Update all code styles
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
local Clustorio = require("modules/clusterio/api")
|
||||
local ExpUtil = require("modules/exp_util")
|
||||
|
||||
|
||||
local Event = {
|
||||
real_handlers = {
|
||||
events = {},
|
||||
@@ -14,7 +13,7 @@ local Event = {
|
||||
on_nth_tick = {},
|
||||
on_init = nil,
|
||||
on_load = nil,
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
local function call_handlers_factory(handlers)
|
||||
@@ -37,7 +36,7 @@ function Event.add(event_name, handler)
|
||||
Event.real_handlers.events[event_name] = call_handlers_factory(handlers)
|
||||
end
|
||||
|
||||
handlers[#handlers+1] = handler
|
||||
handlers[#handlers + 1] = handler
|
||||
end
|
||||
|
||||
function Event.on_nth_tick(tick, handler)
|
||||
@@ -52,7 +51,7 @@ function Event.on_nth_tick(tick, handler)
|
||||
Event.real_handlers.on_nth_tick[tick] = call_handlers_factory(handlers)
|
||||
end
|
||||
|
||||
handlers[#handlers+1] = handler
|
||||
handlers[#handlers + 1] = handler
|
||||
end
|
||||
|
||||
function Event.on_init(handler)
|
||||
@@ -66,7 +65,7 @@ function Event.on_init(handler)
|
||||
Event.real_handlers.on_init = call_handlers_factory(handlers)
|
||||
end
|
||||
|
||||
handlers[#handlers+1] = handler
|
||||
handlers[#handlers + 1] = handler
|
||||
Event.add(Clustorio.events.on_server_startup, handler)
|
||||
end
|
||||
|
||||
@@ -81,7 +80,7 @@ function Event.on_load(handler)
|
||||
Event.real_handlers.on_load = call_handlers_factory(handlers)
|
||||
end
|
||||
|
||||
handlers[#handlers+1] = handler
|
||||
handlers[#handlers + 1] = handler
|
||||
end
|
||||
|
||||
return Event
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
local Color = require("modules/exp_util/include/color")
|
||||
local Game = {}
|
||||
|
||||
@@ -27,9 +26,9 @@ always true: game.players[name].name == name; game.players[index].index == index
|
||||
-- obj <number|string|LuaPlayer>
|
||||
function Game.get_player_from_any(obj)
|
||||
local o_type, p = type(obj)
|
||||
if o_type == 'table' then
|
||||
if o_type == "table" then
|
||||
p = obj
|
||||
elseif o_type == 'string' or o_type == 'number' then
|
||||
elseif o_type == "string" or o_type == "number" then
|
||||
p = game.players[obj]
|
||||
end
|
||||
|
||||
@@ -38,4 +37,4 @@ function Game.get_player_from_any(obj)
|
||||
end
|
||||
end
|
||||
|
||||
return Game
|
||||
return Game
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
local Storage = require("modules/exp_util/storage")
|
||||
local Event = require("modules/exp_legacy/utils/event") --- @dep expcore.gui
|
||||
local mod_gui = require 'mod-gui' --- @dep mod-gui
|
||||
local mod_gui = require "mod-gui" --- @dep mod-gui
|
||||
|
||||
local Gui = {}
|
||||
local data = {}
|
||||
@@ -15,7 +15,7 @@ Storage.register(
|
||||
|
||||
function Gui.uid_name()
|
||||
uid = uid + 1
|
||||
return "Redmew_"..uid
|
||||
return "Redmew_" .. uid
|
||||
end
|
||||
|
||||
-- Associates data with the LuaGuiElement. If data is nil then removes the data
|
||||
@@ -85,43 +85,43 @@ end
|
||||
-- Can only have one handler per element name.
|
||||
-- Guarantees that the element and the player are valid when calling the handler.
|
||||
-- Adds a player field to the event table.
|
||||
Gui.on_checked_state_changed = handler_factory('on_gui_checked_state_changed')
|
||||
Gui.on_checked_state_changed = handler_factory("on_gui_checked_state_changed")
|
||||
|
||||
-- Register a handler for the on_gui_click event for LuaGuiElements with element_name.
|
||||
-- Can only have one handler per element name.
|
||||
-- Guarantees that the element and the player are valid when calling the handler.
|
||||
-- Adds a player field to the event table.
|
||||
Gui.on_click = handler_factory('on_gui_click')
|
||||
Gui.on_click = handler_factory("on_gui_click")
|
||||
|
||||
-- Register a handler for the on_gui_closed event for a custom LuaGuiElements with element_name.
|
||||
-- Can only have one handler per element name.
|
||||
-- Guarantees that the element and the player are valid when calling the handler.
|
||||
-- Adds a player field to the event table.
|
||||
Gui.on_custom_close = handler_factory('on_gui_closed')
|
||||
Gui.on_custom_close = handler_factory("on_gui_closed")
|
||||
|
||||
-- Register a handler for the on_gui_elem_changed event for LuaGuiElements with element_name.
|
||||
-- Can only have one handler per element name.
|
||||
-- Guarantees that the element and the player are valid when calling the handler.
|
||||
-- Adds a player field to the event table.
|
||||
Gui.on_elem_changed = handler_factory('on_gui_elem_changed')
|
||||
Gui.on_elem_changed = handler_factory("on_gui_elem_changed")
|
||||
|
||||
-- Register a handler for the on_gui_selection_state_changed event for LuaGuiElements with element_name.
|
||||
-- Can only have one handler per element name.
|
||||
-- Guarantees that the element and the player are valid when calling the handler.
|
||||
-- Adds a player field to the event table.
|
||||
Gui.on_selection_state_changed = handler_factory('on_gui_selection_state_changed')
|
||||
Gui.on_selection_state_changed = handler_factory("on_gui_selection_state_changed")
|
||||
|
||||
-- Register a handler for the on_gui_text_changed event for LuaGuiElements with element_name.
|
||||
-- Can only have one handler per element name.
|
||||
-- Guarantees that the element and the player are valid when calling the handler.
|
||||
-- Adds a player field to the event table.
|
||||
Gui.on_text_changed = handler_factory('on_gui_text_changed')
|
||||
Gui.on_text_changed = handler_factory("on_gui_text_changed")
|
||||
|
||||
-- Register a handler for the on_gui_value_changed event for LuaGuiElements with element_name.
|
||||
-- Can only have one handler per element name.
|
||||
-- Guarantees that the element and the player are valid when calling the handler.
|
||||
-- Adds a player field to the event table.
|
||||
Gui.on_value_changed = handler_factory('on_gui_value_changed')
|
||||
Gui.on_value_changed = handler_factory("on_gui_value_changed")
|
||||
|
||||
--- Returns the flow where top elements can be added and will be effected by google visibility
|
||||
-- For the toggle to work it must be registed with Gui.allow_player_to_toggle_top_element_visibility(element_name)
|
||||
@@ -129,4 +129,4 @@ Gui.on_value_changed = handler_factory('on_gui_value_changed')
|
||||
-- @treturn LuaGuiElement the top element flow
|
||||
Gui.get_top_element_flow = mod_gui.get_button_flow
|
||||
|
||||
return Gui
|
||||
return Gui
|
||||
|
||||
Reference in New Issue
Block a user