Divergent/mods/PDA Taskboard/gamedata/scripts/z_taskboard_overrides.script

67 lines
1.9 KiB
Plaintext
Raw Normal View History

2024-03-17 20:18:03 -04:00
tasks_info = {}
function create_overrides()
local original_give_talk_message2 = db.actor.give_talk_message2
db.actor.give_talk_message2 = function (...)
if ActorMenu.get_pda_menu():IsShown() then
local _, task_title, task_details, task_icon = ...
table.insert(tasks_info, {
task_title = task_title,
task_details = task_details,
task_icon = task_icon
})
else
original_give_talk_message2(...)
end
end
local original_GetTalkingNpc = mob_trade.GetTalkingNpc
mob_trade.GetTalkingNpc = function (...)
if ui_pda_taskboard_tab.currently_processed_npc_id then
return level.object_by_id(ui_pda_taskboard_tab.currently_processed_npc_id)
else
return original_GetTalkingNpc(...)
end
end
local original_is_talking = db.actor.is_talking
db.actor.is_talking = function (...)
if ui_pda_taskboard_tab.currently_processed_npc_id then
return true
else
return original_is_talking(...)
end
end
local original_get_speaker = _G.get_speaker
_G.get_speaker = function (...)
if ui_pda_taskboard_tab.currently_processed_npc_id then
return level.object_by_id(ui_pda_taskboard_tab.currently_processed_npc_id)
else
return original_get_speaker(...)
end
end
local original_set_active_subdialog = pda.set_active_subdialog
pda.set_active_subdialog = function (section)
if (section == "eptTaskboard") then
return ui_pda_taskboard_tab.get_ui()
else
return original_set_active_subdialog(section)
end
end
end
function clear_tasks_info()
tasks_info = {}
end
function push_task_info(task_info)
table.insert(tasks_info, task_info)
end
function on_game_start()
RegisterScriptCallback("on_game_load", create_overrides)
end