mirror of
https://github.com/PHIDIAS0303/ExpCluster.git
synced 2025-12-30 20:41:41 +09:00
Merge branch 'core'
This commit is contained in:
@@ -29,7 +29,7 @@ function Gui._get_data(key) return Gui_data[key] end
|
|||||||
function Gui:_load_parts(parts)
|
function Gui:_load_parts(parts)
|
||||||
for _,part in pairs(parts) do
|
for _,part in pairs(parts) do
|
||||||
verbose('Gui Extraction: '..part)
|
verbose('Gui Extraction: '..part)
|
||||||
self[part] = require('/GuiParts/'..part)
|
self[part] = require('GuiParts/'..part)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -17,11 +17,11 @@ Pass a table with the names of the objects you want and it will be return in tha
|
|||||||
|
|
||||||
local StdExpCoreLib = {}
|
local StdExpCoreLib = {}
|
||||||
|
|
||||||
require('/commands')
|
require('commands')
|
||||||
StdExpCoreLib.Ranking = require('/ranking')
|
StdExpCoreLib.Ranking = require('ranking')
|
||||||
StdExpCoreLib.Server = require('/server')
|
StdExpCoreLib.Server = require('server')
|
||||||
StdExpCoreLib.Sync = require('/sync')
|
StdExpCoreLib.Sync = require('sync')
|
||||||
StdExpCoreLib.Gui = require('/gui')
|
StdExpCoreLib.Gui = require('gui')
|
||||||
verbose('Begain Gui Part Loading')
|
verbose('Begain Gui Part Loading')
|
||||||
StdExpCoreLib.Gui:_load_parts{
|
StdExpCoreLib.Gui:_load_parts{
|
||||||
'inputs',
|
'inputs',
|
||||||
|
|||||||
@@ -214,9 +214,6 @@ setmetatable(defines.lightcolor, _mt.lightcolor)
|
|||||||
-- @module Color
|
-- @module Color
|
||||||
-- @usage local Color = require('stdlib/color/color')
|
-- @usage local Color = require('stdlib/color/color')
|
||||||
|
|
||||||
--require 'stdlib/defines/color'
|
|
||||||
local fail_if_missing = require 'game'['fail_if_missing']
|
|
||||||
|
|
||||||
local Color = {} --luacheck: allow defined top
|
local Color = {} --luacheck: allow defined top
|
||||||
|
|
||||||
--- Set a value for the alpha channel in the given color table.
|
--- Set a value for the alpha channel in the given color table.
|
||||||
@@ -266,7 +263,8 @@ end
|
|||||||
-- @tparam[opt=1] float alpha the alpha value to set; such that ***[ 0 ⋜ value ⋜ 1 ]***
|
-- @tparam[opt=1] float alpha the alpha value to set; such that ***[ 0 ⋜ value ⋜ 1 ]***
|
||||||
-- @treturn Concepts.Color a color table with RGB converted from Hex and with alpha
|
-- @treturn Concepts.Color a color table with RGB converted from Hex and with alpha
|
||||||
function Color.from_hex(hex, alpha)
|
function Color.from_hex(hex, alpha)
|
||||||
fail_if_missing(hex, "missing color hex value")
|
if not _G.Game then error('StdLib/Game not loaded') end
|
||||||
|
_G.Game.fail_if_missing(hex, "missing color hex value")
|
||||||
if hex:find("#") then hex = hex:sub(2) end
|
if hex:find("#") then hex = hex:sub(2) end
|
||||||
if not(#hex == 6) then error("invalid color hex value: "..hex) end
|
if not(#hex == 6) then error("invalid color hex value: "..hex) end
|
||||||
local number = tonumber(hex, 16)
|
local number = tonumber(hex, 16)
|
||||||
|
|||||||
@@ -5,9 +5,6 @@
|
|||||||
-- @module Event
|
-- @module Event
|
||||||
-- @usage require('stdlib/event/event')
|
-- @usage require('stdlib/event/event')
|
||||||
|
|
||||||
local fail_if_missing = require 'game'['fail_if_missing']
|
|
||||||
local Game = require 'game'
|
|
||||||
|
|
||||||
local Event = { --luacheck: allow defined top
|
local Event = { --luacheck: allow defined top
|
||||||
_registry = {},
|
_registry = {},
|
||||||
core_events = {
|
core_events = {
|
||||||
@@ -58,7 +55,8 @@ end]]
|
|||||||
-- @tparam function handler Function to call when event is triggered
|
-- @tparam function handler Function to call when event is triggered
|
||||||
-- @treturn Event
|
-- @treturn Event
|
||||||
function Event.register(event, handler)
|
function Event.register(event, handler)
|
||||||
fail_if_missing(event, "missing event argument")
|
if not _G.Game then error('StdLib/Game not loaded') end
|
||||||
|
_G.Game.fail_if_missing(event, "missing event argument")
|
||||||
|
|
||||||
event = (type(event) == "table" and event) or {event}
|
event = (type(event) == "table" and event) or {event}
|
||||||
|
|
||||||
@@ -146,8 +144,9 @@ end
|
|||||||
-- @tparam function handler to remove
|
-- @tparam function handler to remove
|
||||||
-- @return Event
|
-- @return Event
|
||||||
function Event.remove(event, handler)
|
function Event.remove(event, handler)
|
||||||
fail_if_missing(event, "missing event argument")
|
if not _G.Game then error('StdLib/Game not loaded') end
|
||||||
fail_if_missing(handler, "missing handler argument")
|
_G.Game.fail_if_missing(event, "missing event argument")
|
||||||
|
_G.Game.fail_if_missing(handler, "missing handler argument")
|
||||||
|
|
||||||
event = (type(event) == "table" and event) or {event}
|
event = (type(event) == "table" and event) or {event}
|
||||||
|
|
||||||
|
|||||||
@@ -17,12 +17,12 @@ Pass a table with the names of the objects you want and it will be return in tha
|
|||||||
|
|
||||||
local StdLib = {}
|
local StdLib = {}
|
||||||
|
|
||||||
require('/table')
|
require('table')
|
||||||
require('/string')
|
require('string')
|
||||||
require('/time')
|
require('time')
|
||||||
StdLib.Color = require('/color')
|
StdLib.Color = require('color')
|
||||||
StdLib.Game = require('/game')
|
StdLib.Game = require('game')
|
||||||
StdLib.Event = require('/event')
|
StdLib.Event = require('event')
|
||||||
|
|
||||||
return function(rtn)
|
return function(rtn)
|
||||||
local _return = {}
|
local _return = {}
|
||||||
|
|||||||
11
control.lua
11
control.lua
@@ -33,9 +33,16 @@ verbose('============================= START =============================')
|
|||||||
require_return_err = false -- Set to false when removing files; set to true for debuging
|
require_return_err = false -- Set to false when removing files; set to true for debuging
|
||||||
_require = require
|
_require = require
|
||||||
require = function(path)
|
require = function(path)
|
||||||
|
local _path = path
|
||||||
|
if string.sub(path,1) ~= '/' then path = '/'..path end
|
||||||
local _return = {pcall(_require,path)}
|
local _return = {pcall(_require,path)}
|
||||||
if not table.remove(_return, 1) then verbose('Failed to load: '..path..' ('.._return[1]..')') if require_return_err then error(unpack(_return)) end
|
if not table.remove(_return, 1) then
|
||||||
else verbose('Loaded: '..path) end
|
local __return = {pcall(_require,'/..'..path)}
|
||||||
|
if not table.remove(__return, 1) then
|
||||||
|
verbose('Failed to load: '.._path..' ('.._return[1]..')')
|
||||||
|
if require_return_err then error(unpack(_return)) end
|
||||||
|
else verbose('Loaded: '.._path) return unpack(__return) end
|
||||||
|
else verbose('Loaded: '.._path) end
|
||||||
return unpack(_return)
|
return unpack(_return)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user