mirror of
https://github.com/PHIDIAS0303/factorio-mod-PHI.git
synced 2026-01-01 04:31:40 +09:00
Update
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "PHI-EQ",
|
"name": "PHI-EQ",
|
||||||
"version": "1.1.9",
|
"version": "1.1.10",
|
||||||
"factorio_version": "1.1",
|
"factorio_version": "1.1",
|
||||||
"date": "2023-04-19",
|
"date": "2023-04-19",
|
||||||
"title": "Phidias Equipment",
|
"title": "Phidias Equipment",
|
||||||
|
|||||||
@@ -1,34 +1,21 @@
|
|||||||
local function clock_display(sec)
|
local function clock_display(sec)
|
||||||
if sec == nil then
|
|
||||||
return 0
|
|
||||||
end
|
|
||||||
|
|
||||||
local sym = ''
|
|
||||||
|
|
||||||
if sec < 0 then
|
|
||||||
sec = math.abs(sec)
|
|
||||||
sym = '- '
|
|
||||||
end
|
|
||||||
|
|
||||||
local s = math.floor(sec) % 60
|
local s = math.floor(sec) % 60
|
||||||
local m = math.floor(sec / 60) % 60
|
local m = math.floor(sec / 60) % 60
|
||||||
|
|
||||||
if sec > 3599 then
|
if sec > 3599 then
|
||||||
local h = math.floor(sec / 3600)
|
local h = math.floor(sec / 3600)
|
||||||
return sym .. string.format('%d:%02d:%02d', h, m, s)
|
return string.format('%d:%02d:%02d', h, m, s)
|
||||||
else
|
else
|
||||||
return sym .. string.format('%d:%02d', m, s)
|
return string.format('%d:%02d', m, s)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
script.on_nth_tick(60, function(event)
|
script.on_nth_tick(60, function(event)
|
||||||
clock_display(math.floor(game.tick / 60))
|
|
||||||
|
|
||||||
for _, player in pairs(game.connected_players) do
|
for _, player in pairs(game.connected_players) do
|
||||||
if player.gui.top.phi_clock == nil then
|
if player.gui.top.phi_clock == nil then
|
||||||
player.gui.top.add{type='button', name='phi_clock'}
|
player.gui.top.add{type='button', name='phi_clock'}
|
||||||
end
|
end
|
||||||
|
|
||||||
player.gui.top.phi_clock.caption = clock_display(sec)
|
player.gui.top.phi_clock.caption = clock_display(math.floor(event.tick / 60))
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|||||||
Reference in New Issue
Block a user