Divergent/mods/Banjajis Task Givers Demise/gamedata/scripts/task_manager_monkeypatch_ba...

38 lines
1.1 KiB
Plaintext
Raw Normal View History

2024-03-17 20:18:03 -04:00
-- Modified by Banjaji's Task givers demise
-- 2022.04.01
-- * Added a check for cancelled tasks so that tm_dynamic.ltx can have "condlist_[nr] = {condition_to_check} cancel"
-- to fail a quest with different outcome from ordinary task failure. In essence when condition is true then the task
-- can have on_fail or on_cancel functions run.
--' <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD>
task_manager.CRandomTask.task_fail = function(self, p1)
if (db.actor == nil or device().precache_frame > 1) then
return false
end
local tsk = self.task_info[p1]
if tsk == nil then
printe("!ERROR: CRandomTask:task_fail %s task is nil!",p1)
return false
end
if (tsk.forced_status == "fail") then
tsk.forced_status = nil
tsk.last_check_task = "fail"
elseif (tsk.forced_status == "complete") then
return false
end
-- Banjaji: task.ltx can have "condlist_[nr] = {condition_to_check} cancel" to fail a quest with different outcome from ordinary task failure (on_fail vs on_cancel)
if (tsk.last_check_task == "cancel") then
self:set_task_cancelled(p1)
return false
end
if (tsk.last_check_task == "fail") then
return true
end
return false
end