z_mirror/TaskList
git clone https://git.raiguard.me/z_mirror/TaskList
4a85a42
austinrobichaux18/Twiggy/AddPriorityAndArea
1local active_task_button =require ( "scripts.gui.active-task-button" ) 2local tasks_gui =require ( "scripts.gui.tasks.index" ) 3 4local player_data ={} 5 6--- Initializes the player's `storage` table. 7--- @param player LuaPlayer 8function player_data . init ( player ) 9--- @class PlayerTable 10storage . players [ player . index ] ={ 11--- @type number[] 12completed_tasks ={} , 13flags ={} , 14--- @type PlayerGuis 15guis ={} , 16--- @type number[] 17tasks ={} , 18} 19end 20 21--- @class PlayerGuis 22--- @field active_task_button LuaGuiElement? 23--- @field edit_task EditTaskGui? 24--- @field tasks TasksGui? 25 26--- Refreshes the player's data, including GUIs, based on changes. 27--- @param player LuaPlayer 28--- @param player_table PlayerTable 29function player_data . refresh ( player , player_table ) 30local TasksGui =player_table . guis . tasks 31if TasksGui then 32TasksGui : destroy () 33end 34tasks_gui . new ( player , player_table ) 35 36local EditTaskGui =player_table . guis . edit_task 37if EditTaskGui then 38EditTaskGui : destroy () 39end 40 41active_task_button . destroy ( player_table ) 42if player . mod_settings [ "tlst-show-active-task" ]. value ~= "off" then 43active_task_button . build ( player , player_table ) 44end 45end 46 47return player_data