z_mirror/TaskList

git clone https://git.raiguard.me/z_mirror/TaskList

raiguardStart adding task details GUIbbcaa7a

task-details-gui
709 B32 linesraw
1local tasks_gui = require("scripts.gui.tasks.index")
2
3local player_data = {}
4
5--- Initializes the player's `global` table.
6--- @param player LuaPlayer
7function player_data.init(player)
8  --- @class PlayerTable
9  global.players[player.index] = {
10    completed_tasks = {},
11    flags = {},
12    guis = {
13      --- @type table<number, TaskGui>
14      task = {},
15    },
16    tasks = {},
17  }
18end
19
20--- Refreshes the player's data, including GUIs, based on changes.
21--- @param player LuaPlayer
22--- @param player_table PlayerTable
23function player_data.refresh(player, player_table)
24  local Gui = player_table.guis.tasks
25  if Gui then
26    Gui:destroy()
27  end
28
29  tasks_gui.new(player, player_table)
30end
31
32return player_data