ExpLib always in global now

This commit is contained in:
Cooldude2606
2018-06-01 00:58:02 +01:00
parent 121dcbe70e
commit 22d3efc4a1
2 changed files with 17 additions and 19 deletions

View File

@@ -238,13 +238,6 @@ function Sync.emit_data()
game.write_file('server-info.json',table.json(info),false,0) game.write_file('server-info.json',table.json(info),false,0)
end end
-- will auto replace the file every 5 min by default
script.on_event('on_tick',function(event)
local time = Sync.info.time_period[1]
if (event.tick%time)==0 then Sync.update() Sync.emit_data() end
end)
function Sync:on_init()
--- Used to return and set the current IRL time; not very good need a better way to do this --- Used to return and set the current IRL time; not very good need a better way to do this
-- @usage Sync.time('Sun Apr 1 18:44:30 UTC 2018') -- @usage Sync.time('Sun Apr 1 18:44:30 UTC 2018')
-- @usage Sync.time -- string -- @usage Sync.time -- string
@@ -258,8 +251,16 @@ function Sync:on_init()
info.time_set[2] = tick_to_display_format(game.tick) info.time_set[2] = tick_to_display_format(game.tick)
return true return true
end,function() local info = Sync.info return info.time..' (+'..(game.tick-info.time_set[1])..' Ticks)' end) end,function() local info = Sync.info return info.time..' (+'..(game.tick-info.time_set[1])..' Ticks)' end)
-- will auto replace the file every 5 min by default
script.on_event('on_tick',function(event)
local time = Sync.info.time_period[1]
if (event.tick%time)==0 then Sync.update() Sync.emit_data() end
end)
function Sync:on_init()
-- updates installed mods -- updates installed mods
--Sync.info{mods=table.keys(loaded_modules)} Sync.info{mods=table.keys(loaded_modules)}
-- optinal dependies -- optinal dependies
if loaded_modules.Gui then verbose('ExpGamingCore.Gui is installed; Loading gui lib') require(module_path..'/src/gui') end if loaded_modules.Gui then verbose('ExpGamingCore.Gui is installed; Loading gui lib') require(module_path..'/src/gui') end
if loaded_modules.Ranking then verbose('ExpGamingCore.Ranking is installed; Loading ranking lib') require(module_path..'/src/ranking') end if loaded_modules.Ranking then verbose('ExpGamingCore.Ranking is installed; Loading ranking lib') require(module_path..'/src/ranking') end

View File

@@ -161,9 +161,6 @@ function ExpLib.gui_tree(root)
return tree return tree
end end
-- unpacks lib to _G on module init -- bypasses the module sandbox and places functions into _G
function ExpLib.on_init(self) ExpLib:unpack_to_G()
self:unpack_to_G()
end
return ExpLib return ExpLib