├── .circleci └── config.yml ├── .gitattributes ├── .gitignore ├── LICENSE.md ├── Makefile ├── PKG_COPY ├── PKG_NAME ├── README.md ├── VERSION ├── control.lua ├── data.lua ├── evoGUI.lua ├── graphics ├── gui.pdn └── gui.png ├── info.json ├── locale ├── cs │ └── locale.cfg ├── de │ └── locale.cfg ├── en │ └── locale.cfg ├── he │ └── locale.cfg ├── it │ └── locale.cfg ├── ko │ └── locale.cfg ├── pl │ └── locale.cfg └── ru │ └── locale.cfg ├── prototypes └── styles.lua ├── remote.lua ├── settingsGUI.lua └── value_sensors ├── day_time.lua ├── evolution_factor.lua ├── kill_count.lua ├── play_time.lua ├── player_locations.lua ├── pollution_around_player.lua ├── remote_sensor.lua └── template.lua /.circleci/config.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | jobs: 3 | build: 4 | working_directory: ~/narc0tiq/EvoGUI 5 | parallelism: 1 6 | shell: /bin/bash --login 7 | 8 | environment: 9 | CIRCLE_ARTIFACTS: /tmp/circleci-artifacts 10 | CIRCLE_TEST_REPORTS: /tmp/circleci-test-results 11 | 12 | docker: 13 | - image: circleci/buildpack-deps 14 | 15 | steps: 16 | - checkout 17 | - run: mkdir -pv $CIRCLE_ARTIFACTS $CIRCLE_TEST_REPORTS 18 | - run: sudo apt-get update; sudo apt-get install lua5.2 make zip 19 | - run: rm Makefile 20 | - run: wget https://github.com/narc0tiq/factorio-mod-makefile/raw/master/Makefile 21 | - run: make package clean 22 | 23 | - store_artifacts: 24 | path: pkg/ 25 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | *.lua text 2 | *.json text 3 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .* 2 | 3 | !.git* 4 | 5 | pkg 6 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | The MIT License 2 | 3 | 4 | Copyright (c) 2015-2019 Octav "narc" Sandulescu 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy of 7 | this software and associated documentation files (the "Software"), to deal in 8 | the Software without restriction, including without limitation the rights to 9 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 10 | of the Software, and to permit persons to whom the Software is furnished to do 11 | so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in all 14 | copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 21 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 22 | DEALINGS IN THE SOFTWARE. 23 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | ../factorio-mod-makefile/Makefile -------------------------------------------------------------------------------- /PKG_COPY: -------------------------------------------------------------------------------- 1 | locale 2 | graphics 3 | -------------------------------------------------------------------------------- /PKG_NAME: -------------------------------------------------------------------------------- 1 | EvoGUI 2 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | This is a [Factorio](http://www.factorio.com/) mod. It adds a small UI frame 2 | that informs you of the current biter evolution level, as well as your play 3 | time. 4 | 5 | 6 | ## Many thanks for ## 7 | 8 | * The many downloads so far! Glad you guys are liking it. 9 | * Continuous Integration by CircleCI: [![Circle CI](https://circleci.com/gh/narc0tiq/evoGUI.svg?style=svg)](https://circleci.com/gh/narc0tiq/evoGUI) 10 | * Many, many improvements made by Afforess! Thanks so much, you're the best! 11 | * The wonderful translations contributed by these awesome people: 12 | JoCKeRiL (Hebrew), Rikkilook (Russian), theRustyKnife (Czech), 13 | thomaskneisel and BenediktMagnus (German), diilmac (Polish), 14 | Xagros (Korean), futuroattore86 (Italian). 15 | * Updating assistance by @kylewill0725! 16 | 17 | 18 | ## License ## 19 | 20 | The source of **EvoGUI** is Copyright 2015-2019 Octav "narc" Sandulescu. It 21 | is licensed under the [MIT license][mit], available in this package in the file 22 | [LICENSE.md](LICENSE.md). 23 | 24 | [mit]: http://opensource.org/licenses/mit-license.html 25 | 26 | 27 | ## Statistics ## 28 | 29 | 78 exceptions were caught during the creation of this mod. 30 | -------------------------------------------------------------------------------- /VERSION: -------------------------------------------------------------------------------- 1 | 0.4.601 2 | -------------------------------------------------------------------------------- /control.lua: -------------------------------------------------------------------------------- 1 | require "evoGUI" 2 | 3 | if not evogui then evogui = {} end 4 | 5 | function evogui.log(message) 6 | if game then 7 | for i, p in pairs(game.players) do 8 | p.print(message) 9 | end 10 | else 11 | error(serpent.dump(message, {compact = false, nocode = true, indent = ' '})) 12 | end 13 | end 14 | 15 | 16 | function evogui.format_number(n) -- credit http://richard.warburton.it 17 | local left,num,right = string.match(n,'^([^%d]*%d)(%d*)(.-)$') 18 | return left..(num:reverse():gsub('(%d%d%d)','%1,'):reverse())..right 19 | end 20 | 21 | function string.starts_with(haystack, needle) 22 | return string.sub(haystack, 1, string.len(needle)) == needle 23 | end 24 | 25 | 26 | local octant_names = { 27 | [0] = {"direction.east"}, 28 | [1] = {"direction.southeast"}, 29 | [2] = {"direction.south"}, 30 | [3] = {"direction.southwest"}, 31 | [4] = {"direction.west"}, 32 | [5] = {"direction.northwest"}, 33 | [6] = {"direction.north"}, 34 | [7] = {"direction.northeast"}, 35 | } 36 | 37 | function evogui.get_octant_name(vector) 38 | local radians = math.atan2(vector.y, vector.x) 39 | local octant = math.floor( 8 * radians / (2*math.pi) + 8.5 ) % 8 40 | 41 | return octant_names[octant] 42 | end 43 | 44 | 45 | script.on_init(evogui.mod_init) 46 | script.on_configuration_changed(evogui.mod_update) 47 | 48 | script.on_event(defines.events.on_player_created, function(event) 49 | local status, err = pcall(evogui.new_player, event) 50 | if err then evogui.log({"err_generic", "on_player_created", err}) end 51 | end) 52 | 53 | script.on_event(defines.events.on_tick, function(event) 54 | local status, err = pcall(RemoteSensor.initialize) 55 | if err then evogui.log({"err_generic", "on_tick:remote_initialize", err}) end 56 | local status, err = pcall(evogui.update_gui, event) 57 | if err then evogui.log({"err_generic", "on_tick:update_gui", err}) end 58 | end) 59 | 60 | local last_clicked = nil 61 | local last_checked = nil 62 | 63 | local function raise_on_click(event) 64 | local status, err = pcall(evogui.on_gui_click, event) 65 | 66 | if err then 67 | if event.element.valid then 68 | evogui.log({"err_specific", "on_gui_click", event.element.name, err}) 69 | else 70 | evogui.log({"err_generic", "on_gui_click", err}) 71 | end 72 | end 73 | end 74 | 75 | script.on_event(defines.events.on_gui_checked_state_changed, function(event) 76 | last_checked = event.element.name 77 | 78 | raise_on_click(event) 79 | end) 80 | 81 | script.on_event(defines.events.on_gui_click, function(event) 82 | -- prevent raising on_click twice for the same element 83 | if last_checked ~= nil and last_checked == event.element.name then 84 | return 85 | end 86 | last_clicked = event.element.name 87 | 88 | raise_on_click(event) 89 | end) 90 | -------------------------------------------------------------------------------- /data.lua: -------------------------------------------------------------------------------- 1 | require "prototypes.styles" 2 | -------------------------------------------------------------------------------- /evoGUI.lua: -------------------------------------------------------------------------------- 1 | require "value_sensors.day_time" 2 | require "value_sensors.evolution_factor" 3 | require "value_sensors.kill_count" 4 | require "value_sensors.play_time" 5 | require "value_sensors.player_locations" 6 | require "value_sensors.pollution_around_player" 7 | require "value_sensors.remote_sensor" 8 | require "settingsGUI" 9 | require "remote" 10 | 11 | if not evogui then evogui = {} end 12 | 13 | function evogui.mod_init() 14 | if not global.settings then global.settings = {} end 15 | if not global.settings.update_delay then global.settings.update_delay = 60 end 16 | 17 | for _, player in pairs(game.players) do 18 | evogui.create_player_globals(player) 19 | evogui.create_sensor_display(player) 20 | end 21 | end 22 | 23 | 24 | local function mod_update_0_4_205() 25 | -- 0.4.204 to 0.4.205: Factorio 0.15.22 introduced a bug wherein a 26 | -- GUI element with more than 4 characters in its name, which was 27 | -- shorter than the_mod_name + 4 characters, would get deleted on 28 | -- load. At this time, the EvoGUI root element switched from 29 | -- gui.top.evoGUI to gui.top.evogui_root. 30 | -- 31 | -- We need to clean up the leftovers for people updating EvoGUI 32 | -- from any other version of Factorio now. 33 | for _, player in pairs(game.players) do 34 | if player.gui.top.evoGUI then 35 | player.gui.top.evoGUI.destroy() 36 | end 37 | end 38 | end 39 | 40 | 41 | function evogui.mod_update(data) 42 | if data.mod_changes then 43 | if data.mod_changes["{{MOD_NAME}}"] then 44 | -- TODO: If a more major migration ever needs doing, do that here. 45 | -- Otherwise, just falling back to mod_init should work fine. 46 | evogui.mod_init() 47 | 48 | mod_update_0_4_205() 49 | end 50 | 51 | evogui.validate_sensors(data.mod_changes) 52 | end 53 | end 54 | 55 | function evogui.on_gui_click(event) 56 | if string.starts_with(event.element.name, "evogui_settings_gui_") then 57 | evogui.on_settings_click(event) 58 | elseif event.element.name == "evoGUI_toggle_popup" then 59 | evogui.evoGUI_toggle_popup(event) 60 | elseif string.starts_with(event.element.name, "evogui_sensor_") then 61 | for _, sensor in pairs(evogui.value_sensors) do 62 | -- if the gui element name matches 'evogui_sensor_' + sensor_name, send it the on_click event. 63 | if string.starts_with(event.element.name, "evogui_sensor_" .. sensor.name) then 64 | sensor:on_click(event) 65 | break 66 | end 67 | end 68 | end 69 | end 70 | 71 | -- Iterate through all value_sensors, if any are associated with a mod_name that 72 | -- has been removed, remove the sensor from the list of value_sensors. 73 | function evogui.validate_sensors(mod_changes) 74 | for i = #evogui.value_sensors, 1, -1 do 75 | local sensor = evogui.value_sensors[i] 76 | if sensor.mod_name and mod_changes[sensor.mod_name] then 77 | -- mod removed, remove sensor from ui 78 | if mod_changes[sensor.mod_name].new_version == nil then 79 | evogui.hide_sensor(sensor) 80 | table.remove(evogui.value_sensors, i) 81 | end 82 | end 83 | end 84 | end 85 | 86 | function evogui.hide_sensor(sensor) 87 | for player_name, data in pairs(global.evogui) do 88 | if data.always_visible then 89 | data.always_visible[sensor["name"]] = false 90 | end 91 | end 92 | for _, player in pairs(game.players) do 93 | local player_settings = global.evogui[player.name] 94 | 95 | local sensor_flow = player.gui.top.evogui_root.sensor_flow 96 | evogui.update_av(player, sensor_flow.always_visible) 97 | end 98 | end 99 | 100 | 101 | function evogui.new_player(event) 102 | local player = game.players[event.player_index] 103 | 104 | evogui.create_player_globals(player) 105 | evogui.create_sensor_display(player) 106 | end 107 | 108 | 109 | function evogui.update_gui(event) 110 | if (event.tick % global.settings.update_delay) ~= 0 then return end 111 | 112 | for player_index, player in pairs(game.players) do 113 | local player_settings = global.evogui[player.name] 114 | -- saves converted from SP with no username to MP won't raise evogui.new_player 115 | -- so we have to check here, as well. 116 | if not player_settings then 117 | evogui.new_player({player_index = player_index}) 118 | player_settings = global.evogui[player.name] 119 | elseif not player.gui.top.evogui_root then 120 | evogui.create_sensor_display(player) 121 | end 122 | 123 | local sensor_flow = player.gui.top.evogui_root.sensor_flow 124 | evogui.update_av(player, sensor_flow.always_visible) 125 | if player_settings.popup_open then 126 | evogui.update_ip(player, sensor_flow.in_popup) 127 | end 128 | end 129 | end 130 | 131 | 132 | function evogui.create_player_globals(player) 133 | if not global.evogui then global.evogui = {} end 134 | if not global.evogui[player.name] then global.evogui[player.name] = {} end 135 | local player_settings = global.evogui[player.name] 136 | 137 | if not player_settings.version then player_settings.version = "" end 138 | 139 | if not player_settings.always_visible then 140 | player_settings.always_visible = { 141 | ["evolution_factor"] = true, 142 | ["play_time"] = true, 143 | } 144 | end 145 | 146 | if not player_settings.in_popup then 147 | player_settings.in_popup = { 148 | ["day_time"] = true, 149 | } 150 | end 151 | 152 | if not player_settings.popup_open then player_settings.popup_open = false end 153 | 154 | if not player_settings.sensor_settings then 155 | player_settings.sensor_settings = {} 156 | end 157 | 158 | if not player_settings.sensor_settings['player_locations'] then 159 | player_settings.sensor_settings['player_locations'] = { 160 | ['show_player_index'] = false, 161 | ['show_position'] = false, 162 | ['show_surface'] = false, 163 | ['show_direction'] = true, 164 | ['show_offline'] = false, 165 | } 166 | elseif player_settings.sensor_settings['player_locations'].show_offline == nil then 167 | -- 0.4.3 new feature (783e3d68) 168 | player_settings.sensor_settings['player_locations'].show_offline = false 169 | end 170 | 171 | if not player_settings.sensor_settings['day_time'] then 172 | player_settings.sensor_settings['day_time'] = { 173 | ['show_day_number'] = false, 174 | ['minute_rounding'] = true, 175 | } 176 | end 177 | 178 | if not player_settings.sensor_settings['evolution_factor'] then 179 | player_settings.sensor_settings['evolution_factor'] = { 180 | ['extra_precision'] = false, 181 | } 182 | end 183 | 184 | if not player_settings.sensor_settings['play_time'] then 185 | player_settings.sensor_settings['play_time'] = { 186 | ['show_days'] = true, 187 | ['show_seconds'] = true, 188 | } 189 | end 190 | end 191 | 192 | 193 | function evogui.create_sensor_display(player) 194 | local root = player.gui.top.evogui_root 195 | local destroyed = false 196 | if root then 197 | player.gui.top.evogui_root.destroy() 198 | destroyed = true 199 | end 200 | 201 | if not root or destroyed then 202 | local root = player.gui.top.add{type="frame", 203 | name="evogui_root", 204 | direction="horizontal", 205 | style="EvoGUI_outer_frame_no_border"} 206 | 207 | local action_buttons = root.add{type="flow", 208 | name="action_buttons", 209 | direction="vertical", 210 | style="EvoGUI_cramped_flow_v"} 211 | action_buttons.add{type="button", 212 | name="evoGUI_toggle_popup", 213 | style="EvoGUI_expando_closed"} 214 | if global.evogui[player.name].popup_open then 215 | action_buttons.evoGUI_toggle_popup.style = "EvoGUI_expando_open" 216 | end 217 | action_buttons.add{type="button", 218 | name="evogui_settings_gui_settings_open", 219 | style="EvoGUI_settings"} 220 | 221 | local sensor_flow = root.add{type="flow", 222 | name="sensor_flow", 223 | direction="vertical", 224 | style="EvoGUI_cramped_flow_v"} 225 | sensor_flow.add{type="flow", 226 | name="always_visible", 227 | direction="vertical", 228 | style="EvoGUI_cramped_flow_v"} 229 | sensor_flow.add{type="flow", 230 | name="in_popup", 231 | direction="vertical", 232 | style="EvoGUI_cramped_flow_v"} 233 | end 234 | end 235 | 236 | 237 | local function update_sensors(element, sensor_list, active_sensors) 238 | for _, sensor in ipairs(sensor_list) do 239 | if active_sensors[sensor.name] then 240 | local status, err = pcall(sensor.create_ui, sensor, element) 241 | if err then error({"err_specific", sensor.name, "create_ui", err}) end 242 | status, err = pcall(sensor.update_ui, sensor, element) 243 | if err then error({"err_specific", sensor.name, "update_ui", err}) end 244 | else 245 | local status, err = pcall(sensor.delete_ui, sensor, element) 246 | if err then error({"err_specific", sensor.name, "delete_ui", err}) end 247 | end 248 | end 249 | end 250 | 251 | 252 | function evogui.update_av(player, element) 253 | local always_visible = global.evogui[player.name].always_visible 254 | 255 | update_sensors(element, evogui.value_sensors, always_visible) 256 | end 257 | 258 | 259 | function evogui.update_ip(player, element) 260 | if not global.evogui[player.name].popup_open then return end 261 | 262 | local in_popup = global.evogui[player.name].in_popup 263 | 264 | update_sensors(element, evogui.value_sensors, in_popup) 265 | end 266 | 267 | 268 | function evogui.evoGUI_toggle_popup(event) 269 | local player = game.players[event.player_index] 270 | local player_settings = global.evogui[player.name] 271 | 272 | local root = player.gui.top.evogui_root 273 | 274 | if player_settings.popup_open then 275 | -- close it 276 | player_settings.popup_open = false 277 | 278 | for _, childname in ipairs(root.sensor_flow.in_popup.children_names) do 279 | root.sensor_flow.in_popup[childname].destroy() 280 | end 281 | 282 | root.action_buttons.evoGUI_toggle_popup.style = "EvoGUI_expando_closed" 283 | else 284 | -- open it 285 | player_settings.popup_open = true 286 | 287 | evogui.update_ip(player, root.sensor_flow.in_popup) 288 | root.action_buttons.evoGUI_toggle_popup.style = "EvoGUI_expando_open" 289 | end 290 | end 291 | -------------------------------------------------------------------------------- /graphics/gui.pdn: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/narc0tiq/evoGUI/2403c26bdc8a536d2a65fdb6e4231d0769b5cb85/graphics/gui.pdn -------------------------------------------------------------------------------- /graphics/gui.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/narc0tiq/evoGUI/2403c26bdc8a536d2a65fdb6e4231d0769b5cb85/graphics/gui.png -------------------------------------------------------------------------------- /info.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "{{MOD_NAME}}", 3 | "version": "{{VERSION}}", 4 | "factorio_version": "1.1", 5 | "title": "EvoGUI - Evolution Factor Indicator and more", 6 | "author": "Octav \"narc\" Sandulescu", 7 | "contact": "factorio-mods@narc.ro", 8 | "homepage": "https://github.com/narc0tiq/evoGUI/", 9 | "description": "Places some indicators on your UI for various little statistics that are nice to have.", 10 | "dependencies": [ 11 | "? moweather" 12 | ] 13 | } 14 | -------------------------------------------------------------------------------- /locale/cs/locale.cfg: -------------------------------------------------------------------------------- 1 | sensor.day_time.name=Aktuální čas/intenzita světla 2 | sensor.day_time.format=Je __1__. Světlo: __2__. 3 | sensor.day_time.day_format=Je __1__, __2__. dne. Světlo: __3__ 4 | sensor.day_time.settings.title=Nastavení času 5 | sensor.day_time.settings.show_day_number=Zobrazit aktuální planetární den od přistání. 6 | sensor.day_time.settings.minute_rounding=Zaokrouhlit minuty na čtvrthodiny (xx:15, xx:30, atd). 7 | 8 | sensor.evolution_factor.name=Evoluční faktor 9 | sensor.evolution_factor.format=Vývoj kousačů: __1__. 10 | sensor.evolution_factor.settings.title=Nastavení zobrazení evolučního faktoru 11 | sensor.evolution_factor.settings.extra_precision=Zobrazit čtyři desetinná místa (x.1234%) místo jednoho (x.1%). 12 | 13 | sensor.play_time.name=Doba hraní 14 | sensor.play_time.format=Doba hraní: __1__. 15 | sensor.play_time.single_day_fragment=1 den, 16 | sensor.play_time.multi_day_fragment=__1__ dní, 17 | sensor.play_time.settings.title=Playing time settings 18 | sensor.play_time.settings.show_days=Zobrazit dny ("2 dny, 01:00" místo "49:00") 19 | sensor.play_time.settings.show_seconds=Zobrazit sekundy ("hh:mm:ss" místo of "hh:mm"). 20 | 21 | sensor.player_locations.name=Umístění hráčů 22 | sensor.player_locations.format=Hráči: 23 | sensor.player_locations.err_no_name=Nemáš žádné jméno pro multiplayer, seznam hráčů vypnut. 24 | sensor.player_locations.surface_fragment=na __1__ 25 | sensor.player_locations.offline_fragment=[Offline] 26 | sensor.player_locations.settings.title=Nastavení zobrazení umístění hráčů 27 | sensor.player_locations.settings.show_player_index=Zobrazit index hráče 28 | sensor.player_locations.settings.show_position=Zobrazit souřadnice 29 | sensor.player_locations.settings.show_surface=Zobrazit povrch (surface) na kterém hráč je 30 | sensor.player_locations.settings.show_direction=Zobrazit směr k hráči 31 | sensor.player_locations.settings.show_offline=Zobrazit hráče, kteří jsou offline 32 | 33 | sensor.pollution_around_player.name=Úroveň znečištění v okolí 34 | sensor.pollution_around_player.format=Znečištění: __1__ PU. 35 | 36 | sensor.kill_count.name=Počet zabití (pro tvůj tým) 37 | sensor.kill_count.format=Počet zabití: __1__, __2__, __3__. 38 | sensor.kill_count.biter_fragment_single=1 kousač 39 | sensor.kill_count.biter_fragment_multiple=__1__ kousačů 40 | sensor.kill_count.spawner_fragment_single=1 líheň 41 | sensor.kill_count.spawner_fragment_multiple=__1__ líhní 42 | sensor.kill_count.other_fragment_single=1 jiný 43 | sensor.kill_count.other_fragment_multiple=__1__ jiných 44 | 45 | 46 | settings_title=Nastavení EvoGUI 47 | 48 | settings.core_settings.title=Základní nastavení (sdílené) 49 | settings.core_settings.update_freq_left=Aktualizovat EvoGUI každých 50 | settings.core_settings.update_freq_right=ticků (1 sekunda má 60 ticků) 51 | 52 | settings.sensors_frame.title=Nastavení senzorů 53 | 54 | settings_always_visible=Vždy viditelné 55 | settings_in_popup=Viditelné po rozkliknutí 56 | 57 | settings_close=Zavřít 58 | 59 | 60 | direction.north=S 61 | direction.south=J 62 | direction.east=V 63 | direction.west=Z 64 | direction.northeast=SV 65 | direction.northwest=SZ 66 | direction.southeast=JV 67 | direction.southwest=JZ 68 | direction.unknown=? 69 | 70 | 71 | err_generic=[EvoGUI|__1__] Error: __2__ 72 | err_specific=[EvoGUI|__1__|__2__] Error: __3__ 73 | 74 | err_settings_whatsensor=__1__ can't find sensor! 75 | err_settings_whatsettings=__1__ called for settings-less sensor! 76 | 77 | err_needplayername=[EvoGUI] Je potřeba jméno hráče! 78 | err_nosuchplayer=[EvoGUI] Hráč __1__ neexistuje! 79 | err_noplayerdata=[EvoGUI] Žádná data pro hráče __1__! 80 | 81 | err_nosensorname=[EvoGUI] Missing a sensor name! 82 | err_no_sensor_data=[EvoGUI] Missing remote sensor data! 83 | err_sensor_missing_field=[EvoGUI] Remote sensor __1__ is missing a required field __2__! 84 | err_nosensortext=[EvoGUI] Missing sensor text for __1__! 85 | err_nosensorcaption=[EvoGUI] Missing caption text for __1__! 86 | err_nosensorfound=[EvoGUI] No sensor matching the name __1__! Create a sensor first. 87 | -------------------------------------------------------------------------------- /locale/de/locale.cfg: -------------------------------------------------------------------------------- 1 | sensor.day_time.name=Tageszeit/Sonnenlicht 2 | sensor.day_time.format=Es ist __1__ Uhr. Helligkeit: __2__. 3 | sensor.day_time.day_format=Es ist __1__ Uhr am Tag __2__. Helligkeit: __3__ 4 | sensor.day_time.settings.title=Einstellungen Tageszeit 5 | sensor.day_time.settings.show_day_number=Tage seit der Landung auf dem Planeten anzeigen. 6 | sensor.day_time.settings.minute_rounding=Angezeigte Minuten werden auf Viertelstunden gerundet (xx:15, xx:30, etc). 7 | 8 | sensor.evolution_factor.name=Evolutionsfaktor 9 | sensor.evolution_factor.format=Beißerevolution: __1__. 10 | sensor.evolution_factor.settings.title=Einstellungen Evolutonsfaktoranzeige 11 | sensor.evolution_factor.settings.extra_precision=Zeige vier Nachkommastellen (x.1234%) anstatt einer (x.1%). 12 | 13 | sensor.play_time.name=Gesamte Spielzeit 14 | sensor.play_time.format=Spielzeit: __1__. 15 | sensor.play_time.single_day_fragment=1 Tag, 16 | sensor.play_time.multi_day_fragment=__1__ Tage, 17 | sensor.play_time.settings.title=Einstellungen Spielzeit 18 | sensor.play_time.settings.show_days=Tage anzeigen("2 Tage, 01:00" anstatt "49:00") 19 | sensor.play_time.settings.show_seconds=Sekunden anzeigen("hh:mm:ss" anstatt "hh:mm"). 20 | 21 | sensor.player_locations.name=Spielerpositionen 22 | sensor.player_locations.format=Spieler: 23 | sensor.player_locations.err_no_name=Solange du keinen Mehspielerbenutzernamen angegeben hast, ist die Spielerliste deaktiviert. 24 | sensor.player_locations.local_player=Lokaler Spieler 25 | sensor.player_locations.surface_fragment=Auf __1__ 26 | sensor.player_locations.offline_fragment=[Offline] 27 | sensor.player_locations.settings.title=Einstellungen Spielerposition 28 | sensor.player_locations.settings.show_player_index=Spielerindex anzeigen 29 | sensor.player_locations.settings.show_position=Koordinaten anzeigen 30 | sensor.player_locations.settings.show_surface=Zeige Spielfläche des Spielers an 31 | sensor.player_locations.settings.show_direction=Bewegungsrichtung zum Spieler anzeigen 32 | sensor.player_locations.settings.show_offline=Abwesende Spieler anzeigen 33 | 34 | sensor.pollution_around_player.name=Verschmutzung in der Nähe 35 | sensor.pollution_around_player.format=Verschmutzung: __1__ PU. 36 | 37 | sensor.kill_count.name=Abschusszähler (für dein Team) 38 | sensor.kill_count.format=Abschüsse: __1__, __2__, __3__. 39 | sensor.kill_count.biter_fragment_single=1 Beißer 40 | sensor.kill_count.biter_fragment_multiple=__1__ Beißer 41 | sensor.kill_count.spawner_fragment_single=1 Nest 42 | sensor.kill_count.spawner_fragment_multiple=__1__ Nester 43 | sensor.kill_count.other_fragment_single=1 anderes 44 | sensor.kill_count.other_fragment_multiple=__1__ andere 45 | 46 | 47 | settings_title=Einstellungen EvoGUI 48 | 49 | settings.core_settings.title=Basiseinstellungen (geteilt) 50 | settings.core_settings.update_freq_left=Aktualisiere EvoGUI alle 51 | settings.core_settings.update_freq_right=Ticks (es gibt 60 Ticks pro Sekunde) 52 | 53 | settings.sensors_frame.title=Einstellungen Sensoren 54 | 55 | settings_always_visible=immer sichbar 56 | settings_in_popup=im Popup sichbar 57 | 58 | settings_close=Schließen 59 | 60 | 61 | direction.north=N 62 | direction.south=S 63 | direction.east=O 64 | direction.west=W 65 | direction.northeast=NO 66 | direction.northwest=NW 67 | direction.southeast=SO 68 | direction.southwest=SW 69 | direction.unknown=? 70 | 71 | 72 | err_generic=[EvoGUI|__1__] Fehler: __2__ 73 | err_specific=[EvoGUI|__1__|__2__] Fehler: __3__ 74 | 75 | err_settings_whatsensor=__1__ kann Sensor nicht finden! 76 | err_settings_whatsettings=__1__ wurde für einen nicht einstellbaren Sensor aufgerufen! 77 | 78 | err_needplayername=[EvoGUI] Benötige Spielernamen! 79 | err_nosuchplayer=[EvoGUI] Spieler nicht gefunden: __1__! 80 | err_noplayerdata=[EvoGUI] Keine Spieldaten für __1__! 81 | 82 | err_nosensorname=[EvoGUI] Fehlender Sensorname! 83 | err_no_sensor_data=[EvoGUI] Fehlende Sensordaten (remote)! 84 | err_sensor_missing_field=[EvoGUI] Sensor (remote) __1__ fehlt ein benötigtes Feld __2__! 85 | err_nosensortext=[EvoGUI] Sensortext für __1__ fehlt! 86 | err_nosensorcaption=[EvoGUI] Beschreibungstext für __1__ fehlt! 87 | err_nosensorfound=[EvoGUI] Kein Sensor mit dem Namen __1__ gefunden! Bitte erstelle erst einen Sensor. 88 | -------------------------------------------------------------------------------- /locale/en/locale.cfg: -------------------------------------------------------------------------------- 1 | sensor.day_time.name=Time of day/sunlight 2 | sensor.day_time.format=It's __1__. Brightness: __2__ 3 | sensor.day_time.day_format=It's __1__ on day __2__. Brightness: __3__ 4 | sensor.day_time.settings.title=Time of day settings 5 | sensor.day_time.settings.show_day_number=Show the current planetary day since landing. 6 | sensor.day_time.settings.minute_rounding=Round displayed minutes to a quarter hour (xx:15, xx:30, etc). 7 | 8 | sensor.evolution_factor.name=Evolution factor 9 | sensor.evolution_factor.format=Biter evolution: __1__ 10 | sensor.evolution_factor.settings.title=Evolution factor display settings 11 | sensor.evolution_factor.settings.extra_precision=Show four decimals (x.1234%) instead of one (x.1%). 12 | 13 | sensor.play_time.name=Time played 14 | sensor.play_time.format=Play time (this save): __1__ 15 | sensor.play_time.single_day_fragment=1 day, 16 | sensor.play_time.multi_day_fragment=__1__ days, 17 | sensor.play_time.personal_time_fragment=(you've played: __1__) 18 | sensor.play_time.settings.title=Playing time settings 19 | sensor.play_time.settings.show_days=Show days ("2 days, 01:00" instead of "49:00"). 20 | sensor.play_time.settings.show_seconds=Show seconds ("hh:mm:ss" instead of "hh:mm"). 21 | sensor.play_time.settings.show_personal_time=Show your online time (only useful in multiplayer). 22 | 23 | sensor.player_locations.name=Player locations 24 | sensor.player_locations.format=Players: 25 | sensor.player_locations.err_no_name=You have no multiplayer username, player list disabled. 26 | sensor.player_locations.local_player=Local player 27 | sensor.player_locations.surface_fragment=on __1__ 28 | sensor.player_locations.offline_fragment=[Offline, was on for __1__] 29 | sensor.player_locations.online_fragment=[Online for __1__] 30 | sensor.player_locations.single_day_fragment=1 day, 31 | sensor.player_locations.multi_day_fragment=__1__ days, 32 | sensor.player_locations.settings.title=Player location settings 33 | sensor.player_locations.settings.show_player_index=Show player index 34 | sensor.player_locations.settings.show_position=Show coordinates 35 | sensor.player_locations.settings.show_surface=Show surface the player is on 36 | sensor.player_locations.settings.show_direction=Show direction to walk to reach the player 37 | sensor.player_locations.settings.show_offline=Show offline players 38 | 39 | sensor.pollution_around_player.name=Nearby pollution level 40 | sensor.pollution_around_player.format=Pollution: __1__ PU 41 | 42 | sensor.kill_count.name=Kill count (for your team) 43 | sensor.kill_count.format=Kills: __1__, __2__, __3__ 44 | sensor.kill_count.biter_fragment_single=1 biter 45 | sensor.kill_count.biter_fragment_multiple=__1__ biters 46 | sensor.kill_count.spawner_fragment_single=1 spawner 47 | sensor.kill_count.spawner_fragment_multiple=__1__ spawners 48 | sensor.kill_count.other_fragment_single=1 other 49 | sensor.kill_count.other_fragment_multiple=__1__ others 50 | 51 | sensor.remote.settings_title_format=* __2__ 52 | 53 | settings_title=EvoGUI settings 54 | 55 | settings.core_settings.title=Core settings (shared) 56 | settings.core_settings.update_freq_left=Update EvoGUI every 57 | settings.core_settings.update_freq_right=ticks (there are 60 ticks in a second) 58 | 59 | settings.sensors_frame.title=Sensor settings 60 | 61 | settings_always_visible=Always visible 62 | settings_in_popup=Visible in popup 63 | 64 | settings_close=Close 65 | 66 | 67 | direction.north=N 68 | direction.south=S 69 | direction.east=E 70 | direction.west=W 71 | direction.northeast=NE 72 | direction.northwest=NW 73 | direction.southeast=SE 74 | direction.southwest=SW 75 | direction.unknown=? 76 | 77 | 78 | err_generic=[EvoGUI|__1__] Error: __2__ 79 | err_specific=[EvoGUI|__1__|__2__] Error: __3__ 80 | 81 | err_settings_whatsensor=__1__ can't find sensor! 82 | err_settings_whatsettings=__1__ called for settings-less sensor! 83 | 84 | err_needplayername=[EvoGUI] Need a player name! 85 | err_nosuchplayer=[EvoGUI] No such player: __1__! 86 | err_noplayerdata=[EvoGUI] No player data for __1__! 87 | 88 | err_nosensorname=[EvoGUI] Missing a sensor name! 89 | err_no_sensor_data=[EvoGUI] Missing remote sensor data! 90 | err_sensor_missing_field=[EvoGUI] Remote sensor __1__ is missing a required field __2__! 91 | err_nosensortext=[EvoGUI] Missing sensor text for __1__! 92 | err_nosensorcaption=[EvoGUI] Missing caption text for __1__! 93 | err_nosensorfound=[EvoGUI] No sensor matching the name __1__! Create a sensor first. 94 | -------------------------------------------------------------------------------- /locale/he/locale.cfg: -------------------------------------------------------------------------------- 1 | sensor.day_time.name=שמש רוא/םויה תעש 2 | sensor.day_time.format=__2__ :תוריהב __1__. וישכע 3 | sensor.day_time.day_format=__3__ :תוריהב __2__ םויב __1__ וישכע 4 | sensor.day_time.settings.title=םוי-ןמז תורדגה 5 | sensor.day_time.settings.show_day_number=התיחנהמ םימיה רפסמ תא הארה 6 | sensor.day_time.settings.minute_rounding=תוקד 15 לכ לוגיע 7 | 8 | sensor.evolution_factor.name=תוחתפתה םדקמ 9 | sensor.evolution_factor.format=__1__ :תוחתפתה םדקמ 10 | sensor.evolution_factor.settings.title=תוחתפתה םדקמ תגוצת תורדגה 11 | sensor.evolution_factor.settings.extra_precision=.הדוקנה ירחא (x.1%) תחא םוקמב (x.1234%) תורפס עברא לש קויד 12 | 13 | sensor.play_time.name=קחושש ןמז 14 | sensor.play_time.format=__1__ :קחשמ ןמז 15 | sensor.play_time.single_day_fragment=1, םוי 16 | sensor.play_time.multi_day_fragment=,םימי __1__ 17 | sensor.play_time.settings.title=קחשמ ןמז תורדגה 18 | sensor.play_time.settings.show_days="49:00") תועש םוקמב 01:00" ,םימי ("x םימי גצה 19 | sensor.play_time.settings.show_seconds="hh:mm"). םוקמב ("hh:mm:ss" תוינש גצה 20 | 21 | sensor.player_locations.name=םינקחש ימוקימ 22 | sensor.player_locations.format=:םינקחש 23 | sensor.player_locations.err_no_name=.םיפתתשמ הבורמ קחשמ לרטנמ .םיפתתשמ הבורמ קחשמל ןקחש םש ךל ןיא 24 | 25 | sensor.player_locations.local_player=ימוקמ ןקחש 26 | sensor.player_locations.surface_fragment=__1__ לע 27 | sensor.player_locations.offline_fragment=]קתונמ[ 28 | sensor.player_locations.settings.title=ןקחש ימוקימ תורדגה 29 | sensor.player_locations.settings.show_player_index=ןקחש רפסמ 30 | sensor.player_locations.settings.show_position=ןויצ תודוקנ 31 | sensor.player_locations.settings.show_surface=וילע ןקחשהש םוקמה תא 32 | sensor.player_locations.settings.show_direction=ןקחשל ןוויכ 33 | sensor.player_locations.settings.show_offline=םיקתונמ םינקחש 34 | 35 | sensor.pollution_around_player.name=הבורקה הביבסב םוהיז תמר 36 | sensor.pollution_around_player.format=PU. __1__ :םוהיז תמר 37 | 38 | sensor.kill_count.name=(הצובקל) תוגירה 39 | sensor.kill_count.format=__3__. __2__, __1__, :תוגירה 40 | sensor.kill_count.biter_fragment_single=םינכשנ 1 41 | sensor.kill_count.biter_fragment_multiple=םינכשנ __1__ 42 | sensor.kill_count.spawner_fragment_single=לודיג תיב 1 43 | sensor.kill_count.spawner_fragment_multiple=לודיג תיב __1__ 44 | sensor.kill_count.other_fragment_single=רחא 1 45 | sensor.kill_count.other_fragment_multiple=םירחא __1__ 46 | 47 | 48 | settings_title=תורדגה EvoGUI 49 | 50 | settings.core_settings.title=(ףתושמ) סיסב תורדגה 51 | settings.core_settings.update_freq_left=(הינש לכב ticks 60 םנשי) ticks 52 | settings.core_settings.update_freq_right=לכ EvoGUI תא ןכדע 53 | 54 | settings.sensors_frame.title=םינשייח תורדגה 55 | 56 | settings_always_visible=הארנ דימת 57 | settings_in_popup=ןולחב הארנ 58 | 59 | settings_close=רוגס 60 | 61 | 62 | direction.north=פצ 63 | direction.south=רד 64 | direction.east=זמ 65 | direction.west=עמ 66 | direction.northeast=זמ-פצ 67 | direction.northwest=עמ-פצ 68 | direction.southeast=זמ-רד 69 | direction.southwest=עמ-רד 70 | direction.unknown=? 71 | 72 | 73 | err_generic=__2__ :האיגש [EvoGUI|__1__] 74 | err_specific=__3__ :האיגש [EvoGUI|__1__|__2__] 75 | 76 | err_settings_whatsensor=__1__ can't find sensor! ןשייח אוצמל ןתינ אל 77 | err_settings_whatsettings=__1__ called for settings-less sensor! הרדגה אלל ןשייחל האירק 78 | 79 | err_needplayername=!ןקחש םש ךירצ | Need a player name[EvoGUI] 80 | err_nosuchplayer=[EvoGUI] ןקחש הזכ ןיא | No such player: __1__! 81 | err_noplayerdata=[EvoGUI] רובע ןקחש עדימ ןיא | No player data for __1__! 82 | 83 | err_nosensorname=ןשייח םש רסח name! sensor a Missing [EvoGUI] 84 | err_no_sensor_data=ןשייח עדימ רסח data! sensor remote Missing [EvoGUI] 85 | err_sensor_missing_field=__2__ ץוחנ הדש רסח __1__ ןשייחל __2__! field required a missing is __1__ sensor Remote [EvoGUI] 86 | err_nosensortext=ןשייחל טסקט רסח __1__! for text sensor Missing [EvoGUI] 87 | err_nosensorcaption=[EvoGUI] רובע טסקט רסח | Missing caption text for __1__! 88 | err_nosensorfound=[EvoGUI] הז םשב ןשייח ןיא | No sensor matching the name __1__! Create a sensor first. 89 | -------------------------------------------------------------------------------- /locale/it/locale.cfg: -------------------------------------------------------------------------------- 1 | sensor.day_time.name=Ora del giorno/Luce solare 2 | sensor.day_time.format=Sono le __1__. Luminosità: __2__ 3 | sensor.day_time.day_format=Sono le __1__ del __2__° giorno. Luminosità: __3__ 4 | sensor.day_time.settings.title=Impostazioni ora del giorno 5 | sensor.day_time.settings.show_day_number=Mostra i giorni passati dall'atterraggio sul pianeta. 6 | sensor.day_time.settings.minute_rounding=Arrotonda i minuti mostrati a un quarto d'ora (xx:15, xx:30, ecc). 7 | 8 | sensor.evolution_factor.name=Fattore Evoluzione 9 | sensor.evolution_factor.format=Evoluzione Morditori: __1__ 10 | sensor.evolution_factor.settings.title=Impostazioni display fattore Evoluzione 11 | sensor.evolution_factor.settings.extra_precision=Mostra quattro decimali (x.1234%) anziché uno soltanto (x.1%). 12 | 13 | sensor.play_time.name=Totale Ore di gioco 14 | sensor.play_time.format=Ore di gioco (per questo salvataggio): __1__ 15 | sensor.play_time.single_day_fragment=1 Giorno, 16 | sensor.play_time.multi_day_fragment=__1__ Giorni, 17 | sensor.play_time.personal_time_fragment=(Hai giocato: __1__) 18 | sensor.play_time.settings.title=Impostazioni Tempo Totale di gioco 19 | sensor.play_time.settings.show_days=Mostra Giorni ("2 giorni, 01:00" anziché "49:00"). 20 | sensor.play_time.settings.show_seconds=Mostra secondi ("hh:mm:ss" anziché "hh:mm"). 21 | sensor.play_time.settings.show_personal_time=Mostra ore online (utile solo per multiplayer). 22 | 23 | sensor.player_locations.name=Posizione giocatore 24 | sensor.player_locations.format=Giocatori: 25 | sensor.player_locations.err_no_name=Non hai un username multiplayer, lista giocatori disabilitata. 26 | sensor.player_locations.local_player=Giocatore locale 27 | sensor.player_locations.surface_fragment=su __1__ 28 | sensor.player_locations.offline_fragment=[Offline, era attivo per __1__] 29 | sensor.player_locations.online_fragment=[Online da __1__] 30 | sensor.player_locations.single_day_fragment=1 giorno, 31 | sensor.player_locations.multi_day_fragment=__1__ giorni, 32 | sensor.player_locations.settings.title=Impostazioni posizioni giocatore 33 | sensor.player_locations.settings.show_player_index=Mostra indice giocatori 34 | sensor.player_locations.settings.show_position=Mostra coordinate 35 | sensor.player_locations.settings.show_surface=Mostra la superficie in cui il giocatore si trova 36 | sensor.player_locations.settings.show_direction=Mostra la direzione da prendere per poter raggiungere il giocatore 37 | sensor.player_locations.settings.show_offline=Mostra giocatori offline 38 | 39 | sensor.pollution_around_player.name=Livello di inquinamento nelle vicinanze 40 | sensor.pollution_around_player.format=Inquinamento: __1__ PU 41 | 42 | sensor.kill_count.name=Conteggio uccisioni (per la tua squadra) 43 | sensor.kill_count.format=Uccisioni: __1__, __2__, __3__ 44 | sensor.kill_count.biter_fragment_single=1 Morditore 45 | sensor.kill_count.biter_fragment_multiple=__1__ Morditori 46 | sensor.kill_count.spawner_fragment_single=1 Nido 47 | sensor.kill_count.spawner_fragment_multiple=__1__ Nidi 48 | sensor.kill_count.other_fragment_single=1 Altro 49 | sensor.kill_count.other_fragment_multiple=__1__ Altri 50 | 51 | sensor.remote.settings_title_format=* __2__ 52 | 53 | settings_title=Impostazioni EvoGUI 54 | 55 | settings.core_settings.title=Impostazioni principali (condivisi) 56 | settings.core_settings.update_freq_left=Aggiorna EvoGUI ogni 57 | settings.core_settings.update_freq_right=ticks (1 secondo sono formati da 60 ticks) 58 | 59 | settings.sensors_frame.title=Impostazioni Sensore 60 | 61 | settings_always_visible=Sempre visibile 62 | settings_in_popup=Visibile in un Pop-up 63 | 64 | settings_close=Chiudi 65 | 66 | 67 | direction.north=N 68 | direction.south=S 69 | direction.east=E 70 | direction.west=O 71 | direction.northeast=NE 72 | direction.northwest=NO 73 | direction.southeast=SE 74 | direction.southwest=SO 75 | direction.unknown=? 76 | 77 | 78 | err_generic=[EvoGUI|__1__] Errore: __2__ 79 | err_specific=[EvoGUI|__1__|__2__] Errore: __3__ 80 | 81 | err_settings_whatsensor=__1__ impossibile trovare il sensore! 82 | err_settings_whatsettings=__1__ called for settings-less sensor! 83 | 84 | err_needplayername=[EvoGUI] Necessario nome giocatore! 85 | err_nosuchplayer=[EvoGUI] Nessun giocatore trovato: __1__! 86 | err_noplayerdata=[EvoGUI] Nessun dato giocatore per __1__! 87 | 88 | err_nosensorname=[EvoGUI] Nome sensore mancante! 89 | err_no_sensor_data=[EvoGUI] Dati sensore remoto mancanti! 90 | err_sensor_missing_field=[EvoGUI] Al sensore remoto __1__ manca un campo richiesto __2__! 91 | err_nosensortext=[EvoGUI] Testo sensore mancante per __1__! 92 | err_nosensorcaption=[EvoGUI] Didascalica mancante per __1__! 93 | err_nosensorfound=[EvoGUI] Non c'è nessun sensore con questo nome __1__! Crea prima un sensore. 94 | -------------------------------------------------------------------------------- /locale/ko/locale.cfg: -------------------------------------------------------------------------------- 1 | sensor.day_time.name=게임 내 시간/밝기 2 | sensor.day_time.format=현재 시각: __1__. 밝기: __2__. 3 | sensor.day_time.day_format=현재 시각: __1__. 현재 경과 일수 __2__. 밝기: __3__ 4 | sensor.day_time.settings.title=현재 시각 설정 5 | sensor.day_time.settings.show_day_number=착륙 후 경과일수를 표시. 6 | sensor.day_time.settings.minute_rounding=15분 단위로 반올림 하여 표시 (xx:15, xx:30, etc). 7 | 8 | sensor.evolution_factor.name=진화도 9 | sensor.evolution_factor.format=바이터 진화도: __1__. 10 | sensor.evolution_factor.settings.title=진화도 표시 설정 11 | sensor.evolution_factor.settings.extra_precision=소수점 아래 네자리까지 표시(기본 한자리) 12 | 13 | sensor.play_time.name=플레이한 시간 14 | sensor.play_time.format=플레이 시간: __1__. 15 | sensor.play_time.single_day_fragment=1일, 16 | sensor.play_time.multi_day_fragment=__1__일, 17 | sensor.play_time.personal_time_fragment=(당신은 __1__일 플레이하였습니다.) 18 | sensor.play_time.settings.title=플레이한 시간 설정 19 | sensor.play_time.settings.show_days=경과 일 수 표시 20 | sensor.play_time.settings.show_seconds=초 표시 21 | sensor.play_time.settings.show_personal_time=온라인 시간(멀티 플레이어에서만 유용). 22 | 23 | sensor.player_locations.name=플레이어 위치 24 | sensor.player_locations.format=플레이어: 25 | sensor.player_locations.err_no_name=멀티플레이어 이름이 없어서 플레이어 목록이 비활성화됩니다. 26 | sensor.player_locations.local_player=로컬 플레이어 27 | sensor.player_locations.surface_fragment=__1__ 28 | sensor.player_locations.offline_fragment=[오프라인, was on for __1__] 29 | sensor.player_locations.online_fragment=[온라인 for __1__] 30 | sensor.player_locations.single_day_fragment=1일, 31 | sensor.player_locations.multi_day_fragment=__1__일, 32 | sensor.player_locations.settings.title=플레이어 위치 설정 33 | sensor.player_locations.settings.show_player_index=플레이어 색인 보이기 34 | sensor.player_locations.settings.show_position=좌표 표시 35 | sensor.player_locations.settings.show_surface=플레이어가 위치한 지역 표시 36 | sensor.player_locations.settings.show_direction=상대 플레이어로 향하는 방향 표시 37 | sensor.player_locations.settings.show_offline=오프라인 플레이어 표시 38 | 39 | sensor.pollution_around_player.name=주변 오염도 40 | sensor.pollution_around_player.format=오염도: __1__ PU. 41 | 42 | sensor.kill_count.name=킬 카운트 (속한 팀) 43 | sensor.kill_count.format=킬: __1__, __2__, __3__. 44 | sensor.kill_count.biter_fragment_single=바이터 1마리 45 | sensor.kill_count.biter_fragment_multiple=바이터 __1__마리 46 | sensor.kill_count.spawner_fragment_single=스포너 1개 47 | sensor.kill_count.spawner_fragment_multiple=스포너 __1__개 48 | sensor.kill_count.other_fragment_single=플레이어 1명 49 | sensor.kill_count.other_fragment_multiple=플레이어 __1__명 50 | 51 | sensor.remote.settings_title_format=* __2__ 52 | 53 | settings_title=EvoGUI 설정 54 | 55 | settings.core_settings.title=핵심 설정 (공유됨) 56 | settings.core_settings.update_freq_left=EvoGUI를 57 | settings.core_settings.update_freq_right=틱 마다 업데이트 (1초는 60틱) 58 | 59 | settings.sensors_frame.title=센서 설정 60 | 61 | settings_always_visible=항상 보임 62 | settings_in_popup=팝업에서 보임 63 | 64 | settings_close=닫기 65 | 66 | 67 | direction.north=N 68 | direction.south=S 69 | direction.east=E 70 | direction.west=W 71 | direction.northeast=NE 72 | direction.northwest=NW 73 | direction.southeast=SE 74 | direction.southwest=SW 75 | direction.unknown=? 76 | 77 | 78 | err_generic=[EvoGUI|__1__] 오류: __2__ 79 | err_specific=[EvoGUI|__1__|__2__] 오류: __3__ 80 | 81 | err_settings_whatsensor=__1__: 센서가 없음! 82 | err_settings_whatsettings=__1__: 설정이 안된 센서를 불러옴! 83 | 84 | err_needplayername=[EvoGUI] 플레이어 이름이 필요함! 85 | err_nosuchplayer=[EvoGUI] 플레이어 없음: __1__! 86 | err_noplayerdata=[EvoGUI] 플레이어 데이터 없음: __1__! 87 | 88 | err_nosensorname=[EvoGUI] 센서 이름이 필요함! 89 | err_no_sensor_data=[EvoGUI] 원격 센서 데이터 없음! 90 | err_sensor_missing_field=[EvoGUI] 원격 센서 __1__ 이 요구하는 필드 __2__가 없음! 91 | err_nosensortext=[EvoGUI] 센서 텍스트 없음: __1__! 92 | err_nosensorcaption=[EvoGUI] 캡션 텍스트 없음: __1__! 93 | err_nosensorfound=[EvoGUI] __1__이라는 센서는 없음! 센서를 먼저 만드세요. 94 | -------------------------------------------------------------------------------- /locale/pl/locale.cfg: -------------------------------------------------------------------------------- 1 | sensor.day_time.name=Godzina/światło słoneczne 2 | sensor.day_time.format=Jest __1__. Jasność: __2__. 3 | sensor.day_time.day_format=Jest __1__ w dniu __2__. Jasność: __3__ 4 | sensor.day_time.settings.title=Ustawienia Godzina/światło słoneczne 5 | sensor.day_time.settings.show_day_number=Pokaż aktualny dzień planetarny od wylądowania. 6 | sensor.day_time.settings.minute_rounding=Zaokrąglić wyświetlane minuty do kwadransu (xx:15, xx:30, itd). 7 | 8 | sensor.evolution_factor.name=Współczynnik ewolucji 9 | sensor.evolution_factor.format=Ewolucja obcych: __1__. 10 | sensor.evolution_factor.settings.title=Ustawienia Współczynnik Ewolucji 11 | sensor.evolution_factor.settings.extra_precision=Pokaż cztery dziesiętne (x.1234%) zamiast jednego (x.1%). 12 | 13 | sensor.play_time.name=Czas gry 14 | sensor.play_time.format=Czas gry: __1__. 15 | sensor.play_time.single_day_fragment=1 dzień, 16 | sensor.play_time.multi_day_fragment=__1__ dni, 17 | sensor.play_time.settings.title=Ustawienia Czas gry 18 | sensor.play_time.settings.show_days=Pokaż dni ("2 dni, 01:00" zamiast "49:00") 19 | sensor.play_time.settings.show_seconds=Pokaż sekundy ("gg:mm:ss" zamiast "gg:mm"). 20 | 21 | sensor.player_locations.name=Gracze 22 | sensor.player_locations.format=Gracze: 23 | sensor.player_locations.err_no_name=Nie masz nazwy użytkownika gry wieloosobowej, lista graczy wyłączona. 24 | sensor.player_locations.local_player=Lokalny gracz 25 | sensor.player_locations.surface_fragment=na __1__ 26 | sensor.player_locations.offline_fragment=[Offline] 27 | sensor.player_locations.settings.title=Ustawienia Graczy 28 | sensor.player_locations.settings.show_player_index=Pokaż index gracza 29 | sensor.player_locations.settings.show_position=Pokaż koordynaty 30 | sensor.player_locations.settings.show_surface=Pokaż powierzchnię na której jest gracz 31 | sensor.player_locations.settings.show_direction=Pokaż kierunek drogi dotarcia do gracza 32 | sensor.player_locations.settings.show_offline=Pokaż graczy offline 33 | 34 | sensor.pollution_around_player.name=Poziom zanieczyszczenia 35 | sensor.pollution_around_player.format=Zanieczyszczenie: __1__ 36 | 37 | sensor.kill_count.name=Liczba zabitych 38 | sensor.kill_count.format=Zabito: __1__, __2__, __3__. 39 | sensor.kill_count.biter_fragment_single=1 obcy 40 | sensor.kill_count.biter_fragment_multiple=__1__ obcych 41 | sensor.kill_count.spawner_fragment_single=1 legowisko 42 | sensor.kill_count.spawner_fragment_multiple=__1__ legowisk 43 | sensor.kill_count.other_fragment_single=1 inny 44 | sensor.kill_count.other_fragment_multiple=__1__ innych 45 | 46 | 47 | settings_title=Ustawienia EvoGUI 48 | 49 | settings.core_settings.title=Ustawienia główne 50 | settings.core_settings.update_freq_left=Aktualizuj EvoGUI co 51 | settings.core_settings.update_freq_right=tyknięć (60 tyknięć na sekunde) 52 | 53 | settings.sensors_frame.title=Ustawienia Czujnika 54 | 55 | settings_always_visible=Widać zawsze 56 | settings_in_popup=Widać po rozwinięciu 57 | 58 | settings_close=Zamknij 59 | 60 | 61 | direction.north=PN 62 | direction.south=PD 63 | direction.east=W 64 | direction.west=Z 65 | direction.northeast=PN-W 66 | direction.northwest=PN-Z 67 | direction.southeast=PD-W 68 | direction.southwest=PD-Z 69 | direction.unknown=? 70 | 71 | 72 | err_generic=[EvoGUI|__1__] Błąd: __2__ 73 | err_specific=[EvoGUI|__1__|__2__] Błąd: __3__ 74 | 75 | err_settings_whatsensor=__1__ nie można znaleść czujnika! 76 | err_settings_whatsettings=__1__ wezwanie do ustawień-mniej czujników! 77 | 78 | err_needplayername=[EvoGUI] Potrzebujesz nazwy gracza! 79 | err_nosuchplayer=[EvoGUI] Nie ma takiego gracza: __1__! 80 | err_noplayerdata=[EvoGUI] Brak danych o graczu __1__! 81 | 82 | err_nosensorname=[EvoGUI] Brakuje nazwy czujnika! 83 | err_no_sensor_data=[EvoGUI] Brakuje zdalnych danych z czujników! 84 | err_sensor_missing_field=[EvoGUI] Brakuje __1__ zdalnego czujnika wymagany w polu __2__! 85 | err_nosensortext=[EvoGUI] Brakuje tekstu czujnika __1__! 86 | err_nosensorcaption=[EvoGUI] Brakuje nagłówka do __1__! 87 | err_nosensorfound=[EvoGUI] Brak czujnika odpowiadającego nazwie __1__! Utwórz pierw czujnik. 88 | -------------------------------------------------------------------------------- /locale/ru/locale.cfg: -------------------------------------------------------------------------------- 1 | sensor.day_time.name=Время суток/солнечный свет 2 | sensor.day_time.format=Время __1__. Яркость: __2__. 3 | sensor.day_time.day_format=Время __1__ Прожито дней __2__. Яркость: __3__ 4 | sensor.day_time.settings.title=Настройки дня и времени 5 | sensor.day_time.settings.show_day_number=Показывать кол-во дней после посадки. 6 | sensor.day_time.settings.minute_rounding=Округлять отображение минут на четверть (xx:15, xx:30, и т.д.). 7 | 8 | sensor.evolution_factor.name=Фактор эволюции 9 | sensor.evolution_factor.format=Эволюция кусак: __1__. 10 | sensor.evolution_factor.settings.title=Настройки дисплея. 11 | sensor.evolution_factor.settings.extra_precision=Показывать 4 знака после запятой (x.1234%) вместо (x.1%). 12 | 13 | sensor.play_time.name=Время игры 14 | sensor.play_time.format=Время игры: __1__. 15 | sensor.play_time.single_day_fragment=1 день, 16 | sensor.play_time.multi_day_fragment=__1__ дней, 17 | sensor.play_time.personal_time_fragment=(Вы играли: __1__) 18 | sensor.play_time.settings.title=Настройки игрового времени 19 | sensor.play_time.settings.show_days=Показывать дни ("2 дня, 01:00" вместо "49:00") 20 | sensor.play_time.settings.show_seconds=Показывать секунды ("hh:mm:ss" вместо "hh:mm"). 21 | sensor.play_time.settings.show_personal_time=Время нахождения в игре (только для сети). 22 | 23 | sensor.player_locations.name=Координаты игрока 24 | sensor.player_locations.format=Игроки: 25 | sensor.player_locations.err_no_name=Без мультиплеера нет списка игроков. 26 | sensor.player_locations.local_player=Локальный игрок 27 | sensor.player_locations.surface_fragment=on __1__ 28 | sensor.player_locations.offline_fragment=[Нет в игре] 29 | sensor.player_locations.online_fragment=[В сети __1__] 30 | sensor.player_locations.single_day_fragment=1 день, 31 | sensor.player_locations.multi_day_fragment=__1__ дней, 32 | sensor.player_locations.settings.title=Настройки координат игрока 33 | sensor.player_locations.settings.show_player_index=Показывать номер игрока 34 | sensor.player_locations.settings.show_position=Показывать координаты 35 | sensor.player_locations.settings.show_surface=Показывать поверхность игрока(?) 36 | sensor.player_locations.settings.show_direction=Показывать направление на игрока 37 | sensor.player_locations.settings.show_offline=Показывать оффлайн игроков 38 | 39 | sensor.pollution_around_player.name=Уровень загрязнения 40 | sensor.pollution_around_player.format=Загрязнение: __1__ PU. 41 | 42 | sensor.kill_count.name=Число убийств (для вашей команды) 43 | sensor.kill_count.format=Уничтожено: __1__, __2__, __3__. 44 | sensor.kill_count.biter_fragment_single=1 кусак 45 | sensor.kill_count.biter_fragment_multiple=__1__ кусак 46 | sensor.kill_count.spawner_fragment_single=1 ульев 47 | sensor.kill_count.spawner_fragment_multiple=__1__ ульев 48 | sensor.kill_count.other_fragment_single=1 остальных 49 | sensor.kill_count.other_fragment_multiple=__1__ остальных 50 | 51 | sensor.remote.settings_title_format=* __2__ 52 | 53 | settings_title=Настройки EvoGUI 54 | 55 | settings.core_settings.title=Основные настройки(Перевод RikkiLook) 56 | settings.core_settings.update_freq_left=Обновлять EvoGUI через 57 | settings.core_settings.update_freq_right=тиков (умолчание 60 тиков в секунду) 58 | 59 | settings.sensors_frame.title=Настройки отображения 60 | 61 | settings_always_visible=Показ. всегда 62 | settings_in_popup=Показ. по клику 63 | 64 | settings_close=Закрыть 65 | 66 | 67 | direction.north=Север 68 | direction.south=Юг 69 | direction.east=Восток 70 | direction.west=Запад 71 | direction.northeast=Северо-восток 72 | direction.northwest=Северо-запад 73 | direction.southeast=Юго-восток 74 | direction.southwest=Юго-запад 75 | direction.unknown=? 76 | 77 | 78 | err_generic=[EvoGUI|__1__] Ошибка: __2__ 79 | err_specific=[EvoGUI|__1__|__2__] Ошибка: __3__ 80 | 81 | err_settings_whatsensor=__1__ can't find sensor! 82 | err_settings_whatsettings=__1__ called for settings-less sensor! 83 | 84 | err_needplayername=[EvoGUI] Нужно имя игрока! 85 | err_nosuchplayer=[EvoGUI] Нет такого игрока: __1__! 86 | err_noplayerdata=[EvoGUI] Нет игровых данных __1__! 87 | 88 | err_nosensorname=[EvoGUI] Missing a sensor name! 89 | err_no_sensor_data=[EvoGUI] Missing remote sensor data! 90 | err_sensor_missing_field=[EvoGUI] Remote sensor __1__ is missing a required field __2__! 91 | err_nosensortext=[EvoGUI] Missing sensor text for __1__! 92 | err_nosensorcaption=[EvoGUI] Missing caption text for __1__! 93 | err_nosensorfound=[EvoGUI] No sensor matching the name __1__! Create a sensor first. 94 | -------------------------------------------------------------------------------- /prototypes/styles.lua: -------------------------------------------------------------------------------- 1 | local default_gui = data.raw["gui-style"].default 2 | 3 | local function button_graphics(xpos, ypos) 4 | return { 5 | filename = "__{{MOD_NAME}}__/graphics/gui.png", 6 | priority = "extra-high-no-scale", 7 | width = 16, 8 | height = 16, 9 | x = xpos, 10 | y = ypos 11 | } 12 | end 13 | 14 | default_gui.EvoGUI_outer_frame_no_border = { 15 | type = "frame_style", 16 | parent = "outer_frame", 17 | graphical_set = {} 18 | } 19 | 20 | default_gui.EvoGUI_button_with_icon = { 21 | type = "button_style", 22 | parent = "slot_button", 23 | 24 | scalable = true, 25 | 26 | top_padding = 0, 27 | right_padding = 0, 28 | bottom_padding = 0, 29 | left_padding = 0, 30 | 31 | width = 17, 32 | height = 17, 33 | 34 | default_graphical_set = button_graphics( 0, 0), 35 | hovered_graphical_set = button_graphics(16, 0), 36 | clicked_graphical_set = button_graphics(32, 0), 37 | } 38 | 39 | 40 | 41 | default_gui.EvoGUI_expando_closed = { 42 | type = "button_style", 43 | parent = "EvoGUI_button_with_icon", 44 | 45 | default_graphical_set = button_graphics( 0, 16), 46 | hovered_graphical_set = button_graphics(16, 16), 47 | clicked_graphical_set = button_graphics(32, 16), 48 | } 49 | 50 | 51 | default_gui.EvoGUI_expando_open = { 52 | type = "button_style", 53 | parent = "EvoGUI_button_with_icon", 54 | 55 | default_graphical_set = button_graphics( 0, 32), 56 | hovered_graphical_set = button_graphics(16, 32), 57 | clicked_graphical_set = button_graphics(32, 32), 58 | } 59 | 60 | default_gui.EvoGUI_settings = { 61 | type = "button_style", 62 | parent = "EvoGUI_button_with_icon", 63 | 64 | default_graphical_set = button_graphics( 0, 48), 65 | hovered_graphical_set = button_graphics(16, 48), 66 | clicked_graphical_set = button_graphics(32, 48), 67 | } 68 | 69 | default_gui.EvoGUI_cramped_flow_v = { 70 | type = "vertical_flow_style", 71 | vertical_spacing = 1, 72 | horizontal_spacing = 1, 73 | } 74 | 75 | default_gui.EvoGUI_cramped_flow_h = { 76 | type = "horizontal_flow_style", 77 | vertical_spacing = 1, 78 | horizontal_spacing = 1, 79 | } 80 | -------------------------------------------------------------------------------- /remote.lua: -------------------------------------------------------------------------------- 1 | if not evogui then evogui = { log = function() end } end 2 | 3 | 4 | -- 5 | -- Rebuilds a given player's EvoGUI, destroying any existing settings. 6 | -- player_name: the name or player index of the player being reset 7 | local function remote_rebuild(player_name) 8 | if not player_name then 9 | evogui.log({"err_needplayername"}) 10 | return 11 | end 12 | 13 | if not game.players[player_name] then 14 | evogui.log({"err_nosuchplayer", tostring(player_name)}) 15 | return 16 | end 17 | 18 | if not global.evogui or not global.evogui[player_name] then 19 | evogui.log({"err_noplayerdata", player_name}) 20 | return 21 | end 22 | 23 | global.evogui[player_name] = nil 24 | evogui.new_player({ player_index = player_name }) 25 | end 26 | 27 | -- 28 | -- Creates a sensor managed by a remote interface (another mod or script) 29 | -- sensor_data: a table with the following fields: 30 | -- mod_name: Name of the mod registering the sensor. Sensor will be removed 31 | -- if the mod is removed from the game. 32 | -- name: Internal name of the sensor. Should be unique (otherwise you're 33 | -- just redefining the existing one). 34 | -- text: Text to display in the active gui (may be localized). 35 | -- caption: Sensor setting name in the EvoGUI settings panel (may be localized). 36 | -- color: Font color of the text to display in the active gui, optional, may be nil. 37 | -- 38 | -- example: remote.call("EvoGUI", "create_remote_sensor", { mod_name = "my_mod", 39 | -- name = "my_mod_my_sensor_name", 40 | -- text = "Text: Lorem Ipsum", 41 | -- caption = "Lorem Ipsum Text" }) 42 | -- or, with locale: 43 | -- remote.call("EvoGUI", "create_remote_sensor", { mod_name = "my_mod", 44 | -- name = "my_mod_my_sensor_name", 45 | -- text = {"my_mod_sensor_display", 42}, 46 | -- caption = {"my_mod_sensor"} }) 47 | local function create_remote_sensor(sensor_data) 48 | if not sensor_data then 49 | evogui.log({"err_no_sensor_data"}) 50 | return 51 | end 52 | 53 | for _, field in pairs({ "mod_name", "name", "text", "caption" }) do 54 | if not sensor_data[field] then 55 | evogui.log({"err_sensor_missing_field", serpent.dump(sensor_data, {compact = false, nocode = true, indent = ' '}), field}) 56 | return 57 | end 58 | end 59 | 60 | local sensor = RemoteSensor.get_by_name(sensor_data.name) 61 | if not sensor then 62 | RemoteSensor.new(sensor_data) 63 | end 64 | end 65 | 66 | -- 67 | -- Updates a sensor managed by a remote interface 68 | -- sensor_name: internal name of the sensor. The sensor should have been previously created. 69 | -- sensor_text: Text to display in the active gui 70 | -- sensor_color: Font color of the text to display in the active gui, optional, may be nil 71 | -- example: remote.call("EvoGUI", "update_remote_sensor", "mymod_my_sensor_name", "Text: Lorem Ipsum") 72 | local function update_remote_sensor(sensor_name, sensor_text, sensor_color) 73 | if not sensor_name then 74 | evogui.log({"err_nosensorname"}) 75 | return 76 | end 77 | 78 | if not sensor_text then 79 | evogui.log({"err_nosensortext", sensor_name}) 80 | return 81 | end 82 | 83 | local sensor = RemoteSensor.get_by_name(sensor_name) 84 | if not sensor then 85 | evogui.log({"err_nosensorfound", sensor_name}) 86 | return 87 | end 88 | 89 | sensor["line"] = sensor_text 90 | if sensor_color then 91 | sensor["color"] = sensor_color 92 | end 93 | end 94 | 95 | -- 96 | -- Checks if a remote sensor exists, returns true if one was does 97 | -- sensor_name: internal name of the sensor. 98 | -- example: remote.call("EvoGUI", "has_remote_sensor", "mymod_my_sensor_name") 99 | local function has_remote_sensor(sensor_name) 100 | if not sensor_name then 101 | evogui.log({"err_nosensorname"}) 102 | return 103 | end 104 | local sensor = RemoteSensor.get_by_name(sensor_name) 105 | return sensor ~= nil 106 | end 107 | 108 | -- 109 | -- Removes a sensor managed by a remote interface, returns true if one was removed 110 | -- sensor_name: internal name of the sensor. If it does not exist, it was already removed. 111 | -- example: remote.call("EvoGUI", "remove_remote_sensor", "mymod_my_sensor_name") 112 | local function remove_remote_sensor(sensor_name) 113 | if not sensor_name then 114 | evogui.log({"err_nosensorname"}) 115 | return 116 | end 117 | local sensor = RemoteSensor.get_by_name(sensor_name) 118 | if not sensor then 119 | -- impossible to know if the sensor was removed in advance, so just return a status 120 | return false 121 | end 122 | evogui.hide_sensor(sensor) 123 | for idx, sensor in pairs(evogui.value_sensors) do 124 | if sensor.name == ("remote_sensor_" .. sensor_name) then 125 | table.remove(evogui.value_sensors, idx) 126 | end 127 | end 128 | global.remote_sensors[sensor_name] = nil 129 | return true 130 | end 131 | 132 | interface = { 133 | rebuild = function(player_name) 134 | local status, retval = pcall(remote_rebuild, player_name) 135 | 136 | if status then return retval 137 | elseif retval then evogui.log({"err_generic", "remote.rebuild", retval}) end 138 | end, 139 | 140 | create_remote_sensor = function(sensor_data) 141 | local status, retval = pcall(create_remote_sensor, sensor_data) 142 | 143 | if status then return retval 144 | elseif retval then evogui.log({"err_generic", "remote.create_remote_sensor", retval}) end 145 | end, 146 | 147 | update_remote_sensor = function(sensor_name, sensor_text, sensor_color) 148 | local status, retval = pcall(update_remote_sensor, sensor_name, sensor_text, sensor_color) 149 | 150 | if status then return retval 151 | elseif retval then evogui.log({"err_generic", "remote.update_remote_sensor", retval}) end 152 | end, 153 | 154 | has_remote_sensor = function(sensor_name) 155 | local status, retval = pcall(has_remote_sensor, sensor_name) 156 | 157 | if status then return retval 158 | elseif retval then evogui.log({"err_generic", "remote.has_remote_sensor", retval}) end 159 | end, 160 | 161 | remove_remote_sensor = function(sensor_name) 162 | local status, retval = pcall(remove_remote_sensor, sensor_name) 163 | 164 | if status then return retval 165 | elseif retval then evogui.log({"err_generic", "remote.remove_remote_sensor", retval}) end 166 | end 167 | } 168 | 169 | 170 | remote.add_interface("EvoGUI", interface) 171 | -------------------------------------------------------------------------------- /settingsGUI.lua: -------------------------------------------------------------------------------- 1 | if not evogui then evogui = {} end 2 | 3 | if not global.evogui then global.evogui = {} end 4 | if not global.settings then global.settings = {} end 5 | 6 | 7 | local function toggle_always_visible(event) 8 | local player = game.players[event.player_index] 9 | 10 | local always_visible = global.evogui[player.name].always_visible 11 | local sensor_name = event.element.name:sub(24,-1) 12 | if event.element.state then 13 | always_visible[sensor_name] = true 14 | else 15 | always_visible[sensor_name] = nil 16 | end 17 | end 18 | 19 | 20 | local function toggle_in_popup(event) 21 | local player = game.players[event.player_index] 22 | 23 | local in_popup = global.evogui[player.name].in_popup 24 | local sensor_name = event.element.name:sub(24,-1) 25 | if event.element.state then 26 | in_popup[sensor_name] = true 27 | else 28 | in_popup[sensor_name] = nil 29 | end 30 | end 31 | 32 | 33 | local function on_sensor_settings_closed(player_index) 34 | evogui.evoGUI_settings({player_index = player_index}) 35 | end 36 | 37 | local function trigger_settings_gui(event) 38 | local player = game.players[event.player_index] 39 | 40 | local sensor_name = event.element.name:sub(42,-1) 41 | local sensor = ValueSensor.get_by_name(sensor_name) 42 | if sensor == nil then 43 | error({"err_settings_whatsensor", "trigger_settings_gui"}) 44 | return 45 | end 46 | 47 | if sensor.settings_gui == nil then 48 | error({"err_settings_whatsettings", "trigger_settings_gui"}) 49 | return 50 | end 51 | 52 | if player.gui.center.evoGUI_settingsGUI ~= nil then 53 | player.gui.center.evoGUI_settingsGUI.destroy() 54 | end 55 | 56 | sensor.settings_gui_closed = on_sensor_settings_closed 57 | sensor:settings_gui(event.player_index) 58 | end 59 | 60 | 61 | local function add_sensor_table_row(table, sensor, always_visible, in_popup) 62 | local sensor_always_visible = always_visible[sensor.name] ~= nil 63 | local sensor_in_popup = in_popup[sensor.name] ~= nil 64 | 65 | table.add{type="label", caption=sensor.display_name} 66 | table.add{type="checkbox", name="evogui_settings_gui_av_"..sensor.name, 67 | caption={"settings_always_visible"}, state=sensor_always_visible} 68 | table.add{type="checkbox", name="evogui_settings_gui_ip_"..sensor.name, 69 | caption={"settings_in_popup"}, state=sensor_in_popup} 70 | if sensor.settings_gui ~= nil then 71 | local button_name = "evogui_settings_gui_trigger_settings_gui_"..sensor.name 72 | table.add{type="button", name=button_name, 73 | style="EvoGUI_settings"} 74 | else 75 | table.add{type="flow"} -- empty, but there has to be _something_ there. 76 | end 77 | end 78 | 79 | function evogui.on_settings_click(event) 80 | if event.element.name == "evogui_settings_gui_settings_open" then 81 | evogui.evoGUI_settings(event) 82 | elseif event.element.name == "evogui_settings_gui_settings_close" then 83 | evogui.evoGUI_settings_close(event) 84 | elseif string.starts_with(event.element.name, "evogui_settings_gui_trigger_settings_gui_") then 85 | trigger_settings_gui(event) 86 | elseif string.starts_with(event.element.name, "evogui_settings_gui_av_") then 87 | toggle_always_visible(event) 88 | elseif string.starts_with(event.element.name, "evogui_settings_gui_ip") then 89 | toggle_in_popup(event) 90 | end 91 | end 92 | 93 | 94 | function evogui.evoGUI_settings(event) 95 | local player = game.players[event.player_index] 96 | if player.gui.center.evoGUI_settingsGUI ~= nil then 97 | player.gui.center.evoGUI_settingsGUI.destroy() 98 | return 99 | end 100 | 101 | evogui.create_player_globals(player) 102 | local player_data = global.evogui[player.name] 103 | 104 | local root = player.gui.center.add{type="frame", 105 | direction="vertical", 106 | name="evoGUI_settingsGUI", 107 | caption={"settings_title"}} 108 | 109 | local core_settings = root.add{type="frame", 110 | name="core_settings", 111 | caption={"settings.core_settings.title"}, 112 | direction="vertical", 113 | style="naked_frame"} 114 | 115 | local update_freq_flow = core_settings.add{type="flow", name="update_freq_flow", direction="horizontal"} 116 | update_freq_flow.add{type="label", caption={"settings.core_settings.update_freq_left"}} 117 | local textfield = update_freq_flow.add{type="textfield", name="textfield", style="short_number_textfield"} 118 | textfield.text=tostring(global.settings.update_delay) 119 | update_freq_flow.add{type="label", caption={"settings.core_settings.update_freq_right"}} 120 | 121 | local sensors_frame = root.add{type="frame", 122 | name="sensors_frame", 123 | caption={"settings.sensors_frame.title"}, 124 | direction="vertical", 125 | style="naked_frame"} 126 | 127 | local table = sensors_frame.add{type="table", name="table", column_count=4} 128 | 129 | for _, sensor in ipairs(evogui.value_sensors) do 130 | add_sensor_table_row(table, sensor, player_data.always_visible, player_data.in_popup) 131 | end 132 | 133 | local buttons = root.add{type="flow", name="buttons", direction="horizontal"} 134 | buttons.add{type="button", name="evogui_settings_gui_settings_close", caption={"settings_close"}} 135 | end 136 | 137 | 138 | function evogui.evoGUI_settings_close(event) 139 | local player = game.players[event.player_index] 140 | 141 | local new_update_freq = tonumber(player.gui.center.evoGUI_settingsGUI.core_settings.update_freq_flow.textfield.text) 142 | if new_update_freq ~= nil then 143 | global.settings.update_delay = new_update_freq 144 | end 145 | 146 | if player.gui.center.evoGUI_settingsGUI ~= nil then 147 | player.gui.center.evoGUI_settingsGUI.destroy() 148 | end 149 | end 150 | -------------------------------------------------------------------------------- /value_sensors/day_time.lua: -------------------------------------------------------------------------------- 1 | require "template" 2 | 3 | local sensor = ValueSensor.new("day_time") 4 | 5 | if remote.interfaces.MoWeather then 6 | -- assume MoWeather's getdaytime is sane 7 | function get_day_time(player) return remote.call("MoWeather", "getdaytime", player.surface.index) end 8 | else 9 | -- 0.5 is midnight; let's make days *start* at midnight instead. 10 | function get_day_time(player) return player.surface.daytime + 0.5 end 11 | end 12 | 13 | sensor.show_day_number = sensor:make_on_click_checkbox_handler("show_day_number") 14 | sensor.minute_rounding = sensor:make_on_click_checkbox_handler("minute_rounding") 15 | 16 | function sensor:get_line(player) 17 | local day_time = math.fmod(get_day_time(player), 1) 18 | 19 | local day_time_minutes = math.floor(day_time * 24 * 60) 20 | local day_time_hours = math.floor(day_time_minutes / 60) 21 | 22 | local display_minutes = day_time_minutes 23 | if self.settings.minute_rounding then 24 | display_minutes = day_time_minutes - (day_time_minutes % 15) 25 | end 26 | 27 | local brightness = math.floor((1 - player.surface.darkness) * 100) 28 | 29 | if self.settings.show_day_number then 30 | local day_number = 1 + ((game.tick + 12500) / 25000) 31 | return {"sensor.day_time.day_format", 32 | string.format("%d:%02d", day_time_hours, display_minutes % 60), 33 | string.format("%d", day_number), 34 | string.format("%d%%", brightness)} 35 | else 36 | return {self.format_key, 37 | string.format("%d:%02d", day_time_hours, display_minutes % 60), 38 | string.format("%d%%", brightness)} 39 | end 40 | end 41 | 42 | 43 | function sensor:settings_gui(player_index) 44 | local player = game.players[player_index] 45 | local sensor_settings = global.evogui[player.name].sensor_settings[self.name] 46 | local root_name = self:settings_root_name() 47 | 48 | local root = player.gui.center.add{type="frame", 49 | name=root_name, 50 | direction="vertical", 51 | caption={"sensor.day_time.settings.title"}} 52 | root.add{type="checkbox", name="evogui_sensor_day_time_checkbox_show_day_number", 53 | caption={"sensor.day_time.settings.show_day_number"}, 54 | state=sensor_settings.show_day_number} 55 | 56 | root.add{type="checkbox", name="evogui_sensor_day_time_checkbox_minute_rounding", 57 | caption={"sensor.day_time.settings.minute_rounding"}, 58 | state=sensor_settings.minute_rounding} 59 | 60 | root.add{type="button", name="evogui_sensor_day_time_btn_close", caption={"settings_close"}} 61 | end 62 | 63 | ValueSensor.register(sensor) 64 | -------------------------------------------------------------------------------- /value_sensors/evolution_factor.lua: -------------------------------------------------------------------------------- 1 | require "template" 2 | 3 | local sensor = ValueSensor.new("evolution_factor") 4 | sensor.extra_precision = sensor:make_on_click_checkbox_handler("extra_precision") 5 | 6 | function sensor:get_line(player) 7 | local percent_evo_factor = game.forces.enemy.evolution_factor * 100 8 | -- this nonsense is because string.format(%.4f) is not safe in MP across platforms, but integer math is 9 | local whole_number = math.floor(percent_evo_factor) 10 | local fractional_component = math.floor((percent_evo_factor - whole_number) * 10) 11 | if self.settings.extra_precision then 12 | fractional_component = math.floor((percent_evo_factor - whole_number) * 10000) 13 | return {self.format_key, string.format("%d.%04d%%", whole_number, fractional_component)} 14 | end 15 | 16 | return {self.format_key, string.format("%d.%d%%", whole_number, fractional_component)} 17 | end 18 | 19 | 20 | function sensor:settings_gui(player_index) 21 | local player = game.players[player_index] 22 | local sensor_settings = global.evogui[player.name].sensor_settings[self.name] 23 | local root_name = self:settings_root_name() 24 | 25 | local root = player.gui.center.add{type="frame", 26 | name=root_name, 27 | direction="vertical", 28 | caption={"sensor.evolution_factor.settings.title"}} 29 | root.add{type="checkbox", name="evogui_sensor_evolution_factor_checkbox_extra_precision", 30 | caption={"sensor.evolution_factor.settings.extra_precision"}, 31 | state=sensor_settings.extra_precision} 32 | 33 | root.add{type="button", name="evogui_sensor_evolution_factor_close", caption={"settings_close"}} 34 | end 35 | 36 | ValueSensor.register(sensor) 37 | -------------------------------------------------------------------------------- /value_sensors/kill_count.lua: -------------------------------------------------------------------------------- 1 | require "template" 2 | 3 | -- Preload known vanilla types 4 | local entity_types = { 5 | ["unit"] = { 6 | ["small-biter"] = true, 7 | ["medium-biter"] = true, 8 | ["big-biter"] = true, 9 | ["behemoth-biter"] = true, 10 | ["small-spitter"] = true, 11 | ["medium-spitter"] = true, 12 | ["big-spitter"] = true, 13 | ["behemoth-spitter"] = true, 14 | }, 15 | ["unit-spawner"] = { 16 | ["biter-spawner"] = true, 17 | ["spitter-spawner"] = true, 18 | }, 19 | } 20 | 21 | local function is_entity_type(what_type, entity_name) 22 | if not entity_types[what_type] then entity_types[what_type] = {} end 23 | local type_cache = entity_types[what_type] 24 | 25 | if type_cache[entity_name] ~= nil then 26 | return type_cache[entity_name] 27 | end 28 | 29 | local prototype = game.entity_prototypes[entity_name] 30 | if prototype and prototype.type == what_type then 31 | type_cache[entity_name] = true 32 | else 33 | type_cache[entity_name] = false 34 | end 35 | 36 | return type_cache[entity_name] 37 | end 38 | 39 | 40 | local function is_biter(entity_name) 41 | return is_entity_type("unit", entity_name) 42 | end 43 | 44 | 45 | local function is_spawner(entity_name) 46 | return is_entity_type("unit-spawner", entity_name) 47 | end 48 | 49 | 50 | local sensor = ValueSensor.new("kill_count") 51 | 52 | function sensor:update_ui(owner) 53 | local player = game.players[owner.player_index] 54 | 55 | local biter_count = 0 56 | local spawner_count = 0 57 | local other_count = 0 58 | for entity_name, kill_count in pairs(player.force.kill_count_statistics.input_counts) do 59 | if is_biter(entity_name) then 60 | biter_count = biter_count + kill_count 61 | elseif is_spawner(entity_name) then 62 | spawner_count = spawner_count + kill_count 63 | else 64 | other_count = other_count + kill_count 65 | end 66 | end 67 | 68 | local biter_kills = {"sensor.kill_count.biter_fragment_single"} 69 | if biter_count ~= 1 then 70 | biter_kills = {"sensor.kill_count.biter_fragment_multiple", evogui.format_number(biter_count)} 71 | end 72 | 73 | local spawner_kills = {"sensor.kill_count.spawner_fragment_single"} 74 | if spawner_count ~= 1 then 75 | spawner_kills = {"sensor.kill_count.spawner_fragment_multiple", evogui.format_number(spawner_count)} 76 | end 77 | 78 | local other_kills = {"sensor.kill_count.other_fragment_single"} 79 | if other_count ~= 1 then 80 | other_kills = {"sensor.kill_count.other_fragment_multiple", evogui.format_number(other_count)} 81 | end 82 | 83 | owner[self.name].caption = {self.format_key, biter_kills, spawner_kills, other_kills} 84 | end 85 | 86 | ValueSensor.register(sensor) 87 | 88 | -------------------------------------------------------------------------------- /value_sensors/play_time.lua: -------------------------------------------------------------------------------- 1 | require "template" 2 | 3 | local sensor = ValueSensor.new("play_time") 4 | sensor.show_days = sensor:make_on_click_checkbox_handler("show_days") 5 | sensor.show_seconds = sensor:make_on_click_checkbox_handler("show_seconds") 6 | sensor.show_personal_time = sensor:make_on_click_checkbox_handler("show_personal_time") 7 | 8 | 9 | local function format_play_time(ticks, settings) 10 | local seconds = math.floor(ticks / 60) 11 | local minutes = math.floor(seconds / 60) 12 | local hours = math.floor(minutes / 60) 13 | local days = math.floor(hours / 24) 14 | 15 | local result = {""} 16 | if days > 0 and settings.show_days then 17 | if days == 1 then 18 | table.insert(result, {"sensor.play_time.single_day_fragment"}) 19 | else 20 | table.insert(result, {"sensor.play_time.multi_day_fragment", tostring(days)}) 21 | end 22 | table.insert(result, ' ') 23 | hours = hours % 24 24 | end 25 | 26 | if settings.show_seconds then 27 | table.insert(result, string.format("%d:%02d:%02d", hours, minutes % 60, seconds % 60)) 28 | else 29 | table.insert(result, string.format("%d:%02d", hours, minutes % 60)) 30 | end 31 | 32 | return result 33 | end 34 | 35 | 36 | function sensor:get_line(player) 37 | local desc = {"", format_play_time(game.tick, self.settings)} 38 | 39 | if self.settings.show_personal_time then 40 | table.insert(desc, ' ') 41 | table.insert(desc, {"sensor.play_time.personal_time_fragment", format_play_time(player.online_time, self.settings)}) 42 | end 43 | 44 | return {self.format_key, desc} 45 | end 46 | 47 | 48 | function sensor:settings_gui(player_index) 49 | local player = game.players[player_index] 50 | local sensor_settings = global.evogui[player.name].sensor_settings[self.name] 51 | local root_name = self:settings_root_name() 52 | 53 | local root = player.gui.center.add{type="frame", 54 | name=root_name, 55 | direction="vertical", 56 | caption={"sensor.play_time.settings.title"}} 57 | root.add{type="checkbox", name="evogui_sensor_play_time_checkbox_show_days", 58 | caption={"sensor.play_time.settings.show_days"}, 59 | state=sensor_settings.show_days} 60 | 61 | root.add{type="checkbox", name="evogui_sensor_play_time_checkbox_show_seconds", 62 | caption={"sensor.play_time.settings.show_seconds"}, 63 | state=sensor_settings.show_seconds} 64 | 65 | root.add{type="checkbox", name="evogui_sensor_play_time_checkbox_show_personal_time", 66 | caption={"sensor.play_time.settings.show_personal_time"}, 67 | state=sensor_settings.show_personal_time or false} 68 | 69 | root.add{type="button", name="evogui_sensor_play_time_close", caption={"settings_close"}} 70 | end 71 | 72 | 73 | ValueSensor.register(sensor) 74 | -------------------------------------------------------------------------------- /value_sensors/player_locations.lua: -------------------------------------------------------------------------------- 1 | require "template" 2 | 3 | if not evogui.on_click then evogui.on_click = {} end 4 | local sensor = ValueSensor.new("player_locations") 5 | sensor.show_player_index = sensor:make_on_click_checkbox_handler("show_player_index") 6 | sensor.show_position = sensor:make_on_click_checkbox_handler("show_position") 7 | sensor.show_surface = sensor:make_on_click_checkbox_handler("show_surface") 8 | sensor.show_direction = sensor:make_on_click_checkbox_handler("show_direction") 9 | sensor.show_offline = sensor:make_on_click_checkbox_handler("show_offline") 10 | 11 | 12 | function sensor:create_ui(owner) 13 | if owner[self.name] == nil then 14 | local root = owner.add{type="flow", 15 | name=self.name, 16 | direction="horizontal", 17 | style="EvoGUI_cramped_flow_h"} 18 | 19 | root.add{type="label", caption={self.format_key}} 20 | root.add{type="table", name="player_list", column_count=1} 21 | end 22 | end 23 | 24 | 25 | function sensor:settings_gui(player_index) 26 | local player = game.players[player_index] 27 | local sensor_settings = global.evogui[player.name].sensor_settings[self.name] 28 | local root_name = self:settings_root_name() 29 | 30 | local root = player.gui.center.add{type="frame", 31 | name=root_name, 32 | direction="vertical", 33 | caption={"sensor.player_locations.settings.title"}} 34 | root.add{type="checkbox", name="evogui_sensor_player_locations_checkbox_show_player_index", 35 | caption={"sensor.player_locations.settings.show_player_index"}, 36 | state=sensor_settings.show_player_index} 37 | 38 | root.add{type="checkbox", name="evogui_sensor_player_locations_checkbox_show_position", 39 | caption={"sensor.player_locations.settings.show_position"}, 40 | state=sensor_settings.show_position} 41 | 42 | root.add{type="checkbox", name="evogui_sensor_player_locations_checkbox_show_surface", 43 | caption={"sensor.player_locations.settings.show_surface"}, 44 | state=sensor_settings.show_surface} 45 | 46 | root.add{type="checkbox", name="evogui_sensor_player_locations_checkbox_show_direction", 47 | caption={"sensor.player_locations.settings.show_direction"}, 48 | state=sensor_settings.show_direction} 49 | 50 | root.add{type="checkbox", name="evogui_sensor_player_locations_checkbox_show_offline", 51 | caption={"sensor.player_locations.settings.show_offline"}, 52 | state=sensor_settings.show_offline} 53 | 54 | root.add{type="button", name="evogui_sensor_player_locations_close", caption={"settings_close"}} 55 | end 56 | 57 | local function directions(source, destination) 58 | -- Directions to or from positionless things? Hrm. 59 | if not source.position or not destination.position then return {"direction.unknown"} end 60 | 61 | local delta_x = destination.position.x - source.position.x 62 | local delta_y = destination.position.y - source.position.y 63 | 64 | if math.abs(delta_x) < 2 and math.abs(delta_y) < 2 then return '' end 65 | 66 | return evogui.get_octant_name{x=delta_x, y=delta_y} 67 | end 68 | 69 | 70 | local function get_online_time(player) 71 | local minutes = math.floor(player.online_time / 3600) 72 | local hours = math.floor(minutes / 60) 73 | local days = math.floor(hours / 24) 74 | 75 | local result = {""} 76 | if days > 0 then 77 | if days == 1 then 78 | table.insert(result, {"sensor.player_locations.single_day_fragment"}) 79 | else 80 | table.insert(result, {"sensor.player_locations.multi_day_fragment", tostring(days)}) 81 | end 82 | table.insert(result, ' ') 83 | end 84 | 85 | table.insert(result, string.format("%d:%02d", hours % 24, minutes % 60)) 86 | 87 | return result 88 | end 89 | 90 | 91 | function sensor:update_ui(owner) 92 | local player = game.players[owner.player_index] 93 | local sensor_settings = global.evogui[player.name].sensor_settings[self.name] 94 | local gui_list = owner[self.name].player_list 95 | 96 | for _, p in pairs(game.players) do 97 | local player_name = p.name 98 | if not player_name or player_name == '' then 99 | -- fallback to "Local Player" if this is singleplayer 100 | if #game.players == 1 then 101 | player_name = "sensor.player_locations.local_player" 102 | else 103 | if gui_list.error == nil then 104 | gui_list.add{type="label", name="error", caption={"sensor.player_locations.err_no_name"}} 105 | end 106 | break 107 | end 108 | end 109 | 110 | if gui_list.error ~= nil then gui_list.error.destroy() end 111 | 112 | if p.connected == false and not sensor_settings.show_offline then 113 | if gui_list[player_name] and gui_list[player_name].valid then 114 | gui_list[player_name].destroy() 115 | end 116 | goto next_player 117 | end 118 | 119 | if gui_list[player_name] == nil then 120 | gui_list.add{type="label", name=player_name} 121 | end 122 | 123 | local direction = '?' 124 | local current_player = game.players[owner.player_index] 125 | if p == current_player then 126 | direction = '' 127 | elseif current_player then 128 | direction = directions(current_player, p) 129 | end 130 | 131 | local desc = {''} 132 | if sensor_settings.show_player_index then 133 | table.insert(desc, string.format('(%d) ', p.index)) 134 | end 135 | 136 | if player_name == "sensor.player_locations.local_player" then 137 | table.insert(desc, {player_name}) 138 | else 139 | table.insert(desc, player_name) 140 | end 141 | 142 | table.insert(desc, ' ') 143 | if p.connected then 144 | table.insert(desc, {"sensor.player_locations.online_fragment", get_online_time(p)}) 145 | else 146 | table.insert(desc, {"sensor.player_locations.offline_fragment", get_online_time(p)}) 147 | end 148 | 149 | if sensor_settings.show_position or sensor_settings.show_surface then 150 | table.insert(desc, ' (') 151 | if sensor_settings.show_position then 152 | table.insert(desc, string.format('@%d, %d', math.floor(p.position.x), math.floor(p.position.y))) 153 | end 154 | if sensor_settings.show_surface then 155 | if sensor_settings.show_position then 156 | table.insert(desc, ' ') 157 | end 158 | table.insert(desc, {"sensor.player_locations.surface_fragment", p.surface.name}) 159 | end 160 | table.insert(desc, ')') 161 | end 162 | 163 | if sensor_settings.show_direction then 164 | table.insert(desc, ' ') 165 | table.insert(desc, direction) 166 | end 167 | 168 | gui_list[player_name].caption = desc 169 | ::next_player:: 170 | end 171 | end 172 | 173 | ValueSensor.register(sensor) 174 | -------------------------------------------------------------------------------- /value_sensors/pollution_around_player.lua: -------------------------------------------------------------------------------- 1 | require "template" 2 | 3 | local sensor = ValueSensor.new("pollution_around_player") 4 | 5 | function sensor:get_line(player) 6 | local surface = player.surface 7 | local pollution = surface.get_pollution(player.position) 8 | 9 | -- this nonsense is because string.format(%.1f) is not safe in MP across platforms, but integer math is 10 | local whole_number = math.floor(pollution) 11 | local fractional_component = math.floor((pollution - whole_number) * 10) 12 | 13 | return {self.format_key, (whole_number .. "." .. fractional_component)} 14 | end 15 | 16 | ValueSensor.register(sensor) 17 | -------------------------------------------------------------------------------- /value_sensors/remote_sensor.lua: -------------------------------------------------------------------------------- 1 | require "template" 2 | 3 | RemoteSensor = {} 4 | function RemoteSensor.new(sensor_data) 5 | local sensor = ValueSensor.new("remote_sensor_" .. sensor_data.name) 6 | 7 | sensor["mod_name"] = sensor_data.mod_name 8 | sensor["line"] = sensor_data.text 9 | sensor["display_name"] = {"sensor.remote.settings_title_format", sensor_data.mod_name, sensor_data.caption} 10 | sensor["color"] = sensor_data.color 11 | 12 | function sensor:set_line(text) 13 | self.line = text 14 | end 15 | 16 | function sensor:get_line(player) 17 | return self.line 18 | end 19 | 20 | ValueSensor.register(sensor) 21 | if not global.remote_sensors then 22 | global.remote_sensors = {} 23 | end 24 | 25 | -- store sensor data for global serialization 26 | global.remote_sensors[sensor_data.name] = sensor_data 27 | end 28 | 29 | function RemoteSensor.get_by_name(name) 30 | return ValueSensor.get_by_name("remote_sensor_" .. name) 31 | end 32 | 33 | local remote_initialized = false 34 | 35 | function RemoteSensor.initialize() 36 | if remote_initialized then return end 37 | 38 | -- Initialize any remote sensors that were previously saved 39 | if global.remote_sensors then 40 | for _, sensor_data in pairs(global.remote_sensors) do 41 | if not RemoteSensor.get_by_name(sensor_data.name) then 42 | RemoteSensor.new(sensor_data) 43 | end 44 | end 45 | end 46 | 47 | remote_initialized = true 48 | end 49 | 50 | return RemoteSensor 51 | -------------------------------------------------------------------------------- /value_sensors/template.lua: -------------------------------------------------------------------------------- 1 | 2 | ValueSensor = {} 3 | 4 | if not evogui then evogui = {} end 5 | if not evogui.value_sensors then evogui.value_sensors = {} end 6 | 7 | function ValueSensor.new(name) 8 | local sensor = { 9 | ["name"] = name, 10 | ["display_name"] = { "sensor."..name..".name" }, 11 | ["format_key"] = "sensor."..name..".format", 12 | ["color"] = { r = 255, g = 255, b = 255 }, 13 | } 14 | 15 | function sensor:get_line(player) 16 | return self.display_name 17 | end 18 | 19 | function sensor:create_ui(owner) 20 | if owner[self.name] == nil then 21 | owner.add{type="label", name=self.name} 22 | end 23 | end 24 | 25 | function sensor:update_ui(owner) 26 | local player = game.players[owner.player_index] 27 | local sensor_settings = global.evogui[player.name].sensor_settings[self.name] 28 | 29 | self.settings = sensor_settings 30 | 31 | owner[self.name].caption = self:get_line(player) 32 | owner[self.name].style.font_color = self.color 33 | end 34 | 35 | function sensor:delete_ui(owner) 36 | if owner[self.name] ~= nil then 37 | owner[self.name].destroy() 38 | end 39 | end 40 | 41 | function sensor:settings_root_name() 42 | return self.name.."_settings" 43 | end 44 | 45 | function sensor:on_click(event) 46 | if string.starts_with(event.element.name, "evogui_sensor_" .. self.name .. "_checkbox_") then 47 | local len = string.len("evogui_sensor_" .. self.name .. "_checkbox_") 48 | local function_name = event.element.name:sub(len + 1,-1) 49 | self[function_name](event) 50 | else 51 | self:close_settings_gui(event.player_index) 52 | end 53 | end 54 | 55 | function sensor:close_settings_gui(player_index) 56 | local player = game.players[player_index] 57 | local root_name = self:settings_root_name() 58 | 59 | player.gui.center[root_name].destroy() 60 | 61 | if self.settings_gui_closed then self.settings_gui_closed(player_index) end 62 | end 63 | 64 | function sensor:make_on_click_checkbox_handler(setting_name) 65 | local sensor_name = self.name 66 | 67 | return function(event) 68 | local player = game.players[event.player_index] 69 | local sensor_settings = global.evogui[player.name].sensor_settings[sensor_name] 70 | 71 | sensor_settings[setting_name] = event.element.state 72 | end 73 | end 74 | 75 | return sensor 76 | end 77 | 78 | function ValueSensor.register(sensor) 79 | table.insert(evogui.value_sensors, sensor) 80 | end 81 | 82 | function ValueSensor.get_by_name(sensor_name) 83 | for _, sensor in pairs(evogui.value_sensors) do 84 | if sensor.name == sensor_name then 85 | return sensor 86 | end 87 | end 88 | return nil 89 | end 90 | 91 | return ValueSensor 92 | --------------------------------------------------------------------------------