From 812dde4e02090851acbc2a64d802674af687f021 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Mon, 17 Jun 2024 04:53:50 +0900 Subject: [PATCH] . --- {PHI-XC => OLD/PHI-XC}/.editorconfig | 0 {PHI-XC => OLD/PHI-XC}/.luacheckrc | 0 {PHI-XC => OLD/PHI-XC}/changelog.txt | 0 {PHI-XC => OLD/PHI-XC}/control.lua | 0 {PHI-XC => OLD/PHI-XC}/info.json | 0 {PHI-XC => OLD/PHI-XC}/thumbnail.png | Bin PHI-CL/control.lua | 23 +++++++++++++++++++++++ PHI-CL/data.lua | 2 -- PHI-CL/locale/en/locale.cfg | 1 + PHI-CL/locale/ja/locale.cfg | 1 + PHI-CL/locale/zh-CN/locale.cfg | 1 + PHI-CL/locale/zh-TW/locale.cfg | 1 + PHI-CL/main.lua | 2 ++ PHI-CL/settings.lua | 24 ++++++++++++------------ 14 files changed, 41 insertions(+), 14 deletions(-) rename {PHI-XC => OLD/PHI-XC}/.editorconfig (100%) rename {PHI-XC => OLD/PHI-XC}/.luacheckrc (100%) rename {PHI-XC => OLD/PHI-XC}/changelog.txt (100%) rename {PHI-XC => OLD/PHI-XC}/control.lua (100%) rename {PHI-XC => OLD/PHI-XC}/info.json (100%) rename {PHI-XC => OLD/PHI-XC}/thumbnail.png (100%) create mode 100644 PHI-CL/control.lua diff --git a/PHI-XC/.editorconfig b/OLD/PHI-XC/.editorconfig similarity index 100% rename from PHI-XC/.editorconfig rename to OLD/PHI-XC/.editorconfig diff --git a/PHI-XC/.luacheckrc b/OLD/PHI-XC/.luacheckrc similarity index 100% rename from PHI-XC/.luacheckrc rename to OLD/PHI-XC/.luacheckrc diff --git a/PHI-XC/changelog.txt b/OLD/PHI-XC/changelog.txt similarity index 100% rename from PHI-XC/changelog.txt rename to OLD/PHI-XC/changelog.txt diff --git a/PHI-XC/control.lua b/OLD/PHI-XC/control.lua similarity index 100% rename from PHI-XC/control.lua rename to OLD/PHI-XC/control.lua diff --git a/PHI-XC/info.json b/OLD/PHI-XC/info.json similarity index 100% rename from PHI-XC/info.json rename to OLD/PHI-XC/info.json diff --git a/PHI-XC/thumbnail.png b/OLD/PHI-XC/thumbnail.png similarity index 100% rename from PHI-XC/thumbnail.png rename to OLD/PHI-XC/thumbnail.png diff --git a/PHI-CL/control.lua b/PHI-CL/control.lua new file mode 100644 index 0000000..1d2f94f --- /dev/null +++ b/PHI-CL/control.lua @@ -0,0 +1,23 @@ +local function clock_display(sec) + local s = math.floor(sec) % 60 + local m = math.floor(sec / 60) % 60 + + if sec > 3599 then + local h = math.floor(sec / 3600) + return string.format('%d:%02d:%02d', h, m, s) + else + return string.format('%d:%02d', m, s) + end +end + +if settings.startup['PHI-XC'].value then + script.on_nth_tick(60, function(event) + for _, player in pairs(game.connected_players) do + if player.gui.top.phi_clock == nil then + player.gui.top.add{type='button', name='phi_clock'} + end + + player.gui.top.phi_clock.caption = clock_display(math.floor(event.tick / 60)) + end + end) +end diff --git a/PHI-CL/data.lua b/PHI-CL/data.lua index caef967..253bc41 100644 --- a/PHI-CL/data.lua +++ b/PHI-CL/data.lua @@ -1,5 +1,3 @@ -local alpha_order = {'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm'} --- local graphics_location = '__PHI-EN__/graphics/' local items = require 'config' local main = require 'main' local file_stage = 1 diff --git a/PHI-CL/locale/en/locale.cfg b/PHI-CL/locale/en/locale.cfg index c4a096d..0a27058 100644 --- a/PHI-CL/locale/en/locale.cfg +++ b/PHI-CL/locale/en/locale.cfg @@ -720,6 +720,7 @@ PHI-EN=Energy PHI-MB=Megabase PHI-WE=Military PHI-EQ=Equipment +PHI-XC=Clock PHI-EN-SOLAR-TIER=Solar Panel PHI-EN-STEAM-TIER=Steam engine PHI-EN-NUCLEAR-TIER=Nuclear reactor diff --git a/PHI-CL/locale/ja/locale.cfg b/PHI-CL/locale/ja/locale.cfg index 2e4ffd3..8f1b7fc 100644 --- a/PHI-CL/locale/ja/locale.cfg +++ b/PHI-CL/locale/ja/locale.cfg @@ -718,6 +718,7 @@ PHI-EN=エネルギー PHI-MB=メガベース PHI-WE=軍事 PHI-EQ=設備 +PHI-XC=時計 PHI-EN-SOLAR-TIER=ソーラーパネル PHI-EN-STEAM-TIER=蒸気機関 PHI-EN-NUCLEAR-TIER=原子炉 diff --git a/PHI-CL/locale/zh-CN/locale.cfg b/PHI-CL/locale/zh-CN/locale.cfg index 9ab7613..dc39658 100644 --- a/PHI-CL/locale/zh-CN/locale.cfg +++ b/PHI-CL/locale/zh-CN/locale.cfg @@ -718,6 +718,7 @@ PHI-EN=能量 PHI-MB=大型基地 PHI-WE=軍事 PHI-EQ=設備 +PHI-XC=時鐘 PHI-EN-SOLAR-TIER=太陽能板 PHI-EN-STEAM-TIER=蒸汽發電機 PHI-EN-NUCLEAR-TIER=核能反應爐 diff --git a/PHI-CL/locale/zh-TW/locale.cfg b/PHI-CL/locale/zh-TW/locale.cfg index 9ab7613..dc39658 100644 --- a/PHI-CL/locale/zh-TW/locale.cfg +++ b/PHI-CL/locale/zh-TW/locale.cfg @@ -718,6 +718,7 @@ PHI-EN=能量 PHI-MB=大型基地 PHI-WE=軍事 PHI-EQ=設備 +PHI-XC=時鐘 PHI-EN-SOLAR-TIER=太陽能板 PHI-EN-STEAM-TIER=蒸汽發電機 PHI-EN-NUCLEAR-TIER=核能反應爐 diff --git a/PHI-CL/main.lua b/PHI-CL/main.lua index 86cb6c1..d654806 100644 --- a/PHI-CL/main.lua +++ b/PHI-CL/main.lua @@ -1,3 +1,5 @@ +local alpha_order = {'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm'} +-- local graphics_location = '__PHI-EN__/graphics/' local main = {} -- entity diff --git a/PHI-CL/settings.lua b/PHI-CL/settings.lua index 14885e0..d3635bb 100644 --- a/PHI-CL/settings.lua +++ b/PHI-CL/settings.lua @@ -5,37 +5,38 @@ data:extend({ setting_type = 'startup', default_value = true, order = 'A1' - }, - { + }, { type = 'bool-setting', name = 'PHI-MB', setting_type = 'startup', default_value = true, order = 'A2' - }, - { + }, { type = 'bool-setting', name = 'PHI-WE', setting_type = 'startup', default_value = true, order = 'A3' - }, - { + }, { type = 'bool-setting', name = 'PHI-EQ', setting_type = 'startup', default_value = true, order = 'A6' - }, - { + }, { type = 'int-setting', name = 'PHI-XW-WATER', setting_type = 'startup', default_value = 1, allowed_values = {0, 1, 2, 3, 4, 5}, order = 'A7' - }, - { + }, { + type = 'bool-setting', + name = 'PHI-XC', + setting_type = 'startup', + default_value = true, + order = 'A8' + }, { type = 'int-setting', name = 'PHI-EN-SOLAR-TIER', setting_type = 'startup', @@ -105,8 +106,7 @@ data:extend({ default_value = 3, allowed_values = {1, 2, 3}, order = 'C7' - }, - { + }, { type = 'int-setting', name = 'PHI-WE-LASER-TIER', setting_type = 'startup',