Divergent/mods/Stashes From Journals/gamedata/scripts/stash_journal.script

32 lines
1.8 KiB
Plaintext

---==================================================================================================================---
--- ---
--- Original Author(s) : NLTP_ASHES ---
--- Edited : N/A ---
--- Date : 05/11/2023 ---
--- License : Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0) ---
--- ---
--- Script used to manage the actions with the journal item. ---
--- ---
---==================================================================================================================---
--- Function called to get the text displayed when right clicking on a journal.
--- @param obj game_object
--- @return string
function menu_read(obj)
-- Check if item is in player inventory
local owner = obj:parent()
if not (owner and owner:id() == AC_ID) then return end
-- Return tool tip text
return game.translate_string("st_sj_read")
end
--- Function called when reading a journal to award the player a stash.
--- @param obj game_object
--- @return nil
function read(obj)
-- Give stash to player
xr_effects.reward_stash(nil,nil,{"false"})
-- Delete journal
alife_release_id(obj:id())
end