mirror of
https://github.com/PHIDIAS0303/ExpCluster.git
synced 2025-12-30 20:41:41 +09:00
Added Sync.time
This commit is contained in:
@@ -132,6 +132,8 @@ function Sync.info(set)
|
|||||||
if not global.exp_core.sync then global.exp_core.sync = {
|
if not global.exp_core.sync then global.exp_core.sync = {
|
||||||
server_name='Factorio Server',
|
server_name='Factorio Server',
|
||||||
reset_time='On Demand',
|
reset_time='On Demand',
|
||||||
|
time='Day Mth 00 00:00:00 UTC Year',
|
||||||
|
time_set=0,
|
||||||
last_update=0,
|
last_update=0,
|
||||||
time_period=18000,
|
time_period=18000,
|
||||||
online=#game.connected_players,
|
online=#game.connected_players,
|
||||||
@@ -152,6 +154,21 @@ function Sync.info(set)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- used to return the global time and set its value
|
||||||
|
-- @usage Sync.time('Sun Apr 1 18:44:30 UTC 2018')
|
||||||
|
-- @tparam[opt=nil] string the date time to be set
|
||||||
|
-- @return either true false if setting or the date time and tick off set
|
||||||
|
function Sync.time(set)
|
||||||
|
local info = Sync.info()
|
||||||
|
if not set then return info.time..'('..(game.tick-info.time_set)..')'
|
||||||
|
else
|
||||||
|
if not is_type(set,'string') then return false end
|
||||||
|
info.time = set
|
||||||
|
info.time_set = game.tick
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
--- called to update values inside of the info
|
--- called to update values inside of the info
|
||||||
-- @usage Sync.update()
|
-- @usage Sync.update()
|
||||||
-- @return all of the new info
|
-- @return all of the new info
|
||||||
|
|||||||
Reference in New Issue
Block a user