mirror of
https://github.com/Refactorio/RedMew.git
synced 2025-01-12 02:28:02 +02:00
Removed unused files #152
This commit is contained in:
parent
109554c91a
commit
f63050c1a4
@ -1,40 +0,0 @@
|
||||
-- Colors Module
|
||||
-- Collection of common colors
|
||||
-- @author Denis Zholob (DDDGamer)
|
||||
-- github: https://github.com/DDDGamer/factorio-dz-softmod
|
||||
-- ======================================================= --
|
||||
|
||||
Colors = {
|
||||
black = { r=0, g=0, b=0 },
|
||||
darkgrey = { r=65, g=65, b=65 },
|
||||
grey = { r=130, g=130, b=130 },
|
||||
lightgrey = { r=190, g=190, b=190 },
|
||||
white = { r=255, g=255, b=255 },
|
||||
|
||||
darkgreen = { r=0, g=130, b=0 },
|
||||
green = {r=25, g=255, b=51 },
|
||||
lightgreen = { r=130, g=255, b=130 },
|
||||
|
||||
cyan = { r=20, g=220, b=190 },
|
||||
|
||||
darkblue = { r=30, g=30, b=180 },
|
||||
blue = { r=0, g=100, b=255 },
|
||||
lightblue = { r=20, g=180, b=235 },
|
||||
|
||||
darkpurple = { r=160, g=50, b=255 },
|
||||
purple = { r=179, g=102, b=255 },
|
||||
violet = { r=130, g=130, b=255 },
|
||||
|
||||
pink = { r=255, g= 0, b=255 },
|
||||
|
||||
darkred = { r=160, g=0, b=0 },
|
||||
red = { r=255, g=0, b=25 },
|
||||
lightred = { r=255, g=130, b=130 },
|
||||
|
||||
darkorange = { r=242, g=70, b=13 },
|
||||
orange = { r=255, g=140, b=25 },
|
||||
yellow = { r=255, g=255, b=0 },
|
||||
brown = { r=0.6, g=0.4, b=0.1 },
|
||||
}
|
||||
|
||||
return Colors
|
@ -1,26 +0,0 @@
|
||||
-- Time Helper Module
|
||||
-- Common Time functions
|
||||
-- @author Denis Zholob (DDDGamer)
|
||||
-- github: https://github.com/DDDGamer/factorio-dz-softmod
|
||||
-- ======================================================= --
|
||||
|
||||
Time = {}
|
||||
|
||||
-- Rounding helper function
|
||||
function round(number, precision)
|
||||
return math.floor(number*math.pow(10,precision)+0.5) / math.pow(10,precision)
|
||||
end
|
||||
|
||||
-- Returns hours converted from game ticks
|
||||
function Time.tick_to_hour(t)
|
||||
local time = game.speed * (t / 60) / 3600
|
||||
return round(time, 1)
|
||||
end
|
||||
|
||||
-- Returns hours converted from game ticks
|
||||
function Time.tick_to_min(t)
|
||||
local time = game.speed * (t / 60) / 60
|
||||
return round(time, 1)
|
||||
end
|
||||
|
||||
return Time
|
@ -1,10 +0,0 @@
|
||||
local player_inventories = {
|
||||
defines.inventory.player_vehicle,
|
||||
defines.inventory.player_armor,
|
||||
defines.inventory.player_tools,
|
||||
defines.inventory.player_guns,
|
||||
defines.inventory.player_ammo,
|
||||
defines.inventory.player_quickbar,
|
||||
defines.inventory.player_main,
|
||||
defines.inventory.player_trash,
|
||||
}
|
@ -1,196 +0,0 @@
|
||||
-- Dependencies
|
||||
require "gui-2"
|
||||
require "Time"
|
||||
|
||||
-- Master button controlls the visibility of the readme window
|
||||
local MASTER_BTN = {name = "btn_readme", caption = "Read Me", tooltip = "Server rules, information, and more"}
|
||||
-- Master frame(window), holds all the contents
|
||||
local MASTER_FRAME = {name = "frame_readme"}
|
||||
|
||||
-- Tabs and the corresponding buttons to put in the master frame
|
||||
local FRAME_TABS = {
|
||||
rules = {btn = {name = "btn_readme_rules", caption = "Server Rules", tooltip = ""}, win = {name = "win_readme_rules"}},
|
||||
comm = {btn = {name = "btn_readme_help", caption = "Info", tooltip = ""}, win = {name = "win_readme_help"}},
|
||||
resources = {btn = {name = "btn_readme_resources", caption = "Changelog", tooltip = ""}, win = {name = "win_readme_resources"}},
|
||||
players = {btn = {name = "btn_readme_players", caption = "Players", tooltip = ""}, win = {name = "win_readme_players"}},
|
||||
about = {btn = {name = "btn_readme_about", caption = "About", tooltip = ""}, win = {name = "win_readme_about"}},
|
||||
close = {
|
||||
btn = {name = "btn_readme_close", caption = "Close", tooltip = ""},
|
||||
win = {name = "win_readme_close"} -- no window created, just for consistency to use in loop
|
||||
}
|
||||
}
|
||||
|
||||
-- Static Content
|
||||
local CONTENT = {
|
||||
rules = {""},
|
||||
comm = {""},
|
||||
resources = {""},
|
||||
about = {""}
|
||||
}
|
||||
|
||||
-- On Player Join
|
||||
-- Display the master button, and show rules if new player
|
||||
-- @param event on_player_joined_game
|
||||
function on_player_join(event)
|
||||
local player = game.players[event.player_index]
|
||||
draw_master_readme_btn(player)
|
||||
-- Force a gui refresh in case there where updates
|
||||
if player.gui.center[MASTER_FRAME.name] ~= nil then
|
||||
player.gui.center[MASTER_FRAME.name].destroy()
|
||||
end
|
||||
-- Show readme window (rules) when player (not admin) first joins, but not at later times
|
||||
if not player.admin and Time.tick_to_min(player.online_time) < 1 then
|
||||
draw_master_readme_frame(player, FRAME_TABS.rules.win.name)
|
||||
end
|
||||
end
|
||||
|
||||
-- On Player Leave
|
||||
-- Clean up the GUI in case this mod gets removed next time
|
||||
-- @param event on_player_left_game
|
||||
function on_player_leave(event)
|
||||
local player = game.players[event.player_index]
|
||||
if player.gui.center[MASTER_FRAME.name] ~= nil then
|
||||
player.gui.center[MASTER_FRAME.name].destroy()
|
||||
end
|
||||
if player.gui.top[MASTER_BTN.name] ~= nil then
|
||||
player.gui.top[MASTER_BTN.name].destroy()
|
||||
end
|
||||
end
|
||||
|
||||
-- On GUI Click
|
||||
-- Depending of what button was click open a different tab
|
||||
-- @param event on_gui_click
|
||||
function on_gui_click(event)
|
||||
local player = game.players[event.player_index]
|
||||
local el_name = event.element.name
|
||||
-- Master frame gui button?
|
||||
if el_name == MASTER_BTN.name then
|
||||
-- Call toggle if frame has been created
|
||||
if (player.gui.center[MASTER_FRAME.name] ~= nil) then
|
||||
GUI.toggle_element(player.gui.center[MASTER_FRAME.name])
|
||||
else
|
||||
-- Call create if it hasnt
|
||||
draw_master_readme_frame(player, FRAME_TABS.rules.win.name)
|
||||
end
|
||||
end
|
||||
-- One of the tabs?
|
||||
for i, frame_tab in pairs(FRAME_TABS) do
|
||||
if el_name == frame_tab.btn.name then
|
||||
draw_master_readme_frame(player, frame_tab.win.name)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- Draws the master readme button on the top of the screen
|
||||
-- @param player
|
||||
function draw_master_readme_btn(player)
|
||||
if player.gui.top[MASTER_BTN.name] == nil then
|
||||
player.gui.top.add {type = "button", name = MASTER_BTN.name, caption = MASTER_BTN.caption, tooltip = MASTER_BTN.tooltip}
|
||||
end
|
||||
end
|
||||
|
||||
-- Draws the master frame and a tab inside it base on arg
|
||||
-- *Recursive (only 1 deep)
|
||||
-- @param player
|
||||
-- @param window_name - which window to display in the frame
|
||||
function draw_master_readme_frame(player, window_name)
|
||||
-- Master frame is already created, just draw a new tab
|
||||
if player.gui.center[MASTER_FRAME.name] ~= nil then
|
||||
-- Rules
|
||||
if window_name == FRAME_TABS.rules.win.name then
|
||||
-- Comm
|
||||
draw_static_content(player.gui.center[MASTER_FRAME.name]["scroll_content"], CONTENT.rules)
|
||||
elseif window_name == FRAME_TABS.comm.win.name then
|
||||
-- Resourses
|
||||
draw_static_content(player.gui.center[MASTER_FRAME.name]["scroll_content"], CONTENT.comm)
|
||||
elseif window_name == FRAME_TABS.resources.win.name then
|
||||
-- About
|
||||
draw_static_content(player.gui.center[MASTER_FRAME.name]["scroll_content"], CONTENT.resources)
|
||||
elseif window_name == FRAME_TABS.about.win.name then
|
||||
-- Players
|
||||
draw_static_content(player.gui.center[MASTER_FRAME.name]["scroll_content"], CONTENT.about)
|
||||
elseif window_name == FRAME_TABS.players.win.name then
|
||||
-- Close
|
||||
draw_players(player.gui.center[MASTER_FRAME.name]["scroll_content"])
|
||||
elseif window_name == FRAME_TABS.close.win.name then
|
||||
GUI.toggle_element(player.gui.center[MASTER_FRAME.name])
|
||||
end
|
||||
else
|
||||
-- create the master frame and call function again to draw specific tab
|
||||
local frame = player.gui.center.add {type = "frame", direction = "vertical", name = MASTER_FRAME.name}
|
||||
-- make a nav container and add nav buttons
|
||||
frame.add {type = "flow", name = "readme_nav", direction = "horizontal"}
|
||||
draw_frame_nav(frame.readme_nav)
|
||||
-- make a tab content container
|
||||
frame.add {type = "scroll-pane", name = "scroll_content", direction = "vertical", vertical_scroll_policy = "always", horizontal_scroll_policy = "auto"}
|
||||
-- Style config for nav
|
||||
frame.readme_nav.style.maximal_width = 600
|
||||
frame.readme_nav.style.minimal_width = 600
|
||||
-- Style config for content
|
||||
frame.scroll_content.style.maximal_height = 500
|
||||
frame.scroll_content.style.minimal_height = 500
|
||||
frame.scroll_content.style.maximal_width = 600
|
||||
frame.scroll_content.style.minimal_width = 600
|
||||
-- Recursive call
|
||||
draw_master_readme_frame(player, window_name)
|
||||
end
|
||||
end
|
||||
|
||||
-- Draws the nav buttons for readme frame
|
||||
-- @param nav_container GUI element to add the buttons to
|
||||
function draw_frame_nav(nav_container)
|
||||
for i, frame_tab in pairs(FRAME_TABS) do
|
||||
nav_container.add {type = "button", name = frame_tab.btn.name, caption = frame_tab.btn.caption, tooltip = frame_tab.btn.tooltip}
|
||||
end
|
||||
end
|
||||
|
||||
-- Draws a list of labels from content passed in
|
||||
-- @param container - gui element to add to
|
||||
-- @param content - array list of string to display
|
||||
function draw_static_content(container, content)
|
||||
GUI.clear_element(container) -- Clear the current info before adding new
|
||||
for i, text in pairs(content) do
|
||||
container.add {type = "label", name = i, caption = text}
|
||||
end
|
||||
end
|
||||
|
||||
-- Draws a list of players on the server with their playtime
|
||||
-- @param container - gui element to add to
|
||||
function draw_players(container)
|
||||
GUI.clear_element(container) -- Clear the current info before adding new
|
||||
|
||||
local table_name = "tbl_readme_players"
|
||||
container.add {type = "label", name = "lbl_player_tile", caption = "=== ALL TIME PLAYERS ==="}
|
||||
container.add {type = "table", name = table_name, column_count = 2}
|
||||
container[table_name].style.minimal_width = 500
|
||||
container[table_name].style.maximal_width = 500
|
||||
container[table_name].add {type = "label", name = "lbl_hours", caption = "Time (h:m)"}
|
||||
container[table_name].add {type = "label", name = "lbl_name", caption = "Name"}
|
||||
|
||||
-- Copy player list into local list
|
||||
local player_list = {}
|
||||
for i, player in pairs(game.players) do
|
||||
table.insert(player_list, {name = player.name, online_time = player.online_time})
|
||||
end
|
||||
|
||||
-- Sort players based on time played
|
||||
table.sort(
|
||||
player_list,
|
||||
function(a, b)
|
||||
return a.online_time > b.online_time
|
||||
end
|
||||
)
|
||||
|
||||
-- Add in gui list
|
||||
for i, player in pairs(player_list) do
|
||||
local total_min = Time.tick_to_min(player.online_time)
|
||||
local time_str = math.floor(total_min / 60) .. ":" .. math.floor(total_min % 60)
|
||||
container[table_name].add {type = "label", name = "lbl_" .. player.name .. "_time", caption = time_str}
|
||||
container[table_name].add {type = "label", name = "lbl_" .. player.name .. "_name", caption = player.name}
|
||||
end
|
||||
end
|
||||
|
||||
-- Event Handlers
|
||||
Event.register(defines.events.on_gui_click, on_gui_click)
|
||||
Event.register(defines.events.on_player_joined_game, on_player_join)
|
||||
Event.register(defines.events.on_player_left_game, on_player_leave)
|
@ -1,31 +0,0 @@
|
||||
-- GUI Helper Module
|
||||
-- Common GUI functions
|
||||
-- @author Denis Zholob (DDDGamer)
|
||||
-- github: https://github.com/DDDGamer/factorio-dz-softmod
|
||||
-- ======================================================= --
|
||||
|
||||
GUI = {}
|
||||
|
||||
-- Destroyes the children of a GUI element
|
||||
-- @param el <- element to toggle destroy childen of
|
||||
function GUI.clear_element( el )
|
||||
if el ~= nil then
|
||||
for i, child in pairs(el.children_names) do
|
||||
el[child].destroy()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- Toggles element on off (visibility)
|
||||
-- @param el <- element to toggle visibility
|
||||
function GUI.toggle_element( el )
|
||||
if el ~= nil then
|
||||
if el.style.visible == false then
|
||||
el.style.visible = true
|
||||
else
|
||||
el.style.visible = false
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return GUI
|
@ -1,131 +0,0 @@
|
||||
--- Gui module
|
||||
--A 3Ra Gaming revision, original from Factorio-Stdlib by Afforess
|
||||
-- @module Gui
|
||||
Gui = {}
|
||||
|
||||
Gui.Event = {
|
||||
_registry = {},
|
||||
_dispatch = {}
|
||||
}
|
||||
|
||||
--- Registers a function for a given event and matching gui element pattern
|
||||
-- @param event Valid values are defines.event.on_gui_*
|
||||
-- @param gui_element_pattern the name or string regular expression to match the gui element
|
||||
-- @param handler Function to call when event is triggered
|
||||
-- @return #Gui.Event
|
||||
function Gui.Event.register(event, gui_element_pattern, handler)
|
||||
fail_if_missing(event, "missing event name argument")
|
||||
fail_if_missing(gui_element_pattern, "missing gui name or pattern argument")
|
||||
|
||||
if type(gui_element_pattern) ~= "string" then
|
||||
error("gui_element_pattern argument must be a string")
|
||||
end
|
||||
|
||||
if handler == nil then
|
||||
Gui.Event.remove(event, gui_element_pattern)
|
||||
return Gui.Event
|
||||
end
|
||||
|
||||
if not Gui.Event._registry[event] then
|
||||
Gui.Event._registry[event] = {}
|
||||
end
|
||||
Gui.Event._registry[event][gui_element_pattern] = handler
|
||||
|
||||
-- Use custom Gui event dispatcher to pass off the event to the correct sub-handler
|
||||
if not Gui.Event._dispatch[event] then
|
||||
Event.register(event, Gui.Event.dispatch)
|
||||
Gui.Event._dispatch[event] = true
|
||||
end
|
||||
|
||||
return Gui.Event
|
||||
end
|
||||
|
||||
--- Calls the registered handlers
|
||||
-- @param event LuaEvent as created by game.raise_event
|
||||
function Gui.Event.dispatch(event)
|
||||
fail_if_missing(event, "missing event argument")
|
||||
|
||||
local gui_element = event.element
|
||||
if gui_element and gui_element.valid then
|
||||
local gui_element_name = gui_element.name;
|
||||
local gui_element_state = nil;
|
||||
local gui_element_text = nil;
|
||||
|
||||
if event.name == defines.events.on_gui_checked_state_changed then
|
||||
gui_element_state = gui_element.state
|
||||
end
|
||||
|
||||
if event.name == defines.events.on_gui_text_changed then
|
||||
gui_element_text = gui_element.text
|
||||
end
|
||||
|
||||
for gui_element_pattern, handler in pairs(Gui.Event._registry[event.name]) do
|
||||
local match_str = string.match(gui_element_name, gui_element_pattern)
|
||||
if match_str ~= nil then
|
||||
local new_event = { tick = event.tick, name = event.name, _handler = handler, match = match_str, element = gui_element, state=gui_element_state, text=gui_element_text, player_index = event.player_index , _event = event}
|
||||
local success, err = pcall(handler, new_event)
|
||||
if not success then
|
||||
Game.print_all(err)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
--- Removes the handler with matching gui element pattern from the event
|
||||
-- @param event Valid values are defines.event.on_gui_*
|
||||
-- @param gui_element_pattern the name or string regular expression to remove the handler for
|
||||
-- @return #Gui.Event
|
||||
function Gui.Event.remove(event, gui_element_pattern)
|
||||
fail_if_missing(event, "missing event argument")
|
||||
fail_if_missing(gui_element_pattern, "missing gui_element_pattern argument")
|
||||
|
||||
if type(gui_element_pattern) ~= "string" then
|
||||
error("gui_element_pattern argument must be a string")
|
||||
end
|
||||
|
||||
local function tablelength(T)
|
||||
local count = 0
|
||||
for _ in pairs(T) do count = count + 1 end
|
||||
return count
|
||||
end
|
||||
|
||||
if Gui.Event._registry[event] then
|
||||
if Gui.Event._registry[event][gui_element_pattern] then
|
||||
Gui.Event._registry[event][gui_element_pattern] = nil
|
||||
end
|
||||
if tablelength(Gui.Event._registry[event]) == 0 then
|
||||
Event.remove(event, Gui.Event.dispatch)
|
||||
Gui.Event._registry[event] = nil
|
||||
Gui.Event._dispatch[event] = false
|
||||
end
|
||||
end
|
||||
return Gui.Event
|
||||
end
|
||||
|
||||
--- Registers a function for a given gui element name or pattern when the element is clicked
|
||||
-- @param gui_element_pattern the name or string regular expression to match the gui element
|
||||
-- @param handler Function to call when gui element is clicked
|
||||
-- @return #Gui
|
||||
function Gui.on_click(gui_element_pattern, handler)
|
||||
Gui.Event.register(defines.events.on_gui_click, gui_element_pattern, handler)
|
||||
return Gui
|
||||
end
|
||||
|
||||
--- Registers a function for a given gui element name or pattern when the element checked state changes
|
||||
-- @param gui_element_pattern the name or string regular expression to match the gui element
|
||||
-- @param handler Function to call when gui element checked state changes
|
||||
-- @return #Gui
|
||||
function Gui.on_checked_state_changed(gui_element_pattern, handler)
|
||||
Gui.Event.register(defines.events.on_gui_checked_state_changed, gui_element_pattern, handler)
|
||||
return Gui
|
||||
end
|
||||
|
||||
--- Registers a function for a given gui element name or pattern when the element text changes
|
||||
-- @param gui_element_pattern the name or string regular expression to match the gui element
|
||||
-- @param handler Function to call when gui element text changes
|
||||
-- @return #Gui
|
||||
function Gui.on_text_changed(gui_element_pattern, handler)
|
||||
Gui.Event.register(defines.events.on_gui_text_changed, gui_element_pattern, handler)
|
||||
return Gui
|
||||
end
|
@ -1,104 +0,0 @@
|
||||
-- Player List Soft Mod
|
||||
-- Adds a player list sidebar that displays online players along with their online time.
|
||||
-- @author Denis Zholob (DDDGamer)
|
||||
-- github: https://github.com/DDDGamer/factorio-dz-softmod
|
||||
-- ======================================================= --
|
||||
|
||||
-- Dependencies
|
||||
require "gui-2"
|
||||
require "Time"
|
||||
require "Colors"
|
||||
|
||||
|
||||
|
||||
local OWNER = "chpich"
|
||||
|
||||
-- Roles
|
||||
local ROLES = {
|
||||
owner = {tag = "Owner", color = Colors.black}, -- server owner
|
||||
admin = {tag = "Admin", color = Colors.gray} -- server admin
|
||||
}
|
||||
|
||||
-- Regular player ranks (time in hrs)
|
||||
local RANKS =
|
||||
{lvl1 = {time = 0, color = Colors.white, tag = "Engineer Trainee", },
|
||||
lvl2 = {time = 1, color = Colors.green, tag = "Jr. Engineer"},
|
||||
lvl3 = {time = 2, color = Colors.cyan, tag = "Associate Engineer"},
|
||||
lvl4 = {time = 3, color = Colors.blue, tag = "Engineer I"},
|
||||
lvl5 = {time = 4, color = Colors.darkblue, tag = "Intermediate Engineer"},
|
||||
lvl6 = {time = 5, color = Colors.yellow, tag = "Engineer II"},
|
||||
lvl7 = {time = 7, color = Colors.orange, tag = "Sr. Engineer"},
|
||||
lvl8 = {time = 9, color = Colors.darkorange, tag = "Engineer III"},
|
||||
lvl9 = {time = 12, color = Colors.red, tag = "Engineering Specialist"},
|
||||
lvl10 = {time = 15, color = Colors.darkred, tag = "Chief Engineer"},
|
||||
lvl11 = {time = 20, color = Colors.grey, tag = "Sr. Chief Engineer", }}
|
||||
|
||||
|
||||
|
||||
-- When new player joins add the playerlist btn to their GUI
|
||||
-- Redraw the playerlist frame to update with the new player
|
||||
-- @param event on_player_joined_game
|
||||
function on_player_join(event)
|
||||
local player = game.players[event.player_index]
|
||||
draw_playerlist_btn(player)
|
||||
draw_playerlist_frame()
|
||||
end
|
||||
|
||||
-- On Player Leave
|
||||
-- Clean up the GUI in case this mod gets removed next time
|
||||
-- Redraw the playerlist frame to update
|
||||
-- @param event on_player_left_game
|
||||
function on_player_leave(event)
|
||||
local player = game.players[event.player_index]
|
||||
if player.gui.left["frame_playerlist"] ~= nil then
|
||||
player.gui.left["frame_playerlist"].destroy()
|
||||
end
|
||||
if player.gui.top["btn_menu_playerlist"] ~= nil then
|
||||
player.gui.top["btn_menu_playerlist"].destroy()
|
||||
end
|
||||
draw_playerlist_frame()
|
||||
end
|
||||
|
||||
-- Toggle playerlist is called if gui element is playerlist button
|
||||
-- @param event on_gui_click
|
||||
local function on_gui_click(event)
|
||||
local player = game.players[event.player_index]
|
||||
local el_name = event.element.name
|
||||
|
||||
if el_name == "btn_menu_playerlist" then
|
||||
GUI.toggle_element(player.gui.left["frame_playerlist"])
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
-- Add a player to the GUI list
|
||||
-- @param player
|
||||
-- @param p_online
|
||||
-- @param color
|
||||
-- @param tag
|
||||
function add_player_to_list(player, p_online, color, tag)
|
||||
local played_hrs = tostring(Time.tick_to_hour(p_online.online_time))
|
||||
player.gui.left["frame_playerlist"].add {type = "label", style = "caption_label_style", name = p_online.name, caption = {"", played_hrs, " hr - ", p_online.name, " ", "[" .. tag .. "]"}}
|
||||
player.gui.left["frame_playerlist"][p_online.name].style.font_color = color
|
||||
p_online.tag = "[" .. tag .. "]"
|
||||
end
|
||||
|
||||
-- Refresh the playerlist after 10 min
|
||||
-- @param event on_tick
|
||||
function on_tick(event)
|
||||
global.last_refresh = global.last_refresh or 0
|
||||
local cur_time = game.tick / 60
|
||||
local refresh_period = 10 -- 600 seconds (10 min)
|
||||
local refresh_time_passed = cur_time - global.last_refresh
|
||||
if refresh_time_passed > refresh_period then
|
||||
draw_playerlist_frame()
|
||||
global.last_refresh = cur_time
|
||||
end
|
||||
end
|
||||
|
||||
-- Event Handlers
|
||||
Event.register(defines.events.on_gui_click, on_gui_click)
|
||||
Event.register(defines.events.on_player_joined_game, on_player_join)
|
||||
Event.register(defines.events.on_player_left_game, on_player_leave)
|
||||
Event.register(defines.events.on_tick, on_tick)
|
||||
|
Loading…
Reference in New Issue
Block a user