From f5d548e709376da7cb7cf029d8a6bf1080d76fde Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Sun, 29 Dec 2024 14:04:13 +0900 Subject: [PATCH 001/406] . --- .gitignore | 5 + README.md | 34 +- exp_legacy/module/config/_file_loader.lua | 10 +- exp_legacy/module/config/advanced_start.lua | 43 +-- exp_legacy/module/config/bonus.lua | 132 ++++---- exp_legacy/module/config/discord_alerts.lua | 23 +- .../config/expcore/permission_groups.lua | 32 +- exp_legacy/module/config/expcore/roles.lua | 319 +++++++++--------- exp_legacy/module/config/join_messages.lua | 6 - exp_legacy/module/config/spawn_area.lua | 206 +++-------- exp_legacy/module/config/vlayer.lua | 79 +++-- exp_legacy/module/locale/en/data.cfg | 2 +- exp_legacy/module/locale/en/expcore.cfg | 2 +- exp_legacy/module/locale/en/gui.cfg | 36 +- exp_legacy/module/locale/zh-CN/addons.cfg | 22 +- exp_legacy/module/locale/zh-CN/data.cfg | 4 +- exp_legacy/module/locale/zh-CN/gui.cfg | 37 +- exp_legacy/module/locale/zh-TW/addons.cfg | 22 +- exp_legacy/module/locale/zh-TW/data.cfg | 4 +- exp_legacy/module/locale/zh-TW/gui.cfg | 36 +- .../module/modules/addons/compilatron.lua | 4 +- exp_legacy/module/modules/control/vlayer.lua | 26 +- exp_legacy/module/modules/gui/vlayer.lua | 42 +-- 23 files changed, 532 insertions(+), 594 deletions(-) diff --git a/.gitignore b/.gitignore index 1ae60152..88ffb62e 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,8 @@ node_modules/ package-lock.json pnpm-lock.yaml .vscode +exp_util/node-compile-cache/ +exp_commands/node-compile-cache/ +exp_groups/node-compile-cache/ +exp_legacy/node-compile-cache/ +exp_scenario/node-compile-cache/ diff --git a/README.md b/README.md index 83c95cb1..85dad859 100644 --- a/README.md +++ b/README.md @@ -1,17 +1,20 @@

logo
- - Release + + Release - - Downloads + + Downloads - - Star + + Star - - Fork + + Fork + + + CodeFactor Discord @@ -25,9 +28,9 @@ Explosive Gaming (often ExpGaming) is a server hosting community with a strong f ## Installation -This is a plugin collection for [Clusterio](https://github.com/clusterio/clusterio) which implements all our scenario features. +This is a plugin collection for [Clusterio](https://github.com/clusterio/clusterio) which provides all our scenario features. -To use this plugin you must have a clusterio instance running, see [here](https://github.com/clusterio/clusterio?tab=readme-ov-file#installation) for clusterio installation instructions. +To use this plugin you must already have a clusterio instance running, see [here](https://github.com/clusterio/clusterio?tab=readme-ov-file#installation) for clusterio installation instructions. This module is currently not published and therefore can not be installed via `npm`. Instead follow the steps for [building from source](#building-from-source) @@ -35,8 +38,8 @@ This module is currently not published and therefore can not be installed via `n 1) Create a `external_plugins` directory within your clusterio instance. 2) Clone this repository into that directory: `git clone https://github.com/explosivegaming/ExpCluster` -3) Install the package dev dependencies: `pnpm install` (`pnpm` is recommended over `npm`) -4) Add supported plugins will be loaded on next controller / host restart. +3) Install the package dev dependencies: `pnpm install` +4) Add the plugins to your clusterio instance such as: `npx clusteriocontroller plugin add ./external_plugins/ExpCluster/exp_groups` ## Contributing @@ -68,7 +71,7 @@ See [Contributing](CONTRIBUTING.md) for how to make pull requests and issues. | [1.0][s1.0] | Modulation | [0.15][f0.15] | | [0.1][s0.1] | First Tracked Version | [0.14][f0.14] | -\* Scenario patch releases have been omitted and can be found [here](https://github.com/explosivegaming/scenario/releases). +\* Scenario patch releases have been omitted and can be found [here][releases]. \*\* Factorio versions show the version they were made for, often the minimum requirement to run the scenario. @@ -119,6 +122,11 @@ See [Contributing](CONTRIBUTING.md) for how to make pull requests and issues. The Explosive Gaming codebase is licensed under the [MIT](LICENSE) +[stable-dl]: https://github.com/explosivegaming/scenario/archive/master.zip +[experimental-dl]: https://github.com/explosivegaming/scenario/archive/dev.zip +[releases]: https://github.com/explosivegaming/scenario/releases [factorio]: https://factorio.com +[docs]: https://explosivegaming.github.io/scenario +[issues]: https://github.com/explosivegaming/scenario/issues/new/choose [website]: https://explosivegaming.nl [discord]: https://discord.explosivegaming.nl diff --git a/exp_legacy/module/config/_file_loader.lua b/exp_legacy/module/config/_file_loader.lua index 9e72d522..3ab87539 100644 --- a/exp_legacy/module/config/_file_loader.lua +++ b/exp_legacy/module/config/_file_loader.lua @@ -13,9 +13,9 @@ return { "modules.addons.advanced-start", "modules.addons.spawn-area", "modules.addons.compilatron", - "modules.addons.scorched-earth", - "modules.addons.pollution-grading", - "modules.addons.station-auto-name", + --"modules.addons.scorched-earth", + --"modules.addons.pollution-grading", + --"modules.addons.station-auto-name", "modules.addons.discord-alerts", "modules.addons.chat-reply", "modules.addons.tree-decon", @@ -44,8 +44,8 @@ return { --- GUI "modules.gui.readme", - "modules.gui.rocket-info", - "modules.gui.science-info", + -- "modules.gui.rocket-info", + -- "modules.gui.science-info", "modules.gui.autofill", "modules.gui.warp-list", "modules.gui.task-list", diff --git a/exp_legacy/module/config/advanced_start.lua b/exp_legacy/module/config/advanced_start.lua index 6653d06b..cbbfe84a 100644 --- a/exp_legacy/module/config/advanced_start.lua +++ b/exp_legacy/module/config/advanced_start.lua @@ -25,6 +25,7 @@ end --- Use to make a split point for the number of items given based on amount made -- ['firearm-magazine']=cutoff_amount_made(100, 10, 0) -- give 10 items until 100 items have been made +--[[ local function cutoff_amount_made(amount, before, after) return function(amount_made, items_made, player) if amount_made < amount then @@ -34,9 +35,11 @@ local function cutoff_amount_made(amount, before, after) end end end +]] --- Same as above but will not give any items if x amount has been made of another item, useful for tiers -- ['light-armor']=cutoff_amount_made_unless(5, 0,1,'heavy-armor',5) -- give light armor once 5 have been made unless 5 heavy armor has been made +--[[ local function cutoff_amount_made_unless(amount, before, after, second_item, second_amount) return function(amount_made, items_made, player) if items_made(second_item) < second_amount then @@ -50,9 +53,11 @@ local function cutoff_amount_made_unless(amount, before, after, second_item, sec end end end +]] -- Use for mass production items where you want the amount to change based on the amount already made -- ['iron-plate']=scale_amount_made(5*minutes, 10, 10) -- for first 5 minutes give 10 items then after apply a factor of 10 +--[[ local function scale_amount_made(amount, before, scalar) return function(amount_made, items_made, player) if amount_made < amount then @@ -62,6 +67,7 @@ local function scale_amount_made(amount, before, scalar) end end end +]] --[[ Common values @@ -79,33 +85,28 @@ return { enemy_expansion = false, --- @setting enemy_expansion a catch all for in case the map settings file fails to load chart_radius = 10 * 32, --- @setting chart_radius the number of tiles that will be charted when the map starts items = { --- @setting items items and there condition for being given - -- ['item-name'] = function(amount_made, production_stats, player) return end -- 0 means no items given - -- Plates - ["iron-plate"] = scale_amount_made(100, 10, 10), - ["copper-plate"] = scale_amount_made(100, 0, 8), - ["steel-plate"] = scale_amount_made(100, 0, 4), - -- Secondary Items - ["electronic-circuit"] = scale_amount_made(1000, 0, 6), - ["iron-gear-wheel"] = scale_amount_made(1000, 0, 6), - -- Starting Items - ["burner-mining-drill"] = cutoff_time(10 * minutes, 4, 0), - ["stone-furnace"] = cutoff_time(10 * minutes, 4, 0), - -- Armor - ["light-armor"] = cutoff_amount_made_unless(5, 0, 1, "heavy-armor", 5), - ["heavy-armor"] = cutoff_amount_made(5, 0, 1), - -- Weapon - ["pistol"] = cutoff_amount_made_unless(0, 1, 1, "submachine-gun", 5), - ["submachine-gun"] = cutoff_amount_made(5, 0, 1), - -- Ammo - ["firearm-magazine"] = cutoff_amount_made_unless(100, 10, 0, "piercing-rounds-magazine", 100), - ["piercing-rounds-magazine"] = cutoff_amount_made(100, 0, 10), - --[[ + ['iron-ore']=cutoff_time(20 * minutes, 80, 0), + ['stone']=cutoff_time(20 * minutes, 20, 0), + ['coal']=cutoff_time(20 * minutes, 20, 0), + -- ['burner-mining-drill']=cutoff_time(20 * minutes, 8, 0), + -- ['stone-furnace']=cutoff_time(20 * minutes, 8, 0), + ['submachine-gun'] = 1, + ['piercing-rounds-magazine'] = 20, ['construction-robot'] = 10, ['modular-armor'] = 1, ['solar-panel-equipment'] = 16, ['belt-immunity-equipment'] = 1, ['battery-equipment'] = 2, ['personal-roboport-equipment'] = 1 + --[[ + ['construction-robot'] = 50, + ['spidertron'] = 1, + ['spidertron-remote'] = 1, + ['modular-armor'] = 1, + ['solar-panel-equipment'] = 60, + ['belt-immunity-equipment'] = 1, + ['battery-equipment'] = 6, + ['personal-roboport-equipment'] = 5 ]] } } diff --git a/exp_legacy/module/config/bonus.lua b/exp_legacy/module/config/bonus.lua index 7c9289a4..78a0881d 100644 --- a/exp_legacy/module/config/bonus.lua +++ b/exp_legacy/module/config/bonus.lua @@ -10,96 +10,108 @@ return { Base point is equal to the amount of standard value in each parameter. CMMS CRS CCS CISB CHB CRDB PBR - STD 30 90 32 20 16 12 60 - = 260 + STD 20 60 24 12 8 8 40 + = 172 - MAX 60 180 64 40 32 24 120 - = 480 + MAX 40 120 48 24 16 16 80 + = 344 ]] pts = { - base = 260, + rate = { + ['Senior Administrator'] = 1.5, + ['Administrator'] = 1.4, + ['Senior Moderator'] = 1.3, + ['Moderator'] = 1.2, + ['Trainee Moderator'] = 1.2, + ['Board Member'] = 1.1, + ['Supporter'] = 1.1, + ['Partner'] = 1.1, + ['Senior Member'] = 1.1, + ['Member'] = 1 + }, + base = 172 }, gui_display_width = { half = 150, label = 70, slider = 180, - count = 50, + count = 50 }, conversion = { - ["cmms"] = "character_mining_speed_modifier", - ["crs"] = "character_running_speed_modifier", - ["ccs"] = "character_crafting_speed_modifier", - ["cisb"] = "character_inventory_slots_bonus", - ["chb"] = "character_health_bonus", - ["crdb"] = "character_reach_distance_bonus", + ['cmms'] = 'character_mining_speed_modifier', + ['crs'] = 'character_running_speed_modifier', + ['ccs'] = 'character_crafting_speed_modifier', + ['cisb'] = 'character_inventory_slots_bonus', + ['chb'] = 'character_health_bonus', + ['crdb'] = 'character_reach_distance_bonus', --[[ ['cpdb'] = 'character_item_pickup_distance_bonus' ]] }, player_special_bonus_rate = 300, player_special_bonus = { - ["personal_battery_recharge"] = { + ['personal_battery_recharge'] = { -- 1 MW - value = 6, - max = 12, - scale = 1, - cost_scale = 4, - cost = 40, - is_percentage = false, - }, - }, - player_bonus = { - ["character_mining_speed_modifier"] = { - value = 3, - max = 6, + value = 4, + max = 8, scale = 0.5, cost_scale = 1, cost = 10, - is_percentage = true, + is_percentage = false + } + }, + player_bonus = { + ['character_mining_speed_modifier'] = { + value = 2, + max = 4, + scale = 0.5, + cost_scale = 1, + cost = 10, + is_percentage = true }, - ["character_running_speed_modifier"] = { - value = 1.5, - max = 3, + ['character_running_speed_modifier'] = { + value = 1, + max = 2, scale = 0.25, cost_scale = 1, cost = 60, - is_percentage = true, + is_percentage = true }, - ["character_crafting_speed_modifier"] = { - value = 8, - max = 16, - scale = 1, + ['character_crafting_speed_modifier'] = { + value = 6, + max = 12, + scale = 0.5, cost_scale = 1, cost = 4, - is_percentage = true, + is_percentage = true }, - ["character_inventory_slots_bonus"] = { - value = 100, - max = 200, - scale = 10, + ['character_inventory_slots_bonus'] = { + value = 60, + max = 120, + scale = 5, cost_scale = 10, cost = 2, - is_percentage = false, + is_percentage = false }, - ["character_health_bonus"] = { - value = 200, - max = 400, - scale = 50, - cost_scale = 50, - cost = 4, - is_percentage = false, + ['character_health_bonus'] = { + value = 100, + max = 200, + scale = 25, + cost_scale = 25, + cost = 2, + is_percentage = false }, - ["character_reach_distance_bonus"] = { - value = 12, - max = 24, + ['character_reach_distance_bonus'] = { + value = 8, + max = 16, scale = 2, cost_scale = 1, cost = 1, is_percentage = false, combined_bonus = { - "character_resource_reach_distance_bonus", - "character_build_distance_bonus", - }, + 'character_resource_reach_distance_bonus', + 'character_build_distance_bonus' + } }, --[[ ['character_item_pickup_distance_bonus'] = { @@ -190,29 +202,29 @@ return { is_percentage = false }, ]] - ["worker_robots_battery_modifier"] = { + ['worker_robots_battery_modifier'] = { value = 1, max = 1, scale = 1, cost_scale = 1, cost = 1, - is_percentage = false, + is_percentage = false }, - ["worker_robots_storage_bonus"] = { + ['worker_robots_storage_bonus'] = { value = 1, max = 1, scale = 1, cost_scale = 1, cost = 1, - is_percentage = false, + is_percentage = false }, - ["following_robots_lifetime_modifier"] = { + ['following_robots_lifetime_modifier'] = { value = 1, max = 1, scale = 1, cost_scale = 1, cost = 1, - is_percentage = false, + is_percentage = false }, --[[ ['character_item_pickup_distance_bonus'] = { @@ -316,5 +328,5 @@ return { is_percentage = false } ]] - }, + } } diff --git a/exp_legacy/module/config/discord_alerts.lua b/exp_legacy/module/config/discord_alerts.lua index 11dfb6a8..be19c6e2 100644 --- a/exp_legacy/module/config/discord_alerts.lua +++ b/exp_legacy/module/config/discord_alerts.lua @@ -11,15 +11,16 @@ return { player_kicks = true, player_promotes = false, player_jail = true, - ["config"] = true, - ["purge"] = true, - ["c"] = true, - ["command"] = true, - ["silent-command"] = true, - ["measured-command"] = true, - ["banlist"] = true, - ["permissions"] = true, - ["editor"] = true, - ["cheat"] = true, - ["open"] = false, + ['config']=false, + ['purge']=false, + ['c']=false, + ['sc']=false, + ['command']=false, + ['silent-command']=false, + ['measured-command']=false, + ['banlist']=false, + ['permissions']=false, + ['editor']=false, + ['cheat']=false, + ['open']=false } diff --git a/exp_legacy/module/config/expcore/permission_groups.lua b/exp_legacy/module/config/expcore/permission_groups.lua index b0e972f3..7d986851 100644 --- a/exp_legacy/module/config/expcore/permission_groups.lua +++ b/exp_legacy/module/config/expcore/permission_groups.lua @@ -9,20 +9,23 @@ local Groups = require("modules.exp_legacy.expcore.permission_groups") --- @dep Groups.new_group("Admin") :allow_all() + +Groups.new_group('Mod') + :allow_all() :disallow{ - "add_permission_group", -- admin - "delete_permission_group", - "edit_permission_group", - "import_permissions_string", - "map_editor_action", - "toggle_map_editor", - "change_multiplayer_config", - "set_heat_interface_mode", - "set_heat_interface_temperature", - "set_infinity_container_filter_item", - "set_infinity_container_remove_unfiltered_items", - "set_infinity_pipe_filter", - } + 'add_permission_group', -- admin + 'delete_permission_group', + 'edit_permission_group', + 'import_permissions_string', + 'map_editor_action', + 'toggle_map_editor', + 'change_multiplayer_config', + 'set_heat_interface_mode', + 'set_heat_interface_temperature', + 'set_infinity_container_filter_item', + 'set_infinity_container_remove_unfiltered_items', + 'set_infinity_pipe_filter' + } Groups.new_group("Trusted") :allow_all() @@ -59,9 +62,8 @@ Groups.new_group("Standard") "set_infinity_pipe_filter", "admin_action", -- trusted "change_programmable_speaker_alert_parameters", -- standard - "drop_item", "open_new_platform_button_from_rocket_silo", - "set_rocket_silo_send_to_orbit_automated_mode", + "set_rocket_silo_send_to_orbit_automated_mode" } Groups.new_group("Guest") diff --git a/exp_legacy/module/config/expcore/roles.lua b/exp_legacy/module/config/expcore/roles.lua index 14fd9695..ca4c1f9c 100644 --- a/exp_legacy/module/config/expcore/roles.lua +++ b/exp_legacy/module/config/expcore/roles.lua @@ -37,12 +37,7 @@ Roles.new_role("Senior Administrator", "SAdmin") :set_flag("report-immune") :set_flag("instant-respawn") :set_parent("Administrator") - :allow{ - "command/_rcon", - "command/debug", - "command/set-cheat-mode", - "command/research-all", - } + :set_allow_all() Roles.new_role("Administrator", "Admin") :set_permission_group("Admin") @@ -51,63 +46,52 @@ Roles.new_role("Administrator", "Admin") :set_flag("is_spectator") :set_flag("report-immune") :set_flag("instant-respawn") + :set_parent("Senior Moderator") + :allow{ + "command/_rcon", + "command/debug", + "command/set-cheat-mode", + "command/research-all" + } + +Roles.new_role("Senior Moderator", "SMod") + :set_permission_group("Mod") + :set_custom_color{ r = 0, g = 170, b = 0 } + :set_flag("is_admin") + :set_flag("is_system") + :set_flag("is_spectator") + :set_flag("report-immune") + :set_flag("instant-respawn") :set_parent("Moderator") :allow{ "gui/warp-list/bypass-proximity", "gui/warp-list/bypass-cooldown", - "command/connect-all", + "command/connect-all" } Roles.new_role("Moderator", "Mod") - :set_permission_group("Admin") + :set_permission_group("Mod") :set_custom_color{ r = 0, g = 170, b = 0 } :set_flag("is_admin") :set_flag("is_spectator") :set_flag("report-immune") :set_flag("instant-respawn") - :set_parent("Trainee") + :set_parent("Trainee Moderator") :allow{ - "command/assign-role", - "command/unassign-role", - "command/repair", - "command/kill/always", - "command/clear-tag/always", - "command/spawn/always", - "command/clear-reports", - "command/clear-warnings", - "command/clear-script-warnings", - "command/clear-last-warnings", - "command/clear-inventory", - "command/kill-enemies", - "command/remove-enemies", - --'command/bonus', - "command/home", - "command/set-home", - "command/get-home", - "command/return", - "command/connect-player", - "command/set-bot-queue", - "command/set-game-speed", - "command/set-friendly-fire", - "command/set-always-day", - "command/set-pollution-enabled", - "command/clear-pollution", - "gui/rocket-info/toggle-active", - "gui/rocket-info/remote_launch", - "gui/bonus", - "fast-tree-decon", } -Roles.new_role("Trainee", "TrMod") - :set_permission_group("Admin") +Roles.new_role("Trainee Moderator", "Trainee") + :set_permission_group("Mod") :set_custom_color{ r = 0, g = 170, b = 0 } :set_flag("is_admin") :set_flag("is_spectator") :set_flag("report-immune") - :set_parent("Veteran") + :set_parent("Board Member") :allow{ + "command/assign-role", + "command/unassign-role", "command/admin-chat", - "command/goto", + "command/protect-tag", "command/teleport", "command/bring", "command/create-warning", @@ -115,19 +99,30 @@ Roles.new_role("Trainee", "TrMod") "command/get-reports", "command/protect-entity", "command/protect-area", - "command/protect-tag", - "command/jail", - "command/unjail", "command/kick", "command/ban", - "command/spectate", - "command/follow", "command/search", "command/search-online", "command/search-amount", "command/search-recent", - "command/clear-blueprints", - "gui/playerdata", + "command/clear-pollution", + "command/set-pollution-enabled", + "command/set-bot-queue", + "command/set-game-speed", + "command/kill-enemies", + "command/remove-enemies", + "command/set-friendly-fire", + "command/set-always-day", + "command/clear-reports", + "command/clear-warnings", + "command/clear-script-warnings", + "command/clear-last-warnings", + "command/clear-inventory", + "command/connect-player", + "command/kill/always", + -- "command/clear-tag/always", + "command/spawn/always", + "gui/playerdata" } --- Trusted Roles @@ -137,81 +132,85 @@ Roles.new_role("Board Member", "Board") :set_flag("is_spectator") :set_flag("report-immune") :set_flag("instant-respawn") - :set_parent("Sponsor") - :allow{ - "command/goto", - "command/repair", - "command/spectate", - "command/follow", - "gui/playerdata", - } - -Roles.new_role("Senior Backer", "Backer") - :set_permission_group("Trusted") - :set_custom_color{ r = 238, g = 172, b = 44 } - :set_flag("is_spectator") - :set_flag("report-immune") - :set_flag("instant-respawn") - :set_parent("Sponsor") - :allow{ - } - -Roles.new_role("Sponsor", "Spon") - :set_permission_group("Trusted") - :set_custom_color{ r = 238, g = 172, b = 44 } - :set_flag("is_spectator") - :set_flag("report-immune") - :set_flag("instant-respawn") :set_parent("Supporter") :allow{ - "gui/rocket-info/toggle-active", - "gui/rocket-info/remote_launch", - "gui/bonus", - --"command/bonus", - "command/home", - "command/set-home", - "command/get-home", - "command/return", - "fast-tree-decon", } Roles.new_role("Supporter", "Sup") :set_permission_group("Trusted") :set_custom_color{ r = 230, g = 99, b = 34 } :set_flag("is_spectator") - :set_parent("Veteran") + :set_parent("Partner") :allow{ - "command/tag-color", - "command/jail", - "command/unjail", - "command/set-join-message", - "command/remove-join-message", } Roles.new_role("Partner", "Part") :set_permission_group("Trusted") - :set_custom_color{ r = 140, g = 120, b = 200 } + :set_custom_color{ r = 24, g = 172, b = 188 } :set_flag("is_spectator") - :set_parent("Veteran") + :set_parent("Senior Member") :allow{ - "command/jail", - "command/unjail", } -local hours10, hours250 = 10 * 216000, 250 * 60 +Roles.new_role("Senior Member", "SMem") + :set_permission_group("Trusted") + :set_custom_color{ r = 24, g = 172, b = 188 } + :set_flag("is_spectator") + :set_parent("Member") + :allow{ + "command/set-join-message", + "command/remove-join-message", + "command/goto", + "command/jail", + "command/unjail", + "command/spectate", + "command/follow", + "command/repair" + } + +--- Standard User Roles +Roles.new_role("Member", "Mem") + :set_permission_group("Standard") + :set_custom_color{ r = 24, g = 172, b = 188 } + :set_flag("deconlog-bypass") + :set_parent("Veteran") + :allow{ + "gui/vlayer-edit", + "gui/rocket-info/toggle-active", + "gui/rocket-info/remote_launch", + "gui/tool", + -- "command/tag-color", + "command/clear-blueprints", + --"command/bonus", + "gui/bonus", + "command/personal-logistic", + "command/home", + "command/set-home", + "command/get-home", + "command/return", + "fast-tree-decon" + } + +local hours6, hours250 = 6 * 216000, 250 * 60 Roles.new_role("Veteran", "Vet") :set_permission_group("Trusted") :set_custom_color{ r = 140, g = 120, b = 200 } - :set_parent("Member") + :set_parent("Regular") :allow{ + "gui/surveillance", + "gui/warp-list/add", + "gui/warp-list/edit", "command/chat-bot", "command/clear-ground-items", "command/clear-blueprints-radius", "command/set-trains-to-automatic", "command/set-auto-research", + "command/lawnmower", + "command/waterfill", + "command/artillery" } :set_auto_assign_condition(function(player) - if player.online_time >= hours10 then + if player.online_time >= hours6 then return true else local stats = Statistics:get(player, {}) @@ -220,44 +219,25 @@ Roles.new_role("Veteran", "Vet") end end) ---- Standard User Roles -Roles.new_role("Member", "Mem") - :set_permission_group("Standard") - :set_custom_color{ r = 24, g = 172, b = 188 } - :set_flag("deconlog-bypass") - :set_parent("Regular") - :allow{ - "gui/task-list/add", - "gui/task-list/edit", - "gui/warp-list/add", - "gui/warp-list/edit", - "gui/surveillance", - "gui/vlayer-edit", - "gui/tool", - "command/save-quickbar", - "command/vlayer-info", - "command/personal-logistic", - "command/lawnmower", - "command/waterfill", - "command/artillery", - } - -local hours3, hours15 = 3 * 216000, 15 * 60 +local hours1, hours15 = 1 * 216000, 15 * 60 Roles.new_role("Regular", "Reg") :set_permission_group("Standard") :set_custom_color{ r = 79, g = 155, b = 163 } :set_parent("Guest") :allow{ + "gui/task-list/add", + "gui/task-list/edit", "command/kill", "command/rainbow", "command/spawn", "command/me", + "command/vlayer-info", "standard-decon", "bypass-entity-protection", - "bypass-nukeprotect", + "bypass-nukeprotect" } :set_auto_assign_condition(function(player) - if player.online_time >= hours3 then + if player.online_time >= hours1 then return true else local stats = Statistics:get(player, {}) @@ -271,8 +251,8 @@ local default = Roles.new_role("Guest", "") :set_permission_group("Guest") :set_custom_color{ r = 185, g = 187, b = 160 } :allow{ - "command/tag", - "command/tag-clear", + -- "command/tag", + -- "command/tag-clear", "command/commands", "command/get-role", "command/locate", @@ -280,6 +260,7 @@ local default = Roles.new_role("Guest", "") "command/ratio", "command/server-ups", "command/save-data", + "command/save-quickbar", "command/data-preference", "command/connect", "gui/player-list", @@ -312,57 +293,63 @@ Roles.define_role_order{ "System", -- Best to keep root at top "Senior Administrator", "Administrator", + "Senior Moderator", "Moderator", - "Trainee", + "Trainee Moderator", "Board Member", - "Senior Backer", - "Sponsor", "Supporter", "Partner", - "Veteran", + "Senior Member", "Member", + "Veteran", "Regular", "Jail", - "Guest", -- Default must be last if you want to apply restrictions to other roles + "Guest" -- Default must be last if you want to apply restrictions to other roles } Roles.override_player_roles{ - ["PHIDIAS0303"] = { "Moderator", "Board Member", "Member" }, - ["aldldl"] = { "Administrator", "Moderator", "Member" }, - ["arty714"] = { "Senior Administrator", "Moderator", "Member" }, - ["Cooldude2606"] = { "Senior Administrator", "Moderator", "Member" }, - ["Drahc_pro"] = { "Administrator", "Moderator", "Member" }, - ["mark9064"] = { "Administrator", "Moderator", "Member" }, - ["7h3w1z4rd"] = { "Moderator", "Member" }, - ["FlipHalfling90"] = { "Moderator", "Member" }, - ["hamsterbryan"] = { "Moderator", "Member" }, - ["HunterOfGames"] = { "Moderator", "Member" }, - ["NextIdea"] = { "Moderator", "Member" }, - ["TheKernel32"] = { "Moderator", "Member" }, - ["TheKernel64"] = { "Moderator", "Member" }, - ["tovernaar123"] = { "Moderator", "Member" }, - ["UUBlueFire"] = { "Moderator", "Member" }, - ["AssemblyStorm"] = { "Moderator", "Member" }, - ["banakeg"] = { "Moderator", "Member" }, - ["connormkii"] = { "Moderator", "Member" }, - ["cydes"] = { "Moderator", "Member" }, - ["darklich14"] = { "Moderator", "Member" }, - ["facere"] = { "Moderator", "Member" }, - ["freek18"] = { "Moderator", "Member" }, - ["Gizan"] = { "Moderator", "Member" }, - ["LoicB"] = { "Moderator", "Member" }, - ["M74132"] = { "Moderator", "Member" }, - ["mafisch3"] = { "Moderator", "Member" }, - ["maplesyrup01"] = { "Moderator", "Member" }, - ["ookl"] = { "Moderator", "Member" }, - ["Phoenix27833"] = { "Moderator", "Member" }, - ["porelos"] = { "Moderator", "Member" }, - ["Ruuyji"] = { "Moderator", "Member" }, - ["samy115"] = { "Moderator", "Member" }, - ["SilentLog"] = { "Moderator", "Member" }, - ["Tcheko"] = { "Moderator", "Member" }, - ["thadius856"] = { "Moderator", "Member" }, - ["whoami32"] = { "Moderator", "Member" }, - ["Windbomb"] = { "Moderator", "Member" }, - ["XenoCyber"] = { "Moderator", "Member" }, + ["PHIDIAS0303"] = { "Senior Administrator" }, + ["majoro"] = { "Trainee Moderator" }, + ["konohaScarlet_"] = { "Trainee Moderator" }, + ["hihicome3"] = { "Trainee Moderator" }, + ["Athenaa"] = { "Trainee Moderator" }, + ["rongli"] = { "Trainee Moderator" }, + ["JamesJung"] = { "Trainee Moderator" }, + ["aldldl"] = { "Moderator" }, + ["arty714"] = { "Moderator" }, + ["Cooldude2606"] = { "Moderator" }, + ["Drahc_pro"] = { "Moderator" }, + ["mark9064"] = { "Moderator" }, + ["7h3w1z4rd"] = { "Moderator" }, + ["FlipHalfling90"] = { "Moderator" }, + ["hamsterbryan"] = { "Moderator" }, + ["HunterOfGames"] = { "Moderator" }, + ["NextIdea"] = { "Moderator" }, + ["TheKernel32"] = { "Moderator" }, + ["TheKernel64"] = { "Moderator" }, + ["tovernaar123"] = { "Moderator" }, + ["UUBlueFire"] = { "Moderator" }, + ["AssemblyStorm"] = { "Moderator" }, + ["banakeg"] = { "Moderator" }, + ["connormkii"] = { "Moderator" }, + ["cydes"] = { "Moderator" }, + ["darklich14"] = { "Moderator" }, + ["facere"] = { "Moderator" }, + ["freek18"] = { "Moderator" }, + ["Gizan"] = { "Moderator" }, + ["LoicB"] = { "Moderator" }, + ["M74132"] = { "Moderator" }, + ["mafisch3"] = { "Moderator" }, + ["maplesyrup01"] = { "Moderator" }, + ["ookl"] = { "Moderator" }, + ["Phoenix27833"] = { "Moderator" }, + ["porelos"] = { "Moderator" }, + ["Ruuyji"] = { "Moderator" }, + ["samy115"] = { "Moderator" }, + ["SilentLog"] = { "Moderator" }, + ["Tcheko"] = { "Moderator" }, + ["thadius856"] = { "Moderator" }, + ["whoami32"] = { "Moderator" }, + ["Windbomb"] = { "Moderator" }, + ["XenoCyber"] = { "Moderator" } } diff --git a/exp_legacy/module/config/join_messages.lua b/exp_legacy/module/config/join_messages.lua index 61278a2f..97aeaddb 100644 --- a/exp_legacy/module/config/join_messages.lua +++ b/exp_legacy/module/config/join_messages.lua @@ -1,8 +1,2 @@ return { - Cooldude2606 = "Lua lets you set metatables on numbers, did you know that? Cooldude2606 knows this.", - samy115 = "Tremble in fear as the banhammer is now here, its owner: samy115", - XenoCyber = '"Fire Fire Fire" oops wrong game, have no fear XenoCyber is here', - HunterOfGames = "Unable to support HunterOfGames. You must construct additional miners.", - ookl = 'ookl says: "Pineapples are amazing, hello everyone!"', - arty714 = "Arty\'s Potato made it!", } diff --git a/exp_legacy/module/config/spawn_area.lua b/exp_legacy/module/config/spawn_area.lua index 3d6c0d80..5540faa0 100644 --- a/exp_legacy/module/config/spawn_area.lua +++ b/exp_legacy/module/config/spawn_area.lua @@ -4,180 +4,80 @@ return { spawn_area = { --- @setting spawn_area Settings relating to the whole spawn area -- Enable predefined patches: 128, else: 32 - deconstruction_radius = 20, -- @setting deconstruction_radius All entities within this radius will be removed - tile_radius = 20, - deconstruction_tile = "concrete", --- @setting deconstruction_tile Tile to be placed in the deconstruction radius, use nil for map gen - landfill_radius = 50, --- @setting pattern_radius All water within this radius will be land filled + deconstruction_radius = 12, -- @setting deconstruction_radius All entities within this radius will be removed + deconstruction_tile = 'refined-concrete', --- @setting deconstruction_tile Tile to be placed in the deconstruction radius, use nil for map gen + tile_radius = 14, + landfill_radius = 16, --- @setting pattern_radius All water within this radius will be land filled }, turrets = { --- @setting turrets Settings relating to adding turrets to spawn enabled = true, --- @setting enabled Whether turrets will be added to spawn - ammo_type = "uranium-rounds-magazine", --- @setting ammo_type The ammo type that will be used during refills - refill_time = 60 * 60 * 5, --- @setting refill_time The time in ticks between each refill of the turrets, only change if having lag issues - offset = { x = 0, y = 0 }, --- @setting offset The position offset to apply to turrets + ammo_type = 'uranium-rounds-magazine', --- @setting ammo_type The ammo type that will be used during refills + refill_time = 60*60*5, --- @setting refill_time The time in ticks between each refill of the turrets, only change if having lag issues + offset = {x=0, y=0}, --- @setting offset The position offset to apply to turrets locations = { --- @setting locations The locations of all turrets, this list can change during runtime - { surface = 1, position = { x = -3, y = -3 } }, - { surface = 1, position = { x = 3, y = -3 } }, - { surface = 1, position = { x = -3, y = 3 } }, - { surface = 1, position = { x = 3, y = 3 } }, - }, + {surface=1, position={x=2, y=2}}, + {surface=1, position={x=2, y=-2}}, + {surface=1, position={x=-2, y=2}}, + {surface=1, position={x=-2, y=-2}}, + } }, afk_belts = { --- @setting afk_belts Settings relating to adding afk belts to spawn enabled = true, --- @setting enabled Whether afk belts will be added to spawn - belt_type = "transport-belt", --- @setting belt_type The belt to be used as afk belts + belt_type = 'transport-belt', --- @setting belt_type The belt to be used as afk belts protected = true, --- @setting protected Whether belts will be protected from player interaction - offset = { x = 0, y = 0 }, --- @setting offset The position offset to apply to afk belts - locations = { --- @setting locations The locations to spawn afk belts at, given as the top left position - { -5, -5 }, { 5, -5 }, - { -5, 5 }, { 5, 5 }, - }, + offset = {x=0, y=0}, --- @setting offset The position offset to apply to afk belts + locations={ --- @setting locations The locations to spawn afk belts at, given as the top left position + {4, 4}, + {4, -4}, + {-4, 4}, + {-4, -4} + } }, water = { --- @setting water Settings relating to adding water to spawn enabled = true, --- @setting enabled Whether water tiles will be added to spawn - water_tile = "water-mud", --- @setting water_tile The tile to be used as the water tile - offset = { x = 0, y = 0 }, --- @setting offset The position offset to apply to water tiles + water_tile = 'water-mud', --- @setting water_tile The tile to be used as the water tile + offset = {x=0, y=0}, --- @setting offset The position offset to apply to water tiles locations = { --- @setting locations The location of the water tiles {x,y} -- Each is a 3x3 with the closest tile to 0,0 removed - { 7, 8 }, { 7, 9 }, { 8, 7 }, { 8, 8 }, { 8, 9 }, { 9, 7 }, { 9, 8 }, { 9, 9 }, -- Bottom Right - { 7, -9 }, { 7, -10 }, { 8, -8 }, { 8, -9 }, { 8, -10 }, { 9, -8 }, { 9, -9 }, { 9, -10 }, -- Top Right - { -8, -9 }, { -8, -10 }, { -9, -8 }, { -9, -9 }, { -9, -10 }, { -10, -8 }, { -10, -9 }, { -10, -10 }, -- Top Left - { -8, 8 }, { -8, 9 }, { -9, 7 }, { -9, 8 }, { -9, 9 }, { -10, 7 }, { -10, 8 }, { -10, 9 }, -- Bottom Left - }, + {5, 6}, {5, 7}, {6, 5}, {6, 6}, {6, 7}, {7, 5}, {7, 6}, {7, 7}, + {5, -7}, {5, -8}, {6, -6}, {6, -7}, {6, -8}, {7, -6}, {7, -7}, {7, -8}, + {-6, 6}, {-6, 7}, {-7, 5}, {-7, 6}, {-7, 7}, {-8, 5}, {-8, 6}, {-8, 7}, + {-6, -7}, {-6, -8}, {-7, -6}, {-7, -7}, {-7, -8}, {-8, -6}, {-8, -7}, {-8, -8}, + } }, entities = { --- @setting entities Settings relating to adding entities to spawn - enabled = true, --- @setting enabled Whether entities will be added to spawn + enabled = true, --- @setting enabled Whether entities will be added to spawn protected = true, --- @setting protected Whether entities will be protected from player interaction operable = true, --- @setting operable Whether entities can be opened by players, must be true if chests are used - offset = { x = 0, y = -2 }, --- @setting offset The position offset to apply to entities + offset = {x=0, y=0}, --- @setting offset The position offset to apply to entities locations = { --- @setting locations The location and names of entities {name,x,y} - { "stone-wall", -10, -5 }, { "stone-wall", -10, -4 }, { "stone-wall", -10, -3 }, { "stone-wall", -10, -2 }, { "stone-wall", -10, -1 }, { "stone-wall", -10, 0 }, { "stone-wall", -10, 3 }, { "stone-wall", -10, 4 }, { "stone-wall", -10, 5 }, - { "stone-wall", -10, 6 }, { "stone-wall", -10, 7 }, { "stone-wall", -10, 8 }, { "small-lamp", -8, -4 }, { "small-lamp", -8, -1 }, { "iron-chest", -8, 0 }, { "iron-chest", -8, 3 }, { "small-lamp", -8, 4 }, - { "small-lamp", -8, 7 }, { "stone-wall", -7, -8 }, { "small-electric-pole", -7, -2 }, { "iron-chest", -7, 0 }, { "iron-chest", -7, 3 }, { "small-electric-pole", -7, 5 }, { "stone-wall", -7, 11 }, { "stone-wall", -6, -8 }, { "small-lamp", -6, -6 }, - { "iron-chest", -6, 0 }, { "iron-chest", -6, 3 }, { "small-lamp", -6, 9 }, { "stone-wall", -6, 11 }, { "stone-wall", -5, -8 }, { "small-lamp", -5, -1 }, { "iron-chest", -5, 0 }, { "iron-chest", -5, 3 }, { "small-lamp", -5, 4 }, { "stone-wall", -5, 11 }, - { "stone-wall", -4, -8 }, { "small-electric-pole", -4, -5 }, { "iron-chest", -4, 0 }, { "iron-chest", -4, 3 }, { "small-electric-pole", -4, 8 }, { "stone-wall", -4, 11 }, { "stone-wall", -3, -8 }, { "small-lamp", -3, -6 }, { "small-lamp", -3, -3 }, { "small-lamp", -3, 6 }, - { "small-lamp", -3, 9 }, { "stone-wall", -3, 11 }, { "stone-wall", -2, -8 }, { "iron-chest", -2, -6 }, { "iron-chest", -2, -5 }, { "iron-chest", -2, -4 }, { "iron-chest", -2, -3 }, { "iron-chest", -2, -2 }, { "iron-chest", -2, 5 }, { "iron-chest", -2, 6 }, - { "iron-chest", -2, 7 }, { "iron-chest", -2, 8 }, { "iron-chest", -2, 9 }, { "stone-wall", -2, 11 }, { "stone-wall", 1, -8 }, { "iron-chest", 1, -6 }, - { "iron-chest", 1, -5 }, { "iron-chest", 1, -4 }, { "iron-chest", 1, -3 }, { "iron-chest", 1, -2 }, { "iron-chest", 1, 5 }, { "iron-chest", 1, 6 }, { "iron-chest", 1, 7 }, { "iron-chest", 1, 8 }, { "iron-chest", 1, 9 }, { "stone-wall", 1, 11 }, - { "stone-wall", 2, -8 }, { "small-lamp", 2, -6 }, { "small-lamp", 2, -3 }, { "small-lamp", 2, 6 }, { "small-lamp", 2, 9 }, { "stone-wall", 2, 11 }, { "stone-wall", 3, -8 }, { "small-electric-pole", 3, -5 }, { "iron-chest", 3, 0 }, { "iron-chest", 3, 3 }, - { "small-electric-pole", 3, 8 }, { "stone-wall", 3, 11 }, { "stone-wall", 4, -8 }, { "small-lamp", 4, -1 }, { "iron-chest", 4, 0 }, { "iron-chest", 4, 3 }, { "small-lamp", 4, 4 }, { "stone-wall", 4, 11 }, { "stone-wall", 5, -8 }, { "small-lamp", 5, -6 }, - { "iron-chest", 5, 0 }, { "iron-chest", 5, 3 }, { "small-lamp", 5, 9 }, { "stone-wall", 5, 11 }, { "stone-wall", 6, -8 }, { "small-electric-pole", 6, -2 }, { "iron-chest", 6, 0 }, { "iron-chest", 6, 3 }, { "small-electric-pole", 6, 5 }, { "stone-wall", 6, 11 }, - { "small-lamp", 7, -4 }, { "small-lamp", 7, -1 }, { "iron-chest", 7, 0 }, { "iron-chest", 7, 3 }, { "small-lamp", 7, 4 }, { "small-lamp", 7, 7 }, { "stone-wall", 9, -5 }, - { "stone-wall", 9, -4 }, { "stone-wall", 9, -3 }, { "stone-wall", 9, -2 }, { "stone-wall", 9, -1 }, { "stone-wall", 9, 0 }, { "stone-wall", 9, 3 }, { "stone-wall", 9, 4 }, { "stone-wall", 9, 5 }, { "stone-wall", 9, 6 }, { "stone-wall", 9, 7 }, - { "stone-wall", 9, 8 }, - }, + {'steel-chest', 1, 3}, {'steel-chest', 1, 4}, {'steel-chest', 1, 5}, + {'steel-chest', 3, 1}, {'steel-chest', 4, 1}, {'steel-chest', 5, 1}, + {'steel-chest', 1, -4}, {'steel-chest', 1, -5}, {'steel-chest', 1, -6}, + {'steel-chest', 3, -2}, {'steel-chest', 4, -2}, {'steel-chest', 5, -2}, + {'steel-chest', -2, 3}, {'steel-chest', -2, 4}, {'steel-chest', -2, 5}, + {'steel-chest', -4, 1}, {'steel-chest', -5, 1}, {'steel-chest', -6, 1}, + {'steel-chest', -2, -4}, {'steel-chest', -2, -5}, {'steel-chest', -2, -6}, + {'steel-chest', -4, -2}, {'steel-chest', -5, -2}, {'steel-chest', -6, -2}, + {'medium-electric-pole', 2, 3}, {'medium-electric-pole', 2, -4}, {'medium-electric-pole', -3, 3}, {'medium-electric-pole', -3, -4}, + {'small-lamp', 2, 4}, {'small-lamp', 2, -5}, {'small-lamp', -3, 4}, {'small-lamp', -3, -5}, + {'small-lamp', 4, 2}, {'small-lamp', 4, -3}, {'small-lamp', -5, 2}, {'small-lamp', -5, -3}, + {'stone-wall', 1, 7}, {'stone-wall', 2, 7}, {'stone-wall', 3, 7}, {'stone-wall', 4, 7}, + {'stone-wall', 7, 1}, {'stone-wall', 7, 2}, {'stone-wall', 7, 3}, {'stone-wall', 7, 4}, + {'stone-wall', 1, -8}, {'stone-wall', 2, -8}, {'stone-wall', 3, -8}, {'stone-wall', 4, -8}, + {'stone-wall', 7, -2}, {'stone-wall', 7, -3}, {'stone-wall', 7, -4}, {'stone-wall', 7, -5}, + {'stone-wall', -2, 7}, {'stone-wall', -3, 7}, {'stone-wall', -4, 7}, {'stone-wall', -5, 7}, + {'stone-wall', -8, 1}, {'stone-wall', -8, 2}, {'stone-wall', -8, 3}, {'stone-wall', -8, 4}, + {'stone-wall', -2, -8}, {'stone-wall', -3, -8}, {'stone-wall', -4, -8}, {'stone-wall', -5, -8}, + {'stone-wall', -8, -2}, {'stone-wall', -8, -3}, {'stone-wall', -8, -4}, {'stone-wall', -8, -5}, + } }, pattern = { - enabled = true, --- @setting enabled Whether pattern tiles will be added to spawn - pattern_tile = "stone-path", --- @setting pattern_tile The tile to be used for the pattern - offset = { x = 0, y = -2 }, --- @setting offset The position offset to apply to pattern tiles + enabled = false, --- @setting enabled Whether pattern tiles will be added to spawn + pattern_tile = 'refined-concrete', --- @setting pattern_tile The tile to be used for the pattern + offset = {x=0, y=0}, --- @setting offset The position offset to apply to pattern tiles locations = { --- @setting locations The location of the pattern tiles {x,y} - { -49, -3 }, { -49, -2 }, { -49, 1 }, { -49, 2 }, { -49, 5 }, { -49, 6 }, { -48, -4 }, { -48, -3 }, { -48, -2 }, { -48, 1 }, { -48, 2 }, { -48, 5 }, { -48, 6 }, { -48, 7 }, { -47, -7 }, { -47, -6 }, { -47, -5 }, { -47, -4 }, { -47, -3 }, { -47, -2 }, { -47, 5 }, { -47, 6 }, { -47, 7 }, { -47, 8 }, { -47, 9 }, { -47, 10 }, { -46, -8 }, { -46, -7 }, { -46, -6 }, { -46, -5 }, - { -46, -4 }, { -46, -3 }, { -46, -2 }, { -46, -1 }, { -46, 4 }, { -46, 5 }, { -46, 6 }, { -46, 7 }, { -46, 8 }, { -46, 9 }, { -46, 10 }, { -46, 11 }, { -45, -17 }, { -45, -16 }, { -45, -15 }, { -45, -14 }, { -45, -13 }, { -45, -12 }, { -45, -9 }, { -45, -8 }, { -45, -7 }, { -45, -2 }, { -45, -1 }, { -45, 0 }, { -45, 1 }, { -45, 2 }, { -45, 3 }, { -45, 4 }, { -45, 5 }, { -45, 10 }, - { -45, 11 }, { -45, 12 }, { -45, 15 }, { -45, 16 }, { -45, 17 }, { -45, 18 }, { -45, 19 }, { -45, 20 }, { -44, -18 }, { -44, -17 }, { -44, -16 }, { -44, -15 }, { -44, -14 }, { -44, -13 }, { -44, -12 }, { -44, -9 }, { -44, -8 }, { -44, -1 }, { -44, 0 }, { -44, 1 }, { -44, 2 }, { -44, 3 }, { -44, 4 }, { -44, 11 }, { -44, 12 }, { -44, 15 }, { -44, 16 }, { -44, 17 }, { -44, 18 }, { -44, 19 }, - { -44, 20 }, { -44, 21 }, { -43, -19 }, { -43, -18 }, { -43, -17 }, { -43, -1 }, { -43, 0 }, { -43, 1 }, { -43, 2 }, { -43, 3 }, { -43, 4 }, { -43, 20 }, { -43, 21 }, { -43, 22 }, { -42, -19 }, { -42, -18 }, { -42, -1 }, { -42, 0 }, { -42, 1 }, { -42, 2 }, { -42, 3 }, { -42, 4 }, { -42, 21 }, { -42, 22 }, { -41, -25 }, { -41, -24 }, { -41, -19 }, { -41, -18 }, { -41, -13 }, { -41, -12 }, - { -41, -11 }, { -41, -10 }, { -41, -5 }, { -41, -4 }, { -41, 7 }, { -41, 8 }, { -41, 13 }, { -41, 14 }, { -41, 15 }, { -41, 16 }, { -41, 21 }, { -41, 22 }, { -41, 27 }, { -41, 28 }, { -40, -26 }, { -40, -25 }, { -40, -24 }, { -40, -20 }, { -40, -19 }, { -40, -18 }, { -40, -13 }, { -40, -12 }, { -40, -11 }, { -40, -10 }, { -40, -5 }, { -40, -4 }, { -40, 7 }, { -40, 8 }, { -40, 13 }, { -40, 14 }, - { -40, 15 }, { -40, 16 }, { -40, 21 }, { -40, 22 }, { -40, 23 }, { -40, 27 }, { -40, 28 }, { -40, 29 }, { -39, -27 }, { -39, -26 }, { -39, -25 }, { -39, -24 }, { -39, -21 }, { -39, -20 }, { -39, -19 }, { -39, -13 }, { -39, -12 }, { -39, -5 }, { -39, -4 }, { -39, -3 }, { -39, -2 }, { -39, -1 }, { -39, 0 }, { -39, 1 }, { -39, 2 }, { -39, 3 }, { -39, 4 }, { -39, 5 }, { -39, 6 }, { -39, 7 }, - { -39, 8 }, { -39, 15 }, { -39, 16 }, { -39, 22 }, { -39, 23 }, { -39, 24 }, { -39, 27 }, { -39, 28 }, { -39, 29 }, { -39, 30 }, { -38, -27 }, { -38, -26 }, { -38, -25 }, { -38, -24 }, { -38, -21 }, { -38, -20 }, { -38, -13 }, { -38, -12 }, { -38, -5 }, { -38, -4 }, { -38, -3 }, { -38, -2 }, { -38, -1 }, { -38, 0 }, { -38, 1 }, { -38, 2 }, { -38, 3 }, { -38, 4 }, { -38, 5 }, { -38, 6 }, - { -38, 7 }, { -38, 8 }, { -38, 15 }, { -38, 16 }, { -38, 23 }, { -38, 24 }, { -38, 27 }, { -38, 28 }, { -38, 29 }, { -38, 30 }, { -37, -17 }, { -37, -16 }, { -37, -13 }, { -37, -12 }, { -37, -11 }, { -37, -10 }, { -37, -4 }, { -37, -3 }, { -37, -2 }, { -37, -1 }, { -37, 0 }, { -37, 3 }, { -37, 4 }, { -37, 5 }, { -37, 6 }, { -37, 7 }, { -37, 13 }, { -37, 14 }, { -37, 15 }, { -37, 16 }, - { -37, 19 }, { -37, 20 }, { -36, -17 }, { -36, -16 }, { -36, -13 }, { -36, -12 }, { -36, -11 }, { -36, -10 }, { -36, -9 }, { -36, -3 }, { -36, -2 }, { -36, -1 }, { -36, 0 }, { -36, 3 }, { -36, 4 }, { -36, 5 }, { -36, 6 }, { -36, 12 }, { -36, 13 }, { -36, 14 }, { -36, 15 }, { -36, 16 }, { -36, 19 }, { -36, 20 }, { -35, -29 }, { -35, -28 }, { -35, -23 }, { -35, -22 }, { -35, -17 }, { -35, -16 }, - { -35, -12 }, { -35, -11 }, { -35, -10 }, { -35, -9 }, { -35, -8 }, { -35, 11 }, { -35, 12 }, { -35, 13 }, { -35, 14 }, { -35, 15 }, { -35, 19 }, { -35, 20 }, { -35, 25 }, { -35, 26 }, { -35, 31 }, { -35, 32 }, { -34, -30 }, { -34, -29 }, { -34, -28 }, { -34, -23 }, { -34, -22 }, { -34, -17 }, { -34, -16 }, { -34, -15 }, { -34, -11 }, { -34, -10 }, { -34, -9 }, { -34, -8 }, { -34, 11 }, { -34, 12 }, - { -34, 13 }, { -34, 14 }, { -34, 18 }, { -34, 19 }, { -34, 20 }, { -34, 25 }, { -34, 26 }, { -34, 31 }, { -34, 32 }, { -34, 33 }, { -33, -31 }, { -33, -30 }, { -33, -29 }, { -33, -28 }, { -33, -23 }, { -33, -22 }, { -33, -16 }, { -33, -15 }, { -33, -14 }, { -33, -5 }, { -33, -4 }, { -33, -1 }, { -33, 0 }, { -33, 3 }, { -33, 4 }, { -33, 7 }, { -33, 8 }, { -33, 17 }, { -33, 18 }, { -33, 19 }, - { -33, 25 }, { -33, 26 }, { -33, 31 }, { -33, 32 }, { -33, 33 }, { -33, 34 }, { -32, -32 }, { -32, -31 }, { -32, -30 }, { -32, -29 }, { -32, -28 }, { -32, -27 }, { -32, -23 }, { -32, -22 }, { -32, -21 }, { -32, -15 }, { -32, -14 }, { -32, -6 }, { -32, -5 }, { -32, -4 }, { -32, -1 }, { -32, 0 }, { -32, 3 }, { -32, 4 }, { -32, 7 }, { -32, 8 }, { -32, 9 }, { -32, 17 }, { -32, 18 }, { -32, 24 }, - { -32, 25 }, { -32, 26 }, { -32, 30 }, { -32, 31 }, { -32, 32 }, { -32, 33 }, { -32, 34 }, { -32, 35 }, { -31, -33 }, { -31, -32 }, { -31, -31 }, { -31, -30 }, { -31, -29 }, { -31, -28 }, { -31, -27 }, { -31, -26 }, { -31, -22 }, { -31, -21 }, { -31, -20 }, { -31, -19 }, { -31, -18 }, { -31, -11 }, { -31, -10 }, { -31, -9 }, { -31, -8 }, { -31, -7 }, { -31, -6 }, { -31, -5 }, { -31, -1 }, { -31, 0 }, - { -31, 1 }, { -31, 2 }, { -31, 3 }, { -31, 4 }, { -31, 8 }, { -31, 9 }, { -31, 10 }, { -31, 11 }, { -31, 12 }, { -31, 13 }, { -31, 14 }, { -31, 21 }, { -31, 22 }, { -31, 23 }, { -31, 24 }, { -31, 25 }, { -31, 29 }, { -31, 30 }, { -31, 31 }, { -31, 32 }, { -31, 33 }, { -31, 34 }, { -31, 35 }, { -31, 36 }, { -30, -33 }, { -30, -32 }, { -30, -31 }, { -30, -30 }, { -30, -29 }, { -30, -28 }, - { -30, -27 }, { -30, -26 }, { -30, -21 }, { -30, -20 }, { -30, -19 }, { -30, -18 }, { -30, -11 }, { -30, -10 }, { -30, -9 }, { -30, -8 }, { -30, -7 }, { -30, -6 }, { -30, -1 }, { -30, 0 }, { -30, 1 }, { -30, 2 }, { -30, 3 }, { -30, 4 }, { -30, 9 }, { -30, 10 }, { -30, 11 }, { -30, 12 }, { -30, 13 }, { -30, 14 }, { -30, 21 }, { -30, 22 }, { -30, 23 }, { -30, 24 }, { -30, 29 }, { -30, 30 }, - { -30, 31 }, { -30, 32 }, { -30, 33 }, { -30, 34 }, { -30, 35 }, { -30, 36 }, { -29, -37 }, { -29, -36 }, { -29, -30 }, { -29, -29 }, { -29, -28 }, { -29, -27 }, { -29, -26 }, { -29, -15 }, { -29, -14 }, { -29, -10 }, { -29, -9 }, { -29, -8 }, { -29, -7 }, { -29, 10 }, { -29, 11 }, { -29, 12 }, { -29, 13 }, { -29, 17 }, { -29, 18 }, { -29, 29 }, { -29, 30 }, { -29, 31 }, { -29, 32 }, { -29, 33 }, - { -29, 39 }, { -29, 40 }, { -28, -38 }, { -28, -37 }, { -28, -36 }, { -28, -29 }, { -28, -28 }, { -28, -27 }, { -28, -26 }, { -28, -16 }, { -28, -15 }, { -28, -14 }, { -28, -9 }, { -28, -8 }, { -28, 11 }, { -28, 12 }, { -28, 17 }, { -28, 18 }, { -28, 19 }, { -28, 29 }, { -28, 30 }, { -28, 31 }, { -28, 32 }, { -28, 39 }, { -28, 40 }, { -28, 41 }, { -27, -39 }, { -27, -38 }, { -27, -37 }, { -27, -36 }, - { -27, -23 }, { -27, -22 }, { -27, -19 }, { -27, -18 }, { -27, -17 }, { -27, -16 }, { -27, -15 }, { -27, -5 }, { -27, -4 }, { -27, -1 }, { -27, 0 }, { -27, 1 }, { -27, 2 }, { -27, 3 }, { -27, 4 }, { -27, 7 }, { -27, 8 }, { -27, 18 }, { -27, 19 }, { -27, 20 }, { -27, 21 }, { -27, 22 }, { -27, 25 }, { -27, 26 }, { -27, 39 }, { -27, 40 }, { -27, 41 }, { -27, 42 }, { -26, -39 }, { -26, -38 }, - { -26, -37 }, { -26, -36 }, { -26, -24 }, { -26, -23 }, { -26, -22 }, { -26, -19 }, { -26, -18 }, { -26, -17 }, { -26, -16 }, { -26, -6 }, { -26, -5 }, { -26, -4 }, { -26, -1 }, { -26, 0 }, { -26, 1 }, { -26, 2 }, { -26, 3 }, { -26, 4 }, { -26, 7 }, { -26, 8 }, { -26, 9 }, { -26, 19 }, { -26, 20 }, { -26, 21 }, { -26, 22 }, { -26, 25 }, { -26, 26 }, { -26, 27 }, { -26, 39 }, { -26, 40 }, - { -26, 41 }, { -26, 42 }, { -25, -33 }, { -25, -32 }, { -25, -31 }, { -25, -30 }, { -25, -25 }, { -25, -24 }, { -25, -23 }, { -25, -22 }, { -25, -19 }, { -25, -18 }, { -25, -17 }, { -25, -9 }, { -25, -8 }, { -25, -7 }, { -25, -6 }, { -25, -5 }, { -25, -4 }, { -25, -1 }, { -25, 0 }, { -25, 1 }, { -25, 2 }, { -25, 3 }, { -25, 4 }, { -25, 7 }, { -25, 8 }, { -25, 9 }, { -25, 10 }, { -25, 11 }, - { -25, 12 }, { -25, 20 }, { -25, 21 }, { -25, 22 }, { -25, 25 }, { -25, 26 }, { -25, 27 }, { -25, 28 }, { -25, 33 }, { -25, 34 }, { -25, 35 }, { -25, 36 }, { -24, -33 }, { -24, -32 }, { -24, -31 }, { -24, -30 }, { -24, -29 }, { -24, -25 }, { -24, -24 }, { -24, -23 }, { -24, -22 }, { -24, -19 }, { -24, -18 }, { -24, -9 }, { -24, -8 }, { -24, -7 }, { -24, -6 }, { -24, -5 }, { -24, -4 }, { -24, -1 }, - { -24, 0 }, { -24, 1 }, { -24, 2 }, { -24, 3 }, { -24, 4 }, { -24, 7 }, { -24, 8 }, { -24, 9 }, { -24, 10 }, { -24, 11 }, { -24, 12 }, { -24, 21 }, { -24, 22 }, { -24, 25 }, { -24, 26 }, { -24, 27 }, { -24, 28 }, { -24, 32 }, { -24, 33 }, { -24, 34 }, { -24, 35 }, { -24, 36 }, { -23, -37 }, { -23, -36 }, { -23, -30 }, { -23, -29 }, { -23, -28 }, { -23, -19 }, { -23, -18 }, { -23, -15 }, - { -23, -14 }, { -23, -9 }, { -23, -8 }, { -23, -7 }, { -23, -6 }, { -23, -5 }, { -23, 0 }, { -23, 1 }, { -23, 2 }, { -23, 3 }, { -23, 8 }, { -23, 9 }, { -23, 10 }, { -23, 11 }, { -23, 12 }, { -23, 17 }, { -23, 18 }, { -23, 21 }, { -23, 22 }, { -23, 31 }, { -23, 32 }, { -23, 33 }, { -23, 39 }, { -23, 40 }, { -22, -38 }, { -22, -37 }, { -22, -36 }, { -22, -29 }, { -22, -28 }, { -22, -19 }, - { -22, -18 }, { -22, -15 }, { -22, -14 }, { -22, -13 }, { -22, -9 }, { -22, -8 }, { -22, -7 }, { -22, -6 }, { -22, 1 }, { -22, 2 }, { -22, 9 }, { -22, 10 }, { -22, 11 }, { -22, 12 }, { -22, 16 }, { -22, 17 }, { -22, 18 }, { -22, 21 }, { -22, 22 }, { -22, 31 }, { -22, 32 }, { -22, 39 }, { -22, 40 }, { -22, 41 }, { -21, -41 }, { -21, -40 }, { -21, -39 }, { -21, -38 }, { -21, -37 }, { -21, -29 }, - { -21, -28 }, { -21, -25 }, { -21, -24 }, { -21, -23 }, { -21, -22 }, { -21, -21 }, { -21, -20 }, { -21, -19 }, { -21, -18 }, { -21, -15 }, { -21, -14 }, { -21, -13 }, { -21, -12 }, { -21, -3 }, { -21, -2 }, { -21, 5 }, { -21, 6 }, { -21, 15 }, { -21, 16 }, { -21, 17 }, { -21, 18 }, { -21, 21 }, { -21, 22 }, { -21, 23 }, { -21, 24 }, { -21, 25 }, { -21, 26 }, { -21, 27 }, { -21, 28 }, { -21, 31 }, - { -21, 32 }, { -21, 40 }, { -21, 41 }, { -21, 42 }, { -21, 43 }, { -21, 44 }, { -20, -42 }, { -20, -41 }, { -20, -40 }, { -20, -39 }, { -20, -38 }, { -20, -29 }, { -20, -28 }, { -20, -25 }, { -20, -24 }, { -20, -23 }, { -20, -22 }, { -20, -21 }, { -20, -20 }, { -20, -19 }, { -20, -18 }, { -20, -15 }, { -20, -14 }, { -20, -13 }, { -20, -12 }, { -20, -3 }, { -20, -2 }, { -20, -1 }, { -20, 4 }, { -20, 5 }, - { -20, 6 }, { -20, 15 }, { -20, 16 }, { -20, 17 }, { -20, 18 }, { -20, 21 }, { -20, 22 }, { -20, 23 }, { -20, 24 }, { -20, 25 }, { -20, 26 }, { -20, 27 }, { -20, 28 }, { -20, 31 }, { -20, 32 }, { -20, 41 }, { -20, 42 }, { -20, 43 }, { -20, 44 }, { -20, 45 }, { -19, -43 }, { -19, -42 }, { -19, -41 }, { -19, -35 }, { -19, -34 }, { -19, -33 }, { -19, -32 }, { -19, -25 }, { -19, -24 }, { -19, -23 }, - { -19, -15 }, { -19, -14 }, { -19, -13 }, { -19, -9 }, { -19, -8 }, { -19, -7 }, { -19, -6 }, { -19, -2 }, { -19, -1 }, { -19, 0 }, { -19, 1 }, { -19, 2 }, { -19, 3 }, { -19, 4 }, { -19, 5 }, { -19, 9 }, { -19, 10 }, { -19, 11 }, { -19, 12 }, { -19, 16 }, { -19, 17 }, { -19, 18 }, { -19, 26 }, { -19, 27 }, { -19, 28 }, { -19, 35 }, { -19, 36 }, { -19, 37 }, { -19, 38 }, { -19, 44 }, - { -19, 45 }, { -19, 46 }, { -18, -43 }, { -18, -42 }, { -18, -35 }, { -18, -34 }, { -18, -33 }, { -18, -32 }, { -18, -31 }, { -18, -26 }, { -18, -25 }, { -18, -24 }, { -18, -15 }, { -18, -14 }, { -18, -10 }, { -18, -9 }, { -18, -8 }, { -18, -7 }, { -18, -6 }, { -18, -1 }, { -18, 0 }, { -18, 1 }, { -18, 2 }, { -18, 3 }, { -18, 4 }, { -18, 9 }, { -18, 10 }, { -18, 11 }, { -18, 12 }, { -18, 13 }, - { -18, 17 }, { -18, 18 }, { -18, 27 }, { -18, 28 }, { -18, 29 }, { -18, 34 }, { -18, 35 }, { -18, 36 }, { -18, 37 }, { -18, 38 }, { -18, 45 }, { -18, 46 }, { -17, -43 }, { -17, -42 }, { -17, -32 }, { -17, -31 }, { -17, -30 }, { -17, -27 }, { -17, -26 }, { -17, -25 }, { -17, -21 }, { -17, -20 }, { -17, -19 }, { -17, -18 }, { -17, -17 }, { -17, -16 }, { -17, -15 }, { -17, -14 }, { -17, -11 }, { -17, -10 }, - { -17, -9 }, { -17, -8 }, { -17, -7 }, { -17, -6 }, { -17, 0 }, { -17, 1 }, { -17, 2 }, { -17, 3 }, { -17, 9 }, { -17, 10 }, { -17, 11 }, { -17, 12 }, { -17, 13 }, { -17, 14 }, { -17, 17 }, { -17, 18 }, { -17, 19 }, { -17, 20 }, { -17, 21 }, { -17, 22 }, { -17, 23 }, { -17, 24 }, { -17, 28 }, { -17, 29 }, { -17, 30 }, { -17, 33 }, { -17, 34 }, { -17, 35 }, { -17, 45 }, { -17, 46 }, - { -16, -43 }, { -16, -42 }, { -16, -31 }, { -16, -30 }, { -16, -27 }, { -16, -26 }, { -16, -21 }, { -16, -20 }, { -16, -19 }, { -16, -18 }, { -16, -17 }, { -16, -16 }, { -16, -15 }, { -16, -14 }, { -16, -11 }, { -16, -10 }, { -16, -9 }, { -16, -8 }, { -16, -7 }, { -16, -6 }, { -16, 1 }, { -16, 2 }, { -16, 9 }, { -16, 10 }, { -16, 11 }, { -16, 12 }, { -16, 13 }, { -16, 14 }, { -16, 17 }, { -16, 18 }, - { -16, 19 }, { -16, 20 }, { -16, 21 }, { -16, 22 }, { -16, 23 }, { -16, 24 }, { -16, 29 }, { -16, 30 }, { -16, 33 }, { -16, 34 }, { -16, 45 }, { -16, 46 }, { -15, -43 }, { -15, -42 }, { -15, -39 }, { -15, -38 }, { -15, -37 }, { -15, -36 }, { -15, -35 }, { -15, -34 }, { -15, -20 }, { -15, -19 }, { -15, -18 }, { -15, -17 }, { -15, -10 }, { -15, -9 }, { -15, -8 }, { -15, -7 }, { -15, -3 }, { -15, -2 }, - { -15, 1 }, { -15, 2 }, { -15, 5 }, { -15, 6 }, { -15, 10 }, { -15, 11 }, { -15, 12 }, { -15, 13 }, { -15, 20 }, { -15, 21 }, { -15, 22 }, { -15, 23 }, { -15, 37 }, { -15, 38 }, { -15, 39 }, { -15, 40 }, { -15, 41 }, { -15, 42 }, { -15, 45 }, { -15, 46 }, { -14, -43 }, { -14, -42 }, { -14, -39 }, { -14, -38 }, { -14, -37 }, { -14, -36 }, { -14, -35 }, { -14, -34 }, { -14, -33 }, { -14, -19 }, - { -14, -18 }, { -14, -9 }, { -14, -8 }, { -14, -4 }, { -14, -3 }, { -14, -2 }, { -14, 1 }, { -14, 2 }, { -14, 5 }, { -14, 6 }, { -14, 7 }, { -14, 11 }, { -14, 12 }, { -14, 21 }, { -14, 22 }, { -14, 36 }, { -14, 37 }, { -14, 38 }, { -14, 39 }, { -14, 40 }, { -14, 41 }, { -14, 42 }, { -14, 45 }, { -14, 46 }, { -13, -39 }, { -13, -38 }, { -13, -35 }, { -13, -34 }, { -13, -33 }, { -13, -32 }, - { -13, -29 }, { -13, -28 }, { -13, -15 }, { -13, -14 }, { -13, -5 }, { -13, -4 }, { -13, -3 }, { -13, -2 }, { -13, 5 }, { -13, 6 }, { -13, 7 }, { -13, 8 }, { -13, 17 }, { -13, 18 }, { -13, 31 }, { -13, 32 }, { -13, 35 }, { -13, 36 }, { -13, 37 }, { -13, 38 }, { -13, 41 }, { -13, 42 }, { -12, -39 }, { -12, -38 }, { -12, -35 }, { -12, -34 }, { -12, -33 }, { -12, -32 }, { -12, -29 }, { -12, -28 }, - { -12, -27 }, { -12, -16 }, { -12, -15 }, { -12, -14 }, { -12, -13 }, { -12, -5 }, { -12, -4 }, { -12, -3 }, { -12, -2 }, { -12, 5 }, { -12, 6 }, { -12, 7 }, { -12, 8 }, { -12, 16 }, { -12, 17 }, { -12, 18 }, { -12, 19 }, { -12, 30 }, { -12, 31 }, { -12, 32 }, { -12, 35 }, { -12, 36 }, { -12, 37 }, { -12, 38 }, { -12, 41 }, { -12, 42 }, { -11, -43 }, { -11, -42 }, { -11, -34 }, { -11, -33 }, - { -11, -32 }, { -11, -29 }, { -11, -28 }, { -11, -27 }, { -11, -26 }, { -11, -23 }, { -11, -22 }, { -11, -21 }, { -11, -20 }, { -11, -17 }, { -11, -16 }, { -11, -15 }, { -11, -14 }, { -11, -13 }, { -11, -12 }, { -11, -9 }, { -11, -8 }, { -11, 1 }, { -11, 2 }, { -11, 11 }, { -11, 12 }, { -11, 15 }, { -11, 16 }, { -11, 17 }, { -11, 18 }, { -11, 19 }, { -11, 20 }, { -11, 23 }, { -11, 24 }, { -11, 25 }, - { -11, 26 }, { -11, 29 }, { -11, 30 }, { -11, 31 }, { -11, 32 }, { -11, 35 }, { -11, 36 }, { -11, 37 }, { -11, 45 }, { -11, 46 }, { -10, -44 }, { -10, -43 }, { -10, -42 }, { -10, -33 }, { -10, -32 }, { -10, -29 }, { -10, -28 }, { -10, -27 }, { -10, -26 }, { -10, -23 }, { -10, -22 }, { -10, -21 }, { -10, -20 }, { -10, -17 }, { -10, -16 }, { -10, -15 }, { -10, -14 }, { -10, -13 }, { -10, -12 }, { -10, -9 }, - { -10, -8 }, { -10, -7 }, { -10, 0 }, { -10, 1 }, { -10, 2 }, { -10, 3 }, { -10, 10 }, { -10, 11 }, { -10, 12 }, { -10, 15 }, { -10, 16 }, { -10, 17 }, { -10, 18 }, { -10, 19 }, { -10, 20 }, { -10, 23 }, { -10, 24 }, { -10, 25 }, { -10, 26 }, { -10, 29 }, { -10, 30 }, { -10, 31 }, { -10, 32 }, { -10, 35 }, { -10, 36 }, { -10, 45 }, { -10, 46 }, { -10, 47 }, { -9, -45 }, { -9, -44 }, - { -9, -43 }, { -9, -29 }, { -9, -28 }, { -9, -27 }, { -9, -23 }, { -9, -22 }, { -9, -21 }, { -9, -20 }, { -9, -17 }, { -9, -16 }, { -9, -15 }, { -9, -14 }, { -9, -13 }, { -9, -8 }, { -9, -7 }, { -9, -6 }, { -9, -5 }, { -9, -1 }, { -9, 0 }, { -9, 1 }, { -9, 2 }, { -9, 3 }, { -9, 4 }, { -9, 8 }, { -9, 9 }, { -9, 10 }, { -9, 11 }, { -9, 16 }, { -9, 17 }, { -9, 18 }, - { -9, 19 }, { -9, 20 }, { -9, 23 }, { -9, 24 }, { -9, 25 }, { -9, 26 }, { -9, 30 }, { -9, 31 }, { -9, 32 }, { -9, 46 }, { -9, 47 }, { -9, 48 }, { -8, -45 }, { -8, -44 }, { -8, -30 }, { -8, -29 }, { -8, -28 }, { -8, -24 }, { -8, -23 }, { -8, -22 }, { -8, -21 }, { -8, -20 }, { -8, -17 }, { -8, -16 }, { -8, -15 }, { -8, -14 }, { -8, -7 }, { -8, -6 }, { -8, -5 }, { -8, -4 }, - { -8, -1 }, { -8, 0 }, { -8, 1 }, { -8, 2 }, { -8, 3 }, { -8, 4 }, { -8, 7 }, { -8, 8 }, { -8, 9 }, { -8, 10 }, { -8, 17 }, { -8, 18 }, { -8, 19 }, { -8, 20 }, { -8, 23 }, { -8, 24 }, { -8, 25 }, { -8, 26 }, { -8, 27 }, { -8, 31 }, { -8, 32 }, { -8, 33 }, { -8, 47 }, { -8, 48 }, { -7, -45 }, { -7, -44 }, { -7, -39 }, { -7, -38 }, { -7, -37 }, { -7, -36 }, - { -7, -31 }, { -7, -30 }, { -7, -29 }, { -7, -25 }, { -7, -24 }, { -7, -23 }, { -7, -22 }, { -7, -21 }, { -7, -11 }, { -7, -10 }, { -7, -7 }, { -7, -6 }, { -7, -5 }, { -7, -4 }, { -7, 7 }, { -7, 8 }, { -7, 9 }, { -7, 10 }, { -7, 13 }, { -7, 14 }, { -7, 24 }, { -7, 25 }, { -7, 26 }, { -7, 27 }, { -7, 28 }, { -7, 32 }, { -7, 33 }, { -7, 34 }, { -7, 39 }, { -7, 40 }, - { -7, 41 }, { -7, 42 }, { -7, 47 }, { -7, 48 }, { -6, -46 }, { -6, -45 }, { -6, -44 }, { -6, -39 }, { -6, -38 }, { -6, -37 }, { -6, -36 }, { -6, -35 }, { -6, -31 }, { -6, -30 }, { -6, -25 }, { -6, -24 }, { -6, -23 }, { -6, -22 }, { -6, -12 }, { -6, -11 }, { -6, -10 }, { -6, -6 }, { -6, -5 }, { -6, 8 }, { -6, 9 }, { -6, 13 }, { -6, 14 }, { -6, 15 }, { -6, 25 }, { -6, 26 }, - { -6, 27 }, { -6, 28 }, { -6, 33 }, { -6, 34 }, { -6, 38 }, { -6, 39 }, { -6, 40 }, { -6, 41 }, { -6, 42 }, { -6, 47 }, { -6, 48 }, { -6, 49 }, { -5, -47 }, { -5, -46 }, { -5, -45 }, { -5, -44 }, { -5, -37 }, { -5, -36 }, { -5, -35 }, { -5, -34 }, { -5, -19 }, { -5, -18 }, { -5, -13 }, { -5, -12 }, { -5, -11 }, { -5, -10 }, { -5, -1 }, { -5, 0 }, { -5, 1 }, { -5, 2 }, - { -5, 3 }, { -5, 4 }, { -5, 13 }, { -5, 14 }, { -5, 15 }, { -5, 16 }, { -5, 21 }, { -5, 22 }, { -5, 37 }, { -5, 38 }, { -5, 39 }, { -5, 40 }, { -5, 47 }, { -5, 48 }, { -5, 49 }, { -5, 50 }, { -4, -47 }, { -4, -46 }, { -4, -45 }, { -4, -44 }, { -4, -43 }, { -4, -37 }, { -4, -36 }, { -4, -35 }, { -4, -34 }, { -4, -19 }, { -4, -18 }, { -4, -17 }, { -4, -13 }, { -4, -12 }, - { -4, -11 }, { -4, -10 }, { -4, -2 }, { -4, -1 }, { -4, 0 }, { -4, 1 }, { -4, 2 }, { -4, 3 }, { -4, 4 }, { -4, 5 }, { -4, 13 }, { -4, 14 }, { -4, 15 }, { -4, 16 }, { -4, 20 }, { -4, 21 }, { -4, 22 }, { -4, 37 }, { -4, 38 }, { -4, 39 }, { -4, 40 }, { -4, 46 }, { -4, 47 }, { -4, 48 }, { -4, 49 }, { -4, 50 }, { -3, -44 }, { -3, -43 }, { -3, -42 }, { -3, -41 }, - { -3, -40 }, { -3, -37 }, { -3, -36 }, { -3, -35 }, { -3, -34 }, { -3, -31 }, { -3, -30 }, { -3, -29 }, { -3, -28 }, { -3, -25 }, { -3, -24 }, { -3, -23 }, { -3, -22 }, { -3, -18 }, { -3, -17 }, { -3, -16 }, { -3, -7 }, { -3, -6 }, { -3, -3 }, { -3, -2 }, { -3, -1 }, { -3, 0 }, { -3, 3 }, { -3, 4 }, { -3, 5 }, { -3, 6 }, { -3, 9 }, { -3, 10 }, { -3, 19 }, { -3, 20 }, - { -3, 21 }, { -3, 25 }, { -3, 26 }, { -3, 27 }, { -3, 28 }, { -3, 31 }, { -3, 32 }, { -3, 33 }, { -3, 34 }, { -3, 37 }, { -3, 38 }, { -3, 39 }, { -3, 40 }, { -3, 43 }, { -3, 44 }, { -3, 45 }, { -3, 46 }, { -3, 47 }, { -2, -43 }, { -2, -42 }, { -2, -41 }, { -2, -40 }, { -2, -37 }, { -2, -36 }, { -2, -35 }, { -2, -34 }, { -2, -31 }, { -2, -30 }, { -2, -29 }, { -2, -28 }, - { -2, -25 }, { -2, -24 }, { -2, -23 }, { -2, -22 }, { -2, -21 }, { -2, -17 }, { -2, -16 }, { -2, -15 }, { -2, -8 }, { -2, -7 }, { -2, -6 }, { -2, -3 }, { -2, -2 }, { -2, -1 }, { -2, 0 }, { -2, 3 }, { -2, 4 }, { -2, 5 }, { -2, 6 }, { -2, 9 }, { -2, 10 }, { -2, 11 }, { -2, 18 }, { -2, 19 }, { -2, 20 }, { -2, 24 }, { -2, 25 }, { -2, 26 }, { -2, 27 }, { -2, 28 }, - { -2, 31 }, { -2, 32 }, { -2, 33 }, { -2, 34 }, { -2, 37 }, { -2, 38 }, { -2, 39 }, { -2, 40 }, { -2, 43 }, { -2, 44 }, { -2, 45 }, { -2, 46 }, { -1, -47 }, { -1, -46 }, { -1, -43 }, { -1, -42 }, { -1, -41 }, { -1, -40 }, { -1, -37 }, { -1, -36 }, { -1, -29 }, { -1, -28 }, { -1, -25 }, { -1, -24 }, { -1, -23 }, { -1, -22 }, { -1, -21 }, { -1, -20 }, { -1, -17 }, { -1, -16 }, - { -1, -15 }, { -1, -14 }, { -1, -13 }, { -1, -12 }, { -1, -9 }, { -1, -8 }, { -1, -7 }, { -1, -6 }, { -1, -3 }, { -1, -2 }, { -1, 5 }, { -1, 6 }, { -1, 9 }, { -1, 10 }, { -1, 11 }, { -1, 12 }, { -1, 15 }, { -1, 16 }, { -1, 17 }, { -1, 18 }, { -1, 19 }, { -1, 20 }, { -1, 23 }, { -1, 24 }, { -1, 25 }, { -1, 26 }, { -1, 27 }, { -1, 28 }, { -1, 31 }, { -1, 32 }, - { -1, 39 }, { -1, 40 }, { -1, 43 }, { -1, 44 }, { -1, 45 }, { -1, 46 }, { -1, 49 }, { -1, 50 }, { 0, -47 }, { 0, -46 }, { 0, -43 }, { 0, -42 }, { 0, -41 }, { 0, -40 }, { 0, -37 }, { 0, -36 }, { 0, -29 }, { 0, -28 }, { 0, -25 }, { 0, -24 }, { 0, -23 }, { 0, -22 }, { 0, -21 }, { 0, -20 }, { 0, -17 }, { 0, -16 }, { 0, -15 }, { 0, -14 }, { 0, -13 }, { 0, -12 }, - { 0, -9 }, { 0, -8 }, { 0, -7 }, { 0, -6 }, { 0, -3 }, { 0, -2 }, { 0, 5 }, { 0, 6 }, { 0, 9 }, { 0, 10 }, { 0, 11 }, { 0, 12 }, { 0, 15 }, { 0, 16 }, { 0, 17 }, { 0, 18 }, { 0, 19 }, { 0, 20 }, { 0, 23 }, { 0, 24 }, { 0, 25 }, { 0, 26 }, { 0, 27 }, { 0, 28 }, { 0, 31 }, { 0, 32 }, { 0, 39 }, { 0, 40 }, { 0, 43 }, { 0, 44 }, - { 0, 45 }, { 0, 46 }, { 0, 49 }, { 0, 50 }, { 1, -43 }, { 1, -42 }, { 1, -41 }, { 1, -40 }, { 1, -37 }, { 1, -36 }, { 1, -35 }, { 1, -34 }, { 1, -31 }, { 1, -30 }, { 1, -29 }, { 1, -28 }, { 1, -25 }, { 1, -24 }, { 1, -23 }, { 1, -22 }, { 1, -21 }, { 1, -17 }, { 1, -16 }, { 1, -15 }, { 1, -8 }, { 1, -7 }, { 1, -6 }, { 1, -3 }, { 1, -2 }, { 1, -1 }, - { 1, 0 }, { 1, 3 }, { 1, 4 }, { 1, 5 }, { 1, 6 }, { 1, 9 }, { 1, 10 }, { 1, 11 }, { 1, 18 }, { 1, 19 }, { 1, 20 }, { 1, 24 }, { 1, 25 }, { 1, 26 }, { 1, 27 }, { 1, 28 }, { 1, 31 }, { 1, 32 }, { 1, 33 }, { 1, 34 }, { 1, 37 }, { 1, 38 }, { 1, 39 }, { 1, 40 }, { 1, 43 }, { 1, 44 }, { 1, 45 }, { 1, 46 }, { 2, -44 }, { 2, -43 }, - { 2, -42 }, { 2, -41 }, { 2, -40 }, { 2, -37 }, { 2, -36 }, { 2, -35 }, { 2, -34 }, { 2, -31 }, { 2, -30 }, { 2, -29 }, { 2, -28 }, { 2, -25 }, { 2, -24 }, { 2, -23 }, { 2, -22 }, { 2, -18 }, { 2, -17 }, { 2, -16 }, { 2, -7 }, { 2, -6 }, { 2, -3 }, { 2, -2 }, { 2, -1 }, { 2, 0 }, { 2, 3 }, { 2, 4 }, { 2, 5 }, { 2, 6 }, { 2, 9 }, { 2, 10 }, - { 2, 19 }, { 2, 20 }, { 2, 21 }, { 2, 25 }, { 2, 26 }, { 2, 27 }, { 2, 28 }, { 2, 31 }, { 2, 32 }, { 2, 33 }, { 2, 34 }, { 2, 37 }, { 2, 38 }, { 2, 39 }, { 2, 40 }, { 2, 43 }, { 2, 44 }, { 2, 45 }, { 2, 46 }, { 2, 47 }, { 3, -47 }, { 3, -46 }, { 3, -45 }, { 3, -44 }, { 3, -43 }, { 3, -37 }, { 3, -36 }, { 3, -35 }, { 3, -34 }, { 3, -19 }, - { 3, -18 }, { 3, -17 }, { 3, -13 }, { 3, -12 }, { 3, -11 }, { 3, -10 }, { 3, -2 }, { 3, -1 }, { 3, 0 }, { 3, 1 }, { 3, 2 }, { 3, 3 }, { 3, 4 }, { 3, 5 }, { 3, 13 }, { 3, 14 }, { 3, 15 }, { 3, 16 }, { 3, 20 }, { 3, 21 }, { 3, 22 }, { 3, 37 }, { 3, 38 }, { 3, 39 }, { 3, 40 }, { 3, 46 }, { 3, 47 }, { 3, 48 }, { 3, 49 }, { 3, 50 }, - { 4, -47 }, { 4, -46 }, { 4, -45 }, { 4, -44 }, { 4, -37 }, { 4, -36 }, { 4, -35 }, { 4, -34 }, { 4, -19 }, { 4, -18 }, { 4, -13 }, { 4, -12 }, { 4, -11 }, { 4, -10 }, { 4, -1 }, { 4, 0 }, { 4, 1 }, { 4, 2 }, { 4, 3 }, { 4, 4 }, { 4, 13 }, { 4, 14 }, { 4, 15 }, { 4, 16 }, { 4, 21 }, { 4, 22 }, { 4, 37 }, { 4, 38 }, { 4, 39 }, { 4, 40 }, - { 4, 47 }, { 4, 48 }, { 4, 49 }, { 4, 50 }, { 5, -46 }, { 5, -45 }, { 5, -44 }, { 5, -39 }, { 5, -38 }, { 5, -37 }, { 5, -36 }, { 5, -35 }, { 5, -31 }, { 5, -30 }, { 5, -25 }, { 5, -24 }, { 5, -23 }, { 5, -22 }, { 5, -12 }, { 5, -11 }, { 5, -10 }, { 5, -6 }, { 5, -5 }, { 5, 8 }, { 5, 9 }, { 5, 13 }, { 5, 14 }, { 5, 15 }, { 5, 25 }, { 5, 26 }, - { 5, 27 }, { 5, 28 }, { 5, 33 }, { 5, 34 }, { 5, 38 }, { 5, 39 }, { 5, 40 }, { 5, 41 }, { 5, 42 }, { 5, 47 }, { 5, 48 }, { 5, 49 }, { 6, -45 }, { 6, -44 }, { 6, -39 }, { 6, -38 }, { 6, -37 }, { 6, -36 }, { 6, -31 }, { 6, -30 }, { 6, -29 }, { 6, -25 }, { 6, -24 }, { 6, -23 }, { 6, -22 }, { 6, -21 }, { 6, -11 }, { 6, -10 }, { 6, -7 }, { 6, -6 }, - { 6, -5 }, { 6, -4 }, { 6, 7 }, { 6, 8 }, { 6, 9 }, { 6, 10 }, { 6, 13 }, { 6, 14 }, { 6, 24 }, { 6, 25 }, { 6, 26 }, { 6, 27 }, { 6, 28 }, { 6, 32 }, { 6, 33 }, { 6, 34 }, { 6, 39 }, { 6, 40 }, { 6, 41 }, { 6, 42 }, { 6, 47 }, { 6, 48 }, { 7, -45 }, { 7, -44 }, { 7, -30 }, { 7, -29 }, { 7, -28 }, { 7, -24 }, { 7, -23 }, { 7, -22 }, - { 7, -21 }, { 7, -20 }, { 7, -17 }, { 7, -16 }, { 7, -15 }, { 7, -14 }, { 7, -7 }, { 7, -6 }, { 7, -5 }, { 7, -4 }, { 7, -1 }, { 7, 0 }, { 7, 1 }, { 7, 2 }, { 7, 3 }, { 7, 4 }, { 7, 7 }, { 7, 8 }, { 7, 9 }, { 7, 10 }, { 7, 17 }, { 7, 18 }, { 7, 19 }, { 7, 20 }, { 7, 23 }, { 7, 24 }, { 7, 25 }, { 7, 26 }, { 7, 27 }, { 7, 31 }, - { 7, 32 }, { 7, 33 }, { 7, 47 }, { 7, 48 }, { 8, -45 }, { 8, -44 }, { 8, -43 }, { 8, -29 }, { 8, -28 }, { 8, -27 }, { 8, -23 }, { 8, -22 }, { 8, -21 }, { 8, -20 }, { 8, -17 }, { 8, -16 }, { 8, -15 }, { 8, -14 }, { 8, -13 }, { 8, -8 }, { 8, -7 }, { 8, -6 }, { 8, -5 }, { 8, -1 }, { 8, 0 }, { 8, 1 }, { 8, 2 }, { 8, 3 }, { 8, 4 }, { 8, 8 }, - { 8, 9 }, { 8, 10 }, { 8, 11 }, { 8, 16 }, { 8, 17 }, { 8, 18 }, { 8, 19 }, { 8, 20 }, { 8, 23 }, { 8, 24 }, { 8, 25 }, { 8, 26 }, { 8, 30 }, { 8, 31 }, { 8, 32 }, { 8, 46 }, { 8, 47 }, { 8, 48 }, { 9, -44 }, { 9, -43 }, { 9, -42 }, { 9, -33 }, { 9, -32 }, { 9, -29 }, { 9, -28 }, { 9, -27 }, { 9, -26 }, { 9, -23 }, { 9, -22 }, { 9, -21 }, - { 9, -20 }, { 9, -17 }, { 9, -16 }, { 9, -15 }, { 9, -14 }, { 9, -13 }, { 9, -12 }, { 9, -9 }, { 9, -8 }, { 9, -7 }, { 9, 0 }, { 9, 1 }, { 9, 2 }, { 9, 3 }, { 9, 10 }, { 9, 11 }, { 9, 12 }, { 9, 15 }, { 9, 16 }, { 9, 17 }, { 9, 18 }, { 9, 19 }, { 9, 20 }, { 9, 23 }, { 9, 24 }, { 9, 25 }, { 9, 26 }, { 9, 29 }, { 9, 30 }, { 9, 31 }, - { 9, 32 }, { 9, 35 }, { 9, 36 }, { 9, 45 }, { 9, 46 }, { 9, 47 }, { 10, -43 }, { 10, -42 }, { 10, -34 }, { 10, -33 }, { 10, -32 }, { 10, -29 }, { 10, -28 }, { 10, -27 }, { 10, -26 }, { 10, -23 }, { 10, -22 }, { 10, -21 }, { 10, -20 }, { 10, -17 }, { 10, -16 }, { 10, -15 }, { 10, -14 }, { 10, -13 }, { 10, -12 }, { 10, -9 }, { 10, -8 }, { 10, 1 }, { 10, 2 }, { 10, 11 }, - { 10, 12 }, { 10, 15 }, { 10, 16 }, { 10, 17 }, { 10, 18 }, { 10, 19 }, { 10, 20 }, { 10, 23 }, { 10, 24 }, { 10, 25 }, { 10, 26 }, { 10, 29 }, { 10, 30 }, { 10, 31 }, { 10, 32 }, { 10, 35 }, { 10, 36 }, { 10, 37 }, { 10, 45 }, { 10, 46 }, { 11, -39 }, { 11, -38 }, { 11, -35 }, { 11, -34 }, { 11, -33 }, { 11, -32 }, { 11, -29 }, { 11, -28 }, { 11, -27 }, { 11, -16 }, - { 11, -15 }, { 11, -14 }, { 11, -13 }, { 11, -5 }, { 11, -4 }, { 11, -3 }, { 11, -2 }, { 11, 5 }, { 11, 6 }, { 11, 7 }, { 11, 8 }, { 11, 16 }, { 11, 17 }, { 11, 18 }, { 11, 19 }, { 11, 30 }, { 11, 31 }, { 11, 32 }, { 11, 35 }, { 11, 36 }, { 11, 37 }, { 11, 38 }, { 11, 41 }, { 11, 42 }, { 12, -39 }, { 12, -38 }, { 12, -35 }, { 12, -34 }, { 12, -33 }, { 12, -32 }, - { 12, -29 }, { 12, -28 }, { 12, -15 }, { 12, -14 }, { 12, -5 }, { 12, -4 }, { 12, -3 }, { 12, -2 }, { 12, 5 }, { 12, 6 }, { 12, 7 }, { 12, 8 }, { 12, 17 }, { 12, 18 }, { 12, 31 }, { 12, 32 }, { 12, 35 }, { 12, 36 }, { 12, 37 }, { 12, 38 }, { 12, 41 }, { 12, 42 }, { 13, -43 }, { 13, -42 }, { 13, -39 }, { 13, -38 }, { 13, -37 }, { 13, -36 }, { 13, -35 }, { 13, -34 }, - { 13, -33 }, { 13, -19 }, { 13, -18 }, { 13, -9 }, { 13, -8 }, { 13, -4 }, { 13, -3 }, { 13, -2 }, { 13, 1 }, { 13, 2 }, { 13, 5 }, { 13, 6 }, { 13, 7 }, { 13, 11 }, { 13, 12 }, { 13, 21 }, { 13, 22 }, { 13, 36 }, { 13, 37 }, { 13, 38 }, { 13, 39 }, { 13, 40 }, { 13, 41 }, { 13, 42 }, { 13, 45 }, { 13, 46 }, { 14, -43 }, { 14, -42 }, { 14, -39 }, { 14, -38 }, - { 14, -37 }, { 14, -36 }, { 14, -35 }, { 14, -34 }, { 14, -20 }, { 14, -19 }, { 14, -18 }, { 14, -17 }, { 14, -10 }, { 14, -9 }, { 14, -8 }, { 14, -7 }, { 14, -3 }, { 14, -2 }, { 14, 1 }, { 14, 2 }, { 14, 5 }, { 14, 6 }, { 14, 10 }, { 14, 11 }, { 14, 12 }, { 14, 13 }, { 14, 20 }, { 14, 21 }, { 14, 22 }, { 14, 23 }, { 14, 37 }, { 14, 38 }, { 14, 39 }, { 14, 40 }, - { 14, 41 }, { 14, 42 }, { 14, 45 }, { 14, 46 }, { 15, -43 }, { 15, -42 }, { 15, -31 }, { 15, -30 }, { 15, -27 }, { 15, -26 }, { 15, -21 }, { 15, -20 }, { 15, -19 }, { 15, -18 }, { 15, -17 }, { 15, -16 }, { 15, -15 }, { 15, -14 }, { 15, -11 }, { 15, -10 }, { 15, -9 }, { 15, -8 }, { 15, -7 }, { 15, -6 }, { 15, 1 }, { 15, 2 }, { 15, 9 }, { 15, 10 }, { 15, 11 }, { 15, 12 }, - { 15, 13 }, { 15, 14 }, { 15, 17 }, { 15, 18 }, { 15, 19 }, { 15, 20 }, { 15, 21 }, { 15, 22 }, { 15, 23 }, { 15, 24 }, { 15, 29 }, { 15, 30 }, { 15, 33 }, { 15, 34 }, { 15, 45 }, { 15, 46 }, { 16, -43 }, { 16, -42 }, { 16, -32 }, { 16, -31 }, { 16, -30 }, { 16, -27 }, { 16, -26 }, { 16, -25 }, { 16, -21 }, { 16, -20 }, { 16, -19 }, { 16, -18 }, { 16, -17 }, { 16, -16 }, - { 16, -15 }, { 16, -14 }, { 16, -11 }, { 16, -10 }, { 16, -9 }, { 16, -8 }, { 16, -7 }, { 16, -6 }, { 16, 0 }, { 16, 1 }, { 16, 2 }, { 16, 3 }, { 16, 9 }, { 16, 10 }, { 16, 11 }, { 16, 12 }, { 16, 13 }, { 16, 14 }, { 16, 17 }, { 16, 18 }, { 16, 19 }, { 16, 20 }, { 16, 21 }, { 16, 22 }, { 16, 23 }, { 16, 24 }, { 16, 28 }, { 16, 29 }, { 16, 30 }, { 16, 33 }, - { 16, 34 }, { 16, 35 }, { 16, 45 }, { 16, 46 }, { 17, -43 }, { 17, -42 }, { 17, -35 }, { 17, -34 }, { 17, -33 }, { 17, -32 }, { 17, -31 }, { 17, -26 }, { 17, -25 }, { 17, -24 }, { 17, -15 }, { 17, -14 }, { 17, -10 }, { 17, -9 }, { 17, -8 }, { 17, -7 }, { 17, -6 }, { 17, -1 }, { 17, 0 }, { 17, 1 }, { 17, 2 }, { 17, 3 }, { 17, 4 }, { 17, 9 }, { 17, 10 }, { 17, 11 }, - { 17, 12 }, { 17, 13 }, { 17, 17 }, { 17, 18 }, { 17, 27 }, { 17, 28 }, { 17, 29 }, { 17, 34 }, { 17, 35 }, { 17, 36 }, { 17, 37 }, { 17, 38 }, { 17, 45 }, { 17, 46 }, { 18, -43 }, { 18, -42 }, { 18, -41 }, { 18, -35 }, { 18, -34 }, { 18, -33 }, { 18, -32 }, { 18, -25 }, { 18, -24 }, { 18, -23 }, { 18, -15 }, { 18, -14 }, { 18, -13 }, { 18, -9 }, { 18, -8 }, { 18, -7 }, - { 18, -6 }, { 18, -2 }, { 18, -1 }, { 18, 0 }, { 18, 1 }, { 18, 2 }, { 18, 3 }, { 18, 4 }, { 18, 5 }, { 18, 9 }, { 18, 10 }, { 18, 11 }, { 18, 12 }, { 18, 16 }, { 18, 17 }, { 18, 18 }, { 18, 26 }, { 18, 27 }, { 18, 28 }, { 18, 35 }, { 18, 36 }, { 18, 37 }, { 18, 38 }, { 18, 44 }, { 18, 45 }, { 18, 46 }, { 19, -42 }, { 19, -41 }, { 19, -40 }, { 19, -39 }, - { 19, -38 }, { 19, -29 }, { 19, -28 }, { 19, -25 }, { 19, -24 }, { 19, -23 }, { 19, -22 }, { 19, -21 }, { 19, -20 }, { 19, -19 }, { 19, -18 }, { 19, -15 }, { 19, -14 }, { 19, -13 }, { 19, -12 }, { 19, -3 }, { 19, -2 }, { 19, -1 }, { 19, 4 }, { 19, 5 }, { 19, 6 }, { 19, 15 }, { 19, 16 }, { 19, 17 }, { 19, 18 }, { 19, 21 }, { 19, 22 }, { 19, 23 }, { 19, 24 }, { 19, 25 }, - { 19, 26 }, { 19, 27 }, { 19, 28 }, { 19, 31 }, { 19, 32 }, { 19, 41 }, { 19, 42 }, { 19, 43 }, { 19, 44 }, { 19, 45 }, { 20, -41 }, { 20, -40 }, { 20, -39 }, { 20, -38 }, { 20, -37 }, { 20, -29 }, { 20, -28 }, { 20, -25 }, { 20, -24 }, { 20, -23 }, { 20, -22 }, { 20, -21 }, { 20, -20 }, { 20, -19 }, { 20, -18 }, { 20, -15 }, { 20, -14 }, { 20, -13 }, { 20, -12 }, { 20, -3 }, - { 20, -2 }, { 20, 5 }, { 20, 6 }, { 20, 15 }, { 20, 16 }, { 20, 17 }, { 20, 18 }, { 20, 21 }, { 20, 22 }, { 20, 23 }, { 20, 24 }, { 20, 25 }, { 20, 26 }, { 20, 27 }, { 20, 28 }, { 20, 31 }, { 20, 32 }, { 20, 40 }, { 20, 41 }, { 20, 42 }, { 20, 43 }, { 20, 44 }, { 21, -38 }, { 21, -37 }, { 21, -36 }, { 21, -29 }, { 21, -28 }, { 21, -19 }, { 21, -18 }, { 21, -15 }, - { 21, -14 }, { 21, -13 }, { 21, -9 }, { 21, -8 }, { 21, -7 }, { 21, -6 }, { 21, 1 }, { 21, 2 }, { 21, 9 }, { 21, 10 }, { 21, 11 }, { 21, 12 }, { 21, 16 }, { 21, 17 }, { 21, 18 }, { 21, 21 }, { 21, 22 }, { 21, 31 }, { 21, 32 }, { 21, 39 }, { 21, 40 }, { 21, 41 }, { 22, -37 }, { 22, -36 }, { 22, -30 }, { 22, -29 }, { 22, -28 }, { 22, -19 }, { 22, -18 }, { 22, -15 }, - { 22, -14 }, { 22, -9 }, { 22, -8 }, { 22, -7 }, { 22, -6 }, { 22, -5 }, { 22, 0 }, { 22, 1 }, { 22, 2 }, { 22, 3 }, { 22, 8 }, { 22, 9 }, { 22, 10 }, { 22, 11 }, { 22, 12 }, { 22, 17 }, { 22, 18 }, { 22, 21 }, { 22, 22 }, { 22, 31 }, { 22, 32 }, { 22, 33 }, { 22, 39 }, { 22, 40 }, { 23, -33 }, { 23, -32 }, { 23, -31 }, { 23, -30 }, { 23, -29 }, { 23, -25 }, - { 23, -24 }, { 23, -23 }, { 23, -22 }, { 23, -19 }, { 23, -18 }, { 23, -9 }, { 23, -8 }, { 23, -7 }, { 23, -6 }, { 23, -5 }, { 23, -4 }, { 23, -1 }, { 23, 0 }, { 23, 1 }, { 23, 2 }, { 23, 3 }, { 23, 4 }, { 23, 7 }, { 23, 8 }, { 23, 9 }, { 23, 10 }, { 23, 11 }, { 23, 12 }, { 23, 21 }, { 23, 22 }, { 23, 25 }, { 23, 26 }, { 23, 27 }, { 23, 28 }, { 23, 32 }, - { 23, 33 }, { 23, 34 }, { 23, 35 }, { 23, 36 }, { 24, -33 }, { 24, -32 }, { 24, -31 }, { 24, -30 }, { 24, -25 }, { 24, -24 }, { 24, -23 }, { 24, -22 }, { 24, -19 }, { 24, -18 }, { 24, -17 }, { 24, -9 }, { 24, -8 }, { 24, -7 }, { 24, -6 }, { 24, -5 }, { 24, -4 }, { 24, -1 }, { 24, 0 }, { 24, 1 }, { 24, 2 }, { 24, 3 }, { 24, 4 }, { 24, 7 }, { 24, 8 }, { 24, 9 }, - { 24, 10 }, { 24, 11 }, { 24, 12 }, { 24, 20 }, { 24, 21 }, { 24, 22 }, { 24, 25 }, { 24, 26 }, { 24, 27 }, { 24, 28 }, { 24, 33 }, { 24, 34 }, { 24, 35 }, { 24, 36 }, { 25, -39 }, { 25, -38 }, { 25, -37 }, { 25, -36 }, { 25, -24 }, { 25, -23 }, { 25, -22 }, { 25, -19 }, { 25, -18 }, { 25, -17 }, { 25, -16 }, { 25, -6 }, { 25, -5 }, { 25, -4 }, { 25, -1 }, { 25, 0 }, - { 25, 1 }, { 25, 2 }, { 25, 3 }, { 25, 4 }, { 25, 7 }, { 25, 8 }, { 25, 9 }, { 25, 19 }, { 25, 20 }, { 25, 21 }, { 25, 22 }, { 25, 25 }, { 25, 26 }, { 25, 27 }, { 25, 39 }, { 25, 40 }, { 25, 41 }, { 25, 42 }, { 26, -39 }, { 26, -38 }, { 26, -37 }, { 26, -36 }, { 26, -23 }, { 26, -22 }, { 26, -19 }, { 26, -18 }, { 26, -17 }, { 26, -16 }, { 26, -15 }, { 26, -5 }, - { 26, -4 }, { 26, -1 }, { 26, 0 }, { 26, 1 }, { 26, 2 }, { 26, 3 }, { 26, 4 }, { 26, 7 }, { 26, 8 }, { 26, 18 }, { 26, 19 }, { 26, 20 }, { 26, 21 }, { 26, 22 }, { 26, 25 }, { 26, 26 }, { 26, 39 }, { 26, 40 }, { 26, 41 }, { 26, 42 }, { 27, -38 }, { 27, -37 }, { 27, -36 }, { 27, -29 }, { 27, -28 }, { 27, -27 }, { 27, -26 }, { 27, -16 }, { 27, -15 }, { 27, -14 }, - { 27, -9 }, { 27, -8 }, { 27, 11 }, { 27, 12 }, { 27, 17 }, { 27, 18 }, { 27, 19 }, { 27, 29 }, { 27, 30 }, { 27, 31 }, { 27, 32 }, { 27, 39 }, { 27, 40 }, { 27, 41 }, { 28, -37 }, { 28, -36 }, { 28, -30 }, { 28, -29 }, { 28, -28 }, { 28, -27 }, { 28, -26 }, { 28, -15 }, { 28, -14 }, { 28, -10 }, { 28, -9 }, { 28, -8 }, { 28, -7 }, { 28, 10 }, { 28, 11 }, { 28, 12 }, - { 28, 13 }, { 28, 17 }, { 28, 18 }, { 28, 29 }, { 28, 30 }, { 28, 31 }, { 28, 32 }, { 28, 33 }, { 28, 39 }, { 28, 40 }, { 29, -33 }, { 29, -32 }, { 29, -31 }, { 29, -30 }, { 29, -29 }, { 29, -28 }, { 29, -27 }, { 29, -26 }, { 29, -21 }, { 29, -20 }, { 29, -19 }, { 29, -18 }, { 29, -11 }, { 29, -10 }, { 29, -9 }, { 29, -8 }, { 29, -7 }, { 29, -6 }, { 29, -1 }, { 29, 0 }, - { 29, 1 }, { 29, 2 }, { 29, 3 }, { 29, 4 }, { 29, 9 }, { 29, 10 }, { 29, 11 }, { 29, 12 }, { 29, 13 }, { 29, 14 }, { 29, 21 }, { 29, 22 }, { 29, 23 }, { 29, 24 }, { 29, 29 }, { 29, 30 }, { 29, 31 }, { 29, 32 }, { 29, 33 }, { 29, 34 }, { 29, 35 }, { 29, 36 }, { 30, -33 }, { 30, -32 }, { 30, -31 }, { 30, -30 }, { 30, -29 }, { 30, -28 }, { 30, -27 }, { 30, -26 }, - { 30, -22 }, { 30, -21 }, { 30, -20 }, { 30, -19 }, { 30, -18 }, { 30, -11 }, { 30, -10 }, { 30, -9 }, { 30, -8 }, { 30, -7 }, { 30, -6 }, { 30, -5 }, { 30, -1 }, { 30, 0 }, { 30, 1 }, { 30, 2 }, { 30, 3 }, { 30, 4 }, { 30, 8 }, { 30, 9 }, { 30, 10 }, { 30, 11 }, { 30, 12 }, { 30, 13 }, { 30, 14 }, { 30, 21 }, { 30, 22 }, { 30, 23 }, { 30, 24 }, { 30, 25 }, - { 30, 29 }, { 30, 30 }, { 30, 31 }, { 30, 32 }, { 30, 33 }, { 30, 34 }, { 30, 35 }, { 30, 36 }, { 31, -32 }, { 31, -31 }, { 31, -30 }, { 31, -29 }, { 31, -28 }, { 31, -27 }, { 31, -23 }, { 31, -22 }, { 31, -21 }, { 31, -15 }, { 31, -14 }, { 31, -6 }, { 31, -5 }, { 31, -4 }, { 31, -1 }, { 31, 0 }, { 31, 3 }, { 31, 4 }, { 31, 7 }, { 31, 8 }, { 31, 9 }, { 31, 17 }, - { 31, 18 }, { 31, 24 }, { 31, 25 }, { 31, 26 }, { 31, 30 }, { 31, 31 }, { 31, 32 }, { 31, 33 }, { 31, 34 }, { 31, 35 }, { 32, -31 }, { 32, -30 }, { 32, -29 }, { 32, -28 }, { 32, -23 }, { 32, -22 }, { 32, -16 }, { 32, -15 }, { 32, -14 }, { 32, -5 }, { 32, -4 }, { 32, -1 }, { 32, 0 }, { 32, 3 }, { 32, 4 }, { 32, 7 }, { 32, 8 }, { 32, 17 }, { 32, 18 }, { 32, 19 }, - { 32, 25 }, { 32, 26 }, { 32, 31 }, { 32, 32 }, { 32, 33 }, { 32, 34 }, { 33, -30 }, { 33, -29 }, { 33, -28 }, { 33, -23 }, { 33, -22 }, { 33, -17 }, { 33, -16 }, { 33, -15 }, { 33, -11 }, { 33, -10 }, { 33, -9 }, { 33, -8 }, { 33, 11 }, { 33, 12 }, { 33, 13 }, { 33, 14 }, { 33, 18 }, { 33, 19 }, { 33, 20 }, { 33, 25 }, { 33, 26 }, { 33, 31 }, { 33, 32 }, { 33, 33 }, - { 34, -29 }, { 34, -28 }, { 34, -23 }, { 34, -22 }, { 34, -17 }, { 34, -16 }, { 34, -12 }, { 34, -11 }, { 34, -10 }, { 34, -9 }, { 34, -8 }, { 34, 11 }, { 34, 12 }, { 34, 13 }, { 34, 14 }, { 34, 15 }, { 34, 19 }, { 34, 20 }, { 34, 25 }, { 34, 26 }, { 34, 31 }, { 34, 32 }, { 35, -17 }, { 35, -16 }, { 35, -13 }, { 35, -12 }, { 35, -11 }, { 35, -10 }, { 35, -9 }, { 35, -3 }, - { 35, -2 }, { 35, -1 }, { 35, 0 }, { 35, 3 }, { 35, 4 }, { 35, 5 }, { 35, 6 }, { 35, 12 }, { 35, 13 }, { 35, 14 }, { 35, 15 }, { 35, 16 }, { 35, 19 }, { 35, 20 }, { 36, -17 }, { 36, -16 }, { 36, -13 }, { 36, -12 }, { 36, -11 }, { 36, -10 }, { 36, -4 }, { 36, -3 }, { 36, -2 }, { 36, -1 }, { 36, 0 }, { 36, 3 }, { 36, 4 }, { 36, 5 }, { 36, 6 }, { 36, 7 }, - { 36, 13 }, { 36, 14 }, { 36, 15 }, { 36, 16 }, { 36, 19 }, { 36, 20 }, { 37, -27 }, { 37, -26 }, { 37, -25 }, { 37, -24 }, { 37, -21 }, { 37, -20 }, { 37, -13 }, { 37, -12 }, { 37, -5 }, { 37, -4 }, { 37, -3 }, { 37, -2 }, { 37, -1 }, { 37, 0 }, { 37, 1 }, { 37, 2 }, { 37, 3 }, { 37, 4 }, { 37, 5 }, { 37, 6 }, { 37, 7 }, { 37, 8 }, { 37, 15 }, { 37, 16 }, - { 37, 23 }, { 37, 24 }, { 37, 27 }, { 37, 28 }, { 37, 29 }, { 37, 30 }, { 38, -27 }, { 38, -26 }, { 38, -25 }, { 38, -24 }, { 38, -21 }, { 38, -20 }, { 38, -19 }, { 38, -13 }, { 38, -12 }, { 38, -5 }, { 38, -4 }, { 38, -3 }, { 38, -2 }, { 38, -1 }, { 38, 0 }, { 38, 1 }, { 38, 2 }, { 38, 3 }, { 38, 4 }, { 38, 5 }, { 38, 6 }, { 38, 7 }, { 38, 8 }, { 38, 15 }, - { 38, 16 }, { 38, 22 }, { 38, 23 }, { 38, 24 }, { 38, 27 }, { 38, 28 }, { 38, 29 }, { 38, 30 }, { 39, -26 }, { 39, -25 }, { 39, -24 }, { 39, -20 }, { 39, -19 }, { 39, -18 }, { 39, -13 }, { 39, -12 }, { 39, -11 }, { 39, -10 }, { 39, -5 }, { 39, -4 }, { 39, 7 }, { 39, 8 }, { 39, 13 }, { 39, 14 }, { 39, 15 }, { 39, 16 }, { 39, 21 }, { 39, 22 }, { 39, 23 }, { 39, 27 }, - { 39, 28 }, { 39, 29 }, { 40, -25 }, { 40, -24 }, { 40, -19 }, { 40, -18 }, { 40, -13 }, { 40, -12 }, { 40, -11 }, { 40, -10 }, { 40, -5 }, { 40, -4 }, { 40, 7 }, { 40, 8 }, { 40, 13 }, { 40, 14 }, { 40, 15 }, { 40, 16 }, { 40, 21 }, { 40, 22 }, { 40, 27 }, { 40, 28 }, { 41, -19 }, { 41, -18 }, { 41, -1 }, { 41, 0 }, { 41, 1 }, { 41, 2 }, { 41, 3 }, { 41, 4 }, - { 41, 21 }, { 41, 22 }, { 42, -19 }, { 42, -18 }, { 42, -17 }, { 42, -1 }, { 42, 0 }, { 42, 1 }, { 42, 2 }, { 42, 3 }, { 42, 4 }, { 42, 20 }, { 42, 21 }, { 42, 22 }, { 43, -18 }, { 43, -17 }, { 43, -16 }, { 43, -15 }, { 43, -14 }, { 43, -13 }, { 43, -12 }, { 43, -9 }, { 43, -8 }, { 43, -1 }, { 43, 0 }, { 43, 1 }, { 43, 2 }, { 43, 3 }, { 43, 4 }, { 43, 11 }, - { 43, 12 }, { 43, 15 }, { 43, 16 }, { 43, 17 }, { 43, 18 }, { 43, 19 }, { 43, 20 }, { 43, 21 }, { 44, -17 }, { 44, -16 }, { 44, -15 }, { 44, -14 }, { 44, -13 }, { 44, -12 }, { 44, -9 }, { 44, -8 }, { 44, -7 }, { 44, -2 }, { 44, -1 }, { 44, 0 }, { 44, 1 }, { 44, 2 }, { 44, 3 }, { 44, 4 }, { 44, 5 }, { 44, 10 }, { 44, 11 }, { 44, 12 }, { 44, 15 }, { 44, 16 }, - { 44, 17 }, { 44, 18 }, { 44, 19 }, { 44, 20 }, { 45, -8 }, { 45, -7 }, { 45, -6 }, { 45, -5 }, { 45, -4 }, { 45, -3 }, { 45, -2 }, { 45, -1 }, { 45, 4 }, { 45, 5 }, { 45, 6 }, { 45, 7 }, { 45, 8 }, { 45, 9 }, { 45, 10 }, { 45, 11 }, { 46, -7 }, { 46, -6 }, { 46, -5 }, { 46, -4 }, { 46, -3 }, { 46, -2 }, { 46, 5 }, { 46, 6 }, { 46, 7 }, { 46, 8 }, - { 46, 9 }, { 46, 10 }, { 47, -4 }, { 47, -3 }, { 47, -2 }, { 47, 1 }, { 47, 2 }, { 47, 5 }, { 47, 6 }, { 47, 7 }, { 48, -3 }, { 48, -2 }, { 48, 1 }, { 48, 2 }, { 48, 5 }, { 48, 6 }, - }, + } }, resource_tiles = { enabled = false, diff --git a/exp_legacy/module/config/vlayer.lua b/exp_legacy/module/config/vlayer.lua index d3355c6b..32bfc605 100644 --- a/exp_legacy/module/config/vlayer.lua +++ b/exp_legacy/module/config/vlayer.lua @@ -8,26 +8,26 @@ return { unlimited_capacity = false, --- @setting unlimited_capacity When true the vlayer has an unlimited energy capacity, accumulators are not required unlimited_surface_area = false, --- @setting unlimited_surface_area When true the vlayer has an unlimited surface area, landfill is not required - modded_auto_downgrade = false, --- @setting modded_auto_downgrade When true modded items will be converted into their base game equivalent, original items can not be recovered + modded_auto_downgrade = true, --- @setting modded_auto_downgrade When true modded items will be converted into their base game equivalent, original items can not be recovered mimic_surface = "nauvis", --- @setting mimic_surface Surface name/index the vlayer will copy its settings from, use nil to use the settings below surface = { --- @setting surface When mimic_surface is nil these settings will be used instead, see LuaSurface for details always_day = false, solar_power_multiplier = 1, min_brightness = 0.15, - ticks_per_day = 25000, + ticks_per_day = 25200, daytime = 0, dusk = 0.25, evening = 0.45, morning = 0.55, - dawn = 0.75, + dawn = 0.75 }, interface_limit = { --- @setting interface_limit Sets the limit for the number of vlayer interfaces that can be created energy = 1, -- >1 allows for disconnected power networks to receive power - circuit = 10, -- No caveats - storage_input = 10, -- No caveats - storage_output = 1, -- >0 allows for item teleportation (allowed_items only) + circuit = 20, -- No caveats + storage_input = 30, -- No caveats + storage_output = 1 -- >0 allows for item teleportation (allowed_items only) }, allowed_items = { --- @setting allowed_items List of all items allowed in vlayer storage and their properties @@ -43,55 +43,64 @@ return { ["solar-panel"] = { starting_value = 0, required_area = 9, - production = 0.06, -- MW + production = 0.06 -- MW }, ["accumulator"] = { starting_value = 0, required_area = 4, discharge = 0.3, -- MW - capacity = 5, -- MJ + capacity = 5 -- MJ }, ["landfill"] = { starting_value = 0, required_area = 0, - surface_area = 6, -- Tiles + surface_area = 8 -- Tiles }, ["wood"] = { starting_value = 0, required_area = 0, surface_area = 0, fuel_value = 2, -- MJ - power = true, -- turn all wood to power to reduce trash + power = true -- turn all wood to power to reduce trash }, ["coal"] = { starting_value = 0, required_area = 0, surface_area = 0, fuel_value = 4, -- MJ - power = false, -- turn all coal to power to reduce trash + power = true -- turn all coal to power to reduce trash }, + ["solid-fuel"] = { + starting_value = 0, + required_area = 0, + surface_area = 0, + fuel_value = 12, -- MJ + power = true -- turn all solid fuel to power to reduce trash + }, + ["rocket-fuel"] = { + starting_value = 0, + required_area = 0, + surface_area = 0, + fuel_value = 100, -- MJ + power = true -- turn all rocket fuel to power to reduce trash + } --[[ - ['iron-ore'] = { + ["iron-ore"] = { starting_value = 0, required_area = 0, surface_area = 0 }, - ['copper-ore'] = { + ["copper-ore"] = { starting_value = 0, required_area = 0, surface_area = 0 }, - ['coal'] = { + ["stone"] = { starting_value = 0, required_area = 0, surface_area = 0 }, - ['stone'] = { - starting_value = 0, - required_area = 0, - surface_area = 0 - }, - ['uranium-ore'] = { + ["uranium-ore"] = { starting_value = 0, required_area = 0, surface_area = 0 @@ -103,72 +112,72 @@ return { ["solar-panel-2"] = { starting_value = 0, base_game_equivalent = "solar-panel", - multiplier = 4, + multiplier = 4 }, ["solar-panel-3"] = { starting_value = 0, base_game_equivalent = "solar-panel", - multiplier = 16, + multiplier = 16 }, ["solar-panel-4"] = { starting_value = 0, base_game_equivalent = "solar-panel", - multiplier = 64, + multiplier = 64 }, ["solar-panel-5"] = { starting_value = 0, base_game_equivalent = "solar-panel", - multiplier = 256, + multiplier = 256 }, ["solar-panel-6"] = { starting_value = 0, base_game_equivalent = "solar-panel", - multiplier = 1024, + multiplier = 1024 }, ["solar-panel-7"] = { starting_value = 0, base_game_equivalent = "solar-panel", - multiplier = 4096, + multiplier = 4096 }, ["solar-panel-8"] = { starting_value = 0, base_game_equivalent = "solar-panel", - multiplier = 16384, + multiplier = 16384 }, ["accumulator-2"] = { starting_value = 0, base_game_equivalent = "accumulator", - multiplier = 4, + multiplier = 4 }, ["accumulator-3"] = { starting_value = 0, base_game_equivalent = "accumulator", - multiplier = 16, + multiplier = 16 }, ["accumulator-4"] = { starting_value = 0, base_game_equivalent = "accumulator", - multiplier = 64, + multiplier = 64 }, ["accumulator-5"] = { starting_value = 0, base_game_equivalent = "accumulator", - multiplier = 256, + multiplier = 256 }, ["accumulator-6"] = { starting_value = 0, base_game_equivalent = "accumulator", - multiplier = 1024, + multiplier = 1024 }, ["accumulator-7"] = { starting_value = 0, base_game_equivalent = "accumulator", - multiplier = 4096, + multiplier = 4096 }, ["accumulator-8"] = { starting_value = 0, base_game_equivalent = "accumulator", - multiplier = 16384, + multiplier = 16384 }, - }, + } } diff --git a/exp_legacy/module/locale/en/data.cfg b/exp_legacy/module/locale/en/data.cfg index b29656a3..a3c8944c 100644 --- a/exp_legacy/module/locale/en/data.cfg +++ b/exp_legacy/module/locale/en/data.cfg @@ -2,7 +2,7 @@ description-add=Sets / Gets your custom join message. description-remove=Removes you custom join message. arg-message=Your custom join message. -greet=[color=0,1,0] Welcome to explosive gaming community server! If you like the server join our discord: __1__ [/color] +greet=[color=0,1,0] Welcome to APERX gaming community server! __1__[/color] message-set=Your join message has been updated. message-get=Your join message is: __1__ message-cleared=Your join message has been cleared. diff --git a/exp_legacy/module/locale/en/expcore.cfg b/exp_legacy/module/locale/en/expcore.cfg index 69ec22ea..509e1734 100644 --- a/exp_legacy/module/locale/en/expcore.cfg +++ b/exp_legacy/module/locale/en/expcore.cfg @@ -27,4 +27,4 @@ preference-value-tooltip=Change by using /set-preference preference-All=All data will be saved preference-Statistics=Only statistics, settings, and required data will be saved preference-Settings=Only settings and required data will be saved -preference-Required=Only required data will be saved \ No newline at end of file +preference-Required=Only required data will be saved diff --git a/exp_legacy/module/locale/en/gui.cfg b/exp_legacy/module/locale/en/gui.cfg index 9f0957fd..30f4cfc3 100644 --- a/exp_legacy/module/locale/en/gui.cfg +++ b/exp_legacy/module/locale/en/gui.cfg @@ -133,8 +133,8 @@ goto-edit=Edit warp icon [readme] main-tooltip=Infomation welcome-tab=Welcome -welcome-tooltip=Welcome to Explosive Gaming -welcome-general=Welcome to Explosive Gaming; we host many factorio servers. While you are here, we ask you to follow our rules. You can find these in the tab above. You can also find our custom commands and links to our other servers. This map has been online for __2__.\nPlease note that our servers reset periodically, the next reset is: __1__ +welcome-tooltip=Welcome to APERX +welcome-general=Welcome to APERX; we host many factorio servers. While you are here, we ask you to follow our rules. You can find these in the tab above. You can also find our custom commands and links to our other servers. This map has been online for __2__.\nPlease note that our servers reset periodically, the next reset is: __1__ welcome-roles=We run a custom role system to help protect the work of others. As a result you may not be able to use your deconstruction planner yet or drop item on the groud. Roles also give you access to some custom features such as adding tasks to our task list or making new warp points.\nYou have been assigned the roles: __1__ welcome-chat=Chatting can be difficult for new players because it’s different than other games! It’s very simple, the button you need to press is the “GRAVE/TILDE” key (which is located under the “ESC key”) - If you would like to change the key, go to your Controls tab in options.\nThe setting you need to change is “Toggle chat (and Lua console)” you currently have it set to "__CONTROL__toggle-console__" rules-tab=Rules @@ -162,22 +162,22 @@ servers-tab=Servers servers-tooltip=Links to our other servers and sites servers-general=This is only one of our servers for factorio, we host many of others as well. Below you can find details about all the servers that we host as well as links to our external services such as discord or github. servers-factorio=Factorio Servers -servers-1=S1 Public -servers-d1=This is our 48 hour reset server. -servers-2=S2 Off -servers-d2=This server is closed. -servers-3=S3 Weekly -servers-d3=This is our weekly reset server. -servers-4=S4 Monthly -servers-d4=This is our monthly reset server. -servers-5=S5 Modded -servers-d5=This is our modded server, see discord for details. -servers-6=S6 Donator -servers-d6=This is our donator only server, online when requested. -servers-7=S7 Event -servers-d7=This is our event server, we try to run events at least once per week. -servers-8=S8 T̷-̶s̶-̴:̷ -servers-d8=N̵o̴ ̶o̷-̶e̵ ̴k̸n̷-̶w̵s̸ ̴w̷h̷a̶-̶ ̷h̴a̴p̷p̴e̷n̷s̸ ̷o̶n̴ ̷t̶h̴-̶s̶ ̷s̷e̶r̸v̸e̴r̷,̶ ̸i̸t̴ ̷m̶-̸g̴h̶t̷ ̸n̸-̶t̵ ̷e̴v̸e̸n̶t̷ ̵-̷x̴i̵s̶t̸.̸ +servers-1=S1 +servers-d1=This server resets weekly. +servers-2=S2 +servers-d2=This server resets weekly. +servers-3=S3 +servers-d3=This server resets weekly. +servers-4= +servers-d4= +servers-5=S5 +servers-d5=This server is only for members. Check discord for more details. +servers-6=S6 +servers-d6=This server is only for members. Check discord for more details. +servers-7= +servers-d7= +servers-8=S8 +servers-d8= servers-connect-Offline=Server is currently offline servers-connect-Current=This is your current server servers-connect-Version=Server is on a different version: __1__ diff --git a/exp_legacy/module/locale/zh-CN/addons.cfg b/exp_legacy/module/locale/zh-CN/addons.cfg index 04517f0b..47c623ad 100644 --- a/exp_legacy/module/locale/zh-CN/addons.cfg +++ b/exp_legacy/module/locale/zh-CN/addons.cfg @@ -7,20 +7,20 @@ player-health=__1__ player-damage=__1__ [links] -discord=https://discord.explosivegaming.nl -website=https://www.explosivegaming.nl -status=https://status.explosivegaming.nl -github=https://github.com/explosivegaming/scenario -patreon=https://www.patreon.com/ExpGaming +discord= +website= +status= +github= +patreon= [info] players-online=現在有 __1__ 人在線 total-map-time=地圖時間為 __1__ -discord=加入社群: https://discord.explosivegaming.nl -website=訪問網站: https://www.explosivegaming.nl -status=伺服器狀態: https://status.explosivegaming.nl -github=增加功能或回報錯誤: https://github.com/explosivegaming/scenario -patreon=支持我們: https://www.patreon.com/ExpGaming +discord= +website= +status= +github= +patreon= custom-commands=這裹使用了自制指令,如 /tag 和 /me。可使用 /chelp 查看更多。 read-readme=確保你已閱讀相關資訊。按左上 i 圖標可再次查看。 softmod=這裹用了自設情境,是一種軟裝模組。 @@ -43,7 +43,7 @@ reply=[Chat Bot] __1__ disallow=你沒有權限使用這個指令。 players-online=現在有 __1__ 人上線。 players=本地圖現在有 __1__ 人曾上線。 -not-real-dev=Cooldude2606 只是本場境的開發者 +not-real-dev= softmod=這裹用了自設情境。 blame=責怪 __1__ 吧。 afk=看看 __1__, 他已掛機 __2__ 。 diff --git a/exp_legacy/module/locale/zh-CN/data.cfg b/exp_legacy/module/locale/zh-CN/data.cfg index 76b58651..633aa430 100644 --- a/exp_legacy/module/locale/zh-CN/data.cfg +++ b/exp_legacy/module/locale/zh-CN/data.cfg @@ -2,10 +2,10 @@ description-add=設定 / 取得你的加入信息。 description-remove=移除你的加入信息。 arg-message=你的加入信息。 -greet=[color=0,1,0] 歡迎來到 EXP 的服務器! 若果你喜歡本服務器可加入 DISCORD: __1__ [/color] +greet=[color=0,1,0] 歡迎來到 APERX 的服務器! __1__[/color] message-set=你的加入信息已更新。 message-get=你的加入信息為: __1__ -message-cleared=你的加入信息已清除。 +message-cleared=的加入信息已清除。 [quickbar] saved=你的工具列已儲存。 diff --git a/exp_legacy/module/locale/zh-CN/gui.cfg b/exp_legacy/module/locale/zh-CN/gui.cfg index 1cabda1b..1acf3709 100644 --- a/exp_legacy/module/locale/zh-CN/gui.cfg +++ b/exp_legacy/module/locale/zh-CN/gui.cfg @@ -133,8 +133,8 @@ goto-edit=修改傳送陣圖案 [readme] main-tooltip=資訊 welcome-tab=歡迎 -welcome-tooltip=歡迎來到 Explosive Gaming -welcome-general=歡迎來到 Explosive Gaming; 你在這裏的時候要遵守規則。 你可以在左上方的介面找到更多資訊。 地圖時間 __2__。\n下次地圖重設: __1__ +welcome-tooltip=歡迎來到 APERX +welcome-general=歡迎來到 APERX; 你在這裏的時候要遵守規則。 你可以在左上方的介面找到更多資訊。 地圖時間 __2__。\n下次地圖重設: __1__ welcome-roles=我們有自訂的身份組來保護其他用戶。 所以你有機會不能使用拆除規劃器或掉東西。 身份組給予你各種權限\n你有以下身份組: __1__ welcome-chat=你可以使用 「重音符/抑音符」 鍵 (ESC 鍵 下方) - 你也可以在選項中修改按鍵。\n你目前設定為 「__CONTROL__toggle-console__」 rules-tab=規則 @@ -162,22 +162,22 @@ servers-tab=伺服器 servers-tooltip=到其他伺服器及網站的連結 servers-general=這是其中一個伺服器。你可以在下方找到其他同樣是由我們運行的伺服器資料。 servers-factorio=異星工廠伺服器 -servers-1=S1 公共 -servers-d1=這個服務器每兩日重設。 -servers-2=S2 - -servers-d2=這個服務器沒在營運。 -servers-3=S3 周 -servers-d3=這個服務器每週重設。 -servers-4=S4 月 -servers-d4=這個服務器每月重設。 -servers-5=S5 模組 -servers-d5=這個服務器運行模組,可在 Discord 中得到更多資訊。 -servers-6=S6 Donator -servers-d6=這個服務器為支持者運行,可在 Discord 中得到更多資訊。 -servers-7=S7 項目 -servers-d7=這個服務器只在有項目期間運行。 -servers-8=S8 T̷-̶s̶-̴:̷ -servers-d8=N̵o̴ ̶o̷-̶e̵ ̴k̸n̷-̶w̵s̸ ̴w̷h̷a̶-̶ ̷h̴a̴p̷p̴e̷n̷s̸ ̷o̶n̴ ̷t̶h̴-̶s̶ ̷s̷e̶r̸v̸e̴r̷,̶ ̸i̸t̴ ̷m̶-̸g̴h̶t̷ ̸n̸-̶t̵ ̷e̴v̸e̸n̶t̷ ̵-̷x̴i̵s̶t̸。̸ +servers-1=S1 +servers-d1=這個服務器每兩週重設。 +servers-2=S2 +servers-d2=這個服務器每兩週重設。 +servers-3=S3 +servers-d3=這個服務器每兩週重設。 +servers-4= +servers-d4= +servers-5=S5 會員 +servers-d5=這個服務器為會員運行,可在 Discord 中得到更多資訊。 +servers-6=S6 藍圖 +servers-d6=這個服務器為會員運行,可在 Discord 中得到更多資訊。 +servers-7= +servers-d7= +servers-8=S8 +servers-d8= servers-connect-Offline=該服務器目前沒有在運行 servers-connect-Current=你目前所在的伺服器 servers-connect-Version=該服務器運行不同的遊戲版本: __1__ @@ -353,4 +353,3 @@ research=研究 research-tooltip=啟用自動研究 spawn=傳送出生 spawn-tooltip=傳送到出生點 - diff --git a/exp_legacy/module/locale/zh-TW/addons.cfg b/exp_legacy/module/locale/zh-TW/addons.cfg index 04517f0b..47c623ad 100644 --- a/exp_legacy/module/locale/zh-TW/addons.cfg +++ b/exp_legacy/module/locale/zh-TW/addons.cfg @@ -7,20 +7,20 @@ player-health=__1__ player-damage=__1__ [links] -discord=https://discord.explosivegaming.nl -website=https://www.explosivegaming.nl -status=https://status.explosivegaming.nl -github=https://github.com/explosivegaming/scenario -patreon=https://www.patreon.com/ExpGaming +discord= +website= +status= +github= +patreon= [info] players-online=現在有 __1__ 人在線 total-map-time=地圖時間為 __1__ -discord=加入社群: https://discord.explosivegaming.nl -website=訪問網站: https://www.explosivegaming.nl -status=伺服器狀態: https://status.explosivegaming.nl -github=增加功能或回報錯誤: https://github.com/explosivegaming/scenario -patreon=支持我們: https://www.patreon.com/ExpGaming +discord= +website= +status= +github= +patreon= custom-commands=這裹使用了自制指令,如 /tag 和 /me。可使用 /chelp 查看更多。 read-readme=確保你已閱讀相關資訊。按左上 i 圖標可再次查看。 softmod=這裹用了自設情境,是一種軟裝模組。 @@ -43,7 +43,7 @@ reply=[Chat Bot] __1__ disallow=你沒有權限使用這個指令。 players-online=現在有 __1__ 人上線。 players=本地圖現在有 __1__ 人曾上線。 -not-real-dev=Cooldude2606 只是本場境的開發者 +not-real-dev= softmod=這裹用了自設情境。 blame=責怪 __1__ 吧。 afk=看看 __1__, 他已掛機 __2__ 。 diff --git a/exp_legacy/module/locale/zh-TW/data.cfg b/exp_legacy/module/locale/zh-TW/data.cfg index 76b58651..633aa430 100644 --- a/exp_legacy/module/locale/zh-TW/data.cfg +++ b/exp_legacy/module/locale/zh-TW/data.cfg @@ -2,10 +2,10 @@ description-add=設定 / 取得你的加入信息。 description-remove=移除你的加入信息。 arg-message=你的加入信息。 -greet=[color=0,1,0] 歡迎來到 EXP 的服務器! 若果你喜歡本服務器可加入 DISCORD: __1__ [/color] +greet=[color=0,1,0] 歡迎來到 APERX 的服務器! __1__[/color] message-set=你的加入信息已更新。 message-get=你的加入信息為: __1__ -message-cleared=你的加入信息已清除。 +message-cleared=的加入信息已清除。 [quickbar] saved=你的工具列已儲存。 diff --git a/exp_legacy/module/locale/zh-TW/gui.cfg b/exp_legacy/module/locale/zh-TW/gui.cfg index 65e60a84..1acf3709 100644 --- a/exp_legacy/module/locale/zh-TW/gui.cfg +++ b/exp_legacy/module/locale/zh-TW/gui.cfg @@ -133,8 +133,8 @@ goto-edit=修改傳送陣圖案 [readme] main-tooltip=資訊 welcome-tab=歡迎 -welcome-tooltip=歡迎來到 Explosive Gaming -welcome-general=歡迎來到 Explosive Gaming; 你在這裏的時候要遵守規則。 你可以在左上方的介面找到更多資訊。 地圖時間 __2__。\n下次地圖重設: __1__ +welcome-tooltip=歡迎來到 APERX +welcome-general=歡迎來到 APERX; 你在這裏的時候要遵守規則。 你可以在左上方的介面找到更多資訊。 地圖時間 __2__。\n下次地圖重設: __1__ welcome-roles=我們有自訂的身份組來保護其他用戶。 所以你有機會不能使用拆除規劃器或掉東西。 身份組給予你各種權限\n你有以下身份組: __1__ welcome-chat=你可以使用 「重音符/抑音符」 鍵 (ESC 鍵 下方) - 你也可以在選項中修改按鍵。\n你目前設定為 「__CONTROL__toggle-console__」 rules-tab=規則 @@ -162,22 +162,22 @@ servers-tab=伺服器 servers-tooltip=到其他伺服器及網站的連結 servers-general=這是其中一個伺服器。你可以在下方找到其他同樣是由我們運行的伺服器資料。 servers-factorio=異星工廠伺服器 -servers-1=S1 公共 -servers-d1=這個服務器每兩日重設。 -servers-2=S2 - -servers-d2=這個服務器沒在營運。 -servers-3=S3 周 -servers-d3=這個服務器每週重設。 -servers-4=S4 月 -servers-d4=這個服務器每月重設。 -servers-5=S5 模組 -servers-d5=這個服務器運行模組,可在 Discord 中得到更多資訊。 -servers-6=S6 Donator -servers-d6=這個服務器為支持者運行,可在 Discord 中得到更多資訊。 -servers-7=S7 項目 -servers-d7=這個服務器只在有項目期間運行。 -servers-8=S8 T̷-̶s̶-̴:̷ -servers-d8=N̵o̴ ̶o̷-̶e̵ ̴k̸n̷-̶w̵s̸ ̴w̷h̷a̶-̶ ̷h̴a̴p̷p̴e̷n̷s̸ ̷o̶n̴ ̷t̶h̴-̶s̶ ̷s̷e̶r̸v̸e̴r̷,̶ ̸i̸t̴ ̷m̶-̸g̴h̶t̷ ̸n̸-̶t̵ ̷e̴v̸e̸n̶t̷ ̵-̷x̴i̵s̶t̸。̸ +servers-1=S1 +servers-d1=這個服務器每兩週重設。 +servers-2=S2 +servers-d2=這個服務器每兩週重設。 +servers-3=S3 +servers-d3=這個服務器每兩週重設。 +servers-4= +servers-d4= +servers-5=S5 會員 +servers-d5=這個服務器為會員運行,可在 Discord 中得到更多資訊。 +servers-6=S6 藍圖 +servers-d6=這個服務器為會員運行,可在 Discord 中得到更多資訊。 +servers-7= +servers-d7= +servers-8=S8 +servers-d8= servers-connect-Offline=該服務器目前沒有在運行 servers-connect-Current=你目前所在的伺服器 servers-connect-Version=該服務器運行不同的遊戲版本: __1__ diff --git a/exp_legacy/module/modules/addons/compilatron.lua b/exp_legacy/module/modules/addons/compilatron.lua index 706b8c92..aea060d1 100644 --- a/exp_legacy/module/modules/addons/compilatron.lua +++ b/exp_legacy/module/modules/addons/compilatron.lua @@ -94,8 +94,8 @@ end -- @tparam string location the location tag that is in the config file function Public.spawn_compilatron(surface, location) local position = locations[location] - local pos = surface.find_non_colliding_position("small-biter", position, 1.5, 0.5) - local compi = surface.create_entity{ name = "small-biter", position = pos, force = game.forces.neutral } + local pos = surface.find_non_colliding_position("behemoth-biter", position, 1.5, 0.5) + local compi = surface.create_entity{ name = "behemoth-biter", position = pos, force = game.forces.neutral } Public.add_compilatron(compi, location) end diff --git a/exp_legacy/module/modules/control/vlayer.lua b/exp_legacy/module/modules/control/vlayer.lua index 6533a17b..ccd157ca 100644 --- a/exp_legacy/module/modules/control/vlayer.lua +++ b/exp_legacy/module/modules/control/vlayer.lua @@ -22,6 +22,7 @@ local vlayer_data = { properties = { total_surface_area = 0, used_surface_area = 0, + total_production = 0, production = 0, discharge = 0, capacity = 0, @@ -155,7 +156,7 @@ local function get_production_multiplier() end if surface.darkness then - -- We are using a real surface, our config does not contain 'darkness' + -- We are using a real surface, our config does not contain "darkness" local brightness = 1 - surface.darkness if brightness >= surface.min_brightness then @@ -212,7 +213,9 @@ function vlayer.allocate_item(item_name, count) assert(item_properties, "Item not allowed in vlayer: " .. tostring(item_name)) if item_properties.production then - vlayer_data.properties.production = vlayer_data.properties.production + item_properties.production * count + local nc = item_properties.production * count + vlayer_data.properties.production = vlayer_data.properties.production + nc + vlayer_data.properties.total_production = vlayer_data.properties.total_production + nc end if item_properties.capacity then @@ -232,6 +235,14 @@ function vlayer.allocate_item(item_name, count) end end +function vlayer.unable_alloc_item_pwr_calc(item_name, count) + local item_properties = config.allowed_items[item_name] + + if item_properties.production then + vlayer_data.properties.total_production = vlayer_data.properties.total_production + item_properties.production * count + end +end + -- For all allowed items, setup their starting values, default 0 for item_name, properties in pairs(config.allowed_items) do vlayer_data.storage.items[item_name] = properties.starting_value or 0 @@ -260,7 +271,9 @@ function vlayer.insert_item(item_name, count) vlayer.allocate_item(item_name, allocate_count) end + local nc = count - allocate_count vlayer_data.storage.unallocated[item_name] = vlayer_data.storage.unallocated[item_name] + count - allocate_count + vlayer.unable_alloc_item_pwr_calc(item_name, nc) else vlayer.allocate_item(item_name, count) end @@ -456,6 +469,7 @@ local function handle_unallocated() if allocation_count > 0 then vlayer_data.storage.unallocated[item_name] = vlayer_data.storage.unallocated[item_name] - allocation_count vlayer.allocate_item(item_name, allocation_count) + vlayer.unable_alloc_item_pwr_calc(item_name, -allocation_count) end end end @@ -464,15 +478,19 @@ end function vlayer.get_statistics() local vdp = vlayer_data.properties.production * mega local gdm = get_production_multiplier() + local gsm = get_sustained_multiplier() + local gald = get_actual_land_defecit() return { total_surface_area = vlayer_data.properties.total_surface_area, used_surface_area = vlayer_data.properties.used_surface_area, - remaining_surface_area = get_actual_land_defecit(), + remaining_surface_area = gald, + surface_area = vlayer_data.properties.total_surface_area - gald, production_multiplier = gdm, energy_max = vdp, energy_production = vdp * gdm, - energy_sustained = vdp * get_sustained_multiplier(), + energy_total_production = vlayer_data.properties.total_production * gsm * mega, + energy_sustained = vdp * gsm, energy_capacity = vlayer_data.properties.capacity * mega, energy_storage = vlayer_data.storage.energy, day_time = math.floor(vlayer_data.surface.daytime * vlayer_data.surface.ticks_per_day), diff --git a/exp_legacy/module/modules/gui/vlayer.lua b/exp_legacy/module/modules/gui/vlayer.lua index 6389947a..2dc8ed3d 100644 --- a/exp_legacy/module/modules/gui/vlayer.lua +++ b/exp_legacy/module/modules/gui/vlayer.lua @@ -177,9 +177,9 @@ local vlayer_gui_display_item_accumulator_count = font = "heading-2", } ---- Display label for the remaining surface area --- @element vlayer_gui_display_signal_remaining_surface_area_name -local vlayer_gui_display_signal_remaining_surface_area_name = +--- Display label for the surface area +-- @element vlayer_gui_display_signal_surface_area_name +local vlayer_gui_display_signal_surface_area_name = Gui.element{ type = "label", name = "vlayer_display_signal_remaining_surface_area_name", @@ -190,16 +190,16 @@ local vlayer_gui_display_signal_remaining_surface_area_name = width = 200, } -local vlayer_gui_display_signal_remaining_surface_area_count = +local vlayer_gui_display_signal_surface_area_count = Gui.element{ - type = "label", - name = "vlayer_display_signal_remaining_surface_area_count", - caption = "0", - style = "heading_2_label", + type = "progressbar", + name = "vlayer_display_signal_surface_area_count", + caption = "", + value = 0, + style = "electric_satisfaction_statistics_progressbar", }:style{ width = 200, - height = 28, - horizontal_align = "right", + font = "heading-2", } --- Display label for the sustained energy production @@ -217,14 +217,14 @@ local vlayer_gui_display_signal_sustained_name = local vlayer_gui_display_signal_sustained_count = Gui.element{ - type = "label", + type = "progressbar", name = "vlayer_display_signal_sustained_count", - caption = "0", - style = "heading_2_label", + caption = "", + value = 0, + style = "electric_satisfaction_statistics_progressbar", }:style{ width = 200, - height = 28, - horizontal_align = "right", + font = "heading-2", } --- Display label for the current energy production @@ -288,8 +288,8 @@ local vlayer_display_set = vlayer_gui_display_item_solar_count(disp) vlayer_gui_display_item_accumulator_name(disp) vlayer_gui_display_item_accumulator_count(disp) - vlayer_gui_display_signal_remaining_surface_area_name(disp) - vlayer_gui_display_signal_remaining_surface_area_count(disp) + vlayer_gui_display_signal_surface_area_name(disp) + vlayer_gui_display_signal_surface_area_count(disp) vlayer_gui_display_signal_sustained_name(disp) vlayer_gui_display_signal_sustained_count(disp) vlayer_gui_display_signal_production_name(disp) @@ -493,11 +493,13 @@ Event.on_nth_tick(config.update_tick_gui, function(_) val = (items_alloc["accumulator"] / math.max(items["accumulator"], 1)), cap = format_number(items_alloc["accumulator"], false) .. " / " .. format_number(items["accumulator"], false), }, - [vlayer_gui_display_signal_remaining_surface_area_count.name] = { - cap = format_number(stats.remaining_surface_area, false), + [vlayer_gui_display_signal_surface_area_count.name] = { + val = (stats.total_surface_area / math.max(stats.surface_area, 1)), + cap = format_number(stats.remaining_surface_area) }, [vlayer_gui_display_signal_sustained_count.name] = { - cap = format_energy(stats.energy_sustained, "W"), + val = (stats.energy_sustained / math.max(stats.energy_total_production, 1)), + cap = format_energy(stats.energy_sustained, "W") .. " / " .. format_energy(stats.energy_total_production, "W") }, [vlayer_gui_display_signal_production_count.name] = { val = (stats.energy_production / math.max(stats.energy_max, 1)), From 87dbf0db57b6db8fd9ab489ff6c483b255f1aece Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Sun, 29 Dec 2024 14:06:16 +0900 Subject: [PATCH 002/406] . --- exp_legacy/module/locale/zh-CN/data.cfg | 2 +- exp_legacy/module/locale/zh-TW/data.cfg | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/exp_legacy/module/locale/zh-CN/data.cfg b/exp_legacy/module/locale/zh-CN/data.cfg index 633aa430..495f3f2d 100644 --- a/exp_legacy/module/locale/zh-CN/data.cfg +++ b/exp_legacy/module/locale/zh-CN/data.cfg @@ -5,7 +5,7 @@ arg-message=你的加入信息。 greet=[color=0,1,0] 歡迎來到 APERX 的服務器! __1__[/color] message-set=你的加入信息已更新。 message-get=你的加入信息為: __1__ -message-cleared=的加入信息已清除。 +message-cleared=你的加入信息已清除。 [quickbar] saved=你的工具列已儲存。 diff --git a/exp_legacy/module/locale/zh-TW/data.cfg b/exp_legacy/module/locale/zh-TW/data.cfg index 633aa430..495f3f2d 100644 --- a/exp_legacy/module/locale/zh-TW/data.cfg +++ b/exp_legacy/module/locale/zh-TW/data.cfg @@ -5,7 +5,7 @@ arg-message=你的加入信息。 greet=[color=0,1,0] 歡迎來到 APERX 的服務器! __1__[/color] message-set=你的加入信息已更新。 message-get=你的加入信息為: __1__ -message-cleared=的加入信息已清除。 +message-cleared=你的加入信息已清除。 [quickbar] saved=你的工具列已儲存。 From 0a4b392cf336b085870f130f3a1e371d7a0a1842 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Sun, 29 Dec 2024 14:09:39 +0900 Subject: [PATCH 003/406] . --- README.md | 34 +++++++++++++--------------------- 1 file changed, 13 insertions(+), 21 deletions(-) diff --git a/README.md b/README.md index 85dad859..83c95cb1 100644 --- a/README.md +++ b/README.md @@ -1,20 +1,17 @@

logo
-
- Release + + Release - - Downloads + + Downloads - - Star + + Star - - Fork - - - CodeFactor + + Fork Discord @@ -28,9 +25,9 @@ Explosive Gaming (often ExpGaming) is a server hosting community with a strong f ## Installation -This is a plugin collection for [Clusterio](https://github.com/clusterio/clusterio) which provides all our scenario features. +This is a plugin collection for [Clusterio](https://github.com/clusterio/clusterio) which implements all our scenario features. -To use this plugin you must already have a clusterio instance running, see [here](https://github.com/clusterio/clusterio?tab=readme-ov-file#installation) for clusterio installation instructions. +To use this plugin you must have a clusterio instance running, see [here](https://github.com/clusterio/clusterio?tab=readme-ov-file#installation) for clusterio installation instructions. This module is currently not published and therefore can not be installed via `npm`. Instead follow the steps for [building from source](#building-from-source) @@ -38,8 +35,8 @@ This module is currently not published and therefore can not be installed via `n 1) Create a `external_plugins` directory within your clusterio instance. 2) Clone this repository into that directory: `git clone https://github.com/explosivegaming/ExpCluster` -3) Install the package dev dependencies: `pnpm install` -4) Add the plugins to your clusterio instance such as: `npx clusteriocontroller plugin add ./external_plugins/ExpCluster/exp_groups` +3) Install the package dev dependencies: `pnpm install` (`pnpm` is recommended over `npm`) +4) Add supported plugins will be loaded on next controller / host restart. ## Contributing @@ -71,7 +68,7 @@ See [Contributing](CONTRIBUTING.md) for how to make pull requests and issues. | [1.0][s1.0] | Modulation | [0.15][f0.15] | | [0.1][s0.1] | First Tracked Version | [0.14][f0.14] | -\* Scenario patch releases have been omitted and can be found [here][releases]. +\* Scenario patch releases have been omitted and can be found [here](https://github.com/explosivegaming/scenario/releases). \*\* Factorio versions show the version they were made for, often the minimum requirement to run the scenario. @@ -122,11 +119,6 @@ See [Contributing](CONTRIBUTING.md) for how to make pull requests and issues. The Explosive Gaming codebase is licensed under the [MIT](LICENSE) -[stable-dl]: https://github.com/explosivegaming/scenario/archive/master.zip -[experimental-dl]: https://github.com/explosivegaming/scenario/archive/dev.zip -[releases]: https://github.com/explosivegaming/scenario/releases [factorio]: https://factorio.com -[docs]: https://explosivegaming.github.io/scenario -[issues]: https://github.com/explosivegaming/scenario/issues/new/choose [website]: https://explosivegaming.nl [discord]: https://discord.explosivegaming.nl From e9f82db1548c256c86c3bda9a7e036c7bce75cb9 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Sun, 29 Dec 2024 14:10:55 +0900 Subject: [PATCH 004/406] . --- exp_legacy/module/config/bonus.lua | 106 ++++++++++++++--------------- 1 file changed, 53 insertions(+), 53 deletions(-) diff --git a/exp_legacy/module/config/bonus.lua b/exp_legacy/module/config/bonus.lua index 78a0881d..f01b5ac7 100644 --- a/exp_legacy/module/config/bonus.lua +++ b/exp_legacy/module/config/bonus.lua @@ -18,16 +18,16 @@ return { ]] pts = { rate = { - ['Senior Administrator'] = 1.5, - ['Administrator'] = 1.4, - ['Senior Moderator'] = 1.3, - ['Moderator'] = 1.2, - ['Trainee Moderator'] = 1.2, - ['Board Member'] = 1.1, - ['Supporter'] = 1.1, - ['Partner'] = 1.1, - ['Senior Member'] = 1.1, - ['Member'] = 1 + ["Senior Administrator"] = 1.5, + ["Administrator"] = 1.4, + ["Senior Moderator"] = 1.3, + ["Moderator"] = 1.2, + ["Trainee Moderator"] = 1.2, + ["Board Member"] = 1.1, + ["Supporter"] = 1.1, + ["Partner"] = 1.1, + ["Senior Member"] = 1.1, + ["Member"] = 1 }, base = 172 }, @@ -38,19 +38,19 @@ return { count = 50 }, conversion = { - ['cmms'] = 'character_mining_speed_modifier', - ['crs'] = 'character_running_speed_modifier', - ['ccs'] = 'character_crafting_speed_modifier', - ['cisb'] = 'character_inventory_slots_bonus', - ['chb'] = 'character_health_bonus', - ['crdb'] = 'character_reach_distance_bonus', + ["cmms"] = "character_mining_speed_modifier", + ["crs"] = "character_running_speed_modifier", + ["ccs"] = "character_crafting_speed_modifier", + ["cisb"] = "character_inventory_slots_bonus", + ["chb"] = "character_health_bonus", + ["crdb"] = "character_reach_distance_bonus", --[[ - ['cpdb'] = 'character_item_pickup_distance_bonus' + ["cpdb"] = "character_item_pickup_distance_bonus" ]] }, player_special_bonus_rate = 300, player_special_bonus = { - ['personal_battery_recharge'] = { + ["personal_battery_recharge"] = { -- 1 MW value = 4, max = 8, @@ -61,7 +61,7 @@ return { } }, player_bonus = { - ['character_mining_speed_modifier'] = { + ["character_mining_speed_modifier"] = { value = 2, max = 4, scale = 0.5, @@ -69,7 +69,7 @@ return { cost = 10, is_percentage = true }, - ['character_running_speed_modifier'] = { + ["character_running_speed_modifier"] = { value = 1, max = 2, scale = 0.25, @@ -77,7 +77,7 @@ return { cost = 60, is_percentage = true }, - ['character_crafting_speed_modifier'] = { + ["character_crafting_speed_modifier"] = { value = 6, max = 12, scale = 0.5, @@ -85,7 +85,7 @@ return { cost = 4, is_percentage = true }, - ['character_inventory_slots_bonus'] = { + ["character_inventory_slots_bonus"] = { value = 60, max = 120, scale = 5, @@ -93,7 +93,7 @@ return { cost = 2, is_percentage = false }, - ['character_health_bonus'] = { + ["character_health_bonus"] = { value = 100, max = 200, scale = 25, @@ -101,7 +101,7 @@ return { cost = 2, is_percentage = false }, - ['character_reach_distance_bonus'] = { + ["character_reach_distance_bonus"] = { value = 8, max = 16, scale = 2, @@ -109,12 +109,12 @@ return { cost = 1, is_percentage = false, combined_bonus = { - 'character_resource_reach_distance_bonus', - 'character_build_distance_bonus' + "character_resource_reach_distance_bonus", + "character_build_distance_bonus" } }, --[[ - ['character_item_pickup_distance_bonus'] = { + ["character_item_pickup_distance_bonus"] = { value = 0, max = 20, scale = 1, @@ -122,7 +122,7 @@ return { cost = 1, is_percentage = false }, - ['character_loot_pickup_distance_bonus'] = { + ["character_loot_pickup_distance_bonus"] = { value = 0, max = 20, scale = 1, @@ -130,7 +130,7 @@ return { cost = 1, is_percentage = false }, - ['character_item_drop_distance_bonus'] = { + ["character_item_drop_distance_bonus"] = { value = 0, max = 20, scale = 1, @@ -142,7 +142,7 @@ return { }, force_bonus = { --[[ - ['character_mining_speed_modifier'] = { + ["character_mining_speed_modifier"] = { value = 0, max = 6, scale = 0.5, @@ -150,7 +150,7 @@ return { cost = 10, is_percentage = true }, - ['character_running_speed_modifier'] = { + ["character_running_speed_modifier"] = { value = 0, max = 3, scale = 0.25, @@ -158,7 +158,7 @@ return { cost = 40, is_percentage = true }, - ['character_crafting_speed_modifier'] = { + ["character_crafting_speed_modifier"] = { value = 0, max = 16, scale = 1, @@ -166,7 +166,7 @@ return { cost = 4, is_percentage = true }, - ['character_inventory_slots_bonus'] = { + ["character_inventory_slots_bonus"] = { value = 0, max = 200, scale = 10, @@ -174,14 +174,14 @@ return { cost = 2, is_percentage = false }, - ['character_health_bonus'] = { + ["character_health_bonus"] = { value = 0, max = 400, scale = 50, cost = 4, is_percentage = false }, - ['character_reach_distance_bonus'] = { + ["character_reach_distance_bonus"] = { value = 0, max = 24, scale = 2, @@ -189,11 +189,11 @@ return { cost = 1, is_percentage = false, combined_bonus = { - 'character_resource_reach_distance_bonus', - 'character_build_distance_bonus' + "character_resource_reach_distance_bonus", + "character_build_distance_bonus" } }, - ['worker_robots_speed_modifier'] = { + ["worker_robots_speed_modifier"] = { value = 0, max = 0, scale = 0, @@ -202,7 +202,7 @@ return { is_percentage = false }, ]] - ['worker_robots_battery_modifier'] = { + ["worker_robots_battery_modifier"] = { value = 1, max = 1, scale = 1, @@ -210,7 +210,7 @@ return { cost = 1, is_percentage = false }, - ['worker_robots_storage_bonus'] = { + ["worker_robots_storage_bonus"] = { value = 1, max = 1, scale = 1, @@ -218,7 +218,7 @@ return { cost = 1, is_percentage = false }, - ['following_robots_lifetime_modifier'] = { + ["following_robots_lifetime_modifier"] = { value = 1, max = 1, scale = 1, @@ -227,7 +227,7 @@ return { is_percentage = false }, --[[ - ['character_item_pickup_distance_bonus'] = { + ["character_item_pickup_distance_bonus"] = { value = 0, max = 20, scale = 1, @@ -235,7 +235,7 @@ return { cost = 1, is_percentage = false }, - ['character_loot_pickup_distance_bonus'] = { + ["character_loot_pickup_distance_bonus"] = { value = 0, max = 20, scale = 1, @@ -243,7 +243,7 @@ return { cost = 1, is_percentage = false }, - ['character_item_drop_distance_bonus'] = { + ["character_item_drop_distance_bonus"] = { value = 0, max = 20, scale = 1, @@ -251,7 +251,7 @@ return { cost = 1, is_percentage = false }, - ['character_trash_slot_count'] = { + ["character_trash_slot_count"] = { value = 0, max = 0, scale = 0, @@ -259,7 +259,7 @@ return { cost = 1, is_percentage = false }, - ['mining_drill_productivity_bonus'] = { + ["mining_drill_productivity_bonus"] = { value = 0, max = 0, scale = 0, @@ -267,7 +267,7 @@ return { cost = 1, is_percentage = false }, - ['train_braking_force_bonus'] = { + ["train_braking_force_bonus"] = { value = 0, max = 0, scale = 0, @@ -275,7 +275,7 @@ return { cost = 1, is_percentage = false }, - ['laboratory_speed_modifier'] = { + ["laboratory_speed_modifier"] = { value = 0, max = 0, scale = 0, @@ -283,7 +283,7 @@ return { cost = 1, is_percentage = false }, - ['laboratory_productivity_bonus'] = { + ["laboratory_productivity_bonus"] = { value = 0, max = 0, scale = 0, @@ -291,7 +291,7 @@ return { cost = 1, is_percentage = false }, - ['inserter_stack_size_bonus'] = { + ["inserter_stack_size_bonus"] = { value = 0, max = 0, scale = 0, @@ -299,7 +299,7 @@ return { cost = 1, is_percentage = false }, - ['stack_inserter_capacity_bonus'] = { + ["stack_inserter_capacity_bonus"] = { value = 0, max = 0, scale = 0, @@ -307,7 +307,7 @@ return { cost = 1, is_percentage = false }, - ['artillery_range_modifier'] = { + ["artillery_range_modifier"] = { value = 0, max = 0, scale = 0, @@ -319,7 +319,7 @@ return { }, surface_bonus = { --[[ - ['solar_power_multiplier'] = { + ["solar_power_multiplier"] = { value = 1, max = 1000, scale = 1, From b32e854398462c772e9b5a6c93941b4b04671aa7 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Sun, 29 Dec 2024 14:12:50 +0900 Subject: [PATCH 005/406] . --- exp_legacy/module/config/advanced_start.lua | 54 ++++++++++----------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/exp_legacy/module/config/advanced_start.lua b/exp_legacy/module/config/advanced_start.lua index cbbfe84a..539fa4f3 100644 --- a/exp_legacy/module/config/advanced_start.lua +++ b/exp_legacy/module/config/advanced_start.lua @@ -4,7 +4,7 @@ --- These are called factories because they return another function -- use these as a simple methods of adding new items -- they will do most of the work for you --- ['item-name'] = factory(params) +-- ["item-name"] = factory(params) -- luacheck:ignore 212/amount_made 212/items_made 212/player -- Use these to adjust for ticks ie game.tick < 5*minutes @@ -12,7 +12,7 @@ local seconds, minutes, hours = 60, 3600, 216000 --- Use to make a split point for the number of items given based on time --- ['stone-furnace']=cutoff_time(5*minutes, 4,0) -- before 5 minutes give four items after 5 minutes give none +-- ["stone-furnace"]=cutoff_time(5*minutes, 4,0) -- before 5 minutes give four items after 5 minutes give none local function cutoff_time(time, before, after) return function(amount_made, items_made, player) if game.tick < time then @@ -24,7 +24,7 @@ local function cutoff_time(time, before, after) end --- Use to make a split point for the number of items given based on amount made --- ['firearm-magazine']=cutoff_amount_made(100, 10, 0) -- give 10 items until 100 items have been made +-- ["firearm-magazine"]=cutoff_amount_made(100, 10, 0) -- give 10 items until 100 items have been made --[[ local function cutoff_amount_made(amount, before, after) return function(amount_made, items_made, player) @@ -38,7 +38,7 @@ end ]] --- Same as above but will not give any items if x amount has been made of another item, useful for tiers --- ['light-armor']=cutoff_amount_made_unless(5, 0,1,'heavy-armor',5) -- give light armor once 5 have been made unless 5 heavy armor has been made +-- ["light-armor"]=cutoff_amount_made_unless(5, 0,1,"heavy-armor",5) -- give light armor once 5 have been made unless 5 heavy armor has been made --[[ local function cutoff_amount_made_unless(amount, before, after, second_item, second_amount) return function(amount_made, items_made, player) @@ -56,7 +56,7 @@ end ]] -- Use for mass production items where you want the amount to change based on the amount already made --- ['iron-plate']=scale_amount_made(5*minutes, 10, 10) -- for first 5 minutes give 10 items then after apply a factor of 10 +-- ["iron-plate"]=scale_amount_made(5*minutes, 10, 10) -- for first 5 minutes give 10 items then after apply a factor of 10 --[[ local function scale_amount_made(amount, before, scalar) return function(amount_made, items_made, player) @@ -73,7 +73,7 @@ end Common values game.tick is the amount of time the game has been on for amount_made is the amount of that item which has been made - items_made('item-name') will return the amount of any item made + items_made("item-name") will return the amount of any item made player is the player who just spawned hours, minutes, seconds are the number of ticks in each unit of time ]] @@ -85,28 +85,28 @@ return { enemy_expansion = false, --- @setting enemy_expansion a catch all for in case the map settings file fails to load chart_radius = 10 * 32, --- @setting chart_radius the number of tiles that will be charted when the map starts items = { --- @setting items items and there condition for being given - ['iron-ore']=cutoff_time(20 * minutes, 80, 0), - ['stone']=cutoff_time(20 * minutes, 20, 0), - ['coal']=cutoff_time(20 * minutes, 20, 0), - -- ['burner-mining-drill']=cutoff_time(20 * minutes, 8, 0), - -- ['stone-furnace']=cutoff_time(20 * minutes, 8, 0), - ['submachine-gun'] = 1, - ['piercing-rounds-magazine'] = 20, - ['construction-robot'] = 10, - ['modular-armor'] = 1, - ['solar-panel-equipment'] = 16, - ['belt-immunity-equipment'] = 1, - ['battery-equipment'] = 2, - ['personal-roboport-equipment'] = 1 + ["iron-ore"] = cutoff_time(20 * minutes, 80, 0), + ["stone"] = cutoff_time(20 * minutes, 20, 0), + ["coal"] = cutoff_time(20 * minutes, 20, 0), + -- ["burner-mining-drill"]=cutoff_time(20 * minutes, 8, 0), + -- ["stone-furnace"]=cutoff_time(20 * minutes, 8, 0), + ["submachine-gun"] = 1, + ["piercing-rounds-magazine"] = 20, + ["construction-robot"] = 10, + ["modular-armor"] = 1, + ["solar-panel-equipment"] = 16, + ["belt-immunity-equipment"] = 1, + ["battery-equipment"] = 2, + ["personal-roboport-equipment"] = 1 --[[ - ['construction-robot'] = 50, - ['spidertron'] = 1, - ['spidertron-remote'] = 1, - ['modular-armor'] = 1, - ['solar-panel-equipment'] = 60, - ['belt-immunity-equipment'] = 1, - ['battery-equipment'] = 6, - ['personal-roboport-equipment'] = 5 + ["construction-robot"] = 50, + ["spidertron"] = 1, + ["spidertron-remote"] = 1, + ["modular-armor"] = 1, + ["solar-panel-equipment"] = 60, + ["belt-immunity-equipment"] = 1, + ["battery-equipment"] = 6, + ["personal-roboport-equipment"] = 5 ]] } } From d88def830f55011a4e8bfcc70d295709e2a76f7b Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Sun, 29 Dec 2024 14:16:50 +0900 Subject: [PATCH 006/406] . --- exp_legacy/module/config/bonus.lua | 78 +++++++++++++++--------------- 1 file changed, 39 insertions(+), 39 deletions(-) diff --git a/exp_legacy/module/config/bonus.lua b/exp_legacy/module/config/bonus.lua index f01b5ac7..a7d665a5 100644 --- a/exp_legacy/module/config/bonus.lua +++ b/exp_legacy/module/config/bonus.lua @@ -27,7 +27,7 @@ return { ["Supporter"] = 1.1, ["Partner"] = 1.1, ["Senior Member"] = 1.1, - ["Member"] = 1 + ["Member"] = 1, }, base = 172 }, @@ -35,7 +35,7 @@ return { half = 150, label = 70, slider = 180, - count = 50 + count = 50, }, conversion = { ["cmms"] = "character_mining_speed_modifier", @@ -57,7 +57,7 @@ return { scale = 0.5, cost_scale = 1, cost = 10, - is_percentage = false + is_percentage = false, } }, player_bonus = { @@ -67,7 +67,7 @@ return { scale = 0.5, cost_scale = 1, cost = 10, - is_percentage = true + is_percentage = true, }, ["character_running_speed_modifier"] = { value = 1, @@ -75,7 +75,7 @@ return { scale = 0.25, cost_scale = 1, cost = 60, - is_percentage = true + is_percentage = true, }, ["character_crafting_speed_modifier"] = { value = 6, @@ -83,7 +83,7 @@ return { scale = 0.5, cost_scale = 1, cost = 4, - is_percentage = true + is_percentage = true, }, ["character_inventory_slots_bonus"] = { value = 60, @@ -91,7 +91,7 @@ return { scale = 5, cost_scale = 10, cost = 2, - is_percentage = false + is_percentage = false, }, ["character_health_bonus"] = { value = 100, @@ -99,7 +99,7 @@ return { scale = 25, cost_scale = 25, cost = 2, - is_percentage = false + is_percentage = false, }, ["character_reach_distance_bonus"] = { value = 8, @@ -110,8 +110,8 @@ return { is_percentage = false, combined_bonus = { "character_resource_reach_distance_bonus", - "character_build_distance_bonus" - } + "character_build_distance_bonus", + }, }, --[[ ["character_item_pickup_distance_bonus"] = { @@ -120,7 +120,7 @@ return { scale = 1, cost_scale = 1, cost = 1, - is_percentage = false + is_percentage = false, }, ["character_loot_pickup_distance_bonus"] = { value = 0, @@ -128,7 +128,7 @@ return { scale = 1, cost_scale = 1, cost = 1, - is_percentage = false + is_percentage = false, }, ["character_item_drop_distance_bonus"] = { value = 0, @@ -136,8 +136,8 @@ return { scale = 1, cost_scale = 1, cost = 1, - is_percentage = false - } + is_percentage = false, + }, ]] }, force_bonus = { @@ -148,7 +148,7 @@ return { scale = 0.5, cost_scale = 1, cost = 10, - is_percentage = true + is_percentage = true, }, ["character_running_speed_modifier"] = { value = 0, @@ -156,7 +156,7 @@ return { scale = 0.25, cost_scale = 1, cost = 40, - is_percentage = true + is_percentage = true, }, ["character_crafting_speed_modifier"] = { value = 0, @@ -164,7 +164,7 @@ return { scale = 1, cost_scale = 1, cost = 4, - is_percentage = true + is_percentage = true, }, ["character_inventory_slots_bonus"] = { value = 0, @@ -172,14 +172,14 @@ return { scale = 10, cost_scale = 100, cost = 2, - is_percentage = false + is_percentage = false, }, ["character_health_bonus"] = { value = 0, max = 400, scale = 50, cost = 4, - is_percentage = false + is_percentage = false, }, ["character_reach_distance_bonus"] = { value = 0, @@ -190,8 +190,8 @@ return { is_percentage = false, combined_bonus = { "character_resource_reach_distance_bonus", - "character_build_distance_bonus" - } + "character_build_distance_bonus", + }, }, ["worker_robots_speed_modifier"] = { value = 0, @@ -199,7 +199,7 @@ return { scale = 0, cost_scale = 1, cost = 1, - is_percentage = false + is_percentage = false, }, ]] ["worker_robots_battery_modifier"] = { @@ -208,7 +208,7 @@ return { scale = 1, cost_scale = 1, cost = 1, - is_percentage = false + is_percentage = false, }, ["worker_robots_storage_bonus"] = { value = 1, @@ -216,7 +216,7 @@ return { scale = 1, cost_scale = 1, cost = 1, - is_percentage = false + is_percentage = false, }, ["following_robots_lifetime_modifier"] = { value = 1, @@ -224,7 +224,7 @@ return { scale = 1, cost_scale = 1, cost = 1, - is_percentage = false + is_percentage = false, }, --[[ ["character_item_pickup_distance_bonus"] = { @@ -233,7 +233,7 @@ return { scale = 1, cost_scale = 1, cost = 1, - is_percentage = false + is_percentage = false, }, ["character_loot_pickup_distance_bonus"] = { value = 0, @@ -241,7 +241,7 @@ return { scale = 1, cost_scale = 1, cost = 1, - is_percentage = false + is_percentage = false, }, ["character_item_drop_distance_bonus"] = { value = 0, @@ -249,7 +249,7 @@ return { scale = 1, cost_scale = 1, cost = 1, - is_percentage = false + is_percentage = false, }, ["character_trash_slot_count"] = { value = 0, @@ -257,7 +257,7 @@ return { scale = 0, cost_scale = 1, cost = 1, - is_percentage = false + is_percentage = false, }, ["mining_drill_productivity_bonus"] = { value = 0, @@ -265,7 +265,7 @@ return { scale = 0, cost_scale = 1, cost = 1, - is_percentage = false + is_percentage = false, }, ["train_braking_force_bonus"] = { value = 0, @@ -273,7 +273,7 @@ return { scale = 0, cost_scale = 1, cost = 1, - is_percentage = false + is_percentage = false, }, ["laboratory_speed_modifier"] = { value = 0, @@ -281,7 +281,7 @@ return { scale = 0, cost_scale = 1, cost = 1, - is_percentage = false + is_percentage = false, }, ["laboratory_productivity_bonus"] = { value = 0, @@ -289,7 +289,7 @@ return { scale = 0, cost_scale = 1, cost = 1, - is_percentage = false + is_percentage = false, }, ["inserter_stack_size_bonus"] = { value = 0, @@ -297,7 +297,7 @@ return { scale = 0, cost_scale = 1, cost = 1, - is_percentage = false + is_percentage = false, }, ["stack_inserter_capacity_bonus"] = { value = 0, @@ -305,7 +305,7 @@ return { scale = 0, cost_scale = 1, cost = 1, - is_percentage = false + is_percentage = false, }, ["artillery_range_modifier"] = { value = 0, @@ -313,8 +313,8 @@ return { scale = 0, cost_scale = 1, cost = 1, - is_percentage = false - } + is_percentage = false, + }, ]] }, surface_bonus = { @@ -325,8 +325,8 @@ return { scale = 1, cost_scale = 1, cost = 1, - is_percentage = false - } + is_percentage = false, + }, ]] } } From 47e900f7352751cbeb56299db9bcc5007161e260 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Sun, 29 Dec 2024 23:29:44 +0900 Subject: [PATCH 007/406] . --- exp_legacy/module/config/vlayer.lua | 66 ++++++++++++++--------------- 1 file changed, 33 insertions(+), 33 deletions(-) diff --git a/exp_legacy/module/config/vlayer.lua b/exp_legacy/module/config/vlayer.lua index 32bfc605..3f455ed0 100644 --- a/exp_legacy/module/config/vlayer.lua +++ b/exp_legacy/module/config/vlayer.lua @@ -20,90 +20,90 @@ return { dusk = 0.25, evening = 0.45, morning = 0.55, - dawn = 0.75 + dawn = 0.75, }, interface_limit = { --- @setting interface_limit Sets the limit for the number of vlayer interfaces that can be created energy = 1, -- >1 allows for disconnected power networks to receive power circuit = 20, -- No caveats storage_input = 30, -- No caveats - storage_output = 1 -- >0 allows for item teleportation (allowed_items only) + storage_output = 1, -- >0 allows for item teleportation (allowed_items only) }, allowed_items = { --- @setting allowed_items List of all items allowed in vlayer storage and their properties --[[ Allowed properties: - starting_value = 0: The amount of the item placed into the vlayer on game start, ignores area requirements - required_area = 0: When greater than 0 the items properties are not applied unless their is sufficient surplus surface area - production = 0: The energy production of the item in MW, used for solar panels - discharge = 0: The energy discharge of the item in MW, used for accumulators - capacity = 0: The energy capacity of the item in MJ, used for accumulators - surface_area = 0: The surface area provided by the item, used for landfill + starting_value : The amount of the item placed into the vlayer on game start, ignores area requirements + required_area : When greater than 0 the items properties are not applied unless their is sufficient surplus surface area + production : The energy production of the item in MW, used for solar panels + discharge : The energy discharge of the item in MW, used for accumulators + capacity : The energy capacity of the item in MJ, used for accumulators + surface_area : The surface area provided by the item, used for landfill ]] ["solar-panel"] = { starting_value = 0, required_area = 9, - production = 0.06 -- MW + production = 0.06, -- MW }, ["accumulator"] = { starting_value = 0, required_area = 4, discharge = 0.3, -- MW - capacity = 5 -- MJ + capacity = 5, -- MJ }, ["landfill"] = { starting_value = 0, required_area = 0, - surface_area = 8 -- Tiles + surface_area = 8, -- Tiles }, ["wood"] = { starting_value = 0, required_area = 0, surface_area = 0, fuel_value = 2, -- MJ - power = true -- turn all wood to power to reduce trash + power = true, -- turn all wood to power to reduce trash }, ["coal"] = { starting_value = 0, required_area = 0, surface_area = 0, fuel_value = 4, -- MJ - power = true -- turn all coal to power to reduce trash + power = true, -- turn all coal to power to reduce trash }, ["solid-fuel"] = { starting_value = 0, required_area = 0, surface_area = 0, fuel_value = 12, -- MJ - power = true -- turn all solid fuel to power to reduce trash + power = true, -- turn all solid fuel to power to reduce trash }, ["rocket-fuel"] = { starting_value = 0, required_area = 0, surface_area = 0, fuel_value = 100, -- MJ - power = true -- turn all rocket fuel to power to reduce trash + power = true, -- turn all rocket fuel to power to reduce trash } --[[ ["iron-ore"] = { starting_value = 0, required_area = 0, - surface_area = 0 + surface_area = 0, }, ["copper-ore"] = { starting_value = 0, required_area = 0, - surface_area = 0 + surface_area = 0, }, ["stone"] = { starting_value = 0, required_area = 0, - surface_area = 0 + surface_area = 0, }, ["uranium-ore"] = { starting_value = 0, required_area = 0, - surface_area = 0 + surface_area = 0, }, ]] }, @@ -112,72 +112,72 @@ return { ["solar-panel-2"] = { starting_value = 0, base_game_equivalent = "solar-panel", - multiplier = 4 + multiplier = 4, }, ["solar-panel-3"] = { starting_value = 0, base_game_equivalent = "solar-panel", - multiplier = 16 + multiplier = 16, }, ["solar-panel-4"] = { starting_value = 0, base_game_equivalent = "solar-panel", - multiplier = 64 + multiplier = 64, }, ["solar-panel-5"] = { starting_value = 0, base_game_equivalent = "solar-panel", - multiplier = 256 + multiplier = 256, }, ["solar-panel-6"] = { starting_value = 0, base_game_equivalent = "solar-panel", - multiplier = 1024 + multiplier = 1024, }, ["solar-panel-7"] = { starting_value = 0, base_game_equivalent = "solar-panel", - multiplier = 4096 + multiplier = 4096, }, ["solar-panel-8"] = { starting_value = 0, base_game_equivalent = "solar-panel", - multiplier = 16384 + multiplier = 16384, }, ["accumulator-2"] = { starting_value = 0, base_game_equivalent = "accumulator", - multiplier = 4 + multiplier = 4, }, ["accumulator-3"] = { starting_value = 0, base_game_equivalent = "accumulator", - multiplier = 16 + multiplier = 16, }, ["accumulator-4"] = { starting_value = 0, base_game_equivalent = "accumulator", - multiplier = 64 + multiplier = 64, }, ["accumulator-5"] = { starting_value = 0, base_game_equivalent = "accumulator", - multiplier = 256 + multiplier = 256, }, ["accumulator-6"] = { starting_value = 0, base_game_equivalent = "accumulator", - multiplier = 1024 + multiplier = 1024, }, ["accumulator-7"] = { starting_value = 0, base_game_equivalent = "accumulator", - multiplier = 4096 + multiplier = 4096, }, ["accumulator-8"] = { starting_value = 0, base_game_equivalent = "accumulator", - multiplier = 16384 + multiplier = 16384, }, } } From 3e4318fcab4c9b0fbda5e3486beabea57879a9bb Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Sun, 29 Dec 2024 23:30:30 +0900 Subject: [PATCH 008/406] . --- exp_legacy/module/config/vlayer.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exp_legacy/module/config/vlayer.lua b/exp_legacy/module/config/vlayer.lua index 3f455ed0..e6058863 100644 --- a/exp_legacy/module/config/vlayer.lua +++ b/exp_legacy/module/config/vlayer.lua @@ -26,7 +26,7 @@ return { interface_limit = { --- @setting interface_limit Sets the limit for the number of vlayer interfaces that can be created energy = 1, -- >1 allows for disconnected power networks to receive power circuit = 20, -- No caveats - storage_input = 30, -- No caveats + storage_input = 20, -- No caveats storage_output = 1, -- >0 allows for item teleportation (allowed_items only) }, From 80cd1245e5542fbf66a44e4261a094ac171c9321 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Mon, 30 Dec 2024 16:09:23 +0900 Subject: [PATCH 009/406] . --- exp_commands/module/commands/types.lua | 27 ++++++++++++++++++++++++++ exp_commands/module/locale/en.cfg | 1 + exp_commands/module/locale/zh-CN.cfg | 1 + exp_commands/module/locale/zh-TW.cfg | 1 + 4 files changed, 30 insertions(+) diff --git a/exp_commands/module/commands/types.lua b/exp_commands/module/commands/types.lua index 451ef0a0..46b3ad91 100644 --- a/exp_commands/module/commands/types.lua +++ b/exp_commands/module/commands/types.lua @@ -25,6 +25,8 @@ local Commands = require("modules/exp_commands") local add, parse = Commands.add_data_type, Commands.parse_input local valid, invalid = Commands.status.success, Commands.status.invalid_input +local Roles = require("modules.exp_legacy.expcore.roles") --- @dep expcore.roles + local types = {} --- @class Commands._types --- A boolean value where true is one of: yes, y, true, 1 @@ -229,4 +231,29 @@ types.color = end end) +--- A player who has joined the game at least once, with a lower role +types.lower_role_player = +add("player", function(input, player) + local player_i = game.get_player(input) + local player = game.get_player(player) + + if Roles.get_player_highest_role(player_i).index <= Roles.get_player_highest_role(player).index then + return invalid{ "exp-commands-parse.player", input } + else + return valid(player) + end +end) + +--- A role that is lower than given user +types.lower_role = + add("role", function(input) + local player = game.get_player(input) + + if Roles.config.roles[input] and (Roles.config.roles[input].index >= Roles.get_player_highest_role(player).index) then + return valid(player) + else + return invalid{ "exp-commands-parse.role", input } + end + end) + return types diff --git a/exp_commands/module/locale/en.cfg b/exp_commands/module/locale/en.cfg index 5691ca4c..bc241876 100644 --- a/exp_commands/module/locale/en.cfg +++ b/exp_commands/module/locale/en.cfg @@ -27,6 +27,7 @@ force=Invalid Force Name. surface=Invalid Surface Name. planet=Invalid Planet Name. color=Invalid Color Name. +role=Invalid Role Name. [exp-commands-authorities] character-only=This command can not be used in remote view. diff --git a/exp_commands/module/locale/zh-CN.cfg b/exp_commands/module/locale/zh-CN.cfg index 8eb8c6ea..59c4d760 100644 --- a/exp_commands/module/locale/zh-CN.cfg +++ b/exp_commands/module/locale/zh-CN.cfg @@ -27,6 +27,7 @@ force=勢力名稱錯誤。 surface=地表名稱錯誤。 planet=星球名稱錯誤。 color=顏色名稱錯誤。 +role=權限組名稱錯誤。 [exp-commands-authorities] character-only=該命令不能在遠端視圖中使用。 diff --git a/exp_commands/module/locale/zh-TW.cfg b/exp_commands/module/locale/zh-TW.cfg index 8eb8c6ea..59c4d760 100644 --- a/exp_commands/module/locale/zh-TW.cfg +++ b/exp_commands/module/locale/zh-TW.cfg @@ -27,6 +27,7 @@ force=勢力名稱錯誤。 surface=地表名稱錯誤。 planet=星球名稱錯誤。 color=顏色名稱錯誤。 +role=權限組名稱錯誤。 [exp-commands-authorities] character-only=該命令不能在遠端視圖中使用。 From 596ea470827aa3c5719459e8141463e35caa7eeb Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Mon, 30 Dec 2024 16:30:41 +0900 Subject: [PATCH 010/406] . --- exp_legacy/module/modules/gui/player-list.lua | 3 +-- exp_legacy/module/modules/gui/warp-list.lua | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/exp_legacy/module/modules/gui/player-list.lua b/exp_legacy/module/modules/gui/player-list.lua index 19b81055..0cb3cf7d 100644 --- a/exp_legacy/module/modules/gui/player-list.lua +++ b/exp_legacy/module/modules/gui/player-list.lua @@ -117,8 +117,7 @@ local add_player_base = local selected_player = game.players[selected_player_name] if event.button == defines.mouse_button_type.left then -- LMB will open the map to the selected player - local position = selected_player.physical_position - event.player.zoom_to_world(position, 1.75) + event.player.set_controller{ type = defines.controllers.remote, position = selected_player.physical_position, surface = selected_player.physical_surface } else -- RMB will toggle the settings local old_selected_player_name = SelectedPlayer:get(player) diff --git a/exp_legacy/module/modules/gui/warp-list.lua b/exp_legacy/module/modules/gui/warp-list.lua index e0bdb0d5..9872c623 100644 --- a/exp_legacy/module/modules/gui/warp-list.lua +++ b/exp_legacy/module/modules/gui/warp-list.lua @@ -230,8 +230,7 @@ local warp_label = :on_click(function(player, element, _) local warp_id = element.parent.caption local warp = Warps.get_warp(warp_id) - local position = warp.position - player.zoom_to_world(position, 1.5) + player.set_controller{ type = defines.controllers.remote, position = warp.position, surface = warp.surface } end) :static_name(Gui.unique_static_name) From 43f61909e87b3af4d7686471a413e5db47d74b1d Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Mon, 30 Dec 2024 18:25:03 +0900 Subject: [PATCH 011/406] . --- exp_legacy/module/config/bonus.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/exp_legacy/module/config/bonus.lua b/exp_legacy/module/config/bonus.lua index a7d665a5..c9b5220f 100644 --- a/exp_legacy/module/config/bonus.lua +++ b/exp_legacy/module/config/bonus.lua @@ -58,7 +58,7 @@ return { cost_scale = 1, cost = 10, is_percentage = false, - } + }, }, player_bonus = { ["character_mining_speed_modifier"] = { @@ -328,5 +328,5 @@ return { is_percentage = false, }, ]] - } + }, } From 4362b48106e8930c8d2e21d61c86df70bc9e43d4 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Mon, 30 Dec 2024 19:00:02 +0900 Subject: [PATCH 012/406] . --- exp_legacy/module/modules/control/selection.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/exp_legacy/module/modules/control/selection.lua b/exp_legacy/module/modules/control/selection.lua index 5f746e36..7c026292 100644 --- a/exp_legacy/module/modules/control/selection.lua +++ b/exp_legacy/module/modules/control/selection.lua @@ -153,7 +153,7 @@ end --- Stop selection if the selection tool is removed from the cursor Event.add(defines.events.on_player_cursor_stack_changed, function(event) local player = game.players[event.player_index] --- @cast player -nil - if player.cursor_stack.is_selection_tool then return end + if player.cursor_stack and player.cursor_stack.is_selection_tool then return end Selection.stop(player) end) @@ -161,7 +161,7 @@ end) Event.add(defines.events.on_player_controller_changed, function(event) local player = game.players[event.player_index] --- @cast player -nil local inventory = player.get_main_inventory() - if player.cursor_stack.is_selection_tool and inventory then + if player.cursor_stack and player.cursor_stack.is_selection_tool and inventory then player.hand_location = { inventory = inventory.index, slot = #inventory } end end) From 3830a464f850a9016093f57abe1c7a37becb6f6f Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Mon, 30 Dec 2024 19:52:55 +0900 Subject: [PATCH 013/406] Update types.lua --- exp_commands/module/commands/types.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/exp_commands/module/commands/types.lua b/exp_commands/module/commands/types.lua index 46b3ad91..56db8ae8 100644 --- a/exp_commands/module/commands/types.lua +++ b/exp_commands/module/commands/types.lua @@ -233,7 +233,7 @@ types.color = --- A player who has joined the game at least once, with a lower role types.lower_role_player = -add("player", function(input, player) +add("lower_role_player", function(input, player) local player_i = game.get_player(input) local player = game.get_player(player) @@ -246,7 +246,7 @@ end) --- A role that is lower than given user types.lower_role = - add("role", function(input) + add("lower_role", function(input) local player = game.get_player(input) if Roles.config.roles[input] and (Roles.config.roles[input].index >= Roles.get_player_highest_role(player).index) then From 5ae20ac21cfd6af219bb853c3f18c9111c815193 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Mon, 30 Dec 2024 19:55:13 +0900 Subject: [PATCH 014/406] Update types.lua --- exp_commands/module/commands/types.lua | 2 ++ 1 file changed, 2 insertions(+) diff --git a/exp_commands/module/commands/types.lua b/exp_commands/module/commands/types.lua index 56db8ae8..13de4b54 100644 --- a/exp_commands/module/commands/types.lua +++ b/exp_commands/module/commands/types.lua @@ -231,6 +231,7 @@ types.color = end end) +--[[ --- A player who has joined the game at least once, with a lower role types.lower_role_player = add("lower_role_player", function(input, player) @@ -255,5 +256,6 @@ types.lower_role = return invalid{ "exp-commands-parse.role", input } end end) +]] return types From bd5b2179093b0b6f77d91e76f11ca55e9773d738 Mon Sep 17 00:00:00 2001 From: PHIDIAS0303 Date: Mon, 30 Dec 2024 22:38:40 +0900 Subject: [PATCH 015/406] . --- exp_scenario/module/commands/research.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exp_scenario/module/commands/research.lua b/exp_scenario/module/commands/research.lua index d6673193..56a5b569 100644 --- a/exp_scenario/module/commands/research.lua +++ b/exp_scenario/module/commands/research.lua @@ -71,7 +71,7 @@ local function on_research_finished(event) if not research.res_queue_enable then return end local force = event.research.force - if force.rockets_launched > 0 and force.technologies[config.bonus_inventory.res[config.mod_set].name].level > config.bonus_inventory.res[config.mod_set].level then + if force.technologies[config.bonus_inventory.res[config.mod_set].name].level > config.bonus_inventory.res[config.mod_set].level then module.res_queue(force, event.by_script) end end From d2e2e2d6c93b6b438fd116d17de8f4252e83c7e9 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Tue, 31 Dec 2024 00:28:24 +0900 Subject: [PATCH 016/406] . --- exp_legacy/module/modules/gui/warp-list.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exp_legacy/module/modules/gui/warp-list.lua b/exp_legacy/module/modules/gui/warp-list.lua index 9872c623..9d5fbdd7 100644 --- a/exp_legacy/module/modules/gui/warp-list.lua +++ b/exp_legacy/module/modules/gui/warp-list.lua @@ -95,7 +95,7 @@ local add_new_warp = local position = player.physical_position -- Check if the warp is too close to water - local water_tiles = surface.find_tiles_filtered{ collision_mask = "water-tile", radius = config.standard_proximity_radius + 1, position = position } + local water_tiles = surface.find_tiles_filtered{ collision_mask = { layers = { water_tile = true } }, radius = config.standard_proximity_radius + 1, position = position } if #water_tiles > 0 then player.print( { "expcore-commands.command-fail", { "warp-list.too-close-to-water", config.standard_proximity_radius + 1 } }, From c5395e37b2be48a11a160e674a8469919c8bdc07 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Tue, 31 Dec 2024 00:45:23 +0900 Subject: [PATCH 017/406] . --- exp_legacy/module/modules/gui/warp-list.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exp_legacy/module/modules/gui/warp-list.lua b/exp_legacy/module/modules/gui/warp-list.lua index 9d5fbdd7..67c4414a 100644 --- a/exp_legacy/module/modules/gui/warp-list.lua +++ b/exp_legacy/module/modules/gui/warp-list.lua @@ -95,7 +95,7 @@ local add_new_warp = local position = player.physical_position -- Check if the warp is too close to water - local water_tiles = surface.find_tiles_filtered{ collision_mask = { layers = { water_tile = true } }, radius = config.standard_proximity_radius + 1, position = position } + local water_tiles = surface.find_tiles_filtered{ collision_mask = { "water", "water-green", "water-mud", "water-shallow", "water-wube" }, radius = config.standard_proximity_radius + 1, position = position } if #water_tiles > 0 then player.print( { "expcore-commands.command-fail", { "warp-list.too-close-to-water", config.standard_proximity_radius + 1 } }, From 3266f444cd821efeb4c8e4fe6d134aa20c93f930 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Tue, 31 Dec 2024 00:49:15 +0900 Subject: [PATCH 018/406] . --- exp_legacy/module/modules/gui/warp-list.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exp_legacy/module/modules/gui/warp-list.lua b/exp_legacy/module/modules/gui/warp-list.lua index 67c4414a..bcaa3856 100644 --- a/exp_legacy/module/modules/gui/warp-list.lua +++ b/exp_legacy/module/modules/gui/warp-list.lua @@ -95,7 +95,7 @@ local add_new_warp = local position = player.physical_position -- Check if the warp is too close to water - local water_tiles = surface.find_tiles_filtered{ collision_mask = { "water", "water-green", "water-mud", "water-shallow", "water-wube" }, radius = config.standard_proximity_radius + 1, position = position } + local water_tiles = surface.find_tiles_filtered{ collision_mask = { "water_tile" }, radius = config.standard_proximity_radius + 1, position = position } if #water_tiles > 0 then player.print( { "expcore-commands.command-fail", { "warp-list.too-close-to-water", config.standard_proximity_radius + 1 } }, From 51961d2aea3f3184662452f9bae93e27c020053d Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Tue, 31 Dec 2024 00:50:23 +0900 Subject: [PATCH 019/406] . --- exp_legacy/module/modules/gui/warp-list.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exp_legacy/module/modules/gui/warp-list.lua b/exp_legacy/module/modules/gui/warp-list.lua index bcaa3856..e96de051 100644 --- a/exp_legacy/module/modules/gui/warp-list.lua +++ b/exp_legacy/module/modules/gui/warp-list.lua @@ -95,7 +95,7 @@ local add_new_warp = local position = player.physical_position -- Check if the warp is too close to water - local water_tiles = surface.find_tiles_filtered{ collision_mask = { "water_tile" }, radius = config.standard_proximity_radius + 1, position = position } + local water_tiles = surface.find_tiles_filtered{ collision_mask = "water_tile", radius = config.standard_proximity_radius + 1, position = position } if #water_tiles > 0 then player.print( { "expcore-commands.command-fail", { "warp-list.too-close-to-water", config.standard_proximity_radius + 1 } }, From 15141e98e0020bf729ef39bcacbef3c562e0f2af Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Tue, 31 Dec 2024 02:58:15 +0900 Subject: [PATCH 020/406] . --- exp_legacy/module/config/expcore/roles.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exp_legacy/module/config/expcore/roles.lua b/exp_legacy/module/config/expcore/roles.lua index ca4c1f9c..829163c1 100644 --- a/exp_legacy/module/config/expcore/roles.lua +++ b/exp_legacy/module/config/expcore/roles.lua @@ -170,7 +170,7 @@ Roles.new_role("Senior Member", "SMem") --- Standard User Roles Roles.new_role("Member", "Mem") - :set_permission_group("Standard") + :set_permission_group("Trusted") :set_custom_color{ r = 24, g = 172, b = 188 } :set_flag("deconlog-bypass") :set_parent("Veteran") From d73688dd37a4f441f7aecedc20be434fc636ef4b Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Tue, 31 Dec 2024 13:13:02 +0900 Subject: [PATCH 021/406] . --- exp_legacy/module/modules/gui/player-list.lua | 1 + exp_legacy/module/modules/gui/rocket-info.lua | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/exp_legacy/module/modules/gui/player-list.lua b/exp_legacy/module/modules/gui/player-list.lua index 0cb3cf7d..cc08db56 100644 --- a/exp_legacy/module/modules/gui/player-list.lua +++ b/exp_legacy/module/modules/gui/player-list.lua @@ -117,6 +117,7 @@ local add_player_base = local selected_player = game.players[selected_player_name] if event.button == defines.mouse_button_type.left then -- LMB will open the map to the selected player + local position = selected_player.physical_position event.player.set_controller{ type = defines.controllers.remote, position = selected_player.physical_position, surface = selected_player.physical_surface } else -- RMB will toggle the settings diff --git a/exp_legacy/module/modules/gui/rocket-info.lua b/exp_legacy/module/modules/gui/rocket-info.lua index 9e404d15..5355591e 100644 --- a/exp_legacy/module/modules/gui/rocket-info.lua +++ b/exp_legacy/module/modules/gui/rocket-info.lua @@ -127,7 +127,7 @@ local silo_cords = :on_click(function(player, element, _) local rocket_silo_name = element.parent.caption local rocket_silo = Rockets.get_silo_entity(rocket_silo_name) - player.zoom_to_world(rocket_silo.position, 2) + player.set_controller{ type = defines.controllers.remote, position = rocket_silo.position, surface = rocket_silo.surface } end) --- Base element for each rocket in the progress list From 4a1a451ff29a5905b4540648d05cd3ba141a7ee6 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Tue, 31 Dec 2024 13:14:27 +0900 Subject: [PATCH 022/406] . --- exp_legacy/module/modules/gui/vlayer.lua | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/exp_legacy/module/modules/gui/vlayer.lua b/exp_legacy/module/modules/gui/vlayer.lua index 2dc8ed3d..a99860bb 100644 --- a/exp_legacy/module/modules/gui/vlayer.lua +++ b/exp_legacy/module/modules/gui/vlayer.lua @@ -369,14 +369,10 @@ local vlayer_gui_control_see = if target and vlayer_control_type_list[target] and n > 0 then local i = vlayer.get_interfaces() - - if i and i[vlayer_control_type_list[target]] and i[vlayer_control_type_list[target]][n] then - local pos = i[vlayer_control_type_list[target]][n].position - - if pos then - player.zoom_to_world(pos, 2) - player.print{ "vlayer.result-interface-location", { "vlayer.control-type-" .. vlayer_control_type_list[target]:gsub("_", "-") }, pos_to_gps_string(pos) } - end + local entity = i[vlayer_control_type_list[target]][n] + if entity and entity.valid then + player.set_controller{ type = defines.controllers.remote, position = entity.position, surface = entity.surface } + player.print{ "vlayer.result-interface-location", { "vlayer.control-type-" .. vlayer_control_type_list[target]:gsub("_", "-") }, pos_to_gps_string(entity.position) } end end end) From dfd3f85975983f362eda9112723bec3ac9cabafc Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Tue, 31 Dec 2024 13:33:48 +0900 Subject: [PATCH 023/406] . --- exp_commands/module/commands/types.lua | 27 ------------------- exp_legacy/module/modules/control/vlayer.lua | 6 ++--- exp_legacy/module/modules/gui/player-list.lua | 1 - 3 files changed, 3 insertions(+), 31 deletions(-) diff --git a/exp_commands/module/commands/types.lua b/exp_commands/module/commands/types.lua index 13de4b54..2e823a4c 100644 --- a/exp_commands/module/commands/types.lua +++ b/exp_commands/module/commands/types.lua @@ -231,31 +231,4 @@ types.color = end end) ---[[ ---- A player who has joined the game at least once, with a lower role -types.lower_role_player = -add("lower_role_player", function(input, player) - local player_i = game.get_player(input) - local player = game.get_player(player) - - if Roles.get_player_highest_role(player_i).index <= Roles.get_player_highest_role(player).index then - return invalid{ "exp-commands-parse.player", input } - else - return valid(player) - end -end) - ---- A role that is lower than given user -types.lower_role = - add("lower_role", function(input) - local player = game.get_player(input) - - if Roles.config.roles[input] and (Roles.config.roles[input].index >= Roles.get_player_highest_role(player).index) then - return valid(player) - else - return invalid{ "exp-commands-parse.role", input } - end - end) -]] - return types diff --git a/exp_legacy/module/modules/control/vlayer.lua b/exp_legacy/module/modules/control/vlayer.lua index ccd157ca..c63a3e41 100644 --- a/exp_legacy/module/modules/control/vlayer.lua +++ b/exp_legacy/module/modules/control/vlayer.lua @@ -271,9 +271,9 @@ function vlayer.insert_item(item_name, count) vlayer.allocate_item(item_name, allocate_count) end - local nc = count - allocate_count - vlayer_data.storage.unallocated[item_name] = vlayer_data.storage.unallocated[item_name] + count - allocate_count - vlayer.unable_alloc_item_pwr_calc(item_name, nc) + local unallocated = count - allocate_count + vlayer_data.storage.unallocated[item_name] = vlayer_data.storage.unallocated[item_name] + unallocated + vlayer.unable_alloc_item_pwr_calc(item_name, unallocated) else vlayer.allocate_item(item_name, count) end diff --git a/exp_legacy/module/modules/gui/player-list.lua b/exp_legacy/module/modules/gui/player-list.lua index cc08db56..0cb3cf7d 100644 --- a/exp_legacy/module/modules/gui/player-list.lua +++ b/exp_legacy/module/modules/gui/player-list.lua @@ -117,7 +117,6 @@ local add_player_base = local selected_player = game.players[selected_player_name] if event.button == defines.mouse_button_type.left then -- LMB will open the map to the selected player - local position = selected_player.physical_position event.player.set_controller{ type = defines.controllers.remote, position = selected_player.physical_position, surface = selected_player.physical_surface } else -- RMB will toggle the settings From a0c0169a4b4d3ac03d8428c43a9d63c092c559b4 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Tue, 31 Dec 2024 13:34:15 +0900 Subject: [PATCH 024/406] . --- exp_commands/module/commands/types.lua | 2 -- 1 file changed, 2 deletions(-) diff --git a/exp_commands/module/commands/types.lua b/exp_commands/module/commands/types.lua index 2e823a4c..451ef0a0 100644 --- a/exp_commands/module/commands/types.lua +++ b/exp_commands/module/commands/types.lua @@ -25,8 +25,6 @@ local Commands = require("modules/exp_commands") local add, parse = Commands.add_data_type, Commands.parse_input local valid, invalid = Commands.status.success, Commands.status.invalid_input -local Roles = require("modules.exp_legacy.expcore.roles") --- @dep expcore.roles - local types = {} --- @class Commands._types --- A boolean value where true is one of: yes, y, true, 1 From 3ab5becf169fef585d80ae15b36bbff39605c82d Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Tue, 31 Dec 2024 13:37:50 +0900 Subject: [PATCH 025/406] . --- exp_legacy/module/modules/gui/server-ups.lua | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/exp_legacy/module/modules/gui/server-ups.lua b/exp_legacy/module/modules/gui/server-ups.lua index 592d8755..fc0bd3d2 100644 --- a/exp_legacy/module/modules/gui/server-ups.lua +++ b/exp_legacy/module/modules/gui/server-ups.lua @@ -57,6 +57,10 @@ Commands.new("server-ups", { "server-ups.description" }) local function set_location(event) local player = game.players[event.player_index] local label = player.gui.screen[server_ups.name] + if not label then + label = server_ups(player.gui.screen) + label.visible = UsesServerUps:get(player) + end local res = player.display_resolution local uis = player.display_scale -- below ups and clock @@ -65,12 +69,7 @@ local function set_location(event) end -- Draw the label when the player joins -Event.add(defines.events.on_player_created, function(event) - local player = game.players[event.player_index] - local label = server_ups(player.gui.screen) - label.visible = false - set_location(event) -end) +Event.add(defines.events.on_player_created, set_location) -- Update the caption for all online players -- percentage of game speed From 1eb7a27c7187606bf3b903a6c4988413ba7a9500 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Tue, 31 Dec 2024 13:40:23 +0900 Subject: [PATCH 026/406] . --- exp_legacy/module/modules/gui/rocket-info.lua | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/exp_legacy/module/modules/gui/rocket-info.lua b/exp_legacy/module/modules/gui/rocket-info.lua index 5355591e..f1860e0c 100644 --- a/exp_legacy/module/modules/gui/rocket-info.lua +++ b/exp_legacy/module/modules/gui/rocket-info.lua @@ -138,12 +138,15 @@ local rocket_entry = local player = Gui.get_player_from_element(parent) -- Add the toggle auto launch if the player is allowed it - if check_player_permissions(player, "toggle_active") then + -- Auto launch was removed from the api and no 2.0 equivalent was added + -- https://forums.factorio.com/viewtopic.php?f=28&t=118065&p=656502 + --[[if check_player_permissions(player, "toggle_active") then local flow = parent.add{ type = "flow", name = "toggle-" .. silo_name } local button = toggle_launch(flow) button.tooltip = silo_data.toggle_tooltip button.sprite = silo_data.toggle_sprite end + ]] -- Add the remote launch if the player is allowed it if check_player_permissions(player, "remote_launch") then @@ -246,7 +249,7 @@ local function get_progress_data(force_name) -- Get the toggle button data local toggle_tooltip = { "rocket-info.toggle-rocket-tooltip-disabled" } local toggle_sprite = "utility/play" - if rocket_silo.auto_launch then + if false --[[rocket_silo.auto_launch]] then toggle_tooltip = { "rocket-info.toggle-rocket-tooltip" } toggle_sprite = "utility/stop" end From 2944e730b06175fb90214fc2752db43542e2448c Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Tue, 31 Dec 2024 13:41:06 +0900 Subject: [PATCH 027/406] . --- exp_legacy/module/modules/addons/logging.lua | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/exp_legacy/module/modules/addons/logging.lua b/exp_legacy/module/modules/addons/logging.lua index 331e6415..103a47a5 100644 --- a/exp_legacy/module/modules/addons/logging.lua +++ b/exp_legacy/module/modules/addons/logging.lua @@ -13,12 +13,13 @@ local function add_log(data) write_file(config.file_name, "\n", true, 0) end -Event.add(defines.events.on_rocket_launched, function(event) - if event and event.rocket and event.rocket.force and event.rocket.force.rockets_launched then - if event.rocket.force.rockets_launched >= config.rocket_launch_display_rate and event.rocket.force.rockets_launched % config.rocket_launch_display_rate == 0 then - add_log("[ROCKET] " .. event.rocket.force.rockets_launched .. " rockets launched") - elseif config.rocket_launch_display[event.rocket.force.rockets_launched] then - add_log("[ROCKET] " .. event.rocket.force.rockets_launched .. " rockets launched") +Event.add(defines.events.on_cargo_pod_finished_ascending, function(event) + if event and event.launched_by_rocket then + local force = event.cargo_pod.force + if force.rockets_launched >= config.rocket_launch_display_rate and force.rockets_launched % config.rocket_launch_display_rate == 0 then + add_log("[ROCKET] " .. force.rockets_launched .. " rockets launched") + elseif config.rocket_launch_display[force.rockets_launched] then + add_log("[ROCKET] " .. force.rockets_launched .. " rockets launched") end end end) From cf900d46cdde0cab28aca82308f951b532380d7c Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Tue, 31 Dec 2024 13:41:38 +0900 Subject: [PATCH 028/406] . --- exp_legacy/module/modules/control/rockets.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exp_legacy/module/modules/control/rockets.lua b/exp_legacy/module/modules/control/rockets.lua index 195ac670..1b53946a 100644 --- a/exp_legacy/module/modules/control/rockets.lua +++ b/exp_legacy/module/modules/control/rockets.lua @@ -148,7 +148,7 @@ function Rockets.get_rolling_average(force_name, count) end --- Event used to update the stats and the hui when a rocket is launched -Event.add(defines.events.on_rocket_launched, function(event) +Event.add(defines.events.on_cargo_pod_finished_ascending, function(event) local entity = event.rocket_silo local silo_data = Rockets.get_silo_data(entity) local force = event.rocket_silo.force From 7555de476e9cb2820d03cdaf4fed3e37c885ccc8 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Tue, 31 Dec 2024 13:42:19 +0900 Subject: [PATCH 029/406] . --- exp_legacy/module/modules/control/rockets.lua | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/exp_legacy/module/modules/control/rockets.lua b/exp_legacy/module/modules/control/rockets.lua index 1b53946a..528a4363 100644 --- a/exp_legacy/module/modules/control/rockets.lua +++ b/exp_legacy/module/modules/control/rockets.lua @@ -148,12 +148,13 @@ function Rockets.get_rolling_average(force_name, count) end --- Event used to update the stats and the hui when a rocket is launched -Event.add(defines.events.on_cargo_pod_finished_ascending, function(event) +--- @param event EventData.on_rocket_launched +Event.add(defines.events.on_rocket_launched, function(event) local entity = event.rocket_silo local silo_data = Rockets.get_silo_data(entity) local force = event.rocket_silo.force local force_name = force.name - local rockets_launched = force.rockets_launched + local rockets_launched = force.rockets_launched + 1 -- Hasn't updated when this event fires --- Handles updates to the rocket stats local stats = rocket_stats[force_name] From 6d6e44f0da1c6417514a7c7de76d536a747cf15e Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Tue, 31 Dec 2024 13:42:37 +0900 Subject: [PATCH 030/406] . --- exp_legacy/module/config/_file_loader.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/exp_legacy/module/config/_file_loader.lua b/exp_legacy/module/config/_file_loader.lua index 3ab87539..69e21a27 100644 --- a/exp_legacy/module/config/_file_loader.lua +++ b/exp_legacy/module/config/_file_loader.lua @@ -44,8 +44,8 @@ return { --- GUI "modules.gui.readme", - -- "modules.gui.rocket-info", - -- "modules.gui.science-info", + "modules.gui.rocket-info", + "modules.gui.science-info", "modules.gui.autofill", "modules.gui.warp-list", "modules.gui.task-list", From 118b99f5213f7405f35ddf454e5c5610c4a56b84 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Tue, 31 Dec 2024 13:49:34 +0900 Subject: [PATCH 031/406] . --- exp_legacy/module/modules/gui/rocket-info.lua | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/exp_legacy/module/modules/gui/rocket-info.lua b/exp_legacy/module/modules/gui/rocket-info.lua index f1860e0c..f7d452a4 100644 --- a/exp_legacy/module/modules/gui/rocket-info.lua +++ b/exp_legacy/module/modules/gui/rocket-info.lua @@ -145,8 +145,7 @@ local rocket_entry = local button = toggle_launch(flow) button.tooltip = silo_data.toggle_tooltip button.sprite = silo_data.toggle_sprite - end - ]] + end]] -- Add the remote launch if the player is allowed it if check_player_permissions(player, "remote_launch") then From a991142279403b16b9d690200c39a431bc9d32a9 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Tue, 31 Dec 2024 15:12:26 +0900 Subject: [PATCH 032/406] . --- exp_legacy/module/config/_file_loader.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/exp_legacy/module/config/_file_loader.lua b/exp_legacy/module/config/_file_loader.lua index 69e21a27..3ab87539 100644 --- a/exp_legacy/module/config/_file_loader.lua +++ b/exp_legacy/module/config/_file_loader.lua @@ -44,8 +44,8 @@ return { --- GUI "modules.gui.readme", - "modules.gui.rocket-info", - "modules.gui.science-info", + -- "modules.gui.rocket-info", + -- "modules.gui.science-info", "modules.gui.autofill", "modules.gui.warp-list", "modules.gui.task-list", From 2749df9f08c023dad3c8001cf9db098c9bf5cf6a Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Tue, 31 Dec 2024 23:35:42 +0900 Subject: [PATCH 033/406] . --- exp_legacy/module/modules/gui/readme.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exp_legacy/module/modules/gui/readme.lua b/exp_legacy/module/modules/gui/readme.lua index 7159977a..d144879f 100644 --- a/exp_legacy/module/modules/gui/readme.lua +++ b/exp_legacy/module/modules/gui/readme.lua @@ -115,7 +115,7 @@ local welcome_time_format = ExpUtil.format_time_factory_locale{ format = "long", -- @element welcome_content define_tab({ "readme.welcome-tab" }, { "readme.welcome-tooltip" }, Gui.element(function(_, parent) - local server_details = { name = "ExpGaming S0 - Local", welcome = "Failed to load description: disconnected from external api.", reset_time = "Non Set", branch = "Unknown" } + local server_details = { name = "APERX S0 - Local", welcome = "Failed to load description: disconnected from external api.", reset_time = "Non Set", branch = "Unknown" } if External.valid() then server_details = External.get_current_server() end local container = parent.add{ type = "flow", direction = "vertical" } local player = Gui.get_player_from_element(parent) From a65a04c8109eeba222c44432321c5c5908600f3d Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Wed, 1 Jan 2025 17:26:07 +0900 Subject: [PATCH 034/406] . --- exp_commands/module/module_exports.lua | 10 +-- exp_legacy/module/expcore/external.lua | 6 +- exp_legacy/module/modules/control/rockets.lua | 66 +++++++++---------- exp_util/module/module_exports.lua | 3 + 4 files changed, 42 insertions(+), 43 deletions(-) diff --git a/exp_commands/module/module_exports.lua b/exp_commands/module/module_exports.lua index 206d1e5c..a58e8c04 100644 --- a/exp_commands/module/module_exports.lua +++ b/exp_commands/module/module_exports.lua @@ -164,7 +164,7 @@ Commands.server = setmetatable({ --- @param msg LocalisedString? An optional message to be included when a command completes (only has an effect in command callbacks) --- @return Commands.Status, LocalisedString # Should be returned directly without modification function Commands.status.success(msg) - return Commands.status.success, msg or { "exp-commands.success" } + return Commands.status.success, msg == nil and { "exp-commands.success" } or msg end --- Used to signal an error has occurred in a command, data type parser, or permission authority @@ -172,7 +172,7 @@ end --- @param msg LocalisedString? An optional error message to be included in the output, a generic message is used if not provided --- @return Commands.Status, LocalisedString # Should be returned directly without modification function Commands.status.error(msg) - return Commands.status.error, { "exp-commands.error", msg or { "exp-commands.error-default" } } + return Commands.status.error, { "exp-commands.error", msg == nil and { "exp-commands.error-default" } or msg } end --- Used to signal the player is unauthorised to use a command, primarily used by permission authorities but can be used in a command callback @@ -180,7 +180,7 @@ end --- @param msg LocalisedString? An optional error message to be included in the output, a generic message is used if not provided --- @return Commands.Status, LocalisedString # Should be returned directly without modification function Commands.status.unauthorised(msg) - return Commands.status.unauthorised, msg or { "exp-commands.unauthorized", msg or { "exp-commands.unauthorized-default" } } + return Commands.status.unauthorised, { "exp-commands.unauthorized", msg == nil and { "exp-commands.unauthorized-default" } or msg } end --- Used to signal the player provided invalid input to an command, primarily used by data type parsers but can be used in a command callback @@ -188,7 +188,7 @@ end --- @param msg LocalisedString? An optional error message to be included in the output, a generic message is used if not provided --- @return Commands.Status, LocalisedString # Should be returned directly without modification function Commands.status.invalid_input(msg) - return Commands.status.invalid_input, msg or { "exp-commands.invalid-input" } + return Commands.status.invalid_input, msg == nil and { "exp-commands.invalid-input" } or msg end --- Used to signal an internal error has occurred, this is reserved for internal use only @@ -702,7 +702,7 @@ function Commands._event_handler(event) -- Parse the raw argument to get the correct data type local success, status, parsed = Commands.parse_input(input, player, argument.input_parser) if success == false then - log_command("Input parse failed", command, player, event.parameter, { status = valid_command_status[status], index = index, argument = argument, reason = parsed }) + log_command("Input parse failed", command, player, event.parameter, { status = valid_command_status[status], index = index, argument = argument.name, reason = parsed }) return Commands.error{ "exp-commands.invalid-argument", argument.name, parsed } else arguments[index] = parsed diff --git a/exp_legacy/module/expcore/external.lua b/exp_legacy/module/expcore/external.lua index e5e7b6dc..d37129e0 100644 --- a/exp_legacy/module/expcore/external.lua +++ b/exp_legacy/module/expcore/external.lua @@ -83,7 +83,7 @@ function External.get_current_server() assert(ext, "No external data was found, use External.valid() to ensure external data exists.") local servers = assert(ext.servers, "No server list was found, please ensure that the external service is running") local server_id = assert(ext.current, "No current id was found, please ensure that the external service is running") - return servers[server_id] + return assert(servers[server_id], "No details found for server with id: " .. tostring(server_id)) end --[[-- Gets the details of the given server @@ -97,7 +97,7 @@ local server = External.get_server_details('eu-01') function External.get_server_details(server_id) assert(ext, "No external data was found, use External.valid() to ensure external data exists.") local servers = assert(ext.servers, "No server list was found, please ensure that the external service is running") - return servers[server_id] + return assert(servers[server_id], "No details found for server with id: " .. tostring(server_id)) end --[[-- Gets the status of the given server @@ -113,7 +113,7 @@ function External.get_server_status(server_id, raw) assert(var, "No external data was found, use External.valid() to ensure external data exists.") local servers = assert(var.status, "No server status was found, please ensure that the external service is running") local current = assert(ext.current, "No current id was found, please ensure that the external service is running") - return not raw and server_id == current and "Current" or servers[server_id] + return not raw and server_id == current and "Current" or assert(servers[server_id], "No status found for server with id: " .. tostring(server_id)) end --[[-- Gets the ups of the current server diff --git a/exp_legacy/module/modules/control/rockets.lua b/exp_legacy/module/modules/control/rockets.lua index 528a4363..d6fca7c5 100644 --- a/exp_legacy/module/modules/control/rockets.lua +++ b/exp_legacy/module/modules/control/rockets.lua @@ -59,8 +59,8 @@ Storage.register({ end) --- Gets the silo data for a given silo entity --- @tparam LuaEntity silo the rocket silo entity --- @treturn table the data table for this silo, contains rockets launch, silo status, and its force +--- @param silo LuaEntity Rocket silo entity +--- @return table # Data table for this silo, contains rockets launch, silo status, and its force function Rockets.get_silo_data(silo) local position = silo.position local silo_name = math.floor(position.x) .. ":" .. math.floor(position.y) @@ -68,30 +68,30 @@ function Rockets.get_silo_data(silo) end --- Gets the silo data for a given silo entity --- @tparam string silo_name the silo name that is stored in its data --- @treturn table the data table for this silo, contains rockets launch, silo status, and its force +--- @param silo_name string Silo name that is stored in its data +--- @return table # Data table for this silo, contains rockets launch, silo status, and its force function Rockets.get_silo_data_by_name(silo_name) return rocket_silos[silo_name] end --- Gets the silo entity from its silo name, reverse to get_silo_data --- @tparam string silo_name the silo name that is stored in its data --- @treturn LuaEntity the rocket silo entity +--- @param silo_name string Silo name that is stored in its data +--- @return LuaEntity # Rocket silo entity function Rockets.get_silo_entity(silo_name) local data = rocket_silos[silo_name] return data.entity end --- Gets the rocket stats for a force --- @tparam string force_name the name of the force to get the stats for --- @treturn table the table of stats for the force +--- @param force_name string Name of the force to get the stats for +--- @return table # Stats for the force function Rockets.get_stats(force_name) return rocket_stats[force_name] or {} end --- Gets all the rocket silos that belong to a force --- @tparam string force_name the name of the force to get the silos for --- @treturn table an array of silo data that all belong to this force +--- @param force_name string Name of the force to get the silos for +--- @return table # Array of silo data that all belong to this force function Rockets.get_silos(force_name) local rtn = {} for _, silo_data in pairs(rocket_silos) do @@ -104,23 +104,23 @@ function Rockets.get_silos(force_name) end --- Gets the launch time of a given rocket, due to cleaning not all counts are valid --- @tparam string force_name the name of the force to get the count for --- @tparam number rocket_number the number of the rocket to get the launch time for --- @treturn number the game tick that the rocket was lanuched on +--- @param force_name string Name of the force to get the count for +--- @param rocket_number number Number of the rocket to get the launch time for +--- @return number? # Game tick that the rocket was launched on function Rockets.get_rocket_time(force_name, rocket_number) return rocket_times[force_name] and rocket_times[force_name][rocket_number] or nil end --- Gets the number of rockets that a force has launched --- @tparam string force_name the name of the force to get the count for --- @treturn number the number of rockets that the force has launched +--- @param force_name string the name of the force to get the count for +--- @return number # Number of rockets that the force has launched function Rockets.get_rocket_count(force_name) local force = game.forces[force_name] return force.rockets_launched end --- Gets the total number of rockets launched by all forces --- @treturn number the total number of rockets launched this game +--- @return number # Total number of rockets launched this game function Rockets.get_game_rocket_count() local rtn = 0 for _, force in pairs(game.forces) do @@ -131,9 +131,9 @@ function Rockets.get_game_rocket_count() end --- Gets the rolling average time to launch a rocket --- @tparam string force_name the name of the force to get the average for --- @tparam number count the distance to get the rolling average over --- @treturn number the number of ticks required to launch one rocket +--- @param force_name string Name of the force to get the average for +--- @param count number Distance to get the rolling average over +--- @return number # Number of ticks required to launch one rocket function Rockets.get_rolling_average(force_name, count) local force = game.forces[force_name] local rocket_count = force.rockets_launched @@ -147,14 +147,20 @@ function Rockets.get_rolling_average(force_name, count) return math.floor((last_launch_time - start_rocket_time) / rocket_count) end +--- When a launch is trigger it will wait for the silo to reset +--- @param event EventData.on_rocket_launch_ordered +Event.add(defines.events.on_rocket_launch_ordered, function(event) + local silo_data = Rockets.get_silo_data(event.rocket_silo) + silo_data.launched = silo_data.launched + 1 + silo_data.awaiting_reset = true +end) + --- Event used to update the stats and the hui when a rocket is launched ---- @param event EventData.on_rocket_launched -Event.add(defines.events.on_rocket_launched, function(event) - local entity = event.rocket_silo - local silo_data = Rockets.get_silo_data(entity) - local force = event.rocket_silo.force +--- @param event EventData.on_cargo_pod_finished_ascending +Event.add(defines.events.on_cargo_pod_finished_ascending, function(event) + local force = event.cargo_pod.force local force_name = force.name - local rockets_launched = force.rockets_launched + 1 -- Hasn't updated when this event fires + local rockets_launched = force.rockets_launched --- Handles updates to the rocket stats local stats = rocket_stats[force_name] @@ -183,16 +189,6 @@ Event.add(defines.events.on_rocket_launched, function(event) if remove_rocket > 0 and not table.contains(config.milestones, remove_rocket) then rocket_times[force_name][remove_rocket] = nil end - - --- Adds this 1 to the launch count for this silo - silo_data.launched = silo_data.launched + 1 -end) - ---- When a launch is reiggered it will await reset -Event.add(defines.events.on_rocket_launch_ordered, function(event) - local entity = event.rocket_silo - local silo_data = Rockets.get_silo_data(entity) - silo_data.awaiting_reset = true end) --- Adds a silo to the list when it is built diff --git a/exp_util/module/module_exports.lua b/exp_util/module/module_exports.lua index 159ccaad..d9638d98 100644 --- a/exp_util/module/module_exports.lua +++ b/exp_util/module/module_exports.lua @@ -451,6 +451,7 @@ end --- @class Common.copy_items_to_surface_param: Common.get_or_create_storage_param --- @field items ItemStackIdentification[] | LuaInventory The item stacks to copy +--- @field item ItemStackIdentification? Overwritten internally --- Insert a copy of the given items into the found entities. If no entities are found then they will be created if possible. --- @param options Common.copy_items_to_surface_param @@ -467,6 +468,7 @@ end --- @class Common.move_items_to_surface_param: Common.get_or_create_storage_param --- @field items LuaItemStack[] The item stacks to move +--- @field item ItemStackIdentification? Overwritten internally --- Insert a copy of the given items into the found entities. If no entities are found then they will be created if possible. --- @param options Common.move_items_to_surface_param @@ -484,6 +486,7 @@ end --- @class Common.transfer_inventory_to_surface_param: Common.copy_items_to_surface_param --- @field inventory LuaInventory The inventory to transfer +--- @field items (ItemStackIdentification[] | LuaInventory)? Overwritten internally --- Move the given inventory into the found entities. If no entities are found then they will be created if possible. --- @param options Common.transfer_inventory_to_surface_param From 890019ca98d8b9e1a63796a2f76867d60392e8f4 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Wed, 1 Jan 2025 17:40:51 +0900 Subject: [PATCH 035/406] . --- exp_legacy/module/modules/addons/tree-decon.lua | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/exp_legacy/module/modules/addons/tree-decon.lua b/exp_legacy/module/modules/addons/tree-decon.lua index aa72774d..0298c335 100644 --- a/exp_legacy/module/modules/addons/tree-decon.lua +++ b/exp_legacy/module/modules/addons/tree-decon.lua @@ -117,12 +117,13 @@ Event.add(defines.events.on_entity_damaged, function(event) end local driver = event.cause.get_driver() - if not driver then return end - local allow = get_permission(driver.player.index) - if allow == "fast" and HasEnabledDecon:get(driver.player) then - event.entity.destroy() - else - event.entity.order_deconstruction(event.force, driver.player) + if driver and driver.player then + driver = driver.player + if get_permission(driver.index) == "fast" and HasEnabledDecon:get(driver) then + event.entity.destroy() + else + event.entity.order_deconstruction(event.force, driver) + end end end) From fb01bc1644248a93578268943ca21d03fb0ea5a9 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Wed, 1 Jan 2025 17:42:06 +0900 Subject: [PATCH 036/406] . --- exp_legacy/module/modules/addons/tree-decon.lua | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/exp_legacy/module/modules/addons/tree-decon.lua b/exp_legacy/module/modules/addons/tree-decon.lua index 0298c335..577b72fb 100644 --- a/exp_legacy/module/modules/addons/tree-decon.lua +++ b/exp_legacy/module/modules/addons/tree-decon.lua @@ -119,11 +119,10 @@ Event.add(defines.events.on_entity_damaged, function(event) local driver = event.cause.get_driver() if driver and driver.player then - driver = driver.player - if get_permission(driver.index) == "fast" and HasEnabledDecon:get(driver) then + if get_permission(driver.player.index) == "fast" and HasEnabledDecon:get(driver.player) then event.entity.destroy() else - event.entity.order_deconstruction(event.force, driver) + event.entity.order_deconstruction(event.force, driver.player) end end end) From 9a82000792ed3e3e506deead851aede4eb16162c Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Wed, 1 Jan 2025 18:49:16 +0900 Subject: [PATCH 037/406] . --- exp_legacy/module/config/bonus.lua | 116 +++++++++++++---------------- 1 file changed, 52 insertions(+), 64 deletions(-) diff --git a/exp_legacy/module/config/bonus.lua b/exp_legacy/module/config/bonus.lua index c9b5220f..0f832ab7 100644 --- a/exp_legacy/module/config/bonus.lua +++ b/exp_legacy/module/config/bonus.lua @@ -10,26 +10,14 @@ return { Base point is equal to the amount of standard value in each parameter. CMMS CRS CCS CISB CHB CRDB PBR - STD 20 60 24 12 8 8 40 - = 172 + STD 30 90 32 20 16 12 60 + = 260 - MAX 40 120 48 24 16 16 80 - = 344 + MAX 60 180 64 40 32 24 120 + = 480 ]] pts = { - rate = { - ["Senior Administrator"] = 1.5, - ["Administrator"] = 1.4, - ["Senior Moderator"] = 1.3, - ["Moderator"] = 1.2, - ["Trainee Moderator"] = 1.2, - ["Board Member"] = 1.1, - ["Supporter"] = 1.1, - ["Partner"] = 1.1, - ["Senior Member"] = 1.1, - ["Member"] = 1, - }, - base = 172 + base = 260, }, gui_display_width = { half = 150, @@ -45,65 +33,65 @@ return { ["chb"] = "character_health_bonus", ["crdb"] = "character_reach_distance_bonus", --[[ - ["cpdb"] = "character_item_pickup_distance_bonus" + ['cpdb'] = 'character_item_pickup_distance_bonus', ]] }, player_special_bonus_rate = 300, player_special_bonus = { ["personal_battery_recharge"] = { -- 1 MW - value = 4, - max = 8, - scale = 0.5, - cost_scale = 1, - cost = 10, + value = 6, + max = 12, + scale = 1, + cost_scale = 4, + cost = 40, is_percentage = false, }, }, player_bonus = { ["character_mining_speed_modifier"] = { - value = 2, - max = 4, + value = 3, + max = 6, scale = 0.5, cost_scale = 1, cost = 10, is_percentage = true, }, ["character_running_speed_modifier"] = { - value = 1, - max = 2, + value = 1.5, + max = 3, scale = 0.25, cost_scale = 1, cost = 60, is_percentage = true, }, ["character_crafting_speed_modifier"] = { - value = 6, - max = 12, - scale = 0.5, + value = 8, + max = 16, + scale = 1, cost_scale = 1, cost = 4, is_percentage = true, }, ["character_inventory_slots_bonus"] = { - value = 60, - max = 120, - scale = 5, + value = 100, + max = 200, + scale = 10, cost_scale = 10, cost = 2, is_percentage = false, }, ["character_health_bonus"] = { - value = 100, - max = 200, - scale = 25, - cost_scale = 25, - cost = 2, + value = 200, + max = 400, + scale = 50, + cost_scale = 50, + cost = 4, is_percentage = false, }, ["character_reach_distance_bonus"] = { - value = 8, - max = 16, + value = 12, + max = 24, scale = 2, cost_scale = 1, cost = 1, @@ -114,7 +102,7 @@ return { }, }, --[[ - ["character_item_pickup_distance_bonus"] = { + ['character_item_pickup_distance_bonus'] = { value = 0, max = 20, scale = 1, @@ -122,7 +110,7 @@ return { cost = 1, is_percentage = false, }, - ["character_loot_pickup_distance_bonus"] = { + ['character_loot_pickup_distance_bonus'] = { value = 0, max = 20, scale = 1, @@ -130,7 +118,7 @@ return { cost = 1, is_percentage = false, }, - ["character_item_drop_distance_bonus"] = { + ['character_item_drop_distance_bonus'] = { value = 0, max = 20, scale = 1, @@ -142,7 +130,7 @@ return { }, force_bonus = { --[[ - ["character_mining_speed_modifier"] = { + ['character_mining_speed_modifier'] = { value = 0, max = 6, scale = 0.5, @@ -150,7 +138,7 @@ return { cost = 10, is_percentage = true, }, - ["character_running_speed_modifier"] = { + ['character_running_speed_modifier'] = { value = 0, max = 3, scale = 0.25, @@ -158,7 +146,7 @@ return { cost = 40, is_percentage = true, }, - ["character_crafting_speed_modifier"] = { + ['character_crafting_speed_modifier'] = { value = 0, max = 16, scale = 1, @@ -166,7 +154,7 @@ return { cost = 4, is_percentage = true, }, - ["character_inventory_slots_bonus"] = { + ['character_inventory_slots_bonus'] = { value = 0, max = 200, scale = 10, @@ -174,14 +162,14 @@ return { cost = 2, is_percentage = false, }, - ["character_health_bonus"] = { + ['character_health_bonus'] = { value = 0, max = 400, scale = 50, cost = 4, is_percentage = false, }, - ["character_reach_distance_bonus"] = { + ['character_reach_distance_bonus'] = { value = 0, max = 24, scale = 2, @@ -189,11 +177,11 @@ return { cost = 1, is_percentage = false, combined_bonus = { - "character_resource_reach_distance_bonus", - "character_build_distance_bonus", + 'character_resource_reach_distance_bonus', + 'character_build_distance_bonus', }, }, - ["worker_robots_speed_modifier"] = { + ['worker_robots_speed_modifier'] = { value = 0, max = 0, scale = 0, @@ -227,7 +215,7 @@ return { is_percentage = false, }, --[[ - ["character_item_pickup_distance_bonus"] = { + ['character_item_pickup_distance_bonus'] = { value = 0, max = 20, scale = 1, @@ -235,7 +223,7 @@ return { cost = 1, is_percentage = false, }, - ["character_loot_pickup_distance_bonus"] = { + ['character_loot_pickup_distance_bonus'] = { value = 0, max = 20, scale = 1, @@ -243,7 +231,7 @@ return { cost = 1, is_percentage = false, }, - ["character_item_drop_distance_bonus"] = { + ['character_item_drop_distance_bonus'] = { value = 0, max = 20, scale = 1, @@ -251,7 +239,7 @@ return { cost = 1, is_percentage = false, }, - ["character_trash_slot_count"] = { + ['character_trash_slot_count'] = { value = 0, max = 0, scale = 0, @@ -259,7 +247,7 @@ return { cost = 1, is_percentage = false, }, - ["mining_drill_productivity_bonus"] = { + ['mining_drill_productivity_bonus'] = { value = 0, max = 0, scale = 0, @@ -267,7 +255,7 @@ return { cost = 1, is_percentage = false, }, - ["train_braking_force_bonus"] = { + ['train_braking_force_bonus'] = { value = 0, max = 0, scale = 0, @@ -275,7 +263,7 @@ return { cost = 1, is_percentage = false, }, - ["laboratory_speed_modifier"] = { + ['laboratory_speed_modifier'] = { value = 0, max = 0, scale = 0, @@ -283,7 +271,7 @@ return { cost = 1, is_percentage = false, }, - ["laboratory_productivity_bonus"] = { + ['laboratory_productivity_bonus'] = { value = 0, max = 0, scale = 0, @@ -291,7 +279,7 @@ return { cost = 1, is_percentage = false, }, - ["inserter_stack_size_bonus"] = { + ['inserter_stack_size_bonus'] = { value = 0, max = 0, scale = 0, @@ -299,7 +287,7 @@ return { cost = 1, is_percentage = false, }, - ["stack_inserter_capacity_bonus"] = { + ['stack_inserter_capacity_bonus'] = { value = 0, max = 0, scale = 0, @@ -307,7 +295,7 @@ return { cost = 1, is_percentage = false, }, - ["artillery_range_modifier"] = { + ['artillery_range_modifier'] = { value = 0, max = 0, scale = 0, @@ -319,7 +307,7 @@ return { }, surface_bonus = { --[[ - ["solar_power_multiplier"] = { + ['solar_power_multiplier'] = { value = 1, max = 1000, scale = 1, From f5a830d1c6d62caef6c4657f2af192266dd965b9 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Wed, 1 Jan 2025 21:21:54 +0900 Subject: [PATCH 038/406] . --- exp_scenario/module/commands/research.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exp_scenario/module/commands/research.lua b/exp_scenario/module/commands/research.lua index 56a5b569..420a8741 100644 --- a/exp_scenario/module/commands/research.lua +++ b/exp_scenario/module/commands/research.lua @@ -26,7 +26,7 @@ function module.res_queue(force, silent) local res = force.technologies[config.bonus_inventory.res[config.mod_set].name] if #res_q < config.queue_amount then - for i = 1, config.queue_amount - #res_q do + for i = #res_q, config.queue_amount - 1 do force.add_research(res) if not silent then From 4a14972412d7b69dae56d1d7a355ac6e0abc0e3d Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Thu, 2 Jan 2025 14:39:21 +0900 Subject: [PATCH 039/406] . --- exp_legacy/module/modules/addons/tree-decon.lua | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/exp_legacy/module/modules/addons/tree-decon.lua b/exp_legacy/module/modules/addons/tree-decon.lua index 577b72fb..e886941d 100644 --- a/exp_legacy/module/modules/addons/tree-decon.lua +++ b/exp_legacy/module/modules/addons/tree-decon.lua @@ -103,6 +103,7 @@ Event.on_nth_tick(300, function() end) -- Clear trees when hit with a car +--- @param event EventData.on_entity_damaged Event.add(defines.events.on_entity_damaged, function(event) if not (event.damage_type.name == "impact" and event.force) then return @@ -117,12 +118,16 @@ Event.add(defines.events.on_entity_damaged, function(event) end local driver = event.cause.get_driver() + if not driver then return end + if driver.object_name ~= "LuaPlayer" then + driver = driver.player + if not driver then return end + end - if driver and driver.player then - if get_permission(driver.player.index) == "fast" and HasEnabledDecon:get(driver.player) then - event.entity.destroy() - else - event.entity.order_deconstruction(event.force, driver.player) - end + local allow = get_permission(driver.index) + if allow == "fast" and HasEnabledDecon:get(driver) then + event.entity.destroy() + else + event.entity.order_deconstruction(event.force, driver) end end) From 3e570b159970cb990da5acd0da56ea29b6f5e3b2 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Sat, 4 Jan 2025 13:22:40 +0900 Subject: [PATCH 040/406] . --- exp_legacy/module/modules/control/vlayer.lua | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/exp_legacy/module/modules/control/vlayer.lua b/exp_legacy/module/modules/control/vlayer.lua index c63a3e41..356967ad 100644 --- a/exp_legacy/module/modules/control/vlayer.lua +++ b/exp_legacy/module/modules/control/vlayer.lua @@ -332,7 +332,7 @@ end -- @tparam[opt] LuaPlayer player The player to show as the last user of the interface -- @treturn LuaEntity The entity that was created for the interface function vlayer.create_input_interface(surface, position, circuit, last_user) - local interface = surface.create_entity{ name = "logistic-chest-storage", position = position, force = "neutral" } + local interface = surface.create_entity{ name = "storage-chest", position = position, force = "neutral" } table.insert(vlayer_data.entity_interfaces.storage_input, interface) if last_user then @@ -391,7 +391,7 @@ end -- @tparam[opt] LuaPlayer player The player to show as the last user of the interface -- @treturn LuaEntity The entity that was created for the interface function vlayer.create_output_interface(surface, position, circuit, last_user) - local interface = surface.create_entity{ name = "logistic-chest-requester", position = position, force = "neutral" } + local interface = surface.create_entity{ name = "requester-chest", position = position, force = "neutral" } table.insert(vlayer_data.entity_interfaces.storage_output, interface) if last_user then @@ -682,7 +682,7 @@ end -- @treturn MapPosition The position the interface was at, or nil if no interface was found function vlayer.remove_interface(surface, position) local entities = surface.find_entities_filtered{ - name = { "logistic-chest-storage", "logistic-chest-requester", "constant-combinator", "electric-energy-interface" }, + name = { "storage-chest", "requester-chest", "constant-combinator", "electric-energy-interface" }, force = "neutral", position = position, radius = 2, @@ -699,7 +699,7 @@ function vlayer.remove_interface(surface, position) local pos = interface.position -- Return the type of interface removed and do some clean up - if name == "logistic-chest-storage" then + if name == "storage-chest" then local inventory = assert(interface.get_inventory(defines.inventory.chest)) ExpUtil.transfer_inventory_to_surface{ inventory = inventory, @@ -711,7 +711,7 @@ function vlayer.remove_interface(surface, position) interface.destroy() return "storage-input", pos - elseif name == "logistic-chest-requester" then + elseif name == "requester-chest" then local inventory = assert(interface.get_inventory(defines.inventory.chest)) ExpUtil.transfer_inventory_to_surface{ inventory = inventory, From baf9e3f2df350cb6efe4179bf9a1ab4a289b7909 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Tue, 7 Jan 2025 17:39:47 +0900 Subject: [PATCH 041/406] . --- exp_legacy/module/modules/addons/deconlog.lua | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/exp_legacy/module/modules/addons/deconlog.lua b/exp_legacy/module/modules/addons/deconlog.lua index 08c40b8f..8f42ad72 100644 --- a/exp_legacy/module/modules/addons/deconlog.lua +++ b/exp_legacy/module/modules/addons/deconlog.lua @@ -100,12 +100,15 @@ if config.fired_rocket then return end local ammo_inv = player.get_inventory(defines.inventory.character_ammo) --- @cast ammo_inv -nil - local item = ammo_inv[player.character.selected_gun_index] - if not item or not item.valid or not item.valid_for_read then - return - end - if item.name == "rocket" then - add_log(get_secs() .. "," .. player.name .. ",shot-rocket," .. pos_to_string(player.physical_position) .. "," .. pos_to_string(player.shooting_state.position)) + + if player.character then + local item = ammo_inv[player.character.selected_gun_index] + if not item or not item.valid or not item.valid_for_read then + return + end + if item.name == "rocket" then + add_log(get_secs() .. "," .. player.name .. ",shot-rocket," .. pos_to_string(player.physical_position) .. "," .. pos_to_string(player.shooting_state.position)) + end end end) end From fa3168e1ac9b7ecda574b70ff14a5bcef36a1c7b Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Tue, 7 Jan 2025 17:40:53 +0900 Subject: [PATCH 042/406] . --- exp_legacy/module/modules/addons/deconlog.lua | 1 - 1 file changed, 1 deletion(-) diff --git a/exp_legacy/module/modules/addons/deconlog.lua b/exp_legacy/module/modules/addons/deconlog.lua index 8f42ad72..337a42ed 100644 --- a/exp_legacy/module/modules/addons/deconlog.lua +++ b/exp_legacy/module/modules/addons/deconlog.lua @@ -100,7 +100,6 @@ if config.fired_rocket then return end local ammo_inv = player.get_inventory(defines.inventory.character_ammo) --- @cast ammo_inv -nil - if player.character then local item = ammo_inv[player.character.selected_gun_index] if not item or not item.valid or not item.valid_for_read then From 251e41bba5c27fc24cbd1143bb4cd7dd44b3eca8 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Tue, 7 Jan 2025 18:07:38 +0900 Subject: [PATCH 043/406] . --- exp_legacy/module/modules/addons/deconlog.lua | 50 ++++--------------- 1 file changed, 9 insertions(+), 41 deletions(-) diff --git a/exp_legacy/module/modules/addons/deconlog.lua b/exp_legacy/module/modules/addons/deconlog.lua index 337a42ed..9ffc67d4 100644 --- a/exp_legacy/module/modules/addons/deconlog.lua +++ b/exp_legacy/module/modules/addons/deconlog.lua @@ -102,52 +102,20 @@ if config.fired_rocket then local ammo_inv = player.get_inventory(defines.inventory.character_ammo) --- @cast ammo_inv -nil if player.character then local item = ammo_inv[player.character.selected_gun_index] + local item_name = "" if not item or not item.valid or not item.valid_for_read then return end if item.name == "rocket" then - add_log(get_secs() .. "," .. player.name .. ",shot-rocket," .. pos_to_string(player.physical_position) .. "," .. pos_to_string(player.shooting_state.position)) + item_name = "shot-rocket" + elseif item.name == "explosive-rocket" then + item_name = "shot-explosive-rocket" + elseif item.name == "atomic-bomb" then + item_name = "shot-nuke" + end + if item.name == "rocket" then + add_log(get_secs() .. "," .. player.name .. "," .. item_name .. "," .. pos_to_string(player.physical_position) .. "," .. pos_to_string(player.shooting_state.position)) end end end) end - -if config.fired_explosive_rocket then - Event.add(defines.events.on_player_ammo_inventory_changed, function(e) - local player = game.players[e.player_index] - - if Roles.player_has_flag(player, "deconlog-bypass") then - return - end - local ammo_inv = player.get_inventory(defines.inventory.character_ammo) --- @cast ammo_inv -nil - local item = ammo_inv[player.character.selected_gun_index] - - if not item or not item.valid or not item.valid_for_read then - return - end - if item.name == "explosive-rocket" then - add_log(get_secs() .. "," .. player.name .. ",shot-explosive-rocket," .. pos_to_string(player.physical_position) .. "," .. pos_to_string(player.shooting_state.position)) - end - end) -end - -if config.fired_nuke then - Event.add(defines.events.on_player_ammo_inventory_changed, function(e) - local player = game.players[e.player_index] - - if Roles.player_has_flag(player, "deconlog-bypass") then - return - end - - local ammo_inv = player.get_inventory(defines.inventory.character_ammo) --- @cast ammo_inv -nil - local item = ammo_inv[player.character.selected_gun_index] - - if not item or not item.valid or not item.valid_for_read then - return - end - - if item.name == "atomic-bomb" then - add_log(get_secs() .. "," .. player.name .. ",shot-nuke," .. pos_to_string(player.physical_position) .. "," .. pos_to_string(player.shooting_state.position)) - end - end) -end From 155721938e52a20cd0963b22f9bb270d2abf3105 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Tue, 7 Jan 2025 18:15:43 +0900 Subject: [PATCH 044/406] . --- exp_legacy/module/config/deconlog.lua | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/exp_legacy/module/config/deconlog.lua b/exp_legacy/module/config/deconlog.lua index c55dba24..19bcc54a 100644 --- a/exp_legacy/module/config/deconlog.lua +++ b/exp_legacy/module/config/deconlog.lua @@ -5,7 +5,5 @@ return { decon_area = true, --- @setting decon_area whether to log when an area is being deconstructed built_entity = true, --- @setting built_entity whether to log when an entity is built mined_entity = true, --- @setting mined_entity whether to log when an entity is mined - fired_rocket = true, --- @setting fired_nuke whether to log when a rocket is fired - fired_explosive_rocket = true, --- @setting fired_nuke whether to log when a explosive rocket is fired - fired_nuke = true, --- @setting fired_nuke whether to log when a nuke is fired + fired_rocket = true, --- @setting fired_nuke whether to log when any rocket is fired } From 11eb7152bdd8f8c467d8f29735af63d1a0a03c0e Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Tue, 7 Jan 2025 19:32:25 +0900 Subject: [PATCH 045/406] . --- exp_legacy/module/modules/addons/compilatron.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exp_legacy/module/modules/addons/compilatron.lua b/exp_legacy/module/modules/addons/compilatron.lua index aea060d1..e18e9993 100644 --- a/exp_legacy/module/modules/addons/compilatron.lua +++ b/exp_legacy/module/modules/addons/compilatron.lua @@ -44,7 +44,7 @@ local speech_bubble_async = local function circle_messages() for name, ent in pairs(Public.compilatrons) do if not ent.valid then - Public.spawn_compilatron(game.players[1].surface, name) + Public.spawn_compilatron(game.players[1].physical_surface, name) end local current_message = Public.current_messages[name] local msg_number From 664c9e67c0fbb3cf9012ae9a34f27484a1aae758 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Tue, 7 Jan 2025 19:35:02 +0900 Subject: [PATCH 046/406] . --- exp_legacy/module/modules/addons/compilatron.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exp_legacy/module/modules/addons/compilatron.lua b/exp_legacy/module/modules/addons/compilatron.lua index e18e9993..2fc08f5b 100644 --- a/exp_legacy/module/modules/addons/compilatron.lua +++ b/exp_legacy/module/modules/addons/compilatron.lua @@ -44,7 +44,7 @@ local speech_bubble_async = local function circle_messages() for name, ent in pairs(Public.compilatrons) do if not ent.valid then - Public.spawn_compilatron(game.players[1].physical_surface, name) + Public.spawn_compilatron(game.players[1].surface or game.surfaces[1], name) end local current_message = Public.current_messages[name] local msg_number From a38708c203545d8f0d6953a36d2bbf1837dd1239 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Tue, 7 Jan 2025 20:15:03 +0900 Subject: [PATCH 047/406] . --- exp_legacy/module/modules/addons/compilatron.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/exp_legacy/module/modules/addons/compilatron.lua b/exp_legacy/module/modules/addons/compilatron.lua index 2fc08f5b..9e06ae54 100644 --- a/exp_legacy/module/modules/addons/compilatron.lua +++ b/exp_legacy/module/modules/addons/compilatron.lua @@ -44,7 +44,7 @@ local speech_bubble_async = local function circle_messages() for name, ent in pairs(Public.compilatrons) do if not ent.valid then - Public.spawn_compilatron(game.players[1].surface or game.surfaces[1], name) + Public.spawn_compilatron(game.players[1].surface, name) end local current_message = Public.current_messages[name] local msg_number @@ -93,7 +93,7 @@ end -- @tparam LuaSurface surface the surface to spawn the compilatron on -- @tparam string location the location tag that is in the config file function Public.spawn_compilatron(surface, location) - local position = locations[location] + local position = locations[location] or { x = 0, y = 0 } local pos = surface.find_non_colliding_position("behemoth-biter", position, 1.5, 0.5) local compi = surface.create_entity{ name = "behemoth-biter", position = pos, force = game.forces.neutral } Public.add_compilatron(compi, location) From db70decbf30c044edf01d653045dd1004c68ac04 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Tue, 7 Jan 2025 21:54:33 +0900 Subject: [PATCH 048/406] . --- exp_legacy/module/modules/addons/compilatron.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/exp_legacy/module/modules/addons/compilatron.lua b/exp_legacy/module/modules/addons/compilatron.lua index 9e06ae54..9799c2c0 100644 --- a/exp_legacy/module/modules/addons/compilatron.lua +++ b/exp_legacy/module/modules/addons/compilatron.lua @@ -44,7 +44,7 @@ local speech_bubble_async = local function circle_messages() for name, ent in pairs(Public.compilatrons) do if not ent.valid then - Public.spawn_compilatron(game.players[1].surface, name) + Public.spawn_compilatron(game.players[1].surface or game.surfaces[1], name) end local current_message = Public.current_messages[name] local msg_number @@ -93,8 +93,8 @@ end -- @tparam LuaSurface surface the surface to spawn the compilatron on -- @tparam string location the location tag that is in the config file function Public.spawn_compilatron(surface, location) - local position = locations[location] or { x = 0, y = 0 } - local pos = surface.find_non_colliding_position("behemoth-biter", position, 1.5, 0.5) + local position = locations[location] + local pos = surface.find_non_colliding_position("behemoth-biter", position, 1.5, 0.5) or { x = 0, y = 0 } local compi = surface.create_entity{ name = "behemoth-biter", position = pos, force = game.forces.neutral } Public.add_compilatron(compi, location) end From 723f535ab62ae69ce650001efd4a62ff11545bd0 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Tue, 7 Jan 2025 22:55:27 +0900 Subject: [PATCH 049/406] . --- exp_legacy/module/config/deconlog.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/exp_legacy/module/config/deconlog.lua b/exp_legacy/module/config/deconlog.lua index 19bcc54a..c55dba24 100644 --- a/exp_legacy/module/config/deconlog.lua +++ b/exp_legacy/module/config/deconlog.lua @@ -5,5 +5,7 @@ return { decon_area = true, --- @setting decon_area whether to log when an area is being deconstructed built_entity = true, --- @setting built_entity whether to log when an entity is built mined_entity = true, --- @setting mined_entity whether to log when an entity is mined - fired_rocket = true, --- @setting fired_nuke whether to log when any rocket is fired + fired_rocket = true, --- @setting fired_nuke whether to log when a rocket is fired + fired_explosive_rocket = true, --- @setting fired_nuke whether to log when a explosive rocket is fired + fired_nuke = true, --- @setting fired_nuke whether to log when a nuke is fired } From a03df603025b21f450cbb788e8b47e221015a102 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Tue, 7 Jan 2025 22:59:50 +0900 Subject: [PATCH 050/406] . --- exp_legacy/module/modules/addons/deconlog.lua | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/exp_legacy/module/modules/addons/deconlog.lua b/exp_legacy/module/modules/addons/deconlog.lua index 9ffc67d4..202e7241 100644 --- a/exp_legacy/module/modules/addons/deconlog.lua +++ b/exp_legacy/module/modules/addons/deconlog.lua @@ -93,7 +93,7 @@ if config.mined_entity then end) end -if config.fired_rocket then +if config.fired_rocket or config.fired_explosive_rocket or config.fired_nuke then Event.add(defines.events.on_player_ammo_inventory_changed, function(e) local player = game.players[e.player_index] if Roles.player_has_flag(player, "deconlog-bypass") then @@ -102,20 +102,20 @@ if config.fired_rocket then local ammo_inv = player.get_inventory(defines.inventory.character_ammo) --- @cast ammo_inv -nil if player.character then local item = ammo_inv[player.character.selected_gun_index] - local item_name = "" + local action_name if not item or not item.valid or not item.valid_for_read then return end - if item.name == "rocket" then - item_name = "shot-rocket" - elseif item.name == "explosive-rocket" then - item_name = "shot-explosive-rocket" - elseif item.name == "atomic-bomb" then - item_name = "shot-nuke" - end - if item.name == "rocket" then - add_log(get_secs() .. "," .. player.name .. "," .. item_name .. "," .. pos_to_string(player.physical_position) .. "," .. pos_to_string(player.shooting_state.position)) + if config.fired_rocket and item.name == "rocket" then + action_name = ",shot-rocket," + elseif config.fired_explosive_rocket and item.name == "explosive-rocket" then + action_name = ",shot-explosive-rocket," + elseif config.fired_nuke and item.name == "atomic-bomb" then + action_name = ",shot-nuke," + else + return end + add_log(get_secs() .. "," .. player.name .. action_name .. pos_to_string(player.physical_position) .. "," .. pos_to_string(player.shooting_state.position)) end end) end From ce146be9869cb10665811f4716bae758357634a2 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Tue, 7 Jan 2025 23:01:21 +0900 Subject: [PATCH 051/406] . --- exp_legacy/module/modules/addons/compilatron.lua | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/exp_legacy/module/modules/addons/compilatron.lua b/exp_legacy/module/modules/addons/compilatron.lua index 9799c2c0..c72020fa 100644 --- a/exp_legacy/module/modules/addons/compilatron.lua +++ b/exp_legacy/module/modules/addons/compilatron.lua @@ -94,9 +94,11 @@ end -- @tparam string location the location tag that is in the config file function Public.spawn_compilatron(surface, location) local position = locations[location] - local pos = surface.find_non_colliding_position("behemoth-biter", position, 1.5, 0.5) or { x = 0, y = 0 } - local compi = surface.create_entity{ name = "behemoth-biter", position = pos, force = game.forces.neutral } - Public.add_compilatron(compi, location) + local pos = surface.find_non_colliding_position("behemoth-biter", position, 1.5, 0.5) + if pos then + local compi = surface.create_entity{ name = "behemoth-biter", position = pos, force = game.forces.neutral } + Public.add_compilatron(compi, location) + end end -- When the first player is created this will create all compilatrons that are resisted in the config From a6da3a74c2625ddb32606925c153ee7615f56903 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Wed, 8 Jan 2025 22:22:21 +0900 Subject: [PATCH 052/406] . --- exp_legacy/module/modules/addons/death-logger.lua | 2 +- exp_util/module/module_exports.lua | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/exp_legacy/module/modules/addons/death-logger.lua b/exp_legacy/module/modules/addons/death-logger.lua index a1b9531a..b735f8b8 100644 --- a/exp_legacy/module/modules/addons/death-logger.lua +++ b/exp_legacy/module/modules/addons/death-logger.lua @@ -155,7 +155,7 @@ if config.auto_collect_bodies then ExpUtil.transfer_inventory_to_surface{ inventory = inventory, surface = corpse.surface, - name = "iron-chest", + name = "steel-chest", allow_creation = true, } end) diff --git a/exp_util/module/module_exports.lua b/exp_util/module/module_exports.lua index a98b1e71..dc49b0e4 100644 --- a/exp_util/module/module_exports.lua +++ b/exp_util/module/module_exports.lua @@ -420,7 +420,7 @@ function ExpUtil.get_storage_for_stack(options) local current, count, entities = cache.current, cache.count, cache.entities for i = 1, cache.count do local entity = entities[((current + i - 1) % count) + 1] - if entity.can_insert(item) then + if entity and entity.can_insert(item) then cache.current = current + 1 return entity end From b3c19b8010d6d8a1a5dc699d329abb25438e9db3 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Wed, 8 Jan 2025 23:27:14 +0900 Subject: [PATCH 053/406] . --- exp_legacy/module/modules/addons/deconlog.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exp_legacy/module/modules/addons/deconlog.lua b/exp_legacy/module/modules/addons/deconlog.lua index 202e7241..10442420 100644 --- a/exp_legacy/module/modules/addons/deconlog.lua +++ b/exp_legacy/module/modules/addons/deconlog.lua @@ -99,8 +99,8 @@ if config.fired_rocket or config.fired_explosive_rocket or config.fired_nuke the if Roles.player_has_flag(player, "deconlog-bypass") then return end - local ammo_inv = player.get_inventory(defines.inventory.character_ammo) --- @cast ammo_inv -nil if player.character then + local ammo_inv = player.get_inventory(defines.inventory.character_ammo) --- @cast ammo_inv -nil local item = ammo_inv[player.character.selected_gun_index] local action_name if not item or not item.valid or not item.valid_for_read then From 7e7bf5708c03f29a057a449d3e11d5d9742f5703 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Wed, 8 Jan 2025 23:40:30 +0900 Subject: [PATCH 054/406] . --- exp_legacy/module/config/expcore/roles.lua | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/exp_legacy/module/config/expcore/roles.lua b/exp_legacy/module/config/expcore/roles.lua index 829163c1..58aad366 100644 --- a/exp_legacy/module/config/expcore/roles.lua +++ b/exp_legacy/module/config/expcore/roles.lua @@ -26,6 +26,7 @@ Roles.new_role("System", "SYS") :set_flag("is_spectator") :set_flag("report-immune") :set_flag("instant-respawn") + :set_flag("deconlog-bypass") :set_allow_all() Roles.new_role("Senior Administrator", "SAdmin") @@ -36,6 +37,7 @@ Roles.new_role("Senior Administrator", "SAdmin") :set_flag("is_spectator") :set_flag("report-immune") :set_flag("instant-respawn") + :set_flag("deconlog-bypass") :set_parent("Administrator") :set_allow_all() @@ -46,6 +48,7 @@ Roles.new_role("Administrator", "Admin") :set_flag("is_spectator") :set_flag("report-immune") :set_flag("instant-respawn") + :set_flag("deconlog-bypass") :set_parent("Senior Moderator") :allow{ "command/_rcon", @@ -62,6 +65,7 @@ Roles.new_role("Senior Moderator", "SMod") :set_flag("is_spectator") :set_flag("report-immune") :set_flag("instant-respawn") + :set_flag("deconlog-bypass") :set_parent("Moderator") :allow{ "gui/warp-list/bypass-proximity", @@ -76,6 +80,7 @@ Roles.new_role("Moderator", "Mod") :set_flag("is_spectator") :set_flag("report-immune") :set_flag("instant-respawn") + :set_flag("deconlog-bypass") :set_parent("Trainee Moderator") :allow{ } @@ -86,6 +91,7 @@ Roles.new_role("Trainee Moderator", "Trainee") :set_flag("is_admin") :set_flag("is_spectator") :set_flag("report-immune") + :set_flag("deconlog-bypass") :set_parent("Board Member") :allow{ "command/assign-role", @@ -132,6 +138,7 @@ Roles.new_role("Board Member", "Board") :set_flag("is_spectator") :set_flag("report-immune") :set_flag("instant-respawn") + :set_flag("deconlog-bypass") :set_parent("Supporter") :allow{ } @@ -140,6 +147,7 @@ Roles.new_role("Supporter", "Sup") :set_permission_group("Trusted") :set_custom_color{ r = 230, g = 99, b = 34 } :set_flag("is_spectator") + :set_flag("deconlog-bypass") :set_parent("Partner") :allow{ } @@ -148,6 +156,7 @@ Roles.new_role("Partner", "Part") :set_permission_group("Trusted") :set_custom_color{ r = 24, g = 172, b = 188 } :set_flag("is_spectator") + :set_flag("deconlog-bypass") :set_parent("Senior Member") :allow{ } @@ -156,6 +165,7 @@ Roles.new_role("Senior Member", "SMem") :set_permission_group("Trusted") :set_custom_color{ r = 24, g = 172, b = 188 } :set_flag("is_spectator") + :set_flag("deconlog-bypass") :set_parent("Member") :allow{ "command/set-join-message", @@ -195,6 +205,7 @@ local hours6, hours250 = 6 * 216000, 250 * 60 Roles.new_role("Veteran", "Vet") :set_permission_group("Trusted") :set_custom_color{ r = 140, g = 120, b = 200 } + :set_flag("deconlog-bypass") :set_parent("Regular") :allow{ "gui/surveillance", From 72c1d73a205d98c9ba991c5ada73fab3fdef7382 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Thu, 9 Jan 2025 00:09:22 +0900 Subject: [PATCH 055/406] . --- exp_legacy/module/modules/addons/deconlog.lua | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/exp_legacy/module/modules/addons/deconlog.lua b/exp_legacy/module/modules/addons/deconlog.lua index 10442420..4b2d3a34 100644 --- a/exp_legacy/module/modules/addons/deconlog.lua +++ b/exp_legacy/module/modules/addons/deconlog.lua @@ -24,8 +24,8 @@ local function pos_to_string(pos) return tostring(pos.x) .. "," .. tostring(pos.y) end -local function pos_to_gps_string(pos) - return "[gps=" .. string.format("%.1f", pos.x) .. "," .. string.format("%.1f", pos.y) .. "]" +local function pos_to_gps_string(pos, surface_name) + return "[gps=" .. string.format("%.1f", pos.x) .. "," .. string.format("%.1f", pos.y) .. "," .. surface_name "]" end --- Print a message to all players who match the value of admin @@ -59,9 +59,8 @@ if config.decon_area then print_to_players(true, { "deconlog.decon", player.name, - e.surface.localised_name, - pos_to_gps_string(e.area.left_top), - pos_to_gps_string(e.area.right_bottom), + pos_to_gps_string(e.area.left_top, e.surface.name), + pos_to_gps_string(e.area.right_bottom, e.surface.name), format_number(#items, false), }) end From 292870bf8cfa7854c2b54b61c2752a0bcabd02a2 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Thu, 9 Jan 2025 00:20:08 +0900 Subject: [PATCH 056/406] . --- exp_legacy/module/locale/en/addons.cfg | 2 +- exp_legacy/module/locale/zh-CN/addons.cfg | 2 +- exp_legacy/module/locale/zh-TW/addons.cfg | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/exp_legacy/module/locale/en/addons.cfg b/exp_legacy/module/locale/en/addons.cfg index 1a8152c5..ec45c6fa 100644 --- a/exp_legacy/module/locale/en/addons.cfg +++ b/exp_legacy/module/locale/en/addons.cfg @@ -92,4 +92,4 @@ add-l=[RES] __1__ at level __2__ has been researched add-n=[RES] __1__ has been researched [deconlog] -decon=__1__ tried to deconstruct on __2__ from __3__ to __4__ which has __5__ items. +decon=__1__ tried to deconstruct from __2__ to __3__ which has __4__ items. diff --git a/exp_legacy/module/locale/zh-CN/addons.cfg b/exp_legacy/module/locale/zh-CN/addons.cfg index 47c623ad..6d893451 100644 --- a/exp_legacy/module/locale/zh-CN/addons.cfg +++ b/exp_legacy/module/locale/zh-CN/addons.cfg @@ -92,4 +92,4 @@ add-l=[RES] __1__ at level __2__ has been researched add-n=[RES] __1__ has been researched [deconlog] -decon=__1__ 試圖拆除在 __2__ 上從 __3__ 到 __4__ ,有 __5__ 個物品。 +decon=__1__ 試圖拆除在 __2__ 到 __3__ ,有 __4__ 個物品。 diff --git a/exp_legacy/module/locale/zh-TW/addons.cfg b/exp_legacy/module/locale/zh-TW/addons.cfg index 47c623ad..6d893451 100644 --- a/exp_legacy/module/locale/zh-TW/addons.cfg +++ b/exp_legacy/module/locale/zh-TW/addons.cfg @@ -92,4 +92,4 @@ add-l=[RES] __1__ at level __2__ has been researched add-n=[RES] __1__ has been researched [deconlog] -decon=__1__ 試圖拆除在 __2__ 上從 __3__ 到 __4__ ,有 __5__ 個物品。 +decon=__1__ 試圖拆除在 __2__ 到 __3__ ,有 __4__ 個物品。 From b56b53c2689dee3202694fd80f217e4fbd4e8d1f Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Thu, 9 Jan 2025 03:10:11 +0900 Subject: [PATCH 057/406] . --- exp_util/module/module_exports.lua | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/exp_util/module/module_exports.lua b/exp_util/module/module_exports.lua index dc49b0e4..e66b8622 100644 --- a/exp_util/module/module_exports.lua +++ b/exp_util/module/module_exports.lua @@ -420,7 +420,29 @@ function ExpUtil.get_storage_for_stack(options) local current, count, entities = cache.current, cache.count, cache.entities for i = 1, cache.count do local entity = entities[((current + i - 1) % count) + 1] - if entity and entity.can_insert(item) then + --[[ + PR 349 https://github.com/explosivegaming/ExpCluster/pull/349 + + Error while running event level::on_character_corpse_expired (ID 103) + level/modules/exp_util/module_exports.lua:423: attempt to index local 'entity' (a nil value) + stack traceback: + level/modules/exp_util/module_exports.lua:423: in function 'get_storage_for_stack' + level/modules/exp_util/module_exports.lua:462: in function 'copy_items_to_surface' + level/modules/exp_util/module_exports.lua:495: in function 'transfer_inventory_to_surface' + ...vel__/modules/exp_legacy/modules/addons/death-logger.lua:155: in function 'handler' + level/modules/exp_legacy/utils/event.lua:22: in function 'handler' + core/lualib/event_handler.lua:47: in function + ]] + if entity == nil then + error("entity was nil, context:\n" .. ExpUtil.format_any({ + cache = cache, + i = i, + }, { + max_line_count = 0, + no_locale_strings = true + })) + end + if entity.can_insert(item) then cache.current = current + 1 return entity end From 64910c28216d828926ac75acbaa3c85e99e5514b Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Thu, 9 Jan 2025 03:11:32 +0900 Subject: [PATCH 058/406] . --- exp_legacy/module/modules/addons/deconlog.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exp_legacy/module/modules/addons/deconlog.lua b/exp_legacy/module/modules/addons/deconlog.lua index 4b2d3a34..f5d9bad0 100644 --- a/exp_legacy/module/modules/addons/deconlog.lua +++ b/exp_legacy/module/modules/addons/deconlog.lua @@ -25,7 +25,7 @@ local function pos_to_string(pos) end local function pos_to_gps_string(pos, surface_name) - return "[gps=" .. string.format("%.1f", pos.x) .. "," .. string.format("%.1f", pos.y) .. "," .. surface_name "]" + return "[gps=" .. string.format("%.1f", pos.x) .. "," .. string.format("%.1f", pos.y) .. "," .. surface_name .. "]" end --- Print a message to all players who match the value of admin From a02975853d218cbb036ab9df8a45a3cf66ba6cf4 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Thu, 9 Jan 2025 03:26:12 +0900 Subject: [PATCH 059/406] . --- exp_legacy/module/config/compilatron.lua | 10 +++++----- exp_legacy/module/locale/en/addons.cfg | 20 ++++++++++---------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/exp_legacy/module/config/compilatron.lua b/exp_legacy/module/config/compilatron.lua index 933b5571..7ed21abf 100644 --- a/exp_legacy/module/config/compilatron.lua +++ b/exp_legacy/module/config/compilatron.lua @@ -8,16 +8,16 @@ return { }, messages = { --- @setting messages the messages that each one will say, must be same name as its location ["Spawn"] = { - { "info.website" }, + -- { "info.website" }, { "info.read-readme" }, - { "info.discord" }, + -- { "info.discord" }, { "info.softmod" }, { "info.redmew" }, { "info.custom-commands" }, - { "info.status" }, + -- { "info.status" }, { "info.lhd" }, - { "info.github" }, - { "info.patreon" }, + -- { "info.github" }, + -- { "info.patreon" }, }, }, } diff --git a/exp_legacy/module/locale/en/addons.cfg b/exp_legacy/module/locale/en/addons.cfg index ec45c6fa..53a63fb8 100644 --- a/exp_legacy/module/locale/en/addons.cfg +++ b/exp_legacy/module/locale/en/addons.cfg @@ -7,20 +7,20 @@ player-health=__1__ player-damage=__1__ [links] -discord=https://discord.explosivegaming.nl -website=https://www.explosivegaming.nl -status=https://status.explosivegaming.nl -github=https://github.com/explosivegaming/scenario -patreon=https://www.patreon.com/ExpGaming +discord= +website= +status= +github= +patreon= [info] players-online=There are __1__ players online total-map-time=This map has been on for __1__ -discord=Join us on our discord at: https://discord.explosivegaming.nl -website=Please visit our website at: https://www.explosivegaming.nl -status=Want to check if out servers are down? Visit: https://status.explosivegaming.nl -github=Want to help improve our server with some extra features? Help us at: https://github.com/explosivegaming/scenario -patreon=Consider supporting our server at: https://www.patreon.com/ExpGaming +discord= +website= +status= +github= +patreon= custom-commands=We use custom commands, such as /tag and /me, use /chelp for more info. read-readme=Make sure you have read the information gui (It can be found through the info mark on the top left) softmod=We run a softmod on our servers. A softmod is a custom scenario that runs on this server, an example is the player list. From c168095249d2bcebeb80d7e3c5b4b4267b977f03 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Thu, 9 Jan 2025 03:37:46 +0900 Subject: [PATCH 060/406] . --- exp_legacy/module/config/compilatron.lua | 5 ++--- exp_legacy/module/locale/en/addons.cfg | 6 ++---- exp_legacy/module/locale/zh-CN/addons.cfg | 6 ++---- exp_legacy/module/locale/zh-TW/addons.cfg | 6 ++---- exp_legacy/module/modules/gui/readme.lua | 3 ++- 5 files changed, 10 insertions(+), 16 deletions(-) diff --git a/exp_legacy/module/config/compilatron.lua b/exp_legacy/module/config/compilatron.lua index 7ed21abf..af2360dd 100644 --- a/exp_legacy/module/config/compilatron.lua +++ b/exp_legacy/module/config/compilatron.lua @@ -12,11 +12,10 @@ return { { "info.read-readme" }, -- { "info.discord" }, { "info.softmod" }, - { "info.redmew" }, + -- { "info.redmew" }, { "info.custom-commands" }, - -- { "info.status" }, { "info.lhd" }, - -- { "info.github" }, + { "info.github" }, -- { "info.patreon" }, }, }, diff --git a/exp_legacy/module/locale/en/addons.cfg b/exp_legacy/module/locale/en/addons.cfg index 53a63fb8..e7a99783 100644 --- a/exp_legacy/module/locale/en/addons.cfg +++ b/exp_legacy/module/locale/en/addons.cfg @@ -9,8 +9,7 @@ player-damage=__1__ [links] discord= website= -status= -github= +github=https://github.com/PHIDIAS0303/ExpCluster patreon= [info] @@ -18,8 +17,7 @@ players-online=There are __1__ players online total-map-time=This map has been on for __1__ discord= website= -status= -github= +github=Want to help improve our server with some extra features? Help us at: https://github.com/PHIDIAS0303/ExpCluster patreon= custom-commands=We use custom commands, such as /tag and /me, use /chelp for more info. read-readme=Make sure you have read the information gui (It can be found through the info mark on the top left) diff --git a/exp_legacy/module/locale/zh-CN/addons.cfg b/exp_legacy/module/locale/zh-CN/addons.cfg index 6d893451..c2d4e1a9 100644 --- a/exp_legacy/module/locale/zh-CN/addons.cfg +++ b/exp_legacy/module/locale/zh-CN/addons.cfg @@ -9,8 +9,7 @@ player-damage=__1__ [links] discord= website= -status= -github= +github=https://github.com/PHIDIAS0303/ExpCluster patreon= [info] @@ -18,8 +17,7 @@ players-online=現在有 __1__ 人在線 total-map-time=地圖時間為 __1__ discord= website= -status= -github= +github=增加功能或回報錯誤: https://github.com/PHIDIAS0303/ExpCluster patreon= custom-commands=這裹使用了自制指令,如 /tag 和 /me。可使用 /chelp 查看更多。 read-readme=確保你已閱讀相關資訊。按左上 i 圖標可再次查看。 diff --git a/exp_legacy/module/locale/zh-TW/addons.cfg b/exp_legacy/module/locale/zh-TW/addons.cfg index 6d893451..c2d4e1a9 100644 --- a/exp_legacy/module/locale/zh-TW/addons.cfg +++ b/exp_legacy/module/locale/zh-TW/addons.cfg @@ -9,8 +9,7 @@ player-damage=__1__ [links] discord= website= -status= -github= +github=https://github.com/PHIDIAS0303/ExpCluster patreon= [info] @@ -18,8 +17,7 @@ players-online=現在有 __1__ 人在線 total-map-time=地圖時間為 __1__ discord= website= -status= -github= +github=增加功能或回報錯誤: https://github.com/PHIDIAS0303/ExpCluster patreon= custom-commands=這裹使用了自制指令,如 /tag 和 /me。可使用 /chelp 查看更多。 read-readme=確保你已閱讀相關資訊。按左上 i 圖標可再次查看。 diff --git a/exp_legacy/module/modules/gui/readme.lua b/exp_legacy/module/modules/gui/readme.lua index d144879f..f69a1698 100644 --- a/exp_legacy/module/modules/gui/readme.lua +++ b/exp_legacy/module/modules/gui/readme.lua @@ -236,7 +236,8 @@ define_tab({ "readme.servers-tab" }, { "readme.servers-tooltip" }, -- Add the external links local external_links = title_table(scroll_pane, 235, { "readme.servers-external" }, 2) - for _, key in ipairs{ "discord", "website", "patreon", "status", "github" } do + -- "discord", "website", "patreon", "github" + for _, key in ipairs{ "github" } do local upper_key = key:gsub("^%l", string.upper) Gui.centered_label(external_links, 110, upper_key) Gui.centered_label(external_links, 460, { "links." .. key }, { "readme.servers-open-in-browser" }) From 46bb73b927404f3ffa3228748d500e341b0236a3 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Thu, 9 Jan 2025 03:44:56 +0900 Subject: [PATCH 061/406] . --- exp_legacy/module/config/compilatron.lua | 6 ++---- exp_legacy/module/locale/en/addons.cfg | 12 +++++------- exp_legacy/module/locale/zh-CN/addons.cfg | 12 +++++------- exp_legacy/module/locale/zh-TW/addons.cfg | 12 +++++------- exp_legacy/module/modules/gui/readme.lua | 3 +-- 5 files changed, 18 insertions(+), 27 deletions(-) diff --git a/exp_legacy/module/config/compilatron.lua b/exp_legacy/module/config/compilatron.lua index af2360dd..d6500819 100644 --- a/exp_legacy/module/config/compilatron.lua +++ b/exp_legacy/module/config/compilatron.lua @@ -8,15 +8,13 @@ return { }, messages = { --- @setting messages the messages that each one will say, must be same name as its location ["Spawn"] = { - -- { "info.website" }, + { "info.website" }, { "info.read-readme" }, - -- { "info.discord" }, { "info.softmod" }, - -- { "info.redmew" }, { "info.custom-commands" }, { "info.lhd" }, { "info.github" }, - -- { "info.patreon" }, + { "info.graph" }, }, }, } diff --git a/exp_legacy/module/locale/en/addons.cfg b/exp_legacy/module/locale/en/addons.cfg index e7a99783..b92aace6 100644 --- a/exp_legacy/module/locale/en/addons.cfg +++ b/exp_legacy/module/locale/en/addons.cfg @@ -7,22 +7,20 @@ player-health=__1__ player-damage=__1__ [links] -discord= -website= +website=https://aperx.org +cloud=https://aperx.org +graph=https://graph.aperx.org/public-dashboards/1a0862cb7b544769b629a75c1b51b9f9 github=https://github.com/PHIDIAS0303/ExpCluster -patreon= [info] players-online=There are __1__ players online total-map-time=This map has been on for __1__ -discord= -website= +website=Please visit our website at: https://aperx.org +graph=Server data graph at: https://graph.aperx.org/public-dashboards/1a0862cb7b544769b629a75c1b51b9f9 github=Want to help improve our server with some extra features? Help us at: https://github.com/PHIDIAS0303/ExpCluster -patreon= custom-commands=We use custom commands, such as /tag and /me, use /chelp for more info. read-readme=Make sure you have read the information gui (It can be found through the info mark on the top left) softmod=We run a softmod on our servers. A softmod is a custom scenario that runs on this server, an example is the player list. -redmew=We don't talk about redmew here; they beat us to 1000 members ;-; lhd=All trains must be LHD! This is a long standing rule on our servers, please respect this. [warnings] diff --git a/exp_legacy/module/locale/zh-CN/addons.cfg b/exp_legacy/module/locale/zh-CN/addons.cfg index c2d4e1a9..30b8e659 100644 --- a/exp_legacy/module/locale/zh-CN/addons.cfg +++ b/exp_legacy/module/locale/zh-CN/addons.cfg @@ -7,22 +7,20 @@ player-health=__1__ player-damage=__1__ [links] -discord= -website= +website=https://aperx.org +cloud=https://aperx.org +graph=https://graph.aperx.org/public-dashboards/1a0862cb7b544769b629a75c1b51b9f9 github=https://github.com/PHIDIAS0303/ExpCluster -patreon= [info] players-online=現在有 __1__ 人在線 total-map-time=地圖時間為 __1__ -discord= -website= +website=訪問網站: https://aperx.org +graph=服務器資料圖表: https://graph.aperx.org/public-dashboards/1a0862cb7b544769b629a75c1b51b9f9 github=增加功能或回報錯誤: https://github.com/PHIDIAS0303/ExpCluster -patreon= custom-commands=這裹使用了自制指令,如 /tag 和 /me。可使用 /chelp 查看更多。 read-readme=確保你已閱讀相關資訊。按左上 i 圖標可再次查看。 softmod=這裹用了自設情境,是一種軟裝模組。 -redmew= lhd=列車必須是左則通行。這是本服務器長久以來的規則。 [warnings] diff --git a/exp_legacy/module/locale/zh-TW/addons.cfg b/exp_legacy/module/locale/zh-TW/addons.cfg index c2d4e1a9..30b8e659 100644 --- a/exp_legacy/module/locale/zh-TW/addons.cfg +++ b/exp_legacy/module/locale/zh-TW/addons.cfg @@ -7,22 +7,20 @@ player-health=__1__ player-damage=__1__ [links] -discord= -website= +website=https://aperx.org +cloud=https://aperx.org +graph=https://graph.aperx.org/public-dashboards/1a0862cb7b544769b629a75c1b51b9f9 github=https://github.com/PHIDIAS0303/ExpCluster -patreon= [info] players-online=現在有 __1__ 人在線 total-map-time=地圖時間為 __1__ -discord= -website= +website=訪問網站: https://aperx.org +graph=服務器資料圖表: https://graph.aperx.org/public-dashboards/1a0862cb7b544769b629a75c1b51b9f9 github=增加功能或回報錯誤: https://github.com/PHIDIAS0303/ExpCluster -patreon= custom-commands=這裹使用了自制指令,如 /tag 和 /me。可使用 /chelp 查看更多。 read-readme=確保你已閱讀相關資訊。按左上 i 圖標可再次查看。 softmod=這裹用了自設情境,是一種軟裝模組。 -redmew= lhd=列車必須是左則通行。這是本服務器長久以來的規則。 [warnings] diff --git a/exp_legacy/module/modules/gui/readme.lua b/exp_legacy/module/modules/gui/readme.lua index f69a1698..57dd2aac 100644 --- a/exp_legacy/module/modules/gui/readme.lua +++ b/exp_legacy/module/modules/gui/readme.lua @@ -236,8 +236,7 @@ define_tab({ "readme.servers-tab" }, { "readme.servers-tooltip" }, -- Add the external links local external_links = title_table(scroll_pane, 235, { "readme.servers-external" }, 2) - -- "discord", "website", "patreon", "github" - for _, key in ipairs{ "github" } do + for _, key in ipairs{ "website", "cloud", "graph", "github" } do local upper_key = key:gsub("^%l", string.upper) Gui.centered_label(external_links, 110, upper_key) Gui.centered_label(external_links, 460, { "links." .. key }, { "readme.servers-open-in-browser" }) From b9de395a44db2c2960f61e237989eca43179e520 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Thu, 9 Jan 2025 03:49:22 +0900 Subject: [PATCH 062/406] . --- exp_legacy/module/config/compilatron.lua | 5 +++-- exp_legacy/module/locale/en/addons.cfg | 3 ++- exp_legacy/module/locale/zh-CN/addons.cfg | 3 ++- exp_legacy/module/locale/zh-TW/addons.cfg | 3 ++- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/exp_legacy/module/config/compilatron.lua b/exp_legacy/module/config/compilatron.lua index d6500819..16c634e1 100644 --- a/exp_legacy/module/config/compilatron.lua +++ b/exp_legacy/module/config/compilatron.lua @@ -9,12 +9,13 @@ return { messages = { --- @setting messages the messages that each one will say, must be same name as its location ["Spawn"] = { { "info.website" }, + { "info.cloud" }, + { "info.github" }, + { "info.graph" }, { "info.read-readme" }, { "info.softmod" }, { "info.custom-commands" }, { "info.lhd" }, - { "info.github" }, - { "info.graph" }, }, }, } diff --git a/exp_legacy/module/locale/en/addons.cfg b/exp_legacy/module/locale/en/addons.cfg index b92aace6..55536dae 100644 --- a/exp_legacy/module/locale/en/addons.cfg +++ b/exp_legacy/module/locale/en/addons.cfg @@ -8,7 +8,7 @@ player-damage=__1__ [links] website=https://aperx.org -cloud=https://aperx.org +cloud=https://cloud.aperx.org/s/sTbiePpmGs7bRxB graph=https://graph.aperx.org/public-dashboards/1a0862cb7b544769b629a75c1b51b9f9 github=https://github.com/PHIDIAS0303/ExpCluster @@ -16,6 +16,7 @@ github=https://github.com/PHIDIAS0303/ExpCluster players-online=There are __1__ players online total-map-time=This map has been on for __1__ website=Please visit our website at: https://aperx.org +cloud=Server save files: https://cloud.aperx.org/s/sTbiePpmGs7bRxB graph=Server data graph at: https://graph.aperx.org/public-dashboards/1a0862cb7b544769b629a75c1b51b9f9 github=Want to help improve our server with some extra features? Help us at: https://github.com/PHIDIAS0303/ExpCluster custom-commands=We use custom commands, such as /tag and /me, use /chelp for more info. diff --git a/exp_legacy/module/locale/zh-CN/addons.cfg b/exp_legacy/module/locale/zh-CN/addons.cfg index 30b8e659..3fd1dcae 100644 --- a/exp_legacy/module/locale/zh-CN/addons.cfg +++ b/exp_legacy/module/locale/zh-CN/addons.cfg @@ -8,7 +8,7 @@ player-damage=__1__ [links] website=https://aperx.org -cloud=https://aperx.org +cloud=https://cloud.aperx.org/s/sTbiePpmGs7bRxB graph=https://graph.aperx.org/public-dashboards/1a0862cb7b544769b629a75c1b51b9f9 github=https://github.com/PHIDIAS0303/ExpCluster @@ -16,6 +16,7 @@ github=https://github.com/PHIDIAS0303/ExpCluster players-online=現在有 __1__ 人在線 total-map-time=地圖時間為 __1__ website=訪問網站: https://aperx.org +cloud=服務器存檔: https://cloud.aperx.org/s/sTbiePpmGs7bRxB graph=服務器資料圖表: https://graph.aperx.org/public-dashboards/1a0862cb7b544769b629a75c1b51b9f9 github=增加功能或回報錯誤: https://github.com/PHIDIAS0303/ExpCluster custom-commands=這裹使用了自制指令,如 /tag 和 /me。可使用 /chelp 查看更多。 diff --git a/exp_legacy/module/locale/zh-TW/addons.cfg b/exp_legacy/module/locale/zh-TW/addons.cfg index 30b8e659..3fd1dcae 100644 --- a/exp_legacy/module/locale/zh-TW/addons.cfg +++ b/exp_legacy/module/locale/zh-TW/addons.cfg @@ -8,7 +8,7 @@ player-damage=__1__ [links] website=https://aperx.org -cloud=https://aperx.org +cloud=https://cloud.aperx.org/s/sTbiePpmGs7bRxB graph=https://graph.aperx.org/public-dashboards/1a0862cb7b544769b629a75c1b51b9f9 github=https://github.com/PHIDIAS0303/ExpCluster @@ -16,6 +16,7 @@ github=https://github.com/PHIDIAS0303/ExpCluster players-online=現在有 __1__ 人在線 total-map-time=地圖時間為 __1__ website=訪問網站: https://aperx.org +cloud=服務器存檔: https://cloud.aperx.org/s/sTbiePpmGs7bRxB graph=服務器資料圖表: https://graph.aperx.org/public-dashboards/1a0862cb7b544769b629a75c1b51b9f9 github=增加功能或回報錯誤: https://github.com/PHIDIAS0303/ExpCluster custom-commands=這裹使用了自制指令,如 /tag 和 /me。可使用 /chelp 查看更多。 From f0b066cdfe0be783183fe4bebde63fb86125954c Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Thu, 9 Jan 2025 14:07:40 +0900 Subject: [PATCH 063/406] . --- exp_util/module/module_exports.lua | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/exp_util/module/module_exports.lua b/exp_util/module/module_exports.lua index e66b8622..01c14397 100644 --- a/exp_util/module/module_exports.lua +++ b/exp_util/module/module_exports.lua @@ -420,20 +420,8 @@ function ExpUtil.get_storage_for_stack(options) local current, count, entities = cache.current, cache.count, cache.entities for i = 1, cache.count do local entity = entities[((current + i - 1) % count) + 1] - --[[ - PR 349 https://github.com/explosivegaming/ExpCluster/pull/349 - - Error while running event level::on_character_corpse_expired (ID 103) - level/modules/exp_util/module_exports.lua:423: attempt to index local 'entity' (a nil value) - stack traceback: - level/modules/exp_util/module_exports.lua:423: in function 'get_storage_for_stack' - level/modules/exp_util/module_exports.lua:462: in function 'copy_items_to_surface' - level/modules/exp_util/module_exports.lua:495: in function 'transfer_inventory_to_surface' - ...vel__/modules/exp_legacy/modules/addons/death-logger.lua:155: in function 'handler' - level/modules/exp_legacy/utils/event.lua:22: in function 'handler' - core/lualib/event_handler.lua:47: in function - ]] if entity == nil then + -- See Github Issue #352 error("entity was nil, context:\n" .. ExpUtil.format_any({ cache = cache, i = i, From f1868e883cc1913674ace6a8666e0b5a9979b780 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Thu, 9 Jan 2025 14:42:32 +0900 Subject: [PATCH 064/406] . --- exp_legacy/module/config/compilatron.lua | 2 -- exp_legacy/module/locale/en/addons.cfg | 6 ++---- exp_legacy/module/locale/zh-CN/addons.cfg | 6 ++---- exp_legacy/module/locale/zh-TW/addons.cfg | 6 ++---- exp_legacy/module/modules/gui/readme.lua | 2 +- 5 files changed, 7 insertions(+), 15 deletions(-) diff --git a/exp_legacy/module/config/compilatron.lua b/exp_legacy/module/config/compilatron.lua index 16c634e1..75e857cc 100644 --- a/exp_legacy/module/config/compilatron.lua +++ b/exp_legacy/module/config/compilatron.lua @@ -9,9 +9,7 @@ return { messages = { --- @setting messages the messages that each one will say, must be same name as its location ["Spawn"] = { { "info.website" }, - { "info.cloud" }, { "info.github" }, - { "info.graph" }, { "info.read-readme" }, { "info.softmod" }, { "info.custom-commands" }, diff --git a/exp_legacy/module/locale/en/addons.cfg b/exp_legacy/module/locale/en/addons.cfg index 55536dae..de90722d 100644 --- a/exp_legacy/module/locale/en/addons.cfg +++ b/exp_legacy/module/locale/en/addons.cfg @@ -8,17 +8,15 @@ player-damage=__1__ [links] website=https://aperx.org -cloud=https://cloud.aperx.org/s/sTbiePpmGs7bRxB -graph=https://graph.aperx.org/public-dashboards/1a0862cb7b544769b629a75c1b51b9f9 github=https://github.com/PHIDIAS0303/ExpCluster +discord= [info] players-online=There are __1__ players online total-map-time=This map has been on for __1__ website=Please visit our website at: https://aperx.org -cloud=Server save files: https://cloud.aperx.org/s/sTbiePpmGs7bRxB -graph=Server data graph at: https://graph.aperx.org/public-dashboards/1a0862cb7b544769b629a75c1b51b9f9 github=Want to help improve our server with some extra features? Help us at: https://github.com/PHIDIAS0303/ExpCluster +discord= custom-commands=We use custom commands, such as /tag and /me, use /chelp for more info. read-readme=Make sure you have read the information gui (It can be found through the info mark on the top left) softmod=We run a softmod on our servers. A softmod is a custom scenario that runs on this server, an example is the player list. diff --git a/exp_legacy/module/locale/zh-CN/addons.cfg b/exp_legacy/module/locale/zh-CN/addons.cfg index 3fd1dcae..10a3b5cb 100644 --- a/exp_legacy/module/locale/zh-CN/addons.cfg +++ b/exp_legacy/module/locale/zh-CN/addons.cfg @@ -8,17 +8,15 @@ player-damage=__1__ [links] website=https://aperx.org -cloud=https://cloud.aperx.org/s/sTbiePpmGs7bRxB -graph=https://graph.aperx.org/public-dashboards/1a0862cb7b544769b629a75c1b51b9f9 github=https://github.com/PHIDIAS0303/ExpCluster +discord= [info] players-online=現在有 __1__ 人在線 total-map-time=地圖時間為 __1__ website=訪問網站: https://aperx.org -cloud=服務器存檔: https://cloud.aperx.org/s/sTbiePpmGs7bRxB -graph=服務器資料圖表: https://graph.aperx.org/public-dashboards/1a0862cb7b544769b629a75c1b51b9f9 github=增加功能或回報錯誤: https://github.com/PHIDIAS0303/ExpCluster +discord= custom-commands=這裹使用了自制指令,如 /tag 和 /me。可使用 /chelp 查看更多。 read-readme=確保你已閱讀相關資訊。按左上 i 圖標可再次查看。 softmod=這裹用了自設情境,是一種軟裝模組。 diff --git a/exp_legacy/module/locale/zh-TW/addons.cfg b/exp_legacy/module/locale/zh-TW/addons.cfg index 3fd1dcae..10a3b5cb 100644 --- a/exp_legacy/module/locale/zh-TW/addons.cfg +++ b/exp_legacy/module/locale/zh-TW/addons.cfg @@ -8,17 +8,15 @@ player-damage=__1__ [links] website=https://aperx.org -cloud=https://cloud.aperx.org/s/sTbiePpmGs7bRxB -graph=https://graph.aperx.org/public-dashboards/1a0862cb7b544769b629a75c1b51b9f9 github=https://github.com/PHIDIAS0303/ExpCluster +discord= [info] players-online=現在有 __1__ 人在線 total-map-time=地圖時間為 __1__ website=訪問網站: https://aperx.org -cloud=服務器存檔: https://cloud.aperx.org/s/sTbiePpmGs7bRxB -graph=服務器資料圖表: https://graph.aperx.org/public-dashboards/1a0862cb7b544769b629a75c1b51b9f9 github=增加功能或回報錯誤: https://github.com/PHIDIAS0303/ExpCluster +discord= custom-commands=這裹使用了自制指令,如 /tag 和 /me。可使用 /chelp 查看更多。 read-readme=確保你已閱讀相關資訊。按左上 i 圖標可再次查看。 softmod=這裹用了自設情境,是一種軟裝模組。 diff --git a/exp_legacy/module/modules/gui/readme.lua b/exp_legacy/module/modules/gui/readme.lua index 57dd2aac..e77fb45f 100644 --- a/exp_legacy/module/modules/gui/readme.lua +++ b/exp_legacy/module/modules/gui/readme.lua @@ -236,7 +236,7 @@ define_tab({ "readme.servers-tab" }, { "readme.servers-tooltip" }, -- Add the external links local external_links = title_table(scroll_pane, 235, { "readme.servers-external" }, 2) - for _, key in ipairs{ "website", "cloud", "graph", "github" } do + for _, key in ipairs{ "website", "github" } do local upper_key = key:gsub("^%l", string.upper) Gui.centered_label(external_links, 110, upper_key) Gui.centered_label(external_links, 460, { "links." .. key }, { "readme.servers-open-in-browser" }) From 0a61893f68d12426d77d91743d534da81f8e5f37 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Thu, 9 Jan 2025 19:46:21 +0900 Subject: [PATCH 065/406] . --- exp_legacy/module/locale/en/gui.cfg | 15 +++++--------- exp_legacy/module/locale/zh-CN/gui.cfg | 25 ++++++++++-------------- exp_legacy/module/locale/zh-TW/gui.cfg | 25 ++++++++++-------------- exp_legacy/module/modules/gui/readme.lua | 10 +++++----- 4 files changed, 30 insertions(+), 45 deletions(-) diff --git a/exp_legacy/module/locale/en/gui.cfg b/exp_legacy/module/locale/en/gui.cfg index 30f4cfc3..0e9058bf 100644 --- a/exp_legacy/module/locale/en/gui.cfg +++ b/exp_legacy/module/locale/en/gui.cfg @@ -163,21 +163,17 @@ servers-tooltip=Links to our other servers and sites servers-general=This is only one of our servers for factorio, we host many of others as well. Below you can find details about all the servers that we host as well as links to our external services such as discord or github. servers-factorio=Factorio Servers servers-1=S1 -servers-d1=This server resets weekly. +servers-d1=This server resets regularly. servers-2=S2 -servers-d2=This server resets weekly. +servers-d2=This server resets regularly. servers-3=S3 -servers-d3=This server resets weekly. -servers-4= -servers-d4= +servers-d3=This server resets regularly. servers-5=S5 servers-d5=This server is only for members. Check discord for more details. servers-6=S6 servers-d6=This server is only for members. Check discord for more details. -servers-7= -servers-d7= servers-8=S8 -servers-d8= +servers-d8=This server is only for event and others. Check discord for more details. servers-connect-Offline=Server is currently offline servers-connect-Current=This is your current server servers-connect-Version=Server is on a different version: __1__ @@ -190,9 +186,8 @@ backers-tab=Backers backers-tooltip=People who have helped make our server backers-general=We would like to thank all our staff and backers who have helped our community grow. Our staff have helped to keep our servers safe from trolls and a fun place to play. Our backers have helped us to cover our running costs and provide a great community for us all to enjoy together. backers-management=Administrators -backers-board=Board Members and Senior Backers backers-staff=Staff Members -backers-backers=Sponsors and Supporters +backers-backers=Board Members, Supporters, and Partners backers-active=Active Players data-tab=Data data-tooltip=All of your stored player data diff --git a/exp_legacy/module/locale/zh-CN/gui.cfg b/exp_legacy/module/locale/zh-CN/gui.cfg index 1acf3709..657363f1 100644 --- a/exp_legacy/module/locale/zh-CN/gui.cfg +++ b/exp_legacy/module/locale/zh-CN/gui.cfg @@ -163,21 +163,17 @@ servers-tooltip=到其他伺服器及網站的連結 servers-general=這是其中一個伺服器。你可以在下方找到其他同樣是由我們運行的伺服器資料。 servers-factorio=異星工廠伺服器 servers-1=S1 -servers-d1=這個服務器每兩週重設。 +servers-d1=這個服務器定期重設。 servers-2=S2 -servers-d2=這個服務器每兩週重設。 +servers-d2=這個服務器定期重設。 servers-3=S3 -servers-d3=這個服務器每兩週重設。 -servers-4= -servers-d4= -servers-5=S5 會員 -servers-d5=這個服務器為會員運行,可在 Discord 中得到更多資訊。 -servers-6=S6 藍圖 -servers-d6=這個服務器為會員運行,可在 Discord 中得到更多資訊。 -servers-7= -servers-d7= +servers-d3=這個服務器定期重設。 +servers-5=S5 +servers-d5=這個服務器只為會員運行,可在 Discord 中得到更多資訊。 +servers-6=S6 +servers-d6=這個服務器只為會員運行,可在 Discord 中得到更多資訊。 servers-8=S8 -servers-d8= +servers-d8=這個服務器只在活動和其他時運行,可在 Discord 中得到更多資訊。 servers-connect-Offline=該服務器目前沒有在運行 servers-connect-Current=你目前所在的伺服器 servers-connect-Version=該服務器運行不同的遊戲版本: __1__ @@ -189,10 +185,9 @@ servers-open-in-browser=可在你的瀏覽器中打開 backers-tab=支持者 backers-tooltip=支持者 backers-general=他們為服務器運行提供了不少幫助。 -backers-management=系統管理員 -backers-board=議員 +backers-management=管理員 backers-staff=職員 -backers-backers=支持者 +backers-backers=議員,支持者,和夥伴 backers-active=活躍玩家 data-tab=資料 data-tooltip=所有已存資料 diff --git a/exp_legacy/module/locale/zh-TW/gui.cfg b/exp_legacy/module/locale/zh-TW/gui.cfg index 1acf3709..657363f1 100644 --- a/exp_legacy/module/locale/zh-TW/gui.cfg +++ b/exp_legacy/module/locale/zh-TW/gui.cfg @@ -163,21 +163,17 @@ servers-tooltip=到其他伺服器及網站的連結 servers-general=這是其中一個伺服器。你可以在下方找到其他同樣是由我們運行的伺服器資料。 servers-factorio=異星工廠伺服器 servers-1=S1 -servers-d1=這個服務器每兩週重設。 +servers-d1=這個服務器定期重設。 servers-2=S2 -servers-d2=這個服務器每兩週重設。 +servers-d2=這個服務器定期重設。 servers-3=S3 -servers-d3=這個服務器每兩週重設。 -servers-4= -servers-d4= -servers-5=S5 會員 -servers-d5=這個服務器為會員運行,可在 Discord 中得到更多資訊。 -servers-6=S6 藍圖 -servers-d6=這個服務器為會員運行,可在 Discord 中得到更多資訊。 -servers-7= -servers-d7= +servers-d3=這個服務器定期重設。 +servers-5=S5 +servers-d5=這個服務器只為會員運行,可在 Discord 中得到更多資訊。 +servers-6=S6 +servers-d6=這個服務器只為會員運行,可在 Discord 中得到更多資訊。 servers-8=S8 -servers-d8= +servers-d8=這個服務器只在活動和其他時運行,可在 Discord 中得到更多資訊。 servers-connect-Offline=該服務器目前沒有在運行 servers-connect-Current=你目前所在的伺服器 servers-connect-Version=該服務器運行不同的遊戲版本: __1__ @@ -189,10 +185,9 @@ servers-open-in-browser=可在你的瀏覽器中打開 backers-tab=支持者 backers-tooltip=支持者 backers-general=他們為服務器運行提供了不少幫助。 -backers-management=系統管理員 -backers-board=議員 +backers-management=管理員 backers-staff=職員 -backers-backers=支持者 +backers-backers=議員,支持者,和夥伴 backers-active=活躍玩家 data-tab=資料 data-tooltip=所有已存資料 diff --git a/exp_legacy/module/modules/gui/readme.lua b/exp_legacy/module/modules/gui/readme.lua index e77fb45f..c5a266ee 100644 --- a/exp_legacy/module/modules/gui/readme.lua +++ b/exp_legacy/module/modules/gui/readme.lua @@ -228,7 +228,7 @@ define_tab({ "readme.servers-tab" }, { "readme.servers-tooltip" }, end else local factorio_servers = title_table(scroll_pane, 225, { "readme.servers-factorio" }, 2) - for i = 1, 8 do + for _, i in pairs{ 1, 2, 3, 5, 6, 8 } do Gui.centered_label(factorio_servers, 110, { "readme.servers-" .. i }) Gui.centered_label(factorio_servers, 460, { "readme.servers-d" .. i }) end @@ -261,10 +261,10 @@ define_tab({ "readme.backers-tab" }, { "readme.backers-tooltip" }, local done = {} local groups = { { _roles = { "Senior Administrator", "Administrator" }, _title = { "readme.backers-management" }, _width = 230 }, - { _roles = { "Board Member", "Senior Backer" }, _title = { "readme.backers-board" }, _width = 145 }, -- change role to board - { _roles = { "Sponsor", "Supporter" }, _title = { "readme.backers-backers" }, _width = 196 }, -- change to backer - { _roles = { "Moderator", "Trainee" }, _title = { "readme.backers-staff" }, _width = 235 }, - { _roles = {}, _time = 3 * 3600 * 60, _title = { "readme.backers-active" }, _width = 235 }, + { _roles = { "Senior Moderator", "Moderator", "Trainee Moderator" }, _title = { "readme.backers-staff" }, _width = 230 }, + { _roles = { "Board Member", "Supporter", "Partner" }, _title = { "readme.backers-backers" }, _width = 230 }, -- change role to board + { _roles = { "Veteran" }, _title = { "readme.backers-active" }, _width = 230 }, + -- _time = 3 * 3600 * 60 } -- Fill by player roles From dee2600eecc81e9e7557c6af2272563b9622e725 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Thu, 9 Jan 2025 20:27:47 +0900 Subject: [PATCH 066/406] . --- exp_legacy/module/modules/control/vlayer.lua | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/exp_legacy/module/modules/control/vlayer.lua b/exp_legacy/module/modules/control/vlayer.lua index 356967ad..c9679566 100644 --- a/exp_legacy/module/modules/control/vlayer.lua +++ b/exp_legacy/module/modules/control/vlayer.lua @@ -558,18 +558,17 @@ local function handle_circuit_interfaces() vlayer_data.entity_interfaces.circuit[index] = nil else local circuit_oc = interface.get_or_create_control_behavior() - local max_signals = circuit_oc.signals_count local signal_index = 1 local circuit = vlayer.get_circuits() -- Set the virtual signals based on the vlayer stats for stat_name, signal_name in pairs(circuit) do if stat_name:find("energy") then - circuit_oc.set_signal(signal_index, { signal = { type = "virtual", name = signal_name }, count = math.floor(stats[stat_name] / mega) }) + circuit_oc.set_slot(signal_index, { signal = { type = "virtual", name = signal_name }, count = math.floor(stats[stat_name] / mega) }) elseif stat_name == "production_multiplier" then - circuit_oc.set_signal(signal_index, { signal = { type = "virtual", name = signal_name }, count = math.floor(stats[stat_name] * 10000) }) + circuit_oc.set_slot(signal_index, { signal = { type = "virtual", name = signal_name }, count = math.floor(stats[stat_name] * 10000) }) else - circuit_oc.set_signal(signal_index, { signal = { type = "virtual", name = signal_name }, count = math.floor(stats[stat_name]) }) + circuit_oc.set_slot(signal_index, { signal = { type = "virtual", name = signal_name }, count = math.floor(stats[stat_name]) }) end signal_index = signal_index + 1 @@ -578,21 +577,18 @@ local function handle_circuit_interfaces() -- Set the item signals based on stored items for item_name, count in pairs(vlayer_data.storage.items) do if prototypes.item[item_name] and count > 0 then - circuit_oc.set_signal(signal_index, { signal = { type = "item", name = item_name }, count = count }) + circuit_oc.set_slot(signal_index, { signal = { type = "item", name = item_name }, count = count }) signal_index = signal_index + 1 - if signal_index > max_signals then - return -- No more signals can be added - end end end -- Clear remaining signals to prevent outdated values being present (caused by count > 0 check) - for clear_index = signal_index, max_signals do - if not circuit_oc.get_signal(clear_index).signal then + for clear_index = signal_index, #circuit do + if not circuit_oc.get_slot(clear_index).signal then break -- There are no more signals to clear end - circuit_oc.set_signal(clear_index, nil) + circuit_oc.clear_slot(clear_index) end end end From 6d449363642a5581288317bee7b985314d96e6a7 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Thu, 9 Jan 2025 20:32:26 +0900 Subject: [PATCH 067/406] . --- exp_legacy/module/modules/control/vlayer.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exp_legacy/module/modules/control/vlayer.lua b/exp_legacy/module/modules/control/vlayer.lua index c9679566..6afaf8a7 100644 --- a/exp_legacy/module/modules/control/vlayer.lua +++ b/exp_legacy/module/modules/control/vlayer.lua @@ -557,7 +557,7 @@ local function handle_circuit_interfaces() if not interface.valid then vlayer_data.entity_interfaces.circuit[index] = nil else - local circuit_oc = interface.get_or_create_control_behavior() + local circuit_oc = interface.get_or_create_control_behavior().sections[1] local signal_index = 1 local circuit = vlayer.get_circuits() From 64ca88a1984ed602344941e6674d9279acd0238f Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Thu, 9 Jan 2025 21:58:32 +0900 Subject: [PATCH 068/406] . --- exp_legacy/module/modules/control/vlayer.lua | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/exp_legacy/module/modules/control/vlayer.lua b/exp_legacy/module/modules/control/vlayer.lua index 6afaf8a7..ebd833f0 100644 --- a/exp_legacy/module/modules/control/vlayer.lua +++ b/exp_legacy/module/modules/control/vlayer.lua @@ -132,17 +132,17 @@ function vlayer.get_interfaces() end --[[ - 25,000 / 416 s + 25,200 / 420 s 昼 208秒 ソーラー効率100% 夕方 83秒 1秒ごとにソーラー発電量が約1.2%ずつ下がり、やがて0%になる 夜 41秒 ソーラー発電量が0%になる 朝方 83秒 1秒ごとにソーラー発電量が約1.2%ずつ上がり、やがて100%になる - (surface.dawn) 0.75 18,750 Day 12,500 208s + (surface.dawn) 0.75 18,900 Day 12,600 210s 0.00 0 Noon - (surface.dusk) 0.25 6,250 Sunset 5,000 83s - (surface.evening) 0.45 11,250 Night 2,500 41s - (surface.morning) 0.55 13,750 Sunrise 5,000 83s + (surface.dusk) 0.25 6,300 Sunset 5,040 84s + (surface.evening) 0.45 11,340 Night 2,520 42s + (surface.morning) 0.55 13,860 Sunrise 5,040 84s ]] --- Get the power multiplier based on the surface time From f0172f62703fe97d164a01956830a73c41ea867c Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Thu, 9 Jan 2025 22:00:17 +0900 Subject: [PATCH 069/406] . --- exp_legacy/module/modules/control/vlayer.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exp_legacy/module/modules/control/vlayer.lua b/exp_legacy/module/modules/control/vlayer.lua index ebd833f0..1d332031 100644 --- a/exp_legacy/module/modules/control/vlayer.lua +++ b/exp_legacy/module/modules/control/vlayer.lua @@ -194,7 +194,7 @@ local function get_sustained_multiplier() return mul end - -- For nauvis vanilla: 208s + (1/2 x (83s + 83s)) + -- For nauvis vanilla: 210s + (1/2 x (84s + 84s)) local day_duration = 1 - surface.dawn + surface.dusk local sunset_duration = surface.evening - surface.dusk local sunrise_duration = surface.dawn - surface.morning From 62ac9a640629a94ec383653e3ff0d7cb8e9b7756 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Thu, 9 Jan 2025 22:25:49 +0900 Subject: [PATCH 070/406] . --- exp_legacy/module/modules/control/vlayer.lua | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/exp_legacy/module/modules/control/vlayer.lua b/exp_legacy/module/modules/control/vlayer.lua index 1d332031..cc843e92 100644 --- a/exp_legacy/module/modules/control/vlayer.lua +++ b/exp_legacy/module/modules/control/vlayer.lua @@ -564,11 +564,11 @@ local function handle_circuit_interfaces() -- Set the virtual signals based on the vlayer stats for stat_name, signal_name in pairs(circuit) do if stat_name:find("energy") then - circuit_oc.set_slot(signal_index, { signal = { type = "virtual", name = signal_name }, count = math.floor(stats[stat_name] / mega) }) + circuit_oc.set_slot(signal_index, { value = { type = "virtual", name = signal_name }, min = math.floor(stats[stat_name] / mega) }) elseif stat_name == "production_multiplier" then - circuit_oc.set_slot(signal_index, { signal = { type = "virtual", name = signal_name }, count = math.floor(stats[stat_name] * 10000) }) + circuit_oc.set_slot(signal_index, { value = { type = "virtual", name = signal_name }, min = math.floor(stats[stat_name] * 10000) }) else - circuit_oc.set_slot(signal_index, { signal = { type = "virtual", name = signal_name }, count = math.floor(stats[stat_name]) }) + circuit_oc.set_slot(signal_index, { value = { type = "virtual", name = signal_name }, min = math.floor(stats[stat_name]) }) end signal_index = signal_index + 1 @@ -577,7 +577,7 @@ local function handle_circuit_interfaces() -- Set the item signals based on stored items for item_name, count in pairs(vlayer_data.storage.items) do if prototypes.item[item_name] and count > 0 then - circuit_oc.set_slot(signal_index, { signal = { type = "item", name = item_name }, count = count }) + circuit_oc.set_slot(signal_index, { value = { type = "item", name = item_name }, min = count }) signal_index = signal_index + 1 end end From 5c15bbbe7c77be2e34a6145a830eaa7f32ced655 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Thu, 9 Jan 2025 22:33:27 +0900 Subject: [PATCH 071/406] . --- exp_legacy/module/modules/control/vlayer.lua | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/exp_legacy/module/modules/control/vlayer.lua b/exp_legacy/module/modules/control/vlayer.lua index cc843e92..6819ed69 100644 --- a/exp_legacy/module/modules/control/vlayer.lua +++ b/exp_legacy/module/modules/control/vlayer.lua @@ -564,11 +564,11 @@ local function handle_circuit_interfaces() -- Set the virtual signals based on the vlayer stats for stat_name, signal_name in pairs(circuit) do if stat_name:find("energy") then - circuit_oc.set_slot(signal_index, { value = { type = "virtual", name = signal_name }, min = math.floor(stats[stat_name] / mega) }) + circuit_oc.set_slot(signal_index, { value = { type = "virtual", name = signal_name, quality = "normal" }, min = math.floor(stats[stat_name] / mega) }) elseif stat_name == "production_multiplier" then - circuit_oc.set_slot(signal_index, { value = { type = "virtual", name = signal_name }, min = math.floor(stats[stat_name] * 10000) }) + circuit_oc.set_slot(signal_index, { value = { type = "virtual", name = signal_name, quality = "normal" }, min = math.floor(stats[stat_name] * 10000) }) else - circuit_oc.set_slot(signal_index, { value = { type = "virtual", name = signal_name }, min = math.floor(stats[stat_name]) }) + circuit_oc.set_slot(signal_index, { value = { type = "virtual", name = signal_name, quality = "normal" }, min = math.floor(stats[stat_name]) }) end signal_index = signal_index + 1 @@ -577,7 +577,7 @@ local function handle_circuit_interfaces() -- Set the item signals based on stored items for item_name, count in pairs(vlayer_data.storage.items) do if prototypes.item[item_name] and count > 0 then - circuit_oc.set_slot(signal_index, { value = { type = "item", name = item_name }, min = count }) + circuit_oc.set_slot(signal_index, { value = { type = "item", name = item_name, quality = "normal" }, min = count }) signal_index = signal_index + 1 end end From 397661728f19dce56054170911f9c4cf3f75b773 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Thu, 9 Jan 2025 23:21:54 +0900 Subject: [PATCH 072/406] . --- exp_legacy/module/config/vlayer.lua | 22 -------------------- exp_legacy/module/modules/control/vlayer.lua | 14 +++++++------ exp_legacy/module/modules/gui/vlayer.lua | 1 + 3 files changed, 9 insertions(+), 28 deletions(-) diff --git a/exp_legacy/module/config/vlayer.lua b/exp_legacy/module/config/vlayer.lua index e6058863..74a000bd 100644 --- a/exp_legacy/module/config/vlayer.lua +++ b/exp_legacy/module/config/vlayer.lua @@ -83,29 +83,7 @@ return { surface_area = 0, fuel_value = 100, -- MJ power = true, -- turn all rocket fuel to power to reduce trash - } - --[[ - ["iron-ore"] = { - starting_value = 0, - required_area = 0, - surface_area = 0, }, - ["copper-ore"] = { - starting_value = 0, - required_area = 0, - surface_area = 0, - }, - ["stone"] = { - starting_value = 0, - required_area = 0, - surface_area = 0, - }, - ["uranium-ore"] = { - starting_value = 0, - required_area = 0, - surface_area = 0, - }, - ]] }, modded_items = { --- @setting modded_items List of all modded items allowed in vlayer storage and their base game equivalent diff --git a/exp_legacy/module/modules/control/vlayer.lua b/exp_legacy/module/modules/control/vlayer.lua index 6819ed69..a7e02181 100644 --- a/exp_legacy/module/modules/control/vlayer.lua +++ b/exp_legacy/module/modules/control/vlayer.lua @@ -362,23 +362,25 @@ local function handle_input_interfaces() else local inventory = interface.get_inventory(defines.inventory.chest) - for name, count in pairs(inventory.get_contents()) do + for name, v in pairs(inventory.get_contents()) do if config.allowed_items[name] then if config.allowed_items[name].modded then if config.modded_auto_downgrade then - vlayer.insert_item(config.modded_items[name].base_game_equivalent, count * config.modded_items[name].multiplier) + -- TODO Quality Insert 7 + 3N items based on quailty level. + -- For example, level 1: 10 = 10, level 2: 10 = 13 + vlayer.insert_item(config.modded_items[name].base_game_equivalent, v.count * config.modded_items[name].multiplier) else - vlayer.insert_item(name, count) + vlayer.insert_item(name, v.count) end else if vlayer_data.storage.power_items[name] then - vlayer_data.storage.power_items[name].count = vlayer_data.storage.power_items[name].count + count + vlayer_data.storage.power_items[name].count = vlayer_data.storage.power_items[name].count + v.count else - vlayer.insert_item(name, count) + vlayer.insert_item(name, v.count) end end - inventory.remove{ name = name, count = count } + inventory.remove{ name = name, count = v.count, quality = v.quality } end end end diff --git a/exp_legacy/module/modules/gui/vlayer.lua b/exp_legacy/module/modules/gui/vlayer.lua index a99860bb..974570fb 100644 --- a/exp_legacy/module/modules/gui/vlayer.lua +++ b/exp_legacy/module/modules/gui/vlayer.lua @@ -43,6 +43,7 @@ local function format_energy(amount, unit) local suffix = "" local suffix_list = { + ["P"] = 1000000000000000, ["T"] = 1000000000000, ["G"] = 1000000000, ["M"] = 1000000, From bd488aef7671c227c09d803e3037c7ae8077bbd4 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Thu, 9 Jan 2025 23:32:21 +0900 Subject: [PATCH 073/406] . --- exp_legacy/module/modules/control/vlayer.lua | 57 ++++++++++++++------ 1 file changed, 41 insertions(+), 16 deletions(-) diff --git a/exp_legacy/module/modules/control/vlayer.lua b/exp_legacy/module/modules/control/vlayer.lua index a7e02181..4fbefbde 100644 --- a/exp_legacy/module/modules/control/vlayer.lua +++ b/exp_legacy/module/modules/control/vlayer.lua @@ -364,23 +364,48 @@ local function handle_input_interfaces() for name, v in pairs(inventory.get_contents()) do if config.allowed_items[name] then - if config.allowed_items[name].modded then - if config.modded_auto_downgrade then - -- TODO Quality Insert 7 + 3N items based on quailty level. - -- For example, level 1: 10 = 10, level 2: 10 = 13 - vlayer.insert_item(config.modded_items[name].base_game_equivalent, v.count * config.modded_items[name].multiplier) - else - vlayer.insert_item(name, v.count) - end - else - if vlayer_data.storage.power_items[name] then - vlayer_data.storage.power_items[name].count = vlayer_data.storage.power_items[name].count + v.count - else - vlayer.insert_item(name, v.count) - end - end + --[[ + TODO + there are no quality support currently. + so instead, using the stats projection value for higher quality. + ]] + if v.quality.level > 1 and v.count >= 10 then + local batch_to_convert = math.floor(v.count / 10) + local count_projection = batch_to_convert * (7 + (v.quality.level * 3)) - inventory.remove{ name = name, count = v.count, quality = v.quality } + if config.allowed_items[name].modded then + if config.modded_auto_downgrade then + vlayer.insert_item(config.modded_items[name].base_game_equivalent, count_projection * config.modded_items[name].multiplier) + else + vlayer.insert_item(name, count_projection) + end + else + if vlayer_data.storage.power_items[name] then + vlayer_data.storage.power_items[name].count = vlayer_data.storage.power_items[name].count + count_projection + else + vlayer.insert_item(name, count_projection) + end + end + + inventory.remove{ name = name, count = batch_to_convert * 10, quality = v.quality } + + elseif v.quality.level == 1 then + if config.allowed_items[name].modded then + if config.modded_auto_downgrade then + vlayer.insert_item(config.modded_items[name].base_game_equivalent, v.count * config.modded_items[name].multiplier) + else + vlayer.insert_item(name, v.count) + end + else + if vlayer_data.storage.power_items[name] then + vlayer_data.storage.power_items[name].count = vlayer_data.storage.power_items[name].count + v.count + else + vlayer.insert_item(name, v.count) + end + end + + inventory.remove{ name = name, count = v.count, quality = v.quality } + end end end end From 10bf61247c1b0c826fc869a226ad0efff6326446 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Thu, 9 Jan 2025 23:38:39 +0900 Subject: [PATCH 074/406] . --- exp_legacy/module/modules/addons/death-logger.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/exp_legacy/module/modules/addons/death-logger.lua b/exp_legacy/module/modules/addons/death-logger.lua index b735f8b8..760c407d 100644 --- a/exp_legacy/module/modules/addons/death-logger.lua +++ b/exp_legacy/module/modules/addons/death-logger.lua @@ -73,10 +73,10 @@ Event.add(defines.events.on_player_died, function(event) inventory = inventory, surface = corpse.surface, position = corpse.position, - name = "iron-chest", + name = "steel-chest", allow_creation = true, } - + corpse.destroy() corpse = chest end From f94e9bf17d9601246f6feb4cc5a3b4b98f6747f6 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Thu, 9 Jan 2025 23:44:35 +0900 Subject: [PATCH 075/406] . --- exp_legacy/module/modules/control/vlayer.lua | 42 ++++++++------------ 1 file changed, 17 insertions(+), 25 deletions(-) diff --git a/exp_legacy/module/modules/control/vlayer.lua b/exp_legacy/module/modules/control/vlayer.lua index 4fbefbde..3245148f 100644 --- a/exp_legacy/module/modules/control/vlayer.lua +++ b/exp_legacy/module/modules/control/vlayer.lua @@ -369,42 +369,34 @@ local function handle_input_interfaces() there are no quality support currently. so instead, using the stats projection value for higher quality. ]] - if v.quality.level > 1 and v.count >= 10 then - local batch_to_convert = math.floor(v.count / 10) - local count_projection = batch_to_convert * (7 + (v.quality.level * 3)) + local count_deduct + local count_add + if v.quality.level == 1 then + count_deduct = v.count + count_add = v.count + + elseif v.quality.level > 1 and v.count >= 10 then + count_deduct = math.floor(v.count / 10) + count_add = count_deduct * (7 + (v.quality.level * 3)) + end + + if count_deduct and count_add then if config.allowed_items[name].modded then if config.modded_auto_downgrade then - vlayer.insert_item(config.modded_items[name].base_game_equivalent, count_projection * config.modded_items[name].multiplier) + vlayer.insert_item(config.modded_items[name].base_game_equivalent, count_add * config.modded_items[name].multiplier) else - vlayer.insert_item(name, count_projection) + vlayer.insert_item(name, count_add) end else if vlayer_data.storage.power_items[name] then - vlayer_data.storage.power_items[name].count = vlayer_data.storage.power_items[name].count + count_projection + vlayer_data.storage.power_items[name].count = vlayer_data.storage.power_items[name].count + count_add else - vlayer.insert_item(name, count_projection) + vlayer.insert_item(name, count_add) end end - inventory.remove{ name = name, count = batch_to_convert * 10, quality = v.quality } - - elseif v.quality.level == 1 then - if config.allowed_items[name].modded then - if config.modded_auto_downgrade then - vlayer.insert_item(config.modded_items[name].base_game_equivalent, v.count * config.modded_items[name].multiplier) - else - vlayer.insert_item(name, v.count) - end - else - if vlayer_data.storage.power_items[name] then - vlayer_data.storage.power_items[name].count = vlayer_data.storage.power_items[name].count + v.count - else - vlayer.insert_item(name, v.count) - end - end - - inventory.remove{ name = name, count = v.count, quality = v.quality } + inventory.remove{ name = name, count = count_deduct, quality = v.quality } end end end From 82e858975b593b1c0081ef872160a400027b1743 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Thu, 9 Jan 2025 23:49:44 +0900 Subject: [PATCH 076/406] . --- exp_legacy/module/modules/control/vlayer.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/exp_legacy/module/modules/control/vlayer.lua b/exp_legacy/module/modules/control/vlayer.lua index 3245148f..27826793 100644 --- a/exp_legacy/module/modules/control/vlayer.lua +++ b/exp_legacy/module/modules/control/vlayer.lua @@ -382,6 +382,7 @@ local function handle_input_interfaces() end if count_deduct and count_add then + game.print(count_add) if config.allowed_items[name].modded then if config.modded_auto_downgrade then vlayer.insert_item(config.modded_items[name].base_game_equivalent, count_add * config.modded_items[name].multiplier) From 965c1c771296b4d73aa6546a0d2fd080bfaf6e92 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Thu, 9 Jan 2025 23:51:34 +0900 Subject: [PATCH 077/406] . --- exp_legacy/module/modules/control/vlayer.lua | 1 - 1 file changed, 1 deletion(-) diff --git a/exp_legacy/module/modules/control/vlayer.lua b/exp_legacy/module/modules/control/vlayer.lua index 27826793..3245148f 100644 --- a/exp_legacy/module/modules/control/vlayer.lua +++ b/exp_legacy/module/modules/control/vlayer.lua @@ -382,7 +382,6 @@ local function handle_input_interfaces() end if count_deduct and count_add then - game.print(count_add) if config.allowed_items[name].modded then if config.modded_auto_downgrade then vlayer.insert_item(config.modded_items[name].base_game_equivalent, count_add * config.modded_items[name].multiplier) From 4136b5018b0b52042597edc2118a9a7b530ce0ff Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Thu, 9 Jan 2025 23:54:15 +0900 Subject: [PATCH 078/406] . --- exp_legacy/module/modules/control/vlayer.lua | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/exp_legacy/module/modules/control/vlayer.lua b/exp_legacy/module/modules/control/vlayer.lua index 3245148f..ed896980 100644 --- a/exp_legacy/module/modules/control/vlayer.lua +++ b/exp_legacy/module/modules/control/vlayer.lua @@ -362,8 +362,8 @@ local function handle_input_interfaces() else local inventory = interface.get_inventory(defines.inventory.chest) - for name, v in pairs(inventory.get_contents()) do - if config.allowed_items[name] then + for _, v in pairs(inventory.get_contents()) do + if config.allowed_items[v.name] then --[[ TODO there are no quality support currently. @@ -382,21 +382,21 @@ local function handle_input_interfaces() end if count_deduct and count_add then - if config.allowed_items[name].modded then + if config.allowed_items[v.name].modded then if config.modded_auto_downgrade then - vlayer.insert_item(config.modded_items[name].base_game_equivalent, count_add * config.modded_items[name].multiplier) + vlayer.insert_item(config.modded_items[v.name].base_game_equivalent, count_add * config.modded_items[v.name].multiplier) else - vlayer.insert_item(name, count_add) + vlayer.insert_item(v.name, count_add) end else - if vlayer_data.storage.power_items[name] then - vlayer_data.storage.power_items[name].count = vlayer_data.storage.power_items[name].count + count_add + if vlayer_data.storage.power_items[v.name] then + vlayer_data.storage.power_items[v.name].count = vlayer_data.storage.power_items[v.name].count + count_add else - vlayer.insert_item(name, count_add) + vlayer.insert_item(v.name, count_add) end end - inventory.remove{ name = name, count = count_deduct, quality = v.quality } + inventory.remove{ name = v.name, count = count_deduct, quality = v.quality } end end end From 46f35eadcc419c2f71932a620d21668ad84093f4 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Thu, 9 Jan 2025 23:58:26 +0900 Subject: [PATCH 079/406] . --- exp_legacy/module/modules/control/vlayer.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exp_legacy/module/modules/control/vlayer.lua b/exp_legacy/module/modules/control/vlayer.lua index ed896980..7e846d64 100644 --- a/exp_legacy/module/modules/control/vlayer.lua +++ b/exp_legacy/module/modules/control/vlayer.lua @@ -376,7 +376,7 @@ local function handle_input_interfaces() count_deduct = v.count count_add = v.count - elseif v.quality.level > 1 and v.count >= 10 then + elseif prototypes.quality[v.quality].level > 1 and v.count >= 10 then count_deduct = math.floor(v.count / 10) count_add = count_deduct * (7 + (v.quality.level * 3)) end From 6603a14fd3fd6e66aeba7a48351e46a7adc26c95 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Thu, 9 Jan 2025 23:58:36 +0900 Subject: [PATCH 080/406] . --- exp_legacy/module/modules/control/vlayer.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exp_legacy/module/modules/control/vlayer.lua b/exp_legacy/module/modules/control/vlayer.lua index 7e846d64..1ed83cb0 100644 --- a/exp_legacy/module/modules/control/vlayer.lua +++ b/exp_legacy/module/modules/control/vlayer.lua @@ -378,7 +378,7 @@ local function handle_input_interfaces() elseif prototypes.quality[v.quality].level > 1 and v.count >= 10 then count_deduct = math.floor(v.count / 10) - count_add = count_deduct * (7 + (v.quality.level * 3)) + count_add = count_deduct * (7 + (prototypes.quality[v.quality].level * 3)) end if count_deduct and count_add then From 8f5d3e4a65124494ecfaa010c6a6d21e992ff3e4 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Fri, 10 Jan 2025 00:01:16 +0900 Subject: [PATCH 081/406] . --- exp_legacy/module/modules/control/vlayer.lua | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/exp_legacy/module/modules/control/vlayer.lua b/exp_legacy/module/modules/control/vlayer.lua index 1ed83cb0..9f4b7b18 100644 --- a/exp_legacy/module/modules/control/vlayer.lua +++ b/exp_legacy/module/modules/control/vlayer.lua @@ -372,13 +372,14 @@ local function handle_input_interfaces() local count_deduct local count_add - if v.quality.level == 1 then + if prototypes.quality[v.quality].level == 1 then count_deduct = v.count count_add = v.count elseif prototypes.quality[v.quality].level > 1 and v.count >= 10 then - count_deduct = math.floor(v.count / 10) - count_add = count_deduct * (7 + (prototypes.quality[v.quality].level * 3)) + local batch = math.floor(v.count / 10) + count_deduct = batch * 10 + count_add = batch * (7 + (prototypes.quality[v.quality].level * 3)) end if count_deduct and count_add then From 7a5577452c164c0289a638ce731e751358ffb56a Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Fri, 10 Jan 2025 00:09:13 +0900 Subject: [PATCH 082/406] . --- exp_legacy/module/modules/control/vlayer.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/exp_legacy/module/modules/control/vlayer.lua b/exp_legacy/module/modules/control/vlayer.lua index 9f4b7b18..73b78439 100644 --- a/exp_legacy/module/modules/control/vlayer.lua +++ b/exp_legacy/module/modules/control/vlayer.lua @@ -372,11 +372,11 @@ local function handle_input_interfaces() local count_deduct local count_add - if prototypes.quality[v.quality].level == 1 then + if prototypes.quality[v.quality].level == 0 then count_deduct = v.count count_add = v.count - elseif prototypes.quality[v.quality].level > 1 and v.count >= 10 then + elseif prototypes.quality[v.quality].level > 0 and v.count >= 10 then local batch = math.floor(v.count / 10) count_deduct = batch * 10 count_add = batch * (7 + (prototypes.quality[v.quality].level * 3)) From 8dac727396898905aad3ca830a8c057d8cd733e7 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Fri, 10 Jan 2025 00:11:45 +0900 Subject: [PATCH 083/406] . --- exp_legacy/module/modules/control/vlayer.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exp_legacy/module/modules/control/vlayer.lua b/exp_legacy/module/modules/control/vlayer.lua index 73b78439..7ff44c69 100644 --- a/exp_legacy/module/modules/control/vlayer.lua +++ b/exp_legacy/module/modules/control/vlayer.lua @@ -379,7 +379,7 @@ local function handle_input_interfaces() elseif prototypes.quality[v.quality].level > 0 and v.count >= 10 then local batch = math.floor(v.count / 10) count_deduct = batch * 10 - count_add = batch * (7 + (prototypes.quality[v.quality].level * 3)) + count_add = batch * (10 + (prototypes.quality[v.quality].level * 3)) end if count_deduct and count_add then From 803192e01c464dc09d157d876535583e0c5c8624 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Fri, 10 Jan 2025 02:44:05 +0900 Subject: [PATCH 084/406] . --- exp_legacy/module/modules/control/vlayer.lua | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/exp_legacy/module/modules/control/vlayer.lua b/exp_legacy/module/modules/control/vlayer.lua index 7ff44c69..1fce06fe 100644 --- a/exp_legacy/module/modules/control/vlayer.lua +++ b/exp_legacy/module/modules/control/vlayer.lua @@ -133,10 +133,10 @@ end --[[ 25,200 / 420 s - 昼 208秒 ソーラー効率100% - 夕方 83秒 1秒ごとにソーラー発電量が約1.2%ずつ下がり、やがて0%になる - 夜 41秒 ソーラー発電量が0%になる - 朝方 83秒 1秒ごとにソーラー発電量が約1.2%ずつ上がり、やがて100%になる + 昼 210秒 ソーラー効率100% + 夕方 84秒 1秒ごとにソーラー発電量が約1.2%ずつ下がり、やがて0%になる + 夜 42秒 ソーラー発電量が0%になる + 朝方 84秒 1秒ごとにソーラー発電量が約1.2%ずつ上がり、やがて100%になる (surface.dawn) 0.75 18,900 Day 12,600 210s 0.00 0 Noon @@ -365,7 +365,6 @@ local function handle_input_interfaces() for _, v in pairs(inventory.get_contents()) do if config.allowed_items[v.name] then --[[ - TODO there are no quality support currently. so instead, using the stats projection value for higher quality. ]] From 518f1fc5610b495518d42fd78b6a202388b0f5f6 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Fri, 10 Jan 2025 14:04:17 +0900 Subject: [PATCH 085/406] . --- exp_scenario/module/commands/lawnmower.lua | 4 ++-- exp_scenario/module/commands/waterfill.lua | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/exp_scenario/module/commands/lawnmower.lua b/exp_scenario/module/commands/lawnmower.lua index e002f21b..22522ba3 100644 --- a/exp_scenario/module/commands/lawnmower.lua +++ b/exp_scenario/module/commands/lawnmower.lua @@ -10,7 +10,7 @@ Commands.new("lawnmower", { "exp-commands_lawnmower.description" }) :register(function(player, range) --- @cast range number local surface = player.surface - + -- Intentionally left as player.position to allow use in remote view local entities = surface.find_entities_filtered{ position = player.position, radius = range, type = "corpse" } for _, entity in pairs(entities) do @@ -18,7 +18,7 @@ Commands.new("lawnmower", { "exp-commands_lawnmower.description" }) entity.destroy() end end - + local replace_tiles = {} local tiles = surface.find_tiles_filtered{ position = player.position, radius = range, name = { "nuclear-ground" } } for i, tile in pairs(tiles) do diff --git a/exp_scenario/module/commands/waterfill.lua b/exp_scenario/module/commands/waterfill.lua index d748356f..1451112e 100644 --- a/exp_scenario/module/commands/waterfill.lua +++ b/exp_scenario/module/commands/waterfill.lua @@ -28,10 +28,12 @@ Selection.on_selection(SelectionName, function(event) local player = game.players[event.player_index] local surface = event.surface + --[[ if surface.planet and surface.planet ~= game.planets.nauvis then player.print({ "exp-commands_waterfill.nauvis-only" }, Commands.print_settings.error) return end + ]] local area_size = (area.right_bottom.x - area.left_top.x) * (area.right_bottom.y - area.left_top.y) if area_size > 1000 then From ea04b93c7c298503d215ede98b918f43a6cd8e9d Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Fri, 10 Jan 2025 14:13:12 +0900 Subject: [PATCH 086/406] . --- exp_scenario/module/commands/kill.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exp_scenario/module/commands/kill.lua b/exp_scenario/module/commands/kill.lua index 2ab239bd..7a707c5e 100644 --- a/exp_scenario/module/commands/kill.lua +++ b/exp_scenario/module/commands/kill.lua @@ -23,7 +23,7 @@ Commands.new("kill", { "exp-commands_kill.description" }) elseif other_player == player then -- You can always kill yourself other_player.character.die() - elseif highest_role(other_player).index < highest_role(player).index then + elseif highest_role(player).index > highest_role(other_player).index then -- Can kill lower role players other_player.character.die() else From 645d6935832cc4fcb866d8fbda0d244bb066c9e3 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Fri, 10 Jan 2025 14:22:33 +0900 Subject: [PATCH 087/406] . --- exp_scenario/module/commands/kill.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exp_scenario/module/commands/kill.lua b/exp_scenario/module/commands/kill.lua index 7a707c5e..2ab239bd 100644 --- a/exp_scenario/module/commands/kill.lua +++ b/exp_scenario/module/commands/kill.lua @@ -23,7 +23,7 @@ Commands.new("kill", { "exp-commands_kill.description" }) elseif other_player == player then -- You can always kill yourself other_player.character.die() - elseif highest_role(player).index > highest_role(other_player).index then + elseif highest_role(other_player).index < highest_role(player).index then -- Can kill lower role players other_player.character.die() else From 3632738501c699402c25b96055430aa8a80abf5e Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Fri, 10 Jan 2025 17:37:33 +0900 Subject: [PATCH 088/406] . --- exp_scenario/module/commands/waterfill.lua | 2 -- 1 file changed, 2 deletions(-) diff --git a/exp_scenario/module/commands/waterfill.lua b/exp_scenario/module/commands/waterfill.lua index 1451112e..d748356f 100644 --- a/exp_scenario/module/commands/waterfill.lua +++ b/exp_scenario/module/commands/waterfill.lua @@ -28,12 +28,10 @@ Selection.on_selection(SelectionName, function(event) local player = game.players[event.player_index] local surface = event.surface - --[[ if surface.planet and surface.planet ~= game.planets.nauvis then player.print({ "exp-commands_waterfill.nauvis-only" }, Commands.print_settings.error) return end - ]] local area_size = (area.right_bottom.x - area.left_top.x) * (area.right_bottom.y - area.left_top.y) if area_size > 1000 then From a6ddf0c427e3a920644c31d6120b5e4b3378b693 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Sat, 11 Jan 2025 22:09:35 +0900 Subject: [PATCH 089/406] . --- exp_legacy/module/config/vlayer.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/exp_legacy/module/config/vlayer.lua b/exp_legacy/module/config/vlayer.lua index 74a000bd..335b8337 100644 --- a/exp_legacy/module/config/vlayer.lua +++ b/exp_legacy/module/config/vlayer.lua @@ -24,10 +24,10 @@ return { }, interface_limit = { --- @setting interface_limit Sets the limit for the number of vlayer interfaces that can be created - energy = 1, -- >1 allows for disconnected power networks to receive power + energy = 20, -- >1 allows for disconnected power networks to receive power circuit = 20, -- No caveats storage_input = 20, -- No caveats - storage_output = 1, -- >0 allows for item teleportation (allowed_items only) + storage_output = 20, -- >0 allows for item teleportation (allowed_items only) }, allowed_items = { --- @setting allowed_items List of all items allowed in vlayer storage and their properties From c9700414c74bb15cf1edaf6a5b2d88ca94313994 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Sat, 11 Jan 2025 22:10:26 +0900 Subject: [PATCH 090/406] . --- exp_scenario/module/commands/waterfill.lua | 2 ++ 1 file changed, 2 insertions(+) diff --git a/exp_scenario/module/commands/waterfill.lua b/exp_scenario/module/commands/waterfill.lua index d748356f..1451112e 100644 --- a/exp_scenario/module/commands/waterfill.lua +++ b/exp_scenario/module/commands/waterfill.lua @@ -28,10 +28,12 @@ Selection.on_selection(SelectionName, function(event) local player = game.players[event.player_index] local surface = event.surface + --[[ if surface.planet and surface.planet ~= game.planets.nauvis then player.print({ "exp-commands_waterfill.nauvis-only" }, Commands.print_settings.error) return end + ]] local area_size = (area.right_bottom.x - area.left_top.x) * (area.right_bottom.y - area.left_top.y) if area_size > 1000 then From 2ed7235f3d613795323964bd506490a2dafa574c Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Sat, 11 Jan 2025 23:05:39 +0900 Subject: [PATCH 091/406] . --- exp_legacy/module/modules/gui/server-ups.lua | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/exp_legacy/module/modules/gui/server-ups.lua b/exp_legacy/module/modules/gui/server-ups.lua index fc0bd3d2..9de3189c 100644 --- a/exp_legacy/module/modules/gui/server-ups.lua +++ b/exp_legacy/module/modules/gui/server-ups.lua @@ -34,9 +34,13 @@ local server_ups = UsesServerUps:on_load(function(player_name, visible) local player = game.players[player_name] local label = player.gui.screen[server_ups.name] + --- @diagnostic disable-next-line undefined-field - if not External.valid() or not storage.ext.var.server_ups then visible = false end - label.visible = visible + if External.valid() and storage.ext and storage.ext.var and storage.ext.var.server_ups then + label.visible = true + else + label.visible = false + end end) --- Toggles if the server ups is visbile From cf2f6cfb8cb5e120d1fee57d310c506d9efaf200 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Sat, 11 Jan 2025 23:07:07 +0900 Subject: [PATCH 092/406] . --- exp_legacy/module/modules/gui/server-ups.lua | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/exp_legacy/module/modules/gui/server-ups.lua b/exp_legacy/module/modules/gui/server-ups.lua index 9de3189c..ff0ff596 100644 --- a/exp_legacy/module/modules/gui/server-ups.lua +++ b/exp_legacy/module/modules/gui/server-ups.lua @@ -35,11 +35,11 @@ UsesServerUps:on_load(function(player_name, visible) local player = game.players[player_name] local label = player.gui.screen[server_ups.name] - --- @diagnostic disable-next-line undefined-field - if External.valid() and storage.ext and storage.ext.var and storage.ext.var.server_ups then - label.visible = true - else + --- @diagnostic disable-next-line undefined-field + if not External.valid() or not storage.ext.var.server_ups then label.visible = false + else + label.visible = label.visible or false end end) From 0d8712dd6b636c3cbc03c5fdd5ad159282a25139 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Sat, 11 Jan 2025 23:07:58 +0900 Subject: [PATCH 093/406] . --- exp_legacy/module/modules/gui/server-ups.lua | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/exp_legacy/module/modules/gui/server-ups.lua b/exp_legacy/module/modules/gui/server-ups.lua index ff0ff596..f24626a2 100644 --- a/exp_legacy/module/modules/gui/server-ups.lua +++ b/exp_legacy/module/modules/gui/server-ups.lua @@ -36,11 +36,8 @@ UsesServerUps:on_load(function(player_name, visible) local label = player.gui.screen[server_ups.name] --- @diagnostic disable-next-line undefined-field - if not External.valid() or not storage.ext.var.server_ups then - label.visible = false - else - label.visible = label.visible or false - end + if not External.valid() or not storage.ext.var.server_ups then visible = false end + label.visible = visible or false end) --- Toggles if the server ups is visbile From da323d5152d972c5d24f3cb75d576e738b631764 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Sat, 11 Jan 2025 23:08:26 +0900 Subject: [PATCH 094/406] . --- exp_legacy/module/modules/gui/server-ups.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exp_legacy/module/modules/gui/server-ups.lua b/exp_legacy/module/modules/gui/server-ups.lua index f24626a2..b4b110fe 100644 --- a/exp_legacy/module/modules/gui/server-ups.lua +++ b/exp_legacy/module/modules/gui/server-ups.lua @@ -37,7 +37,7 @@ UsesServerUps:on_load(function(player_name, visible) --- @diagnostic disable-next-line undefined-field if not External.valid() or not storage.ext.var.server_ups then visible = false end - label.visible = visible or false + label.visible = visible end) --- Toggles if the server ups is visbile From 8b67491d8cd96d9261dea8b756fc698ceb508100 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Sun, 12 Jan 2025 03:26:24 +0900 Subject: [PATCH 095/406] . --- exp_legacy/module/config/vlayer.lua | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/exp_legacy/module/config/vlayer.lua b/exp_legacy/module/config/vlayer.lua index 335b8337..70db3ac3 100644 --- a/exp_legacy/module/config/vlayer.lua +++ b/exp_legacy/module/config/vlayer.lua @@ -24,10 +24,10 @@ return { }, interface_limit = { --- @setting interface_limit Sets the limit for the number of vlayer interfaces that can be created - energy = 20, -- >1 allows for disconnected power networks to receive power - circuit = 20, -- No caveats - storage_input = 20, -- No caveats - storage_output = 20, -- >0 allows for item teleportation (allowed_items only) + energy = 100, -- >1 allows for disconnected power networks to receive power + circuit = 100, -- No caveats + storage_input = 100, -- No caveats + storage_output = 100, -- >0 allows for item teleportation (allowed_items only) }, allowed_items = { --- @setting allowed_items List of all items allowed in vlayer storage and their properties From de6474dc7690f6c78f317cad68752dde7461caac Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Sun, 12 Jan 2025 03:43:48 +0900 Subject: [PATCH 096/406] . --- exp_legacy/module/modules/addons/logging.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exp_legacy/module/modules/addons/logging.lua b/exp_legacy/module/modules/addons/logging.lua index 103a47a5..84e4ce17 100644 --- a/exp_legacy/module/modules/addons/logging.lua +++ b/exp_legacy/module/modules/addons/logging.lua @@ -44,7 +44,7 @@ Event.add(defines.events.on_research_finished, function(event) return end - if (event.research.level and config_res.inf_res[event.research.name]) and (event.research.level >= config_res.inf_res[event.research.name]) then + if (event.research.level and config.inf_res[config.mod_set][event.research.name]) and (event.research.level >= config.inf_res[config.mod_set][event.research.name]) then add_log{ "logging.add-l", event.research.prototype.localised_name, event.research.level - 1 } else add_log{ "logging.add-n", event.research.prototype.localised_name } From 9e44de8850d2e7141abf9b9b1ef3f7bdfd67ce3c Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Mon, 13 Jan 2025 19:07:40 +0900 Subject: [PATCH 097/406] . --- exp_legacy/module/modules/addons/logging.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exp_legacy/module/modules/addons/logging.lua b/exp_legacy/module/modules/addons/logging.lua index 84e4ce17..cf940d15 100644 --- a/exp_legacy/module/modules/addons/logging.lua +++ b/exp_legacy/module/modules/addons/logging.lua @@ -44,7 +44,7 @@ Event.add(defines.events.on_research_finished, function(event) return end - if (event.research.level and config.inf_res[config.mod_set][event.research.name]) and (event.research.level >= config.inf_res[config.mod_set][event.research.name]) then + if (event.research.level and config_res.inf_res[config_res.mod_set][event.research.name]) and (event.research.level >= config_res.inf_res[config_res.mod_set][event.research.name]) then add_log{ "logging.add-l", event.research.prototype.localised_name, event.research.level - 1 } else add_log{ "logging.add-n", event.research.prototype.localised_name } From 4fa1ea4fb3045b237aa0389bff9e62a10e9a611e Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Mon, 13 Jan 2025 22:03:03 +0900 Subject: [PATCH 098/406] . --- exp_legacy/module/modules/gui/bonus.lua | 2 ++ 1 file changed, 2 insertions(+) diff --git a/exp_legacy/module/modules/gui/bonus.lua b/exp_legacy/module/modules/gui/bonus.lua index e69ee0b8..1f89048f 100644 --- a/exp_legacy/module/modules/gui/bonus.lua +++ b/exp_legacy/module/modules/gui/bonus.lua @@ -75,6 +75,7 @@ local function apply_periodic_bonus(player) local disp = frame.container["bonus_st_2"].disp.table if vlayer.get_statistics()["energy_sustained"] > 0 then + --[[ local armor = player.get_inventory(defines.inventory.character_armor)[1].grid if armor then @@ -90,6 +91,7 @@ local function apply_periodic_bonus(player) end end end + ]] end end From bfe5110254a2b9ddc8db456bddfa4c243bd95aa9 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Mon, 13 Jan 2025 22:34:31 +0900 Subject: [PATCH 099/406] . --- exp_legacy/module/modules/control/vlayer.lua | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/exp_legacy/module/modules/control/vlayer.lua b/exp_legacy/module/modules/control/vlayer.lua index 1fce06fe..d494b13c 100644 --- a/exp_legacy/module/modules/control/vlayer.lua +++ b/exp_legacy/module/modules/control/vlayer.lua @@ -40,6 +40,12 @@ Storage.register(vlayer_data, function(tbl) vlayer_data = tbl end) +--[[ +if script.active_mods["space-age"] then + config.allowed_items.landfill.surface_area = math.floor(config.allowed_items.landfill.surface_area * 2.5) +end +]] + for name, properties in pairs(config.allowed_items) do properties.modded = false From c10de39a89a79347983d3e28c708addb1a081f27 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Mon, 13 Jan 2025 22:48:10 +0900 Subject: [PATCH 100/406] . --- exp_legacy/module/modules/addons/death-logger.lua | 2 ++ 1 file changed, 2 insertions(+) diff --git a/exp_legacy/module/modules/addons/death-logger.lua b/exp_legacy/module/modules/addons/death-logger.lua index 760c407d..831d312c 100644 --- a/exp_legacy/module/modules/addons/death-logger.lua +++ b/exp_legacy/module/modules/addons/death-logger.lua @@ -152,12 +152,14 @@ if config.auto_collect_bodies then Event.add(defines.events.on_character_corpse_expired, function(event) local corpse = event.corpse local inventory = assert(corpse.get_inventory(defines.inventory.character_corpse)) + --[[ ExpUtil.transfer_inventory_to_surface{ inventory = inventory, surface = corpse.surface, name = "steel-chest", allow_creation = true, } + ]] end) end From 843de85206b2641b73fe36dbb41d01b429833b86 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Tue, 14 Jan 2025 13:26:49 +0900 Subject: [PATCH 101/406] . --- exp_commands/module/commands/authorities.lua | 2 +- .../module/modules/addons/death-logger.lua | 2 -- exp_util/module/module_exports.lua | 33 +++++++++---------- type.patch.lua | 3 ++ 4 files changed, 19 insertions(+), 21 deletions(-) diff --git a/exp_commands/module/commands/authorities.lua b/exp_commands/module/commands/authorities.lua index 57b1ce28..db82a6ce 100644 --- a/exp_commands/module/commands/authorities.lua +++ b/exp_commands/module/commands/authorities.lua @@ -82,7 +82,7 @@ authorities.character_only = --- If a command has the flag "remote_only" then the command can only be used inside of remote view authorities.remote_only = add(function(player, command) - if command.flags.character_only and player.controller_type ~= defines.controllers.remote then + if command.flags.remote_only and player.controller_type ~= defines.controllers.remote then return deny{ "exp-commands-authorities.remote-only" } else return allow() diff --git a/exp_legacy/module/modules/addons/death-logger.lua b/exp_legacy/module/modules/addons/death-logger.lua index 831d312c..760c407d 100644 --- a/exp_legacy/module/modules/addons/death-logger.lua +++ b/exp_legacy/module/modules/addons/death-logger.lua @@ -152,14 +152,12 @@ if config.auto_collect_bodies then Event.add(defines.events.on_character_corpse_expired, function(event) local corpse = event.corpse local inventory = assert(corpse.get_inventory(defines.inventory.character_corpse)) - --[[ ExpUtil.transfer_inventory_to_surface{ inventory = inventory, surface = corpse.surface, name = "steel-chest", allow_creation = true, } - ]] end) end diff --git a/exp_util/module/module_exports.lua b/exp_util/module/module_exports.lua index a5deec4b..903821fa 100644 --- a/exp_util/module/module_exports.lua +++ b/exp_util/module/module_exports.lua @@ -403,6 +403,7 @@ end function ExpUtil.get_storage_for_stack(options) local surface = assert(options.surface, "A surface must be provided") local item = assert(options.item, "An item stack must be provided") + assert(type(item) ~= "userdata" or item.valid_for_read, "Invalid stack provided") -- Perform a search if on has not been done already local cache = options.cache @@ -420,16 +421,6 @@ function ExpUtil.get_storage_for_stack(options) local current, count, entities = cache.current, cache.count, cache.entities for i = 1, cache.count do local entity = entities[((current + i - 1) % count) + 1] - if entity == nil then - -- See Github Issue #352 - error("entity was nil, context:\n" .. ExpUtil.format_any({ - cache = cache, - i = i, - }, { - max_line_count = 0, - no_locale_strings = true - })) - end if entity.can_insert(item) then cache.current = current + 1 return entity @@ -454,7 +445,7 @@ function ExpUtil.get_storage_for_stack(options) assert(entity, "Failed to create a new entity") cache.count = count + 1 - entities[count] = entity + entities[count + 1] = entity return entity end @@ -468,9 +459,12 @@ end function ExpUtil.copy_items_to_surface(options) local entity for item_index = 1, #options.items do - options.item = options.items[item_index] - entity = ExpUtil.get_storage_for_stack(options) - entity.insert(options.item) + local item = options.items[item_index] + if type(item) ~= "userdata" or item.valid_for_read then + options.item = item + entity = ExpUtil.get_storage_for_stack(options) + entity.insert(options.item) + end end return entity end @@ -485,10 +479,13 @@ end function ExpUtil.move_items_to_surface(options) local entity for item_index = 1, #options.items do - options.item = options.items[item_index] - entity = ExpUtil.get_storage_for_stack(options) - entity.insert(options.item) - options.item.clear() + local item = options.items[item_index] + if type(item) ~= "userdata" or item.valid_for_read then + options.item = item + entity = ExpUtil.get_storage_for_stack(options) + entity.insert(options.item) + options.item.clear() + end end return entity end diff --git a/type.patch.lua b/type.patch.lua index b27b5997..64cd9f6e 100644 --- a/type.patch.lua +++ b/type.patch.lua @@ -29,7 +29,10 @@ script = { --- --- Type patched in 2.0.28: [Bug Report](https://forums.factorio.com/viewtopic.php?f=233&t=125062) --- Changed "event" from "string | integer" to "LuaEventType" + --- Resolved in 2.0.29, this patch will be removed was version is stable ---@param event LuaEventType ID or name of the event to raise. ---@param data table Table with extra data that will be passed to the event handler. Any invalid LuaObjects will silently stop the event from being raised. raise_event = function(event, data) end; } +---@class LuaObject:userdata +--https://github.com/justarandomgeek/vscode-factoriomod-debug/issues/165 From d7dc4040c8bc744f80bd03d47734dc9c4018119d Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Tue, 14 Jan 2025 18:48:24 +0900 Subject: [PATCH 102/406] . --- exp_legacy/module/modules/control/vlayer.lua | 11 ++++++----- exp_legacy/module/modules/gui/vlayer.lua | 12 ++++++------ 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/exp_legacy/module/modules/control/vlayer.lua b/exp_legacy/module/modules/control/vlayer.lua index d494b13c..5e879a3e 100644 --- a/exp_legacy/module/modules/control/vlayer.lua +++ b/exp_legacy/module/modules/control/vlayer.lua @@ -712,11 +712,12 @@ function vlayer.remove_interface(surface, position) -- Get the details which will be returned if #entities == 0 then - return nil, nil + return nil, nil, nil end local interface = entities[1] local name = interface.name + local sur = interface.surface local pos = interface.position -- Return the type of interface removed and do some clean up @@ -731,7 +732,7 @@ function vlayer.remove_interface(surface, position) table.remove_element(vlayer_data.entity_interfaces.storage_input, interface) interface.destroy() - return "storage-input", pos + return "storage-input", sur, pos elseif name == "requester-chest" then local inventory = assert(interface.get_inventory(defines.inventory.chest)) ExpUtil.transfer_inventory_to_surface{ @@ -743,18 +744,18 @@ function vlayer.remove_interface(surface, position) table.remove_element(vlayer_data.entity_interfaces.storage_output, interface) interface.destroy() - return "storage-output", pos + return "storage-output", sur, pos elseif name == "constant-combinator" then table.remove_element(vlayer_data.entity_interfaces.circuit, interface) interface.destroy() - return "circuit", pos + return "circuit", sur, pos elseif name == "electric-energy-interface" then vlayer_data.storage.energy = vlayer_data.storage.energy + interface.energy table.remove_element(vlayer_data.entity_interfaces.energy, interface) interface.destroy() - return "energy", pos + return "energy", sur, pos end end diff --git a/exp_legacy/module/modules/gui/vlayer.lua b/exp_legacy/module/modules/gui/vlayer.lua index 974570fb..e37c0437 100644 --- a/exp_legacy/module/modules/gui/vlayer.lua +++ b/exp_legacy/module/modules/gui/vlayer.lua @@ -32,8 +32,8 @@ local vlayer_control_type_list = { [4] = "storage_output", } -local function pos_to_gps_string(pos) - return "[gps=" .. string.format("%.1f", pos.x) .. "," .. string.format("%.1f", pos.y) .. "]" +local function pos_to_gps_string(pos, surface_name) + return "[gps=" .. string.format("%.1f", pos.x) .. "," .. string.format("%.1f", pos.y) .. "," .. surface_name .. "]" end local function format_energy(amount, unit) @@ -127,7 +127,7 @@ Selection.on_selection(SelectionConvertArea, function(event) vlayer.create_output_interface(event.surface, e_pos, e_circ, player) end - game.print{ "vlayer.interface-result", player.name, pos_to_gps_string(e_pos), { "vlayer.result-build" }, { "vlayer.control-type-" .. target:gsub("_", "-") } } + game.print{ "vlayer.interface-result", player.name, pos_to_gps_string(e_pos, event.surface), { "vlayer.result-build" }, { "vlayer.control-type-" .. target:gsub("_", "-") } } end) --- Display label for the number of solar panels @@ -373,7 +373,7 @@ local vlayer_gui_control_see = local entity = i[vlayer_control_type_list[target]][n] if entity and entity.valid then player.set_controller{ type = defines.controllers.remote, position = entity.position, surface = entity.surface } - player.print{ "vlayer.result-interface-location", { "vlayer.control-type-" .. vlayer_control_type_list[target]:gsub("_", "-") }, pos_to_gps_string(entity.position) } + player.print{ "vlayer.result-interface-location", { "vlayer.control-type-" .. vlayer_control_type_list[target]:gsub("_", "-") }, pos_to_gps_string(entity.position, entity.surface) } end end end) @@ -415,10 +415,10 @@ local vlayer_gui_control_remove = local i = vlayer.get_interfaces() if i and i[vlayer_control_type_list[target]] then - local interface_type, interface_position = vlayer.remove_interface(i[vlayer_control_type_list[target]][n].surface, i[vlayer_control_type_list[target]][n].position) + local interface_type, interface_surface, interface_position = vlayer.remove_interface(i[vlayer_control_type_list[target]][n].surface, i[vlayer_control_type_list[target]][n].position) if interface_type then - game.print{ "vlayer.interface-result", player.name, pos_to_gps_string(interface_position), { "vlayer.result-remove" }, { "vlayer.control-type-" .. interface_type } } + game.print{ "vlayer.interface-result", player.name, pos_to_gps_string(interface_position, interface_surface), { "vlayer.result-remove" }, { "vlayer.control-type-" .. interface_type } } end end end From fdf0cb66cfbe153004dec92adfc19aea1abe45c4 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Tue, 14 Jan 2025 18:53:31 +0900 Subject: [PATCH 103/406] . --- exp_legacy/module/modules/control/vlayer.lua | 2 -- 1 file changed, 2 deletions(-) diff --git a/exp_legacy/module/modules/control/vlayer.lua b/exp_legacy/module/modules/control/vlayer.lua index 5e879a3e..0b80127f 100644 --- a/exp_legacy/module/modules/control/vlayer.lua +++ b/exp_legacy/module/modules/control/vlayer.lua @@ -40,11 +40,9 @@ Storage.register(vlayer_data, function(tbl) vlayer_data = tbl end) ---[[ if script.active_mods["space-age"] then config.allowed_items.landfill.surface_area = math.floor(config.allowed_items.landfill.surface_area * 2.5) end -]] for name, properties in pairs(config.allowed_items) do properties.modded = false From 781760d67e11f5da7e1ba91c2ba80e04b4b9c4e4 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Tue, 14 Jan 2025 19:13:57 +0900 Subject: [PATCH 104/406] . --- exp_legacy/module/modules/gui/bonus.lua | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/exp_legacy/module/modules/gui/bonus.lua b/exp_legacy/module/modules/gui/bonus.lua index 1f89048f..f0ee48d8 100644 --- a/exp_legacy/module/modules/gui/bonus.lua +++ b/exp_legacy/module/modules/gui/bonus.lua @@ -75,23 +75,25 @@ local function apply_periodic_bonus(player) local disp = frame.container["bonus_st_2"].disp.table if vlayer.get_statistics()["energy_sustained"] > 0 then - --[[ - local armor = player.get_inventory(defines.inventory.character_armor)[1].grid + local armor = player.get_inventory(defines.inventory.character_armor)[1] if armor then - local slider = disp["bonus_display_personal_battery_recharge_slider"].slider_value * 100000 * config.player_special_bonus_rate / 6 + local armor_grid = armor.grid - for i = 1, #armor.equipment do - if armor.equipment[i].energy < armor.equipment[i].max_energy then - local energy_required = math.min(math.floor(armor.equipment[i].max_energy - armor.equipment[i].energy), vlayer.get_statistics()["energy_storage"], slider) - armor.equipment[i].energy = armor.equipment[i].energy + energy_required - vlayer.energy_changed(-energy_required) + if armor_grid then + local slider = disp["bonus_display_personal_battery_recharge_slider"].slider_value * 100000 * config.player_special_bonus_rate / 6 - slider = slider - energy_required + for i = 1, #armor_grid.equipment do + if armor_grid.equipment[i].energy < armor_grid.equipment[i].max_energy then + local energy_required = math.min(math.floor(armor_grid.equipment[i].max_energy - armor_grid.equipment[i].energy), vlayer.get_statistics()["energy_storage"], slider) + armor_grid.equipment[i].energy = armor_grid.equipment[i].energy + energy_required + vlayer.energy_changed(-energy_required) + + slider = slider - energy_required + end end end end - ]] end end From 7c87cfc8bc610c1074e2c3fea4134a5cbf0f7f5d Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Tue, 14 Jan 2025 19:19:55 +0900 Subject: [PATCH 105/406] . --- exp_legacy/module/modules/gui/vlayer.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/exp_legacy/module/modules/gui/vlayer.lua b/exp_legacy/module/modules/gui/vlayer.lua index e37c0437..44409c24 100644 --- a/exp_legacy/module/modules/gui/vlayer.lua +++ b/exp_legacy/module/modules/gui/vlayer.lua @@ -127,7 +127,7 @@ Selection.on_selection(SelectionConvertArea, function(event) vlayer.create_output_interface(event.surface, e_pos, e_circ, player) end - game.print{ "vlayer.interface-result", player.name, pos_to_gps_string(e_pos, event.surface), { "vlayer.result-build" }, { "vlayer.control-type-" .. target:gsub("_", "-") } } + game.print{ "vlayer.interface-result", player.name, pos_to_gps_string(e_pos, event.surface.name), { "vlayer.result-build" }, { "vlayer.control-type-" .. target:gsub("_", "-") } } end) --- Display label for the number of solar panels @@ -373,7 +373,7 @@ local vlayer_gui_control_see = local entity = i[vlayer_control_type_list[target]][n] if entity and entity.valid then player.set_controller{ type = defines.controllers.remote, position = entity.position, surface = entity.surface } - player.print{ "vlayer.result-interface-location", { "vlayer.control-type-" .. vlayer_control_type_list[target]:gsub("_", "-") }, pos_to_gps_string(entity.position, entity.surface) } + player.print{ "vlayer.result-interface-location", { "vlayer.control-type-" .. vlayer_control_type_list[target]:gsub("_", "-") }, pos_to_gps_string(entity.position, entity.surface.name) } end end end) @@ -418,7 +418,7 @@ local vlayer_gui_control_remove = local interface_type, interface_surface, interface_position = vlayer.remove_interface(i[vlayer_control_type_list[target]][n].surface, i[vlayer_control_type_list[target]][n].position) if interface_type then - game.print{ "vlayer.interface-result", player.name, pos_to_gps_string(interface_position, interface_surface), { "vlayer.result-remove" }, { "vlayer.control-type-" .. interface_type } } + game.print{ "vlayer.interface-result", player.name, pos_to_gps_string(interface_position, interface_surface.name), { "vlayer.result-remove" }, { "vlayer.control-type-" .. interface_type } } end end end From 29abf08b706f47c34824f818567d455718f003cc Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Tue, 14 Jan 2025 19:48:51 +0900 Subject: [PATCH 106/406] . --- exp_legacy/module/modules/gui/bonus.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/exp_legacy/module/modules/gui/bonus.lua b/exp_legacy/module/modules/gui/bonus.lua index f0ee48d8..266d811b 100644 --- a/exp_legacy/module/modules/gui/bonus.lua +++ b/exp_legacy/module/modules/gui/bonus.lua @@ -75,10 +75,10 @@ local function apply_periodic_bonus(player) local disp = frame.container["bonus_st_2"].disp.table if vlayer.get_statistics()["energy_sustained"] > 0 then - local armor = player.get_inventory(defines.inventory.character_armor)[1] + local armor = player.get_inventory(defines.inventory.character_armor) if armor then - local armor_grid = armor.grid + local armor_grid = armor[1].grid if armor_grid then local slider = disp["bonus_display_personal_battery_recharge_slider"].slider_value * 100000 * config.player_special_bonus_rate / 6 From 7784dbf3ad23734f49a51112f9ac6b1b958a41a3 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Tue, 14 Jan 2025 23:38:43 +0900 Subject: [PATCH 107/406] . --- exp_legacy/module/modules/gui/bonus.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exp_legacy/module/modules/gui/bonus.lua b/exp_legacy/module/modules/gui/bonus.lua index 266d811b..c4d63c17 100644 --- a/exp_legacy/module/modules/gui/bonus.lua +++ b/exp_legacy/module/modules/gui/bonus.lua @@ -77,7 +77,7 @@ local function apply_periodic_bonus(player) if vlayer.get_statistics()["energy_sustained"] > 0 then local armor = player.get_inventory(defines.inventory.character_armor) - if armor then + if armor and armor[1] then local armor_grid = armor[1].grid if armor_grid then From 736df61152952bb92590019ece64bca27704a4d7 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Wed, 15 Jan 2025 12:44:37 +0900 Subject: [PATCH 108/406] . --- exp_legacy/module/config/vlayer.lua | 2 +- exp_legacy/module/modules/control/vlayer.lua | 4 ---- exp_legacy/module/modules/gui/bonus.lua | 2 +- 3 files changed, 2 insertions(+), 6 deletions(-) diff --git a/exp_legacy/module/config/vlayer.lua b/exp_legacy/module/config/vlayer.lua index 70db3ac3..8406dd72 100644 --- a/exp_legacy/module/config/vlayer.lua +++ b/exp_legacy/module/config/vlayer.lua @@ -54,7 +54,7 @@ return { ["landfill"] = { starting_value = 0, required_area = 0, - surface_area = 8, -- Tiles + surface_area = 20, -- Tiles }, ["wood"] = { starting_value = 0, diff --git a/exp_legacy/module/modules/control/vlayer.lua b/exp_legacy/module/modules/control/vlayer.lua index 0b80127f..cff7aea8 100644 --- a/exp_legacy/module/modules/control/vlayer.lua +++ b/exp_legacy/module/modules/control/vlayer.lua @@ -40,10 +40,6 @@ Storage.register(vlayer_data, function(tbl) vlayer_data = tbl end) -if script.active_mods["space-age"] then - config.allowed_items.landfill.surface_area = math.floor(config.allowed_items.landfill.surface_area * 2.5) -end - for name, properties in pairs(config.allowed_items) do properties.modded = false diff --git a/exp_legacy/module/modules/gui/bonus.lua b/exp_legacy/module/modules/gui/bonus.lua index c4d63c17..25da2127 100644 --- a/exp_legacy/module/modules/gui/bonus.lua +++ b/exp_legacy/module/modules/gui/bonus.lua @@ -77,7 +77,7 @@ local function apply_periodic_bonus(player) if vlayer.get_statistics()["energy_sustained"] > 0 then local armor = player.get_inventory(defines.inventory.character_armor) - if armor and armor[1] then + if armor and armor[1] and armor[1].valid_for_read then local armor_grid = armor[1].grid if armor_grid then From 9fb1af24d29e096565299823560690279ea4be60 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Wed, 15 Jan 2025 16:50:05 +0900 Subject: [PATCH 109/406] . --- exp_legacy/module/modules/gui/bonus.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/exp_legacy/module/modules/gui/bonus.lua b/exp_legacy/module/modules/gui/bonus.lua index 25da2127..9ee65303 100644 --- a/exp_legacy/module/modules/gui/bonus.lua +++ b/exp_legacy/module/modules/gui/bonus.lua @@ -77,10 +77,10 @@ local function apply_periodic_bonus(player) if vlayer.get_statistics()["energy_sustained"] > 0 then local armor = player.get_inventory(defines.inventory.character_armor) - if armor and armor[1] and armor[1].valid_for_read then + if armor and armor[1] and armor[1].valid_for_read and armor[1].grid then local armor_grid = armor[1].grid - if armor_grid then + if armor_grid and armor_grid.available_in_batteries and armor_grid.battery_capacity and armor_grid.available_in_batteries < armor_grid.battery_capacity then local slider = disp["bonus_display_personal_battery_recharge_slider"].slider_value * 100000 * config.player_special_bonus_rate / 6 for i = 1, #armor_grid.equipment do From 8ad24b3afd0ba4593ac6e2549bafcb59d6c96549 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Wed, 15 Jan 2025 17:36:34 +0900 Subject: [PATCH 110/406] . --- exp_legacy/module/modules/addons/compilatron.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exp_legacy/module/modules/addons/compilatron.lua b/exp_legacy/module/modules/addons/compilatron.lua index c72020fa..c6843a8c 100644 --- a/exp_legacy/module/modules/addons/compilatron.lua +++ b/exp_legacy/module/modules/addons/compilatron.lua @@ -44,7 +44,7 @@ local speech_bubble_async = local function circle_messages() for name, ent in pairs(Public.compilatrons) do if not ent.valid then - Public.spawn_compilatron(game.players[1].surface or game.surfaces[1], name) + Public.spawn_compilatron(game.surfaces[1] or game.players[1].surface, name) end local current_message = Public.current_messages[name] local msg_number From f9405b930deec906d37c754267d9bda2119e25d4 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Thu, 16 Jan 2025 14:06:51 +0900 Subject: [PATCH 111/406] . --- exp_legacy/module/config/research.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/exp_legacy/module/config/research.lua b/exp_legacy/module/config/research.lua index 7ba2e223..07925afa 100644 --- a/exp_legacy/module/config/research.lua +++ b/exp_legacy/module/config/research.lua @@ -114,9 +114,9 @@ return { -- Robot Speed ["worker-robots-speed-7"] = 7, -- Laser Damage - ["energy-weapons-damage-7"] = 7, + ["laser-weapons-damage-7"] = 7, -- Electric Damage - ["electric-weapons-damage-3"] = 3, + ["electric-weapons-damage-4"] = 4, -- Explosive Damage ["stronger-explosives-7"] = 7, -- Bullet Damage From 55fe9b6069ef8c89f1a1dcfb346dd9b0b22fd6c4 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Fri, 17 Jan 2025 18:05:21 +0900 Subject: [PATCH 112/406] . --- exp_legacy/module/modules/control/vlayer.lua | 21 ++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/exp_legacy/module/modules/control/vlayer.lua b/exp_legacy/module/modules/control/vlayer.lua index cff7aea8..01633c9d 100644 --- a/exp_legacy/module/modules/control/vlayer.lua +++ b/exp_legacy/module/modules/control/vlayer.lua @@ -439,19 +439,20 @@ local function handle_output_interfaces() vlayer_data.entity_interfaces.storage_output[index] = nil else local inventory = interface.get_inventory(defines.inventory.chest) + local inventory_request_sections = interface.get_or_create_control_behavior().sections - for i = 1, interface.request_slot_count do - local request = interface.get_request_slot(i) + for i = 1, #inventory_request_sections do + for _, v in pairs(inventory_request_sections[i].filters) do + if v.value and config.allowed_items[v.value.name] then + local current_amount = inventory.get_item_count(v.value.name) + local request_amount = math.min(v.min - current_amount, vlayer_data.storage.items[v.value.name]) - if request and config.allowed_items[request.name] then - local current_amount = inventory.get_item_count(request.name) - local request_amount = math.min(request.count - current_amount, vlayer_data.storage.items[request.name]) + if request_amount > 0 and inventory.can_insert{ name = v.value.name, count = request_amount } then + local removed_item_count = vlayer.remove_item(v.value.name, request_amount) - if request_amount > 0 and inventory.can_insert{ name = request.name, count = request_amount } then - local removed_item_count = vlayer.remove_item(request.name, request_amount) - - if removed_item_count > 0 then - inventory.insert{ name = request.name, count = removed_item_count } + if removed_item_count > 0 then + inventory.insert{ name = v.value.name, count = removed_item_count, quality = "normal" } + end end end end From e2173cc57d766c9e2750c58d4ec2445fb039ee9e Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Fri, 17 Jan 2025 20:05:42 +0900 Subject: [PATCH 113/406] . --- exp_scenario/module/locale/en.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exp_scenario/module/locale/en.cfg b/exp_scenario/module/locale/en.cfg index 52edc056..f2086f9c 100644 --- a/exp_scenario/module/locale/en.cfg +++ b/exp_scenario/module/locale/en.cfg @@ -275,7 +275,7 @@ cleared-last=__1__ had their last warning cleared by __2__. description=Replace tiles with shallow water. requires-explosives=__ITEM__cliff-explosives__ are required to create water. enter=Entered waterfill selection mode, select the area to fill with water. -exit=Exited water fill seclection mode. +exit=Exited waterfill seclection mode. nauvis-only=Can only waterfill on Nauvis, this may change in the future. area-too-large=Selected area is too large, must be less than __1__ tiles, selected __2__. too-few-explosives=Requires __1__ __ITEM__cliff-explosives__ you have __2__. From 3fd2876ba785d04a72323b937bdbe117835c1a15 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Fri, 17 Jan 2025 20:07:36 +0900 Subject: [PATCH 114/406] . --- exp_legacy/module/locale/en/gui.cfg | 2 ++ exp_scenario/module/locale/en.cfg | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/exp_legacy/module/locale/en/gui.cfg b/exp_legacy/module/locale/en/gui.cfg index 0e9058bf..6252ec27 100644 --- a/exp_legacy/module/locale/en/gui.cfg +++ b/exp_legacy/module/locale/en/gui.cfg @@ -289,6 +289,8 @@ control-type-energy=Energy control-type-circuit=Circuit control-type-storage-input=Storage Input control-type-storage-output=Storage Output +enter=Entered vlayer selection mode. +exit=Exited vlayer selection mode. [module] main-tooltip=Module GUI diff --git a/exp_scenario/module/locale/en.cfg b/exp_scenario/module/locale/en.cfg index f2086f9c..2dd747e4 100644 --- a/exp_scenario/module/locale/en.cfg +++ b/exp_scenario/module/locale/en.cfg @@ -275,7 +275,7 @@ cleared-last=__1__ had their last warning cleared by __2__. description=Replace tiles with shallow water. requires-explosives=__ITEM__cliff-explosives__ are required to create water. enter=Entered waterfill selection mode, select the area to fill with water. -exit=Exited waterfill seclection mode. +exit=Exited waterfill selection mode. nauvis-only=Can only waterfill on Nauvis, this may change in the future. area-too-large=Selected area is too large, must be less than __1__ tiles, selected __2__. too-few-explosives=Requires __1__ __ITEM__cliff-explosives__ you have __2__. From 3f351df82d55d28eaf79fb326abb99d81f1ff2eb Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Fri, 17 Jan 2025 20:09:48 +0900 Subject: [PATCH 115/406] . --- exp_legacy/module/locale/zh-CN/gui.cfg | 2 ++ exp_legacy/module/locale/zh-TW/gui.cfg | 2 ++ exp_scenario/module/locale/zh-CN.cfg | 4 ++-- exp_scenario/module/locale/zh-TW.cfg | 4 ++-- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/exp_legacy/module/locale/zh-CN/gui.cfg b/exp_legacy/module/locale/zh-CN/gui.cfg index 657363f1..da2ac6bb 100644 --- a/exp_legacy/module/locale/zh-CN/gui.cfg +++ b/exp_legacy/module/locale/zh-CN/gui.cfg @@ -289,6 +289,8 @@ control-type-energy=電力 control-type-circuit=回路 control-type-storage-input=放入箱 control-type-storage-output=提取箱 +enter=現在進入 vlayer 區域選擇 +exit=已進入 vlayer 區域選擇 [module] main-tooltip=模組介面 diff --git a/exp_legacy/module/locale/zh-TW/gui.cfg b/exp_legacy/module/locale/zh-TW/gui.cfg index 657363f1..da2ac6bb 100644 --- a/exp_legacy/module/locale/zh-TW/gui.cfg +++ b/exp_legacy/module/locale/zh-TW/gui.cfg @@ -289,6 +289,8 @@ control-type-energy=電力 control-type-circuit=回路 control-type-storage-input=放入箱 control-type-storage-output=提取箱 +enter=現在進入 vlayer 區域選擇 +exit=已進入 vlayer 區域選擇 [module] main-tooltip=模組介面 diff --git a/exp_scenario/module/locale/zh-CN.cfg b/exp_scenario/module/locale/zh-CN.cfg index 109dd7ce..6abe8229 100644 --- a/exp_scenario/module/locale/zh-CN.cfg +++ b/exp_scenario/module/locale/zh-CN.cfg @@ -274,8 +274,8 @@ cleared-last=__1__ 的最後警告己被 __2__ 清除。 [exp-commands_waterfill] description=把地換為淺水。 requires-explosives=沒有足夠的 __ITEM__cliff-explosives__ 。 -enter=現在進入區域選擇 -exit=已進入區域選擇 +enter=現在進入挖水區域選擇 +exit=已進入挖水區域選擇 nauvis-only=只可在地星上填水,之後可能會再改變。 area-too-large=區域太大了,需少過 __1__ 格,你選了 __2__ 格。 too-few-explosives=需要 __1__ 個 __ITEM__cliff-explosives__,你現在有 __2__ 個。 diff --git a/exp_scenario/module/locale/zh-TW.cfg b/exp_scenario/module/locale/zh-TW.cfg index 109dd7ce..6abe8229 100644 --- a/exp_scenario/module/locale/zh-TW.cfg +++ b/exp_scenario/module/locale/zh-TW.cfg @@ -274,8 +274,8 @@ cleared-last=__1__ 的最後警告己被 __2__ 清除。 [exp-commands_waterfill] description=把地換為淺水。 requires-explosives=沒有足夠的 __ITEM__cliff-explosives__ 。 -enter=現在進入區域選擇 -exit=已進入區域選擇 +enter=現在進入挖水區域選擇 +exit=已進入挖水區域選擇 nauvis-only=只可在地星上填水,之後可能會再改變。 area-too-large=區域太大了,需少過 __1__ 格,你選了 __2__ 格。 too-few-explosives=需要 __1__ 個 __ITEM__cliff-explosives__,你現在有 __2__ 個。 From e291759cb733aa75654f2a705d62f2a3a77bba29 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Fri, 17 Jan 2025 20:14:03 +0900 Subject: [PATCH 116/406] . --- exp_legacy/module/modules/gui/vlayer.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/exp_legacy/module/modules/gui/vlayer.lua b/exp_legacy/module/modules/gui/vlayer.lua index 44409c24..12595259 100644 --- a/exp_legacy/module/modules/gui/vlayer.lua +++ b/exp_legacy/module/modules/gui/vlayer.lua @@ -390,9 +390,10 @@ local vlayer_gui_control_build = }:on_click(function(player, _, _) if Selection.is_selecting(player, SelectionConvertArea) then Selection.stop(player) + player.print{ "vlayer.exit" } else Selection.start(player, SelectionConvertArea) - player.print{ "exp-commands_waterfill.entered-area-selection" } + player.print{ "vlayer.enter" } end vlayer_gui_list_refresh(player) From c56f8b4f27d43afc695aef128d031d4dd9adf645 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Mon, 20 Jan 2025 16:19:52 +0900 Subject: [PATCH 117/406] . --- exp_legacy/module/modules/control/vlayer.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exp_legacy/module/modules/control/vlayer.lua b/exp_legacy/module/modules/control/vlayer.lua index 01633c9d..0bdb9ba3 100644 --- a/exp_legacy/module/modules/control/vlayer.lua +++ b/exp_legacy/module/modules/control/vlayer.lua @@ -439,7 +439,7 @@ local function handle_output_interfaces() vlayer_data.entity_interfaces.storage_output[index] = nil else local inventory = interface.get_inventory(defines.inventory.chest) - local inventory_request_sections = interface.get_or_create_control_behavior().sections + local inventory_request_sections = interface.get_logistic_sections().sections for i = 1, #inventory_request_sections do for _, v in pairs(inventory_request_sections[i].filters) do From 79f6747f79d5ba7f9758bdcf371077847cbab285 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Mon, 20 Jan 2025 16:26:27 +0900 Subject: [PATCH 118/406] . --- exp_util/module/module_exports.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/exp_util/module/module_exports.lua b/exp_util/module/module_exports.lua index f7059c5f..a41fdb04 100644 --- a/exp_util/module/module_exports.lua +++ b/exp_util/module/module_exports.lua @@ -277,15 +277,15 @@ function ExpUtil.extract_time_units(ticks, units) -- Remove units that are not requested if not units.days then - rtn.hours = rtn.hours + rtn.days * 24 + rtn.hours = rtn.hours + (rtn.days or 0) * 24 rtn.days = nil end if not units.hours then - rtn.minutes = rtn.minutes + rtn.hours * 60 + rtn.minutes = rtn.minutes + (rtn.hours or 0) * 60 rtn.hours = nil end if not units.minutes then - rtn.seconds = rtn.seconds + rtn.minutes * 60 + rtn.seconds = rtn.seconds + (rtn.minutes or 0) * 60 rtn.minutes = nil end if not units.seconds then From 7b7482b70d371057b0fdfbe1a50a133116dd6105 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Mon, 20 Jan 2025 16:27:56 +0900 Subject: [PATCH 119/406] . --- exp_util/module/module_exports.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/exp_util/module/module_exports.lua b/exp_util/module/module_exports.lua index a41fdb04..2d58ee9e 100644 --- a/exp_util/module/module_exports.lua +++ b/exp_util/module/module_exports.lua @@ -277,15 +277,15 @@ function ExpUtil.extract_time_units(ticks, units) -- Remove units that are not requested if not units.days then - rtn.hours = rtn.hours + (rtn.days or 0) * 24 + rtn.hours = (rtn.hours or 0) + (rtn.days or 0) * 24 rtn.days = nil end if not units.hours then - rtn.minutes = rtn.minutes + (rtn.hours or 0) * 60 + rtn.minutes = (rtn.minutes or 0) + (rtn.hours or 0) * 60 rtn.hours = nil end if not units.minutes then - rtn.seconds = rtn.seconds + (rtn.minutes or 0) * 60 + rtn.seconds = (rtn.seconds or 0) + (rtn.minutes or 0) * 60 rtn.minutes = nil end if not units.seconds then From f21586192d6c1c29b0f570fbd52886f30bd6558b Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Mon, 20 Jan 2025 16:29:52 +0900 Subject: [PATCH 120/406] . --- exp_util/module/module_exports.lua | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/exp_util/module/module_exports.lua b/exp_util/module/module_exports.lua index 2d58ee9e..4d0bb78a 100644 --- a/exp_util/module/module_exports.lua +++ b/exp_util/module/module_exports.lua @@ -265,6 +265,7 @@ end --- @param units Common.format_time_param_units A table selecting which units should be displayed, options are: days, hours, minutes, seconds --- @return Common.extract_time_units_return function ExpUtil.extract_time_units(ticks, units) + ticks = ticks or 0 -- Calculate the values to be determine the display values local max_days, max_hours, max_minutes, max_seconds = ticks / 5184000, ticks / 216000, ticks / 3600, ticks / 60 @@ -277,15 +278,15 @@ function ExpUtil.extract_time_units(ticks, units) -- Remove units that are not requested if not units.days then - rtn.hours = (rtn.hours or 0) + (rtn.days or 0) * 24 + rtn.hours = rtn.hours + rtn.days * 24 rtn.days = nil end if not units.hours then - rtn.minutes = (rtn.minutes or 0) + (rtn.hours or 0) * 60 + rtn.minutes = rtn.minutes + rtn.hours * 60 rtn.hours = nil end if not units.minutes then - rtn.seconds = (rtn.seconds or 0) + (rtn.minutes or 0) * 60 + rtn.seconds = rtn.seconds + rtn.minutes * 60 rtn.minutes = nil end if not units.seconds then From f95f5faad9f9e71c780732b95f98fc60cdbc02cc Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Mon, 20 Jan 2025 16:33:10 +0900 Subject: [PATCH 121/406] . --- exp_util/module/module_exports.lua | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/exp_util/module/module_exports.lua b/exp_util/module/module_exports.lua index 4d0bb78a..616758d2 100644 --- a/exp_util/module/module_exports.lua +++ b/exp_util/module/module_exports.lua @@ -265,15 +265,14 @@ end --- @param units Common.format_time_param_units A table selecting which units should be displayed, options are: days, hours, minutes, seconds --- @return Common.extract_time_units_return function ExpUtil.extract_time_units(ticks, units) - ticks = ticks or 0 -- Calculate the values to be determine the display values local max_days, max_hours, max_minutes, max_seconds = ticks / 5184000, ticks / 216000, ticks / 3600, ticks / 60 local rtn = { - day = floor(max_days), - hours = floor(max_hours - floor(max_days) * 24), - minutes = floor(max_minutes - floor(max_hours) * 60), - seconds = floor(max_seconds - floor(max_minutes) * 60), + day = floor(max_days) or 0, + hours = floor(max_hours - floor(max_days) * 24) or 0, + minutes = floor(max_minutes - floor(max_hours) * 60) or 0, + seconds = floor(max_seconds - floor(max_minutes) * 60) or 0, } -- Remove units that are not requested From ab12a8be527fc5a5d7973ea98c4ba7b0cd0045b3 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Mon, 20 Jan 2025 16:36:41 +0900 Subject: [PATCH 122/406] . --- exp_util/module/module_exports.lua | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/exp_util/module/module_exports.lua b/exp_util/module/module_exports.lua index 616758d2..afdc0cf0 100644 --- a/exp_util/module/module_exports.lua +++ b/exp_util/module/module_exports.lua @@ -269,10 +269,10 @@ function ExpUtil.extract_time_units(ticks, units) local max_days, max_hours, max_minutes, max_seconds = ticks / 5184000, ticks / 216000, ticks / 3600, ticks / 60 local rtn = { - day = floor(max_days) or 0, - hours = floor(max_hours - floor(max_days) * 24) or 0, - minutes = floor(max_minutes - floor(max_hours) * 60) or 0, - seconds = floor(max_seconds - floor(max_minutes) * 60) or 0, + days = floor(max_days), + hours = floor(max_hours - floor(max_days) * 24), + minutes = floor(max_minutes - floor(max_hours) * 60), + seconds = floor(max_seconds - floor(max_minutes) * 60), } -- Remove units that are not requested From 3c876d4873a0b63a25c03f209c1727f69e63eb9c Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Mon, 20 Jan 2025 22:54:38 +0900 Subject: [PATCH 123/406] . --- exp_legacy/module/config/research.lua | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/exp_legacy/module/config/research.lua b/exp_legacy/module/config/research.lua index 07925afa..df106aa7 100644 --- a/exp_legacy/module/config/research.lua +++ b/exp_legacy/module/config/research.lua @@ -106,7 +106,9 @@ return { -- Artillery Range ["artillery-shell-range-1"] = 1, -- Artillery Speed - ["artillery-shell-speed-1"] = 1 + ["artillery-shell-speed-1"] = 1, + -- Follower Robot Count + ["follower-robot-count-5"] = 5, }, ["space-age"] = { -- Mining Productivity @@ -152,7 +154,9 @@ return { -- Rocket Fuel Productivity ["rocket-fuel-productivity"] = 1, -- Rocket Part Productivity - ["rocket-part-productivity"] = 1 + ["rocket-part-productivity"] = 1, + -- Follower Robot Count + ["follower-robot-count-5"] = 5, } }, } From 30f9e325500d23db0478c06127f52f1708c9dd49 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Tue, 21 Jan 2025 19:05:14 +0900 Subject: [PATCH 124/406] . --- exp_legacy/module/config/nukeprotect.lua | 4 ---- exp_legacy/module/config/research.lua | 9 +++++++++ exp_legacy/module/modules/addons/nukeprotect.lua | 9 --------- exp_legacy/module/modules/gui/research.lua | 9 +++++++++ 4 files changed, 18 insertions(+), 13 deletions(-) diff --git a/exp_legacy/module/config/nukeprotect.lua b/exp_legacy/module/config/nukeprotect.lua index 65af3830..f80b6a7a 100644 --- a/exp_legacy/module/config/nukeprotect.lua +++ b/exp_legacy/module/config/nukeprotect.lua @@ -27,8 +27,4 @@ return { }, ignore_permisison = "bypass-nukeprotect", -- @setting ignore_permisison The permission that nukeprotect will ignore ignore_admins = true, -- @setting ignore_admins Ignore admins, true by default. Allows usage outside of the roles module - disable_nuke_research = false, -- @setting disable_nuke_research Disable the nuke research, true by default - disable_nuke_research_names = { - ["atomic-bomb"] = true, - }, -- @setting disable_nuke_research_names The names of the researches to disabled } diff --git a/exp_legacy/module/config/research.lua b/exp_legacy/module/config/research.lua index df106aa7..c2c705d7 100644 --- a/exp_legacy/module/config/research.lua +++ b/exp_legacy/module/config/research.lua @@ -159,4 +159,13 @@ return { ["follower-robot-count-5"] = 5, } }, + -- prevent research up to a certain level + limit_res = { + -- Artillery Range + ["artillery-shell-range-1"] = 7, + -- Artillery Speed + ["artillery-shell-speed-1"] = 7, + -- Atomic Bomb + -- ["atomic-bomb"] = 1 + }, } diff --git a/exp_legacy/module/modules/addons/nukeprotect.lua b/exp_legacy/module/modules/addons/nukeprotect.lua index e474de28..59238290 100644 --- a/exp_legacy/module/modules/addons/nukeprotect.lua +++ b/exp_legacy/module/modules/addons/nukeprotect.lua @@ -43,12 +43,3 @@ for _, inventory in ipairs(config.inventories) do end) end end - -if config.disable_nuke_research then - Event.add(defines.events.on_research_started, function(event) - local name = event.research.name - if config.disable_nuke_research_names[name] then - event.research.force.cancel_current_research() - end - end) -end diff --git a/exp_legacy/module/modules/gui/research.lua b/exp_legacy/module/modules/gui/research.lua index 3325581a..06865eb9 100644 --- a/exp_legacy/module/modules/gui/research.lua +++ b/exp_legacy/module/modules/gui/research.lua @@ -309,6 +309,15 @@ Event.add(defines.events.on_research_finished, function(event) end end) +Event.add(defines.events.on_research_started, function(event) + local r = event.research + local res_name = config.limit_res[r.name] + + if res_name and r.level > res_name then + table.remove(r.force.research_queue) + end +end) + Event.on_nth_tick(60, function() local current_time = research_time_format(game.tick) From e3d42442d4540458707b78586f7803fae61e9a4f Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Tue, 21 Jan 2025 19:33:31 +0900 Subject: [PATCH 125/406] . --- exp_legacy/module/modules/gui/research.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/exp_legacy/module/modules/gui/research.lua b/exp_legacy/module/modules/gui/research.lua index 06865eb9..5ac84803 100644 --- a/exp_legacy/module/modules/gui/research.lua +++ b/exp_legacy/module/modules/gui/research.lua @@ -311,9 +311,9 @@ end) Event.add(defines.events.on_research_started, function(event) local r = event.research - local res_name = config.limit_res[r.name] + local rn = config.limit_res[r.name] - if res_name and r.level > res_name then + if rn and r.level > rn then table.remove(r.force.research_queue) end end) From 8376f240bbc03066785f1fb3262664cb018e0237 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Tue, 21 Jan 2025 19:52:12 +0900 Subject: [PATCH 126/406] . --- exp_legacy/module/modules/gui/research.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exp_legacy/module/modules/gui/research.lua b/exp_legacy/module/modules/gui/research.lua index 5ac84803..4d78c29d 100644 --- a/exp_legacy/module/modules/gui/research.lua +++ b/exp_legacy/module/modules/gui/research.lua @@ -314,7 +314,7 @@ Event.add(defines.events.on_research_started, function(event) local rn = config.limit_res[r.name] if rn and r.level > rn then - table.remove(r.force.research_queue) + r.force.research_queue = table.remove(r.force.research_queue) end end) From 9b72f9e127f8eb3b6c6ab469be060ed2dcf39e95 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Tue, 21 Jan 2025 19:58:57 +0900 Subject: [PATCH 127/406] . --- exp_legacy/module/modules/gui/research.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exp_legacy/module/modules/gui/research.lua b/exp_legacy/module/modules/gui/research.lua index 4d78c29d..f33e69bf 100644 --- a/exp_legacy/module/modules/gui/research.lua +++ b/exp_legacy/module/modules/gui/research.lua @@ -314,7 +314,7 @@ Event.add(defines.events.on_research_started, function(event) local rn = config.limit_res[r.name] if rn and r.level > rn then - r.force.research_queue = table.remove(r.force.research_queue) + r.force.cancel_current_research() end end) From d101dc1f11996c3be6568557a04f144fd0f3046d Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Tue, 21 Jan 2025 20:07:41 +0900 Subject: [PATCH 128/406] . --- exp_legacy/module/modules/gui/research.lua | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/exp_legacy/module/modules/gui/research.lua b/exp_legacy/module/modules/gui/research.lua index f33e69bf..a04c3043 100644 --- a/exp_legacy/module/modules/gui/research.lua +++ b/exp_legacy/module/modules/gui/research.lua @@ -311,10 +311,12 @@ end) Event.add(defines.events.on_research_started, function(event) local r = event.research - local rn = config.limit_res[r.name] + local rq = r.force.research_queue - if rn and r.level > rn then - r.force.cancel_current_research() + for i = #rq, 1, -1 do + if config.limit_res[rq[i]] and rq[i].level > config.limit_res[rq[i]] then + r.force.cancel_current_research() + end end end) From 4ab3fb0b4d3f3f2a48cb0a3a6830de2ba6a19868 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Tue, 21 Jan 2025 20:42:09 +0900 Subject: [PATCH 129/406] . --- exp_legacy/module/modules/gui/research.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/exp_legacy/module/modules/gui/research.lua b/exp_legacy/module/modules/gui/research.lua index a04c3043..d96b2b94 100644 --- a/exp_legacy/module/modules/gui/research.lua +++ b/exp_legacy/module/modules/gui/research.lua @@ -309,16 +309,18 @@ Event.add(defines.events.on_research_finished, function(event) end end) +--[[ Event.add(defines.events.on_research_started, function(event) local r = event.research local rq = r.force.research_queue for i = #rq, 1, -1 do - if config.limit_res[rq[i]] and rq[i].level > config.limit_res[rq[i]] then + if config.limit_res[rq[i] ] and rq[i].level > config.limit_res[rq[i] ] then r.force.cancel_current_research() end end end) +]] Event.on_nth_tick(60, function() local current_time = research_time_format(game.tick) From 70625f08880812cb08bd8864cd12b9cb0e040749 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Wed, 22 Jan 2025 18:01:47 +0900 Subject: [PATCH 130/406] . --- exp_scenario/module/commands/waterfill.lua | 26 ++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/exp_scenario/module/commands/waterfill.lua b/exp_scenario/module/commands/waterfill.lua index 1451112e..ef4c57b7 100644 --- a/exp_scenario/module/commands/waterfill.lua +++ b/exp_scenario/module/commands/waterfill.lua @@ -36,15 +36,26 @@ Selection.on_selection(SelectionName, function(event) ]] local area_size = (area.right_bottom.x - area.left_top.x) * (area.right_bottom.y - area.left_top.y) + if area_size > 1000 then player.print({ "exp-commands_waterfill.area-too-large", 1000, area_size }, Commands.print_settings.error) return end - local item_count = player.get_item_count("cliff-explosives") - if item_count < area_size then - player.print({ "exp-commands_waterfill.too-few-explosives", area_size, item_count }, Commands.print_settings.error) + local item_count_cliff = player.get_item_count("cliff-explosives") + local item_count_cliff_craft = math.min(math.floor(player.get_item_count("explosives") / 10), player.get_item_count("barrel"), player.get_item_count("grenade")) + local item_count_type_bool = true + + if item_count_cliff > 0 and item_count_cliff < area_size then + player.print({ "exp-commands_waterfill.too-few-explosives", area_size, item_count_cliff }, Commands.print_settings.error) return + elseif item_count_cliff_craft > 0 then + if item_count_cliff_craft < area_size then + player.print({ "exp-commands_waterfill.too-few-explosives", area_size, item_count_cliff_craft }, Commands.print_settings.error) + return + else + item_count_type_bool = false + end end local tile_count = 0 @@ -61,7 +72,14 @@ Selection.on_selection(SelectionName, function(event) surface.set_tiles(tiles_to_make, true, "abort_on_collision", true, false, player, 0) local remaining_tiles = surface.count_tiles_filtered{ area = area, name = "water-mud" } - player.remove_item{ name = "cliff-explosives", count = tile_count - remaining_tiles } + + if item_count_type_bool then + player.remove_item{ name = "cliff-explosives", count = tile_count - remaining_tiles } + else + player.remove_item{ name = "explosives", count = 10 * (tile_count - remaining_tiles) } + player.remove_item{ name = "barrel", count = tile_count - remaining_tiles } + player.remove_item{ name = "grenade", count = tile_count - remaining_tiles } + end if remaining_tiles > 0 then player.print({ "exp-commands_waterfill.part-complete", tile_count, remaining_tiles }, Commands.print_settings.default) From b8f78835d09473594e7b23c6c3a0f0e9a999fe29 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Wed, 22 Jan 2025 18:11:19 +0900 Subject: [PATCH 131/406] . --- exp_scenario/module/commands/waterfill.lua | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/exp_scenario/module/commands/waterfill.lua b/exp_scenario/module/commands/waterfill.lua index ef4c57b7..0603e613 100644 --- a/exp_scenario/module/commands/waterfill.lua +++ b/exp_scenario/module/commands/waterfill.lua @@ -72,13 +72,14 @@ Selection.on_selection(SelectionName, function(event) surface.set_tiles(tiles_to_make, true, "abort_on_collision", true, false, player, 0) local remaining_tiles = surface.count_tiles_filtered{ area = area, name = "water-mud" } + local t_diff = tile_count - remaining_tiles if item_count_type_bool then - player.remove_item{ name = "cliff-explosives", count = tile_count - remaining_tiles } + player.remove_item{ name = "cliff-explosives", count = t_diff } else - player.remove_item{ name = "explosives", count = 10 * (tile_count - remaining_tiles) } - player.remove_item{ name = "barrel", count = tile_count - remaining_tiles } - player.remove_item{ name = "grenade", count = tile_count - remaining_tiles } + player.remove_item{ name = "explosives", count = 10 * t_diff } + player.remove_item{ name = "barrel", count = t_diff } + player.remove_item{ name = "grenade", count = t_diff } end if remaining_tiles > 0 then From 3914e4594d2cb5508cd5a6ed67e369881368728f Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Wed, 22 Jan 2025 18:17:14 +0900 Subject: [PATCH 132/406] . --- exp_scenario/module/commands/waterfill.lua | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/exp_scenario/module/commands/waterfill.lua b/exp_scenario/module/commands/waterfill.lua index 0603e613..3525c658 100644 --- a/exp_scenario/module/commands/waterfill.lua +++ b/exp_scenario/module/commands/waterfill.lua @@ -43,19 +43,22 @@ Selection.on_selection(SelectionName, function(event) end local item_count_cliff = player.get_item_count("cliff-explosives") - local item_count_cliff_craft = math.min(math.floor(player.get_item_count("explosives") / 10), player.get_item_count("barrel"), player.get_item_count("grenade")) + local item_count_craft = math.min(math.floor(player.get_item_count("explosives") / 10), player.get_item_count("barrel"), player.get_item_count("grenade")) local item_count_type_bool = true + local item_count_cliff_ne = false + local item_count_craft_ne = false - if item_count_cliff > 0 and item_count_cliff < area_size then + if item_count_cliff < area_size then + item_count_cliff_ne = true + elseif item_count_craft < area_size then + item_count_craft_ne = true + end + + if item_count_cliff_ne and item_count_craft_ne then player.print({ "exp-commands_waterfill.too-few-explosives", area_size, item_count_cliff }, Commands.print_settings.error) return - elseif item_count_cliff_craft > 0 then - if item_count_cliff_craft < area_size then - player.print({ "exp-commands_waterfill.too-few-explosives", area_size, item_count_cliff_craft }, Commands.print_settings.error) - return - else - item_count_type_bool = false - end + elseif item_count_cliff_ne and (not item_count_craft_ne) then + item_count_type_bool = false end local tile_count = 0 From 112d5b7bdaf7f88bd419b46b21bc80e138756c05 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Wed, 22 Jan 2025 18:27:36 +0900 Subject: [PATCH 133/406] . --- exp_scenario/module/commands/waterfill.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/exp_scenario/module/commands/waterfill.lua b/exp_scenario/module/commands/waterfill.lua index 3525c658..65e2b21e 100644 --- a/exp_scenario/module/commands/waterfill.lua +++ b/exp_scenario/module/commands/waterfill.lua @@ -57,7 +57,9 @@ Selection.on_selection(SelectionName, function(event) if item_count_cliff_ne and item_count_craft_ne then player.print({ "exp-commands_waterfill.too-few-explosives", area_size, item_count_cliff }, Commands.print_settings.error) return - elseif item_count_cliff_ne and (not item_count_craft_ne) then + end + + if item_count_cliff_ne and (not item_count_craft_ne) then item_count_type_bool = false end From fe901c5f11f58b14fcfc02354a8dcaff365bf4ce Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Wed, 22 Jan 2025 18:30:24 +0900 Subject: [PATCH 134/406] . --- exp_scenario/module/commands/waterfill.lua | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/exp_scenario/module/commands/waterfill.lua b/exp_scenario/module/commands/waterfill.lua index 65e2b21e..e86e4445 100644 --- a/exp_scenario/module/commands/waterfill.lua +++ b/exp_scenario/module/commands/waterfill.lua @@ -44,7 +44,6 @@ Selection.on_selection(SelectionName, function(event) local item_count_cliff = player.get_item_count("cliff-explosives") local item_count_craft = math.min(math.floor(player.get_item_count("explosives") / 10), player.get_item_count("barrel"), player.get_item_count("grenade")) - local item_count_type_bool = true local item_count_cliff_ne = false local item_count_craft_ne = false @@ -59,10 +58,6 @@ Selection.on_selection(SelectionName, function(event) return end - if item_count_cliff_ne and (not item_count_craft_ne) then - item_count_type_bool = false - end - local tile_count = 0 local tiles_to_make = {} for x = area.left_top.x, area.right_bottom.x do @@ -79,7 +74,7 @@ Selection.on_selection(SelectionName, function(event) local remaining_tiles = surface.count_tiles_filtered{ area = area, name = "water-mud" } local t_diff = tile_count - remaining_tiles - if item_count_type_bool then + if (not item_count_cliff_ne) and item_count_craft_ne then player.remove_item{ name = "cliff-explosives", count = t_diff } else player.remove_item{ name = "explosives", count = 10 * t_diff } From 733c70823af73583be24e976c24125fbdf67b6c0 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Wed, 22 Jan 2025 18:31:07 +0900 Subject: [PATCH 135/406] . --- exp_scenario/module/commands/waterfill.lua | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/exp_scenario/module/commands/waterfill.lua b/exp_scenario/module/commands/waterfill.lua index e86e4445..7070586c 100644 --- a/exp_scenario/module/commands/waterfill.lua +++ b/exp_scenario/module/commands/waterfill.lua @@ -47,13 +47,7 @@ Selection.on_selection(SelectionName, function(event) local item_count_cliff_ne = false local item_count_craft_ne = false - if item_count_cliff < area_size then - item_count_cliff_ne = true - elseif item_count_craft < area_size then - item_count_craft_ne = true - end - - if item_count_cliff_ne and item_count_craft_ne then + if item_count_cliff < area_size and item_count_craft < area_size then player.print({ "exp-commands_waterfill.too-few-explosives", area_size, item_count_cliff }, Commands.print_settings.error) return end From b297b0d0b7f71af1cd548a3b0c2d2f955d5d3483 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Wed, 22 Jan 2025 18:32:28 +0900 Subject: [PATCH 136/406] . --- exp_scenario/module/commands/waterfill.lua | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/exp_scenario/module/commands/waterfill.lua b/exp_scenario/module/commands/waterfill.lua index 7070586c..570be202 100644 --- a/exp_scenario/module/commands/waterfill.lua +++ b/exp_scenario/module/commands/waterfill.lua @@ -44,10 +44,8 @@ Selection.on_selection(SelectionName, function(event) local item_count_cliff = player.get_item_count("cliff-explosives") local item_count_craft = math.min(math.floor(player.get_item_count("explosives") / 10), player.get_item_count("barrel"), player.get_item_count("grenade")) - local item_count_cliff_ne = false - local item_count_craft_ne = false - if item_count_cliff < area_size and item_count_craft < area_size then + if (item_count_cliff < area_size) and (item_count_craft < area_size) then player.print({ "exp-commands_waterfill.too-few-explosives", area_size, item_count_cliff }, Commands.print_settings.error) return end @@ -68,7 +66,7 @@ Selection.on_selection(SelectionName, function(event) local remaining_tiles = surface.count_tiles_filtered{ area = area, name = "water-mud" } local t_diff = tile_count - remaining_tiles - if (not item_count_cliff_ne) and item_count_craft_ne then + if item_count_cliff >= area_size then player.remove_item{ name = "cliff-explosives", count = t_diff } else player.remove_item{ name = "explosives", count = 10 * t_diff } From 5e1c27d52fbb02205a869f07ebcf817aa98cca1c Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Wed, 22 Jan 2025 18:37:29 +0900 Subject: [PATCH 137/406] . --- exp_scenario/module/locale/en.cfg | 2 +- exp_scenario/module/locale/zh-CN.cfg | 2 +- exp_scenario/module/locale/zh-TW.cfg | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/exp_scenario/module/locale/en.cfg b/exp_scenario/module/locale/en.cfg index 2dd747e4..1b928702 100644 --- a/exp_scenario/module/locale/en.cfg +++ b/exp_scenario/module/locale/en.cfg @@ -278,6 +278,6 @@ enter=Entered waterfill selection mode, select the area to fill with water. exit=Exited waterfill selection mode. nauvis-only=Can only waterfill on Nauvis, this may change in the future. area-too-large=Selected area is too large, must be less than __1__ tiles, selected __2__. -too-few-explosives=Requires __1__ __ITEM__cliff-explosives__ you have __2__. +too-few-explosives=Requires __1__ __ITEM__cliff-explosives__ or its ingredients, you have __2__. part-complete=__1__ tiles were filled with water, but entities are blocking __2__ tiles. complete=__1__ tiles were filled with water. diff --git a/exp_scenario/module/locale/zh-CN.cfg b/exp_scenario/module/locale/zh-CN.cfg index 6abe8229..48c25ba3 100644 --- a/exp_scenario/module/locale/zh-CN.cfg +++ b/exp_scenario/module/locale/zh-CN.cfg @@ -278,6 +278,6 @@ enter=現在進入挖水區域選擇 exit=已進入挖水區域選擇 nauvis-only=只可在地星上填水,之後可能會再改變。 area-too-large=區域太大了,需少過 __1__ 格,你選了 __2__ 格。 -too-few-explosives=需要 __1__ 個 __ITEM__cliff-explosives__,你現在有 __2__ 個。 +too-few-explosives=需要 __1__ 個 __ITEM__cliff-explosives__或其材料,你現在有 __2__ 個。 part-complete=__1__ 格已填水,但有 __2__ 格有東西擋著。 complete=__1__ 格已經轉換好。 diff --git a/exp_scenario/module/locale/zh-TW.cfg b/exp_scenario/module/locale/zh-TW.cfg index 6abe8229..48c25ba3 100644 --- a/exp_scenario/module/locale/zh-TW.cfg +++ b/exp_scenario/module/locale/zh-TW.cfg @@ -278,6 +278,6 @@ enter=現在進入挖水區域選擇 exit=已進入挖水區域選擇 nauvis-only=只可在地星上填水,之後可能會再改變。 area-too-large=區域太大了,需少過 __1__ 格,你選了 __2__ 格。 -too-few-explosives=需要 __1__ 個 __ITEM__cliff-explosives__,你現在有 __2__ 個。 +too-few-explosives=需要 __1__ 個 __ITEM__cliff-explosives__或其材料,你現在有 __2__ 個。 part-complete=__1__ 格已填水,但有 __2__ 格有東西擋著。 complete=__1__ 格已經轉換好。 From 852cf45d0c8b6db87de7a9359b43590457748398 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Wed, 22 Jan 2025 18:39:18 +0900 Subject: [PATCH 138/406] . --- exp_scenario/module/commands/waterfill.lua | 1 - 1 file changed, 1 deletion(-) diff --git a/exp_scenario/module/commands/waterfill.lua b/exp_scenario/module/commands/waterfill.lua index 570be202..8c36202b 100644 --- a/exp_scenario/module/commands/waterfill.lua +++ b/exp_scenario/module/commands/waterfill.lua @@ -36,7 +36,6 @@ Selection.on_selection(SelectionName, function(event) ]] local area_size = (area.right_bottom.x - area.left_top.x) * (area.right_bottom.y - area.left_top.y) - if area_size > 1000 then player.print({ "exp-commands_waterfill.area-too-large", 1000, area_size }, Commands.print_settings.error) return From d4b4f50618611669223529995cdb7becfd8a164f Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Wed, 22 Jan 2025 18:42:39 +0900 Subject: [PATCH 139/406] . --- exp_scenario/module/locale/zh-CN.cfg | 2 +- exp_scenario/module/locale/zh-TW.cfg | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/exp_scenario/module/locale/zh-CN.cfg b/exp_scenario/module/locale/zh-CN.cfg index 48c25ba3..4272fa51 100644 --- a/exp_scenario/module/locale/zh-CN.cfg +++ b/exp_scenario/module/locale/zh-CN.cfg @@ -278,6 +278,6 @@ enter=現在進入挖水區域選擇 exit=已進入挖水區域選擇 nauvis-only=只可在地星上填水,之後可能會再改變。 area-too-large=區域太大了,需少過 __1__ 格,你選了 __2__ 格。 -too-few-explosives=需要 __1__ 個 __ITEM__cliff-explosives__或其材料,你現在有 __2__ 個。 +too-few-explosives=需要 __1__ 個 __ITEM__cliff-explosives__ 或其材料,你現在有 __2__ 個。 part-complete=__1__ 格已填水,但有 __2__ 格有東西擋著。 complete=__1__ 格已經轉換好。 diff --git a/exp_scenario/module/locale/zh-TW.cfg b/exp_scenario/module/locale/zh-TW.cfg index 48c25ba3..4272fa51 100644 --- a/exp_scenario/module/locale/zh-TW.cfg +++ b/exp_scenario/module/locale/zh-TW.cfg @@ -278,6 +278,6 @@ enter=現在進入挖水區域選擇 exit=已進入挖水區域選擇 nauvis-only=只可在地星上填水,之後可能會再改變。 area-too-large=區域太大了,需少過 __1__ 格,你選了 __2__ 格。 -too-few-explosives=需要 __1__ 個 __ITEM__cliff-explosives__或其材料,你現在有 __2__ 個。 +too-few-explosives=需要 __1__ 個 __ITEM__cliff-explosives__ 或其材料,你現在有 __2__ 個。 part-complete=__1__ 格已填水,但有 __2__ 格有東西擋著。 complete=__1__ 格已經轉換好。 From 991d26510edc00aaca450e1245854083b154a070 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Wed, 22 Jan 2025 19:46:56 +0900 Subject: [PATCH 140/406] . --- exp_legacy/module/modules/gui/vlayer.lua | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/exp_legacy/module/modules/gui/vlayer.lua b/exp_legacy/module/modules/gui/vlayer.lua index 12595259..fc924518 100644 --- a/exp_legacy/module/modules/gui/vlayer.lua +++ b/exp_legacy/module/modules/gui/vlayer.lua @@ -81,10 +81,16 @@ Selection.on_selection(SelectionConvertArea, function(event) return nil end - local entities = event.surface.find_entities_filtered{ area = area, name = "steel-chest", force = player.force } local frame = Gui.get_left_element(player, vlayer_container) local disp = frame.container["vlayer_st_2"].disp.table local target = vlayer_control_type_list[disp[vlayer_gui_control_type.name].selected_index] + local entities + + if event.surface and event.surface.platform and target == "energy" then + entities = event.surface.find_entities_filtered{ area = area, name = "constant-combinator", force = player.force } + else + entities = event.surface.find_entities_filtered{ area = area, name = "steel-chest", force = player.force } + end if #entities == 0 then player.print{ "vlayer.steel-chest-detect" } From 357eba0e649c468b41c1640f8812ad5d979510dc Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Wed, 22 Jan 2025 19:51:04 +0900 Subject: [PATCH 141/406] . --- exp_legacy/module/modules/gui/vlayer.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exp_legacy/module/modules/gui/vlayer.lua b/exp_legacy/module/modules/gui/vlayer.lua index fc924518..e196098b 100644 --- a/exp_legacy/module/modules/gui/vlayer.lua +++ b/exp_legacy/module/modules/gui/vlayer.lua @@ -106,7 +106,7 @@ Selection.on_selection(SelectionConvertArea, function(event) local e = entities[1] local e_pos = { x = string.format("%.1f", e.position.x), y = string.format("%.1f", e.position.y) } - local e_circ = {} -- e.circuit_connected_entities --- TODO use new circuit api + local e_circ = e.get_wire_connectors if not e.get_inventory(defines.inventory.chest).is_empty() then player.print{ "vlayer.steel-chest-empty" } From 1f7ac1ace541f0d838c232b7ae3004635a9aff9f Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Wed, 22 Jan 2025 20:10:48 +0900 Subject: [PATCH 142/406] . --- exp_legacy/module/modules/control/vlayer.lua | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/exp_legacy/module/modules/control/vlayer.lua b/exp_legacy/module/modules/control/vlayer.lua index 0bdb9ba3..800b824f 100644 --- a/exp_legacy/module/modules/control/vlayer.lua +++ b/exp_legacy/module/modules/control/vlayer.lua @@ -340,9 +340,9 @@ function vlayer.create_input_interface(surface, position, circuit, last_user) end if circuit then - for k, _ in pairs(circuit) do - for _, v in pairs(circuit[k]) do - interface.connect_neighbour{ wire = defines.wire_type[k], target_entity = v } + for k, _ in pairs({ defines.wire_connector_id.circuit_red, defines.wire_connector_id.circuit_green }) do + for _, v in pairs(circuit.get_wire_connector{ wire_connector_id = k, or_create = false }.real_connections) do + interface.connect_to{ target = v.target } end end end @@ -418,9 +418,9 @@ function vlayer.create_output_interface(surface, position, circuit, last_user) end if circuit then - for k, _ in pairs(circuit) do - for _, v in pairs(circuit[k]) do - interface.connect_neighbour{ wire = defines.wire_type[k], target_entity = v } + for k, _ in pairs({ defines.wire_connector_id.circuit_red, defines.wire_connector_id.circuit_green }) do + for _, v in pairs(circuit.get_wire_connector{ wire_connector_id = k, or_create = false }.real_connections) do + interface.connect_to{ target = v.target } end end end @@ -555,9 +555,9 @@ function vlayer.create_circuit_interface(surface, position, circuit, last_user) end if circuit then - for k, _ in pairs(circuit) do - for _, v in pairs(circuit[k]) do - interface.connect_neighbour{ wire = defines.wire_type[k], target_entity = v } + for k, _ in pairs({ defines.wire_connector_id.circuit_red, defines.wire_connector_id.circuit_green }) do + for _, v in pairs(circuit.get_wire_connector{ wire_connector_id = k, or_create = false }.real_connections) do + interface.connect_to{ target = v.target } end end end From 0eaa2b15428d5a0678c38a39eae40204f4afecf6 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Wed, 22 Jan 2025 20:13:32 +0900 Subject: [PATCH 143/406] . --- exp_legacy/module/modules/gui/vlayer.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exp_legacy/module/modules/gui/vlayer.lua b/exp_legacy/module/modules/gui/vlayer.lua index e196098b..74c8ac00 100644 --- a/exp_legacy/module/modules/gui/vlayer.lua +++ b/exp_legacy/module/modules/gui/vlayer.lua @@ -106,7 +106,7 @@ Selection.on_selection(SelectionConvertArea, function(event) local e = entities[1] local e_pos = { x = string.format("%.1f", e.position.x), y = string.format("%.1f", e.position.y) } - local e_circ = e.get_wire_connectors + local e_circ = e.get_wire_connectors{ or_create = false } if not e.get_inventory(defines.inventory.chest).is_empty() then player.print{ "vlayer.steel-chest-empty" } From 16574b590820a5a0a2b7f462bbe98b4fcb3e8e88 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Wed, 22 Jan 2025 20:26:23 +0900 Subject: [PATCH 144/406] . --- exp_legacy/module/modules/gui/vlayer.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exp_legacy/module/modules/gui/vlayer.lua b/exp_legacy/module/modules/gui/vlayer.lua index 74c8ac00..31b9686e 100644 --- a/exp_legacy/module/modules/gui/vlayer.lua +++ b/exp_legacy/module/modules/gui/vlayer.lua @@ -106,7 +106,7 @@ Selection.on_selection(SelectionConvertArea, function(event) local e = entities[1] local e_pos = { x = string.format("%.1f", e.position.x), y = string.format("%.1f", e.position.y) } - local e_circ = e.get_wire_connectors{ or_create = false } + local e_circ = {} -- e.get_wire_connectors{ or_create = false } if not e.get_inventory(defines.inventory.chest).is_empty() then player.print{ "vlayer.steel-chest-empty" } From 064dead08c2d9e6c72b2b2aa942a50e041fad71c Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Wed, 22 Jan 2025 20:27:50 +0900 Subject: [PATCH 145/406] . --- exp_legacy/module/modules/gui/vlayer.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exp_legacy/module/modules/gui/vlayer.lua b/exp_legacy/module/modules/gui/vlayer.lua index 31b9686e..f0301633 100644 --- a/exp_legacy/module/modules/gui/vlayer.lua +++ b/exp_legacy/module/modules/gui/vlayer.lua @@ -106,7 +106,7 @@ Selection.on_selection(SelectionConvertArea, function(event) local e = entities[1] local e_pos = { x = string.format("%.1f", e.position.x), y = string.format("%.1f", e.position.y) } - local e_circ = {} -- e.get_wire_connectors{ or_create = false } + local e_circ = nil -- e.get_wire_connectors{ or_create = false } if not e.get_inventory(defines.inventory.chest).is_empty() then player.print{ "vlayer.steel-chest-empty" } From 6520014c47d936629a12f2edb01e9bfc00b5508c Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Wed, 22 Jan 2025 20:37:19 +0900 Subject: [PATCH 146/406] . --- exp_legacy/module/modules/gui/vlayer.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exp_legacy/module/modules/gui/vlayer.lua b/exp_legacy/module/modules/gui/vlayer.lua index f0301633..62e504d8 100644 --- a/exp_legacy/module/modules/gui/vlayer.lua +++ b/exp_legacy/module/modules/gui/vlayer.lua @@ -108,7 +108,7 @@ Selection.on_selection(SelectionConvertArea, function(event) local e_pos = { x = string.format("%.1f", e.position.x), y = string.format("%.1f", e.position.y) } local e_circ = nil -- e.get_wire_connectors{ or_create = false } - if not e.get_inventory(defines.inventory.chest).is_empty() then + if e.name and e.name == "steel-chest" and (not e.get_inventory(defines.inventory.chest).is_empty()) then player.print{ "vlayer.steel-chest-empty" } return nil end From bf29c1ccd97764e438f576f763d5c983e43ceaf7 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Thu, 23 Jan 2025 22:14:32 +0900 Subject: [PATCH 147/406] . --- exp_legacy/module/config/vlayer.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/exp_legacy/module/config/vlayer.lua b/exp_legacy/module/config/vlayer.lua index 8406dd72..67e8f13a 100644 --- a/exp_legacy/module/config/vlayer.lua +++ b/exp_legacy/module/config/vlayer.lua @@ -9,6 +9,7 @@ return { unlimited_capacity = false, --- @setting unlimited_capacity When true the vlayer has an unlimited energy capacity, accumulators are not required unlimited_surface_area = false, --- @setting unlimited_surface_area When true the vlayer has an unlimited surface area, landfill is not required modded_auto_downgrade = true, --- @setting modded_auto_downgrade When true modded items will be converted into their base game equivalent, original items can not be recovered + power_on_space = false, --- @setting power_on_space When true allow on spaceship mimic_surface = "nauvis", --- @setting mimic_surface Surface name/index the vlayer will copy its settings from, use nil to use the settings below surface = { --- @setting surface When mimic_surface is nil these settings will be used instead, see LuaSurface for details From cea73d7ab8f161690b10c0d864213cf760e1b263 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Thu, 23 Jan 2025 22:16:21 +0900 Subject: [PATCH 148/406] . --- exp_legacy/module/modules/gui/vlayer.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exp_legacy/module/modules/gui/vlayer.lua b/exp_legacy/module/modules/gui/vlayer.lua index 62e504d8..15e6af02 100644 --- a/exp_legacy/module/modules/gui/vlayer.lua +++ b/exp_legacy/module/modules/gui/vlayer.lua @@ -86,7 +86,7 @@ Selection.on_selection(SelectionConvertArea, function(event) local target = vlayer_control_type_list[disp[vlayer_gui_control_type.name].selected_index] local entities - if event.surface and event.surface.platform and target == "energy" then + if config.power_on_space and event.surface and event.surface.platform and target == "energy" then entities = event.surface.find_entities_filtered{ area = area, name = "constant-combinator", force = player.force } else entities = event.surface.find_entities_filtered{ area = area, name = "steel-chest", force = player.force } From c00f5b54a8eb7fe89c0f568adc27beea3bc9c815 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Thu, 23 Jan 2025 22:17:26 +0900 Subject: [PATCH 149/406] . --- exp_legacy/module/config/vlayer.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exp_legacy/module/config/vlayer.lua b/exp_legacy/module/config/vlayer.lua index 67e8f13a..e52db602 100644 --- a/exp_legacy/module/config/vlayer.lua +++ b/exp_legacy/module/config/vlayer.lua @@ -9,7 +9,7 @@ return { unlimited_capacity = false, --- @setting unlimited_capacity When true the vlayer has an unlimited energy capacity, accumulators are not required unlimited_surface_area = false, --- @setting unlimited_surface_area When true the vlayer has an unlimited surface area, landfill is not required modded_auto_downgrade = true, --- @setting modded_auto_downgrade When true modded items will be converted into their base game equivalent, original items can not be recovered - power_on_space = false, --- @setting power_on_space When true allow on spaceship + power_on_space = true, --- @setting power_on_space When true allow on spaceship mimic_surface = "nauvis", --- @setting mimic_surface Surface name/index the vlayer will copy its settings from, use nil to use the settings below surface = { --- @setting surface When mimic_surface is nil these settings will be used instead, see LuaSurface for details From 403bace3abb0b4779d479e2eb47e9f53f34271fb Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Thu, 23 Jan 2025 22:22:53 +0900 Subject: [PATCH 150/406] . --- exp_scenario/module/commands/waterfill.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exp_scenario/module/commands/waterfill.lua b/exp_scenario/module/commands/waterfill.lua index 8c36202b..20d84005 100644 --- a/exp_scenario/module/commands/waterfill.lua +++ b/exp_scenario/module/commands/waterfill.lua @@ -65,7 +65,7 @@ Selection.on_selection(SelectionName, function(event) local remaining_tiles = surface.count_tiles_filtered{ area = area, name = "water-mud" } local t_diff = tile_count - remaining_tiles - if item_count_cliff >= area_size then + if item_count_cliff >= t_diff then player.remove_item{ name = "cliff-explosives", count = t_diff } else player.remove_item{ name = "explosives", count = 10 * t_diff } From a86a625d628dc090817895dbdd41ee03721f36fe Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Sun, 26 Jan 2025 13:50:43 +0900 Subject: [PATCH 151/406] . --- exp_scenario/module/commands/kill.lua | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/exp_scenario/module/commands/kill.lua b/exp_scenario/module/commands/kill.lua index 2ab239bd..05149f4e 100644 --- a/exp_scenario/module/commands/kill.lua +++ b/exp_scenario/module/commands/kill.lua @@ -20,11 +20,10 @@ Commands.new("kill", { "exp-commands_kill.description" }) if other_player == nil then -- Can only be nil if the target is the player and they are already dead return Commands.status.error{ "exp-commands_kill.already-dead" } - elseif other_player == player then - -- You can always kill yourself - other_player.character.die() - elseif highest_role(other_player).index < highest_role(player).index then - -- Can kill lower role players + elseif (other_player == player) or highest_role(other_player).index < highest_role(player).index then + -- You can always kill yourself or can kill lower role players + local pos = other_player.position + other_player.surface.create_entity{ name = "lightning", position = { pos.x, pos.y - 16 }, target = other_player.character } other_player.character.die() else return Commands.status.unauthorised{ "exp-commands_kill.lower-role" } From c2089a89ba63aef67471c69d02fdd78b440b0768 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Sun, 26 Jan 2025 13:50:58 +0900 Subject: [PATCH 152/406] . --- exp_scenario/module/commands/kill.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exp_scenario/module/commands/kill.lua b/exp_scenario/module/commands/kill.lua index 05149f4e..509daff6 100644 --- a/exp_scenario/module/commands/kill.lua +++ b/exp_scenario/module/commands/kill.lua @@ -20,7 +20,7 @@ Commands.new("kill", { "exp-commands_kill.description" }) if other_player == nil then -- Can only be nil if the target is the player and they are already dead return Commands.status.error{ "exp-commands_kill.already-dead" } - elseif (other_player == player) or highest_role(other_player).index < highest_role(player).index then + elseif (other_player == player) or (highest_role(other_player).index < highest_role(player).index) then -- You can always kill yourself or can kill lower role players local pos = other_player.position other_player.surface.create_entity{ name = "lightning", position = { pos.x, pos.y - 16 }, target = other_player.character } From a7a0e85a95e97963c38d1bf94e1280998d897304 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Sun, 26 Jan 2025 22:02:17 +0900 Subject: [PATCH 153/406] . --- exp_scenario/module/commands/kill.lua | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/exp_scenario/module/commands/kill.lua b/exp_scenario/module/commands/kill.lua index 509daff6..7c3dd922 100644 --- a/exp_scenario/module/commands/kill.lua +++ b/exp_scenario/module/commands/kill.lua @@ -22,8 +22,10 @@ Commands.new("kill", { "exp-commands_kill.description" }) return Commands.status.error{ "exp-commands_kill.already-dead" } elseif (other_player == player) or (highest_role(other_player).index < highest_role(player).index) then -- You can always kill yourself or can kill lower role players - local pos = other_player.position - other_player.surface.create_entity{ name = "lightning", position = { pos.x, pos.y - 16 }, target = other_player.character } + if script.active_mods["space-age"] then + local pos = other_player.position + other_player.surface.create_entity{ name = "lightning", position = { pos.x, pos.y - 16 }, target = other_player.character } + end other_player.character.die() else return Commands.status.unauthorised{ "exp-commands_kill.lower-role" } From 1aaae3fa13a988a4382fab02fe19c15b4687599e Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Mon, 27 Jan 2025 00:00:04 +0900 Subject: [PATCH 154/406] . --- exp_scenario/module/commands/kill.lua | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/exp_scenario/module/commands/kill.lua b/exp_scenario/module/commands/kill.lua index 7c3dd922..ac4356d0 100644 --- a/exp_scenario/module/commands/kill.lua +++ b/exp_scenario/module/commands/kill.lua @@ -23,8 +23,7 @@ Commands.new("kill", { "exp-commands_kill.description" }) elseif (other_player == player) or (highest_role(other_player).index < highest_role(player).index) then -- You can always kill yourself or can kill lower role players if script.active_mods["space-age"] then - local pos = other_player.position - other_player.surface.create_entity{ name = "lightning", position = { pos.x, pos.y - 16 }, target = other_player.character } + other_player.surface.create_entity{ name = "lightning", position = { other_player.position.x, other_player.position.y - 16 }, target = other_player.character } end other_player.character.die() else From bbe25ec120c5bac6b0fd36a1063f141eba335ce5 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Tue, 28 Jan 2025 17:05:23 +0900 Subject: [PATCH 155/406] . --- exp_scenario/module/commands/waterfill.lua | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/exp_scenario/module/commands/waterfill.lua b/exp_scenario/module/commands/waterfill.lua index 20d84005..6ca7a005 100644 --- a/exp_scenario/module/commands/waterfill.lua +++ b/exp_scenario/module/commands/waterfill.lua @@ -43,8 +43,9 @@ Selection.on_selection(SelectionName, function(event) local item_count_cliff = player.get_item_count("cliff-explosives") local item_count_craft = math.min(math.floor(player.get_item_count("explosives") / 10), player.get_item_count("barrel"), player.get_item_count("grenade")) + local item_count_total = item_count_cliff + item_count_craft - if (item_count_cliff < area_size) and (item_count_craft < area_size) then + if item_count_total < area_size then player.print({ "exp-commands_waterfill.too-few-explosives", area_size, item_count_cliff }, Commands.print_settings.error) return end @@ -68,9 +69,11 @@ Selection.on_selection(SelectionName, function(event) if item_count_cliff >= t_diff then player.remove_item{ name = "cliff-explosives", count = t_diff } else - player.remove_item{ name = "explosives", count = 10 * t_diff } - player.remove_item{ name = "barrel", count = t_diff } - player.remove_item{ name = "grenade", count = t_diff } + local item_count_needed = t_diff - item_count_cliff + player.remove_item{ name = "cliff-explosives", count = item_count_cliff } + player.remove_item{ name = "explosives", count = 10 * item_count_needed } + player.remove_item{ name = "barrel", count = item_count_needed } + player.remove_item{ name = "grenade", count = item_count_needed } end if remaining_tiles > 0 then From 4bc18e10f5dd6204dd5474d75572906e63f754d4 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Tue, 28 Jan 2025 17:09:27 +0900 Subject: [PATCH 156/406] . --- exp_legacy/module/config/vlayer.lua | 3 +++ 1 file changed, 3 insertions(+) diff --git a/exp_legacy/module/config/vlayer.lua b/exp_legacy/module/config/vlayer.lua index e52db602..98c0644a 100644 --- a/exp_legacy/module/config/vlayer.lua +++ b/exp_legacy/module/config/vlayer.lua @@ -10,6 +10,9 @@ return { unlimited_surface_area = false, --- @setting unlimited_surface_area When true the vlayer has an unlimited surface area, landfill is not required modded_auto_downgrade = true, --- @setting modded_auto_downgrade When true modded items will be converted into their base game equivalent, original items can not be recovered power_on_space = true, --- @setting power_on_space When true allow on spaceship + power_on_space_research = { + ["research-productivity"] = 10 + }, mimic_surface = "nauvis", --- @setting mimic_surface Surface name/index the vlayer will copy its settings from, use nil to use the settings below surface = { --- @setting surface When mimic_surface is nil these settings will be used instead, see LuaSurface for details From d475a5546031f5dabcbea72f0979af630f1084f0 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Tue, 28 Jan 2025 17:55:04 +0900 Subject: [PATCH 157/406] . --- exp_legacy/module/config/vlayer.lua | 3 ++- exp_legacy/module/locale/en/gui.cfg | 1 + exp_legacy/module/locale/zh-CN/gui.cfg | 1 + exp_legacy/module/locale/zh-TW/gui.cfg | 1 + exp_legacy/module/modules/gui/vlayer.lua | 6 +++++- 5 files changed, 10 insertions(+), 2 deletions(-) diff --git a/exp_legacy/module/config/vlayer.lua b/exp_legacy/module/config/vlayer.lua index 98c0644a..b2d49af6 100644 --- a/exp_legacy/module/config/vlayer.lua +++ b/exp_legacy/module/config/vlayer.lua @@ -11,7 +11,8 @@ return { modded_auto_downgrade = true, --- @setting modded_auto_downgrade When true modded items will be converted into their base game equivalent, original items can not be recovered power_on_space = true, --- @setting power_on_space When true allow on spaceship power_on_space_research = { - ["research-productivity"] = 10 + name = "research-productivity", + level = 10 }, mimic_surface = "nauvis", --- @setting mimic_surface Surface name/index the vlayer will copy its settings from, use nil to use the settings below diff --git a/exp_legacy/module/locale/en/gui.cfg b/exp_legacy/module/locale/en/gui.cfg index 6252ec27..f59db6d8 100644 --- a/exp_legacy/module/locale/en/gui.cfg +++ b/exp_legacy/module/locale/en/gui.cfg @@ -289,6 +289,7 @@ control-type-energy=Energy control-type-circuit=Circuit control-type-storage-input=Storage Input control-type-storage-output=Storage Output +power-on-space-research=You need to research [technology=__1__] for the space platform vlayer feature. enter=Entered vlayer selection mode. exit=Exited vlayer selection mode. diff --git a/exp_legacy/module/locale/zh-CN/gui.cfg b/exp_legacy/module/locale/zh-CN/gui.cfg index da2ac6bb..442b3c4c 100644 --- a/exp_legacy/module/locale/zh-CN/gui.cfg +++ b/exp_legacy/module/locale/zh-CN/gui.cfg @@ -289,6 +289,7 @@ control-type-energy=電力 control-type-circuit=回路 control-type-storage-input=放入箱 control-type-storage-output=提取箱 +power-on-space-research=你要研究 [technology=__1__] 才可使用太空平台 vlayer 功能。 enter=現在進入 vlayer 區域選擇 exit=已進入 vlayer 區域選擇 diff --git a/exp_legacy/module/locale/zh-TW/gui.cfg b/exp_legacy/module/locale/zh-TW/gui.cfg index da2ac6bb..442b3c4c 100644 --- a/exp_legacy/module/locale/zh-TW/gui.cfg +++ b/exp_legacy/module/locale/zh-TW/gui.cfg @@ -289,6 +289,7 @@ control-type-energy=電力 control-type-circuit=回路 control-type-storage-input=放入箱 control-type-storage-output=提取箱 +power-on-space-research=你要研究 [technology=__1__] 才可使用太空平台 vlayer 功能。 enter=現在進入 vlayer 區域選擇 exit=已進入 vlayer 區域選擇 diff --git a/exp_legacy/module/modules/gui/vlayer.lua b/exp_legacy/module/modules/gui/vlayer.lua index 15e6af02..1f360336 100644 --- a/exp_legacy/module/modules/gui/vlayer.lua +++ b/exp_legacy/module/modules/gui/vlayer.lua @@ -87,7 +87,11 @@ Selection.on_selection(SelectionConvertArea, function(event) local entities if config.power_on_space and event.surface and event.surface.platform and target == "energy" then - entities = event.surface.find_entities_filtered{ area = area, name = "constant-combinator", force = player.force } + if player.force.technologies[config.power_on_space_research.name].level >= config.power_on_space_research.level then + entities = event.surface.find_entities_filtered{ area = area, name = "constant-combinator", force = player.force } + else + player.print{ "vlayer.power-on-space-research", config.power_on_space_research.name } + end else entities = event.surface.find_entities_filtered{ area = area, name = "steel-chest", force = player.force } end From 3ae1b7c1f82b36a50930b935601445219bc4bf2a Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Tue, 28 Jan 2025 18:01:00 +0900 Subject: [PATCH 158/406] . --- exp_legacy/module/locale/en/gui.cfg | 2 +- exp_legacy/module/locale/zh-CN/gui.cfg | 2 +- exp_legacy/module/locale/zh-TW/gui.cfg | 2 +- exp_legacy/module/modules/gui/vlayer.lua | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/exp_legacy/module/locale/en/gui.cfg b/exp_legacy/module/locale/en/gui.cfg index f59db6d8..bfc6f3d5 100644 --- a/exp_legacy/module/locale/en/gui.cfg +++ b/exp_legacy/module/locale/en/gui.cfg @@ -289,7 +289,7 @@ control-type-energy=Energy control-type-circuit=Circuit control-type-storage-input=Storage Input control-type-storage-output=Storage Output -power-on-space-research=You need to research [technology=__1__] for the space platform vlayer feature. +power-on-space-research=You need to research [technology=__1__] at __2__ level for the space platform vlayer feature. enter=Entered vlayer selection mode. exit=Exited vlayer selection mode. diff --git a/exp_legacy/module/locale/zh-CN/gui.cfg b/exp_legacy/module/locale/zh-CN/gui.cfg index 442b3c4c..4af76596 100644 --- a/exp_legacy/module/locale/zh-CN/gui.cfg +++ b/exp_legacy/module/locale/zh-CN/gui.cfg @@ -289,7 +289,7 @@ control-type-energy=電力 control-type-circuit=回路 control-type-storage-input=放入箱 control-type-storage-output=提取箱 -power-on-space-research=你要研究 [technology=__1__] 才可使用太空平台 vlayer 功能。 +power-on-space-research=你要研究 [technology=__1__] 在 __2__ 級 才可使用太空平台 vlayer 功能。 enter=現在進入 vlayer 區域選擇 exit=已進入 vlayer 區域選擇 diff --git a/exp_legacy/module/locale/zh-TW/gui.cfg b/exp_legacy/module/locale/zh-TW/gui.cfg index 442b3c4c..76864eb7 100644 --- a/exp_legacy/module/locale/zh-TW/gui.cfg +++ b/exp_legacy/module/locale/zh-TW/gui.cfg @@ -289,7 +289,7 @@ control-type-energy=電力 control-type-circuit=回路 control-type-storage-input=放入箱 control-type-storage-output=提取箱 -power-on-space-research=你要研究 [technology=__1__] 才可使用太空平台 vlayer 功能。 +power-on-space-research=你要研究 [technology=__1__] 在 __2__ 級才可使用太空平台 vlayer 功能。 enter=現在進入 vlayer 區域選擇 exit=已進入 vlayer 區域選擇 diff --git a/exp_legacy/module/modules/gui/vlayer.lua b/exp_legacy/module/modules/gui/vlayer.lua index 1f360336..b2ecbc2c 100644 --- a/exp_legacy/module/modules/gui/vlayer.lua +++ b/exp_legacy/module/modules/gui/vlayer.lua @@ -90,7 +90,7 @@ Selection.on_selection(SelectionConvertArea, function(event) if player.force.technologies[config.power_on_space_research.name].level >= config.power_on_space_research.level then entities = event.surface.find_entities_filtered{ area = area, name = "constant-combinator", force = player.force } else - player.print{ "vlayer.power-on-space-research", config.power_on_space_research.name } + player.print{ "vlayer.power-on-space-research", config.power_on_space_research.name, config.power_on_space_research.level } end else entities = event.surface.find_entities_filtered{ area = area, name = "steel-chest", force = player.force } From ddd6dc474ff366f50c654fcbd7faadcf6e95f0f3 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Tue, 28 Jan 2025 18:03:36 +0900 Subject: [PATCH 159/406] . --- exp_legacy/module/config/vlayer.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exp_legacy/module/config/vlayer.lua b/exp_legacy/module/config/vlayer.lua index b2d49af6..64aafdf3 100644 --- a/exp_legacy/module/config/vlayer.lua +++ b/exp_legacy/module/config/vlayer.lua @@ -13,7 +13,7 @@ return { power_on_space_research = { name = "research-productivity", level = 10 - }, + }, --- @setting power_on_space_research the research level needed to use power_on_space mimic_surface = "nauvis", --- @setting mimic_surface Surface name/index the vlayer will copy its settings from, use nil to use the settings below surface = { --- @setting surface When mimic_surface is nil these settings will be used instead, see LuaSurface for details From 8ae03a7ee15e9e5c69f74ab74681d17162e43757 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Tue, 28 Jan 2025 18:03:50 +0900 Subject: [PATCH 160/406] . --- exp_legacy/module/config/vlayer.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/exp_legacy/module/config/vlayer.lua b/exp_legacy/module/config/vlayer.lua index 64aafdf3..db29bb15 100644 --- a/exp_legacy/module/config/vlayer.lua +++ b/exp_legacy/module/config/vlayer.lua @@ -10,10 +10,10 @@ return { unlimited_surface_area = false, --- @setting unlimited_surface_area When true the vlayer has an unlimited surface area, landfill is not required modded_auto_downgrade = true, --- @setting modded_auto_downgrade When true modded items will be converted into their base game equivalent, original items can not be recovered power_on_space = true, --- @setting power_on_space When true allow on spaceship - power_on_space_research = { + power_on_space_research = { --- @setting power_on_space_research the research level needed to use power_on_space name = "research-productivity", level = 10 - }, --- @setting power_on_space_research the research level needed to use power_on_space + }, mimic_surface = "nauvis", --- @setting mimic_surface Surface name/index the vlayer will copy its settings from, use nil to use the settings below surface = { --- @setting surface When mimic_surface is nil these settings will be used instead, see LuaSurface for details From a59f5830f2c0d6d845a4375eafc08c1a28da842b Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Tue, 28 Jan 2025 18:07:17 +0900 Subject: [PATCH 161/406] . --- exp_legacy/module/modules/gui/vlayer.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/exp_legacy/module/modules/gui/vlayer.lua b/exp_legacy/module/modules/gui/vlayer.lua index b2ecbc2c..ec694a61 100644 --- a/exp_legacy/module/modules/gui/vlayer.lua +++ b/exp_legacy/module/modules/gui/vlayer.lua @@ -91,6 +91,7 @@ Selection.on_selection(SelectionConvertArea, function(event) entities = event.surface.find_entities_filtered{ area = area, name = "constant-combinator", force = player.force } else player.print{ "vlayer.power-on-space-research", config.power_on_space_research.name, config.power_on_space_research.level } + return nil end else entities = event.surface.find_entities_filtered{ area = area, name = "steel-chest", force = player.force } From 1d4af308437538be09aee2b4af907dba30788d0e Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Tue, 28 Jan 2025 19:49:14 +0900 Subject: [PATCH 162/406] . --- exp_legacy/module/config/bonus.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/exp_legacy/module/config/bonus.lua b/exp_legacy/module/config/bonus.lua index 0f832ab7..05d0375b 100644 --- a/exp_legacy/module/config/bonus.lua +++ b/exp_legacy/module/config/bonus.lua @@ -18,6 +18,7 @@ return { ]] pts = { base = 260, + increase_percentage_per_role_level = 5, }, gui_display_width = { half = 150, From be6ccb27f13598c3b0f23a16fb8d5b294d9da7be Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Tue, 28 Jan 2025 20:21:14 +0900 Subject: [PATCH 163/406] . --- exp_legacy/module/config/bonus.lua | 1 + exp_legacy/module/modules/gui/bonus.lua | 1 + 2 files changed, 2 insertions(+) diff --git a/exp_legacy/module/config/bonus.lua b/exp_legacy/module/config/bonus.lua index 05d0375b..2e4052c4 100644 --- a/exp_legacy/module/config/bonus.lua +++ b/exp_legacy/module/config/bonus.lua @@ -19,6 +19,7 @@ return { pts = { base = 260, increase_percentage_per_role_level = 5, + role_name = "Member" }, gui_display_width = { half = 150, diff --git a/exp_legacy/module/modules/gui/bonus.lua b/exp_legacy/module/modules/gui/bonus.lua index 9ee65303..e696009d 100644 --- a/exp_legacy/module/modules/gui/bonus.lua +++ b/exp_legacy/module/modules/gui/bonus.lua @@ -329,6 +329,7 @@ bonus_container = local disp = frame.container["bonus_st_1"].disp.table local n = bonus_gui_pts_needed(player) disp[bonus_gui_control_pts_n_count.name].caption = n + disp[bonus_gui_control_pts_a_count.name].caption = config.pts.base * (Roles.get_player_highest_role(player).index - Roles.get_role_by_name(config.pts.role_name).index) local r = tonumber(disp[bonus_gui_control_pts_a_count.name].caption) - n disp[bonus_gui_control_pts_r_count.name].caption = r From dbe3c873f6cde20adeb20ebb5c12400759d37d0f Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Tue, 28 Jan 2025 20:26:14 +0900 Subject: [PATCH 164/406] . --- exp_legacy/module/modules/gui/bonus.lua | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/exp_legacy/module/modules/gui/bonus.lua b/exp_legacy/module/modules/gui/bonus.lua index e696009d..557ba5fb 100644 --- a/exp_legacy/module/modules/gui/bonus.lua +++ b/exp_legacy/module/modules/gui/bonus.lua @@ -62,6 +62,12 @@ local function apply_bonus(player) end end +local function max_bonus_pts_update(player) + local frame = Gui.get_left_element(player, bonus_container) + local disp = frame.container["bonus_st_2"].disp.table + disp["bonus_control_pts_a_count"].caption = config.pts.base * (Roles.get_player_highest_role(player).index - Roles.get_role_by_name(config.pts.role_name).index) +end + local function apply_periodic_bonus(player) if not Roles.player_allowed(player, "gui/bonus") then return @@ -360,11 +366,15 @@ Event.add(defines.events.on_player_created, function(event) end) Event.add(Roles.events.on_role_assigned, function(event) - apply_bonus(game.players[event.player_index]) + local player = game.players[event.player_index] + apply_bonus(player) + max_bonus_pts_update(player) end) Event.add(Roles.events.on_role_unassigned, function(event) - apply_bonus(game.players[event.player_index]) + local player = game.players[event.player_index] + apply_bonus(player) + max_bonus_pts_update(player) end) --- When a player respawns re-apply bonus From 97c6f7f3c325d97a19fa69288b11ff7eb594531d Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Tue, 28 Jan 2025 20:31:44 +0900 Subject: [PATCH 165/406] . --- exp_legacy/module/config/bonus.lua | 2 +- exp_legacy/module/modules/gui/bonus.lua | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/exp_legacy/module/config/bonus.lua b/exp_legacy/module/config/bonus.lua index 2e4052c4..db97d270 100644 --- a/exp_legacy/module/config/bonus.lua +++ b/exp_legacy/module/config/bonus.lua @@ -18,7 +18,7 @@ return { ]] pts = { base = 260, - increase_percentage_per_role_level = 5, + increase_percentage_per_role_level = 0.05, role_name = "Member" }, gui_display_width = { diff --git a/exp_legacy/module/modules/gui/bonus.lua b/exp_legacy/module/modules/gui/bonus.lua index 557ba5fb..7c85c99b 100644 --- a/exp_legacy/module/modules/gui/bonus.lua +++ b/exp_legacy/module/modules/gui/bonus.lua @@ -65,7 +65,7 @@ end local function max_bonus_pts_update(player) local frame = Gui.get_left_element(player, bonus_container) local disp = frame.container["bonus_st_2"].disp.table - disp["bonus_control_pts_a_count"].caption = config.pts.base * (Roles.get_player_highest_role(player).index - Roles.get_role_by_name(config.pts.role_name).index) + disp["bonus_control_pts_a_count"].caption = math.floor(config.pts.base * (1 + config.pts.increase_percentage_per_role_level * (Roles.get_player_highest_role(player).index - Roles.get_role_by_name(config.pts.role_name).index))) end local function apply_periodic_bonus(player) @@ -335,7 +335,7 @@ bonus_container = local disp = frame.container["bonus_st_1"].disp.table local n = bonus_gui_pts_needed(player) disp[bonus_gui_control_pts_n_count.name].caption = n - disp[bonus_gui_control_pts_a_count.name].caption = config.pts.base * (Roles.get_player_highest_role(player).index - Roles.get_role_by_name(config.pts.role_name).index) + max_bonus_pts_update(player) local r = tonumber(disp[bonus_gui_control_pts_a_count.name].caption) - n disp[bonus_gui_control_pts_r_count.name].caption = r From 8f230bb3931534356468b886011ebfecbf435cb9 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Tue, 28 Jan 2025 20:47:08 +0900 Subject: [PATCH 166/406] . --- exp_legacy/module/config/chat_reply.lua | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/exp_legacy/module/config/chat_reply.lua b/exp_legacy/module/config/chat_reply.lua index 4a1cd6e8..784b5aaf 100644 --- a/exp_legacy/module/config/chat_reply.lua +++ b/exp_legacy/module/config/chat_reply.lua @@ -23,12 +23,9 @@ return { allow_command_prefix_for_messages = true, --- @setting allow_command_prefix_for_messages when true any message trigger will print to all player when prefixed messages = { --- @setting messages will trigger when ever the word is said ["discord"] = { "info.discord" }, - ["expgaming"] = { "info.website" }, + ["aperx"] = { "info.website" }, ["website"] = { "info.website" }, - ["status"] = { "info.status" }, ["github"] = { "info.github" }, - ["patreon"] = { "info.patreon" }, - ["donate"] = { "info.patreon" }, ["command"] = { "info.custom-commands" }, ["commands"] = { "info.custom-commands" }, ["softmod"] = { "info.softmod" }, From d12ad7ed2ebd2b261677566e5ca87e87215e9966 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Tue, 28 Jan 2025 21:00:45 +0900 Subject: [PATCH 167/406] . --- exp_legacy/module/modules/gui/bonus.lua | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/exp_legacy/module/modules/gui/bonus.lua b/exp_legacy/module/modules/gui/bonus.lua index 7c85c99b..c04790cc 100644 --- a/exp_legacy/module/modules/gui/bonus.lua +++ b/exp_legacy/module/modules/gui/bonus.lua @@ -9,7 +9,9 @@ local Event = require("modules/exp_legacy/utils/event") --- @dep utils.event local config = require("modules.exp_legacy.config.bonus") --- @dep config.bonus local vlayer = require("modules.exp_legacy.modules.control.vlayer") local format_number = require("util").format_number --- @dep util + local bonus_container +local bonus_gui_control_pts_a_count local function bonus_gui_pts_needed(player) local frame = Gui.get_left_element(player, bonus_container) @@ -65,7 +67,7 @@ end local function max_bonus_pts_update(player) local frame = Gui.get_left_element(player, bonus_container) local disp = frame.container["bonus_st_2"].disp.table - disp["bonus_control_pts_a_count"].caption = math.floor(config.pts.base * (1 + config.pts.increase_percentage_per_role_level * (Roles.get_player_highest_role(player).index - Roles.get_role_by_name(config.pts.role_name).index))) + disp[bonus_gui_control_pts_a_count.name].caption = math.floor(config.pts.base * (1 + config.pts.increase_percentage_per_role_level * (Roles.get_player_highest_role(player).index - Roles.get_role_by_name(config.pts.role_name).index))) end local function apply_periodic_bonus(player) @@ -115,7 +117,7 @@ local bonus_gui_control_pts_a = width = config.gui_display_width["half"], } -local bonus_gui_control_pts_a_count = +bonus_gui_control_pts_a_count = Gui.element{ type = "label", name = "bonus_control_pts_a_count", From 8c79c0363ca52bfa19a347e670a2d4a8f502d16e Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Tue, 28 Jan 2025 21:53:14 +0900 Subject: [PATCH 168/406] . --- exp_legacy/module/modules/gui/bonus.lua | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/exp_legacy/module/modules/gui/bonus.lua b/exp_legacy/module/modules/gui/bonus.lua index c04790cc..e5c3022c 100644 --- a/exp_legacy/module/modules/gui/bonus.lua +++ b/exp_legacy/module/modules/gui/bonus.lua @@ -64,11 +64,13 @@ local function apply_bonus(player) end end +--[[ local function max_bonus_pts_update(player) local frame = Gui.get_left_element(player, bonus_container) local disp = frame.container["bonus_st_2"].disp.table disp[bonus_gui_control_pts_a_count.name].caption = math.floor(config.pts.base * (1 + config.pts.increase_percentage_per_role_level * (Roles.get_player_highest_role(player).index - Roles.get_role_by_name(config.pts.role_name).index))) end +]] local function apply_periodic_bonus(player) if not Roles.player_allowed(player, "gui/bonus") then @@ -337,7 +339,6 @@ bonus_container = local disp = frame.container["bonus_st_1"].disp.table local n = bonus_gui_pts_needed(player) disp[bonus_gui_control_pts_n_count.name].caption = n - max_bonus_pts_update(player) local r = tonumber(disp[bonus_gui_control_pts_a_count.name].caption) - n disp[bonus_gui_control_pts_r_count.name].caption = r @@ -368,15 +369,11 @@ Event.add(defines.events.on_player_created, function(event) end) Event.add(Roles.events.on_role_assigned, function(event) - local player = game.players[event.player_index] - apply_bonus(player) - max_bonus_pts_update(player) + apply_bonus(game.players[event.player_index]) end) Event.add(Roles.events.on_role_unassigned, function(event) - local player = game.players[event.player_index] - apply_bonus(player) - max_bonus_pts_update(player) + apply_bonus(game.players[event.player_index]) end) --- When a player respawns re-apply bonus From 9e1f7530e23e0e394b68b2d26acb5dfc7eb69752 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Tue, 28 Jan 2025 22:21:07 +0900 Subject: [PATCH 169/406] . --- exp_scenario/module/commands/cheat.lua | 4 ++-- exp_scenario/module/locale/zh-CN.cfg | 4 ++-- exp_scenario/module/locale/zh-TW.cfg | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/exp_scenario/module/commands/cheat.lua b/exp_scenario/module/commands/cheat.lua index ab0e4183..a9ead34a 100644 --- a/exp_scenario/module/commands/cheat.lua +++ b/exp_scenario/module/commands/cheat.lua @@ -42,7 +42,7 @@ Commands.new("set-always-day", { "exp-commands_cheat.description-always-day" }) else surface.always_day = state end - game.print{ "exp-commands_cheat.always-day", format_player_name(player), surface.localised_name, surface.always_day } + game.print{ "exp-commands_cheat.always-day", format_player_name(player), surface.name, surface.always_day } end) --- Toggles friendly fire for your force or another @@ -89,7 +89,7 @@ Commands.new("clear-pollution", { "exp-commands_cheat.description-clear-pollutio :register(function(player, surface) --- @cast surface LuaSurface surface.clear_pollution() - game.print{ "exp-commands_cheat.clear-pollution", format_player_name(player), surface.localised_name } + game.print{ "exp-commands_cheat.clear-pollution", format_player_name(player), surface.name } end) --- Toggles pollution being enabled in the game diff --git a/exp_scenario/module/locale/zh-CN.cfg b/exp_scenario/module/locale/zh-CN.cfg index 4272fa51..09cc70d3 100644 --- a/exp_scenario/module/locale/zh-CN.cfg +++ b/exp_scenario/module/locale/zh-CN.cfg @@ -38,8 +38,8 @@ arg-surface=位面 arg-amount=數量 cheat-mode=作弊模式現在為 __1__ always-day=__1__ 把在 __2__ 的位面的永久白天設置為 __3__ 。 -friendly-fire=__1__ 已為在 __2__ 的位面設定成 __3__ 。 -research-all=__1__ 已為在 __2__ 的位面啟用所有科技 。 +friendly-fire=__1__ 已為在 __2__ 的勢力設定成 __3__ 。 +research-all=__1__ 已為在 __2__ 的勢力啟用所有科技 。 clear-pollution=__1__ 已為在 __2__ 的位面清除所有污染 。 pollution-enabled=__1__ 已設定污染為 __2__ 。 game-speed-set=__1__ 把遊戲速度改成 __2__ 。 diff --git a/exp_scenario/module/locale/zh-TW.cfg b/exp_scenario/module/locale/zh-TW.cfg index 4272fa51..09cc70d3 100644 --- a/exp_scenario/module/locale/zh-TW.cfg +++ b/exp_scenario/module/locale/zh-TW.cfg @@ -38,8 +38,8 @@ arg-surface=位面 arg-amount=數量 cheat-mode=作弊模式現在為 __1__ always-day=__1__ 把在 __2__ 的位面的永久白天設置為 __3__ 。 -friendly-fire=__1__ 已為在 __2__ 的位面設定成 __3__ 。 -research-all=__1__ 已為在 __2__ 的位面啟用所有科技 。 +friendly-fire=__1__ 已為在 __2__ 的勢力設定成 __3__ 。 +research-all=__1__ 已為在 __2__ 的勢力啟用所有科技 。 clear-pollution=__1__ 已為在 __2__ 的位面清除所有污染 。 pollution-enabled=__1__ 已設定污染為 __2__ 。 game-speed-set=__1__ 把遊戲速度改成 __2__ 。 From fc7c9d41adae3348f8a86ce7b491ef62f8ec478e Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Wed, 29 Jan 2025 00:32:54 +0900 Subject: [PATCH 170/406] . --- exp_scenario/module/commands/waterfill.lua | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/exp_scenario/module/commands/waterfill.lua b/exp_scenario/module/commands/waterfill.lua index 6ca7a005..02c0a5a5 100644 --- a/exp_scenario/module/commands/waterfill.lua +++ b/exp_scenario/module/commands/waterfill.lua @@ -41,12 +41,10 @@ Selection.on_selection(SelectionName, function(event) return end - local item_count_cliff = player.get_item_count("cliff-explosives") - local item_count_craft = math.min(math.floor(player.get_item_count("explosives") / 10), player.get_item_count("barrel"), player.get_item_count("grenade")) - local item_count_total = item_count_cliff + item_count_craft + local item_count_total = player.get_item_count("cliff-explosives") + math.min(math.floor(player.get_item_count("explosives") / 10), player.get_item_count("barrel"), player.get_item_count("grenade")) if item_count_total < area_size then - player.print({ "exp-commands_waterfill.too-few-explosives", area_size, item_count_cliff }, Commands.print_settings.error) + player.print({ "exp-commands_waterfill.too-few-explosives", area_size, item_count_total }, Commands.print_settings.error) return end From cc590372def8f8881045590cc75028fd77ef7389 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Wed, 29 Jan 2025 00:34:20 +0900 Subject: [PATCH 171/406] . --- exp_legacy/module/modules/gui/tool.lua | 10 ++++++---- exp_scenario/module/commands/waterfill.lua | 4 +++- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/exp_legacy/module/modules/gui/tool.lua b/exp_legacy/module/modules/gui/tool.lua index be36d435..82123d1b 100644 --- a/exp_legacy/module/modules/gui/tool.lua +++ b/exp_legacy/module/modules/gui/tool.lua @@ -83,11 +83,13 @@ local tool_gui_waterfill_b = if Selection.is_selecting(player, SelectionWaterfillArea) then Selection.stop(player) return player.print{ "exp-commands_waterfill.exit" } - elseif player.get_item_count("cliff-explosives") == 0 then - return player.print{ "exp-commands_waterfill.requires-explosives" } else - Selection.start(player, SelectionWaterfillArea) - return player.print{ "exp-commands_waterfill.enter" } + if player.get_item_count("cliff-explosives") == 0 then + return player.print{ "exp-commands_waterfill.requires-explosives" } + else + Selection.start(player, SelectionWaterfillArea) + return player.print{ "exp-commands_waterfill.enter" } + end end end) diff --git a/exp_scenario/module/commands/waterfill.lua b/exp_scenario/module/commands/waterfill.lua index 02c0a5a5..f612e075 100644 --- a/exp_scenario/module/commands/waterfill.lua +++ b/exp_scenario/module/commands/waterfill.lua @@ -41,7 +41,9 @@ Selection.on_selection(SelectionName, function(event) return end - local item_count_total = player.get_item_count("cliff-explosives") + math.min(math.floor(player.get_item_count("explosives") / 10), player.get_item_count("barrel"), player.get_item_count("grenade")) + local item_count_cliff = player.get_item_count("cliff-explosives") + local item_count_craft = math.min(math.floor(player.get_item_count("explosives") / 10), player.get_item_count("barrel"), player.get_item_count("grenade")) + local item_count_total = item_count_cliff + item_count_craft if item_count_total < area_size then player.print({ "exp-commands_waterfill.too-few-explosives", area_size, item_count_total }, Commands.print_settings.error) From 4c257d14974cf34ce596cf7e99b1bf2896eb934e Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Wed, 29 Jan 2025 00:35:15 +0900 Subject: [PATCH 172/406] . --- exp_legacy/module/modules/gui/tool.lua | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/exp_legacy/module/modules/gui/tool.lua b/exp_legacy/module/modules/gui/tool.lua index 82123d1b..eaeede89 100644 --- a/exp_legacy/module/modules/gui/tool.lua +++ b/exp_legacy/module/modules/gui/tool.lua @@ -84,7 +84,10 @@ local tool_gui_waterfill_b = Selection.stop(player) return player.print{ "exp-commands_waterfill.exit" } else - if player.get_item_count("cliff-explosives") == 0 then + local item_count_cliff = player.get_item_count("cliff-explosives") + local item_count_craft = math.min(math.floor(player.get_item_count("explosives") / 10), player.get_item_count("barrel"), player.get_item_count("grenade")) + local item_count_total = item_count_cliff + item_count_craft + if item_count_total == 0 then return player.print{ "exp-commands_waterfill.requires-explosives" } else Selection.start(player, SelectionWaterfillArea) From fd5d95bcd8b3dcdfead38720c722dc54f403f7d4 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Wed, 29 Jan 2025 00:35:57 +0900 Subject: [PATCH 173/406] . --- exp_scenario/module/commands/waterfill.lua | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/exp_scenario/module/commands/waterfill.lua b/exp_scenario/module/commands/waterfill.lua index f612e075..161ef81e 100644 --- a/exp_scenario/module/commands/waterfill.lua +++ b/exp_scenario/module/commands/waterfill.lua @@ -13,11 +13,16 @@ Commands.new("waterfill", { "exp-commands_waterfill.description" }) if Selection.is_selecting(player, SelectionName) then Selection.stop(player) return Commands.status.success{ "exp-commands_waterfill.exit" } - elseif player.get_item_count("cliff-explosives") == 0 then - return Commands.status.error{ "exp-commands_waterfill.requires-explosives" } else - Selection.start(player, SelectionName) - return Commands.status.success{ "exp-commands_waterfill.enter" } + local item_count_cliff = player.get_item_count("cliff-explosives") + local item_count_craft = math.min(math.floor(player.get_item_count("explosives") / 10), player.get_item_count("barrel"), player.get_item_count("grenade")) + local item_count_total = item_count_cliff + item_count_craft + if item_count_total == 0 then + return player.print{ "exp-commands_waterfill.requires-explosives" } + else + Selection.start(player, SelectionWaterfillArea) + return player.print{ "exp-commands_waterfill.enter" } + end end end) From c62cfc413d849441385319fdd4d020d1b5b6cdbc Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Wed, 29 Jan 2025 00:36:26 +0900 Subject: [PATCH 174/406] . --- exp_scenario/module/commands/waterfill.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exp_scenario/module/commands/waterfill.lua b/exp_scenario/module/commands/waterfill.lua index 161ef81e..d47eb8fc 100644 --- a/exp_scenario/module/commands/waterfill.lua +++ b/exp_scenario/module/commands/waterfill.lua @@ -20,7 +20,7 @@ Commands.new("waterfill", { "exp-commands_waterfill.description" }) if item_count_total == 0 then return player.print{ "exp-commands_waterfill.requires-explosives" } else - Selection.start(player, SelectionWaterfillArea) + Selection.start(player, SelectionName) return player.print{ "exp-commands_waterfill.enter" } end end From 8407c1357d8e3b2cb7404f0234131b7e8d3a907d Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Wed, 29 Jan 2025 00:43:43 +0900 Subject: [PATCH 175/406] . --- exp_scenario/module/commands/waterfill.lua | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/exp_scenario/module/commands/waterfill.lua b/exp_scenario/module/commands/waterfill.lua index d47eb8fc..9bb7e8d0 100644 --- a/exp_scenario/module/commands/waterfill.lua +++ b/exp_scenario/module/commands/waterfill.lua @@ -74,11 +74,13 @@ Selection.on_selection(SelectionName, function(event) if item_count_cliff >= t_diff then player.remove_item{ name = "cliff-explosives", count = t_diff } else - local item_count_needed = t_diff - item_count_cliff player.remove_item{ name = "cliff-explosives", count = item_count_cliff } - player.remove_item{ name = "explosives", count = 10 * item_count_needed } - player.remove_item{ name = "barrel", count = item_count_needed } - player.remove_item{ name = "grenade", count = item_count_needed } + local item_count_needed = t_diff - item_count_cliff + if item_count_needed > 0 then + player.remove_item{ name = "explosives", count = 10 * item_count_needed } + player.remove_item{ name = "barrel", count = item_count_needed } + player.remove_item{ name = "grenade", count = item_count_needed } + end end if remaining_tiles > 0 then From 40bf727e49e9f2163234420a4ab305661965d3b9 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Wed, 29 Jan 2025 00:45:39 +0900 Subject: [PATCH 176/406] . --- exp_scenario/module/commands/waterfill.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/exp_scenario/module/commands/waterfill.lua b/exp_scenario/module/commands/waterfill.lua index 9bb7e8d0..d59d912d 100644 --- a/exp_scenario/module/commands/waterfill.lua +++ b/exp_scenario/module/commands/waterfill.lua @@ -74,7 +74,9 @@ Selection.on_selection(SelectionName, function(event) if item_count_cliff >= t_diff then player.remove_item{ name = "cliff-explosives", count = t_diff } else - player.remove_item{ name = "cliff-explosives", count = item_count_cliff } + if item_count_cliff > 0 then + player.remove_item{ name = "cliff-explosives", count = item_count_cliff } + end local item_count_needed = t_diff - item_count_cliff if item_count_needed > 0 then player.remove_item{ name = "explosives", count = 10 * item_count_needed } From cd3cdda4bf14815c058128a14d59744a99ac01cb Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Mon, 3 Feb 2025 15:33:00 +0900 Subject: [PATCH 177/406] . --- exp_legacy/module/modules/addons/tree-decon.lua | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/exp_legacy/module/modules/addons/tree-decon.lua b/exp_legacy/module/modules/addons/tree-decon.lua index 0fa81f11..c6d33d9f 100644 --- a/exp_legacy/module/modules/addons/tree-decon.lua +++ b/exp_legacy/module/modules/addons/tree-decon.lua @@ -43,8 +43,7 @@ Gui.toolbar.create_button{ visible = function(player, _) return Roles.player_allowed(player, "fast-tree-decon") end -}:on_click(function(def, event, element) - local player = Gui.get_player(event) +}:on_click(function(def, player, element) local state = Gui.toolbar.get_button_toggled_state(def, player) HasEnabledDecon:set(player, state) player.print{ "tree-decon.toggle-msg", state and { "tree-decon.enabled" } or { "tree-decon.disabled" } } From f7549b801754050d51440712c5a6088edea14544 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Mon, 3 Feb 2025 18:06:54 +0900 Subject: [PATCH 178/406] .. --- exp_scenario/module/commands/repair.lua | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/exp_scenario/module/commands/repair.lua b/exp_scenario/module/commands/repair.lua index 6f82c67b..1d250dfd 100644 --- a/exp_scenario/module/commands/repair.lua +++ b/exp_scenario/module/commands/repair.lua @@ -5,8 +5,6 @@ Adds a command that allows an admin to repair and revive a large area local Commands = require("modules/exp_commands") local config = require("modules.exp_legacy.config.repair") --- @dep config.repair -local huge = math.huge - --- Repairs entities on your force around you Commands.new("repair", { "exp-commands_repair.description" }) :argument("range", { "exp-commands_repair.arg-range" }, Commands.types.integer_range(1, config.max_range)) @@ -46,9 +44,9 @@ Commands.new("repair", { "exp-commands_repair.description" }) } for _, entity in ipairs(entities) do - if entity.health and entity.get_health_ratio() ~= 1 then + if entity.health and entity.max_health and entity.health ~= entity.max_health then healed_count = healed_count + 1 - entity.health = huge + entity.health = entity.max_health end end From f63ebf8e7cabe3dc7166810742513772ccf82487 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Mon, 3 Feb 2025 18:07:06 +0900 Subject: [PATCH 179/406] . --- exp_scenario/module/commands/repair.lua | 1 - 1 file changed, 1 deletion(-) diff --git a/exp_scenario/module/commands/repair.lua b/exp_scenario/module/commands/repair.lua index 1d250dfd..019c1dee 100644 --- a/exp_scenario/module/commands/repair.lua +++ b/exp_scenario/module/commands/repair.lua @@ -55,4 +55,3 @@ Commands.new("repair", { "exp-commands_repair.description" }) return Commands.status.success(response) end) - From c8ca52700502f1ace6dd58ed76b65e5b38b8f9e9 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Mon, 3 Feb 2025 23:12:37 +0900 Subject: [PATCH 180/406] . --- exp_gui/module/data.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/exp_gui/module/data.lua b/exp_gui/module/data.lua index b5ceac5c..c792fcdb 100644 --- a/exp_gui/module/data.lua +++ b/exp_gui/module/data.lua @@ -25,6 +25,7 @@ Storage.register({ scope_data = scope_data, registration_numbers = registration_numbers, }, function(tbl) + scope_data = tbl.scope_data registration_numbers = tbl.registration_numbers for scope, data in pairs(tbl.scope_data) do local proxy = registered_scopes[scope] From 29395fe1613fdab15890bcd298cff5c1480c8e95 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Wed, 5 Feb 2025 17:35:07 +0900 Subject: [PATCH 181/406] . --- exp_legacy/module/modules/addons/afk-kick.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/exp_legacy/module/modules/addons/afk-kick.lua b/exp_legacy/module/modules/addons/afk-kick.lua index 5dd3bffe..de1e2ec2 100644 --- a/exp_legacy/module/modules/addons/afk-kick.lua +++ b/exp_legacy/module/modules/addons/afk-kick.lua @@ -30,9 +30,9 @@ Event.on_nth_tick(config.update_time, function() -- Check for active players for _, player in ipairs(game.connected_players) do if player.afk_time < config.afk_time - or config.admin_as_active and player.admin - or config.trust_as_active and player.online_time > config.trust_time - or config.active_role and (Roles.get_player_highest_role(player).index >= Roles.get_role_from_any(config.active_role).index) then + or (config.active_role and Roles.get_player_highest_role(player).index >= Roles.get_role_from_any(config.active_role).index) + or (config.admin_as_active and player.admin) + or (config.trust_as_active and player.online_time > config.trust_time) then -- Active player was found primitives.last_active = game.tick return From 7da0cf78a8dfc5f8700f17ead1278fe867f9eaef Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Thu, 6 Feb 2025 20:27:46 +0900 Subject: [PATCH 182/406] . --- exp_legacy/module/modules/gui/task-list.lua | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/exp_legacy/module/modules/gui/task-list.lua b/exp_legacy/module/modules/gui/task-list.lua index eb20e2ae..983fb9e0 100644 --- a/exp_legacy/module/modules/gui/task-list.lua +++ b/exp_legacy/module/modules/gui/task-list.lua @@ -244,8 +244,7 @@ local task_view_edit_button = Gui.element("task_view_edit_button") tooltip = { "task-list.edit-tooltip" }, style = "shortcut_bar_button", }:style(Styles.footer_button):on_click( - function(def, event, element) - local player = Gui.get_player(event) + function(def, player, element) local selected = PlayerSelected:get(player) PlayerIsEditing:set(player, true) From b94e5e4dad40f03d8cd0965651ab16ae51456106 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Thu, 6 Feb 2025 20:34:23 +0900 Subject: [PATCH 183/406] . --- exp_scenario/module/commands/kill.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exp_scenario/module/commands/kill.lua b/exp_scenario/module/commands/kill.lua index ac4356d0..3fd658c0 100644 --- a/exp_scenario/module/commands/kill.lua +++ b/exp_scenario/module/commands/kill.lua @@ -20,7 +20,7 @@ Commands.new("kill", { "exp-commands_kill.description" }) if other_player == nil then -- Can only be nil if the target is the player and they are already dead return Commands.status.error{ "exp-commands_kill.already-dead" } - elseif (other_player == player) or (highest_role(other_player).index < highest_role(player).index) then + elseif (other_player == player) or (highest_role(other_player).index >= highest_role(player).index) then -- You can always kill yourself or can kill lower role players if script.active_mods["space-age"] then other_player.surface.create_entity{ name = "lightning", position = { other_player.position.x, other_player.position.y - 16 }, target = other_player.character } From a3f3ec3991490e259f3dc1ae215b9b611bad561c Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Thu, 6 Feb 2025 20:40:10 +0900 Subject: [PATCH 184/406] . --- exp_scenario/module/commands/kill.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exp_scenario/module/commands/kill.lua b/exp_scenario/module/commands/kill.lua index 3fd658c0..ac4356d0 100644 --- a/exp_scenario/module/commands/kill.lua +++ b/exp_scenario/module/commands/kill.lua @@ -20,7 +20,7 @@ Commands.new("kill", { "exp-commands_kill.description" }) if other_player == nil then -- Can only be nil if the target is the player and they are already dead return Commands.status.error{ "exp-commands_kill.already-dead" } - elseif (other_player == player) or (highest_role(other_player).index >= highest_role(player).index) then + elseif (other_player == player) or (highest_role(other_player).index < highest_role(player).index) then -- You can always kill yourself or can kill lower role players if script.active_mods["space-age"] then other_player.surface.create_entity{ name = "lightning", position = { other_player.position.x, other_player.position.y - 16 }, target = other_player.character } From 946cc583b1ec65b4027781283d4c77ab16b4a1d0 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Thu, 6 Feb 2025 20:43:29 +0900 Subject: [PATCH 185/406] . --- exp_scenario/module/commands/kill.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exp_scenario/module/commands/kill.lua b/exp_scenario/module/commands/kill.lua index ac4356d0..3fd658c0 100644 --- a/exp_scenario/module/commands/kill.lua +++ b/exp_scenario/module/commands/kill.lua @@ -20,7 +20,7 @@ Commands.new("kill", { "exp-commands_kill.description" }) if other_player == nil then -- Can only be nil if the target is the player and they are already dead return Commands.status.error{ "exp-commands_kill.already-dead" } - elseif (other_player == player) or (highest_role(other_player).index < highest_role(player).index) then + elseif (other_player == player) or (highest_role(other_player).index >= highest_role(player).index) then -- You can always kill yourself or can kill lower role players if script.active_mods["space-age"] then other_player.surface.create_entity{ name = "lightning", position = { other_player.position.x, other_player.position.y - 16 }, target = other_player.character } From dd20b145abd270936de1a0510c2cfc36cfcb7120 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Thu, 6 Feb 2025 22:25:04 +0900 Subject: [PATCH 186/406] . --- .../config/expcore/permission_groups.lua | 54 +++++++++---------- 1 file changed, 25 insertions(+), 29 deletions(-) diff --git a/exp_legacy/module/config/expcore/permission_groups.lua b/exp_legacy/module/config/expcore/permission_groups.lua index 7d986851..b88dae1c 100644 --- a/exp_legacy/module/config/expcore/permission_groups.lua +++ b/exp_legacy/module/config/expcore/permission_groups.lua @@ -1,5 +1,5 @@ --- Use this file to add new permission groups to the game; --- start with Permission_Groups.new_group('name'); +-- start with Permission_Groups.new_group("name"); -- then use either :allow_all() or :disallow_all() to set the default for non specified actions; -- then use :allow{} and :disallow{} to specify certain actions to allow/disallow -- @config Permission-Groups @@ -10,22 +10,22 @@ local Groups = require("modules.exp_legacy.expcore.permission_groups") --- @dep Groups.new_group("Admin") :allow_all() -Groups.new_group('Mod') +Groups.new_group("Mod") :allow_all() :disallow{ - 'add_permission_group', -- admin - 'delete_permission_group', - 'edit_permission_group', - 'import_permissions_string', - 'map_editor_action', - 'toggle_map_editor', - 'change_multiplayer_config', - 'set_heat_interface_mode', - 'set_heat_interface_temperature', - 'set_infinity_container_filter_item', - 'set_infinity_container_remove_unfiltered_items', - 'set_infinity_pipe_filter' - } + "add_permission_group", -- admin + "delete_permission_group", + "edit_permission_group", + "import_permissions_string", + "map_editor_action", + "toggle_map_editor", + "change_multiplayer_config", + "set_heat_interface_mode", + "set_heat_interface_temperature", + "set_infinity_container_filter_item", + "set_infinity_container_remove_unfiltered_items", + "set_infinity_pipe_filter" + } Groups.new_group("Trusted") :allow_all() @@ -62,8 +62,6 @@ Groups.new_group("Standard") "set_infinity_pipe_filter", "admin_action", -- trusted "change_programmable_speaker_alert_parameters", -- standard - "open_new_platform_button_from_rocket_silo", - "set_rocket_silo_send_to_orbit_automated_mode" } Groups.new_group("Guest") @@ -86,17 +84,15 @@ Groups.new_group("Guest") "drop_item", "open_new_platform_button_from_rocket_silo", "set_rocket_silo_send_to_orbit_automated_mode", - "change_programmable_speaker_parameters", -- guest + "change_programmable_speaker_parameters", "change_train_stop_station", - -- 'deconstruct', + -- "deconstruct", "remove_cables", "remove_train_station", "reset_assembling_machine", "rotate_entity", - -- 'use_artillery_remote', -- not in 2.0 - "launch_rocket", + -- "launch_rocket", "cancel_research", - -- 'activate_cut', -- not in 2.0 "flush_opened_entity_fluid", "flush_opened_entity_specific_fluid", } @@ -110,15 +106,15 @@ Groups.new_group("Restricted") local trusted_time = 60*60*60*10 -- 10 hour local standard_time = 60*60*60*3 -- 3 hour local function assign_group(player) - local current_group_name = player.permission_group and player.permission_group.name or 'None' + local current_group_name = player.permission_group and player.permission_group.name or "None" if player.admin then - Permission_Groups.set_player_group(player,'Admin') - elseif player.online_time > trusted_time or current_group_name == 'Trusted' then - Permission_Groups.set_player_group(player,'Trusted') - elseif player.online_time > standard_time or current_group_name == 'Standard' then - Permission_Groups.set_player_group(player,'Standard') + Permission_Groups.set_player_group(player,"Admin") + elseif player.online_time > trusted_time or current_group_name == "Trusted" then + Permission_Groups.set_player_group(player,"Trusted") + elseif player.online_time > standard_time or current_group_name == "Standard" then + Permission_Groups.set_player_group(player,"Standard") else - Permission_Groups.set_player_group(player,'Guest') + Permission_Groups.set_player_group(player,"Guest") end end From 68e523bc5657a486c80a88525c9ffbd104480e44 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Thu, 6 Feb 2025 22:30:29 +0900 Subject: [PATCH 187/406] . --- exp_legacy/module/config/expcore/permission_groups.lua | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/exp_legacy/module/config/expcore/permission_groups.lua b/exp_legacy/module/config/expcore/permission_groups.lua index b88dae1c..617c6e4f 100644 --- a/exp_legacy/module/config/expcore/permission_groups.lua +++ b/exp_legacy/module/config/expcore/permission_groups.lua @@ -81,10 +81,14 @@ Groups.new_group("Guest") "set_infinity_pipe_filter", "admin_action", -- trusted "change_programmable_speaker_alert_parameters", -- standard + "change_programmable_speaker_circuit_parameters", + "change_programmable_speaker_parameters", "drop_item", "open_new_platform_button_from_rocket_silo", "set_rocket_silo_send_to_orbit_automated_mode", - "change_programmable_speaker_parameters", + "instantly_create_space_platform", + "cancel_delete_space_platform", + "rename_space_platform", "change_train_stop_station", -- "deconstruct", "remove_cables", From e42d1a828062f812b0d0e8e284afff43976a3eb4 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Thu, 6 Feb 2025 22:34:40 +0900 Subject: [PATCH 188/406] . --- exp_legacy/module/config/expcore/permission_groups.lua | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/exp_legacy/module/config/expcore/permission_groups.lua b/exp_legacy/module/config/expcore/permission_groups.lua index 617c6e4f..cee7f623 100644 --- a/exp_legacy/module/config/expcore/permission_groups.lua +++ b/exp_legacy/module/config/expcore/permission_groups.lua @@ -61,7 +61,6 @@ Groups.new_group("Standard") "set_infinity_container_remove_unfiltered_items", "set_infinity_pipe_filter", "admin_action", -- trusted - "change_programmable_speaker_alert_parameters", -- standard } Groups.new_group("Guest") @@ -80,22 +79,23 @@ Groups.new_group("Guest") "set_infinity_container_remove_unfiltered_items", "set_infinity_pipe_filter", "admin_action", -- trusted - "change_programmable_speaker_alert_parameters", -- standard + "change_programmable_speaker_alert_parameters", -- guest "change_programmable_speaker_circuit_parameters", "change_programmable_speaker_parameters", "drop_item", - "open_new_platform_button_from_rocket_silo", "set_rocket_silo_send_to_orbit_automated_mode", + "open_new_platform_button_from_rocket_silo", "instantly_create_space_platform", "cancel_delete_space_platform", + "delete_space_platform", "rename_space_platform", + -- "launch_rocket", "change_train_stop_station", -- "deconstruct", "remove_cables", "remove_train_station", "reset_assembling_machine", "rotate_entity", - -- "launch_rocket", "cancel_research", "flush_opened_entity_fluid", "flush_opened_entity_specific_fluid", From f40fd155abdb1cc9562bb8ccead72b57c5227b90 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Thu, 6 Feb 2025 22:38:21 +0900 Subject: [PATCH 189/406] . --- exp_legacy/module/config/expcore/permission_groups.lua | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/exp_legacy/module/config/expcore/permission_groups.lua b/exp_legacy/module/config/expcore/permission_groups.lua index cee7f623..40ca8ec1 100644 --- a/exp_legacy/module/config/expcore/permission_groups.lua +++ b/exp_legacy/module/config/expcore/permission_groups.lua @@ -61,6 +61,7 @@ Groups.new_group("Standard") "set_infinity_container_remove_unfiltered_items", "set_infinity_pipe_filter", "admin_action", -- trusted + "change_programmable_speaker_alert_parameters", -- standard } Groups.new_group("Guest") @@ -79,8 +80,8 @@ Groups.new_group("Guest") "set_infinity_container_remove_unfiltered_items", "set_infinity_pipe_filter", "admin_action", -- trusted - "change_programmable_speaker_alert_parameters", -- guest - "change_programmable_speaker_circuit_parameters", + "change_programmable_speaker_alert_parameters", -- standard + "change_programmable_speaker_circuit_parameters", -- guest "change_programmable_speaker_parameters", "drop_item", "set_rocket_silo_send_to_orbit_automated_mode", From 2c4316a53ba9b7522a631547fd1c4ea50ae700d2 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Thu, 6 Feb 2025 22:40:01 +0900 Subject: [PATCH 190/406] . --- exp_legacy/module/config/expcore/permission_groups.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/exp_legacy/module/config/expcore/permission_groups.lua b/exp_legacy/module/config/expcore/permission_groups.lua index 40ca8ec1..162a8f04 100644 --- a/exp_legacy/module/config/expcore/permission_groups.lua +++ b/exp_legacy/module/config/expcore/permission_groups.lua @@ -61,6 +61,7 @@ Groups.new_group("Standard") "set_infinity_container_remove_unfiltered_items", "set_infinity_pipe_filter", "admin_action", -- trusted + "delete_space_platform", "change_programmable_speaker_alert_parameters", -- standard } @@ -80,6 +81,7 @@ Groups.new_group("Guest") "set_infinity_container_remove_unfiltered_items", "set_infinity_pipe_filter", "admin_action", -- trusted + "delete_space_platform", "change_programmable_speaker_alert_parameters", -- standard "change_programmable_speaker_circuit_parameters", -- guest "change_programmable_speaker_parameters", @@ -88,7 +90,6 @@ Groups.new_group("Guest") "open_new_platform_button_from_rocket_silo", "instantly_create_space_platform", "cancel_delete_space_platform", - "delete_space_platform", "rename_space_platform", -- "launch_rocket", "change_train_stop_station", From 5241a41ff3e2f3f11d150561b4df39e6e7fd4be4 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Thu, 6 Feb 2025 23:14:28 +0900 Subject: [PATCH 191/406] . --- exp_scenario/module/commands/kill.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exp_scenario/module/commands/kill.lua b/exp_scenario/module/commands/kill.lua index 3fd658c0..17d291fd 100644 --- a/exp_scenario/module/commands/kill.lua +++ b/exp_scenario/module/commands/kill.lua @@ -20,7 +20,7 @@ Commands.new("kill", { "exp-commands_kill.description" }) if other_player == nil then -- Can only be nil if the target is the player and they are already dead return Commands.status.error{ "exp-commands_kill.already-dead" } - elseif (other_player == player) or (highest_role(other_player).index >= highest_role(player).index) then + elseif (other_player == player) or (highest_role(player).index < highest_role(other_player).index) then -- You can always kill yourself or can kill lower role players if script.active_mods["space-age"] then other_player.surface.create_entity{ name = "lightning", position = { other_player.position.x, other_player.position.y - 16 }, target = other_player.character } From 61494e9c4803e67a54fff572cce8b2dad38b0694 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Thu, 6 Feb 2025 23:20:13 +0900 Subject: [PATCH 192/406] . --- exp_legacy/module/config/expcore/permission_groups.lua | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/exp_legacy/module/config/expcore/permission_groups.lua b/exp_legacy/module/config/expcore/permission_groups.lua index 162a8f04..2a341f62 100644 --- a/exp_legacy/module/config/expcore/permission_groups.lua +++ b/exp_legacy/module/config/expcore/permission_groups.lua @@ -20,11 +20,6 @@ Groups.new_group("Mod") "map_editor_action", "toggle_map_editor", "change_multiplayer_config", - "set_heat_interface_mode", - "set_heat_interface_temperature", - "set_infinity_container_filter_item", - "set_infinity_container_remove_unfiltered_items", - "set_infinity_pipe_filter" } Groups.new_group("Trusted") @@ -37,12 +32,12 @@ Groups.new_group("Trusted") "map_editor_action", "toggle_map_editor", "change_multiplayer_config", - "set_heat_interface_mode", + "set_heat_interface_mode", -- trusted "set_heat_interface_temperature", "set_infinity_container_filter_item", "set_infinity_container_remove_unfiltered_items", "set_infinity_pipe_filter", - "admin_action", -- trusted + "admin_action", } Groups.new_group("Standard") From fb2a409d4c4d677bb2bed4aacb0e67e5a16c6203 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Fri, 7 Feb 2025 02:25:40 +0900 Subject: [PATCH 193/406] . --- exp_legacy/module/modules/addons/miner.lua | 26 +++++++++++----------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/exp_legacy/module/modules/addons/miner.lua b/exp_legacy/module/modules/addons/miner.lua index d83a9c3f..8fe3bd1c 100644 --- a/exp_legacy/module/modules/addons/miner.lua +++ b/exp_legacy/module/modules/addons/miner.lua @@ -41,7 +41,7 @@ local function check_entity(entity) end if not entity.minable then - -- if it is minable + -- if it is not minable return true end @@ -85,7 +85,7 @@ local function chest_check(entity) end end - if check_entity(target) then + if not check_entity(target) then table.insert(miner_data.queue, { t = game.tick + 10, e = target }) end end @@ -161,27 +161,27 @@ Event.add(defines.events.on_resource_depleted, function(event) return end - local entities = event.entity.surface.find_entities_filtered{ area = { { event.entity.position.x - 1, event.entity.position.y - 1 }, { event.entity.position.x + 1, event.entity.position.y + 1 } }, type = "mining-drill" } + local resource = event.entity + local drills = resource.surface.find_entities_filtered{ type = "mining-drill" } - if #entities == 0 then - return - end - - for _, entity in pairs(entities) do - if ((math.abs(entity.position.x - event.entity.position.x) < entity.prototype.mining_drill_radius) and (math.abs(entity.position.y - event.entity.position.y) < entity.prototype.mining_drill_radius)) then + for _, entity in pairs(drills) do + local radius = entity.prototype.mining_drill_radius + local dx = math.abs(entity.position.x - resource.position.x) + local dy = math.abs(entity.position.y - resource.position.y) + if dx <= radius and dy <= radius then miner_check(entity) end end end) Event.on_nth_tick(10, function(event) - for k, q in pairs(miner_data.queue) do + for i = #miner_data.queue, 1, -1 do + local q = miner_data.queue[i] if not q.e or not q.e.valid then - table.remove(miner_data.queue, k) - break + table.remove(miner_data.queue, i) elseif event.tick >= q.t then q.e.order_deconstruction(q.e.force) - table.remove(miner_data.queue, k) + table.remove(miner_data.queue, i) end end end) From 8da7ab8586431ec0d5ef93711e9beff30b1da425 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Fri, 7 Feb 2025 13:22:56 +0900 Subject: [PATCH 194/406] . --- exp_legacy/module/modules/gui/vlayer.lua | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/exp_legacy/module/modules/gui/vlayer.lua b/exp_legacy/module/modules/gui/vlayer.lua index 559d2fd7..47bc677a 100644 --- a/exp_legacy/module/modules/gui/vlayer.lua +++ b/exp_legacy/module/modules/gui/vlayer.lua @@ -443,6 +443,7 @@ local vlayer_gui_control_remove = Gui.element("vlayer_gui_control_remove") -- @element vlayer_control_set local vlayer_control_set = Gui.element("vlayer_control_set") :draw(function(_, parent, name) + local player = Gui.get_player(parent) local vlayer_set = parent.add{ type = "flow", direction = "vertical", name = name } local disp = Gui.elements.scroll_table(vlayer_set, 400, 2, "disp") @@ -450,8 +451,11 @@ local vlayer_control_set = Gui.element("vlayer_control_set") vlayer_gui_control_list(disp) vlayer_gui_control_refresh(disp) vlayer_gui_control_see(disp) - vlayer_gui_control_build(disp) - vlayer_gui_control_remove(disp) + local b = vlayer_gui_control_build(disp) + local r = vlayer_gui_control_remove(disp) + local v = Roles.player_allowed(player, "gui/vlayer-edit") + b.visible = v + r.visible = v return vlayer_set end) @@ -460,12 +464,10 @@ local vlayer_control_set = Gui.element("vlayer_control_set") -- @element vlayer_container vlayer_container = Gui.element("vlayer_container") :draw(function(definition, parent) - local player = Gui.get_player(parent) local container = Gui.elements.container(parent, 400) vlayer_display_set(container, "vlayer_st_1") - local control_set = vlayer_control_set(container, "vlayer_st_2") - control_set.visible = Roles.player_allowed(player, "gui/vlayer-edit") + vlayer_control_set(container, "vlayer_st_2") return container.parent end) @@ -487,7 +489,9 @@ local function role_update_event(event) local player = game.players[event.player_index] local visible = Roles.player_allowed(player, "gui/vlayer-edit") local container = Gui.get_left_element(vlayer_container, player) - container.frame["vlayer_st_2"].visible = visible + local frame = container.frame["vlayer_st_2"] + frame[vlayer_gui_control_build.name].visible = visible + frame[vlayer_gui_control_remove.name].visible = visible end Event.add(Roles.events.on_role_assigned, role_update_event) From e34b6682ed2c7f6afec73701f249cbae33a59c02 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Fri, 7 Feb 2025 13:49:44 +0900 Subject: [PATCH 195/406] . --- exp_legacy/module/modules/addons/miner.lua | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/exp_legacy/module/modules/addons/miner.lua b/exp_legacy/module/modules/addons/miner.lua index 8fe3bd1c..fcc4fae3 100644 --- a/exp_legacy/module/modules/addons/miner.lua +++ b/exp_legacy/module/modules/addons/miner.lua @@ -115,9 +115,7 @@ local function miner_check(entity) if config.fluid and entity.fluidbox and #entity.fluidbox > 0 then -- if require fluid to mine table.insert(pipe_build, { x = 0, y = 0 }) - - local half = math.floor(entity.get_radius()) - local r = 1 + er + local r = er + 1 local entities = es.find_entities_filtered{ area = { { ep.x - r, ep.y - r }, { ep.x + r, ep.y + r } }, type = { "mining-drill", "pipe", "pipe-to-ground" } } local entities_t = es.find_entities_filtered{ area = { { ep.x - r, ep.y - r }, { ep.x + r, ep.y + r } }, ghost_type = { "pipe", "pipe-to-ground" } } @@ -126,19 +124,19 @@ local function miner_check(entity) for _, e in pairs(entities) do if (e.position.x > ep.x) and (e.position.y == ep.y) then - for h = 1, half do + for h = 1, er do table.insert(pipe_build, { x = h, y = 0 }) end elseif (e.position.x < ep.x) and (e.position.y == ep.y) then - for h = 1, half do + for h = 1, er do table.insert(pipe_build, { x = -h, y = 0 }) end elseif (e.position.x == ep.x) and (e.position.y > ep.y) then - for h = 1, half do + for h = 1, er do table.insert(pipe_build, { x = 0, y = h }) end elseif (e.position.x == ep.x) and (e.position.y < ep.y) then - for h = 1, half do + for h = 1, er do table.insert(pipe_build, { x = 0, y = -h }) end end From 1daef1f2160ebf6daa5bdf5222a8507006c43c02 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Fri, 7 Feb 2025 13:54:01 +0900 Subject: [PATCH 196/406] . --- exp_legacy/module/modules/addons/miner.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exp_legacy/module/modules/addons/miner.lua b/exp_legacy/module/modules/addons/miner.lua index fcc4fae3..d5e87aef 100644 --- a/exp_legacy/module/modules/addons/miner.lua +++ b/exp_legacy/module/modules/addons/miner.lua @@ -85,7 +85,7 @@ local function chest_check(entity) end end - if not check_entity(target) then + if check_entity(target) then table.insert(miner_data.queue, { t = game.tick + 10, e = target }) end end From cbd776966efae66e6d55f083d9cfdd0a0f6b5c25 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Fri, 7 Feb 2025 18:40:33 +0900 Subject: [PATCH 197/406] . --- exp_legacy/module/modules/addons/spawn-area.lua | 2 +- exp_legacy/module/modules/control/warps.lua | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/exp_legacy/module/modules/addons/spawn-area.lua b/exp_legacy/module/modules/addons/spawn-area.lua index 568fa0af..9e3de144 100644 --- a/exp_legacy/module/modules/addons/spawn-area.lua +++ b/exp_legacy/module/modules/addons/spawn-area.lua @@ -61,7 +61,7 @@ local function spawn_turrets() -- Makes a new turret if it is not found if not turret or not turret.valid then - turret = surface.create_entity{ name = "gun-turret", position = pos, force = "spawn" } + turret = surface.create_entity{ name = "gun-turret", position = pos, force = "neutral" } if not turret then return end protect_entity(turret) end diff --git a/exp_legacy/module/modules/control/warps.lua b/exp_legacy/module/modules/control/warps.lua index b6cad0a9..9a3f905f 100644 --- a/exp_legacy/module/modules/control/warps.lua +++ b/exp_legacy/module/modules/control/warps.lua @@ -189,6 +189,10 @@ function Warps.make_warp_area(warp_id) if entity.type == "electric-pole" then warp.electric_pole = entity end + + if entity.name == "small-lamp" then + warp.always_on = true + end end end From aeb1538095587b83d7afd8481d7930e858705275 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Fri, 7 Feb 2025 18:43:51 +0900 Subject: [PATCH 198/406] . --- .../module/modules/addons/spawn-area.lua | 20 ++++++++----------- 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/exp_legacy/module/modules/addons/spawn-area.lua b/exp_legacy/module/modules/addons/spawn-area.lua index 9e3de144..e2ff55a9 100644 --- a/exp_legacy/module/modules/addons/spawn-area.lua +++ b/exp_legacy/module/modules/addons/spawn-area.lua @@ -21,20 +21,12 @@ for _, turret in ipairs(turrets) do end -- Get or create the force used for entities in spawn -local function get_spawn_force() - local force = game.forces["spawn"] +local function get_neutral_force() + local force = game.forces["neutral"] if force and force.valid then return force end - - force = game.create_force("spawn") - force.set_cease_fire("player", true) - -- force.set_friend('player', true) - game.forces["player"].set_cease_fire("spawn", true) - -- game.forces['player'].set_friend('spawn', true) - - return force end -- Protects an entity @@ -47,7 +39,7 @@ local function protect_entity(entity, set_force) entity.operable = false if set_force then - entity.force = get_spawn_force() + entity.force = get_neutral_force() end end end @@ -228,7 +220,11 @@ Event.add(defines.events.on_player_created, function(event) local player = game.players[event.player_index] local p = { x = 0, y = 0 } local s = player.physical_surface - get_spawn_force() + game.forces["neutral"].set_cease_fire("player", true) + game.forces["player"].set_cease_fire("neutral", true) + -- force.set_friend("player", true) + -- game.forces["player"].set_friend("neutral", true) + game.forces["neutral"].enable_all_technologies() spawn_area(s, p) if config.pattern.enabled then spawn_pattern(s, p) end if config.water.enabled then spawn_water(s, p) end From d4e76de5fd7ff028beed62d7db770c1fe6464b36 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Fri, 7 Feb 2025 18:45:18 +0900 Subject: [PATCH 199/406] . --- exp_legacy/module/modules/addons/spawn-area.lua | 2 -- 1 file changed, 2 deletions(-) diff --git a/exp_legacy/module/modules/addons/spawn-area.lua b/exp_legacy/module/modules/addons/spawn-area.lua index e2ff55a9..6ce63a21 100644 --- a/exp_legacy/module/modules/addons/spawn-area.lua +++ b/exp_legacy/module/modules/addons/spawn-area.lua @@ -222,8 +222,6 @@ Event.add(defines.events.on_player_created, function(event) local s = player.physical_surface game.forces["neutral"].set_cease_fire("player", true) game.forces["player"].set_cease_fire("neutral", true) - -- force.set_friend("player", true) - -- game.forces["player"].set_friend("neutral", true) game.forces["neutral"].enable_all_technologies() spawn_area(s, p) if config.pattern.enabled then spawn_pattern(s, p) end From 2b66965d08bcbc0846ad73a55dd5e22494b87b93 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Fri, 7 Feb 2025 18:59:13 +0900 Subject: [PATCH 200/406] . --- exp_legacy/module/modules/addons/spawn-area.lua | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/exp_legacy/module/modules/addons/spawn-area.lua b/exp_legacy/module/modules/addons/spawn-area.lua index 6ce63a21..b814ed19 100644 --- a/exp_legacy/module/modules/addons/spawn-area.lua +++ b/exp_legacy/module/modules/addons/spawn-area.lua @@ -20,15 +20,6 @@ for _, turret in ipairs(turrets) do turret.position = apply_offset(turret.position, config.turrets.offset) end --- Get or create the force used for entities in spawn -local function get_neutral_force() - local force = game.forces["neutral"] - - if force and force.valid then - return force - end -end - -- Protects an entity -- and sets its force to the spawn force local function protect_entity(entity, set_force) @@ -39,7 +30,7 @@ local function protect_entity(entity, set_force) entity.operable = false if set_force then - entity.force = get_neutral_force() + entity.force = game.forces["neutral"] end end end From 39dbcfeacaeeef062c0cb5d2253aa6b0898e9278 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Fri, 7 Feb 2025 19:01:21 +0900 Subject: [PATCH 201/406] . --- exp_legacy/module/modules/gui/vlayer.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/exp_legacy/module/modules/gui/vlayer.lua b/exp_legacy/module/modules/gui/vlayer.lua index 47bc677a..c5512799 100644 --- a/exp_legacy/module/modules/gui/vlayer.lua +++ b/exp_legacy/module/modules/gui/vlayer.lua @@ -489,9 +489,9 @@ local function role_update_event(event) local player = game.players[event.player_index] local visible = Roles.player_allowed(player, "gui/vlayer-edit") local container = Gui.get_left_element(vlayer_container, player) - local frame = container.frame["vlayer_st_2"] - frame[vlayer_gui_control_build.name].visible = visible - frame[vlayer_gui_control_remove.name].visible = visible + local disp = container.frame["vlayer_st_2"].disp.table + disp[vlayer_gui_control_build.name].visible = visible + disp[vlayer_gui_control_remove.name].visible = visible end Event.add(Roles.events.on_role_assigned, role_update_event) From 08fbb1fd843e89304b29331a4ab398bf84bf2999 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Fri, 7 Feb 2025 19:17:05 +0900 Subject: [PATCH 202/406] . --- exp_legacy/module/modules/addons/spawn-area.lua | 8 +++++++- exp_legacy/module/modules/control/warps.lua | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/exp_legacy/module/modules/addons/spawn-area.lua b/exp_legacy/module/modules/addons/spawn-area.lua index b814ed19..41d2768c 100644 --- a/exp_legacy/module/modules/addons/spawn-area.lua +++ b/exp_legacy/module/modules/addons/spawn-area.lua @@ -114,7 +114,13 @@ local function spawn_entities(surface, position) protect_entity(entity) end - entity.operable = config.entities.operable + if entity then + entity.operable = config.entities.operable + + if entity.name == "small-lamp" then + entity.always_on = true + end + end end end diff --git a/exp_legacy/module/modules/control/warps.lua b/exp_legacy/module/modules/control/warps.lua index 9a3f905f..8ff4df53 100644 --- a/exp_legacy/module/modules/control/warps.lua +++ b/exp_legacy/module/modules/control/warps.lua @@ -191,7 +191,7 @@ function Warps.make_warp_area(warp_id) end if entity.name == "small-lamp" then - warp.always_on = true + entity.always_on = true end end end From 04d55cec4ac68ef144b137c5d00dfeb201c6344c Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Fri, 7 Feb 2025 19:23:42 +0900 Subject: [PATCH 203/406] . --- exp_legacy/module/modules/addons/spawn-area.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/exp_legacy/module/modules/addons/spawn-area.lua b/exp_legacy/module/modules/addons/spawn-area.lua index 41d2768c..c6a67783 100644 --- a/exp_legacy/module/modules/addons/spawn-area.lua +++ b/exp_legacy/module/modules/addons/spawn-area.lua @@ -219,7 +219,9 @@ Event.add(defines.events.on_player_created, function(event) local s = player.physical_surface game.forces["neutral"].set_cease_fire("player", true) game.forces["player"].set_cease_fire("neutral", true) - game.forces["neutral"].enable_all_technologies() + game.forces["neutral"].set_ammo_damage_modifier("bullet", 2) + game.forces["neutral"].set_gun_speed_modifier("bullet", 2) + game.forces["neutral"].set_turret_attack_modifier("gun-turret", 2) spawn_area(s, p) if config.pattern.enabled then spawn_pattern(s, p) end if config.water.enabled then spawn_water(s, p) end From f0adfa3e3289c70a56685cef42f45c74528aef7f Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Fri, 7 Feb 2025 19:24:07 +0900 Subject: [PATCH 204/406] . --- exp_legacy/module/modules/addons/spawn-area.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/exp_legacy/module/modules/addons/spawn-area.lua b/exp_legacy/module/modules/addons/spawn-area.lua index c6a67783..5c22c7ff 100644 --- a/exp_legacy/module/modules/addons/spawn-area.lua +++ b/exp_legacy/module/modules/addons/spawn-area.lua @@ -219,9 +219,9 @@ Event.add(defines.events.on_player_created, function(event) local s = player.physical_surface game.forces["neutral"].set_cease_fire("player", true) game.forces["player"].set_cease_fire("neutral", true) - game.forces["neutral"].set_ammo_damage_modifier("bullet", 2) - game.forces["neutral"].set_gun_speed_modifier("bullet", 2) - game.forces["neutral"].set_turret_attack_modifier("gun-turret", 2) + game.forces["neutral"].set_ammo_damage_modifier("bullet", 1) + game.forces["neutral"].set_gun_speed_modifier("bullet", 1) + game.forces["neutral"].set_turret_attack_modifier("gun-turret", 1) spawn_area(s, p) if config.pattern.enabled then spawn_pattern(s, p) end if config.water.enabled then spawn_water(s, p) end From 31ec0afa5bfdefe4c43486bafea45eb588f52c0d Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Fri, 7 Feb 2025 22:20:20 +0900 Subject: [PATCH 205/406] . --- exp_legacy/module/modules/gui/research.lua | 185 ++++++++------------- 1 file changed, 72 insertions(+), 113 deletions(-) diff --git a/exp_legacy/module/modules/gui/research.lua b/exp_legacy/module/modules/gui/research.lua index 0ccbe038..14a7b1f3 100644 --- a/exp_legacy/module/modules/gui/research.lua +++ b/exp_legacy/module/modules/gui/research.lua @@ -20,9 +20,9 @@ Storage.register(research, function(tbl) research = tbl end) -for i = 1, #config.mod_set_lookup do - if script.active_mods[config.mod_set_lookup[i]] then - config.mod_set = config.mod_set_lookup[i] +for _, mod_name in ipairs(config.mod_set_lookup) do + if script.active_mods[mod_name] then + config.mod_set = mod_name break end end @@ -31,10 +31,9 @@ local research_time_format = ExpUtil.format_time_factory{ format = "clock", hour local empty_time = research_time_format(nil) local font_color = { - -- positive - [1] = { r = 0.3, g = 1, b = 0.3 }, - -- negative - [2] = { r = 1, g = 0.3, b = 0.3 }, + ["neutral"] = { r = 0, g = 0, b = 0 }, + ["positive"] = { r = 0.3, g = 1, b = 0.3 }, + ["negative"] = { r = 1, g = 0.3, b = 0.3 }, } local res = { @@ -64,36 +63,26 @@ end local function research_add_log() local result_data = {} - for i = 1, #research.time, 1 do - result_data[res["disp"][i]["raw_name"]] = research.time[i] + for i = 1, #research.time do + result_data[res.disp[i].raw_name] = research.time[i] end write_file(config.file_name, table_to_json(result_data) .. "\n", true, 0) end -local function research_res_n(res_) - local res_n = 1 +local function research_res_n() + local current = #res.disp + 1 - for k, _ in pairs(res_) do - if research.time[k] == 0 then - res_n = k - 1 + for i = 1, #res.disp do + if research.time[i] == 0 then + current = i break end end - if research.time[#res_] and research.time[#res_] > 0 then - if res_n == 1 then - res_n = #res_ - end - end - - if res_n < 3 then - res_n = 3 - elseif res_n > (#research.time - 5) then - res_n = #research.time - 5 - end - - return res_n + local max_start = math.max(1, #res.disp - 7) + local start = math.clamp(current - 3, 1, max_start) + return math.min(start, max_start) end local function research_notification(event) @@ -105,68 +94,60 @@ local function research_notification(event) end if config.bonus_inventory.enabled then - if (event.research.level - 1) <= math.ceil(config.bonus_inventory.limit / config.bonus_inventory.rate) then - event.research.force[config.bonus_inventory.name] = math.max((event.research.level - 1) * config.bonus_inventory.rate, config.bonus_inventory.limit) - end + event.research.force[config.bonus_inventory.name] = math.max((event.research.level - 1) * config.bonus_inventory.rate, config.bonus_inventory.limit) end if config.pollution_ageing_by_research then game.map_settings.pollution.ageing = math.min(10, event.research.level / 5) end - else - if not (event.by_script) then - game.print{ "research.inf", research_time_format(game.tick), event.research.name, event.research.level - 1 } - end + end + + if not (event.by_script) then + game.print{ "research.inf", research_time_format(game.tick), event.research.name, event.research.level - 1 } end else if not (event.by_script) then game.print{ "research.msg", research_time_format(game.tick), event.research.name } end - if config.bonus_inventory.enabled then - if event.research.name == "mining-productivity-1" or event.research.name == "mining-productivity-2" or event.research.name == "mining-productivity-3" then - event.research.force[config.bonus_inventory.name] = event.research.level * config.bonus_inventory.rate - end + if config.bonus_inventory.enabled and (event.research.name == "mining-productivity-1" or event.research.name == "mining-productivity-2" or event.research.name == "mining-productivity-3") then + event.research.force[config.bonus_inventory.name] = event.research.level * config.bonus_inventory.rate end end end local function research_gui_update() local res_disp = {} - local res_n = research_res_n(res["disp"]) + local res_n = research_res_n() - for i = 1, 8, 1 do - res_disp[i] = { - ["name"] = "", - ["target"] = "", - ["attempt"] = "", - ["difference"] = "", - ["difference_color"] = font_color[1], + for i = 1, 8 do + local res_i = res_n + i - 1 + local entry = res.disp[res_i] or {} + local data = { + name = "", + target = "", + attempt = "", + difference = "", + color = font_color["positive"] } - local res_i = res_n + i - 3 - - if res["disp"][res_i] then - res_disp[i]["name"] = { "research.res-name", res["disp"][res_i]["raw_name"], prototypes.technology[res["disp"][res_i]["raw_name"]].localised_name } + if entry.raw_name then + data.name = { "research.res-name", entry.raw_name, prototypes.technology[entry.raw_name].localised_name } + data.target = entry.target_disp if research.time[res_i] == 0 then - res_disp[i]["target"] = res["disp"][res_i].target_disp - res_disp[i]["attempt"] = empty_time - res_disp[i]["difference"] = empty_time - res_disp[i]["difference_color"] = font_color[1] - else - res_disp[i]["target"] = res["disp"][res_i].target_disp - res_disp[i]["attempt"] = research_time_format(research.time[res_i]) + data.attempt = empty_time + data.difference = empty_time - if research.time[res_i] < res["disp"][res_i].target then - res_disp[i]["difference"] = "-" .. research_time_format(res["disp"][res_i].target - research.time[res_i]) - res_disp[i]["difference_color"] = font_color[1] - else - res_disp[i]["difference"] = research_time_format(research.time[res_i] - res["disp"][res_i].target) - res_disp[i]["difference_color"] = font_color[2] - end + else + data.attempt = research_time_format(research.time[res_i]) + local diff = research.time[res_i] - entry.target + data.difference = (diff < 0 and "-" or "") .. research_time_format(math.abs(diff)) + data.color = (diff < 0 and font_color["positive"]) or font_color["negative"] end end + + res_disp[i] = data end return res_disp @@ -198,42 +179,19 @@ local research_clock_set = Gui.element("research_clock_set") -- @element research_data_group local research_data_group = Gui.element("research_data_group") :draw(function(_def, parent, i) - local name = parent.add{ - type = "label", - name = "research_" .. i .. "_name", - caption = "", - style = "heading_2_label", - } - name.style.width = 180 - name.style.horizontal_align = "left" + local labels = { "name", "target", "attempt", "difference" } - local target = parent.add{ - type = "label", - name = "research_" .. i .. "_target", - caption = "", - style = "heading_2_label", - } - target.style.width = 70 - target.style.horizontal_align = "right" - - local attempt = parent.add{ - type = "label", - name = "research_" .. i .. "_attempt", - caption = "", - style = "heading_2_label", - } - attempt.style.width = 70 - attempt.style.horizontal_align = "right" - - local difference = parent.add{ - type = "label", - name = "research_" .. i .. "_difference", - caption = "", - style = "heading_2_label", - } - difference.style.width = 70 - difference.style.horizontal_align = "right" - difference.style.font_color = font_color[1] + for _, label in ipairs(labels) do + local elem = parent.add{ + type = "label", + name = "research_" .. i .. "_" .. label, + caption = "", + style = "heading_2_label" + } + elem.style.minimal_width = (label == "name" and 180) or 70 + elem.style.horizontal_align = (label == "name" and "left") or "right" + elem.style.font_color = (label == "difference" and font_color["positive"]) or font_color["neutral"] + end end) --- A vertical flow containing the data @@ -250,7 +208,7 @@ local research_data_set = Gui.element("research_data_set") disp["research_0_attempt"].caption = { "research.attempt" } disp["research_0_difference"].caption = { "research.difference" } - for i = 1, 8, 1 do + for i = 1, 8 do research_data_group(disp, i) local research_name_i = "research_" .. i @@ -289,28 +247,29 @@ Gui.toolbar.create_button{ Event.add(defines.events.on_research_finished, function(event) research_notification(event) + local research_name = event.research.name - if res["lookup_name"][event.research.name] == nil then + if not res["lookup_name"][research_name] then return end - local n_i = res["lookup_name"][event.research.name] - research.time[n_i] = game.tick + research.time[res.lookup_name[research_name]] = game.tick local res_disp = research_gui_update() for _, player in pairs(game.connected_players) do - local container = Gui.get_left_element(research_container, player) - local disp = container.frame["research_st_2"].disp.table + if Roles.player_allowed(player, "gui/research") then + local container = Gui.get_left_element(research_container, player) + local disp = container.frame["research_st_2"].disp.table - for i = 1, 8, 1 do - local research_name_i = "research_" .. i - - disp[research_name_i .. "_name"].caption = res_disp[i]["name"] - disp[research_name_i .. "_target"].caption = res_disp[i]["target"] - disp[research_name_i .. "_attempt"].caption = res_disp[i]["attempt"] - disp[research_name_i .. "_difference"].caption = res_disp[i]["difference"] - disp[research_name_i .. "_difference"].style.font_color = res_disp[i]["difference_color"] + for i = 1, 8 do + local research_name_i = "research_" .. i + disp[research_name_i .. "_name"].caption = res_disp[i]["name"] + disp[research_name_i .. "_target"].caption = res_disp[i]["target"] + disp[research_name_i .. "_attempt"].caption = res_disp[i]["attempt"] + disp[research_name_i .. "_difference"].caption = res_disp[i]["difference"] + disp[research_name_i .. "_difference"].style.font_color = res_disp[i]["difference_color"] + end end end end) From 5ebf2eb0bc55e4a483fa1fd97eca77b77d22a254 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Fri, 7 Feb 2025 22:25:52 +0900 Subject: [PATCH 206/406] . --- exp_legacy/module/modules/gui/research.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/exp_legacy/module/modules/gui/research.lua b/exp_legacy/module/modules/gui/research.lua index 14a7b1f3..5d24edce 100644 --- a/exp_legacy/module/modules/gui/research.lua +++ b/exp_legacy/module/modules/gui/research.lua @@ -31,7 +31,7 @@ local research_time_format = ExpUtil.format_time_factory{ format = "clock", hour local empty_time = research_time_format(nil) local font_color = { - ["neutral"] = { r = 0, g = 0, b = 0 }, + ["neutral"] = { r = 1, g = 1, b = 1 }, ["positive"] = { r = 0.3, g = 1, b = 0.3 }, ["negative"] = { r = 1, g = 0.3, b = 0.3 }, } @@ -207,6 +207,7 @@ local research_data_set = Gui.element("research_data_set") disp["research_0_target"].caption = { "research.target" } disp["research_0_attempt"].caption = { "research.attempt" } disp["research_0_difference"].caption = { "research.difference" } + disp["research_0_difference"].style.font_color = font_color["neutral"] for i = 1, 8 do research_data_group(disp, i) From 96ac299263dd46934a04e7a812b6804122643831 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Fri, 7 Feb 2025 22:30:34 +0900 Subject: [PATCH 207/406] . --- exp_legacy/module/modules/gui/research.lua | 2 -- 1 file changed, 2 deletions(-) diff --git a/exp_legacy/module/modules/gui/research.lua b/exp_legacy/module/modules/gui/research.lua index 5d24edce..f7a66c53 100644 --- a/exp_legacy/module/modules/gui/research.lua +++ b/exp_legacy/module/modules/gui/research.lua @@ -211,9 +211,7 @@ local research_data_set = Gui.element("research_data_set") for i = 1, 8 do research_data_group(disp, i) - local research_name_i = "research_" .. i - disp[research_name_i .. "_name"].caption = res_disp[i]["name"] disp[research_name_i .. "_target"].caption = res_disp[i]["target"] disp[research_name_i .. "_attempt"].caption = res_disp[i]["attempt"] From 5552e17715204e485a39314cec817e5bf4a32193 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Fri, 7 Feb 2025 22:41:12 +0900 Subject: [PATCH 208/406] . --- exp_legacy/module/modules/gui/research.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/exp_legacy/module/modules/gui/research.lua b/exp_legacy/module/modules/gui/research.lua index f7a66c53..ff69e971 100644 --- a/exp_legacy/module/modules/gui/research.lua +++ b/exp_legacy/module/modules/gui/research.lua @@ -216,7 +216,7 @@ local research_data_set = Gui.element("research_data_set") disp[research_name_i .. "_target"].caption = res_disp[i]["target"] disp[research_name_i .. "_attempt"].caption = res_disp[i]["attempt"] disp[research_name_i .. "_difference"].caption = res_disp[i]["difference"] - disp[research_name_i .. "_difference"].style.font_color = res_disp[i]["difference_color"] + disp[research_name_i .. "_difference"].style.font_color = res_disp[i]["color"] end return research_set @@ -267,7 +267,7 @@ Event.add(defines.events.on_research_finished, function(event) disp[research_name_i .. "_target"].caption = res_disp[i]["target"] disp[research_name_i .. "_attempt"].caption = res_disp[i]["attempt"] disp[research_name_i .. "_difference"].caption = res_disp[i]["difference"] - disp[research_name_i .. "_difference"].style.font_color = res_disp[i]["difference_color"] + disp[research_name_i .. "_difference"].style.font_color = res_disp[i]["color"] end end end From d2eb463d21591ad141b362a384196252f6c2038b Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Fri, 7 Feb 2025 22:44:05 +0900 Subject: [PATCH 209/406] . --- exp_legacy/module/modules/gui/research.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exp_legacy/module/modules/gui/research.lua b/exp_legacy/module/modules/gui/research.lua index ff69e971..27ebfbcb 100644 --- a/exp_legacy/module/modules/gui/research.lua +++ b/exp_legacy/module/modules/gui/research.lua @@ -280,7 +280,7 @@ Event.add(defines.events.on_research_started, function(event) for i = #rq, 1, -1 do if config.limit_res[rq[i] ] and rq[i].level > config.limit_res[rq[i] ] then - r.force.cancel_current_research() + rq[i] = nil end end end) From 05eee28bb1a5791a2e422b721b5949460e673868 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Fri, 7 Feb 2025 22:46:55 +0900 Subject: [PATCH 210/406] . --- exp_legacy/module/config/research.lua | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/exp_legacy/module/config/research.lua b/exp_legacy/module/config/research.lua index c2c705d7..c0db8a9e 100644 --- a/exp_legacy/module/config/research.lua +++ b/exp_legacy/module/config/research.lua @@ -76,17 +76,17 @@ return { ["space-science-pack"] = 300 }, ["space-age"] = { - ["logistic-science-pack"] = 2400, - ["military-science-pack"] = 2400, - ["chemical-science-pack"] = 3000, - ["utility-science-pack"] = 3600, - ["production-science-pack"] = 3600, - ["space-science-pack"] = 3600, - ["metallurgic-science-pack"] = 4200, - ["electromagnetic-science-pack"] = 4200, - ["agricultural-science-pack"] = 4200, - ["cryogenic-science-pack"] = 4200, - ["promethium-science-pack"] = 4800 + ["logistic-science-pack"] = 3600, + ["military-science-pack"] = 3600, + ["chemical-science-pack"] = 4500, + ["utility-science-pack"] = 5400, + ["production-science-pack"] = 5400, + ["space-science-pack"] = 5400, + ["metallurgic-science-pack"] = 6300, + ["electromagnetic-science-pack"] = 6300, + ["agricultural-science-pack"] = 6300, + ["cryogenic-science-pack"] = 6300, + ["promethium-science-pack"] = 7200 } }, inf_res = { From 1e6d1b19de1ebef60f881cd93fd42c56e896ba08 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Fri, 7 Feb 2025 22:53:07 +0900 Subject: [PATCH 211/406] . --- exp_legacy/module/modules/gui/research.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exp_legacy/module/modules/gui/research.lua b/exp_legacy/module/modules/gui/research.lua index 27ebfbcb..0d7a2c37 100644 --- a/exp_legacy/module/modules/gui/research.lua +++ b/exp_legacy/module/modules/gui/research.lua @@ -64,7 +64,7 @@ local function research_add_log() local result_data = {} for i = 1, #research.time do - result_data[res.disp[i].raw_name] = research.time[i] + result_data[res["disp"][i]["raw_name"]] = research.time[i] end write_file(config.file_name, table_to_json(result_data) .. "\n", true, 0) From c8216806ea9220ca859510272a12478ba5a9b472 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Fri, 7 Feb 2025 23:01:41 +0900 Subject: [PATCH 212/406] . --- exp_legacy/module/modules/gui/bonus.lua | 1 - 1 file changed, 1 deletion(-) diff --git a/exp_legacy/module/modules/gui/bonus.lua b/exp_legacy/module/modules/gui/bonus.lua index ac204757..62287400 100644 --- a/exp_legacy/module/modules/gui/bonus.lua +++ b/exp_legacy/module/modules/gui/bonus.lua @@ -11,7 +11,6 @@ local vlayer = require("modules.exp_legacy.modules.control.vlayer") local format_number = require("util").format_number --- @dep util local bonus_container -local bonus_gui_control_pts_a_count --- @param player LuaPlayer --- @param container LuaGuiElement? From fbd52f9943fb8392d73605276f650c03943cc2db Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Fri, 7 Feb 2025 23:06:24 +0900 Subject: [PATCH 213/406] . --- exp_legacy/module/config/_file_loader.lua | 1 - exp_legacy/module/config/expcore/roles.lua | 1 - exp_legacy/module/modules/gui/landfill.lua | 191 --------------------- 3 files changed, 193 deletions(-) delete mode 100644 exp_legacy/module/modules/gui/landfill.lua diff --git a/exp_legacy/module/config/_file_loader.lua b/exp_legacy/module/config/_file_loader.lua index 70ecea6f..c04554f8 100644 --- a/exp_legacy/module/config/_file_loader.lua +++ b/exp_legacy/module/config/_file_loader.lua @@ -56,7 +56,6 @@ return { "modules.gui.vlayer", "modules.gui.research", "modules.gui.module", - "modules.gui.landfill", "modules.gui.tool", "modules.gui.production", "modules.gui.playerdata", diff --git a/exp_legacy/module/config/expcore/roles.lua b/exp_legacy/module/config/expcore/roles.lua index 58aad366..0f951bb7 100644 --- a/exp_legacy/module/config/expcore/roles.lua +++ b/exp_legacy/module/config/expcore/roles.lua @@ -284,7 +284,6 @@ local default = Roles.new_role("Guest", "") "gui/research", "gui/autofill", "gui/module", - "gui/landfill", "gui/production", } diff --git a/exp_legacy/module/modules/gui/landfill.lua b/exp_legacy/module/modules/gui/landfill.lua deleted file mode 100644 index bbc6061d..00000000 --- a/exp_legacy/module/modules/gui/landfill.lua +++ /dev/null @@ -1,191 +0,0 @@ ---[[-- Gui Module - Landfill - - Landfill blueprint - @gui Landfill - @alias landfill_container -]] - -local Gui = require("modules/exp_gui") -local Event = require("modules/exp_legacy/utils/event") --- @dep utils.event -local Roles = require("modules.exp_legacy.expcore.roles") --- @dep expcore.roles - -local rolling_stocks = {} - -local function landfill_init() - for name, _ in pairs(prototypes.get_entity_filtered{ { filter = "rolling-stock" } }) do - rolling_stocks[name] = true - end -end - -local function rotate_bounding_box(box) - return { - left_top = { - x = -box.right_bottom.y, - y = box.left_top.x, - }, - right_bottom = { - x = -box.left_top.y, - y = box.right_bottom.x, - }, - } -end - -local function curve_flip_lr(oc) - local nc = table.deepcopy(oc) - - for r = 1, 8 do - for c = 1, 8 do - nc[r][c] = oc[r][9 - c] - end - end - - return nc -end - -local function curve_flip_d(oc) - local nc = table.deepcopy(oc) - - for r = 1, 8 do - for c = 1, 8 do - nc[r][c] = oc[c][r] - end - end - - return nc -end - -local curves = {} - -curves[1] = { - { 0, 0, 0, 0, 0, 1, 0, 0 }, - { 0, 0, 0, 0, 1, 1, 1, 0 }, - { 0, 0, 0, 1, 1, 1, 1, 0 }, - { 0, 0, 0, 1, 1, 1, 0, 0 }, - { 0, 0, 1, 1, 1, 0, 0, 0 }, - { 0, 0, 1, 1, 1, 0, 0, 0 }, - { 0, 0, 1, 1, 0, 0, 0, 0 }, - { 0, 0, 1, 1, 0, 0, 0, 0 }, -} -curves[6] = curve_flip_d(curves[1]) -curves[3] = curve_flip_lr(curves[6]) -curves[4] = curve_flip_d(curves[3]) -curves[5] = curve_flip_lr(curves[4]) -curves[2] = curve_flip_d(curves[5]) -curves[7] = curve_flip_lr(curves[2]) -curves[8] = curve_flip_d(curves[7]) - -local curve_n = {} - -for i, map in ipairs(curves) do - curve_n[i] = {} - local index = 1 - - for r = 1, 8 do - for c = 1, 8 do - if map[r][c] == 1 then - curve_n[i][index] = { - ["x"] = c - 5, - ["y"] = r - 5, - } - - index = index + 1 - end - end - end -end - ---- @param blueprint LuaItemStack ---- @return table -local function landfill_gui_add_landfill(blueprint) - local entities = assert(blueprint.get_blueprint_entities()) - local tile_index = 0 - local new_tiles = {} - - for _, ent in pairs(entities) do - -- vehicle - if not (rolling_stocks[ent.name] or ent.name == "offshore-pump") then - -- curved rail, special - if ent.name ~= "curved-rail" then - local proto = prototypes.entity[ent.name] - local box = proto.collision_box or proto.selection_box - - if proto.collision_mask["ground-tile"] == nil then - if ent.direction then - if ent.direction ~= defines.direction.north then - box = rotate_bounding_box(box) - - if ent.direction ~= defines.direction.east then - box = rotate_bounding_box(box) - - if ent.direction ~= defines.direction.south then - box = rotate_bounding_box(box) - end - end - end - end - - for y = math.floor(ent.position.y + box.left_top.y), math.floor(ent.position.y + box.right_bottom.y), 1 do - for x = math.floor(ent.position.x + box.left_top.x), math.floor(ent.position.x + box.right_bottom.x), 1 do - tile_index = tile_index + 1 - new_tiles[tile_index] = { - name = "landfill", - position = { x, y }, - } - end - end - end - - -- curved rail - else - local curve_mask = curve_n[ent.direction or 8] - - for m = 1, #curve_mask do - new_tiles[tile_index + 1] = { - name = "landfill", - position = { curve_mask[m].x + ent.position.x, curve_mask[m].y + ent.position.y }, - } - - tile_index = tile_index + 1 - end - end - end - end - - local old_tiles = blueprint.get_blueprint_tiles() - - if old_tiles then - for _, old_tile in pairs(old_tiles) do - new_tiles[tile_index + 1] = { - name = "landfill", - position = { old_tile.position.x, old_tile.position.y }, - } - - tile_index = tile_index + 1 - end - end - - return { tiles = new_tiles } -end - ---- Add the toolbar button -Gui.toolbar.create_button{ - name = "landfill", - sprite = "item/landfill", - tooltip = { "landfill.main-tooltip" }, - visible = function(player, element) - return Roles.player_allowed(player, "gui/landfill") - end -}:on_click(function(def, player, element) - if player.cursor_stack and player.cursor_stack.valid_for_read then - if player.cursor_stack.type == "blueprint" and player.cursor_stack.is_blueprint_setup() then - local modified = landfill_gui_add_landfill(player.cursor_stack) - - if modified and next(modified.tiles) then - player.cursor_stack.set_blueprint_tiles(modified.tiles) - end - end - else - player.print{ "landfill.cursor-none" } - end -end) - -Event.add(defines.events.on_player_joined_game, landfill_init) From c6d32f07b57a7c7f71d20ba78f27ff0983fabae5 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Fri, 7 Feb 2025 23:10:52 +0900 Subject: [PATCH 214/406] . --- exp_legacy/module/modules/addons/inventory-clear.lua | 2 +- exp_legacy/module/modules/addons/nukeprotect.lua | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/exp_legacy/module/modules/addons/inventory-clear.lua b/exp_legacy/module/modules/addons/inventory-clear.lua index 60c11e90..dfe48646 100644 --- a/exp_legacy/module/modules/addons/inventory-clear.lua +++ b/exp_legacy/module/modules/addons/inventory-clear.lua @@ -11,7 +11,7 @@ local function clear_items(event) ExpUtil.transfer_inventory_to_surface{ inventory = inventory, surface = game.surfaces[1], - name = "iron-chest", + name = "steel-chest", allow_creation = true, } end diff --git a/exp_legacy/module/modules/addons/nukeprotect.lua b/exp_legacy/module/modules/addons/nukeprotect.lua index 59238290..5f7bad4a 100644 --- a/exp_legacy/module/modules/addons/nukeprotect.lua +++ b/exp_legacy/module/modules/addons/nukeprotect.lua @@ -29,7 +29,7 @@ local function check_items(player, type) items = items, surface = game.planets.nauvis.surface, allow_creation = true, - name = "iron-chest", + name = "steel-chest", } end From 6318425f8047bfac886243c1d58952c12ed3f5f9 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Sat, 8 Feb 2025 00:01:08 +0900 Subject: [PATCH 215/406] . --- exp_legacy/module/modules/gui/bonus.lua | 87 ++++++------------------- 1 file changed, 20 insertions(+), 67 deletions(-) diff --git a/exp_legacy/module/modules/gui/bonus.lua b/exp_legacy/module/modules/gui/bonus.lua index 62287400..fffc6e94 100644 --- a/exp_legacy/module/modules/gui/bonus.lua +++ b/exp_legacy/module/modules/gui/bonus.lua @@ -11,6 +11,10 @@ local vlayer = require("modules.exp_legacy.modules.control.vlayer") local format_number = require("util").format_number --- @dep util local bonus_container +local bonus_score = { + ["current"] = 0, + ["limit"] = config.pts.base, +} --- @param player LuaPlayer --- @param container LuaGuiElement? @@ -71,7 +75,7 @@ end local function max_bonus_pts_update(player) local frame = Gui.get_left_element(player, bonus_container) local disp = frame.container["bonus_st_2"].disp.table - disp[bonus_gui_control_pts_a_count.name].caption = math.floor(config.pts.base * (1 + config.pts.increase_percentage_per_role_level * (Roles.get_player_highest_role(player).index - Roles.get_role_by_name(config.pts.role_name).index))) + disp[bonus_gui_control_pts_count.name].caption = math.floor(config.pts.base * (1 + config.pts.increase_percentage_per_role_level * (Roles.get_player_highest_role(player).index - Roles.get_role_by_name(config.pts.role_name).index))) end ]] @@ -111,8 +115,8 @@ local function apply_periodic_bonus(player) end --- Control label for the bonus points available --- @element bonus_gui_control_pts_a -local bonus_gui_control_pts_a = Gui.element("bonus_gui_control_pts_a") +-- @element bonus_gui_control_pts +local bonus_gui_control_pts = Gui.element("bonus_gui_control_pts") :draw{ type = "label", name = Gui.property_from_name, @@ -122,58 +126,16 @@ local bonus_gui_control_pts_a = Gui.element("bonus_gui_control_pts_a") width = config.gui_display_width["half"], } -local bonus_gui_control_pts_a_count = Gui.element("bonus_gui_control_pts_a_count") +local bonus_gui_control_pts_count = Gui.element("vlayer_gui_display_item_solar_count") :draw{ - type = "label", + type = "progressbar", name = Gui.property_from_name, - caption = config.pts.base, - style = "heading_2_label", - }:style{ - width = config.gui_display_width["half"], - } - ---- Control label for the bonus points needed --- @element bonus_gui_control_pts_n -local bonus_gui_control_pts_n = Gui.element("bonus_gui_control_pts_n") - :draw{ - type = "label", - name = Gui.property_from_name, - caption = { "bonus.control-pts-n" }, - style = "heading_2_label", - }:style{ - width = config.gui_display_width["half"], - } - -local bonus_gui_control_pts_n_count = Gui.element("bonus_gui_control_pts_n_count") - :draw{ - type = "label", - name = Gui.property_from_name, - caption = "0", - style = "heading_2_label", - }:style{ - width = config.gui_display_width["half"], - } - ---- Control label for the bonus points remaining --- @element bonus_gui_control_pts_r -local bonus_gui_control_pts_r = Gui.element("bonus_gui_control_pts_r") - :draw{ - type = "label", - name = Gui.property_from_name, - caption = { "bonus.control-pts-r" }, - style = "heading_2_label", - }:style{ - width = config.gui_display_width["half"], - } - -local bonus_gui_control_pts_r_count = Gui.element("bonus_gui_control_pts_r_count") - :draw{ - type = "label", - name = Gui.property_from_name, - caption = "0", - style = "heading_2_label", + caption = bonus_score["current"] .. " / " .. bonus_score["limit"], + value = 0, + style = "electric_satisfaction_statistics_progressbar", }:style{ width = config.gui_display_width["half"], + font = "heading-2", } --- A button used for pts calculations @@ -205,8 +167,7 @@ local bonus_gui_control_reset = Gui.element("bonus_gui_control_reset") disp[slider.tags.counter].caption = format_number(slider.slider_value, false) local r = bonus_gui_pts_needed(player) - element.parent[bonus_gui_control_pts_n_count.name].caption = r - element.parent[bonus_gui_control_pts_r_count.name].caption = tonumber(element.parent[bonus_gui_control_pts_a_count.name].caption) - r + disp[bonus_gui_control_pts_count.name].caption = 0 .. " / " .. bonus_score["limit"] end) --- A button used for pts apply @@ -221,7 +182,7 @@ local bonus_gui_control_apply = Gui.element("bonus_gui_control_apply") }:on_click(function(def, player, element) local n = bonus_gui_pts_needed(player) element.parent[bonus_gui_control_pts_n_count.name].caption = n - local r = tonumber(element.parent[bonus_gui_control_pts_a_count.name].caption) - n + local r = tonumber(element.parent[bonus_gui_control_pts_count.name].caption) - n element.parent[bonus_gui_control_pts_r_count.name].caption = r if r >= 0 then @@ -236,15 +197,8 @@ local bonus_control_set = Gui.element("bonus_control_set") local bonus_set = parent.add{ type = "flow", direction = "vertical", name = name } local disp = Gui.elements.scroll_table(bonus_set, config.gui_display_width["half"] * 2, 2, "disp") - bonus_gui_control_pts_a(disp) - bonus_gui_control_pts_a_count(disp) - - bonus_gui_control_pts_n(disp) - bonus_gui_control_pts_n_count(disp) - - bonus_gui_control_pts_r(disp) - bonus_gui_control_pts_r_count(disp) - + bonus_gui_control_pts(disp) + bonus_gui_control_pts_count(disp) bonus_gui_control_reset(disp) bonus_gui_control_apply(disp) @@ -307,8 +261,7 @@ local bonus_gui_slider = Gui.element("bonus_gui_slider") local r = bonus_gui_pts_needed(player) local container = Gui.get_left_element(bonus_container, player) local disp = container.frame["bonus_st_1"].disp.table - disp[bonus_gui_control_pts_n_count.name].caption = r - disp[bonus_gui_control_pts_r_count.name].caption = tonumber(disp[bonus_gui_control_pts_a_count.name].caption) - r + disp[bonus_gui_control_pts_count.name].caption = 0 .. " / " .. config.pts.base end) --- A vertical flow containing all the bonus data @@ -341,7 +294,7 @@ bonus_container = Gui.element("bonus_container") local disp = container["bonus_st_1"].disp.table local n = bonus_gui_pts_needed(player, container.parent) disp[bonus_gui_control_pts_n_count.name].caption = n - local r = tonumber(disp[bonus_gui_control_pts_a_count.name].caption) - n + local r = tonumber(disp[bonus_gui_control_pts_count.name].caption) - n disp[bonus_gui_control_pts_r_count.name].caption = r return container.parent @@ -388,7 +341,7 @@ Event.add(defines.events.on_player_respawned, function(event) local disp = container.frame["bonus_st_1"].disp.table local n = bonus_gui_pts_needed(player) disp[bonus_gui_control_pts_n_count.name].caption = n - local r = tonumber(disp[bonus_gui_control_pts_a_count.name].caption) - n + local r = tonumber(disp[bonus_gui_control_pts_count.name].caption) - n disp[bonus_gui_control_pts_r_count.name].caption = r if r >= 0 then From a763d30e2b7175b53f82ab7f0fb352e5c667c2c0 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Sat, 8 Feb 2025 00:02:01 +0900 Subject: [PATCH 216/406] . --- exp_legacy/module/modules/gui/bonus.lua | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/exp_legacy/module/modules/gui/bonus.lua b/exp_legacy/module/modules/gui/bonus.lua index fffc6e94..4b5d1340 100644 --- a/exp_legacy/module/modules/gui/bonus.lua +++ b/exp_legacy/module/modules/gui/bonus.lua @@ -165,9 +165,7 @@ local bonus_gui_control_reset = Gui.element("bonus_gui_control_reset") local slider = disp["bonus_display_personal_battery_recharge_slider"] slider.slider_value = config.player_special_bonus["personal_battery_recharge"].value disp[slider.tags.counter].caption = format_number(slider.slider_value, false) - - local r = bonus_gui_pts_needed(player) - disp[bonus_gui_control_pts_count.name].caption = 0 .. " / " .. bonus_score["limit"] + disp[bonus_gui_control_pts_count.name].caption = bonus_gui_pts_needed(player) .. " / " .. bonus_score["limit"] end) --- A button used for pts apply From 0a9d4f4c8c5fbb7f6ecd9ac883075f235d838f73 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Sat, 8 Feb 2025 00:11:35 +0900 Subject: [PATCH 217/406] . --- exp_legacy/module/config/expcore/roles.lua | 5 ++ exp_legacy/module/modules/gui/bonus.lua | 70 ++++++---------------- 2 files changed, 24 insertions(+), 51 deletions(-) diff --git a/exp_legacy/module/config/expcore/roles.lua b/exp_legacy/module/config/expcore/roles.lua index 0f951bb7..f2053b3a 100644 --- a/exp_legacy/module/config/expcore/roles.lua +++ b/exp_legacy/module/config/expcore/roles.lua @@ -91,6 +91,7 @@ Roles.new_role("Trainee Moderator", "Trainee") :set_flag("is_admin") :set_flag("is_spectator") :set_flag("report-immune") + :set_flag("instant-respawn") :set_flag("deconlog-bypass") :set_parent("Board Member") :allow{ @@ -147,6 +148,7 @@ Roles.new_role("Supporter", "Sup") :set_permission_group("Trusted") :set_custom_color{ r = 230, g = 99, b = 34 } :set_flag("is_spectator") + :set_flag("instant-respawn") :set_flag("deconlog-bypass") :set_parent("Partner") :allow{ @@ -156,6 +158,7 @@ Roles.new_role("Partner", "Part") :set_permission_group("Trusted") :set_custom_color{ r = 24, g = 172, b = 188 } :set_flag("is_spectator") + :set_flag("instant-respawn") :set_flag("deconlog-bypass") :set_parent("Senior Member") :allow{ @@ -166,6 +169,7 @@ Roles.new_role("Senior Member", "SMem") :set_custom_color{ r = 24, g = 172, b = 188 } :set_flag("is_spectator") :set_flag("deconlog-bypass") + :set_flag("instant-respawn") :set_parent("Member") :allow{ "command/set-join-message", @@ -182,6 +186,7 @@ Roles.new_role("Senior Member", "SMem") Roles.new_role("Member", "Mem") :set_permission_group("Trusted") :set_custom_color{ r = 24, g = 172, b = 188 } + :set_flag("instant-respawn") :set_flag("deconlog-bypass") :set_parent("Veteran") :allow{ diff --git a/exp_legacy/module/modules/gui/bonus.lua b/exp_legacy/module/modules/gui/bonus.lua index 4b5d1340..998b20af 100644 --- a/exp_legacy/module/modules/gui/bonus.lua +++ b/exp_legacy/module/modules/gui/bonus.lua @@ -11,10 +11,7 @@ local vlayer = require("modules.exp_legacy.modules.control.vlayer") local format_number = require("util").format_number --- @dep util local bonus_container -local bonus_score = { - ["current"] = 0, - ["limit"] = config.pts.base, -} +local bonus_score_limit = config.pts.base --- @param player LuaPlayer --- @param container LuaGuiElement? @@ -71,14 +68,6 @@ local function apply_bonus(player) end end ---[[ -local function max_bonus_pts_update(player) - local frame = Gui.get_left_element(player, bonus_container) - local disp = frame.container["bonus_st_2"].disp.table - disp[bonus_gui_control_pts_count.name].caption = math.floor(config.pts.base * (1 + config.pts.increase_percentage_per_role_level * (Roles.get_player_highest_role(player).index - Roles.get_role_by_name(config.pts.role_name).index))) -end -]] - local function apply_periodic_bonus(player) if not Roles.player_allowed(player, "gui/bonus") then return @@ -130,7 +119,7 @@ local bonus_gui_control_pts_count = Gui.element("vlayer_gui_display_item_solar_c :draw{ type = "progressbar", name = Gui.property_from_name, - caption = bonus_score["current"] .. " / " .. bonus_score["limit"], + caption = "0 / " .. bonus_score_limit, value = 0, style = "electric_satisfaction_statistics_progressbar", }:style{ @@ -154,18 +143,13 @@ local bonus_gui_control_reset = Gui.element("bonus_gui_control_reset") for k, v in pairs(config.conversion) do local s = "bonus_display_" .. k .. "_slider" disp[s].slider_value = config.player_bonus[v].value - - if config.player_bonus[v].is_percentage then - disp[disp[s].tags.counter].caption = format_number(disp[s].slider_value * 100, false) .. " %" - else - disp[disp[s].tags.counter].caption = format_number(disp[s].slider_value, false) - end + disp[disp[s].tags.counter].caption = (config.player_bonus[v].is_percentage and format_number(disp[s].slider_value * 100, false) .. " %") or format_number(disp[s].slider_value, false) end local slider = disp["bonus_display_personal_battery_recharge_slider"] slider.slider_value = config.player_special_bonus["personal_battery_recharge"].value disp[slider.tags.counter].caption = format_number(slider.slider_value, false) - disp[bonus_gui_control_pts_count.name].caption = bonus_gui_pts_needed(player) .. " / " .. bonus_score["limit"] + disp[bonus_gui_control_pts_count.name].caption = bonus_gui_pts_needed(player) .. " / " .. bonus_score_limit end) --- A button used for pts apply @@ -179,11 +163,9 @@ local bonus_gui_control_apply = Gui.element("bonus_gui_control_apply") width = config.gui_display_width["half"], }:on_click(function(def, player, element) local n = bonus_gui_pts_needed(player) - element.parent[bonus_gui_control_pts_n_count.name].caption = n - local r = tonumber(element.parent[bonus_gui_control_pts_count.name].caption) - n - element.parent[bonus_gui_control_pts_r_count.name].caption = r + element.parent[bonus_gui_control_pts_count.name].caption = n .. " / " .. bonus_score_limit - if r >= 0 then + if n <= bonus_score_limit then apply_bonus(player) end end) @@ -215,14 +197,6 @@ local bonus_gui_slider = Gui.element("bonus_gui_slider") } label.style.width = config.gui_display_width["label"] - local value = bonus.value - - if bonus.is_percentage then - value = format_number(value * 100, false) .. " %" - else - value = format_number(value, false) - end - local slider = parent.add{ type = "slider", name = name .. "_slider", @@ -242,7 +216,7 @@ local bonus_gui_slider = Gui.element("bonus_gui_slider") local count = parent.add{ type = "label", name = name .. "_count", - caption = value, + caption = (bonus.is_percentage and format_number(bonus.value * 100, false) .. " %") or format_number(bonus.value, false), style = "heading_2_label", } count.style.width = config.gui_display_width["count"] @@ -250,16 +224,10 @@ local bonus_gui_slider = Gui.element("bonus_gui_slider") return slider end) :on_value_changed(function(def, player, element) - if element.tags.is_percentage then - element.parent[element.tags.counter].caption = format_number(element.slider_value * 100, false) .. " %" - else - element.parent[element.tags.counter].caption = format_number(element.slider_value, false) - end - - local r = bonus_gui_pts_needed(player) + element.parent[element.tags.counter].caption = (element.tags.is_percentage and format_number(element.slider_value * 100, false) .. " %") or format_number(element.slider_value, false) local container = Gui.get_left_element(bonus_container, player) local disp = container.frame["bonus_st_1"].disp.table - disp[bonus_gui_control_pts_count.name].caption = 0 .. " / " .. config.pts.base + disp[bonus_gui_control_pts_count.name].caption = bonus_gui_pts_needed(player) .. " / " .. bonus_score_limit end) --- A vertical flow containing all the bonus data @@ -290,10 +258,8 @@ bonus_container = Gui.element("bonus_container") bonus_data_set(container, "bonus_st_2") local disp = container["bonus_st_1"].disp.table - local n = bonus_gui_pts_needed(player, container.parent) - disp[bonus_gui_control_pts_n_count.name].caption = n - local r = tonumber(disp[bonus_gui_control_pts_count.name].caption) - n - disp[bonus_gui_control_pts_r_count.name].caption = r + bonus_score_limit = math.floor(config.pts.base * (1 + config.pts.increase_percentage_per_role_level * (Roles.get_player_highest_role(player).index - Roles.get_role_by_name(config.pts.role_name).index))) + disp[bonus_gui_control_pts_count.name].caption = bonus_gui_pts_needed(player) .. " / " .. bonus_score_limit return container.parent end) @@ -325,11 +291,15 @@ Event.add(defines.events.on_player_created, function(event) end) Event.add(Roles.events.on_role_assigned, function(event) - apply_bonus(game.players[event.player_index]) + local player = game.players[event.player_index] + bonus_score_limit = math.floor(config.pts.base * (1 + config.pts.increase_percentage_per_role_level * (Roles.get_player_highest_role(player).index - Roles.get_role_by_name(config.pts.role_name).index))) + apply_bonus(player) end) Event.add(Roles.events.on_role_unassigned, function(event) - apply_bonus(game.players[event.player_index]) + local player = game.players[event.player_index] + bonus_score_limit = math.floor(config.pts.base * (1 + config.pts.increase_percentage_per_role_level * (Roles.get_player_highest_role(player).index - Roles.get_role_by_name(config.pts.role_name).index))) + apply_bonus(player) end) --- When a player respawns re-apply bonus @@ -338,11 +308,9 @@ Event.add(defines.events.on_player_respawned, function(event) local container = Gui.get_left_element(bonus_container, player) local disp = container.frame["bonus_st_1"].disp.table local n = bonus_gui_pts_needed(player) - disp[bonus_gui_control_pts_n_count.name].caption = n - local r = tonumber(disp[bonus_gui_control_pts_count.name].caption) - n - disp[bonus_gui_control_pts_r_count.name].caption = r + disp[bonus_gui_control_pts_count.name].caption = n .. " / " .. bonus_score_limit - if r >= 0 then + if n <= bonus_score_limit then apply_bonus(player) end end) From 52a94b7bd378831b4f48db43fdc64be4177cd4c8 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Sat, 8 Feb 2025 00:13:27 +0900 Subject: [PATCH 218/406] . --- exp_legacy/module/modules/gui/bonus.lua | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/exp_legacy/module/modules/gui/bonus.lua b/exp_legacy/module/modules/gui/bonus.lua index 998b20af..2a189145 100644 --- a/exp_legacy/module/modules/gui/bonus.lua +++ b/exp_legacy/module/modules/gui/bonus.lua @@ -241,8 +241,7 @@ local bonus_data_set = Gui.element("bonus_data_set") bonus_gui_slider(disp, "bonus_display_" .. k, { "bonus.display-" .. k }, { "bonus.display-" .. k .. "-tooltip" }, config.player_bonus[v]) end - bonus_gui_slider(disp, "bonus_display_personal_battery_recharge", { "bonus.display-personal-battery-recharge" }, { "bonus.display-personal-battery-recharge-tooltip" }, - config.player_special_bonus["personal_battery_recharge"]) + bonus_gui_slider(disp, "bonus_display_personal_battery_recharge", { "bonus.display-personal-battery-recharge" }, { "bonus.display-personal-battery-recharge-tooltip" }, config.player_special_bonus["personal_battery_recharge"]) return bonus_set end) From c74121bdd4335a8fa10ce54b0b9c39349bb18ff0 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Sat, 8 Feb 2025 00:17:48 +0900 Subject: [PATCH 219/406] . --- exp_legacy/module/modules/gui/bonus.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/exp_legacy/module/modules/gui/bonus.lua b/exp_legacy/module/modules/gui/bonus.lua index 2a189145..7d217a17 100644 --- a/exp_legacy/module/modules/gui/bonus.lua +++ b/exp_legacy/module/modules/gui/bonus.lua @@ -16,8 +16,8 @@ local bonus_score_limit = config.pts.base --- @param player LuaPlayer --- @param container LuaGuiElement? --- @return number -local function bonus_gui_pts_needed(player, container) - container = container or Gui.get_left_element(bonus_container, player) +local function bonus_gui_pts_needed(player) + container = Gui.get_left_element(bonus_container, player) local disp = container.frame["bonus_st_2"].disp.table local total = 0 From d5803bed8d57628196638693585ec8e9cad2e4a1 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Sat, 8 Feb 2025 00:18:04 +0900 Subject: [PATCH 220/406] . --- exp_legacy/module/modules/gui/bonus.lua | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/exp_legacy/module/modules/gui/bonus.lua b/exp_legacy/module/modules/gui/bonus.lua index 7d217a17..9e207d05 100644 --- a/exp_legacy/module/modules/gui/bonus.lua +++ b/exp_legacy/module/modules/gui/bonus.lua @@ -14,10 +14,9 @@ local bonus_container local bonus_score_limit = config.pts.base --- @param player LuaPlayer ---- @param container LuaGuiElement? --- @return number local function bonus_gui_pts_needed(player) - container = Gui.get_left_element(bonus_container, player) + local container = Gui.get_left_element(bonus_container, player) local disp = container.frame["bonus_st_2"].disp.table local total = 0 From 1df8fd0359090c702397b707d2adf6e076c13bdf Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Sat, 8 Feb 2025 00:23:00 +0900 Subject: [PATCH 221/406] . --- exp_legacy/module/modules/gui/bonus.lua | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/exp_legacy/module/modules/gui/bonus.lua b/exp_legacy/module/modules/gui/bonus.lua index 9e207d05..3209caed 100644 --- a/exp_legacy/module/modules/gui/bonus.lua +++ b/exp_legacy/module/modules/gui/bonus.lua @@ -14,9 +14,10 @@ local bonus_container local bonus_score_limit = config.pts.base --- @param player LuaPlayer +--- @param container LuaGuiElement? --- @return number -local function bonus_gui_pts_needed(player) - local container = Gui.get_left_element(bonus_container, player) +local function bonus_gui_pts_needed(player, container) + container = container or Gui.get_left_element(bonus_container, player) local disp = container.frame["bonus_st_2"].disp.table local total = 0 @@ -257,7 +258,7 @@ bonus_container = Gui.element("bonus_container") local disp = container["bonus_st_1"].disp.table bonus_score_limit = math.floor(config.pts.base * (1 + config.pts.increase_percentage_per_role_level * (Roles.get_player_highest_role(player).index - Roles.get_role_by_name(config.pts.role_name).index))) - disp[bonus_gui_control_pts_count.name].caption = bonus_gui_pts_needed(player) .. " / " .. bonus_score_limit + disp[bonus_gui_control_pts_count.name].caption = bonus_gui_pts_needed(player, container.parent) .. " / " .. bonus_score_limit return container.parent end) From c3da0363f34e11df65c3bc9061082f2ddad827d5 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Sat, 8 Feb 2025 00:28:26 +0900 Subject: [PATCH 222/406] . --- exp_legacy/module/modules/gui/bonus.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/exp_legacy/module/modules/gui/bonus.lua b/exp_legacy/module/modules/gui/bonus.lua index 3209caed..ab46ff76 100644 --- a/exp_legacy/module/modules/gui/bonus.lua +++ b/exp_legacy/module/modules/gui/bonus.lua @@ -115,7 +115,7 @@ local bonus_gui_control_pts = Gui.element("bonus_gui_control_pts") width = config.gui_display_width["half"], } -local bonus_gui_control_pts_count = Gui.element("vlayer_gui_display_item_solar_count") +local bonus_gui_control_pts_count = Gui.element("bonus_gui_control_pts_count") :draw{ type = "progressbar", name = Gui.property_from_name, @@ -143,7 +143,7 @@ local bonus_gui_control_reset = Gui.element("bonus_gui_control_reset") for k, v in pairs(config.conversion) do local s = "bonus_display_" .. k .. "_slider" disp[s].slider_value = config.player_bonus[v].value - disp[disp[s].tags.counter].caption = (config.player_bonus[v].is_percentage and format_number(disp[s].slider_value * 100, false) .. " %") or format_number(disp[s].slider_value, false) + disp[disp[s].tags.counter].caption = (config.player_bonus[v].is_percentage and (format_number(disp[s].slider_value * 100, false) .. " %")) or format_number(disp[s].slider_value, false) end local slider = disp["bonus_display_personal_battery_recharge_slider"] From 374c727a4a7ef0e3aaa266a0ea0521f7a4fd04c8 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Sat, 8 Feb 2025 00:33:05 +0900 Subject: [PATCH 223/406] . --- exp_legacy/module/modules/gui/bonus.lua | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/exp_legacy/module/modules/gui/bonus.lua b/exp_legacy/module/modules/gui/bonus.lua index ab46ff76..9d3834fa 100644 --- a/exp_legacy/module/modules/gui/bonus.lua +++ b/exp_legacy/module/modules/gui/bonus.lua @@ -149,7 +149,8 @@ local bonus_gui_control_reset = Gui.element("bonus_gui_control_reset") local slider = disp["bonus_display_personal_battery_recharge_slider"] slider.slider_value = config.player_special_bonus["personal_battery_recharge"].value disp[slider.tags.counter].caption = format_number(slider.slider_value, false) - disp[bonus_gui_control_pts_count.name].caption = bonus_gui_pts_needed(player) .. " / " .. bonus_score_limit + + element.parent[bonus_gui_control_pts_count.name].caption = bonus_gui_pts_needed(player) .. " / " .. bonus_score_limit end) --- A button used for pts apply @@ -245,9 +246,9 @@ local bonus_data_set = Gui.element("bonus_data_set") return bonus_set end) - --- The main container for the bonus gui -- @element bonus_container + bonus_container = Gui.element("bonus_container") :draw(function(def, parent) local player = Gui.get_player(parent) @@ -257,7 +258,7 @@ bonus_container = Gui.element("bonus_container") bonus_data_set(container, "bonus_st_2") local disp = container["bonus_st_1"].disp.table - bonus_score_limit = math.floor(config.pts.base * (1 + config.pts.increase_percentage_per_role_level * (Roles.get_player_highest_role(player).index - Roles.get_role_by_name(config.pts.role_name).index))) + bonus_score_limit = math.floor(config.pts.base * (1 + config.pts.increase_percentage_per_role_level * (Roles.get_role_by_name(config.pts.role_name).index - Roles.get_player_highest_role(player).index))) disp[bonus_gui_control_pts_count.name].caption = bonus_gui_pts_needed(player, container.parent) .. " / " .. bonus_score_limit return container.parent From d3b8c3252c3575581537b2c98bf1939885e0540d Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Sat, 8 Feb 2025 00:36:57 +0900 Subject: [PATCH 224/406] . --- exp_legacy/module/config/bonus.lua | 2 +- exp_legacy/module/modules/gui/bonus.lua | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/exp_legacy/module/config/bonus.lua b/exp_legacy/module/config/bonus.lua index db97d270..2b1dfc26 100644 --- a/exp_legacy/module/config/bonus.lua +++ b/exp_legacy/module/config/bonus.lua @@ -18,7 +18,7 @@ return { ]] pts = { base = 260, - increase_percentage_per_role_level = 0.05, + increase_percentage_per_role_level = 0.03, role_name = "Member" }, gui_display_width = { diff --git a/exp_legacy/module/modules/gui/bonus.lua b/exp_legacy/module/modules/gui/bonus.lua index 9d3834fa..537b53fc 100644 --- a/exp_legacy/module/modules/gui/bonus.lua +++ b/exp_legacy/module/modules/gui/bonus.lua @@ -292,13 +292,13 @@ end) Event.add(Roles.events.on_role_assigned, function(event) local player = game.players[event.player_index] - bonus_score_limit = math.floor(config.pts.base * (1 + config.pts.increase_percentage_per_role_level * (Roles.get_player_highest_role(player).index - Roles.get_role_by_name(config.pts.role_name).index))) + bonus_score_limit = math.floor(config.pts.base * (1 + config.pts.increase_percentage_per_role_level * (Roles.get_role_by_name(config.pts.role_name).index - Roles.get_player_highest_role(player).index))) apply_bonus(player) end) Event.add(Roles.events.on_role_unassigned, function(event) local player = game.players[event.player_index] - bonus_score_limit = math.floor(config.pts.base * (1 + config.pts.increase_percentage_per_role_level * (Roles.get_player_highest_role(player).index - Roles.get_role_by_name(config.pts.role_name).index))) + bonus_score_limit = math.floor(config.pts.base * (1 + config.pts.increase_percentage_per_role_level * (Roles.get_role_by_name(config.pts.role_name).index - Roles.get_player_highest_role(player).index))) apply_bonus(player) end) From 66cbb71c673ffc8799d7e2e9187f8f4ea0891156 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Sat, 8 Feb 2025 00:43:02 +0900 Subject: [PATCH 225/406] . --- exp_legacy/module/modules/gui/bonus.lua | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/exp_legacy/module/modules/gui/bonus.lua b/exp_legacy/module/modules/gui/bonus.lua index 537b53fc..86ca59b3 100644 --- a/exp_legacy/module/modules/gui/bonus.lua +++ b/exp_legacy/module/modules/gui/bonus.lua @@ -246,9 +246,13 @@ local bonus_data_set = Gui.element("bonus_data_set") return bonus_set end) + +local function bonus_score_limit_calc(player) + return math.floor(config.pts.base * (1 + config.pts.increase_percentage_per_role_level * (Roles.get_role_by_name(config.pts.role_name).index - Roles.get_player_highest_role(player).index))) +end + --- The main container for the bonus gui -- @element bonus_container - bonus_container = Gui.element("bonus_container") :draw(function(def, parent) local player = Gui.get_player(parent) @@ -258,7 +262,7 @@ bonus_container = Gui.element("bonus_container") bonus_data_set(container, "bonus_st_2") local disp = container["bonus_st_1"].disp.table - bonus_score_limit = math.floor(config.pts.base * (1 + config.pts.increase_percentage_per_role_level * (Roles.get_role_by_name(config.pts.role_name).index - Roles.get_player_highest_role(player).index))) + bonus_score_limit = bonus_score_limit_calc(player) disp[bonus_gui_control_pts_count.name].caption = bonus_gui_pts_needed(player, container.parent) .. " / " .. bonus_score_limit return container.parent @@ -292,13 +296,13 @@ end) Event.add(Roles.events.on_role_assigned, function(event) local player = game.players[event.player_index] - bonus_score_limit = math.floor(config.pts.base * (1 + config.pts.increase_percentage_per_role_level * (Roles.get_role_by_name(config.pts.role_name).index - Roles.get_player_highest_role(player).index))) + bonus_score_limit = bonus_score_limit_calc(player) apply_bonus(player) end) Event.add(Roles.events.on_role_unassigned, function(event) local player = game.players[event.player_index] - bonus_score_limit = math.floor(config.pts.base * (1 + config.pts.increase_percentage_per_role_level * (Roles.get_role_by_name(config.pts.role_name).index - Roles.get_player_highest_role(player).index))) + bonus_score_limit = bonus_score_limit_calc(player) apply_bonus(player) end) @@ -309,6 +313,7 @@ Event.add(defines.events.on_player_respawned, function(event) local disp = container.frame["bonus_st_1"].disp.table local n = bonus_gui_pts_needed(player) disp[bonus_gui_control_pts_count.name].caption = n .. " / " .. bonus_score_limit + disp[bonus_gui_control_pts_count.name].v if n <= bonus_score_limit then apply_bonus(player) @@ -318,7 +323,6 @@ end) --- When a player dies allow them to have instant respawn Event.add(defines.events.on_player_died, function(event) local player = game.players[event.player_index] - if Roles.player_has_flag(player, "instant-respawn") then player.ticks_to_respawn = 120 end From abfa6b6abadb1446c30488cc6714464d010035b2 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Sat, 8 Feb 2025 00:43:55 +0900 Subject: [PATCH 226/406] . --- exp_legacy/module/modules/gui/bonus.lua | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/exp_legacy/module/modules/gui/bonus.lua b/exp_legacy/module/modules/gui/bonus.lua index 86ca59b3..67e88c7d 100644 --- a/exp_legacy/module/modules/gui/bonus.lua +++ b/exp_legacy/module/modules/gui/bonus.lua @@ -150,7 +150,9 @@ local bonus_gui_control_reset = Gui.element("bonus_gui_control_reset") slider.slider_value = config.player_special_bonus["personal_battery_recharge"].value disp[slider.tags.counter].caption = format_number(slider.slider_value, false) - element.parent[bonus_gui_control_pts_count.name].caption = bonus_gui_pts_needed(player) .. " / " .. bonus_score_limit + local n = bonus_gui_pts_needed(player) + element.parent[bonus_gui_control_pts_count.name].caption = n .. " / " .. bonus_score_limit + element.parent[bonus_gui_control_pts_count.name].value = n / bonus_score_limit end) --- A button used for pts apply @@ -165,6 +167,7 @@ local bonus_gui_control_apply = Gui.element("bonus_gui_control_apply") }:on_click(function(def, player, element) local n = bonus_gui_pts_needed(player) element.parent[bonus_gui_control_pts_count.name].caption = n .. " / " .. bonus_score_limit + element.parent[bonus_gui_control_pts_count.name].value = n / bonus_score_limit if n <= bonus_score_limit then apply_bonus(player) @@ -228,7 +231,9 @@ local bonus_gui_slider = Gui.element("bonus_gui_slider") element.parent[element.tags.counter].caption = (element.tags.is_percentage and format_number(element.slider_value * 100, false) .. " %") or format_number(element.slider_value, false) local container = Gui.get_left_element(bonus_container, player) local disp = container.frame["bonus_st_1"].disp.table - disp[bonus_gui_control_pts_count.name].caption = bonus_gui_pts_needed(player) .. " / " .. bonus_score_limit + local n = bonus_gui_pts_needed(player) + disp[bonus_gui_control_pts_count.name].caption = n .. " / " .. bonus_score_limit + disp[bonus_gui_control_pts_count.name].value = n / bonus_score_limit end) --- A vertical flow containing all the bonus data @@ -262,8 +267,10 @@ bonus_container = Gui.element("bonus_container") bonus_data_set(container, "bonus_st_2") local disp = container["bonus_st_1"].disp.table + local n = bonus_gui_pts_needed(player, container.parent) bonus_score_limit = bonus_score_limit_calc(player) - disp[bonus_gui_control_pts_count.name].caption = bonus_gui_pts_needed(player, container.parent) .. " / " .. bonus_score_limit + disp[bonus_gui_control_pts_count.name].caption = n .. " / " .. bonus_score_limit + disp[bonus_gui_control_pts_count.name].value = n / bonus_score_limit return container.parent end) @@ -313,7 +320,7 @@ Event.add(defines.events.on_player_respawned, function(event) local disp = container.frame["bonus_st_1"].disp.table local n = bonus_gui_pts_needed(player) disp[bonus_gui_control_pts_count.name].caption = n .. " / " .. bonus_score_limit - disp[bonus_gui_control_pts_count.name].v + disp[bonus_gui_control_pts_count.name].value = n / bonus_score_limit if n <= bonus_score_limit then apply_bonus(player) From f261e1fbf47f91d252b3557e83cfdd73ed481684 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Sat, 8 Feb 2025 00:53:15 +0900 Subject: [PATCH 227/406] . --- exp_legacy/module/modules/gui/bonus.lua | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/exp_legacy/module/modules/gui/bonus.lua b/exp_legacy/module/modules/gui/bonus.lua index 67e88c7d..e2a7576f 100644 --- a/exp_legacy/module/modules/gui/bonus.lua +++ b/exp_legacy/module/modules/gui/bonus.lua @@ -103,6 +103,10 @@ local function apply_periodic_bonus(player) end end +local function bonus_score_limit_calc(player) + return math.floor(config.pts.base * (1 + config.pts.increase_percentage_per_role_level * (Roles.get_player_highest_role(player).index - Roles.get_role_by_name(config.pts.role_name).index))) +end + --- Control label for the bonus points available -- @element bonus_gui_control_pts local bonus_gui_control_pts = Gui.element("bonus_gui_control_pts") @@ -252,10 +256,6 @@ local bonus_data_set = Gui.element("bonus_data_set") return bonus_set end) -local function bonus_score_limit_calc(player) - return math.floor(config.pts.base * (1 + config.pts.increase_percentage_per_role_level * (Roles.get_role_by_name(config.pts.role_name).index - Roles.get_player_highest_role(player).index))) -end - --- The main container for the bonus gui -- @element bonus_container bonus_container = Gui.element("bonus_container") From a1a974531943be457d8f27822a6cf1bb42e5867a Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Sat, 8 Feb 2025 00:56:53 +0900 Subject: [PATCH 228/406] . --- exp_legacy/module/modules/gui/bonus.lua | 3 +++ 1 file changed, 3 insertions(+) diff --git a/exp_legacy/module/modules/gui/bonus.lua b/exp_legacy/module/modules/gui/bonus.lua index e2a7576f..696fd2ac 100644 --- a/exp_legacy/module/modules/gui/bonus.lua +++ b/exp_legacy/module/modules/gui/bonus.lua @@ -104,6 +104,9 @@ local function apply_periodic_bonus(player) end local function bonus_score_limit_calc(player) + game.print(Roles.get_player_highest_role(player).index) + game.print(Roles.get_role_by_name(config.pts.role_name).index) + return math.floor(config.pts.base * (1 + config.pts.increase_percentage_per_role_level * (Roles.get_player_highest_role(player).index - Roles.get_role_by_name(config.pts.role_name).index))) end From 0fea8692af78ac34a3aebcf74c45fb2176e29748 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Sat, 8 Feb 2025 00:59:39 +0900 Subject: [PATCH 229/406] . --- exp_legacy/module/modules/gui/bonus.lua | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/exp_legacy/module/modules/gui/bonus.lua b/exp_legacy/module/modules/gui/bonus.lua index 696fd2ac..e49c0748 100644 --- a/exp_legacy/module/modules/gui/bonus.lua +++ b/exp_legacy/module/modules/gui/bonus.lua @@ -104,10 +104,7 @@ local function apply_periodic_bonus(player) end local function bonus_score_limit_calc(player) - game.print(Roles.get_player_highest_role(player).index) - game.print(Roles.get_role_by_name(config.pts.role_name).index) - - return math.floor(config.pts.base * (1 + config.pts.increase_percentage_per_role_level * (Roles.get_player_highest_role(player).index - Roles.get_role_by_name(config.pts.role_name).index))) + return math.floor(config.pts.base * (1 + config.pts.increase_percentage_per_role_level * (Roles.get_role_by_name(config.pts.role_name).index - Roles.get_player_highest_role(player).index))) end --- Control label for the bonus points available From de5462662f31e1fa0dba233226ee706eebca33d7 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Sat, 8 Feb 2025 01:27:36 +0900 Subject: [PATCH 230/406] . --- exp_legacy/module/config/bonus.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exp_legacy/module/config/bonus.lua b/exp_legacy/module/config/bonus.lua index 2b1dfc26..2f7f466a 100644 --- a/exp_legacy/module/config/bonus.lua +++ b/exp_legacy/module/config/bonus.lua @@ -19,7 +19,7 @@ return { pts = { base = 260, increase_percentage_per_role_level = 0.03, - role_name = "Member" + role_name = "Member", }, gui_display_width = { half = 150, From c7280169a419236ec4283ff12f35bc46b8853f09 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Sat, 8 Feb 2025 01:31:37 +0900 Subject: [PATCH 231/406] . --- exp_legacy/module/modules/gui/bonus.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exp_legacy/module/modules/gui/bonus.lua b/exp_legacy/module/modules/gui/bonus.lua index e49c0748..c0381583 100644 --- a/exp_legacy/module/modules/gui/bonus.lua +++ b/exp_legacy/module/modules/gui/bonus.lua @@ -125,7 +125,7 @@ local bonus_gui_control_pts_count = Gui.element("bonus_gui_control_pts_count") name = Gui.property_from_name, caption = "0 / " .. bonus_score_limit, value = 0, - style = "electric_satisfaction_statistics_progressbar", + style = "progressbar", }:style{ width = config.gui_display_width["half"], font = "heading-2", From 725ae0d7b3d62fbc8ca894b1f4f5fc85f6083a9f Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Sat, 8 Feb 2025 01:36:41 +0900 Subject: [PATCH 232/406] . --- exp_legacy/module/modules/gui/bonus.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exp_legacy/module/modules/gui/bonus.lua b/exp_legacy/module/modules/gui/bonus.lua index c0381583..e49c0748 100644 --- a/exp_legacy/module/modules/gui/bonus.lua +++ b/exp_legacy/module/modules/gui/bonus.lua @@ -125,7 +125,7 @@ local bonus_gui_control_pts_count = Gui.element("bonus_gui_control_pts_count") name = Gui.property_from_name, caption = "0 / " .. bonus_score_limit, value = 0, - style = "progressbar", + style = "electric_satisfaction_statistics_progressbar", }:style{ width = config.gui_display_width["half"], font = "heading-2", From 432d29cc897b6bbe372c3902d40d7a38facc73ca Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Sat, 8 Feb 2025 03:49:37 +0900 Subject: [PATCH 233/406] . --- exp_legacy/module/modules/gui/research.lua | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/exp_legacy/module/modules/gui/research.lua b/exp_legacy/module/modules/gui/research.lua index 0d7a2c37..5142f6f1 100644 --- a/exp_legacy/module/modules/gui/research.lua +++ b/exp_legacy/module/modules/gui/research.lua @@ -273,18 +273,16 @@ Event.add(defines.events.on_research_finished, function(event) end end) ---[[ Event.add(defines.events.on_research_started, function(event) local r = event.research local rq = r.force.research_queue for i = #rq, 1, -1 do - if config.limit_res[rq[i] ] and rq[i].level > config.limit_res[rq[i] ] then + if config.limit_res[rq[i]] and rq[i].level > config.limit_res[rq[i]] then rq[i] = nil end end end) -]] Event.on_nth_tick(60, function() local current_time = research_time_format(game.tick) From 4093d30ee5a93950eb7599e5734664e25b415f84 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Sat, 8 Feb 2025 03:54:13 +0900 Subject: [PATCH 234/406] . --- exp_legacy/module/modules/gui/research.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exp_legacy/module/modules/gui/research.lua b/exp_legacy/module/modules/gui/research.lua index 5142f6f1..c13784bd 100644 --- a/exp_legacy/module/modules/gui/research.lua +++ b/exp_legacy/module/modules/gui/research.lua @@ -279,7 +279,7 @@ Event.add(defines.events.on_research_started, function(event) for i = #rq, 1, -1 do if config.limit_res[rq[i]] and rq[i].level > config.limit_res[rq[i]] then - rq[i] = nil + event.research.force.research_queue[i] = nil end end end) From c241fbef0de24cd082820290ed1e2a2a51f666cf Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Sat, 8 Feb 2025 04:00:58 +0900 Subject: [PATCH 235/406] . --- exp_legacy/module/modules/gui/research.lua | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/exp_legacy/module/modules/gui/research.lua b/exp_legacy/module/modules/gui/research.lua index c13784bd..451dec90 100644 --- a/exp_legacy/module/modules/gui/research.lua +++ b/exp_legacy/module/modules/gui/research.lua @@ -114,6 +114,11 @@ local function research_notification(event) event.research.force[config.bonus_inventory.name] = event.research.level * config.bonus_inventory.rate end end + + if config.limit_res[event.research.name] and event.research.level > config.limit_res[event.research.name] then + event.research.enabled = false + event.research.visible_when_disabled = false + end end local function research_gui_update() @@ -273,17 +278,6 @@ Event.add(defines.events.on_research_finished, function(event) end end) -Event.add(defines.events.on_research_started, function(event) - local r = event.research - local rq = r.force.research_queue - - for i = #rq, 1, -1 do - if config.limit_res[rq[i]] and rq[i].level > config.limit_res[rq[i]] then - event.research.force.research_queue[i] = nil - end - end -end) - Event.on_nth_tick(60, function() local current_time = research_time_format(game.tick) From 413083e03ab9462eafb239047731154907dd005d Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Sat, 8 Feb 2025 04:01:37 +0900 Subject: [PATCH 236/406] . --- exp_legacy/module/modules/gui/research.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exp_legacy/module/modules/gui/research.lua b/exp_legacy/module/modules/gui/research.lua index 451dec90..11663a22 100644 --- a/exp_legacy/module/modules/gui/research.lua +++ b/exp_legacy/module/modules/gui/research.lua @@ -115,7 +115,7 @@ local function research_notification(event) end end - if config.limit_res[event.research.name] and event.research.level > config.limit_res[event.research.name] then + if config.limit_res[event.research.name] and (event.research.level + 1) >= config.limit_res[event.research.name] then event.research.enabled = false event.research.visible_when_disabled = false end From af241f2f17c505a263716254f5aed1e77037f3bc Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Sat, 8 Feb 2025 04:11:31 +0900 Subject: [PATCH 237/406] . --- exp_legacy/module/modules/gui/research.lua | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/exp_legacy/module/modules/gui/research.lua b/exp_legacy/module/modules/gui/research.lua index 11663a22..7f134eb0 100644 --- a/exp_legacy/module/modules/gui/research.lua +++ b/exp_legacy/module/modules/gui/research.lua @@ -118,6 +118,12 @@ local function research_notification(event) if config.limit_res[event.research.name] and (event.research.level + 1) >= config.limit_res[event.research.name] then event.research.enabled = false event.research.visible_when_disabled = false + + for i = #event.research.force.research_queue, 1, -1 do + if event.research.force.research_queue[i] == event.research.name then + table.remove(event.research.force.research_queue, i) + end + end end end From 3174efafed431a96ada9af1cfd5bbadee0870b7f Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Sat, 8 Feb 2025 04:15:58 +0900 Subject: [PATCH 238/406] .. --- exp_legacy/module/modules/gui/research.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/exp_legacy/module/modules/gui/research.lua b/exp_legacy/module/modules/gui/research.lua index 7f134eb0..cb5762d7 100644 --- a/exp_legacy/module/modules/gui/research.lua +++ b/exp_legacy/module/modules/gui/research.lua @@ -118,12 +118,14 @@ local function research_notification(event) if config.limit_res[event.research.name] and (event.research.level + 1) >= config.limit_res[event.research.name] then event.research.enabled = false event.research.visible_when_disabled = false - + event.research.force.cancel_current_research() + --[[ for i = #event.research.force.research_queue, 1, -1 do if event.research.force.research_queue[i] == event.research.name then table.remove(event.research.force.research_queue, i) end end + ]] end end From 71e8f393618aa598de3ecc4013c9710ee64d897d Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Sat, 8 Feb 2025 04:16:15 +0900 Subject: [PATCH 239/406] . --- exp_legacy/module/modules/gui/research.lua | 1 - 1 file changed, 1 deletion(-) diff --git a/exp_legacy/module/modules/gui/research.lua b/exp_legacy/module/modules/gui/research.lua index cb5762d7..fa6a7a01 100644 --- a/exp_legacy/module/modules/gui/research.lua +++ b/exp_legacy/module/modules/gui/research.lua @@ -117,7 +117,6 @@ local function research_notification(event) if config.limit_res[event.research.name] and (event.research.level + 1) >= config.limit_res[event.research.name] then event.research.enabled = false - event.research.visible_when_disabled = false event.research.force.cancel_current_research() --[[ for i = #event.research.force.research_queue, 1, -1 do From 3f6fb513834f5db54b6438704edbbe5f734e34fa Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Sat, 8 Feb 2025 04:18:14 +0900 Subject: [PATCH 240/406] . --- exp_legacy/module/modules/gui/research.lua | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/exp_legacy/module/modules/gui/research.lua b/exp_legacy/module/modules/gui/research.lua index fa6a7a01..b8258eb1 100644 --- a/exp_legacy/module/modules/gui/research.lua +++ b/exp_legacy/module/modules/gui/research.lua @@ -117,14 +117,16 @@ local function research_notification(event) if config.limit_res[event.research.name] and (event.research.level + 1) >= config.limit_res[event.research.name] then event.research.enabled = false - event.research.force.cancel_current_research() - --[[ - for i = #event.research.force.research_queue, 1, -1 do - if event.research.force.research_queue[i] == event.research.name then - table.remove(event.research.force.research_queue, i) + local rq = event.research.force.research_queue + + for i = #rq, 1, -1 do + if rq[i] == event.research.name then + table.remove(rq, i) end end - ]] + + event.research.force.cancel_current_research() + event.research.force.research_queue = rq end end From 13d1452f426db707a2616335676fce505be63e7f Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Sat, 8 Feb 2025 04:21:13 +0900 Subject: [PATCH 241/406] . --- exp_legacy/module/modules/gui/research.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exp_legacy/module/modules/gui/research.lua b/exp_legacy/module/modules/gui/research.lua index b8258eb1..05dd3905 100644 --- a/exp_legacy/module/modules/gui/research.lua +++ b/exp_legacy/module/modules/gui/research.lua @@ -115,7 +115,7 @@ local function research_notification(event) end end - if config.limit_res[event.research.name] and (event.research.level + 1) >= config.limit_res[event.research.name] then + if config.limit_res[event.research.name] and event.research.level >= config.limit_res[event.research.name] then event.research.enabled = false local rq = event.research.force.research_queue From fa16c66f1ec64658eef13c7d6d4f9e1c48a078e9 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Sat, 8 Feb 2025 04:26:04 +0900 Subject: [PATCH 242/406] . --- exp_legacy/module/modules/gui/research.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/exp_legacy/module/modules/gui/research.lua b/exp_legacy/module/modules/gui/research.lua index 05dd3905..58916483 100644 --- a/exp_legacy/module/modules/gui/research.lua +++ b/exp_legacy/module/modules/gui/research.lua @@ -117,6 +117,7 @@ local function research_notification(event) if config.limit_res[event.research.name] and event.research.level >= config.limit_res[event.research.name] then event.research.enabled = false + event.research.visible_when_disabled = true local rq = event.research.force.research_queue for i = #rq, 1, -1 do From 544782e65e83b9955fc8d573d6ecc82fc4abfab6 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Sat, 8 Feb 2025 04:28:47 +0900 Subject: [PATCH 243/406] . --- exp_legacy/module/modules/gui/research.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exp_legacy/module/modules/gui/research.lua b/exp_legacy/module/modules/gui/research.lua index 58916483..9c2f8d45 100644 --- a/exp_legacy/module/modules/gui/research.lua +++ b/exp_legacy/module/modules/gui/research.lua @@ -115,7 +115,7 @@ local function research_notification(event) end end - if config.limit_res[event.research.name] and event.research.level >= config.limit_res[event.research.name] then + if config.limit_res[event.research.name] and event.research.level > config.limit_res[event.research.name] then event.research.enabled = false event.research.visible_when_disabled = true local rq = event.research.force.research_queue From 8ac99a0aa7186a483e77b8661434cdbbaf935f1a Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Mon, 10 Feb 2025 04:27:48 +0900 Subject: [PATCH 244/406] . --- exp_legacy/module/modules/addons/miner.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exp_legacy/module/modules/addons/miner.lua b/exp_legacy/module/modules/addons/miner.lua index d5e87aef..a3742e12 100644 --- a/exp_legacy/module/modules/addons/miner.lua +++ b/exp_legacy/module/modules/addons/miner.lua @@ -160,7 +160,7 @@ Event.add(defines.events.on_resource_depleted, function(event) end local resource = event.entity - local drills = resource.surface.find_entities_filtered{ type = "mining-drill" } + local drills = resource.surface.find_entities_filtered{ area = { { event.entity.position.x - 1, event.entity.position.y - 1 }, { event.entity.position.x + 1, event.entity.position.y + 1 } }, type = "mining-drill" } for _, entity in pairs(drills) do local radius = entity.prototype.mining_drill_radius From 3ed1589e7eb602373c7509a12d3118c017d27bfc Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Mon, 10 Feb 2025 15:07:18 +0900 Subject: [PATCH 245/406] . --- exp_legacy/module/modules/gui/research.lua | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/exp_legacy/module/modules/gui/research.lua b/exp_legacy/module/modules/gui/research.lua index 9c2f8d45..138824fa 100644 --- a/exp_legacy/module/modules/gui/research.lua +++ b/exp_legacy/module/modules/gui/research.lua @@ -80,9 +80,7 @@ local function research_res_n() end end - local max_start = math.max(1, #res.disp - 7) - local start = math.clamp(current - 3, 1, max_start) - return math.min(start, max_start) + return math.clamp(current - 3, 1, math.max(1, #res.disp - 7)) end local function research_notification(event) From df3daafc032fd28abf3d6c875b35310fc9574e69 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Mon, 10 Feb 2025 15:09:28 +0900 Subject: [PATCH 246/406] . --- exp_legacy/module/modules/gui/research.lua | 32 ++++++++++++---------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/exp_legacy/module/modules/gui/research.lua b/exp_legacy/module/modules/gui/research.lua index 138824fa..ac1028c4 100644 --- a/exp_legacy/module/modules/gui/research.lua +++ b/exp_legacy/module/modules/gui/research.lua @@ -112,21 +112,6 @@ local function research_notification(event) event.research.force[config.bonus_inventory.name] = event.research.level * config.bonus_inventory.rate end end - - if config.limit_res[event.research.name] and event.research.level > config.limit_res[event.research.name] then - event.research.enabled = false - event.research.visible_when_disabled = true - local rq = event.research.force.research_queue - - for i = #rq, 1, -1 do - if rq[i] == event.research.name then - table.remove(rq, i) - end - end - - event.research.force.cancel_current_research() - event.research.force.research_queue = rq - end end local function research_gui_update() @@ -286,6 +271,23 @@ Event.add(defines.events.on_research_finished, function(event) end end) +Event.add(defines.events.on_research_started, function(event) + if config.limit_res[event.research.name] and event.research.level > config.limit_res[event.research.name] then + event.research.enabled = false + event.research.visible_when_disabled = true + local rq = event.research.force.research_queue + + for i = #rq, 1, -1 do + if rq[i] == event.research.name then + table.remove(rq, i) + end + end + + event.research.force.cancel_current_research() + event.research.force.research_queue = rq + end +end) + Event.on_nth_tick(60, function() local current_time = research_time_format(game.tick) From 1fc30471163d8dd35a6e935bd859dcf6b8700612 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Mon, 10 Feb 2025 15:11:43 +0900 Subject: [PATCH 247/406] . --- exp_legacy/module/modules/gui/research.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/exp_legacy/module/modules/gui/research.lua b/exp_legacy/module/modules/gui/research.lua index ac1028c4..4a8bed31 100644 --- a/exp_legacy/module/modules/gui/research.lua +++ b/exp_legacy/module/modules/gui/research.lua @@ -130,6 +130,7 @@ local function research_gui_update() } if entry.raw_name then + assert(prototypes.technology[entry.raw_name], "Invalid Research: " .. tostring(entry.raw_name)) data.name = { "research.res-name", entry.raw_name, prototypes.technology[entry.raw_name].localised_name } data.target = entry.target_disp From adda5c0f9d8fc247609b065b2bc850e9d6f9429a Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Mon, 10 Feb 2025 15:21:35 +0900 Subject: [PATCH 248/406] . --- exp_legacy/module/modules/gui/bonus.lua | 43 +++++++++++++++---------- 1 file changed, 26 insertions(+), 17 deletions(-) diff --git a/exp_legacy/module/modules/gui/bonus.lua b/exp_legacy/module/modules/gui/bonus.lua index e49c0748..e112a66e 100644 --- a/exp_legacy/module/modules/gui/bonus.lua +++ b/exp_legacy/module/modules/gui/bonus.lua @@ -4,6 +4,7 @@ ]] local Gui = require("modules/exp_gui") +local Storage = require("modules/exp_util/storage") local Event = require("modules/exp_legacy/utils/event") --- @dep utils.event local Roles = require("modules.exp_legacy.expcore.roles") --- @dep expcore.roles local config = require("modules.exp_legacy.config.bonus") --- @dep config.bonus @@ -11,7 +12,14 @@ local vlayer = require("modules.exp_legacy.modules.control.vlayer") local format_number = require("util").format_number --- @dep util local bonus_container -local bonus_score_limit = config.pts.base + +local bonus_data = { + score_limit = {} +} + +Storage.register(bonus_data, function(tbl) + bonus_data = tbl +end) --- @param player LuaPlayer --- @param container LuaGuiElement? @@ -123,7 +131,7 @@ local bonus_gui_control_pts_count = Gui.element("bonus_gui_control_pts_count") :draw{ type = "progressbar", name = Gui.property_from_name, - caption = "0 / " .. bonus_score_limit, + caption = "0 / 0", value = 0, style = "electric_satisfaction_statistics_progressbar", }:style{ @@ -155,8 +163,8 @@ local bonus_gui_control_reset = Gui.element("bonus_gui_control_reset") disp[slider.tags.counter].caption = format_number(slider.slider_value, false) local n = bonus_gui_pts_needed(player) - element.parent[bonus_gui_control_pts_count.name].caption = n .. " / " .. bonus_score_limit - element.parent[bonus_gui_control_pts_count.name].value = n / bonus_score_limit + element.parent[bonus_gui_control_pts_count.name].caption = n .. " / " .. bonus_data.score_limit[player] + element.parent[bonus_gui_control_pts_count.name].value = n / bonus_data.score_limit[player] end) --- A button used for pts apply @@ -170,10 +178,10 @@ local bonus_gui_control_apply = Gui.element("bonus_gui_control_apply") width = config.gui_display_width["half"], }:on_click(function(def, player, element) local n = bonus_gui_pts_needed(player) - element.parent[bonus_gui_control_pts_count.name].caption = n .. " / " .. bonus_score_limit - element.parent[bonus_gui_control_pts_count.name].value = n / bonus_score_limit + element.parent[bonus_gui_control_pts_count.name].caption = n .. " / " .. bonus_data.score_limit[player] + element.parent[bonus_gui_control_pts_count.name].value = n / bonus_data.score_limit[player] - if n <= bonus_score_limit then + if n <= bonus_data.score_limit[player] then apply_bonus(player) end end) @@ -236,8 +244,8 @@ local bonus_gui_slider = Gui.element("bonus_gui_slider") local container = Gui.get_left_element(bonus_container, player) local disp = container.frame["bonus_st_1"].disp.table local n = bonus_gui_pts_needed(player) - disp[bonus_gui_control_pts_count.name].caption = n .. " / " .. bonus_score_limit - disp[bonus_gui_control_pts_count.name].value = n / bonus_score_limit + disp[bonus_gui_control_pts_count.name].caption = n .. " / " .. bonus_data.score_limit[player] + disp[bonus_gui_control_pts_count.name].value = n / bonus_data.score_limit[player] end) --- A vertical flow containing all the bonus data @@ -268,9 +276,9 @@ bonus_container = Gui.element("bonus_container") local disp = container["bonus_st_1"].disp.table local n = bonus_gui_pts_needed(player, container.parent) - bonus_score_limit = bonus_score_limit_calc(player) - disp[bonus_gui_control_pts_count.name].caption = n .. " / " .. bonus_score_limit - disp[bonus_gui_control_pts_count.name].value = n / bonus_score_limit + bonus_data.score_limit[player] = bonus_score_limit_calc(player) + disp[bonus_gui_control_pts_count.name].caption = n .. " / " .. bonus_data.score_limit[player] + disp[bonus_gui_control_pts_count.name].value = n / bonus_data.score_limit[player] return container.parent end) @@ -303,13 +311,14 @@ end) Event.add(Roles.events.on_role_assigned, function(event) local player = game.players[event.player_index] - bonus_score_limit = bonus_score_limit_calc(player) + bonus_data[player] = config.pts.base + bonus_data.score_limit[player] = bonus_score_limit_calc(player) apply_bonus(player) end) Event.add(Roles.events.on_role_unassigned, function(event) local player = game.players[event.player_index] - bonus_score_limit = bonus_score_limit_calc(player) + bonus_data.score_limit[player] = bonus_score_limit_calc(player) apply_bonus(player) end) @@ -319,10 +328,10 @@ Event.add(defines.events.on_player_respawned, function(event) local container = Gui.get_left_element(bonus_container, player) local disp = container.frame["bonus_st_1"].disp.table local n = bonus_gui_pts_needed(player) - disp[bonus_gui_control_pts_count.name].caption = n .. " / " .. bonus_score_limit - disp[bonus_gui_control_pts_count.name].value = n / bonus_score_limit + disp[bonus_gui_control_pts_count.name].caption = n .. " / " .. bonus_data.score_limit[player] + disp[bonus_gui_control_pts_count.name].value = n / bonus_data.score_limit[player] - if n <= bonus_score_limit then + if n <= bonus_data.score_limit[player] then apply_bonus(player) end end) From 127aace0aec8cfb2b6d6e8e96746c1a7beaa6bef Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Mon, 10 Feb 2025 15:34:47 +0900 Subject: [PATCH 249/406] . --- exp_legacy/module/modules/gui/bonus.lua | 3 +++ 1 file changed, 3 insertions(+) diff --git a/exp_legacy/module/modules/gui/bonus.lua b/exp_legacy/module/modules/gui/bonus.lua index e112a66e..f1902a61 100644 --- a/exp_legacy/module/modules/gui/bonus.lua +++ b/exp_legacy/module/modules/gui/bonus.lua @@ -296,6 +296,9 @@ Gui.toolbar.create_button{ } Event.add(defines.events.on_player_created, function(event) + local player = game.players[event.player_index] + bonus_data.score_limit[player] = bonus_score_limit_calc(player) + if event.player_index ~= 1 then return end From 2f2389f1eaede1b2d5608bd8b201e739689a85dd Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Mon, 10 Feb 2025 15:40:09 +0900 Subject: [PATCH 250/406] . --- exp_legacy/module/modules/gui/bonus.lua | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/exp_legacy/module/modules/gui/bonus.lua b/exp_legacy/module/modules/gui/bonus.lua index f1902a61..14f76fac 100644 --- a/exp_legacy/module/modules/gui/bonus.lua +++ b/exp_legacy/module/modules/gui/bonus.lua @@ -163,6 +163,7 @@ local bonus_gui_control_reset = Gui.element("bonus_gui_control_reset") disp[slider.tags.counter].caption = format_number(slider.slider_value, false) local n = bonus_gui_pts_needed(player) + bonus_data.score_limit[player] = bonus_score_limit_calc(player) element.parent[bonus_gui_control_pts_count.name].caption = n .. " / " .. bonus_data.score_limit[player] element.parent[bonus_gui_control_pts_count.name].value = n / bonus_data.score_limit[player] end) @@ -178,6 +179,7 @@ local bonus_gui_control_apply = Gui.element("bonus_gui_control_apply") width = config.gui_display_width["half"], }:on_click(function(def, player, element) local n = bonus_gui_pts_needed(player) + bonus_data.score_limit[player] = bonus_score_limit_calc(player) element.parent[bonus_gui_control_pts_count.name].caption = n .. " / " .. bonus_data.score_limit[player] element.parent[bonus_gui_control_pts_count.name].value = n / bonus_data.score_limit[player] @@ -244,6 +246,7 @@ local bonus_gui_slider = Gui.element("bonus_gui_slider") local container = Gui.get_left_element(bonus_container, player) local disp = container.frame["bonus_st_1"].disp.table local n = bonus_gui_pts_needed(player) + bonus_data.score_limit[player] = bonus_score_limit_calc(player) disp[bonus_gui_control_pts_count.name].caption = n .. " / " .. bonus_data.score_limit[player] disp[bonus_gui_control_pts_count.name].value = n / bonus_data.score_limit[player] end) @@ -296,9 +299,6 @@ Gui.toolbar.create_button{ } Event.add(defines.events.on_player_created, function(event) - local player = game.players[event.player_index] - bonus_data.score_limit[player] = bonus_score_limit_calc(player) - if event.player_index ~= 1 then return end @@ -314,7 +314,6 @@ end) Event.add(Roles.events.on_role_assigned, function(event) local player = game.players[event.player_index] - bonus_data[player] = config.pts.base bonus_data.score_limit[player] = bonus_score_limit_calc(player) apply_bonus(player) end) @@ -331,6 +330,7 @@ Event.add(defines.events.on_player_respawned, function(event) local container = Gui.get_left_element(bonus_container, player) local disp = container.frame["bonus_st_1"].disp.table local n = bonus_gui_pts_needed(player) + bonus_data.score_limit[player] = bonus_score_limit_calc(player) disp[bonus_gui_control_pts_count.name].caption = n .. " / " .. bonus_data.score_limit[player] disp[bonus_gui_control_pts_count.name].value = n / bonus_data.score_limit[player] From 6934d44b1d3cd4786d6ea0d246bbb59f36befe47 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Wed, 12 Feb 2025 19:12:11 +0900 Subject: [PATCH 251/406] . --- exp_legacy/module/modules/addons/miner.lua | 26 +++++++++------------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/exp_legacy/module/modules/addons/miner.lua b/exp_legacy/module/modules/addons/miner.lua index a3742e12..b19fa7bb 100644 --- a/exp_legacy/module/modules/addons/miner.lua +++ b/exp_legacy/module/modules/addons/miner.lua @@ -123,21 +123,17 @@ local function miner_check(entity) table.insert_array(entities, entities_t) for _, e in pairs(entities) do - if (e.position.x > ep.x) and (e.position.y == ep.y) then - for h = 1, er do - table.insert(pipe_build, { x = h, y = 0 }) - end - elseif (e.position.x < ep.x) and (e.position.y == ep.y) then - for h = 1, er do - table.insert(pipe_build, { x = -h, y = 0 }) - end - elseif (e.position.x == ep.x) and (e.position.y > ep.y) then - for h = 1, er do - table.insert(pipe_build, { x = 0, y = h }) - end - elseif (e.position.x == ep.x) and (e.position.y < ep.y) then - for h = 1, er do - table.insert(pipe_build, { x = 0, y = -h }) + for i, _ in pairs(e.fluidbox) do + local pc = e.fluidbox.get_pipe_connections(i) + + for _, p in pairs(pc) do + if p.flow_direction == "input" or p.flow_direction == "input-output" then + for x = 1, p.position.x do + for y = 1, p.position.y do + table.insert(pipe_build, { x = x, y = y }) + end + end + end end end end From f332cd649a1afb8d7c537b75dbe778ac24bd8fae Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Wed, 12 Feb 2025 19:12:34 +0900 Subject: [PATCH 252/406] . --- exp_legacy/module/modules/addons/miner.lua | 2 -- 1 file changed, 2 deletions(-) diff --git a/exp_legacy/module/modules/addons/miner.lua b/exp_legacy/module/modules/addons/miner.lua index b19fa7bb..bc8c453c 100644 --- a/exp_legacy/module/modules/addons/miner.lua +++ b/exp_legacy/module/modules/addons/miner.lua @@ -116,10 +116,8 @@ local function miner_check(entity) -- if require fluid to mine table.insert(pipe_build, { x = 0, y = 0 }) local r = er + 1 - local entities = es.find_entities_filtered{ area = { { ep.x - r, ep.y - r }, { ep.x + r, ep.y + r } }, type = { "mining-drill", "pipe", "pipe-to-ground" } } local entities_t = es.find_entities_filtered{ area = { { ep.x - r, ep.y - r }, { ep.x + r, ep.y + r } }, ghost_type = { "pipe", "pipe-to-ground" } } - table.insert_array(entities, entities_t) for _, e in pairs(entities) do From 30591995126030a998c51ca0d57593261f8d022e Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Wed, 12 Feb 2025 19:14:20 +0900 Subject: [PATCH 253/406] . --- exp_legacy/module/modules/addons/miner.lua | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/exp_legacy/module/modules/addons/miner.lua b/exp_legacy/module/modules/addons/miner.lua index bc8c453c..553e0a01 100644 --- a/exp_legacy/module/modules/addons/miner.lua +++ b/exp_legacy/module/modules/addons/miner.lua @@ -122,9 +122,7 @@ local function miner_check(entity) for _, e in pairs(entities) do for i, _ in pairs(e.fluidbox) do - local pc = e.fluidbox.get_pipe_connections(i) - - for _, p in pairs(pc) do + for _, p in pairs(e.fluidbox.get_pipe_connections(i)) do if p.flow_direction == "input" or p.flow_direction == "input-output" then for x = 1, p.position.x do for y = 1, p.position.y do From dfeec22b641e24053080e5c9c64cc1eb17a773cd Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Wed, 12 Feb 2025 19:19:02 +0900 Subject: [PATCH 254/406] . --- exp_legacy/module/modules/addons/miner.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exp_legacy/module/modules/addons/miner.lua b/exp_legacy/module/modules/addons/miner.lua index 553e0a01..84137fad 100644 --- a/exp_legacy/module/modules/addons/miner.lua +++ b/exp_legacy/module/modules/addons/miner.lua @@ -121,7 +121,7 @@ local function miner_check(entity) table.insert_array(entities, entities_t) for _, e in pairs(entities) do - for i, _ in pairs(e.fluidbox) do + for i = 1, #e.fluidbox do for _, p in pairs(e.fluidbox.get_pipe_connections(i)) do if p.flow_direction == "input" or p.flow_direction == "input-output" then for x = 1, p.position.x do From 02561e36c64ad321a9d649870ea6c152482753d9 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Wed, 12 Feb 2025 19:26:12 +0900 Subject: [PATCH 255/406] . --- exp_legacy/module/modules/addons/miner.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/exp_legacy/module/modules/addons/miner.lua b/exp_legacy/module/modules/addons/miner.lua index 84137fad..d25352b2 100644 --- a/exp_legacy/module/modules/addons/miner.lua +++ b/exp_legacy/module/modules/addons/miner.lua @@ -124,8 +124,8 @@ local function miner_check(entity) for i = 1, #e.fluidbox do for _, p in pairs(e.fluidbox.get_pipe_connections(i)) do if p.flow_direction == "input" or p.flow_direction == "input-output" then - for x = 1, p.position.x do - for y = 1, p.position.y do + for x = 1, p.target_position.x do + for y = 1, p.target_position.y do table.insert(pipe_build, { x = x, y = y }) end end From 2f1be9762f0fbe08eba6139a931fad04b6d469f7 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Wed, 12 Feb 2025 19:33:43 +0900 Subject: [PATCH 256/406] . --- exp_legacy/module/modules/addons/miner.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/exp_legacy/module/modules/addons/miner.lua b/exp_legacy/module/modules/addons/miner.lua index d25352b2..84137fad 100644 --- a/exp_legacy/module/modules/addons/miner.lua +++ b/exp_legacy/module/modules/addons/miner.lua @@ -124,8 +124,8 @@ local function miner_check(entity) for i = 1, #e.fluidbox do for _, p in pairs(e.fluidbox.get_pipe_connections(i)) do if p.flow_direction == "input" or p.flow_direction == "input-output" then - for x = 1, p.target_position.x do - for y = 1, p.target_position.y do + for x = 1, p.position.x do + for y = 1, p.position.y do table.insert(pipe_build, { x = x, y = y }) end end From a900440fc4b8ca96eb806c88ab5405704b750c05 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Wed, 12 Feb 2025 19:39:34 +0900 Subject: [PATCH 257/406] . --- exp_legacy/module/modules/addons/miner.lua | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/exp_legacy/module/modules/addons/miner.lua b/exp_legacy/module/modules/addons/miner.lua index 84137fad..17e38844 100644 --- a/exp_legacy/module/modules/addons/miner.lua +++ b/exp_legacy/module/modules/addons/miner.lua @@ -115,19 +115,13 @@ local function miner_check(entity) if config.fluid and entity.fluidbox and #entity.fluidbox > 0 then -- if require fluid to mine table.insert(pipe_build, { x = 0, y = 0 }) - local r = er + 1 - local entities = es.find_entities_filtered{ area = { { ep.x - r, ep.y - r }, { ep.x + r, ep.y + r } }, type = { "mining-drill", "pipe", "pipe-to-ground" } } - local entities_t = es.find_entities_filtered{ area = { { ep.x - r, ep.y - r }, { ep.x + r, ep.y + r } }, ghost_type = { "pipe", "pipe-to-ground" } } - table.insert_array(entities, entities_t) - for _, e in pairs(entities) do - for i = 1, #e.fluidbox do - for _, p in pairs(e.fluidbox.get_pipe_connections(i)) do - if p.flow_direction == "input" or p.flow_direction == "input-output" then - for x = 1, p.position.x do - for y = 1, p.position.y do - table.insert(pipe_build, { x = x, y = y }) - end + for i = 1, #entity.fluidbox do + for _, p in pairs(entity.fluidbox.get_pipe_connections(i)) do + if p.flow_direction == "input" or p.flow_direction == "input-output" then + for x = 1, p.position.x do + for y = 1, p.position.y do + table.insert(pipe_build, { x = x, y = y }) end end end From 20e98d4b13eb3310d665b7f97a4848d1f809d12d Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Wed, 12 Feb 2025 19:51:53 +0900 Subject: [PATCH 258/406] . --- exp_legacy/module/modules/addons/miner.lua | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/exp_legacy/module/modules/addons/miner.lua b/exp_legacy/module/modules/addons/miner.lua index 17e38844..225bc53b 100644 --- a/exp_legacy/module/modules/addons/miner.lua +++ b/exp_legacy/module/modules/addons/miner.lua @@ -118,11 +118,9 @@ local function miner_check(entity) for i = 1, #entity.fluidbox do for _, p in pairs(entity.fluidbox.get_pipe_connections(i)) do - if p.flow_direction == "input" or p.flow_direction == "input-output" then - for x = 1, p.position.x do - for y = 1, p.position.y do - table.insert(pipe_build, { x = x, y = y }) - end + for x = 1, p.position.x do + for y = 1, p.position.y do + table.insert(pipe_build, { x = x, y = y }) end end end From 95bdc0f0f3306d447e04a856d50d7ba2523c034b Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Wed, 12 Feb 2025 19:56:59 +0900 Subject: [PATCH 259/406] . --- exp_legacy/module/modules/addons/miner.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exp_legacy/module/modules/addons/miner.lua b/exp_legacy/module/modules/addons/miner.lua index 225bc53b..38f6c9d6 100644 --- a/exp_legacy/module/modules/addons/miner.lua +++ b/exp_legacy/module/modules/addons/miner.lua @@ -117,7 +117,7 @@ local function miner_check(entity) table.insert(pipe_build, { x = 0, y = 0 }) for i = 1, #entity.fluidbox do - for _, p in pairs(entity.fluidbox.get_pipe_connections(i)) do + for _, p in pairs(entity.fluidbox.pipe_connections) do for x = 1, p.position.x do for y = 1, p.position.y do table.insert(pipe_build, { x = x, y = y }) From 2720c6938ee47fb597db43c1a4e7d78ec15689f5 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Wed, 12 Feb 2025 20:01:00 +0900 Subject: [PATCH 260/406] . --- exp_legacy/module/modules/addons/miner.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exp_legacy/module/modules/addons/miner.lua b/exp_legacy/module/modules/addons/miner.lua index 38f6c9d6..0708c0d5 100644 --- a/exp_legacy/module/modules/addons/miner.lua +++ b/exp_legacy/module/modules/addons/miner.lua @@ -117,7 +117,7 @@ local function miner_check(entity) table.insert(pipe_build, { x = 0, y = 0 }) for i = 1, #entity.fluidbox do - for _, p in pairs(entity.fluidbox.pipe_connections) do + for _, p in pairs(entity.fluidbox[i].pipe_connections) do for x = 1, p.position.x do for y = 1, p.position.y do table.insert(pipe_build, { x = x, y = y }) From 823af41ad4bd4db9f942e3ffca1f2e8a31444be1 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Wed, 12 Feb 2025 20:12:22 +0900 Subject: [PATCH 261/406] . --- exp_legacy/module/modules/addons/miner.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exp_legacy/module/modules/addons/miner.lua b/exp_legacy/module/modules/addons/miner.lua index 0708c0d5..225bc53b 100644 --- a/exp_legacy/module/modules/addons/miner.lua +++ b/exp_legacy/module/modules/addons/miner.lua @@ -117,7 +117,7 @@ local function miner_check(entity) table.insert(pipe_build, { x = 0, y = 0 }) for i = 1, #entity.fluidbox do - for _, p in pairs(entity.fluidbox[i].pipe_connections) do + for _, p in pairs(entity.fluidbox.get_pipe_connections(i)) do for x = 1, p.position.x do for y = 1, p.position.y do table.insert(pipe_build, { x = x, y = y }) From 7b61c8b690e417717ba56b2ff6fa3083950447e0 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Wed, 12 Feb 2025 20:12:51 +0900 Subject: [PATCH 262/406] . --- exp_legacy/module/modules/addons/miner.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/exp_legacy/module/modules/addons/miner.lua b/exp_legacy/module/modules/addons/miner.lua index 225bc53b..75edaf39 100644 --- a/exp_legacy/module/modules/addons/miner.lua +++ b/exp_legacy/module/modules/addons/miner.lua @@ -103,7 +103,9 @@ local function miner_check(entity) end --[[ - entity.status ~= defines.entity_status.no_minable_resources + if entity.status ~= defines.entity_status.no_minable_resources then + return + end ]] if check_entity(entity) then From 3f2bb631f8e1c6f0d40ca365edfe3569021c6149 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Wed, 12 Feb 2025 20:14:21 +0900 Subject: [PATCH 263/406] . --- exp_legacy/module/modules/addons/miner.lua | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/exp_legacy/module/modules/addons/miner.lua b/exp_legacy/module/modules/addons/miner.lua index 75edaf39..3e13e0fc 100644 --- a/exp_legacy/module/modules/addons/miner.lua +++ b/exp_legacy/module/modules/addons/miner.lua @@ -96,16 +96,16 @@ local function miner_check(entity) local ef = entity.force local er = entity.prototype.mining_drill_radius + if entity.status ~= defines.entity_status.no_minable_resources then + return + end + + --[[ for _, r in pairs(entity.surface.find_entities_filtered{ area = { { x = ep.x - er, y = ep.y - er }, { x = ep.x + er, y = ep.y + er } }, type = "resource" }) do if r.amount > 0 then return end end - - --[[ - if entity.status ~= defines.entity_status.no_minable_resources then - return - end ]] if check_entity(entity) then From cea58693f9966f460d9d3b08b5b92332791c9313 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Wed, 12 Feb 2025 20:19:34 +0900 Subject: [PATCH 264/406] . --- exp_legacy/module/modules/addons/miner.lua | 39 +++++++++++++--------- 1 file changed, 23 insertions(+), 16 deletions(-) diff --git a/exp_legacy/module/modules/addons/miner.lua b/exp_legacy/module/modules/addons/miner.lua index 3e13e0fc..c87097e1 100644 --- a/exp_legacy/module/modules/addons/miner.lua +++ b/exp_legacy/module/modules/addons/miner.lua @@ -100,14 +100,6 @@ local function miner_check(entity) return end - --[[ - for _, r in pairs(entity.surface.find_entities_filtered{ area = { { x = ep.x - er, y = ep.y - er }, { x = ep.x + er, y = ep.y + er } }, type = "resource" }) do - if r.amount > 0 then - return - end - end - ]] - if check_entity(entity) then return end @@ -115,15 +107,30 @@ local function miner_check(entity) local pipe_build = {} if config.fluid and entity.fluidbox and #entity.fluidbox > 0 then - -- if require fluid to mine table.insert(pipe_build, { x = 0, y = 0 }) + local r = er + 1 - for i = 1, #entity.fluidbox do - for _, p in pairs(entity.fluidbox.get_pipe_connections(i)) do - for x = 1, p.position.x do - for y = 1, p.position.y do - table.insert(pipe_build, { x = x, y = y }) - end + local entities = es.find_entities_filtered{ area = { { ep.x - r, ep.y - r }, { ep.x + r, ep.y + r } }, type = { "mining-drill", "pipe", "pipe-to-ground" } } + local entities_t = es.find_entities_filtered{ area = { { ep.x - r, ep.y - r }, { ep.x + r, ep.y + r } }, ghost_type = { "pipe", "pipe-to-ground" } } + + table.insert_array(entities, entities_t) + + for _, e in pairs(entities) do + if (e.position.x > ep.x) and (e.position.y == ep.y) then + for h = 1, er do + table.insert(pipe_build, { x = h, y = 0 }) + end + elseif (e.position.x < ep.x) and (e.position.y == ep.y) then + for h = 1, er do + table.insert(pipe_build, { x = -h, y = 0 }) + end + elseif (e.position.x == ep.x) and (e.position.y > ep.y) then + for h = 1, er do + table.insert(pipe_build, { x = 0, y = h }) + end + elseif (e.position.x == ep.x) and (e.position.y < ep.y) then + for h = 1, er do + table.insert(pipe_build, { x = 0, y = -h }) end end end @@ -136,7 +143,7 @@ local function miner_check(entity) table.insert(miner_data.queue, { t = game.tick + 5, e = entity }) for _, pos in ipairs(pipe_build) do - es.create_entity{ name = "entity-ghost", position = { x = ep.x + pos.x, y = ep.y + pos.y }, force = ef, inner_name = "pipe", raise_built = true } + es.create_entity{ name = "entity-ghost", position = { x = ep.x + pos.x, y = ep.y + pos.y }, force = ef, inner_name = "pipe" } end end From 5f24583e902ae4d84a5366d11ec83c54f5bfeeee Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Wed, 12 Feb 2025 20:20:42 +0900 Subject: [PATCH 265/406] . --- exp_legacy/module/modules/addons/miner.lua | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/exp_legacy/module/modules/addons/miner.lua b/exp_legacy/module/modules/addons/miner.lua index c87097e1..596cb8be 100644 --- a/exp_legacy/module/modules/addons/miner.lua +++ b/exp_legacy/module/modules/addons/miner.lua @@ -108,6 +108,7 @@ local function miner_check(entity) if config.fluid and entity.fluidbox and #entity.fluidbox > 0 then table.insert(pipe_build, { x = 0, y = 0 }) + local rh = math.ceil(er / 2) local r = er + 1 local entities = es.find_entities_filtered{ area = { { ep.x - r, ep.y - r }, { ep.x + r, ep.y + r } }, type = { "mining-drill", "pipe", "pipe-to-ground" } } @@ -117,19 +118,19 @@ local function miner_check(entity) for _, e in pairs(entities) do if (e.position.x > ep.x) and (e.position.y == ep.y) then - for h = 1, er do + for h = 1, rh do table.insert(pipe_build, { x = h, y = 0 }) end elseif (e.position.x < ep.x) and (e.position.y == ep.y) then - for h = 1, er do + for h = 1, rh do table.insert(pipe_build, { x = -h, y = 0 }) end elseif (e.position.x == ep.x) and (e.position.y > ep.y) then - for h = 1, er do + for h = 1, rh do table.insert(pipe_build, { x = 0, y = h }) end elseif (e.position.x == ep.x) and (e.position.y < ep.y) then - for h = 1, er do + for h = 1, rh do table.insert(pipe_build, { x = 0, y = -h }) end end From 29f997bde2b5142e363e2bbb62a4acbebf81c00c Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Wed, 12 Feb 2025 20:22:34 +0900 Subject: [PATCH 266/406] . --- exp_legacy/module/modules/addons/miner.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exp_legacy/module/modules/addons/miner.lua b/exp_legacy/module/modules/addons/miner.lua index 596cb8be..1c645b86 100644 --- a/exp_legacy/module/modules/addons/miner.lua +++ b/exp_legacy/module/modules/addons/miner.lua @@ -112,7 +112,7 @@ local function miner_check(entity) local r = er + 1 local entities = es.find_entities_filtered{ area = { { ep.x - r, ep.y - r }, { ep.x + r, ep.y + r } }, type = { "mining-drill", "pipe", "pipe-to-ground" } } - local entities_t = es.find_entities_filtered{ area = { { ep.x - r, ep.y - r }, { ep.x + r, ep.y + r } }, ghost_type = { "pipe", "pipe-to-ground" } } + local entities_t = es.find_entities_filtered{ area = { { ep.x - r, ep.y - r }, { ep.x + r, ep.y + r } }, ghost_type = { "mining-drill", "pipe", "pipe-to-ground" } } table.insert_array(entities, entities_t) From 9e0ed189ee0a5bd365546e7c02dc7975e73ef873 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Wed, 12 Feb 2025 20:25:08 +0900 Subject: [PATCH 267/406] . --- exp_legacy/module/modules/addons/miner.lua | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/exp_legacy/module/modules/addons/miner.lua b/exp_legacy/module/modules/addons/miner.lua index 1c645b86..fd192704 100644 --- a/exp_legacy/module/modules/addons/miner.lua +++ b/exp_legacy/module/modules/addons/miner.lua @@ -96,8 +96,10 @@ local function miner_check(entity) local ef = entity.force local er = entity.prototype.mining_drill_radius - if entity.status ~= defines.entity_status.no_minable_resources then - return + for _, r in pairs(entity.surface.find_entities_filtered{ area = { { x = ep.x - er, y = ep.y - er }, { x = ep.x + er, y = ep.y + er } }, type = "resource" }) do + if r.amount > 0 then + return + end end if check_entity(entity) then From 822258eee0c8c794bb1f4e2fd086a1ff72e6183b Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Wed, 12 Feb 2025 20:39:07 +0900 Subject: [PATCH 268/406] . --- exp_legacy/module/modules/addons/miner.lua | 29 +++++----------------- 1 file changed, 6 insertions(+), 23 deletions(-) diff --git a/exp_legacy/module/modules/addons/miner.lua b/exp_legacy/module/modules/addons/miner.lua index fd192704..2d6ca6f6 100644 --- a/exp_legacy/module/modules/addons/miner.lua +++ b/exp_legacy/module/modules/addons/miner.lua @@ -110,30 +110,13 @@ local function miner_check(entity) if config.fluid and entity.fluidbox and #entity.fluidbox > 0 then table.insert(pipe_build, { x = 0, y = 0 }) - local rh = math.ceil(er / 2) - local r = er + 1 - local entities = es.find_entities_filtered{ area = { { ep.x - r, ep.y - r }, { ep.x + r, ep.y + r } }, type = { "mining-drill", "pipe", "pipe-to-ground" } } - local entities_t = es.find_entities_filtered{ area = { { ep.x - r, ep.y - r }, { ep.x + r, ep.y + r } }, ghost_type = { "mining-drill", "pipe", "pipe-to-ground" } } - - table.insert_array(entities, entities_t) - - for _, e in pairs(entities) do - if (e.position.x > ep.x) and (e.position.y == ep.y) then - for h = 1, rh do - table.insert(pipe_build, { x = h, y = 0 }) - end - elseif (e.position.x < ep.x) and (e.position.y == ep.y) then - for h = 1, rh do - table.insert(pipe_build, { x = -h, y = 0 }) - end - elseif (e.position.x == ep.x) and (e.position.y > ep.y) then - for h = 1, rh do - table.insert(pipe_build, { x = 0, y = h }) - end - elseif (e.position.x == ep.x) and (e.position.y < ep.y) then - for h = 1, rh do - table.insert(pipe_build, { x = 0, y = -h }) + for i = 1, #entity.fluidbox do + for _, p in pairs(entity.fluidbox[i].get_pipe_connections(i)) do + for x = 1, p.position.x do + for y = 1, p.position.y do + table.insert(pipe_build, { x = x, y = y }) + end end end end From 35631f45c6eeb407c401c4045557d454101a50a1 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Wed, 12 Feb 2025 20:46:00 +0900 Subject: [PATCH 269/406] . --- exp_legacy/module/modules/addons/miner.lua | 26 +++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/exp_legacy/module/modules/addons/miner.lua b/exp_legacy/module/modules/addons/miner.lua index 2d6ca6f6..99d09e2c 100644 --- a/exp_legacy/module/modules/addons/miner.lua +++ b/exp_legacy/module/modules/addons/miner.lua @@ -109,13 +109,29 @@ local function miner_check(entity) local pipe_build = {} if config.fluid and entity.fluidbox and #entity.fluidbox > 0 then - table.insert(pipe_build, { x = 0, y = 0 }) + local connections = {} + -- Collect all unique pipe connection directions for i = 1, #entity.fluidbox do - for _, p in pairs(entity.fluidbox[i].get_pipe_connections(i)) do - for x = 1, p.position.x do - for y = 1, p.position.y do - table.insert(pipe_build, { x = x, y = y }) + local box_connections = entity.fluidbox.get_pipe_connections(i) + + for _, connection in pairs(box_connections) do + -- Get relative connection position vector + local vec = connection.target_position + -- Normalize to cardinal direction + local direction = { + x = vec.x > 0.5 and 1 or vec.x < -0.5 and -1 or 0, + y = vec.y > 0.5 and 1 or vec.y < -0.5 and -1 or 0 + } + + -- Convert to string key to prevent duplicates + local key = direction.x .. "," .. direction.y + if not connections[key] then + connections[key] = true + + -- Calculate pipe positions in this direction + for d = 1, entity.prototype.mining_drill_radius or 1 do + table.insert(pipe_build, { x = direction.x * d, y = direction.y * d }) end end end From 6ed3a8bd499aea6c84d0d5867d003701da70bb05 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Wed, 12 Feb 2025 20:50:24 +0900 Subject: [PATCH 270/406] . --- exp_legacy/module/modules/addons/miner.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/exp_legacy/module/modules/addons/miner.lua b/exp_legacy/module/modules/addons/miner.lua index 99d09e2c..c222bff8 100644 --- a/exp_legacy/module/modules/addons/miner.lua +++ b/exp_legacy/module/modules/addons/miner.lua @@ -120,8 +120,8 @@ local function miner_check(entity) local vec = connection.target_position -- Normalize to cardinal direction local direction = { - x = vec.x > 0.5 and 1 or vec.x < -0.5 and -1 or 0, - y = vec.y > 0.5 and 1 or vec.y < -0.5 and -1 or 0 + x = (((vec.x > 0.5 and 1) or (vec.x < -0.5 and -1)) or 0), + y = (((vec.y > 0.5 and 1) or (vec.y < -0.5 and -1)) or 0) } -- Convert to string key to prevent duplicates @@ -130,7 +130,7 @@ local function miner_check(entity) connections[key] = true -- Calculate pipe positions in this direction - for d = 1, entity.prototype.mining_drill_radius or 1 do + for d = 1, er do table.insert(pipe_build, { x = direction.x * d, y = direction.y * d }) end end From 2a0b4f2bfbf0c3ca3b4dc160a076f379e64b5200 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Wed, 12 Feb 2025 20:50:38 +0900 Subject: [PATCH 271/406] . --- exp_legacy/module/modules/addons/miner.lua | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/exp_legacy/module/modules/addons/miner.lua b/exp_legacy/module/modules/addons/miner.lua index c222bff8..64c70830 100644 --- a/exp_legacy/module/modules/addons/miner.lua +++ b/exp_legacy/module/modules/addons/miner.lua @@ -119,10 +119,7 @@ local function miner_check(entity) -- Get relative connection position vector local vec = connection.target_position -- Normalize to cardinal direction - local direction = { - x = (((vec.x > 0.5 and 1) or (vec.x < -0.5 and -1)) or 0), - y = (((vec.y > 0.5 and 1) or (vec.y < -0.5 and -1)) or 0) - } + local direction = { x = (((vec.x > 0.5 and 1) or (vec.x < -0.5 and -1)) or 0), y = (((vec.y > 0.5 and 1) or (vec.y < -0.5 and -1)) or 0) } -- Convert to string key to prevent duplicates local key = direction.x .. "," .. direction.y From 6da76c548e63976a63c13c9d143dd8fb8d5ab251 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Wed, 12 Feb 2025 20:53:44 +0900 Subject: [PATCH 272/406] . --- exp_legacy/module/modules/addons/miner.lua | 40 ++++++++++++---------- 1 file changed, 22 insertions(+), 18 deletions(-) diff --git a/exp_legacy/module/modules/addons/miner.lua b/exp_legacy/module/modules/addons/miner.lua index 64c70830..861e49ce 100644 --- a/exp_legacy/module/modules/addons/miner.lua +++ b/exp_legacy/module/modules/addons/miner.lua @@ -109,27 +109,31 @@ local function miner_check(entity) local pipe_build = {} if config.fluid and entity.fluidbox and #entity.fluidbox > 0 then - local connections = {} + table.insert(pipe_build, { x = 0, y = 0 }) + local rh = math.ceil(er / 2) - 1 + local r = er + 1 - -- Collect all unique pipe connection directions - for i = 1, #entity.fluidbox do - local box_connections = entity.fluidbox.get_pipe_connections(i) + local entities = es.find_entities_filtered{ area = { { ep.x - r, ep.y - r }, { ep.x + r, ep.y + r } }, type = { "mining-drill", "pipe", "pipe-to-ground" } } + local entities_t = es.find_entities_filtered{ area = { { ep.x - r, ep.y - r }, { ep.x + r, ep.y + r } }, ghost_type = { "pipe", "pipe-to-ground" } } - for _, connection in pairs(box_connections) do - -- Get relative connection position vector - local vec = connection.target_position - -- Normalize to cardinal direction - local direction = { x = (((vec.x > 0.5 and 1) or (vec.x < -0.5 and -1)) or 0), y = (((vec.y > 0.5 and 1) or (vec.y < -0.5 and -1)) or 0) } + table.insert_array(entities, entities_t) - -- Convert to string key to prevent duplicates - local key = direction.x .. "," .. direction.y - if not connections[key] then - connections[key] = true - - -- Calculate pipe positions in this direction - for d = 1, er do - table.insert(pipe_build, { x = direction.x * d, y = direction.y * d }) - end + for _, e in pairs(entities) do + if (e.position.x > ep.x) and (e.position.y == ep.y) then + for h = 1, rh do + table.insert(pipe_build, { x = h, y = 0 }) + end + elseif (e.position.x < ep.x) and (e.position.y == ep.y) then + for h = 1, rh do + table.insert(pipe_build, { x = -h, y = 0 }) + end + elseif (e.position.x == ep.x) and (e.position.y > ep.y) then + for h = 1, rh do + table.insert(pipe_build, { x = 0, y = h }) + end + elseif (e.position.x == ep.x) and (e.position.y < ep.y) then + for h = 1, rh do + table.insert(pipe_build, { x = 0, y = -h }) end end end From b026a84e67c44b2d30670dc4d884573b1f280e3c Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Wed, 12 Feb 2025 21:59:29 +0900 Subject: [PATCH 273/406] . --- exp_legacy/module/modules/addons/miner.lua | 1 - 1 file changed, 1 deletion(-) diff --git a/exp_legacy/module/modules/addons/miner.lua b/exp_legacy/module/modules/addons/miner.lua index 861e49ce..501843fb 100644 --- a/exp_legacy/module/modules/addons/miner.lua +++ b/exp_legacy/module/modules/addons/miner.lua @@ -115,7 +115,6 @@ local function miner_check(entity) local entities = es.find_entities_filtered{ area = { { ep.x - r, ep.y - r }, { ep.x + r, ep.y + r } }, type = { "mining-drill", "pipe", "pipe-to-ground" } } local entities_t = es.find_entities_filtered{ area = { { ep.x - r, ep.y - r }, { ep.x + r, ep.y + r } }, ghost_type = { "pipe", "pipe-to-ground" } } - table.insert_array(entities, entities_t) for _, e in pairs(entities) do From 6bc077ed3e101f4af4d5e9a2eb99366b3ad3c66b Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Wed, 12 Feb 2025 22:13:10 +0900 Subject: [PATCH 274/406] . --- exp_legacy/module/modules/addons/miner.lua | 1 - 1 file changed, 1 deletion(-) diff --git a/exp_legacy/module/modules/addons/miner.lua b/exp_legacy/module/modules/addons/miner.lua index 501843fb..7dd8f29f 100644 --- a/exp_legacy/module/modules/addons/miner.lua +++ b/exp_legacy/module/modules/addons/miner.lua @@ -112,7 +112,6 @@ local function miner_check(entity) table.insert(pipe_build, { x = 0, y = 0 }) local rh = math.ceil(er / 2) - 1 local r = er + 1 - local entities = es.find_entities_filtered{ area = { { ep.x - r, ep.y - r }, { ep.x + r, ep.y + r } }, type = { "mining-drill", "pipe", "pipe-to-ground" } } local entities_t = es.find_entities_filtered{ area = { { ep.x - r, ep.y - r }, { ep.x + r, ep.y + r } }, ghost_type = { "pipe", "pipe-to-ground" } } table.insert_array(entities, entities_t) From eb6997736590240645c91164840140f9c26ee0cc Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Wed, 12 Feb 2025 22:17:50 +0900 Subject: [PATCH 275/406] . --- exp_legacy/module/modules/gui/production.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exp_legacy/module/modules/gui/production.lua b/exp_legacy/module/modules/gui/production.lua index 8da29140..63556670 100644 --- a/exp_legacy/module/modules/gui/production.lua +++ b/exp_legacy/module/modules/gui/production.lua @@ -27,7 +27,7 @@ local function format_n(n) i = i:reverse():gsub("(%d%d%d)", "%1,") if f ~= "" then - return m .. i:reverse():gsub("^,", "") .. f + return m .. i:reverse():gsub("^,", "") .. string.format("%.1f", f) else return m .. i:reverse():gsub("^,", "") .. ".0" end From 2ab8a8ae662df17eee13a69a4a4d5593f31c5c2f Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Wed, 12 Feb 2025 22:20:20 +0900 Subject: [PATCH 276/406] . --- exp_legacy/module/modules/gui/production.lua | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/exp_legacy/module/modules/gui/production.lua b/exp_legacy/module/modules/gui/production.lua index 63556670..579200e7 100644 --- a/exp_legacy/module/modules/gui/production.lua +++ b/exp_legacy/module/modules/gui/production.lua @@ -16,10 +16,8 @@ local precision = { } local font_color = { - -- positive - [1] = { r = 0.3, g = 1, b = 0.3 }, - -- negative - [2] = { r = 1, g = 0.3, b = 0.3 }, + ["positive"] = { r = 0.3, g = 1, b = 0.3 }, + ["negative"] = { r = 1, g = 0.3, b = 0.3 }, } local function format_n(n) @@ -66,7 +64,7 @@ local production_data_group = Gui.element("production_data_group") } data_1.style.width = 90 data_1.style.horizontal_align = "right" - data_1.style.font_color = font_color[1] + data_1.style.font_color = font_color["positive"] local data_2 = parent.add{ type = "label", @@ -76,7 +74,7 @@ local production_data_group = Gui.element("production_data_group") } data_2.style.width = 90 data_2.style.horizontal_align = "right" - data_2.style.font_color = font_color[2] + data_2.style.font_color = font_color["negative"] local data_3 = parent.add{ type = "label", @@ -86,7 +84,7 @@ local production_data_group = Gui.element("production_data_group") } data_3.style.width = 90 data_3.style.horizontal_align = "right" - data_3.style.font_color = font_color[1] + data_3.style.font_color = font_color["positive"] return item end) @@ -153,15 +151,15 @@ Event.on_nth_tick(60, function() table[production_prefix .. "_3"].caption = format_n(sum) if sum < 0 then - table[production_prefix .. "_3"].style.font_color = font_color[2] + table[production_prefix .. "_3"].style.font_color = font_color["negative"] else - table[production_prefix .. "_3"].style.font_color = font_color[1] + table[production_prefix .. "_3"].style.font_color = font_color["positive"] end else table[production_prefix .. "_1"].caption = "0.0" table[production_prefix .. "_2"].caption = "0.0" table[production_prefix .. "_3"].caption = "0.0" - table[production_prefix .. "_3"].style.font_color = font_color[1] + table[production_prefix .. "_3"].style.font_color = font_color["positive"] end end end From e759ca3c481f423e43a359cbabfa6ab319814eac Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Wed, 12 Feb 2025 22:29:27 +0900 Subject: [PATCH 277/406] . --- exp_legacy/module/modules/gui/production.lua | 48 +++++--------------- 1 file changed, 12 insertions(+), 36 deletions(-) diff --git a/exp_legacy/module/modules/gui/production.lua b/exp_legacy/module/modules/gui/production.lua index 579200e7..4dde8e55 100644 --- a/exp_legacy/module/modules/gui/production.lua +++ b/exp_legacy/module/modules/gui/production.lua @@ -56,35 +56,17 @@ local production_data_group = Gui.element("production_data_group") item.style.width = 32 end - local data_1 = parent.add{ - type = "label", - name = "production_" .. i .. "_1", - caption = "0.0", - style = "heading_2_label", - } - data_1.style.width = 90 - data_1.style.horizontal_align = "right" - data_1.style.font_color = font_color["positive"] - - local data_2 = parent.add{ - type = "label", - name = "production_" .. i .. "_2", - caption = "0.0", - style = "heading_2_label", - } - data_2.style.width = 90 - data_2.style.horizontal_align = "right" - data_2.style.font_color = font_color["negative"] - - local data_3 = parent.add{ - type = "label", - name = "production_" .. i .. "_3", - caption = "0.0", - style = "heading_2_label", - } - data_3.style.width = 90 - data_3.style.horizontal_align = "right" - data_3.style.font_color = font_color["positive"] + for j = 1, 3 do + local data_1 = parent.add{ + type = "label", + name = "production_" .. i .. "_" .. j, + caption = "0.0", + style = "heading_2_label", + } + data_1.style.width = 90 + data_1.style.horizontal_align = "right" + data_1.style.font_color = font_color["positive"] + end return item end) @@ -145,16 +127,10 @@ Event.on_nth_tick(60, function() local add = math.floor(stat.get_flow_count{ name = item, category = "input", precision_index = precision_value, count = false } / 6) / 10 local minus = math.floor(stat.get_flow_count{ name = item, category = "output", precision_index = precision_value, count = false } / 6) / 10 local sum = add - minus - table[production_prefix .. "_1"].caption = format_n(add) table[production_prefix .. "_2"].caption = format_n(minus) table[production_prefix .. "_3"].caption = format_n(sum) - - if sum < 0 then - table[production_prefix .. "_3"].style.font_color = font_color["negative"] - else - table[production_prefix .. "_3"].style.font_color = font_color["positive"] - end + table[production_prefix .. "_3"].style.font_color = (sum < 0 and font_color["negative"]) or font_color["positive"] else table[production_prefix .. "_1"].caption = "0.0" table[production_prefix .. "_2"].caption = "0.0" From 4350cfad8d5c9cfa11a8f56d530bc1add228ebaa Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Wed, 12 Feb 2025 22:29:36 +0900 Subject: [PATCH 278/406] . --- exp_legacy/module/modules/gui/production.lua | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/exp_legacy/module/modules/gui/production.lua b/exp_legacy/module/modules/gui/production.lua index 4dde8e55..dd42209b 100644 --- a/exp_legacy/module/modules/gui/production.lua +++ b/exp_legacy/module/modules/gui/production.lua @@ -57,15 +57,15 @@ local production_data_group = Gui.element("production_data_group") end for j = 1, 3 do - local data_1 = parent.add{ + local data = parent.add{ type = "label", name = "production_" .. i .. "_" .. j, caption = "0.0", style = "heading_2_label", } - data_1.style.width = 90 - data_1.style.horizontal_align = "right" - data_1.style.font_color = font_color["positive"] + data.style.width = 90 + data.style.horizontal_align = "right" + data.style.font_color = font_color["positive"] end return item From 2ec3813e2cdb3fadfe773db1f3a82fdb8c3cf124 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Wed, 12 Feb 2025 22:35:39 +0900 Subject: [PATCH 279/406] . --- exp_legacy/module/modules/gui/production.lua | 47 +++++++++++++------- 1 file changed, 32 insertions(+), 15 deletions(-) diff --git a/exp_legacy/module/modules/gui/production.lua b/exp_legacy/module/modules/gui/production.lua index dd42209b..bec8f3dd 100644 --- a/exp_legacy/module/modules/gui/production.lua +++ b/exp_legacy/module/modules/gui/production.lua @@ -21,14 +21,39 @@ local font_color = { } local function format_n(n) - local _i, _j, m, i, f = tostring(n):find("([-]?)(%d+)([.]?%d*)") - i = i:reverse():gsub("(%d%d%d)", "%1,") - - if f ~= "" then - return m .. i:reverse():gsub("^,", "") .. string.format("%.1f", f) - else - return m .. i:reverse():gsub("^,", "") .. ".0" + if n < 0.1 then + return "0.0" end + + local suffix = "" + local suffix_list = { + ["P"] = 1000000000000000, + ["T"] = 1000000000000, + ["G"] = 1000000000, + ["M"] = 1000000, + ["k"] = 1000, + } + + for letter, limit in pairs(suffix_list) do + if math.abs(n) >= limit then + n = string.format("%.1f", n / limit) + suffix = letter + break + end + end + + local k + local formatted = n + + while true do + formatted, k = string.gsub(formatted, "^(-?%d+)(%d%d%d)", "%1,%2") + + if (k == 0) then + break + end + end + + return formatted .. " " .. suffix end --- Display group @@ -77,26 +102,20 @@ local production_data_set = Gui.element("production_data_set") :draw(function(_, parent, name) local production_set = parent.add{ type = "flow", direction = "vertical", name = name } local disp = Gui.elements.scroll_table(production_set, 350, 4, "disp") - production_data_group(disp, 0) - disp["production_0_1"].caption = { "production.label-prod" } disp["production_0_2"].caption = { "production.label-con" } disp["production_0_3"].caption = { "production.label-bal" } - for i = 1, 8 do production_data_group(disp, i) end - return production_set end) production_container = Gui.element("production_container") :draw(function(def, parent) local container = Gui.elements.container(parent, 350) - production_data_set(container, "production_st") - return container.parent end) @@ -118,11 +137,9 @@ Event.on_nth_tick(60, function() local stat = player.force.get_item_production_statistics(player.surface) -- Allow remote view local precision_value = precision[container.frame["production_st"].disp.table["production_0_e"].selected_index] local table = container.frame["production_st"].disp.table - for i = 1, 8 do local production_prefix = "production_" .. i local item = table[production_prefix .. "_e"].elem_value --[[ @as string ]] - if item then local add = math.floor(stat.get_flow_count{ name = item, category = "input", precision_index = precision_value, count = false } / 6) / 10 local minus = math.floor(stat.get_flow_count{ name = item, category = "output", precision_index = precision_value, count = false } / 6) / 10 From e3a1b1f4fece7b5055c726f3ac6a15e27ba83c8d Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Wed, 12 Feb 2025 22:41:21 +0900 Subject: [PATCH 280/406] . --- exp_legacy/module/modules/gui/production.lua | 1 - 1 file changed, 1 deletion(-) diff --git a/exp_legacy/module/modules/gui/production.lua b/exp_legacy/module/modules/gui/production.lua index bec8f3dd..c8432289 100644 --- a/exp_legacy/module/modules/gui/production.lua +++ b/exp_legacy/module/modules/gui/production.lua @@ -27,7 +27,6 @@ local function format_n(n) local suffix = "" local suffix_list = { - ["P"] = 1000000000000000, ["T"] = 1000000000000, ["G"] = 1000000000, ["M"] = 1000000, From f5d23e9a072c2c003e0b976ded76b378dc45052e Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Wed, 12 Feb 2025 22:42:01 +0900 Subject: [PATCH 281/406] . --- exp_legacy/module/modules/gui/production.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exp_legacy/module/modules/gui/production.lua b/exp_legacy/module/modules/gui/production.lua index c8432289..38573be4 100644 --- a/exp_legacy/module/modules/gui/production.lua +++ b/exp_legacy/module/modules/gui/production.lua @@ -35,7 +35,7 @@ local function format_n(n) for letter, limit in pairs(suffix_list) do if math.abs(n) >= limit then - n = string.format("%.1f", n / limit) + n = string.format("%.2f", n / limit) suffix = letter break end From 63345c753c5a151317fb8bedcf7489693ecb2da5 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Wed, 12 Feb 2025 23:37:34 +0900 Subject: [PATCH 282/406] . --- exp_legacy/module/modules/gui/production.lua | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/exp_legacy/module/modules/gui/production.lua b/exp_legacy/module/modules/gui/production.lua index 38573be4..4795ee37 100644 --- a/exp_legacy/module/modules/gui/production.lua +++ b/exp_legacy/module/modules/gui/production.lua @@ -20,8 +20,8 @@ local font_color = { ["negative"] = { r = 1, g = 0.3, b = 0.3 }, } -local function format_n(n) - if n < 0.1 then +local function format_n(amount) + if amount < 0.1 then return "0.0" end @@ -34,15 +34,15 @@ local function format_n(n) } for letter, limit in pairs(suffix_list) do - if math.abs(n) >= limit then - n = string.format("%.2f", n / limit) + if math.abs(amount) >= limit then + amount = string.format("%.1f", amount / limit) suffix = letter break end end local k - local formatted = n + local formatted = amount while true do formatted, k = string.gsub(formatted, "^(-?%d+)(%d%d%d)", "%1,%2") From a3fbdd195b9717d3ed2778a79c9eceae863bb7d1 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Wed, 12 Feb 2025 23:38:01 +0900 Subject: [PATCH 283/406] . --- exp_legacy/module/modules/gui/production.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exp_legacy/module/modules/gui/production.lua b/exp_legacy/module/modules/gui/production.lua index 4795ee37..8ed89a6c 100644 --- a/exp_legacy/module/modules/gui/production.lua +++ b/exp_legacy/module/modules/gui/production.lua @@ -35,7 +35,7 @@ local function format_n(amount) for letter, limit in pairs(suffix_list) do if math.abs(amount) >= limit then - amount = string.format("%.1f", amount / limit) + amount = string.format("%.2f", amount / limit) suffix = letter break end From aacbfa7c3be9edf61bf3145f8fa314aeda188048 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Wed, 12 Feb 2025 23:57:00 +0900 Subject: [PATCH 284/406] . --- exp_legacy/module/modules/gui/production.lua | 44 +++++++++++++------- 1 file changed, 30 insertions(+), 14 deletions(-) diff --git a/exp_legacy/module/modules/gui/production.lua b/exp_legacy/module/modules/gui/production.lua index 8ed89a6c..20c6e51d 100644 --- a/exp_legacy/module/modules/gui/production.lua +++ b/exp_legacy/module/modules/gui/production.lua @@ -21,38 +21,54 @@ local font_color = { } local function format_n(amount) - if amount < 0.1 then - return "0.0" + if math.abs(amount) < 0.009 then + return "0.00" end local suffix = "" local suffix_list = { - ["T"] = 1000000000000, - ["G"] = 1000000000, - ["M"] = 1000000, - ["k"] = 1000, + ["T"] = 1e12, + ["G"] = 1e9, + ["M"] = 1e6, + ["k"] = 1e3 } + local scale = 1 for letter, limit in pairs(suffix_list) do if math.abs(amount) >= limit then - amount = string.format("%.2f", amount / limit) + scale = limit suffix = letter break end end - local k - local formatted = amount + local scaled_value = amount / scale + local formatted = string.format("%.2f", scaled_value) - while true do - formatted, k = string.gsub(formatted, "^(-?%d+)(%d%d%d)", "%1,%2") + -- Split into integer and fractional parts + local integer_part, fractional_part = formatted:match("^(%-?%d+)%.(%d+)$") + integer_part = integer_part or formatted + fractional_part = fractional_part or "00" - if (k == 0) then - break + -- Add commas to integer part + integer_part = integer_part:reverse():gsub("(%d%d%d)", "%1,"):reverse() + integer_part = integer_part:gsub("^,", ""):gsub("-,", "-") + + -- Handle numbers below 1000 without suffix + if scale == 1 then + -- Remove trailing .00 for whole numbers + if fractional_part == "00" then + return integer_part end + return string.format("%s.%s", integer_part, fractional_part) end - return formatted .. " " .. suffix + -- Combine parts and add suffix + return string.format("%s.%s %s", + integer_part, + fractional_part, + suffix + ):gsub("%.?0+ %k$", " "..suffix) -- Clean up trailing zeros end --- Display group From 62d818605a86b08c22ffff9292d2dcf93fc89d6c Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Thu, 13 Feb 2025 00:00:35 +0900 Subject: [PATCH 285/406] . --- exp_legacy/module/modules/gui/production.lua | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/exp_legacy/module/modules/gui/production.lua b/exp_legacy/module/modules/gui/production.lua index 20c6e51d..85f239de 100644 --- a/exp_legacy/module/modules/gui/production.lua +++ b/exp_legacy/module/modules/gui/production.lua @@ -24,7 +24,6 @@ local function format_n(amount) if math.abs(amount) < 0.009 then return "0.00" end - local suffix = "" local suffix_list = { ["T"] = 1e12, @@ -32,7 +31,6 @@ local function format_n(amount) ["M"] = 1e6, ["k"] = 1e3 } - local scale = 1 for letter, limit in pairs(suffix_list) do if math.abs(amount) >= limit then @@ -41,19 +39,15 @@ local function format_n(amount) break end end - local scaled_value = amount / scale local formatted = string.format("%.2f", scaled_value) - -- Split into integer and fractional parts local integer_part, fractional_part = formatted:match("^(%-?%d+)%.(%d+)$") integer_part = integer_part or formatted fractional_part = fractional_part or "00" - -- Add commas to integer part integer_part = integer_part:reverse():gsub("(%d%d%d)", "%1,"):reverse() integer_part = integer_part:gsub("^,", ""):gsub("-,", "-") - -- Handle numbers below 1000 without suffix if scale == 1 then -- Remove trailing .00 for whole numbers @@ -62,13 +56,9 @@ local function format_n(amount) end return string.format("%s.%s", integer_part, fractional_part) end - -- Combine parts and add suffix - return string.format("%s.%s %s", - integer_part, - fractional_part, - suffix - ):gsub("%.?0+ %k$", " "..suffix) -- Clean up trailing zeros + -- Clean up trailing zeros + return string.format("%s.%s %s", integer_part, fractional_part, suffix):gsub("%.?0+ %k$", " " .. suffix) end --- Display group From 005a5501d86b5bc7e6bfdcec8532d07cb610afec Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Thu, 13 Feb 2025 00:06:06 +0900 Subject: [PATCH 286/406] . --- exp_legacy/module/modules/gui/production.lua | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/exp_legacy/module/modules/gui/production.lua b/exp_legacy/module/modules/gui/production.lua index 85f239de..f7a6d92d 100644 --- a/exp_legacy/module/modules/gui/production.lua +++ b/exp_legacy/module/modules/gui/production.lua @@ -39,8 +39,7 @@ local function format_n(amount) break end end - local scaled_value = amount / scale - local formatted = string.format("%.2f", scaled_value) + local formatted = string.format("%.2f", amount / scale) -- Split into integer and fractional parts local integer_part, fractional_part = formatted:match("^(%-?%d+)%.(%d+)$") integer_part = integer_part or formatted @@ -50,10 +49,6 @@ local function format_n(amount) integer_part = integer_part:gsub("^,", ""):gsub("-,", "-") -- Handle numbers below 1000 without suffix if scale == 1 then - -- Remove trailing .00 for whole numbers - if fractional_part == "00" then - return integer_part - end return string.format("%s.%s", integer_part, fractional_part) end -- Combine parts and add suffix From 1ad8b3edd7c48623d3c2d542bd968ac8a3dfef61 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Thu, 13 Feb 2025 00:09:02 +0900 Subject: [PATCH 287/406] . --- exp_legacy/module/modules/gui/production.lua | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/exp_legacy/module/modules/gui/production.lua b/exp_legacy/module/modules/gui/production.lua index f7a6d92d..088bec23 100644 --- a/exp_legacy/module/modules/gui/production.lua +++ b/exp_legacy/module/modules/gui/production.lua @@ -48,12 +48,8 @@ local function format_n(amount) integer_part = integer_part:reverse():gsub("(%d%d%d)", "%1,"):reverse() integer_part = integer_part:gsub("^,", ""):gsub("-,", "-") -- Handle numbers below 1000 without suffix - if scale == 1 then - return string.format("%s.%s", integer_part, fractional_part) - end -- Combine parts and add suffix - -- Clean up trailing zeros - return string.format("%s.%s %s", integer_part, fractional_part, suffix):gsub("%.?0+ %k$", " " .. suffix) + return string.format("%s.%s%s", integer_part, fractional_part, (suffix == "" and "") or (" " .. suffix)):gsub("%.?0+ %k$", " " .. suffix) end --- Display group From 63e21e1332f668b87b7e57881371c44576bab2ec Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Thu, 13 Feb 2025 00:13:02 +0900 Subject: [PATCH 288/406] . --- exp_legacy/module/modules/gui/production.lua | 1 - 1 file changed, 1 deletion(-) diff --git a/exp_legacy/module/modules/gui/production.lua b/exp_legacy/module/modules/gui/production.lua index 088bec23..e121c822 100644 --- a/exp_legacy/module/modules/gui/production.lua +++ b/exp_legacy/module/modules/gui/production.lua @@ -26,7 +26,6 @@ local function format_n(amount) end local suffix = "" local suffix_list = { - ["T"] = 1e12, ["G"] = 1e9, ["M"] = 1e6, ["k"] = 1e3 From 5a006eaa25b868988595da0f2badee5f017aca5d Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Thu, 13 Feb 2025 00:15:36 +0900 Subject: [PATCH 289/406] . --- exp_legacy/module/modules/gui/production.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/exp_legacy/module/modules/gui/production.lua b/exp_legacy/module/modules/gui/production.lua index e121c822..951385d8 100644 --- a/exp_legacy/module/modules/gui/production.lua +++ b/exp_legacy/module/modules/gui/production.lua @@ -83,7 +83,7 @@ local production_data_group = Gui.element("production_data_group") caption = "0.0", style = "heading_2_label", } - data.style.width = 90 + data.style.width = 70 data.style.horizontal_align = "right" data.style.font_color = font_color["positive"] end @@ -96,7 +96,7 @@ local production_data_group = Gui.element("production_data_group") local production_data_set = Gui.element("production_data_set") :draw(function(_, parent, name) local production_set = parent.add{ type = "flow", direction = "vertical", name = name } - local disp = Gui.elements.scroll_table(production_set, 350, 4, "disp") + local disp = Gui.elements.scroll_table(production_set, 290, 4, "disp") production_data_group(disp, 0) disp["production_0_1"].caption = { "production.label-prod" } disp["production_0_2"].caption = { "production.label-con" } @@ -109,7 +109,7 @@ local production_data_set = Gui.element("production_data_set") production_container = Gui.element("production_container") :draw(function(def, parent) - local container = Gui.elements.container(parent, 350) + local container = Gui.elements.container(parent, 290) production_data_set(container, "production_st") return container.parent end) From 88da422f9e0ee4f9a34925348970123426d209c0 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Thu, 13 Feb 2025 00:19:40 +0900 Subject: [PATCH 290/406] . --- exp_legacy/module/modules/gui/production.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/exp_legacy/module/modules/gui/production.lua b/exp_legacy/module/modules/gui/production.lua index 951385d8..1f391acf 100644 --- a/exp_legacy/module/modules/gui/production.lua +++ b/exp_legacy/module/modules/gui/production.lua @@ -83,7 +83,7 @@ local production_data_group = Gui.element("production_data_group") caption = "0.0", style = "heading_2_label", } - data.style.width = 70 + data.style.width = 80 data.style.horizontal_align = "right" data.style.font_color = font_color["positive"] end @@ -96,7 +96,7 @@ local production_data_group = Gui.element("production_data_group") local production_data_set = Gui.element("production_data_set") :draw(function(_, parent, name) local production_set = parent.add{ type = "flow", direction = "vertical", name = name } - local disp = Gui.elements.scroll_table(production_set, 290, 4, "disp") + local disp = Gui.elements.scroll_table(production_set, 320, 4, "disp") production_data_group(disp, 0) disp["production_0_1"].caption = { "production.label-prod" } disp["production_0_2"].caption = { "production.label-con" } @@ -109,7 +109,7 @@ local production_data_set = Gui.element("production_data_set") production_container = Gui.element("production_container") :draw(function(def, parent) - local container = Gui.elements.container(parent, 290) + local container = Gui.elements.container(parent, 320) production_data_set(container, "production_st") return container.parent end) From ce73946885def62bff1e50de633b2f893a51d888 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Sun, 16 Feb 2025 12:19:46 +0900 Subject: [PATCH 291/406] . --- exp_legacy/module/modules/gui/production.lua | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/exp_legacy/module/modules/gui/production.lua b/exp_legacy/module/modules/gui/production.lua index 1f391acf..2f23f69a 100644 --- a/exp_legacy/module/modules/gui/production.lua +++ b/exp_legacy/module/modules/gui/production.lua @@ -42,13 +42,12 @@ local function format_n(amount) -- Split into integer and fractional parts local integer_part, fractional_part = formatted:match("^(%-?%d+)%.(%d+)$") integer_part = integer_part or formatted - fractional_part = fractional_part or "00" -- Add commas to integer part integer_part = integer_part:reverse():gsub("(%d%d%d)", "%1,"):reverse() integer_part = integer_part:gsub("^,", ""):gsub("-,", "-") -- Handle numbers below 1000 without suffix -- Combine parts and add suffix - return string.format("%s.%s%s", integer_part, fractional_part, (suffix == "" and "") or (" " .. suffix)):gsub("%.?0+ %k$", " " .. suffix) + return string.format("%s.%s%s", integer_part, fractional_part or "00", (suffix == "" and "") or (" " .. suffix)):gsub("%.?0+ %k$", " " .. suffix) end --- Display group From 5add829a785231261a1da7898adca320e1ab0f9c Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Sat, 22 Feb 2025 23:23:58 +0900 Subject: [PATCH 292/406] . --- exp_legacy/module/locale/en/data.cfg | 2 ++ exp_legacy/module/locale/zh-CN/data.cfg | 2 ++ exp_legacy/module/locale/zh-TW/data.cfg | 2 ++ exp_legacy/module/modules/gui/playerdata.lua | 6 ++++++ 4 files changed, 12 insertions(+) diff --git a/exp_legacy/module/locale/en/data.cfg b/exp_legacy/module/locale/en/data.cfg index a3c8944c..9ac2db17 100644 --- a/exp_legacy/module/locale/en/data.cfg +++ b/exp_legacy/module/locale/en/data.cfg @@ -110,3 +110,5 @@ NetPlayTime=Net Play Time NetPlayTime-tooltip=Net Play Time AFKTimeRatio=AFK Time Ratio AFKTimeRatio-tooltip=AFK Time over Play Time +Locale=Locale +Locale-tooltip=The language of player interface diff --git a/exp_legacy/module/locale/zh-CN/data.cfg b/exp_legacy/module/locale/zh-CN/data.cfg index 495f3f2d..3213e569 100644 --- a/exp_legacy/module/locale/zh-CN/data.cfg +++ b/exp_legacy/module/locale/zh-CN/data.cfg @@ -110,3 +110,5 @@ NetPlayTime=淨遊玩時間 NetPlayTime-tooltip=遊玩時間減掛機時間 AFKTimeRatio=掛機時間比 AFKTimeRatio-tooltip=掛機時間除以遊玩時間 +Locale=語言 +Locale-tooltip=用戶介面語言 diff --git a/exp_legacy/module/locale/zh-TW/data.cfg b/exp_legacy/module/locale/zh-TW/data.cfg index 495f3f2d..3213e569 100644 --- a/exp_legacy/module/locale/zh-TW/data.cfg +++ b/exp_legacy/module/locale/zh-TW/data.cfg @@ -110,3 +110,5 @@ NetPlayTime=淨遊玩時間 NetPlayTime-tooltip=遊玩時間減掛機時間 AFKTimeRatio=掛機時間比 AFKTimeRatio-tooltip=掛機時間除以遊玩時間 +Locale=語言 +Locale-tooltip=用戶介面語言 diff --git a/exp_legacy/module/modules/gui/playerdata.lua b/exp_legacy/module/modules/gui/playerdata.lua index 2ef6110c..8e27e1f6 100644 --- a/exp_legacy/module/modules/gui/playerdata.lua +++ b/exp_legacy/module/modules/gui/playerdata.lua @@ -72,6 +72,12 @@ local computed_stats = { return format_number_n(PlayerStats["AfkTime"]:get(player_name, 0) * 100 / PlayerStats["Playtime"]:get(player_name, 1)) end, }, + Locale = { + default = "en", + calculate = function(player_name) + return game.players[player_name].locale + end, + }, } local label = Gui.element("label") From 85f9ebd7d0922dda12e91e9a8b4032e08e244b9f Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Sat, 22 Feb 2025 23:42:26 +0900 Subject: [PATCH 293/406] . --- exp_legacy/module/modules/gui/playerdata.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exp_legacy/module/modules/gui/playerdata.lua b/exp_legacy/module/modules/gui/playerdata.lua index 8e27e1f6..ae06c750 100644 --- a/exp_legacy/module/modules/gui/playerdata.lua +++ b/exp_legacy/module/modules/gui/playerdata.lua @@ -75,7 +75,7 @@ local computed_stats = { Locale = { default = "en", calculate = function(player_name) - return game.players[player_name].locale + return player_name.locale end, }, } From b3c70e7700320fe86519978db38a3203f7b2d288 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Sun, 23 Feb 2025 12:47:01 +0900 Subject: [PATCH 294/406] . --- exp_legacy/module/modules/gui/playerdata.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/exp_legacy/module/modules/gui/playerdata.lua b/exp_legacy/module/modules/gui/playerdata.lua index ae06c750..45725f87 100644 --- a/exp_legacy/module/modules/gui/playerdata.lua +++ b/exp_legacy/module/modules/gui/playerdata.lua @@ -74,8 +74,8 @@ local computed_stats = { }, Locale = { default = "en", - calculate = function(player_name) - return player_name.locale + calculate = function(player) + return player.locale end, }, } From 510a119741e3bcee4a4df57ec8544699d7513fec Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Sun, 23 Feb 2025 14:04:07 +0900 Subject: [PATCH 295/406] . --- exp_legacy/module/modules/gui/bonus.lua | 5 ----- 1 file changed, 5 deletions(-) diff --git a/exp_legacy/module/modules/gui/bonus.lua b/exp_legacy/module/modules/gui/bonus.lua index 14f76fac..965a7a6f 100644 --- a/exp_legacy/module/modules/gui/bonus.lua +++ b/exp_legacy/module/modules/gui/bonus.lua @@ -4,7 +4,6 @@ ]] local Gui = require("modules/exp_gui") -local Storage = require("modules/exp_util/storage") local Event = require("modules/exp_legacy/utils/event") --- @dep utils.event local Roles = require("modules.exp_legacy.expcore.roles") --- @dep expcore.roles local config = require("modules.exp_legacy.config.bonus") --- @dep config.bonus @@ -17,10 +16,6 @@ local bonus_data = { score_limit = {} } -Storage.register(bonus_data, function(tbl) - bonus_data = tbl -end) - --- @param player LuaPlayer --- @param container LuaGuiElement? --- @return number From 766e96a9fcd8cb11b2c33789c22cdf7be5bb3c70 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Sun, 23 Feb 2025 14:33:39 +0900 Subject: [PATCH 296/406] . --- exp_legacy/module/modules/gui/bonus.lua | 50 ++++++++++++------------- 1 file changed, 24 insertions(+), 26 deletions(-) diff --git a/exp_legacy/module/modules/gui/bonus.lua b/exp_legacy/module/modules/gui/bonus.lua index 965a7a6f..126c0381 100644 --- a/exp_legacy/module/modules/gui/bonus.lua +++ b/exp_legacy/module/modules/gui/bonus.lua @@ -12,9 +12,7 @@ local format_number = require("util").format_number --- @dep util local bonus_container -local bonus_data = { - score_limit = {} -} +local bonus_data_score_limit = {} --- @param player LuaPlayer --- @param container LuaGuiElement? @@ -106,8 +104,10 @@ local function apply_periodic_bonus(player) end end -local function bonus_score_limit_calc(player) - return math.floor(config.pts.base * (1 + config.pts.increase_percentage_per_role_level * (Roles.get_role_by_name(config.pts.role_name).index - Roles.get_player_highest_role(player).index))) +local function bonus_score_limit(player) + if not bonus_data_score_limit[player] then + bonus_data_score_limit[player] = math.floor(config.pts.base * (1 + config.pts.increase_percentage_per_role_level * (Roles.get_role_by_name(config.pts.role_name).index - Roles.get_player_highest_role(player).index))) + end end --- Control label for the bonus points available @@ -158,9 +158,9 @@ local bonus_gui_control_reset = Gui.element("bonus_gui_control_reset") disp[slider.tags.counter].caption = format_number(slider.slider_value, false) local n = bonus_gui_pts_needed(player) - bonus_data.score_limit[player] = bonus_score_limit_calc(player) - element.parent[bonus_gui_control_pts_count.name].caption = n .. " / " .. bonus_data.score_limit[player] - element.parent[bonus_gui_control_pts_count.name].value = n / bonus_data.score_limit[player] + bonus_score_limit(player) + element.parent[bonus_gui_control_pts_count.name].caption = n .. " / " .. bonus_data_score_limit[player] + element.parent[bonus_gui_control_pts_count.name].value = n / bonus_data_score_limit[player] end) --- A button used for pts apply @@ -174,11 +174,11 @@ local bonus_gui_control_apply = Gui.element("bonus_gui_control_apply") width = config.gui_display_width["half"], }:on_click(function(def, player, element) local n = bonus_gui_pts_needed(player) - bonus_data.score_limit[player] = bonus_score_limit_calc(player) - element.parent[bonus_gui_control_pts_count.name].caption = n .. " / " .. bonus_data.score_limit[player] - element.parent[bonus_gui_control_pts_count.name].value = n / bonus_data.score_limit[player] + bonus_score_limit(player) + element.parent[bonus_gui_control_pts_count.name].caption = n .. " / " .. bonus_data_score_limit[player] + element.parent[bonus_gui_control_pts_count.name].value = n / bonus_data_score_limit[player] - if n <= bonus_data.score_limit[player] then + if n <= bonus_data_score_limit[player] then apply_bonus(player) end end) @@ -241,9 +241,9 @@ local bonus_gui_slider = Gui.element("bonus_gui_slider") local container = Gui.get_left_element(bonus_container, player) local disp = container.frame["bonus_st_1"].disp.table local n = bonus_gui_pts_needed(player) - bonus_data.score_limit[player] = bonus_score_limit_calc(player) - disp[bonus_gui_control_pts_count.name].caption = n .. " / " .. bonus_data.score_limit[player] - disp[bonus_gui_control_pts_count.name].value = n / bonus_data.score_limit[player] + bonus_score_limit(player) + disp[bonus_gui_control_pts_count.name].caption = n .. " / " .. bonus_data_score_limit[player] + disp[bonus_gui_control_pts_count.name].value = n / bonus_data_score_limit[player] end) --- A vertical flow containing all the bonus data @@ -274,9 +274,9 @@ bonus_container = Gui.element("bonus_container") local disp = container["bonus_st_1"].disp.table local n = bonus_gui_pts_needed(player, container.parent) - bonus_data.score_limit[player] = bonus_score_limit_calc(player) - disp[bonus_gui_control_pts_count.name].caption = n .. " / " .. bonus_data.score_limit[player] - disp[bonus_gui_control_pts_count.name].value = n / bonus_data.score_limit[player] + bonus_score_limit(player) + disp[bonus_gui_control_pts_count.name].caption = n .. " / " .. bonus_data_score_limit[player] + disp[bonus_gui_control_pts_count.name].value = n / bonus_data_score_limit[player] return container.parent end) @@ -309,14 +309,12 @@ end) Event.add(Roles.events.on_role_assigned, function(event) local player = game.players[event.player_index] - bonus_data.score_limit[player] = bonus_score_limit_calc(player) - apply_bonus(player) + bonus_data_score_limit[player] = nil end) Event.add(Roles.events.on_role_unassigned, function(event) local player = game.players[event.player_index] - bonus_data.score_limit[player] = bonus_score_limit_calc(player) - apply_bonus(player) + bonus_data_score_limit[player] = nil end) --- When a player respawns re-apply bonus @@ -325,11 +323,11 @@ Event.add(defines.events.on_player_respawned, function(event) local container = Gui.get_left_element(bonus_container, player) local disp = container.frame["bonus_st_1"].disp.table local n = bonus_gui_pts_needed(player) - bonus_data.score_limit[player] = bonus_score_limit_calc(player) - disp[bonus_gui_control_pts_count.name].caption = n .. " / " .. bonus_data.score_limit[player] - disp[bonus_gui_control_pts_count.name].value = n / bonus_data.score_limit[player] + bonus_score_limit(player) + disp[bonus_gui_control_pts_count.name].caption = n .. " / " .. bonus_data_score_limit[player] + disp[bonus_gui_control_pts_count.name].value = n / bonus_data_score_limit[player] - if n <= bonus_data.score_limit[player] then + if n <= bonus_data_score_limit[player] then apply_bonus(player) end end) From 52c688788710e1f467e42abd64a7cafe23ffc47d Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Sun, 23 Feb 2025 14:34:02 +0900 Subject: [PATCH 297/406] . --- exp_legacy/module/modules/gui/bonus.lua | 1 - 1 file changed, 1 deletion(-) diff --git a/exp_legacy/module/modules/gui/bonus.lua b/exp_legacy/module/modules/gui/bonus.lua index 126c0381..2f3c3e8d 100644 --- a/exp_legacy/module/modules/gui/bonus.lua +++ b/exp_legacy/module/modules/gui/bonus.lua @@ -11,7 +11,6 @@ local vlayer = require("modules.exp_legacy.modules.control.vlayer") local format_number = require("util").format_number --- @dep util local bonus_container - local bonus_data_score_limit = {} --- @param player LuaPlayer From 60279c4a4947fe5dac47487b1b4a16acbc0cb276 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Sun, 23 Feb 2025 14:47:07 +0900 Subject: [PATCH 298/406] . --- exp_legacy/module/modules/gui/production.lua | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/exp_legacy/module/modules/gui/production.lua b/exp_legacy/module/modules/gui/production.lua index 2f23f69a..902c8f96 100644 --- a/exp_legacy/module/modules/gui/production.lua +++ b/exp_legacy/module/modules/gui/production.lua @@ -26,9 +26,9 @@ local function format_n(amount) end local suffix = "" local suffix_list = { - ["G"] = 1e9, - ["M"] = 1e6, - ["k"] = 1e3 + [" G"] = 1e9, + [" M"] = 1e6, + [" k"] = 1e3 } local scale = 1 for letter, limit in pairs(suffix_list) do @@ -38,16 +38,11 @@ local function format_n(amount) break end end - local formatted = string.format("%.2f", amount / scale) + local formatted = string.format("%.2f%s", amount / scale, suffix) -- Split into integer and fractional parts - local integer_part, fractional_part = formatted:match("^(%-?%d+)%.(%d+)$") - integer_part = integer_part or formatted + local integer_part, fractional_part = formatted:match("^(%-?%d+)%.(%d+)(.*)$") -- Add commas to integer part - integer_part = integer_part:reverse():gsub("(%d%d%d)", "%1,"):reverse() - integer_part = integer_part:gsub("^,", ""):gsub("-,", "-") - -- Handle numbers below 1000 without suffix - -- Combine parts and add suffix - return string.format("%s.%s%s", integer_part, fractional_part or "00", (suffix == "" and "") or (" " .. suffix)):gsub("%.?0+ %k$", " " .. suffix) + return string.format("%s.%s%s", (integer_part or formatted):reverse():gsub("(%d%d%d)", "%1,"):reverse():gsub("^,", ""):gsub("-,", "-"), (fractional_part or "00"), suffix):gsub("%.00([ ]?[GMk])$", "%1") end --- Display group From 5800d4a590a3db69785691c2993dc897e471f941 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Sun, 23 Feb 2025 14:52:28 +0900 Subject: [PATCH 299/406] . --- exp_legacy/module/modules/gui/production.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exp_legacy/module/modules/gui/production.lua b/exp_legacy/module/modules/gui/production.lua index 902c8f96..87ab609e 100644 --- a/exp_legacy/module/modules/gui/production.lua +++ b/exp_legacy/module/modules/gui/production.lua @@ -42,7 +42,7 @@ local function format_n(amount) -- Split into integer and fractional parts local integer_part, fractional_part = formatted:match("^(%-?%d+)%.(%d+)(.*)$") -- Add commas to integer part - return string.format("%s.%s%s", (integer_part or formatted):reverse():gsub("(%d%d%d)", "%1,"):reverse():gsub("^,", ""):gsub("-,", "-"), (fractional_part or "00"), suffix):gsub("%.00([ ]?[GMk])$", "%1") + return string.format("%s.%s%s", (integer_part or formatted):reverse():gsub("(%d%d%d)", "%1,"):reverse():gsub("^,", ""):gsub("-,", "-"), fractional_part or "00", suffix) end --- Display group From 261041edd3b0829b8825efa2290d2ada7ff84e93 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Mon, 24 Feb 2025 17:06:55 +0900 Subject: [PATCH 300/406] . --- exp_legacy/module/modules/control/vlayer.lua | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/exp_legacy/module/modules/control/vlayer.lua b/exp_legacy/module/modules/control/vlayer.lua index 800b824f..a2367e1d 100644 --- a/exp_legacy/module/modules/control/vlayer.lua +++ b/exp_legacy/module/modules/control/vlayer.lua @@ -541,6 +541,12 @@ function vlayer.get_circuits() } end +local vlayer_circuits_string = "" + +for key, value in pairs(vlayer.get_circuits()) do + vlayer_circuits_string = vlayer_circuits_string .. value .. " = " .. key .. "\n" +end + --- Create a new circuit interface -- @tparam LuaSurface surface The surface to place the interface onto -- @tparam MapPosition position The position on the surface to place the interface at @@ -610,6 +616,8 @@ local function handle_circuit_interfaces() circuit_oc.clear_slot(clear_index) end + + circuit_oc.combinator_description = vlayer_circuits_string end end end From 9786c95edaafc9c6c44fe9850264e3d4a5357014 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Mon, 24 Feb 2025 17:15:44 +0900 Subject: [PATCH 301/406] . --- exp_legacy/module/modules/control/vlayer.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exp_legacy/module/modules/control/vlayer.lua b/exp_legacy/module/modules/control/vlayer.lua index a2367e1d..475de868 100644 --- a/exp_legacy/module/modules/control/vlayer.lua +++ b/exp_legacy/module/modules/control/vlayer.lua @@ -617,7 +617,7 @@ local function handle_circuit_interfaces() circuit_oc.clear_slot(clear_index) end - circuit_oc.combinator_description = vlayer_circuits_string + interface.combinator_description = vlayer_circuits_string end end end From 36931d9bb106902d6ea38605bf0dd19287ffd495 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Mon, 24 Feb 2025 17:25:19 +0900 Subject: [PATCH 302/406] . --- exp_legacy/module/modules/control/vlayer.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/exp_legacy/module/modules/control/vlayer.lua b/exp_legacy/module/modules/control/vlayer.lua index 475de868..6611b756 100644 --- a/exp_legacy/module/modules/control/vlayer.lua +++ b/exp_legacy/module/modules/control/vlayer.lua @@ -333,6 +333,7 @@ end -- @treturn LuaEntity The entity that was created for the interface function vlayer.create_input_interface(surface, position, circuit, last_user) local interface = surface.create_entity{ name = "storage-chest", position = position, force = "neutral" } + interface.storage_filter = { name = "deconstruction-planner", quality = "normal" } table.insert(vlayer_data.entity_interfaces.storage_input, interface) if last_user then From 4e7776bc2db64c4eab18158a2e1e1426f20f4c52 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Mon, 24 Feb 2025 17:44:39 +0900 Subject: [PATCH 303/406] . --- exp_legacy/module/modules/control/vlayer.lua | 3 +++ 1 file changed, 3 insertions(+) diff --git a/exp_legacy/module/modules/control/vlayer.lua b/exp_legacy/module/modules/control/vlayer.lua index 6611b756..d01b7bb6 100644 --- a/exp_legacy/module/modules/control/vlayer.lua +++ b/exp_legacy/module/modules/control/vlayer.lua @@ -31,6 +31,7 @@ local vlayer_data = { items = {}, power_items = {}, energy = 0, + load = 0, unallocated = {}, }, surface = table.deep_copy(config.surface), @@ -514,6 +515,7 @@ function vlayer.get_statistics() energy_sustained = vdp * gsm, energy_capacity = vlayer_data.properties.capacity * mega, energy_storage = vlayer_data.storage.energy, + energy_load = vlayer_data.storage.load, day_time = math.floor(vlayer_data.surface.daytime * vlayer_data.surface.ticks_per_day), day_length = vlayer_data.surface.ticks_per_day, tick = game.tick, @@ -536,6 +538,7 @@ function vlayer.get_circuits() energy_sustained = "signal-S", energy_capacity = "signal-C", energy_storage = "signal-E", + energy_load = "signal-O", day_time = "signal-D", day_length = "signal-L", tick = "signal-T", From 082ee900f4cf8058dcc76664e275e31bea72f47f Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Mon, 24 Feb 2025 18:02:03 +0900 Subject: [PATCH 304/406] . --- exp_legacy/module/config/spawn_area.lua | 88 ++++++++++---------- exp_legacy/module/modules/control/vlayer.lua | 16 ++++ 2 files changed, 60 insertions(+), 44 deletions(-) diff --git a/exp_legacy/module/config/spawn_area.lua b/exp_legacy/module/config/spawn_area.lua index 5540faa0..24455dba 100644 --- a/exp_legacy/module/config/spawn_area.lua +++ b/exp_legacy/module/config/spawn_area.lua @@ -5,77 +5,77 @@ return { spawn_area = { --- @setting spawn_area Settings relating to the whole spawn area -- Enable predefined patches: 128, else: 32 deconstruction_radius = 12, -- @setting deconstruction_radius All entities within this radius will be removed - deconstruction_tile = 'refined-concrete', --- @setting deconstruction_tile Tile to be placed in the deconstruction radius, use nil for map gen + deconstruction_tile = "refined-concrete", --- @setting deconstruction_tile Tile to be placed in the deconstruction radius, use nil for map gen tile_radius = 14, landfill_radius = 16, --- @setting pattern_radius All water within this radius will be land filled }, turrets = { --- @setting turrets Settings relating to adding turrets to spawn enabled = true, --- @setting enabled Whether turrets will be added to spawn - ammo_type = 'uranium-rounds-magazine', --- @setting ammo_type The ammo type that will be used during refills - refill_time = 60*60*5, --- @setting refill_time The time in ticks between each refill of the turrets, only change if having lag issues - offset = {x=0, y=0}, --- @setting offset The position offset to apply to turrets + ammo_type = "uranium-rounds-magazine", --- @setting ammo_type The ammo type that will be used during refills + refill_time = 60 * 60 * 5, --- @setting refill_time The time in ticks between each refill of the turrets, only change if having lag issues + offset = { x = 0, y = 0 }, --- @setting offset The position offset to apply to turrets locations = { --- @setting locations The locations of all turrets, this list can change during runtime - {surface=1, position={x=2, y=2}}, - {surface=1, position={x=2, y=-2}}, - {surface=1, position={x=-2, y=2}}, - {surface=1, position={x=-2, y=-2}}, + { surface = 1, position = { x = 2, y = 2 } }, + { surface = 1, position = { x = 2, y = -2 } }, + { surface = 1, position = { x = -2, y = 2 } }, + { surface = 1, position = { x = -2, y = -2 } }, } }, afk_belts = { --- @setting afk_belts Settings relating to adding afk belts to spawn enabled = true, --- @setting enabled Whether afk belts will be added to spawn - belt_type = 'transport-belt', --- @setting belt_type The belt to be used as afk belts + belt_type = "transport-belt", --- @setting belt_type The belt to be used as afk belts protected = true, --- @setting protected Whether belts will be protected from player interaction - offset = {x=0, y=0}, --- @setting offset The position offset to apply to afk belts - locations={ --- @setting locations The locations to spawn afk belts at, given as the top left position - {4, 4}, - {4, -4}, - {-4, 4}, - {-4, -4} + offset = { x = 0, y = 0 }, --- @setting offset The position offset to apply to afk belts + locations = { --- @setting locations The locations to spawn afk belts at, given as the top left position + { 4, 4 }, + { 4, -4 }, + { -4, 4 }, + { -4, -4 } } }, water = { --- @setting water Settings relating to adding water to spawn enabled = true, --- @setting enabled Whether water tiles will be added to spawn - water_tile = 'water-mud', --- @setting water_tile The tile to be used as the water tile - offset = {x=0, y=0}, --- @setting offset The position offset to apply to water tiles + water_tile = "water-mud", --- @setting water_tile The tile to be used as the water tile + offset = { x = 0, y = 0 }, --- @setting offset The position offset to apply to water tiles locations = { --- @setting locations The location of the water tiles {x,y} -- Each is a 3x3 with the closest tile to 0,0 removed - {5, 6}, {5, 7}, {6, 5}, {6, 6}, {6, 7}, {7, 5}, {7, 6}, {7, 7}, - {5, -7}, {5, -8}, {6, -6}, {6, -7}, {6, -8}, {7, -6}, {7, -7}, {7, -8}, - {-6, 6}, {-6, 7}, {-7, 5}, {-7, 6}, {-7, 7}, {-8, 5}, {-8, 6}, {-8, 7}, - {-6, -7}, {-6, -8}, {-7, -6}, {-7, -7}, {-7, -8}, {-8, -6}, {-8, -7}, {-8, -8}, + { 5, 6 }, { 5, 7 }, { 6, 5 }, { 6, 6 }, { 6, 7 }, { 7, 5 }, { 7, 6 }, { 7, 7 }, + { 5, -7 }, { 5, -8 }, { 6, -6 }, { 6, -7 }, { 6, -8 }, { 7, -6 }, { 7, -7 }, { 7, -8 }, + { -6, 6 }, { -6, 7 }, { -7, 5 }, { -7, 6 }, { -7, 7 }, { -8, 5 }, { -8, 6 }, { -8, 7 }, + { -6, -7 }, { -6, -8 }, { -7, -6 }, { -7, -7 }, { -7, -8 }, { -8, -6 }, { -8, -7 }, { -8, -8 }, } }, entities = { --- @setting entities Settings relating to adding entities to spawn - enabled = true, --- @setting enabled Whether entities will be added to spawn + enabled = true, --- @setting enabled Whether entities will be added to spawn protected = true, --- @setting protected Whether entities will be protected from player interaction operable = true, --- @setting operable Whether entities can be opened by players, must be true if chests are used - offset = {x=0, y=0}, --- @setting offset The position offset to apply to entities + offset = { x = 0, y = 0 }, --- @setting offset The position offset to apply to entities locations = { --- @setting locations The location and names of entities {name,x,y} - {'steel-chest', 1, 3}, {'steel-chest', 1, 4}, {'steel-chest', 1, 5}, - {'steel-chest', 3, 1}, {'steel-chest', 4, 1}, {'steel-chest', 5, 1}, - {'steel-chest', 1, -4}, {'steel-chest', 1, -5}, {'steel-chest', 1, -6}, - {'steel-chest', 3, -2}, {'steel-chest', 4, -2}, {'steel-chest', 5, -2}, - {'steel-chest', -2, 3}, {'steel-chest', -2, 4}, {'steel-chest', -2, 5}, - {'steel-chest', -4, 1}, {'steel-chest', -5, 1}, {'steel-chest', -6, 1}, - {'steel-chest', -2, -4}, {'steel-chest', -2, -5}, {'steel-chest', -2, -6}, - {'steel-chest', -4, -2}, {'steel-chest', -5, -2}, {'steel-chest', -6, -2}, - {'medium-electric-pole', 2, 3}, {'medium-electric-pole', 2, -4}, {'medium-electric-pole', -3, 3}, {'medium-electric-pole', -3, -4}, - {'small-lamp', 2, 4}, {'small-lamp', 2, -5}, {'small-lamp', -3, 4}, {'small-lamp', -3, -5}, - {'small-lamp', 4, 2}, {'small-lamp', 4, -3}, {'small-lamp', -5, 2}, {'small-lamp', -5, -3}, - {'stone-wall', 1, 7}, {'stone-wall', 2, 7}, {'stone-wall', 3, 7}, {'stone-wall', 4, 7}, - {'stone-wall', 7, 1}, {'stone-wall', 7, 2}, {'stone-wall', 7, 3}, {'stone-wall', 7, 4}, - {'stone-wall', 1, -8}, {'stone-wall', 2, -8}, {'stone-wall', 3, -8}, {'stone-wall', 4, -8}, - {'stone-wall', 7, -2}, {'stone-wall', 7, -3}, {'stone-wall', 7, -4}, {'stone-wall', 7, -5}, - {'stone-wall', -2, 7}, {'stone-wall', -3, 7}, {'stone-wall', -4, 7}, {'stone-wall', -5, 7}, - {'stone-wall', -8, 1}, {'stone-wall', -8, 2}, {'stone-wall', -8, 3}, {'stone-wall', -8, 4}, - {'stone-wall', -2, -8}, {'stone-wall', -3, -8}, {'stone-wall', -4, -8}, {'stone-wall', -5, -8}, - {'stone-wall', -8, -2}, {'stone-wall', -8, -3}, {'stone-wall', -8, -4}, {'stone-wall', -8, -5}, + { "steel-chest", 1, 3 }, { "steel-chest", 1, 4 }, { "steel-chest", 1, 5 }, + { "steel-chest", 3, 1 }, { "steel-chest", 4, 1 }, { "steel-chest", 5, 1 }, + { "steel-chest", 1, -4 }, { "steel-chest", 1, -5 }, { "steel-chest", 1, -6 }, + { "steel-chest", 3, -2 }, { "steel-chest", 4, -2 }, { "steel-chest", 5, -2 }, + { "steel-chest", -2, 3 }, { "steel-chest", -2, 4 }, { "steel-chest", -2, 5 }, + { "steel-chest", -4, 1 }, { "steel-chest", -5, 1 }, { "steel-chest", -6, 1 }, + { "steel-chest", -2, -4 }, { "steel-chest", -2, -5 }, { "steel-chest", -2, -6 }, + { "steel-chest", -4, -2 }, { "steel-chest", -5, -2 }, { "steel-chest", -6, -2 }, + { "medium-electric-pole", 2, 3 }, { "medium-electric-pole", 2, -4 }, { "medium-electric-pole", -3, 3 }, { "medium-electric-pole", -3, -4 }, + { "small-lamp", 2, 4 }, { "small-lamp", 2, -5 }, { "small-lamp", -3, 4 }, { "small-lamp", -3, -5 }, + { "small-lamp", 4, 2 }, { "small-lamp", 4, -3 }, { "small-lamp", -5, 2 }, { "small-lamp", -5, -3 }, + { "stone-wall", 1, 7 }, { "stone-wall", 2, 7 }, { "stone-wall", 3, 7 }, { "stone-wall", 4, 7 }, + { "stone-wall", 7, 1 }, { "stone-wall", 7, 2 }, { "stone-wall", 7, 3 }, { "stone-wall", 7, 4 }, + { "stone-wall", 1, -8 }, { "stone-wall", 2, -8 }, { "stone-wall", 3, -8 }, { "stone-wall", 4, -8 }, + { "stone-wall", 7, -2 }, { "stone-wall", 7, -3 }, { "stone-wall", 7, -4 }, { "stone-wall", 7, -5 }, + { "stone-wall", -2, 7 }, { "stone-wall", -3, 7 }, { "stone-wall", -4, 7 }, { "stone-wall", -5, 7 }, + { "stone-wall", -8, 1 }, { "stone-wall", -8, 2 }, { "stone-wall", -8, 3 }, { "stone-wall", -8, 4 }, + { "stone-wall", -2, -8 }, { "stone-wall", -3, -8 }, { "stone-wall", -4, -8 }, { "stone-wall", -5, -8 }, + { "stone-wall", -8, -2 }, { "stone-wall", -8, -3 }, { "stone-wall", -8, -4 }, { "stone-wall", -8, -5 }, } }, pattern = { enabled = false, --- @setting enabled Whether pattern tiles will be added to spawn - pattern_tile = 'refined-concrete', --- @setting pattern_tile The tile to be used for the pattern - offset = {x=0, y=0}, --- @setting offset The position offset to apply to pattern tiles + pattern_tile = "refined-concrete", --- @setting pattern_tile The tile to be used for the pattern + offset = { x = 0, y = 0 }, --- @setting offset The position offset to apply to pattern tiles locations = { --- @setting locations The location of the pattern tiles {x,y} } }, diff --git a/exp_legacy/module/modules/control/vlayer.lua b/exp_legacy/module/modules/control/vlayer.lua index d01b7bb6..4013381e 100644 --- a/exp_legacy/module/modules/control/vlayer.lua +++ b/exp_legacy/module/modules/control/vlayer.lua @@ -8,6 +8,7 @@ local ExpUtil = require("modules/exp_util") local Storage = require("modules/exp_util/storage") local Event = require("modules/exp_legacy/utils/event") --- @dep utils.event local config = require("modules.exp_legacy.config.vlayer") --- @dep config.vlayer +local config_spawn = require("modules.exp_legacy.config.spawn_area") --- @dep config.spawn_area local mega = 1000000 @@ -37,6 +38,14 @@ local vlayer_data = { surface = table.deep_copy(config.surface), } +local spawn_pole = {} + +for _, v in pairs(config_spawn.entities.location) do + if v[1] == "small-electric-pole" or v[1] == "medium-electric-pole" then + table.insert(spawn_pole, v) + end +end + Storage.register(vlayer_data, function(tbl) vlayer_data = tbl end) @@ -579,6 +588,12 @@ function vlayer.create_circuit_interface(surface, position, circuit, last_user) return interface end +--- Calculate the current power load to provide a better view for the user +local function handle_circuit_power_load() + for index, interface in pairs(vlayer_data.entity_interfaces.circuit) do + end +end + --- Handle all circuit interfaces, updating their signals to match the vlayer statistics local function handle_circuit_interfaces() local stats = vlayer.get_statistics() @@ -787,6 +802,7 @@ Event.on_nth_tick(config.update_tick_storage, function(_) handle_input_interfaces() handle_output_interfaces() handle_unallocated() + handle_circuit_power_load() end) --- Handle all energy and circuit updates From 67ce09f96e27af3d17984d62876b857345cf4c02 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Mon, 24 Feb 2025 18:33:28 +0900 Subject: [PATCH 305/406] . --- exp_legacy/module/modules/control/vlayer.lua | 30 +++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/exp_legacy/module/modules/control/vlayer.lua b/exp_legacy/module/modules/control/vlayer.lua index 4013381e..0bd95cc8 100644 --- a/exp_legacy/module/modules/control/vlayer.lua +++ b/exp_legacy/module/modules/control/vlayer.lua @@ -590,8 +590,36 @@ end --- Calculate the current power load to provide a better view for the user local function handle_circuit_power_load() - for index, interface in pairs(vlayer_data.entity_interfaces.circuit) do + local processed = {} + local pi = 0 + local po = 0 + + for _, v in pairs(spawn_pole) do + local e = game.surfaces[1].find_entity(v[1], { x = v[2], y = v[3] }) + + if e and e.valid and e.is_connected_to_electric_network() and e.electric_network_id and not processed[e.electric_network_id] then + local ens = e.electric_network_statistics + local ensi = 0 + local enso = 0 + + for _, c in pairs(ens.input_counts) do + ensi = ensi + c + end + + for _, c in pairs(ens.output_counts) do + enso = enso + c + end + + processed[e.electric_network_id] = { i = ensi, o = enso } + end end + + for _, v in pairs(processed) do + pi = pi + v.i + po = po + v.o + end + + vlayer_data.storage.load = pi * 10000 / po end --- Handle all circuit interfaces, updating their signals to match the vlayer statistics From 609796070f6f9f342dc5090f356f01710a61a283 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Mon, 24 Feb 2025 18:36:29 +0900 Subject: [PATCH 306/406] . --- exp_legacy/module/modules/control/vlayer.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exp_legacy/module/modules/control/vlayer.lua b/exp_legacy/module/modules/control/vlayer.lua index 0bd95cc8..66c8f31c 100644 --- a/exp_legacy/module/modules/control/vlayer.lua +++ b/exp_legacy/module/modules/control/vlayer.lua @@ -40,7 +40,7 @@ local vlayer_data = { local spawn_pole = {} -for _, v in pairs(config_spawn.entities.location) do +for _, v in pairs(config_spawn.entities.locations) do if v[1] == "small-electric-pole" or v[1] == "medium-electric-pole" then table.insert(spawn_pole, v) end From 32723e388b2511e46a8b8062429e2d0bc94cbbfd Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Mon, 24 Feb 2025 18:37:55 +0900 Subject: [PATCH 307/406] . --- exp_legacy/module/modules/control/vlayer.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/exp_legacy/module/modules/control/vlayer.lua b/exp_legacy/module/modules/control/vlayer.lua index 66c8f31c..206f14ad 100644 --- a/exp_legacy/module/modules/control/vlayer.lua +++ b/exp_legacy/module/modules/control/vlayer.lua @@ -518,13 +518,13 @@ function vlayer.get_statistics() remaining_surface_area = gald, surface_area = vlayer_data.properties.total_surface_area - gald, production_multiplier = gdm, + current_load = vlayer_data.storage.load, energy_max = vdp, energy_production = vdp * gdm, energy_total_production = vlayer_data.properties.total_production * gsm * mega, energy_sustained = vdp * gsm, energy_capacity = vlayer_data.properties.capacity * mega, energy_storage = vlayer_data.storage.energy, - energy_load = vlayer_data.storage.load, day_time = math.floor(vlayer_data.surface.daytime * vlayer_data.surface.ticks_per_day), day_length = vlayer_data.surface.ticks_per_day, tick = game.tick, @@ -543,11 +543,11 @@ function vlayer.get_circuits() used_surface_area = "signal-U", remaining_surface_area = "signal-R", production_multiplier = "signal-M", + current_load = "signal-O", energy_production = "signal-P", energy_sustained = "signal-S", energy_capacity = "signal-C", energy_storage = "signal-E", - energy_load = "signal-O", day_time = "signal-D", day_length = "signal-L", tick = "signal-T", From 36c65cbea06cf0b476a52e7437f2ce032a9dcebf Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Mon, 24 Feb 2025 18:40:38 +0900 Subject: [PATCH 308/406] . --- exp_legacy/module/modules/control/vlayer.lua | 73 ++++++++++---------- 1 file changed, 36 insertions(+), 37 deletions(-) diff --git a/exp_legacy/module/modules/control/vlayer.lua b/exp_legacy/module/modules/control/vlayer.lua index 206f14ad..272be7c2 100644 --- a/exp_legacy/module/modules/control/vlayer.lua +++ b/exp_legacy/module/modules/control/vlayer.lua @@ -32,7 +32,6 @@ local vlayer_data = { items = {}, power_items = {}, energy = 0, - load = 0, unallocated = {}, }, surface = table.deep_copy(config.surface), @@ -505,12 +504,47 @@ local function handle_unallocated() end end +--- Calculate the current power load to provide a better view for the user +local function handle_circuit_power_load() + local processed = {} + local pi = 0 + local po = 0 + + for _, v in pairs(spawn_pole) do + local e = game.surfaces[1].find_entity(v[1], { x = v[2], y = v[3] }) + + if e and e.valid and e.is_connected_to_electric_network() and e.electric_network_id and not processed[e.electric_network_id] then + local ens = e.electric_network_statistics + local ensi = 0 + local enso = 0 + + for _, c in pairs(ens.input_counts) do + ensi = ensi + c + end + + for _, c in pairs(ens.output_counts) do + enso = enso + c + end + + processed[e.electric_network_id] = { i = ensi, o = enso } + end + end + + for _, v in pairs(processed) do + pi = pi + v.i + po = po + v.o + end + + return pi * 10000 / po +end + --- Get the statistics for the vlayer function vlayer.get_statistics() local vdp = vlayer_data.properties.production * mega local gdm = get_production_multiplier() local gsm = get_sustained_multiplier() local gald = get_actual_land_defecit() + local cl = handle_circuit_power_load() return { total_surface_area = vlayer_data.properties.total_surface_area, @@ -518,7 +552,7 @@ function vlayer.get_statistics() remaining_surface_area = gald, surface_area = vlayer_data.properties.total_surface_area - gald, production_multiplier = gdm, - current_load = vlayer_data.storage.load, + current_load = cl, energy_max = vdp, energy_production = vdp * gdm, energy_total_production = vlayer_data.properties.total_production * gsm * mega, @@ -588,40 +622,6 @@ function vlayer.create_circuit_interface(surface, position, circuit, last_user) return interface end ---- Calculate the current power load to provide a better view for the user -local function handle_circuit_power_load() - local processed = {} - local pi = 0 - local po = 0 - - for _, v in pairs(spawn_pole) do - local e = game.surfaces[1].find_entity(v[1], { x = v[2], y = v[3] }) - - if e and e.valid and e.is_connected_to_electric_network() and e.electric_network_id and not processed[e.electric_network_id] then - local ens = e.electric_network_statistics - local ensi = 0 - local enso = 0 - - for _, c in pairs(ens.input_counts) do - ensi = ensi + c - end - - for _, c in pairs(ens.output_counts) do - enso = enso + c - end - - processed[e.electric_network_id] = { i = ensi, o = enso } - end - end - - for _, v in pairs(processed) do - pi = pi + v.i - po = po + v.o - end - - vlayer_data.storage.load = pi * 10000 / po -end - --- Handle all circuit interfaces, updating their signals to match the vlayer statistics local function handle_circuit_interfaces() local stats = vlayer.get_statistics() @@ -830,7 +830,6 @@ Event.on_nth_tick(config.update_tick_storage, function(_) handle_input_interfaces() handle_output_interfaces() handle_unallocated() - handle_circuit_power_load() end) --- Handle all energy and circuit updates From 51d266a667b86a765cb6422696de490961fbd3cb Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Mon, 24 Feb 2025 18:42:53 +0900 Subject: [PATCH 309/406] . --- exp_legacy/module/modules/control/vlayer.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/exp_legacy/module/modules/control/vlayer.lua b/exp_legacy/module/modules/control/vlayer.lua index 272be7c2..1e1b3ab7 100644 --- a/exp_legacy/module/modules/control/vlayer.lua +++ b/exp_legacy/module/modules/control/vlayer.lua @@ -41,7 +41,7 @@ local spawn_pole = {} for _, v in pairs(config_spawn.entities.locations) do if v[1] == "small-electric-pole" or v[1] == "medium-electric-pole" then - table.insert(spawn_pole, v) + table.insert(spawn_pole, { n = v[1], p = { x = v[2], y = v[3] } }) end end @@ -511,7 +511,7 @@ local function handle_circuit_power_load() local po = 0 for _, v in pairs(spawn_pole) do - local e = game.surfaces[1].find_entity(v[1], { x = v[2], y = v[3] }) + local e = game.surfaces[1].find_entity(v.n, v.p) if e and e.valid and e.is_connected_to_electric_network() and e.electric_network_id and not processed[e.electric_network_id] then local ens = e.electric_network_statistics From 17b53a6695c2a4eb1528d4612c8441a49462e1ff Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Mon, 24 Feb 2025 18:46:08 +0900 Subject: [PATCH 310/406] . --- exp_legacy/module/modules/control/vlayer.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exp_legacy/module/modules/control/vlayer.lua b/exp_legacy/module/modules/control/vlayer.lua index 1e1b3ab7..0b6a241d 100644 --- a/exp_legacy/module/modules/control/vlayer.lua +++ b/exp_legacy/module/modules/control/vlayer.lua @@ -535,7 +535,7 @@ local function handle_circuit_power_load() po = po + v.o end - return pi * 10000 / po + return (pi * 10000 / po) or 0 end --- Get the statistics for the vlayer From 07fe643d030767ed0309dd2df95c727e4a1784b8 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Mon, 24 Feb 2025 18:47:57 +0900 Subject: [PATCH 311/406] . --- exp_legacy/module/modules/control/vlayer.lua | 6 ------ 1 file changed, 6 deletions(-) diff --git a/exp_legacy/module/modules/control/vlayer.lua b/exp_legacy/module/modules/control/vlayer.lua index 0b6a241d..754608f7 100644 --- a/exp_legacy/module/modules/control/vlayer.lua +++ b/exp_legacy/module/modules/control/vlayer.lua @@ -512,29 +512,23 @@ local function handle_circuit_power_load() for _, v in pairs(spawn_pole) do local e = game.surfaces[1].find_entity(v.n, v.p) - if e and e.valid and e.is_connected_to_electric_network() and e.electric_network_id and not processed[e.electric_network_id] then local ens = e.electric_network_statistics local ensi = 0 local enso = 0 - for _, c in pairs(ens.input_counts) do ensi = ensi + c end - for _, c in pairs(ens.output_counts) do enso = enso + c end - processed[e.electric_network_id] = { i = ensi, o = enso } end end - for _, v in pairs(processed) do pi = pi + v.i po = po + v.o end - return (pi * 10000 / po) or 0 end From 8880eb6a57596916fe2769e737cdf773c1cb655d Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Mon, 24 Feb 2025 18:52:54 +0900 Subject: [PATCH 312/406] . --- exp_legacy/module/modules/control/vlayer.lua | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/exp_legacy/module/modules/control/vlayer.lua b/exp_legacy/module/modules/control/vlayer.lua index 754608f7..9d1db5b9 100644 --- a/exp_legacy/module/modules/control/vlayer.lua +++ b/exp_legacy/module/modules/control/vlayer.lua @@ -512,23 +512,17 @@ local function handle_circuit_power_load() for _, v in pairs(spawn_pole) do local e = game.surfaces[1].find_entity(v.n, v.p) - if e and e.valid and e.is_connected_to_electric_network() and e.electric_network_id and not processed[e.electric_network_id] then + if e and e.valid and e.is_connected_to_electric_network() and e.electric_network_id and (not processed[e.electric_network_id]) then local ens = e.electric_network_statistics - local ensi = 0 - local enso = 0 for _, c in pairs(ens.input_counts) do - ensi = ensi + c + pi = pi + c end for _, c in pairs(ens.output_counts) do - enso = enso + c + po = po + c end - processed[e.electric_network_id] = { i = ensi, o = enso } + processed[e.electric_network_id] = true end end - for _, v in pairs(processed) do - pi = pi + v.i - po = po + v.o - end return (pi * 10000 / po) or 0 end From 1cfcdddfa5da815d71727a88aa29e376bc411baf Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Mon, 24 Feb 2025 18:52:59 +0900 Subject: [PATCH 313/406] . --- exp_legacy/module/modules/control/vlayer.lua | 1 - 1 file changed, 1 deletion(-) diff --git a/exp_legacy/module/modules/control/vlayer.lua b/exp_legacy/module/modules/control/vlayer.lua index 9d1db5b9..06bb68d8 100644 --- a/exp_legacy/module/modules/control/vlayer.lua +++ b/exp_legacy/module/modules/control/vlayer.lua @@ -509,7 +509,6 @@ local function handle_circuit_power_load() local processed = {} local pi = 0 local po = 0 - for _, v in pairs(spawn_pole) do local e = game.surfaces[1].find_entity(v.n, v.p) if e and e.valid and e.is_connected_to_electric_network() and e.electric_network_id and (not processed[e.electric_network_id]) then From 3a8b217f8d0e88f532d6885bb265444b66fd4b26 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Mon, 24 Feb 2025 18:54:27 +0900 Subject: [PATCH 314/406] . --- exp_legacy/module/modules/control/vlayer.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exp_legacy/module/modules/control/vlayer.lua b/exp_legacy/module/modules/control/vlayer.lua index 06bb68d8..b77f7608 100644 --- a/exp_legacy/module/modules/control/vlayer.lua +++ b/exp_legacy/module/modules/control/vlayer.lua @@ -522,7 +522,7 @@ local function handle_circuit_power_load() processed[e.electric_network_id] = true end end - return (pi * 10000 / po) or 0 + return pi * 10000 / math.max(po, 1) end --- Get the statistics for the vlayer From fbf91f43105a140a57eaf2adbc85c05fbfa67797 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Mon, 24 Feb 2025 18:59:15 +0900 Subject: [PATCH 315/406] . --- exp_legacy/module/modules/control/vlayer.lua | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/exp_legacy/module/modules/control/vlayer.lua b/exp_legacy/module/modules/control/vlayer.lua index b77f7608..644bf1df 100644 --- a/exp_legacy/module/modules/control/vlayer.lua +++ b/exp_legacy/module/modules/control/vlayer.lua @@ -617,7 +617,11 @@ local function handle_circuit_interfaces() if not interface.valid then vlayer_data.entity_interfaces.circuit[index] = nil else - local circuit_oc = interface.get_or_create_control_behavior().sections[1] + local circuit_oc = interface.get_or_create_control_behavior() + if circuit_oc.sections_count == 0 then + circuit_oc.add_section() + end + circuit_oc = circuit_oc[1] local signal_index = 1 local circuit = vlayer.get_circuits() From f7805ae2a74f2154e286d1b66efe811dfe168e06 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Mon, 24 Feb 2025 18:59:47 +0900 Subject: [PATCH 316/406] . --- exp_legacy/module/modules/control/vlayer.lua | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/exp_legacy/module/modules/control/vlayer.lua b/exp_legacy/module/modules/control/vlayer.lua index 644bf1df..754c99ed 100644 --- a/exp_legacy/module/modules/control/vlayer.lua +++ b/exp_legacy/module/modules/control/vlayer.lua @@ -509,19 +509,24 @@ local function handle_circuit_power_load() local processed = {} local pi = 0 local po = 0 + for _, v in pairs(spawn_pole) do local e = game.surfaces[1].find_entity(v.n, v.p) if e and e.valid and e.is_connected_to_electric_network() and e.electric_network_id and (not processed[e.electric_network_id]) then local ens = e.electric_network_statistics + for _, c in pairs(ens.input_counts) do pi = pi + c end + for _, c in pairs(ens.output_counts) do po = po + c end + processed[e.electric_network_id] = true end end + return pi * 10000 / math.max(po, 1) end From 03e30caeda908ce114cfa96b5be4a968165245b2 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Mon, 24 Feb 2025 19:01:15 +0900 Subject: [PATCH 317/406] . --- exp_legacy/module/modules/control/vlayer.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exp_legacy/module/modules/control/vlayer.lua b/exp_legacy/module/modules/control/vlayer.lua index 754c99ed..c9711014 100644 --- a/exp_legacy/module/modules/control/vlayer.lua +++ b/exp_legacy/module/modules/control/vlayer.lua @@ -626,7 +626,7 @@ local function handle_circuit_interfaces() if circuit_oc.sections_count == 0 then circuit_oc.add_section() end - circuit_oc = circuit_oc[1] + circuit_oc = circuit_oc.sections[1] local signal_index = 1 local circuit = vlayer.get_circuits() From aa3976090f66f883adf8bafd5881195a11ba29fe Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Mon, 24 Feb 2025 19:07:03 +0900 Subject: [PATCH 318/406] . --- exp_legacy/module/modules/control/vlayer.lua | 38 -------------------- 1 file changed, 38 deletions(-) diff --git a/exp_legacy/module/modules/control/vlayer.lua b/exp_legacy/module/modules/control/vlayer.lua index c9711014..425c0af5 100644 --- a/exp_legacy/module/modules/control/vlayer.lua +++ b/exp_legacy/module/modules/control/vlayer.lua @@ -8,7 +8,6 @@ local ExpUtil = require("modules/exp_util") local Storage = require("modules/exp_util/storage") local Event = require("modules/exp_legacy/utils/event") --- @dep utils.event local config = require("modules.exp_legacy.config.vlayer") --- @dep config.vlayer -local config_spawn = require("modules.exp_legacy.config.spawn_area") --- @dep config.spawn_area local mega = 1000000 @@ -37,14 +36,6 @@ local vlayer_data = { surface = table.deep_copy(config.surface), } -local spawn_pole = {} - -for _, v in pairs(config_spawn.entities.locations) do - if v[1] == "small-electric-pole" or v[1] == "medium-electric-pole" then - table.insert(spawn_pole, { n = v[1], p = { x = v[2], y = v[3] } }) - end -end - Storage.register(vlayer_data, function(tbl) vlayer_data = tbl end) @@ -504,39 +495,12 @@ local function handle_unallocated() end end ---- Calculate the current power load to provide a better view for the user -local function handle_circuit_power_load() - local processed = {} - local pi = 0 - local po = 0 - - for _, v in pairs(spawn_pole) do - local e = game.surfaces[1].find_entity(v.n, v.p) - if e and e.valid and e.is_connected_to_electric_network() and e.electric_network_id and (not processed[e.electric_network_id]) then - local ens = e.electric_network_statistics - - for _, c in pairs(ens.input_counts) do - pi = pi + c - end - - for _, c in pairs(ens.output_counts) do - po = po + c - end - - processed[e.electric_network_id] = true - end - end - - return pi * 10000 / math.max(po, 1) -end - --- Get the statistics for the vlayer function vlayer.get_statistics() local vdp = vlayer_data.properties.production * mega local gdm = get_production_multiplier() local gsm = get_sustained_multiplier() local gald = get_actual_land_defecit() - local cl = handle_circuit_power_load() return { total_surface_area = vlayer_data.properties.total_surface_area, @@ -544,7 +508,6 @@ function vlayer.get_statistics() remaining_surface_area = gald, surface_area = vlayer_data.properties.total_surface_area - gald, production_multiplier = gdm, - current_load = cl, energy_max = vdp, energy_production = vdp * gdm, energy_total_production = vlayer_data.properties.total_production * gsm * mega, @@ -569,7 +532,6 @@ function vlayer.get_circuits() used_surface_area = "signal-U", remaining_surface_area = "signal-R", production_multiplier = "signal-M", - current_load = "signal-O", energy_production = "signal-P", energy_sustained = "signal-S", energy_capacity = "signal-C", From 2c0040a033d892212560f743d3a8117c8120ae98 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Mon, 24 Feb 2025 20:05:33 +0900 Subject: [PATCH 319/406] . --- exp_legacy/module/modules/gui/production.lua | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/exp_legacy/module/modules/gui/production.lua b/exp_legacy/module/modules/gui/production.lua index 87ab609e..be359e64 100644 --- a/exp_legacy/module/modules/gui/production.lua +++ b/exp_legacy/module/modules/gui/production.lua @@ -74,7 +74,7 @@ local production_data_group = Gui.element("production_data_group") local data = parent.add{ type = "label", name = "production_" .. i .. "_" .. j, - caption = "0.0", + caption = "0.00", style = "heading_2_label", } data.style.width = 80 @@ -138,9 +138,9 @@ Event.on_nth_tick(60, function() table[production_prefix .. "_3"].caption = format_n(sum) table[production_prefix .. "_3"].style.font_color = (sum < 0 and font_color["negative"]) or font_color["positive"] else - table[production_prefix .. "_1"].caption = "0.0" - table[production_prefix .. "_2"].caption = "0.0" - table[production_prefix .. "_3"].caption = "0.0" + table[production_prefix .. "_1"].caption = "0.00" + table[production_prefix .. "_2"].caption = "0.00" + table[production_prefix .. "_3"].caption = "0.00" table[production_prefix .. "_3"].style.font_color = font_color["positive"] end end From 860cacf16fc6eeef28e75308f710693196309004 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Wed, 26 Feb 2025 23:58:00 +0900 Subject: [PATCH 320/406] . --- exp_legacy/module/modules/addons/logging.lua | 35 +++++++++++--------- 1 file changed, 20 insertions(+), 15 deletions(-) diff --git a/exp_legacy/module/modules/addons/logging.lua b/exp_legacy/module/modules/addons/logging.lua index cf940d15..2d2d6728 100644 --- a/exp_legacy/module/modules/addons/logging.lua +++ b/exp_legacy/module/modules/addons/logging.lua @@ -14,27 +14,32 @@ local function add_log(data) end Event.add(defines.events.on_cargo_pod_finished_ascending, function(event) - if event and event.launched_by_rocket then - local force = event.cargo_pod.force - if force.rockets_launched >= config.rocket_launch_display_rate and force.rockets_launched % config.rocket_launch_display_rate == 0 then - add_log("[ROCKET] " .. force.rockets_launched .. " rockets launched") - elseif config.rocket_launch_display[force.rockets_launched] then - add_log("[ROCKET] " .. force.rockets_launched .. " rockets launched") - end + if not event or not event.launched_by_rocket then + return + end + + local force = event.cargo_pod.force + + if force.rockets_launched >= config.rocket_launch_display_rate and force.rockets_launched % config.rocket_launch_display_rate == 0 then + add_log("[ROCKET] " .. force.rockets_launched .. " rockets launched") + elseif config.rocket_launch_display[force.rockets_launched] then + add_log("[ROCKET] " .. force.rockets_launched .. " rockets launched") end end) Event.add(defines.events.on_pre_player_died, function(event) - if event and event.player_index then - if event.cause then - if event.cause.type and event.cause.type == "character" and event.cause.player and event.cause.player.index then - add_log("[DEATH] " .. game.players[event.player_index].name .. " died because of " .. (game.players[event.cause.player.index].name or "unknown reason")) - else - add_log("[DEATH] " .. game.players[event.player_index].name .. " died because of " .. (event.cause.name or "unknown reason")) - end + if not event or not event.player_index then + return + end + + if event.cause then + if event.cause.type and event.cause.type == "character" and event.cause.player and event.cause.player.index then + add_log("[DEATH] " .. game.players[event.player_index].name .. " died because of " .. (game.players[event.cause.player.index].name or "unknown reason")) else - add_log("[DEATH] " .. game.players[event.player_index].name .. " died because of unknown reason") + add_log("[DEATH] " .. game.players[event.player_index].name .. " died because of " .. (event.cause.name or "unknown reason")) end + else + add_log("[DEATH] " .. game.players[event.player_index].name .. " died because of unknown reason") end end) From 704dd73df4005fd4c40a3d49a00eea0112aab0f4 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Wed, 26 Feb 2025 23:58:33 +0900 Subject: [PATCH 321/406] . --- exp_legacy/module/modules/addons/logging.lua | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/exp_legacy/module/modules/addons/logging.lua b/exp_legacy/module/modules/addons/logging.lua index 2d2d6728..cbec212a 100644 --- a/exp_legacy/module/modules/addons/logging.lua +++ b/exp_legacy/module/modules/addons/logging.lua @@ -32,14 +32,15 @@ Event.add(defines.events.on_pre_player_died, function(event) return end - if event.cause then - if event.cause.type and event.cause.type == "character" and event.cause.player and event.cause.player.index then - add_log("[DEATH] " .. game.players[event.player_index].name .. " died because of " .. (game.players[event.cause.player.index].name or "unknown reason")) - else - add_log("[DEATH] " .. game.players[event.player_index].name .. " died because of " .. (event.cause.name or "unknown reason")) - end - else + if not event.cause then add_log("[DEATH] " .. game.players[event.player_index].name .. " died because of unknown reason") + return + end + + if event.cause.type and event.cause.type == "character" and event.cause.player and event.cause.player.index then + add_log("[DEATH] " .. game.players[event.player_index].name .. " died because of " .. (game.players[event.cause.player.index].name or "unknown reason")) + else + add_log("[DEATH] " .. game.players[event.player_index].name .. " died because of " .. (event.cause.name or "unknown reason")) end end) From 8ccaf47f6f8aee439d02065129f3db5054285506 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Thu, 27 Feb 2025 00:01:12 +0900 Subject: [PATCH 322/406] . --- exp_legacy/module/modules/addons/logging.lua | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/exp_legacy/module/modules/addons/logging.lua b/exp_legacy/module/modules/addons/logging.lua index cbec212a..2e1f03f5 100644 --- a/exp_legacy/module/modules/addons/logging.lua +++ b/exp_legacy/module/modules/addons/logging.lua @@ -59,17 +59,21 @@ Event.add(defines.events.on_research_finished, function(event) end) Event.add(defines.events.on_player_joined_game, function(event) - if event and event.player_index then - add_log("[JOIN] " .. game.players[event.player_index].name .. " joined the game") + if not event or not event.player_index then + return end + + add_log("[JOIN] " .. game.players[event.player_index].name .. " joined the game") end) Event.add(defines.events.on_player_left_game, function(event) - if event and event.player_index then - if event.reason then - add_log("[LEAVE] " .. game.players[event.player_index].name .. config.disconnect_reason[event.reason]) - else - add_log("[LEAVE] " .. game.players[event.player_index].name .. config.disconnect_reason[defines.disconnect_reason.quit]) - end + if not event or not event.player_index then + return + end + + if event.reason then + add_log("[LEAVE] " .. game.players[event.player_index].name .. config.disconnect_reason[event.reason]) + else + add_log("[LEAVE] " .. game.players[event.player_index].name .. config.disconnect_reason[defines.disconnect_reason.quit]) end end) From 23d88c197e00c0e174a9a0074806b0168cef604e Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Thu, 6 Mar 2025 22:19:44 +0900 Subject: [PATCH 323/406] . --- exp_gui/module/locale/en.cfg | 1 - exp_gui/module/locale/zh-CN.cfg | 12 ++++++++++++ exp_gui/module/locale/zh-TW.cfg | 12 ++++++++++++ 3 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 exp_gui/module/locale/zh-CN.cfg create mode 100644 exp_gui/module/locale/zh-TW.cfg diff --git a/exp_gui/module/locale/en.cfg b/exp_gui/module/locale/en.cfg index 931539da..6acfefc5 100644 --- a/exp_gui/module/locale/en.cfg +++ b/exp_gui/module/locale/en.cfg @@ -1,4 +1,3 @@ - [exp-gui] clear-left-flow=Hide all open windows. close-toolbar=__CONTROL_LEFT_CLICK__: Toggle Settings\n__CONTROL_RIGHT_CLICK__: Close Toolbar diff --git a/exp_gui/module/locale/zh-CN.cfg b/exp_gui/module/locale/zh-CN.cfg new file mode 100644 index 00000000..7f411936 --- /dev/null +++ b/exp_gui/module/locale/zh-CN.cfg @@ -0,0 +1,12 @@ +[exp-gui] +clear-left-flow=收起所有打開的介面。 +close-toolbar=__CONTROL_LEFT_CLICK__: 按鍵設定\n__CONTROL_RIGHT_CLICK__: 關閉工具列 +open-toolbar=__CONTROL_LEFT_CLICK__: 按鍵設定\n__CONTROL_RIGHT_CLICK__: 開啟工具列 + +[exp-gui_toolbar-settings] +main-caption=工具列 +main-tooltip=工具列設定\n使用核取方塊來設定喜愛項目 +reset=重置全部 +toggle=切換喜愛項目 +move-up=上移 +move-down=下移 diff --git a/exp_gui/module/locale/zh-TW.cfg b/exp_gui/module/locale/zh-TW.cfg new file mode 100644 index 00000000..7f411936 --- /dev/null +++ b/exp_gui/module/locale/zh-TW.cfg @@ -0,0 +1,12 @@ +[exp-gui] +clear-left-flow=收起所有打開的介面。 +close-toolbar=__CONTROL_LEFT_CLICK__: 按鍵設定\n__CONTROL_RIGHT_CLICK__: 關閉工具列 +open-toolbar=__CONTROL_LEFT_CLICK__: 按鍵設定\n__CONTROL_RIGHT_CLICK__: 開啟工具列 + +[exp-gui_toolbar-settings] +main-caption=工具列 +main-tooltip=工具列設定\n使用核取方塊來設定喜愛項目 +reset=重置全部 +toggle=切換喜愛項目 +move-up=上移 +move-down=下移 From e047c7ecf6deb244e8b7e87326dc717a728f1eeb Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Thu, 6 Mar 2025 22:20:11 +0900 Subject: [PATCH 324/406] . --- exp_legacy/module/modules/control/rockets.lua | 26 +++++-------------- .../modules/gui/debug/redmew_global_view.lua | 2 +- 2 files changed, 7 insertions(+), 21 deletions(-) diff --git a/exp_legacy/module/modules/control/rockets.lua b/exp_legacy/module/modules/control/rockets.lua index d6fca7c5..a46d66c2 100644 --- a/exp_legacy/module/modules/control/rockets.lua +++ b/exp_legacy/module/modules/control/rockets.lua @@ -62,24 +62,14 @@ end) --- @param silo LuaEntity Rocket silo entity --- @return table # Data table for this silo, contains rockets launch, silo status, and its force function Rockets.get_silo_data(silo) - local position = silo.position - local silo_name = math.floor(position.x) .. ":" .. math.floor(position.y) - return rocket_silos[silo_name] -end - ---- Gets the silo data for a given silo entity ---- @param silo_name string Silo name that is stored in its data ---- @return table # Data table for this silo, contains rockets launch, silo status, and its force -function Rockets.get_silo_data_by_name(silo_name) - return rocket_silos[silo_name] + return rocket_silos[silo.unit_number] end --- Gets the silo entity from its silo name, reverse to get_silo_data --- @param silo_name string Silo name that is stored in its data --- @return LuaEntity # Rocket silo entity function Rockets.get_silo_entity(silo_name) - local data = rocket_silos[silo_name] - return data.entity + return rocket_silos[tonumber(silo_name)].entity end --- Gets the rocket stats for a force @@ -151,6 +141,7 @@ end --- @param event EventData.on_rocket_launch_ordered Event.add(defines.events.on_rocket_launch_ordered, function(event) local silo_data = Rockets.get_silo_data(event.rocket_silo) + assert(silo_data, "Rocket silo missing data: " .. tostring(event.rocket_silo)) silo_data.launched = silo_data.launched + 1 silo_data.awaiting_reset = true end) @@ -196,14 +187,9 @@ end) local function on_built(event) local entity = event.entity if entity.valid and entity.name == "rocket-silo" then - local force = entity.force - local force_name = force.name - local position = entity.position - local silo_name = math.floor(position.x) .. ":" .. math.floor(position.y) - - rocket_silos[silo_name] = { - name = silo_name, - force = force_name, + rocket_silos[entity.unit_number] = { + name = tostring(entity.unit_number), + force = entity.force.name, entity = entity, launched = 0, awaiting_reset = false, diff --git a/exp_legacy/module/modules/gui/debug/redmew_global_view.lua b/exp_legacy/module/modules/gui/debug/redmew_global_view.lua index ae42c326..da5417c4 100644 --- a/exp_legacy/module/modules/gui/debug/redmew_global_view.lua +++ b/exp_legacy/module/modules/gui/debug/redmew_global_view.lua @@ -86,7 +86,7 @@ Gui.on_click( element.style.font_color = Color.orange data.selected_header = element - input_text_box.text = concat{ "storage.exp_storage[", token_id, "]" } + input_text_box.text = concat{ "storage.exp_storage['", token_id, "']" } input_text_box.style.font_color = Color.black local content = dump(storage.exp_storage[token_id]) or "nil" From 5939ff8e5983a1e3ac0d049ecbbfca84655ee368 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Thu, 6 Mar 2025 23:05:10 +0900 Subject: [PATCH 325/406] . --- exp_legacy/module/config/expcore/roles.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/exp_legacy/module/config/expcore/roles.lua b/exp_legacy/module/config/expcore/roles.lua index f2053b3a..56d8e4da 100644 --- a/exp_legacy/module/config/expcore/roles.lua +++ b/exp_legacy/module/config/expcore/roles.lua @@ -323,7 +323,7 @@ Roles.define_role_order{ } Roles.override_player_roles{ - ["PHIDIAS0303"] = { "Senior Administrator" }, + -- ["PHIDIAS0303"] = { "Senior Administrator" }, ["majoro"] = { "Trainee Moderator" }, ["konohaScarlet_"] = { "Trainee Moderator" }, ["hihicome3"] = { "Trainee Moderator" }, @@ -332,7 +332,7 @@ Roles.override_player_roles{ ["JamesJung"] = { "Trainee Moderator" }, ["aldldl"] = { "Moderator" }, ["arty714"] = { "Moderator" }, - ["Cooldude2606"] = { "Moderator" }, + -- ["Cooldude2606"] = { "Moderator" }, ["Drahc_pro"] = { "Moderator" }, ["mark9064"] = { "Moderator" }, ["7h3w1z4rd"] = { "Moderator" }, From 4fa34c31d110c34471912eac1fed22eca1a8dbc6 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Thu, 6 Mar 2025 23:29:40 +0900 Subject: [PATCH 326/406] . --- exp_groups/controller.ts | 282 ---------------------- exp_groups/index.ts | 84 ------- exp_groups/instance.ts | 129 ---------- exp_groups/messages.ts | 239 ------------------- exp_groups/module/control.lua | 127 ---------- exp_groups/module/module.json | 12 - exp_groups/module/module_exports.lua | 305 ------------------------ exp_groups/package.json | 41 ---- exp_groups/tsconfig.browser.json | 4 - exp_groups/tsconfig.json | 7 - exp_groups/tsconfig.node.json | 5 - exp_groups/web/components/groupTree.tsx | 129 ---------- exp_groups/web/index.tsx | 82 ------- exp_groups/webpack.config.js | 32 --- 14 files changed, 1478 deletions(-) delete mode 100644 exp_groups/controller.ts delete mode 100644 exp_groups/index.ts delete mode 100644 exp_groups/instance.ts delete mode 100644 exp_groups/messages.ts delete mode 100644 exp_groups/module/control.lua delete mode 100644 exp_groups/module/module.json delete mode 100644 exp_groups/module/module_exports.lua delete mode 100644 exp_groups/package.json delete mode 100644 exp_groups/tsconfig.browser.json delete mode 100644 exp_groups/tsconfig.json delete mode 100644 exp_groups/tsconfig.node.json delete mode 100644 exp_groups/web/components/groupTree.tsx delete mode 100644 exp_groups/web/index.tsx delete mode 100644 exp_groups/webpack.config.js diff --git a/exp_groups/controller.ts b/exp_groups/controller.ts deleted file mode 100644 index dde5515c..00000000 --- a/exp_groups/controller.ts +++ /dev/null @@ -1,282 +0,0 @@ -import * as lib from "@clusterio/lib"; -import { BaseControllerPlugin, InstanceInfo } from "@clusterio/controller"; - -import { - PermissionStrings, PermissionStringsUpdate, - PermissionGroup, PermissionGroupUpdate, - InstancePermissionGroups, - PermissionInstanceId, - PermissionGroupEditEvent, -} from "./messages"; - -import path from "path"; -import fs from "fs-extra"; - -export class ControllerPlugin extends BaseControllerPlugin { - static permissionGroupsPath = "exp_groups.json"; - static userGroupsPath = "exp_user_groups.json"; - - userToGroup: Map = new Map(); // TODO this needs to be per instance - permissionStrings!: Map; - permissionGroups!: Map; - - async init() { - this.controller.handle(PermissionStringsUpdate, this.handlePermissionStringsUpdate.bind(this)); - this.controller.handle(PermissionGroupUpdate, this.handlePermissionGroupUpdate.bind(this)); - this.controller.handle(PermissionGroupEditEvent, this.handlePermissionGroupEditEvent.bind(this)); - this.controller.subscriptions.handle(PermissionStringsUpdate, this.handlePermissionStringsSubscription.bind(this)); - this.controller.subscriptions.handle(PermissionGroupUpdate, this.handlePermissionGroupSubscription.bind(this)); - this.controller.subscriptions.handle(PermissionGroupEditEvent); - this.permissionStrings = new Map([["Global", new PermissionStrings("Global", new Set())]]); - this.permissionGroups = new Map([["Global", new InstancePermissionGroups("Global")]]); - await this.loadData(); - - // Add the default group if missing and add any missing cluster roles - const clusterRoles = [...this.controller.userManager.roles.values()] - for (const instanceGroups of this.permissionGroups.values()) { - const groups = instanceGroups.groups; - const instanceRoles = [...groups.values()].flatMap(group => [...group.roleIds.values()]); - const missingRoles = clusterRoles.filter(role => instanceRoles.includes(role.id)); - const defaultGroup = groups.get("Default"); - if (defaultGroup) { - for (const role of missingRoles) { - defaultGroup.roleIds.add(role.id) - } - } else { - groups.set("Default", new PermissionGroup( - instanceGroups.instanceId, - "Default", - groups.size, - new Set(missingRoles.map(role => role.id)) - )); - } - } - } - - async onControllerConfigFieldChanged(field: string, curr: unknown, prev: unknown) { - if (field === "exp_groups.allow_role_inconsistency") { - // Do something with this.userToGroup - } - } - - async onInstanceConfigFieldChanged(instance: InstanceInfo, field: string, curr: unknown, prev: unknown) { - this.logger.info(`controller::onInstanceConfigFieldChanged ${instance.id} ${field}`); - if (field === "exp_groups.sync_permission_groups") { - const updates = [] - const now = Date.now(); - if (curr) { - // Global sync enabled, we dont need the instance config - const instanceGroups = this.permissionGroups.get(instance.id); - if (instanceGroups) { - this.permissionGroups.delete(instance.id); - for (const group of instanceGroups.groups.values()) { - group.updatedAtMs = now; - group.isDeleted = true; - updates.push(group); - } - } - } else { - // Global sync disabled, make a copy of the global config as a base - const global = this.permissionGroups.get("Global")!; - const oldInstanceGroups = this.permissionGroups.get(instance.id); - const instanceGroups = new InstancePermissionGroups( - instance.id, new Map([...global.groups.values()].map(group => [group.name, group.copy(instance.id)])) - ) - this.permissionGroups.set(instance.id, instanceGroups); - for (const group of instanceGroups.groups.values()) { - group.updatedAtMs = now; - updates.push(group); - } - // If it has an old config (unexpected) then deal with it - if (oldInstanceGroups) { - for (const group of oldInstanceGroups.groups.values()) { - if (!instanceGroups.groups.has(group.name)) { - group.updatedAtMs = now; - group.isDeleted = true; - updates.push(group); - } - } - } - } - // Send the updates to all instances and controls - if (updates.length) { - this.controller.subscriptions.broadcast(new PermissionGroupUpdate(updates)); - } - } - } - - async loadPermissionGroups() { - const file = path.resolve(this.controller.config.get("controller.database_directory"), ControllerPlugin.permissionGroupsPath); - this.logger.verbose(`Loading ${file}`); - try { - const content = await fs.readFile(file, { encoding: "utf8" }); - for (const groupRaw of JSON.parse(content)) { - const group = PermissionGroup.fromJSON(groupRaw); - const instanceGroups = this.permissionGroups.get(group.instanceId); - if (instanceGroups) { - instanceGroups.groups.set(group.name, group); - } else { - this.permissionGroups.set(group.instanceId, - new InstancePermissionGroups(group.instanceId, new Map([[group.name, group]])) - ); - } - }; - - } catch (err: any) { - if (err.code === "ENOENT") { - this.logger.verbose("Creating new permission group database"); - return; - } - throw err; - } - } - - async savePermissionGroups() { - const file = path.resolve(this.controller.config.get("controller.database_directory"), ControllerPlugin.permissionGroupsPath); - this.logger.verbose(`Writing ${file}`); - await lib.safeOutputFile(file, JSON.stringify( - [...this.permissionGroups.values()].flatMap(instanceGroups => [...instanceGroups.groups.values()]) - )); - } - - async loadUserGroups() { - if (!this.controller.config.get("exp_groups.allow_role_inconsistency")) return; - const file = path.resolve(this.controller.config.get("controller.database_directory"), ControllerPlugin.userGroupsPath); - this.logger.verbose(`Loading ${file}`); - try { - const content = await fs.readFile(file, { encoding: "utf8" }); - this.userToGroup = new Map(JSON.parse(content)); - - } catch (err: any) { - if (err.code === "ENOENT") { - this.logger.verbose("Creating new user group database"); - return; - } - throw err; - } - } - - async saveUserGroups() { - if (!this.controller.config.get("exp_groups.allow_role_inconsistency")) return; - const file = path.resolve(this.controller.config.get("controller.database_directory"), ControllerPlugin.userGroupsPath); - this.logger.verbose(`Writing ${file}`); - await lib.safeOutputFile(file, JSON.stringify([...this.permissionGroups.entries()])); - } - - async loadData() { - await Promise.all([ - this.loadPermissionGroups(), - this.loadUserGroups(), - ]) - } - - async onSaveData() { - await Promise.all([ - this.savePermissionGroups(), - this.saveUserGroups(), - ]) - } - - addPermisisonGroup(instanceId: PermissionInstanceId, name: string, permissions = new Set(), silent = false) { - const instanceGroups = this.permissionGroups.get(instanceId); - if (!instanceGroups) { - throw new Error("Instance ID does not exist"); - } - if (instanceGroups.groups.has(name)) { - return instanceGroups.groups.get(name)!; - } - for (const group of instanceGroups.groups.values()) { - group.order += 1; - } - const group = new PermissionGroup(instanceId, name, 0, new Set(), permissions, Date.now(), false); - instanceGroups.groups.set(group.id, group); - if (!silent) { - this.controller.subscriptions.broadcast(new PermissionGroupUpdate([group])); - } - return group; - } - - removePermissionGroup(instanceId: PermissionInstanceId, name: string, silent = false) { - const instanceGroups = this.permissionGroups.get(instanceId); - if (!instanceGroups) { - throw new Error("Instance ID does not exist"); - } - const group = instanceGroups.groups.get(name) - if (!group) { - return null; - } - for (const nextGroup of instanceGroups.groups.values()) { - if (nextGroup.order > group.order) { - nextGroup.order -= 1; - } - } - instanceGroups.groups.delete(group.id); - group.updatedAtMs = Date.now(); - group.isDeleted = true; - if (!silent) { - this.controller.subscriptions.broadcast(new PermissionGroupUpdate([group])); - } - return group; - } - - async handlePermissionGroupEditEvent(event: PermissionGroupEditEvent) { - // TODO - } - - async handlePermissionStringsUpdate(event: PermissionStringsUpdate) { - for (const update of event.updates) { - const global = this.permissionStrings.get("Global")! - this.permissionStrings.set(update.instanceId as number, update) - global.updatedAtMs = Math.max(global.updatedAtMs, update.updatedAtMs) - for (const permission of update.permissions) { - global.permissions.add(permission) - } - // TODO maybe check if changes have happened rather than always pushing updates - this.controller.subscriptions.broadcast(new PermissionStringsUpdate([global, update])) - } - } - - async handlePermissionGroupUpdate(event: PermissionGroupUpdate) { - const updates = []; - for (const group of event.updates) { - const groups = this.permissionGroups.get(group.instanceId); - if (!groups) continue; - const existingGroup = groups.groups.get(group.id); - let update - if (!existingGroup) { - update = this.addPermisisonGroup(group.instanceId, group.name, group.permissions, true); - } else if (group.isDeleted) { - update = this.removePermissionGroup(group.instanceId, group.name, true); - } else { - existingGroup.permissions = group.permissions; - existingGroup.updatedAtMs = Date.now(); - update = existingGroup; - } - if (update) updates.push(update); - } - this.controller.subscriptions.broadcast(new PermissionGroupUpdate(updates)); - } - - async handlePermissionStringsSubscription(request: lib.SubscriptionRequest, src: lib.Address) { - const updates = [ ...this.permissionStrings.values() ] - .filter( - value => value.updatedAtMs > request.lastRequestTimeMs, - ) - return updates.length ? new PermissionStringsUpdate(updates) : null; - } - - async handlePermissionGroupSubscription(request: lib.SubscriptionRequest, src: lib.Address) { - const updates = [ ...this.permissionGroups.values() ] - .flatMap(instanceGroups => [...instanceGroups.groups.values()]) - .filter( - value => value.updatedAtMs > request.lastRequestTimeMs, - ) - if (src.type === lib.Address.instance) { - const instanceUpdates = updates.filter(group => group.instanceId === src.id || group.instanceId === "Global"); - this.logger.info(JSON.stringify(updates)) - this.logger.info(JSON.stringify(instanceUpdates)) - return instanceUpdates.length ? new PermissionGroupUpdate(instanceUpdates) : null; - } - return updates.length ? new PermissionGroupUpdate(updates) : null; - } -} diff --git a/exp_groups/index.ts b/exp_groups/index.ts deleted file mode 100644 index f5e272b3..00000000 --- a/exp_groups/index.ts +++ /dev/null @@ -1,84 +0,0 @@ -import * as lib from "@clusterio/lib"; -import * as Messages from "./messages"; - -lib.definePermission({ - name: "exp_groups.create_delete_groups", - title: "Create and delete permission groups", - description: "Create and delete permission groups.", -}); - -lib.definePermission({ - name: "exp_groups.reorder_groups", - title: "Reorder permission groups", - description: "Reorder groups and link them to user roles.", -}); - -lib.definePermission({ - name: "exp_groups.modify_permissions", - title: "Modify permission groups", - description: "Modify game permissions for groups.", -}); - -lib.definePermission({ - name: "exp_groups.assign_players", - title: "Change player group", - description: "Change the permission group of a player", -}); - -lib.definePermission({ - name: "exp_groups.list", - title: "View permission groups", - description: "View permission groups.", -}); - -lib.definePermission({ - name: "exp_groups.list.subscribe", - title: "Subscribe to permission group updates", - description: "Subscribe to permission group updates.", -}); - -declare module "@clusterio/lib" { - export interface ControllerConfigFields { - "exp_groups.allow_role_inconsistency": boolean; - } - export interface InstanceConfigFields { - "exp_groups.sync_permission_groups": boolean; - } -} - -export const plugin: lib.PluginDeclaration = { - name: "exp_groups", - title: "exp_groups", - description: "Create, modify, and link factorio permission groups to clusterio user roles.", - - controllerEntrypoint: "./dist/node/controller", - controllerConfigFields: { - "exp_groups.allow_role_inconsistency": { - title: "Allow User Role Inconsistency", - description: "When true, users can be assgined to any group regardless of their roles", - type: "boolean", - initialValue: false, - }, - }, - - instanceEntrypoint: "./dist/node/instance", - instanceConfigFields: { - "exp_groups.sync_permission_groups": { - title: "Sync Permission Groups", - description: "When true, the instance cannot deviate from the global group settings and will be hidden from the sellection dropdown.", - type: "boolean", - initialValue: true, - }, - }, - - messages: [ - Messages.PermissionGroupEditEvent, - Messages.PermissionStringsUpdate, - Messages.PermissionGroupUpdate, - ], - - webEntrypoint: "./web", - routes: [ - "/exp_groups", - ], -}; diff --git a/exp_groups/instance.ts b/exp_groups/instance.ts deleted file mode 100644 index 5142d933..00000000 --- a/exp_groups/instance.ts +++ /dev/null @@ -1,129 +0,0 @@ -import * as lib from "@clusterio/lib"; -import { BaseInstancePlugin } from "@clusterio/host"; -import { - PermissionGroup, PermissionGroupEditEvent, PermissionGroupEditType, - PermissionGroupUpdate, PermissionInstanceId, PermissionStrings, PermissionStringsUpdate -} from "./messages"; - -const rconBase = "/sc local Groups = package.loaded['modules/exp_groups/module_exports'];" - -type EditIPC = { - type: PermissionGroupEditType, - changes: string[], - group: string, -}; - -type CreateIPC = { - group: string, - defiantion: [boolean, string[] | {}] -} - -type DeleteIPC = { - group: string, -} - -export class InstancePlugin extends BaseInstancePlugin { - permissions: Set = new Set(); - permissionGroups = new lib.EventSubscriber(PermissionGroupUpdate, this.instance); - permissionGroupUpdates = new lib.EventSubscriber(PermissionGroupEditEvent, this.instance); - syncId: PermissionInstanceId = this.instance.config.get("exp_groups.sync_permission_groups") ? "Global" : this.instance.id; - - async init() { - this.instance.server.handle("exp_groups-permission_group_edit", this.handleEditIPC.bind(this)); - this.instance.server.handle("exp_groups-permission_group_create", this.handleCreateIPC.bind(this)); - this.instance.server.handle("exp_groups-permission_group_delete", this.handleDeleteIPC.bind(this)); - } - - async onStart() { - // Send the most recent version of the permission string - const permissionsString = await this.sendRcon(rconBase + "rcon.print(Groups.get_actions_json())"); - this.permissions = new Set(JSON.parse(permissionsString)); - this.instance.sendTo("controller", new PermissionStringsUpdate([ - new PermissionStrings(this.instance.id, this.permissions, Date.now()) - ])); - - // Subscribe to get updates for permission groups - this.permissionGroups.subscribe(this.onPermissionGroupsUpdate.bind(this)); - this.permissionGroupUpdates.subscribe(this.onPermissionGroupUpdate.bind(this)); - } - - async onControllerConnectionEvent(event: any) { - this.permissionGroups.handleConnectionEvent(event); - } - - async onInstanceConfigFieldChanged(field: string, curr: unknown, prev: unknown) { - if (field === "exp_groups.sync_permission_groups") { - this.syncId = curr ? "Global" : this.instance.id; - const [snapshot, synced] = this.permissionGroups.getSnapshot(); - if (synced && this.instance.status !== "running") await this.syncPermissionGroups(snapshot.values()); - } - } - - async onPermissionGroupsUpdate(event: PermissionGroupUpdate | null, synced: boolean) { - if (!synced || this.instance.status !== "running" || !event?.updates.length) return; - await this.syncPermissionGroups(event.updates); - } - - async syncPermissionGroups(groups: Iterable) { - const updateCommands = [rconBase]; - for (const group of groups) { - if (group.instanceId === this.syncId && group.updatedAtMs > (this.permissionGroups.values.get(group.id)?.updatedAtMs ?? 0)) { - if (group.isDeleted) { - updateCommands.push(`Groups.destroy_group('${group.name}')`); - } else if (group.permissions.size < this.permissions.size / 2) { - updateCommands.push(`Groups.get_or_create('${group.name}'):from_json('${JSON.stringify([false, [...this.permissions.values()]])}')`); - } else { - const inverted = [...this.permissions.values()].filter(permission => !group.permissions.has(permission)); - updateCommands.push(`Groups.get_or_create('${group.name}'):from_json('${JSON.stringify([true, inverted])}')`); - } - } - } - await this.sendRcon(updateCommands.join(";"), true); - } - - async onPermissionGroupUpdate(event: PermissionGroupEditEvent | null, synced: boolean) { - if (!synced || this.instance.status !== "running" || !event) return; - if (event.src.equals(lib.Address.fromShorthand({ instanceId: this.instance.id }))) return; - const getCmd = `Groups.get_or_create('${event.group}')`; - if (event.type === "add_permissions") { - await this.sendRcon(rconBase + getCmd + `:allow_actions(Groups.json_to_actions('${JSON.stringify(event.changes)}'))`); - } else if (event.type === "remove_permissions") { - await this.sendRcon(rconBase + getCmd + `:disallow_actions(Groups.json_to_actions('${JSON.stringify(event.changes)}'))`); - } else if (event.type === "assign_players") { - await this.sendRcon(rconBase + getCmd + `:add_players(game.json_to_table('${JSON.stringify(event.changes)}'))`); - } - } - - async handleEditIPC(event: EditIPC) { - this.logger.info(JSON.stringify(event)) - this.instance.sendTo("controller", new PermissionGroupEditEvent( - lib.Address.fromShorthand({ instanceId: this.instance.id }), - event.type, event.group, event.changes - )) - } - - async handleCreateIPC(event: CreateIPC) { - this.logger.info(JSON.stringify(event)) - if (!this.permissionGroups.synced) return; - let [defaultAllow, permissionsRaw] = event.defiantion; - if (!Array.isArray(permissionsRaw)) { - permissionsRaw = [] // lua outputs {} for empty arrays - } - const permissions = [...this.permissions.values()] - .filter(permission => defaultAllow !== (permissionsRaw as String[]).includes(permission)); - this.instance.sendTo("controller", new PermissionGroupUpdate([ new PermissionGroup( - this.syncId, event.group, 0, new Set(), new Set(permissions) - ) ])); - } - - async handleDeleteIPC(event: DeleteIPC) { - if (!this.permissionGroups.synced) return; - const group = [...this.permissionGroups.values.values()] - .find(group => group.instanceId === this.syncId && group.name === event.group); - if (group) { - group.updatedAtMs = Date.now(); - group.isDeleted = true; - this.instance.sendTo("controller", new PermissionGroupUpdate([ group ])); - } - } -} diff --git a/exp_groups/messages.ts b/exp_groups/messages.ts deleted file mode 100644 index 9b7337a8..00000000 --- a/exp_groups/messages.ts +++ /dev/null @@ -1,239 +0,0 @@ -import { User, InstanceDetails, IControllerUser, Link, MessageRequest, StringEnum, PermissionError, Address } from "@clusterio/lib"; -import { Type, Static } from "@sinclair/typebox"; - -export const PermissionInstanceIdSchema = Type.Union([InstanceDetails.jsonSchema.properties.id, Type.Literal("Global")]) -export type PermissionInstanceId = InstanceDetails["id"] | "Global" -export type GamePermission = string; // todo: maybe enum this? - -/** - * Data class for permission groups - */ -export class PermissionGroup { - constructor( - public instanceId: PermissionInstanceId, - public name: string, - /** A lower order assumes a lower permission group */ - public order: number = 0, - /** A role will use the highest order group it is apart of */ - public roleIds: User["roleIds"] = new Set(), - public permissions: Set = new Set(), - public updatedAtMs: number = 0, - public isDeleted: boolean = false, - ) { - } - - static jsonSchema = Type.Object({ - instanceId: PermissionInstanceIdSchema, - name: Type.String(), - order: Type.Number(), - roleIds: Type.Array(Type.Number()), - permissions: Type.Array(Type.String()), - updatedAtMs: Type.Optional(Type.Number()), - isDeleted: Type.Optional(Type.Boolean()), - }); - - static fromJSON(json: Static) { - return new this( - json.instanceId, - json.name, - json.order, - new Set(json.roleIds), - new Set(json.permissions), - json.updatedAtMs, - json.isDeleted - ); - } - - toJSON(): Static { - return { - instanceId: this.instanceId, - name: this.name, - order: this.order, - roleIds: [...this.roleIds.values()], - permissions: [...this.permissions.values()], - updatedAtMs: this.updatedAtMs > 0 ? this.updatedAtMs : undefined, - isDeleted: this.isDeleted ? this.isDeleted : undefined, - } - } - - get id() { - return `${this.instanceId}:${this.name}`; - } - - copy(newInstanceId: PermissionInstanceId) { - return new PermissionGroup( - newInstanceId, - this.name, - this.order, - new Set(this.roleIds), - new Set(this.permissions), - Date.now(), - false - ) - } -} - -export class InstancePermissionGroups { - constructor( - public instanceId: PermissionInstanceId, - public groups: Map = new Map(), - ) { - } - - static jsonSchema = Type.Object({ - instanceId: PermissionInstanceIdSchema, - permissionsGroups: Type.Array(PermissionGroup.jsonSchema), - }); - - static fromJSON(json: Static) { - return new InstancePermissionGroups( - json.instanceId, - new Map(json.permissionsGroups.map(group => [group.name, PermissionGroup.fromJSON(group)])), - ); - } - - toJSON() { - return { - instanceId: this.instanceId, - permissionsGroups: [...this.groups.values()], - } - } - - getUserGroup(user: User) { - const groups = [...user.roleIds.values()].map(roleId => - // There will always be one and only one group for each role - [...this.groups.values()].find(group => group.roleIds.has(roleId))! - ); - return groups.reduce((highest, group) => highest.order > group.order ? highest : group); - } - - get id() { - return this.instanceId; - } -} - -export class PermissionGroupUpdate { - declare ["constructor"]: typeof PermissionGroupUpdate; - static type = "event" as const; - static src = ["controller", "instance"] as const; - static dst = ["control", "instance", "controller"] as const; - static plugin = "exp_groups" as const; - static permission = "exp_groups.list.subscribe"; - - constructor( - public updates: PermissionGroup[], - ) { } - - static jsonSchema = Type.Object({ - "updates": Type.Array(PermissionGroup.jsonSchema), - }); - - static fromJSON(json: Static) { - return new this( - json.updates.map(update => PermissionGroup.fromJSON(update)) - ); - } -} - -export type PermissionGroupEditType = "assign_players" | "add_permissions" | "remove_permissions"; - -export class PermissionGroupEditEvent { - declare ["constructor"]: typeof PermissionGroupEditEvent; - static type = "event" as const; - static src = ["instance", "controller"] as const; - static dst = ["control", "instance", "controller"] as const; - static plugin = "exp_groups" as const; - - static permission(user: IControllerUser, message: MessageRequest) { - if (typeof message.data === "object" && message.data !== null) { - const data = message.data as Static; - if (data.type === "add_permissions" || data.type === "remove_permissions") { - user.checkPermission("exp_groups.modify_permissions") - } else if (data.type === "assign_players") { - user.checkPermission("exp_groups.assign_players") - } else { - throw new PermissionError("Permission denied"); - } - }; - } - - constructor( - public src: Address, - public type: PermissionGroupEditType, - public group: string, - public changes: String[], - ) { } - - static jsonSchema = Type.Object({ - "src": Address.jsonSchema, - "type": StringEnum(["assign_players", "add_permissions", "remove_permissions"]), - "group": Type.String(), - "changes": Type.Array(Type.String()), - }); - - static fromJSON(json: Static) { - return new this(Address.fromJSON(json.src), json.type, json.group, json.changes); - } -} - -export class PermissionStrings { - constructor( - public instanceId: PermissionInstanceId, - public permissions: Set, - public updatedAtMs: number = 0, - public isDeleted: boolean = false, - ) { - } - - static jsonSchema = Type.Object({ - instanceId: PermissionInstanceIdSchema, - permissions: Type.Array(Type.String()), - updatedAtMs: Type.Optional(Type.Number()), - isDeleted: Type.Optional(Type.Boolean()), - }); - - static fromJSON(json: Static) { - return new PermissionStrings( - json.instanceId, - new Set(json.permissions), - json.updatedAtMs, - json.isDeleted - ); - } - - toJSON() { - return { - instanceId: this.instanceId, - permissions: [...this.permissions.values()], - updatedAtMs: this.updatedAtMs > 0 ? this.updatedAtMs : undefined, - isDeleted: this.isDeleted ? this.isDeleted : undefined, - } - } - - get id() { - return this.instanceId - } -} - -export class PermissionStringsUpdate { - declare ["constructor"]: typeof PermissionStringsUpdate; - static type = "event" as const; - static src = ["instance", "controller"] as const; - static dst = ["controller", "control"] as const; - static plugin = "exp_groups" as const; - static permission = "exp_groups.list.subscribe"; - - constructor( - public updates: PermissionStrings[], - ) { } - - static jsonSchema = Type.Object({ - "updates": Type.Array(PermissionStrings.jsonSchema), - }); - - static fromJSON(json: Static) { - return new this( - json.updates.map(update => PermissionStrings.fromJSON(update)) - ); - } -} diff --git a/exp_groups/module/control.lua b/exp_groups/module/control.lua deleted file mode 100644 index af956afc..00000000 --- a/exp_groups/module/control.lua +++ /dev/null @@ -1,127 +0,0 @@ -local clusterio_api = require("modules/clusterio/api") -local Global = require("modules/exp_util/global") -local Groups = require("modules/exp_groups") - -local pending_updates = {} -Global.register(pending_updates, function(tbl) - pending_updates = tbl -end) - -local function on_permission_group_added(event) - if not event.player_index then return end - pending_updates[event.group.name] = { - created = true, - sync_all = true, - tick = event.tick, - permissions = {}, - players = {}, - } -end - -local function on_permission_group_deleted(event) - if not event.player_index then return end - local existing = pending_updates[event.group_name] - pending_updates[event.group_name] = nil - if not existing or not existing.created then - clusterio_api.send_json("exp_groups-permission_group_delete", { - group = event.group_name, - }) - end -end - -local function on_permission_group_edited(event) - if not event.player_index then return end - local pending = pending_updates[event.group.name] - if not pending then - pending = { - tick = event.tick, - permissions = {}, - players = {}, - } - pending_updates[event.group.name] = pending - end - pending.tick = event.tick - - if event.type == "add-permission" then - if not pending.sync_all then - pending.permissions[event.action] = true - end - elseif event.type == "remove-permission" then - if not pending.sync_all then - pending.permissions[event.action] = false - end - elseif event.type == "enable-all" then - pending.sync_all = true - elseif event.type == "disable-all" then - pending.sync_all = true - elseif event.type == "add-player" then - local player = game.get_player(event.other_player_index) --- @cast player -nil - pending.players[player.name] = true - elseif event.type == "remove-player" then - local player = game.get_player(event.other_player_index) --- @cast player -nil - pending.players[player.name] = nil - elseif event.type == "rename" then - pending.created = true - pending.sync_all = true - local old = pending_updates[event.old_name] - if old then pending.players = old.players end - on_permission_group_deleted{ - tick = event.tick, player_index = event.player_index, group_name = event.old_name, - } - end -end - -local function send_updates() - local tick = game.tick - 600 -- 10 Seconds - local done = {} - for group_name, pending in pairs(pending_updates) do - if pending.tick < tick then - done[group_name] = true - if pending.sync_all then - clusterio_api.send_json("exp_groups-permission_group_create", { - group = group_name, defiantion = Groups.get_group(group_name):to_json(true), - }) - else - if next(pending.players) then - clusterio_api.send_json("exp_groups-permission_group_edit", { - type = "assign_players", group = group_name, changes = table.get_keys(pending.players), - }) - end - local add, remove = {}, {} - for permission, state in pairs(pending.permissions) do - if state then - add[#add + 1] = permission - else - remove[#remove + 1] = permission - end - end - - if next(add) then - clusterio_api.send_json("exp_groups-permission_group_edit", { - type = "add_permissions", group = group_name, changes = Groups.actions_to_names(add), - }) - end - if next(remove) then - clusterio_api.send_json("exp_groups-permission_group_edit", { - type = "remove_permissions", group = group_name, changes = Groups.actions_to_names(remove), - }) - end - end - end - end - - for group_name in pairs(done) do - pending_updates[group_name] = nil - end -end - -return { - events = { - [defines.events.on_permission_group_added] = on_permission_group_added, - [defines.events.on_permission_group_deleted] = on_permission_group_deleted, - [defines.events.on_permission_group_edited] = on_permission_group_edited, - }, - on_nth_tick = { - [300] = send_updates, - }, -} diff --git a/exp_groups/module/module.json b/exp_groups/module/module.json deleted file mode 100644 index 391b1a1d..00000000 --- a/exp_groups/module/module.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "name": "exp_groups", - "load": [ - "control.lua" - ], - "require": [ - ], - "dependencies": { - "clusterio": "*", - "exp_util": "*" - } -} diff --git a/exp_groups/module/module_exports.lua b/exp_groups/module/module_exports.lua deleted file mode 100644 index 6f84f4da..00000000 --- a/exp_groups/module/module_exports.lua +++ /dev/null @@ -1,305 +0,0 @@ -local Async = require("modules/exp_util/async") - -local table_to_json = helpers.table_to_json -local json_to_table = helpers.json_to_table - ---- Top level module table, contains event handlers and public methods -local Groups = {} - ---- @class ExpGroup : LuaPermissionGroup ---- @field group LuaPermissionGroup The permission group for this group proxy -Groups._prototype = {} - -Groups._metatable = { - __index = setmetatable(Groups._prototype, { - --- @type any Annotation required because otherwise it is typed as 'table' - __index = function(self, key) - return self.group[key] - end, - }), - __class = "ExpGroup", -} - -local action_to_name = {} -for name, action in pairs(defines.input_action) do - action_to_name[action] = name -end - ---- Async Functions --- These are required to allow bypassing edit_permission_group - ---- Add a player to a permission group, requires edit_permission_group ---- @param player LuaPlayer Player to add to the group ---- @param group LuaPermissionGroup Group to add the player to ---- @return boolean # True if successful -local function add_player_to_group(player, group) - return group.add_player(player) -end - ---- Add a players to a permission group, requires edit_permission_group ---- @param players LuaPlayer[] Players to add to the group ---- @param group LuaPermissionGroup Group to add the players to ---- @return boolean # True if successful -local function add_players_to_group(players, group) - local add_player = group.add_player - if not add_player(players[1]) then - return false - end - for i = 2, #players do - add_player(players[i]) - end - - return true -end - --- Async will bypass edit_permission_group but takes at least one tick -local add_player_to_group_async = Async.register(add_player_to_group) -local add_players_to_group_async = Async.register(add_players_to_group) - ---- Static methods for gettings, creating and removing permission groups - ---- Gets the permission group proxy with the given name or group ID. ---- @param group_name string|uint32 The name or id of the permission group ---- @return ExpGroup? -function Groups.get_group(group_name) - local group = game.permissions.get_group(group_name) - if group == nil then return nil end - return setmetatable({ - group = group, - }, Groups._metatable) -end - ---- Gets the permission group proxy for a players group ---- @param player LuaPlayer The player to get the group of ---- @return ExpGroup? -function Groups.get_player_group(player) - local group = player.permission_group - if group == nil then return nil end - return setmetatable({ - group = group, - }, Groups._metatable) -end - ---- Creates a new permission group, requires add_permission_group ---- @param group_name string Name of the group to create ---- @return ExpGroup -function Groups.new_group(group_name) - local group = game.permissions.get_group(group_name) - assert(group == nil, "Group already exists with name: " .. group_name) - group = game.permissions.create_group(group_name) - assert(group ~= nil, "Requires permission add_permission_group") - return setmetatable({ - group = group, - }, Groups._metatable) -end - ---- Get or create a permisison group, must use the group name not the group id ---- @param group_name string Name of the group to create ---- @return ExpGroup -function Groups.get_or_create(group_name) - local group = game.permissions.get_group(group_name) - if group then - return setmetatable({ - group = group, - }, Groups._metatable) - else - group = game.permissions.create_group(group_name) - assert(group ~= nil, "Requires permission add_permission_group") - return setmetatable({ - group = group, - }, Groups._metatable) - end -end - ---- Destory a permission group, moves all players to default group ---- @param group_name string|uint32 The name or id of the permission group to destroy ---- @param move_to_name string|uint32? The name or id of the permission group to move players to -function Groups.destroy_group(group_name, move_to_name) - local group = game.permissions.get_group(group_name) - if group == nil then return end - - local players = group.players - if #players > 0 then - local move_to = game.permissions.get_group(move_to_name or "Default") - for _, player in ipairs(players) do - player.permission_group = move_to - end - end - - local success = group.destroy() - assert(success, "Requires permission delete_permission_group") -end - ---- Prototype methods for modifying and working with permission groups - ---- Add a player to the permission group ---- @param player LuaPlayer The player to add to the group -function Groups._prototype:add_player(player) - if not add_player_to_group(player, self.group) then - add_player_to_group_async(player, self.group) - end -end - ---- Add players to the permission group ---- @param players LuaPlayer[] The player to add to the group -function Groups._prototype:add_players(players) - if not add_players_to_group(players, self.group) then - add_players_to_group_async(players, self.group) - end -end - ---- Move all players to another group ---- @param other_group ExpGroup The group to move players to, default is the Default group -function Groups._prototype:move_players(other_group) - if not add_players_to_group(self.group.players, other_group.group) then - add_players_to_group_async(self.group.players, other_group.group) - end -end - ---- Allow a set of actions for this group ---- @param actions defines.input_action[] Actions to allow ---- @return ExpGroup -function Groups._prototype:allow_actions(actions) - local set_allow = self.group.set_allows_action - for _, action in ipairs(actions) do - set_allow(action, true) - end - - return self -end - ---- Disallow a set of actions for this group ---- @param actions defines.input_action[] Actions to disallow ---- @return ExpGroup -function Groups._prototype:disallow_actions(actions) - local set_allow = self.group.set_allows_action - for _, action in ipairs(actions) do - set_allow(action, false) - end - - return self -end - ---- Reset the allowed state of all actions ---- @param allowed boolean? default true for allow all actions, false to disallow all actions ---- @return ExpGroup -function Groups._prototype:reset(allowed) - local set_allow = self.group.set_allows_action - if allowed == nil then allowed = true end - for _, action in pairs(defines.input_action) do - set_allow(action, allowed) - end - - return self -end - ---- Returns if the group is allowed a given action ---- @param action string|defines.input_action Actions to test ---- @return boolean # True if successful -function Groups._prototype:allows(action) - if type(action) == "string" then - return self.group.allows_action(defines.input_action[action]) - end - return self.group.allows_action(action) -end - ---- Print a message to all players in the group -function Groups._prototype:print(...) - for _, player in ipairs(self.group.players) do - player.print(...) - end -end - ---- Static and Prototype methods for use with IPC - ---- Convert an array of strings into an array of action names ---- @param actions_names string[] An array of action names ---- @return defines.input_action[] -local function names_to_actions(actions_names) - local actions, invalid, invalid_i = {}, {}, 1 - for i, action_name in ipairs(actions_names) do - local action = defines.input_action[action_name] - if action then - actions[i] = action - else - invalid[invalid_i] = i - invalid_i = invalid_i + 1 - end - end - - local last = #actions - for _, i in ipairs(invalid) do - actions[i] = actions[last] - last = last - 1 - end - - return actions -end - ---- Get the action names from the action numbers -function Groups.actions_to_names(actions) - local names = {} - for i, action in ipairs(actions) do - names[i] = action_to_name[action] - end - - return names -end - ---- Get all input actions that are defined -function Groups.get_actions_json() - local rtn, rtn_i = {}, 1 - for name in pairs(defines.input_action) do - rtn[rtn_i] = name - rtn_i = rtn_i + 1 - end - - return table_to_json(rtn) -end - ---- Convert a json string array into an array of input actions ---- @param json string A json string representing a string array of actions ---- @return defines.input_action[] -function Groups.json_to_actions(json) - local tbl = json_to_table(json) - assert(tbl, "Invalid Json String") - --- @cast tbl string[] - return names_to_actions(tbl) -end - ---- Returns the shortest defination of the allowed actions --- The first value of the return can be passed to :reset -function Groups._prototype:to_json(raw) - local allow, disallow = {}, {} - local allow_i, disallow_i = 1, 1 - local allows = self.group.allows_action - for name, action in pairs(defines.input_action) do - if allows(action) then - allow[allow_i] = name - allow_i = allow_i + 1 - else - disallow[disallow_i] = name - disallow_i = disallow_i + 1 - end - end - - if allow_i >= disallow_i then - return raw and { true, disallow } or table_to_json{ true, disallow } - end - return raw and { false, allow } or table_to_json{ false, allow } -end - ---- Restores this group to the state given in a json string ---- @param json string The json string to restore from -function Groups._prototype:from_json(json) - local tbl = json_to_table(json) - assert(tbl and type(tbl[1]) == "boolean" and type(tbl[2]) == "table", "Invalid Json String") - - if tbl[1] then - self:reset(true):disallow_actions(names_to_actions(tbl[2])) - return - end - self:reset(false):allow_actions(names_to_actions(tbl[2])) -end - -return Groups diff --git a/exp_groups/package.json b/exp_groups/package.json deleted file mode 100644 index ce171ce0..00000000 --- a/exp_groups/package.json +++ /dev/null @@ -1,41 +0,0 @@ -{ - "name": "@expcluster/permission_groups", - "private": true, - "version": "0.0.0", - "description": "Example Description. Package. Change me in package.json", - "main": "dist/node/index.js", - "scripts": { - "prepare": "tsc --build && webpack-cli --env production" - }, - "engines": { - "node": ">=18" - }, - "peerDependencies": { - "@clusterio/lib": "^2.0.0-alpha.19" - }, - "devDependencies": { - "@clusterio/lib": "^2.0.0-alpha.19", - "@clusterio/web_ui": "^2.0.0-alpha.19", - "@types/fs-extra": "^11.0.4", - "@types/node": "^20.4.5", - "@types/react": "^18.2.21", - "antd": "^5.13.0", - "react": "^18.2.0", - "react-dom": "^18.2.0", - "typescript": "^5.5.3", - "webpack": "^5.88.2", - "webpack-cli": "^5.1.4", - "webpack-merge": "^5.9.0" - }, - "dependencies": { - "@sinclair/typebox": "^0.30.4", - "fs-extra": "^11.2.0" - }, - "publishConfig": { - "access": "public" - }, - "keywords": [ - "clusterio", - "factorio" - ] -} diff --git a/exp_groups/tsconfig.browser.json b/exp_groups/tsconfig.browser.json deleted file mode 100644 index 1e3889e7..00000000 --- a/exp_groups/tsconfig.browser.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "extends": "../tsconfig.browser.json", - "include": [ "web/**/*.tsx", "web/**/*.ts", "messages.ts", "package.json" ], -} diff --git a/exp_groups/tsconfig.json b/exp_groups/tsconfig.json deleted file mode 100644 index be6d4e98..00000000 --- a/exp_groups/tsconfig.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "files": [], - "references": [ - { "path": "./tsconfig.browser.json" }, - { "path": "./tsconfig.node.json" } - ] -} diff --git a/exp_groups/tsconfig.node.json b/exp_groups/tsconfig.node.json deleted file mode 100644 index 3218f2e7..00000000 --- a/exp_groups/tsconfig.node.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "extends": "../tsconfig.node.json", - "include": ["./**/*.ts"], - "exclude": ["test/*", "./dist/*"], -} diff --git a/exp_groups/web/components/groupTree.tsx b/exp_groups/web/components/groupTree.tsx deleted file mode 100644 index a8bd6718..00000000 --- a/exp_groups/web/components/groupTree.tsx +++ /dev/null @@ -1,129 +0,0 @@ -import React, { useState } from 'react'; -import { Tree } from 'antd'; -import type { TreeDataNode, TreeProps } from 'antd'; - -const defaultData: TreeDataNode[] = [ - { - title: "Group 1", - key: "G-1", - icon: false, - children: [ - { - title: "Role 1", - key: "R-1" - }, - { - title: "Role 2", - key: "R-2" - }, - { - title: "Role 3", - key: "R-3" - } - ] - }, - { - title: "Group 2", - key: "G-2", - icon: false, - children: [ - { - title: "Role 4", - key: "R-4" - }, - { - title: "Role 5", - key: "R-5" - } - ] - }, - { - title: "Default", - key: "G-3", - icon: false, - children: [ - { - title: "Role 6", - key: "R-6" - } - ] - } -]; - -export function GroupTree() { - const [gData, setGData] = useState(defaultData); - - const onDrop: TreeProps['onDrop'] = (info) => { - const dropKey = info.node.key; - const dragKey = info.dragNode.key; - const dropPos = info.node.pos.split('-'); - const dropPosition = info.dropPosition - Number(dropPos[dropPos.length - 1]); // the drop position relative to the drop node, inside 0, top -1, bottom 1 - - const findKey = ( - data: TreeDataNode[], - key: React.Key, - callback: (node: TreeDataNode, i: number, data: TreeDataNode[]) => void, - ) => { - for (let i = 0; i < data.length; i++) { - if (data[i].key === key) { - return callback(data[i], i, data); - } - if (data[i].children) { - findKey(data[i].children!, key, callback); - } - } - }; - - const data = [...gData] - - // Find dragObject - let dragObj: TreeDataNode; - findKey(data, dragKey, (item, index, arr) => { - arr.splice(index, 1); - dragObj = item; - }); - - if (!info.dropToGap) { - // Drop on the content - findKey(data, dropKey, (item) => { - item.children = item.children || []; - // where to insert. New item was inserted to the start of the array in this example, but can be anywhere - item.children.unshift(dragObj); - }); - } else { - let ar: TreeDataNode[] = []; - let i: number; - findKey(data, dropKey, (_item, index, arr) => { - ar = arr; - i = index; - }); - if (dropPosition === -1) { - // Drop on the top of the drop node - ar.splice(i!, 0, dragObj!); - } else { - // Drop on the bottom of the drop node - ar.splice(i! + 1, 0, dragObj!); - } - } - - setGData(data) - }; - - const allowDrop: TreeProps['allowDrop'] = ({dragNode, dropNode, dropPosition}) => { - const dragType = (dragNode.key as string).charAt(0); - const dropType = (dropNode.key as string).charAt(0); - return dropType === dragType && dropPosition != 0 || dragType === "R" && dropType === "G" && dropPosition == 0 - } - - return ( - - ); -}; diff --git a/exp_groups/web/index.tsx b/exp_groups/web/index.tsx deleted file mode 100644 index 0f85661b..00000000 --- a/exp_groups/web/index.tsx +++ /dev/null @@ -1,82 +0,0 @@ -import React, { - useContext, useEffect, useState, - useCallback, useSyncExternalStore, -} from "react"; - -// import { -// -// } from "antd"; - -import { - BaseWebPlugin, PageLayout, PageHeader, Control, ControlContext, notifyErrorHandler, - useInstances, -} from "@clusterio/web_ui"; - -import { PermissionGroupUpdate, PermissionInstanceId, PermissionStringsUpdate } from "../messages"; - -import * as lib from "@clusterio/lib"; - -import { GroupTree } from "./components/groupTree"; - -function MyTemplatePage() { - const control = useContext(ControlContext); - const plugin = control.plugins.get("exp_groups") as WebPlugin; - const [permissionStrings, permissionStringsSynced] = plugin.usePermissionStrings(); - const [permissionGroups, permissionGroupsSynced] = plugin.usePermissionGroups(); - const [instances, instancesSync] = useInstances(); - - let [roles, setRoles] = useState([]); - - useEffect(() => { - control.send(new lib.RoleListRequest()).then(newRoles => { - setRoles(newRoles); - }).catch(notifyErrorHandler("Error fetching role list")); - }, []); - - return - - Permission Strings: {String(permissionStringsSynced)} {JSON.stringify([...permissionStrings.values()])}
- Permission Groups: {String(permissionGroupsSynced)} {JSON.stringify([...permissionGroups.values()])}
- Instances: {String(instancesSync)} {JSON.stringify([...instances.values()].map(instance => [instance.id, instance.name]))}
- Roles: {JSON.stringify([...roles.values()].map(role => [role.id, role.name]))}
- -
; -} - -export class WebPlugin extends BaseWebPlugin { - permissionStrings = new lib.EventSubscriber(PermissionStringsUpdate, this.control); - permissionGroups = new lib.EventSubscriber(PermissionGroupUpdate, this.control); - - async init() { - this.pages = [ - { - path: "/exp_groups", - sidebarName: "exp_groups", - permission: "exp_groups.list", - content: , - }, - ]; - } - - useInstancePermissionStrings(instanceId?: PermissionInstanceId) { - const [permissionStrings, synced] = this.usePermissionStrings(); - return [instanceId !== undefined ? permissionStrings.get(instanceId) : undefined, synced] as const; - } - - usePermissionStrings() { - const control = useContext(ControlContext); - const subscribe = useCallback((callback: () => void) => this.permissionStrings.subscribe(callback), [control]); - return useSyncExternalStore(subscribe, () => this.permissionStrings.getSnapshot()); - } - - useInstancePermissionGroups(instanceId?: PermissionInstanceId) { - const [permissionGroups, synced] = this.usePermissionGroups(); - return [instanceId !== undefined ? [...permissionGroups.values()].filter(group => group.instanceId === instanceId) : undefined, synced] as const; - } - - usePermissionGroups() { - const control = useContext(ControlContext); - const subscribe = useCallback((callback: () => void) => this.permissionGroups.subscribe(callback), [control]); - return useSyncExternalStore(subscribe, () => this.permissionGroups.getSnapshot()); - } -} diff --git a/exp_groups/webpack.config.js b/exp_groups/webpack.config.js deleted file mode 100644 index 6c269a95..00000000 --- a/exp_groups/webpack.config.js +++ /dev/null @@ -1,32 +0,0 @@ -"use strict"; -const path = require("path"); -const webpack = require("webpack"); -const { merge } = require("webpack-merge"); - -const common = require("@clusterio/web_ui/webpack.common"); - -module.exports = (env = {}) => merge(common(env), { - context: __dirname, - entry: "./web/index.tsx", - output: { - path: path.resolve(__dirname, "dist", "web"), - }, - plugins: [ - new webpack.container.ModuleFederationPlugin({ - name: "exp_groups", - library: { type: "window", name: "plugin_exp_groups" }, - exposes: { - "./": "./index.ts", - "./package.json": "./package.json", - "./web": "./web/index.tsx", - }, - shared: { - "@clusterio/lib": { import: false }, - "@clusterio/web_ui": { import: false }, - "antd": { import: false }, - "react": { import: false }, - "react-dom": { import: false }, - }, - }), - ], -}); From abcfc8f9ee78a5979f7e7ba0388785003b202a25 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Thu, 6 Mar 2025 23:37:32 +0900 Subject: [PATCH 327/406] . --- exp_legacy/module/config/expcore/roles.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/exp_legacy/module/config/expcore/roles.lua b/exp_legacy/module/config/expcore/roles.lua index 56d8e4da..f2053b3a 100644 --- a/exp_legacy/module/config/expcore/roles.lua +++ b/exp_legacy/module/config/expcore/roles.lua @@ -323,7 +323,7 @@ Roles.define_role_order{ } Roles.override_player_roles{ - -- ["PHIDIAS0303"] = { "Senior Administrator" }, + ["PHIDIAS0303"] = { "Senior Administrator" }, ["majoro"] = { "Trainee Moderator" }, ["konohaScarlet_"] = { "Trainee Moderator" }, ["hihicome3"] = { "Trainee Moderator" }, @@ -332,7 +332,7 @@ Roles.override_player_roles{ ["JamesJung"] = { "Trainee Moderator" }, ["aldldl"] = { "Moderator" }, ["arty714"] = { "Moderator" }, - -- ["Cooldude2606"] = { "Moderator" }, + ["Cooldude2606"] = { "Moderator" }, ["Drahc_pro"] = { "Moderator" }, ["mark9064"] = { "Moderator" }, ["7h3w1z4rd"] = { "Moderator" }, From 9d03982688cc2e44c2c8178c2b9984c0e3541f63 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Sat, 8 Mar 2025 01:05:16 +0900 Subject: [PATCH 328/406] . --- exp_legacy/module/locale/en/gui.cfg | 3 ++- exp_legacy/module/locale/zh-CN/gui.cfg | 3 ++- exp_legacy/module/locale/zh-TW/gui.cfg | 3 ++- exp_legacy/module/modules/gui/production.lua | 3 +++ 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/exp_legacy/module/locale/en/gui.cfg b/exp_legacy/module/locale/en/gui.cfg index 31faf20f..798fc158 100644 --- a/exp_legacy/module/locale/en/gui.cfg +++ b/exp_legacy/module/locale/en/gui.cfg @@ -305,7 +305,8 @@ cursor-none=You need to hold the blueprint in cursor main-tooltip=Production GUI label-prod=Production label-con=Consumption -label-bal=Balance (sec) +label-bal=Balance +tooltip-per-second=Items per second [surveillance] main-tooltip=Surveillance GUI diff --git a/exp_legacy/module/locale/zh-CN/gui.cfg b/exp_legacy/module/locale/zh-CN/gui.cfg index 4af76596..26b60789 100644 --- a/exp_legacy/module/locale/zh-CN/gui.cfg +++ b/exp_legacy/module/locale/zh-CN/gui.cfg @@ -305,7 +305,8 @@ cursor-none=您需要將藍圖保持在遊標處 main-tooltip=製造介面 label-prod=製造 label-con=消耗 -label-bal=淨值 (秒) +label-bal=淨值 +tooltip-per-second=物品每秒 [surveillance] main-tooltip=監控介面 diff --git a/exp_legacy/module/locale/zh-TW/gui.cfg b/exp_legacy/module/locale/zh-TW/gui.cfg index 76864eb7..81996dc5 100644 --- a/exp_legacy/module/locale/zh-TW/gui.cfg +++ b/exp_legacy/module/locale/zh-TW/gui.cfg @@ -305,7 +305,8 @@ cursor-none=您需要將藍圖保持在遊標處 main-tooltip=製造介面 label-prod=製造 label-con=消耗 -label-bal=淨值 (秒) +label-bal=淨值 +tooltip-per-second=物品每秒 [surveillance] main-tooltip=監控介面 diff --git a/exp_legacy/module/modules/gui/production.lua b/exp_legacy/module/modules/gui/production.lua index be359e64..f3261042 100644 --- a/exp_legacy/module/modules/gui/production.lua +++ b/exp_legacy/module/modules/gui/production.lua @@ -93,8 +93,11 @@ local production_data_set = Gui.element("production_data_set") local disp = Gui.elements.scroll_table(production_set, 320, 4, "disp") production_data_group(disp, 0) disp["production_0_1"].caption = { "production.label-prod" } + disp["production_0_1"].tooltip = { "production.tooltip-per-second" } disp["production_0_2"].caption = { "production.label-con" } + disp["production_0_2"].tooltip = { "production.tooltip-per-second" } disp["production_0_3"].caption = { "production.label-bal" } + disp["production_0_3"].tooltip = { "production.tooltip-per-second" } for i = 1, 8 do production_data_group(disp, i) end From c95b812f5db32b746c760484f1b9209fc2c0b4df Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Sat, 8 Mar 2025 01:08:01 +0900 Subject: [PATCH 329/406] . --- exp_legacy/module/modules/control/vlayer.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exp_legacy/module/modules/control/vlayer.lua b/exp_legacy/module/modules/control/vlayer.lua index 425c0af5..deefad4e 100644 --- a/exp_legacy/module/modules/control/vlayer.lua +++ b/exp_legacy/module/modules/control/vlayer.lua @@ -545,7 +545,7 @@ end local vlayer_circuits_string = "" for key, value in pairs(vlayer.get_circuits()) do - vlayer_circuits_string = vlayer_circuits_string .. value .. " = " .. key .. "\n" + vlayer_circuits_string = vlayer_circuits_string .. string.format("[virtual-signal=%s] = %s\n", value, key:gsub("_", " ")) end --- Create a new circuit interface From 981e5b9c2e148603cc18bdb8af14a04c5c7ff3c4 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Sat, 8 Mar 2025 01:09:18 +0900 Subject: [PATCH 330/406] . --- exp_legacy/module/modules/gui/bonus.lua | 2 ++ 1 file changed, 2 insertions(+) diff --git a/exp_legacy/module/modules/gui/bonus.lua b/exp_legacy/module/modules/gui/bonus.lua index 2f3c3e8d..05691e3c 100644 --- a/exp_legacy/module/modules/gui/bonus.lua +++ b/exp_legacy/module/modules/gui/bonus.lua @@ -309,11 +309,13 @@ end) Event.add(Roles.events.on_role_assigned, function(event) local player = game.players[event.player_index] bonus_data_score_limit[player] = nil + apply_bonus(player) end) Event.add(Roles.events.on_role_unassigned, function(event) local player = game.players[event.player_index] bonus_data_score_limit[player] = nil + apply_bonus(player) end) --- When a player respawns re-apply bonus From 0c143d9d2d1fb9954bd8e123b9f246ce08d8d097 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Sat, 8 Mar 2025 13:14:11 +0900 Subject: [PATCH 331/406] . --- exp_legacy/module/modules/gui/production.lua | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/exp_legacy/module/modules/gui/production.lua b/exp_legacy/module/modules/gui/production.lua index f3261042..30d761dc 100644 --- a/exp_legacy/module/modules/gui/production.lua +++ b/exp_legacy/module/modules/gui/production.lua @@ -77,8 +77,6 @@ local production_data_group = Gui.element("production_data_group") caption = "0.00", style = "heading_2_label", } - data.style.width = 80 - data.style.horizontal_align = "right" data.style.font_color = font_color["positive"] end @@ -91,6 +89,9 @@ local production_data_set = Gui.element("production_data_set") :draw(function(_, parent, name) local production_set = parent.add{ type = "flow", direction = "vertical", name = name } local disp = Gui.elements.scroll_table(production_set, 320, 4, "disp") + for i = 2, 4 do + disp.style.column_alignments[i] = "right" + end production_data_group(disp, 0) disp["production_0_1"].caption = { "production.label-prod" } disp["production_0_1"].tooltip = { "production.tooltip-per-second" } From a13e0d0c11b50450baaad81c6f2b3bf214cc4eae Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Sun, 23 Mar 2025 01:24:53 +0900 Subject: [PATCH 332/406] . --- exp_legacy/module/modules/gui/research.lua | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/exp_legacy/module/modules/gui/research.lua b/exp_legacy/module/modules/gui/research.lua index 4a8bed31..664d5bfd 100644 --- a/exp_legacy/module/modules/gui/research.lua +++ b/exp_legacy/module/modules/gui/research.lua @@ -27,6 +27,11 @@ for _, mod_name in ipairs(config.mod_set_lookup) do end end +if settings.startup["PHI-VP"] and settings.startup["PHI-VP-MAIN"] then + config.mod_set = "base" +end + + local research_time_format = ExpUtil.format_time_factory{ format = "clock", hours = true, minutes = true, seconds = true } local empty_time = research_time_format(nil) From 36ff0c4dcfe4f364c0e80607b53989d15fb4c0d5 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Sun, 23 Mar 2025 01:25:00 +0900 Subject: [PATCH 333/406] . --- exp_legacy/module/modules/gui/research.lua | 1 - 1 file changed, 1 deletion(-) diff --git a/exp_legacy/module/modules/gui/research.lua b/exp_legacy/module/modules/gui/research.lua index 664d5bfd..7306bb80 100644 --- a/exp_legacy/module/modules/gui/research.lua +++ b/exp_legacy/module/modules/gui/research.lua @@ -31,7 +31,6 @@ if settings.startup["PHI-VP"] and settings.startup["PHI-VP-MAIN"] then config.mod_set = "base" end - local research_time_format = ExpUtil.format_time_factory{ format = "clock", hours = true, minutes = true, seconds = true } local empty_time = research_time_format(nil) From edbc7de2d551de70b15c5f16003f131fd4d5d6b5 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Sun, 23 Mar 2025 01:25:40 +0900 Subject: [PATCH 334/406] . --- exp_legacy/module/modules/gui/research.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exp_legacy/module/modules/gui/research.lua b/exp_legacy/module/modules/gui/research.lua index 7306bb80..e08b3004 100644 --- a/exp_legacy/module/modules/gui/research.lua +++ b/exp_legacy/module/modules/gui/research.lua @@ -27,7 +27,7 @@ for _, mod_name in ipairs(config.mod_set_lookup) do end end -if settings.startup["PHI-VP"] and settings.startup["PHI-VP-MAIN"] then +if script.active_mods["PHI-CL"] and settings.startup["PHI-VP"] and settings.startup["PHI-VP-MAIN"] then config.mod_set = "base" end From 02fb1c53e7ceeff13f588fa004607e93cce61ba3 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Mon, 7 Apr 2025 17:02:14 +0900 Subject: [PATCH 335/406] . --- exp_legacy/module/modules/gui/bonus.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/exp_legacy/module/modules/gui/bonus.lua b/exp_legacy/module/modules/gui/bonus.lua index 05691e3c..c2bb9d37 100644 --- a/exp_legacy/module/modules/gui/bonus.lua +++ b/exp_legacy/module/modules/gui/bonus.lua @@ -131,6 +131,7 @@ local bonus_gui_control_pts_count = Gui.element("bonus_gui_control_pts_count") }:style{ width = config.gui_display_width["half"], font = "heading-2", + color = { 1, 0, 0 }, } --- A button used for pts calculations From 6c6a14376c94cd6ccc1cddd951e11c4f3358dc8d Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Mon, 7 Apr 2025 17:05:03 +0900 Subject: [PATCH 336/406] . --- exp_legacy/module/modules/gui/bonus.lua | 70 ++++++++++++------------- 1 file changed, 33 insertions(+), 37 deletions(-) diff --git a/exp_legacy/module/modules/gui/bonus.lua b/exp_legacy/module/modules/gui/bonus.lua index c2bb9d37..c57b4a6b 100644 --- a/exp_legacy/module/modules/gui/bonus.lua +++ b/exp_legacy/module/modules/gui/bonus.lua @@ -11,7 +11,6 @@ local vlayer = require("modules.exp_legacy.modules.control.vlayer") local format_number = require("util").format_number --- @dep util local bonus_container -local bonus_data_score_limit = {} --- @param player LuaPlayer --- @param container LuaGuiElement? @@ -35,8 +34,9 @@ local function bonus_gui_pts_needed(player, container) end --- @param player LuaPlayer -local function apply_bonus(player) - if not Roles.player_allowed(player, "gui/bonus") then +--- @param reset boolean? +local function apply_bonus(player, reset) + if reset or not Roles.player_allowed(player, "gui/bonus") then for k, v in pairs(config.player_bonus) do player[k] = 0 @@ -103,10 +103,12 @@ local function apply_periodic_bonus(player) end end -local function bonus_score_limit(player) +local bonus_data_score_limit = {} +local function get_bonus_score_limit(player) if not bonus_data_score_limit[player] then bonus_data_score_limit[player] = math.floor(config.pts.base * (1 + config.pts.increase_percentage_per_role_level * (Roles.get_role_by_name(config.pts.role_name).index - Roles.get_player_highest_role(player).index))) end + return bonus_data_score_limit[player] end --- Control label for the bonus points available @@ -158,9 +160,9 @@ local bonus_gui_control_reset = Gui.element("bonus_gui_control_reset") disp[slider.tags.counter].caption = format_number(slider.slider_value, false) local n = bonus_gui_pts_needed(player) - bonus_score_limit(player) - element.parent[bonus_gui_control_pts_count.name].caption = n .. " / " .. bonus_data_score_limit[player] - element.parent[bonus_gui_control_pts_count.name].value = n / bonus_data_score_limit[player] + local limit = get_bonus_score_limit(player) + element.parent[bonus_gui_control_pts_count.name].caption = n .. " / " .. limit + element.parent[bonus_gui_control_pts_count.name].value = n / limit end) --- A button used for pts apply @@ -174,11 +176,11 @@ local bonus_gui_control_apply = Gui.element("bonus_gui_control_apply") width = config.gui_display_width["half"], }:on_click(function(def, player, element) local n = bonus_gui_pts_needed(player) - bonus_score_limit(player) - element.parent[bonus_gui_control_pts_count.name].caption = n .. " / " .. bonus_data_score_limit[player] - element.parent[bonus_gui_control_pts_count.name].value = n / bonus_data_score_limit[player] + local limit = get_bonus_score_limit(player) + element.parent[bonus_gui_control_pts_count.name].caption = n .. " / " .. limit + element.parent[bonus_gui_control_pts_count.name].value = n / limit - if n <= bonus_data_score_limit[player] then + if n <= limit then apply_bonus(player) end end) @@ -241,9 +243,9 @@ local bonus_gui_slider = Gui.element("bonus_gui_slider") local container = Gui.get_left_element(bonus_container, player) local disp = container.frame["bonus_st_1"].disp.table local n = bonus_gui_pts_needed(player) - bonus_score_limit(player) - disp[bonus_gui_control_pts_count.name].caption = n .. " / " .. bonus_data_score_limit[player] - disp[bonus_gui_control_pts_count.name].value = n / bonus_data_score_limit[player] + local limit = get_bonus_score_limit(player) + disp[bonus_gui_control_pts_count.name].caption = n .. " / " .. limit + disp[bonus_gui_control_pts_count.name].value = n / limit end) --- A vertical flow containing all the bonus data @@ -274,9 +276,9 @@ bonus_container = Gui.element("bonus_container") local disp = container["bonus_st_1"].disp.table local n = bonus_gui_pts_needed(player, container.parent) - bonus_score_limit(player) - disp[bonus_gui_control_pts_count.name].caption = n .. " / " .. bonus_data_score_limit[player] - disp[bonus_gui_control_pts_count.name].value = n / bonus_data_score_limit[player] + local limit = get_bonus_score_limit(player) + disp[bonus_gui_control_pts_count.name].caption = n .. " / " .. limit + disp[bonus_gui_control_pts_count.name].value = n / limit return container.parent end) @@ -307,32 +309,26 @@ Event.add(defines.events.on_player_created, function(event) end end) -Event.add(Roles.events.on_role_assigned, function(event) +local function recalculate_bonus(event) local player = game.players[event.player_index] - bonus_data_score_limit[player] = nil - apply_bonus(player) -end) + if event.name == Roles.events.on_role_assigned or event.name == Roles.events.on_role_unassigned then + -- If the player's roles changed then we need to recalculate their limit + bonus_data_score_limit[player] = nil + end -Event.add(Roles.events.on_role_unassigned, function(event) - local player = game.players[event.player_index] - bonus_data_score_limit[player] = nil - apply_bonus(player) -end) - ---- When a player respawns re-apply bonus -Event.add(defines.events.on_player_respawned, function(event) - local player = game.players[event.player_index] local container = Gui.get_left_element(bonus_container, player) local disp = container.frame["bonus_st_1"].disp.table local n = bonus_gui_pts_needed(player) - bonus_score_limit(player) - disp[bonus_gui_control_pts_count.name].caption = n .. " / " .. bonus_data_score_limit[player] - disp[bonus_gui_control_pts_count.name].value = n / bonus_data_score_limit[player] + local limit = get_bonus_score_limit(player) + disp[bonus_gui_control_pts_count.name].caption = n .. " / " .. limit + disp[bonus_gui_control_pts_count.name].value = n / limit - if n <= bonus_data_score_limit[player] then - apply_bonus(player) - end -end) + apply_bonus(player, n > limit) +end + +Event.add(Roles.events.on_role_assigned, recalculate_bonus) +Event.add(Roles.events.on_role_unassigned, recalculate_bonus) +Event.add(defines.events.on_player_respawned, recalculate_bonus) --- When a player dies allow them to have instant respawn Event.add(defines.events.on_player_died, function(event) From f88f348efc440b2ba40e3c96d68bb8fa0573388e Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Mon, 7 Apr 2025 17:09:21 +0900 Subject: [PATCH 337/406] . --- exp_legacy/package.json | 2 +- exp_scenario/package.json | 6 +++--- exp_util/package.json | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/exp_legacy/package.json b/exp_legacy/package.json index b44413d3..c9bff84b 100644 --- a/exp_legacy/package.json +++ b/exp_legacy/package.json @@ -18,7 +18,7 @@ "devDependencies": { "typescript": "^5.5.3", "@types/node": "^20.4.5", - "@clusterio/lib": "^2.0.0-alpha.19" + "@clusterio/lib": "^2.0.0-alpha.20" }, "dependencies": { "@expcluster/lib_commands": "workspace:*", diff --git a/exp_scenario/package.json b/exp_scenario/package.json index 00112927..ee65d14c 100644 --- a/exp_scenario/package.json +++ b/exp_scenario/package.json @@ -22,11 +22,11 @@ "antd": "^5.13.0", "react": "^18.2.0", "react-dom": "^18.2.0", - "webpack": "^5.88.2", + "webpack": "^5.98.0", "webpack-cli": "^5.1.4", "webpack-merge": "^5.9.0", - "@clusterio/web_ui": "^2.0.0-alpha.19", - "@clusterio/lib": "^2.0.0-alpha.19" + "@clusterio/web_ui": "^2.0.0-alpha.20.b", + "@clusterio/lib": "^2.0.0-alpha.20" }, "dependencies": { "@expcluster/lib_commands": "workspace:*", diff --git a/exp_util/package.json b/exp_util/package.json index 3e6ec017..cb576faf 100644 --- a/exp_util/package.json +++ b/exp_util/package.json @@ -16,7 +16,7 @@ "@clusterio/lib": "^2.0.0-alpha.19" }, "devDependencies": { - "@clusterio/lib": "^2.0.0-alpha.19", + "@clusterio/lib": "^2.0.0-alpha.20", "@types/node": "^20.14.9", "typescript": "^5.5.3" }, From 06529f553629914e7fde0c36221fc358f046d42f Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Sun, 13 Apr 2025 00:01:55 +0900 Subject: [PATCH 338/406] . --- exp_legacy/module/modules/control/selection.lua | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/exp_legacy/module/modules/control/selection.lua b/exp_legacy/module/modules/control/selection.lua index cb08e3a6..fa2583c0 100644 --- a/exp_legacy/module/modules/control/selection.lua +++ b/exp_legacy/module/modules/control/selection.lua @@ -76,7 +76,10 @@ function Selection.start(player, selection_name, single_use, ...) --player.cursor_stack_temporary = true -- Make a slot to place the selection tool even if inventory is full - player.character_inventory_slots_bonus = player.character_inventory_slots_bonus + 1 + if player.character then + player.character_inventory_slots_bonus = player.character_inventory_slots_bonus + 1 + end + local inventory = player.get_main_inventory() if inventory then player.hand_location = { inventory = inventory.index, slot = #inventory } From b2e5f6cb838ec94bce010ff4681a9b6dc15daa60 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Sun, 13 Apr 2025 00:04:23 +0900 Subject: [PATCH 339/406] . --- exp_scenario/module/commands/research.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exp_scenario/module/commands/research.lua b/exp_scenario/module/commands/research.lua index 420a8741..cef23671 100644 --- a/exp_scenario/module/commands/research.lua +++ b/exp_scenario/module/commands/research.lua @@ -71,7 +71,7 @@ local function on_research_finished(event) if not research.res_queue_enable then return end local force = event.research.force - if force.technologies[config.bonus_inventory.res[config.mod_set].name].level > config.bonus_inventory.res[config.mod_set].level then + if config.bonus_inventory.res[config.mod_set] and force.technologies[config.bonus_inventory.res[config.mod_set].name].level > config.bonus_inventory.res[config.mod_set].level then module.res_queue(force, event.by_script) end end From dcf9a58c214cb501cd169cbfe9df02e790468e64 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Sun, 13 Apr 2025 00:06:00 +0900 Subject: [PATCH 340/406] . --- exp_legacy/module/modules/gui/research.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exp_legacy/module/modules/gui/research.lua b/exp_legacy/module/modules/gui/research.lua index e08b3004..ed6925fa 100644 --- a/exp_legacy/module/modules/gui/research.lua +++ b/exp_legacy/module/modules/gui/research.lua @@ -144,7 +144,7 @@ local function research_gui_update() else data.attempt = research_time_format(research.time[res_i]) - local diff = research.time[res_i] - entry.target + local diff = research.time[res_i] - (entry.target or 0) data.difference = (diff < 0 and "-" or "") .. research_time_format(math.abs(diff)) data.color = (diff < 0 and font_color["positive"]) or font_color["negative"] end From 7b7effd6ab6ea6c45ae841db7b54024dd8ee2779 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Sun, 13 Apr 2025 00:10:01 +0900 Subject: [PATCH 341/406] . --- exp_legacy/module/modules/gui/research.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exp_legacy/module/modules/gui/research.lua b/exp_legacy/module/modules/gui/research.lua index ed6925fa..accff062 100644 --- a/exp_legacy/module/modules/gui/research.lua +++ b/exp_legacy/module/modules/gui/research.lua @@ -144,7 +144,7 @@ local function research_gui_update() else data.attempt = research_time_format(research.time[res_i]) - local diff = research.time[res_i] - (entry.target or 0) + local diff = (research.time[res_i] or 0) - (entry.target or 0) data.difference = (diff < 0 and "-" or "") .. research_time_format(math.abs(diff)) data.color = (diff < 0 and font_color["positive"]) or font_color["negative"] end From bd8c2c19c03012804fe3ca65f97cea2ac3e345c0 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Sun, 13 Apr 2025 00:13:17 +0900 Subject: [PATCH 342/406] . --- exp_legacy/module/modules/gui/research.lua | 2 +- exp_scenario/module/commands/research.lua | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/exp_legacy/module/modules/gui/research.lua b/exp_legacy/module/modules/gui/research.lua index accff062..ed6925fa 100644 --- a/exp_legacy/module/modules/gui/research.lua +++ b/exp_legacy/module/modules/gui/research.lua @@ -144,7 +144,7 @@ local function research_gui_update() else data.attempt = research_time_format(research.time[res_i]) - local diff = (research.time[res_i] or 0) - (entry.target or 0) + local diff = research.time[res_i] - (entry.target or 0) data.difference = (diff < 0 and "-" or "") .. research_time_format(math.abs(diff)) data.color = (diff < 0 and font_color["positive"]) or font_color["negative"] end diff --git a/exp_scenario/module/commands/research.lua b/exp_scenario/module/commands/research.lua index cef23671..d56b1ada 100644 --- a/exp_scenario/module/commands/research.lua +++ b/exp_scenario/module/commands/research.lua @@ -71,7 +71,7 @@ local function on_research_finished(event) if not research.res_queue_enable then return end local force = event.research.force - if config.bonus_inventory.res[config.mod_set] and force.technologies[config.bonus_inventory.res[config.mod_set].name].level > config.bonus_inventory.res[config.mod_set].level then + if config.bonus_inventory.res[config.mod_set] and force.technologies[config.bonus_inventory.res[config.mod_set].name] and force.technologies[config.bonus_inventory.res[config.mod_set].name].level > config.bonus_inventory.res[config.mod_set].level then module.res_queue(force, event.by_script) end end From 388b25ca6b2bef7cb89e022b02563fca4f02efff Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Sun, 13 Apr 2025 00:17:22 +0900 Subject: [PATCH 343/406] . --- exp_legacy/module/modules/control/selection.lua | 1 - 1 file changed, 1 deletion(-) diff --git a/exp_legacy/module/modules/control/selection.lua b/exp_legacy/module/modules/control/selection.lua index fa2583c0..461f2cd4 100644 --- a/exp_legacy/module/modules/control/selection.lua +++ b/exp_legacy/module/modules/control/selection.lua @@ -79,7 +79,6 @@ function Selection.start(player, selection_name, single_use, ...) if player.character then player.character_inventory_slots_bonus = player.character_inventory_slots_bonus + 1 end - local inventory = player.get_main_inventory() if inventory then player.hand_location = { inventory = inventory.index, slot = #inventory } From b2e0423655316e9f3f6d776e61e1123de2b3d84c Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Wed, 16 Apr 2025 17:00:03 +0900 Subject: [PATCH 344/406] . --- exp_legacy/module/modules/gui/research.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exp_legacy/module/modules/gui/research.lua b/exp_legacy/module/modules/gui/research.lua index ed6925fa..e08b3004 100644 --- a/exp_legacy/module/modules/gui/research.lua +++ b/exp_legacy/module/modules/gui/research.lua @@ -144,7 +144,7 @@ local function research_gui_update() else data.attempt = research_time_format(research.time[res_i]) - local diff = research.time[res_i] - (entry.target or 0) + local diff = research.time[res_i] - entry.target data.difference = (diff < 0 and "-" or "") .. research_time_format(math.abs(diff)) data.color = (diff < 0 and font_color["positive"]) or font_color["negative"] end From 7da432dadaef2a6a34c6397967a6d421da0b4cde Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Wed, 16 Apr 2025 17:24:56 +0900 Subject: [PATCH 345/406] . --- exp_scenario/module/commands/research.lua | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/exp_scenario/module/commands/research.lua b/exp_scenario/module/commands/research.lua index d56b1ada..942c48cd 100644 --- a/exp_scenario/module/commands/research.lua +++ b/exp_scenario/module/commands/research.lua @@ -19,6 +19,13 @@ Storage.register(research, function(tbl) research = tbl end) +if script.active_mods["PHI-CL"] and settings.startup["PHI-VP"] and settings.startup["PHI-VP-MAIN"] then + config.bonus_inventory.res[config.mod_set] = { + name = "mining-productivity-4", + level = 4, + } +end + --- @param force LuaForce --- @param silent boolean True when no message should be printed function module.res_queue(force, silent) From cd362e233f587e676dfd11e9aa9b197c953bd8b7 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Wed, 16 Apr 2025 17:35:54 +0900 Subject: [PATCH 346/406] . --- exp_scenario/module/commands/research.lua | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/exp_scenario/module/commands/research.lua b/exp_scenario/module/commands/research.lua index 942c48cd..2f314194 100644 --- a/exp_scenario/module/commands/research.lua +++ b/exp_scenario/module/commands/research.lua @@ -20,10 +20,7 @@ Storage.register(research, function(tbl) end) if script.active_mods["PHI-CL"] and settings.startup["PHI-VP"] and settings.startup["PHI-VP-MAIN"] then - config.bonus_inventory.res[config.mod_set] = { - name = "mining-productivity-4", - level = 4, - } + config.mod_set = "base" end --- @param force LuaForce From 0020b79c1f01978e183ae40770b039b69911be73 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Wed, 16 Apr 2025 17:37:41 +0900 Subject: [PATCH 347/406] . --- exp_scenario/module/commands/research.lua | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/exp_scenario/module/commands/research.lua b/exp_scenario/module/commands/research.lua index 2f314194..59bafc1d 100644 --- a/exp_scenario/module/commands/research.lua +++ b/exp_scenario/module/commands/research.lua @@ -19,15 +19,11 @@ Storage.register(research, function(tbl) research = tbl end) -if script.active_mods["PHI-CL"] and settings.startup["PHI-VP"] and settings.startup["PHI-VP-MAIN"] then - config.mod_set = "base" -end - --- @param force LuaForce --- @param silent boolean True when no message should be printed function module.res_queue(force, silent) local res_q = force.research_queue - local res = force.technologies[config.bonus_inventory.res[config.mod_set].name] + local res = force.technologies[config.bonus_inventory.res[config.mod_set].name or "mining-productivity-4"] if #res_q < config.queue_amount then for i = #res_q, config.queue_amount - 1 do From 26d4f150d1afa284e999d099466743534e6387bf Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Wed, 16 Apr 2025 17:39:36 +0900 Subject: [PATCH 348/406] . --- exp_scenario/module/commands/research.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/exp_scenario/module/commands/research.lua b/exp_scenario/module/commands/research.lua index 59bafc1d..9d9e0a6a 100644 --- a/exp_scenario/module/commands/research.lua +++ b/exp_scenario/module/commands/research.lua @@ -23,7 +23,8 @@ end) --- @param silent boolean True when no message should be printed function module.res_queue(force, silent) local res_q = force.research_queue - local res = force.technologies[config.bonus_inventory.res[config.mod_set].name or "mining-productivity-4"] + game.print(config.mod_set) + local res = force.technologies[config.bonus_inventory.res[config.mod_set].name] if #res_q < config.queue_amount then for i = #res_q, config.queue_amount - 1 do From b05f7ee04fa706f4568c4578d92c638d5bb61bab Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Wed, 16 Apr 2025 17:40:52 +0900 Subject: [PATCH 349/406] . --- exp_scenario/module/commands/research.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exp_scenario/module/commands/research.lua b/exp_scenario/module/commands/research.lua index 9d9e0a6a..81af9c58 100644 --- a/exp_scenario/module/commands/research.lua +++ b/exp_scenario/module/commands/research.lua @@ -23,7 +23,7 @@ end) --- @param silent boolean True when no message should be printed function module.res_queue(force, silent) local res_q = force.research_queue - game.print(config.mod_set) + rcon.print(config.mod_set) local res = force.technologies[config.bonus_inventory.res[config.mod_set].name] if #res_q < config.queue_amount then From d344131a7484357cddfb58626f365f3e1b7b9051 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Wed, 16 Apr 2025 17:44:52 +0900 Subject: [PATCH 350/406] . --- exp_scenario/module/commands/research.lua | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/exp_scenario/module/commands/research.lua b/exp_scenario/module/commands/research.lua index 81af9c58..ad00807a 100644 --- a/exp_scenario/module/commands/research.lua +++ b/exp_scenario/module/commands/research.lua @@ -19,11 +19,21 @@ Storage.register(research, function(tbl) research = tbl end) +for _, mod_name in ipairs(config.mod_set_lookup) do + if script.active_mods[mod_name] then + config.mod_set = mod_name + break + end +end + +if script.active_mods["PHI-CL"] and settings.startup["PHI-VP"] and settings.startup["PHI-VP-MAIN"] then + config.mod_set = "base" +end + --- @param force LuaForce --- @param silent boolean True when no message should be printed function module.res_queue(force, silent) local res_q = force.research_queue - rcon.print(config.mod_set) local res = force.technologies[config.bonus_inventory.res[config.mod_set].name] if #res_q < config.queue_amount then From 034973bed9bbceab60fb1ca7c7dd0ded5ad08f82 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Wed, 16 Apr 2025 17:46:26 +0900 Subject: [PATCH 351/406] . --- exp_scenario/module/commands/research.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/exp_scenario/module/commands/research.lua b/exp_scenario/module/commands/research.lua index ad00807a..7b1c1935 100644 --- a/exp_scenario/module/commands/research.lua +++ b/exp_scenario/module/commands/research.lua @@ -35,10 +35,12 @@ end function module.res_queue(force, silent) local res_q = force.research_queue local res = force.technologies[config.bonus_inventory.res[config.mod_set].name] + game.print(config.mod_set) + game.print(config.bonus_inventory.res[config.mod_set].name) if #res_q < config.queue_amount then for i = #res_q, config.queue_amount - 1 do - force.add_research(res) + -- force.add_research(res) if not silent then game.print{ "exp-commands_research.queue", res.name, res.level + i } From b9df5beb94e362b3a5b847c882178866cf4230d3 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Wed, 16 Apr 2025 17:47:42 +0900 Subject: [PATCH 352/406] . --- exp_scenario/module/commands/research.lua | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/exp_scenario/module/commands/research.lua b/exp_scenario/module/commands/research.lua index 7b1c1935..b0c00dbb 100644 --- a/exp_scenario/module/commands/research.lua +++ b/exp_scenario/module/commands/research.lua @@ -35,8 +35,7 @@ end function module.res_queue(force, silent) local res_q = force.research_queue local res = force.technologies[config.bonus_inventory.res[config.mod_set].name] - game.print(config.mod_set) - game.print(config.bonus_inventory.res[config.mod_set].name) + game.print(force.technologies[config.bonus_inventory.res[config.mod_set].name].name) if #res_q < config.queue_amount then for i = #res_q, config.queue_amount - 1 do From 83f5d71225c210906d31c975fc36984a9434c327 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Wed, 16 Apr 2025 17:48:15 +0900 Subject: [PATCH 353/406] . --- exp_scenario/module/commands/research.lua | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/exp_scenario/module/commands/research.lua b/exp_scenario/module/commands/research.lua index b0c00dbb..c838a9be 100644 --- a/exp_scenario/module/commands/research.lua +++ b/exp_scenario/module/commands/research.lua @@ -19,24 +19,15 @@ Storage.register(research, function(tbl) research = tbl end) -for _, mod_name in ipairs(config.mod_set_lookup) do - if script.active_mods[mod_name] then - config.mod_set = mod_name - break - end -end - -if script.active_mods["PHI-CL"] and settings.startup["PHI-VP"] and settings.startup["PHI-VP-MAIN"] then - config.mod_set = "base" -end - --- @param force LuaForce --- @param silent boolean True when no message should be printed function module.res_queue(force, silent) local res_q = force.research_queue local res = force.technologies[config.bonus_inventory.res[config.mod_set].name] + game.print(config.mod_set) + game.print(config.bonus_inventory.res[config.mod_set].name) game.print(force.technologies[config.bonus_inventory.res[config.mod_set].name].name) - + if #res_q < config.queue_amount then for i = #res_q, config.queue_amount - 1 do -- force.add_research(res) From c292004fc1ee0148e024ad706c21f85f577ff6fc Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Wed, 16 Apr 2025 17:49:16 +0900 Subject: [PATCH 354/406] . --- exp_scenario/module/commands/research.lua | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/exp_scenario/module/commands/research.lua b/exp_scenario/module/commands/research.lua index c838a9be..f1248acb 100644 --- a/exp_scenario/module/commands/research.lua +++ b/exp_scenario/module/commands/research.lua @@ -19,6 +19,17 @@ Storage.register(research, function(tbl) research = tbl end) +for _, mod_name in ipairs(config.mod_set_lookup) do + if script.active_mods[mod_name] then + config.mod_set = mod_name + break + end +end + +if script.active_mods["PHI-CL"] and settings.startup["PHI-VP"] and settings.startup["PHI-VP-MAIN"] then + config.mod_set = "base" +end + --- @param force LuaForce --- @param silent boolean True when no message should be printed function module.res_queue(force, silent) @@ -27,7 +38,7 @@ function module.res_queue(force, silent) game.print(config.mod_set) game.print(config.bonus_inventory.res[config.mod_set].name) game.print(force.technologies[config.bonus_inventory.res[config.mod_set].name].name) - + if #res_q < config.queue_amount then for i = #res_q, config.queue_amount - 1 do -- force.add_research(res) From 0efefab723710c4b3ef73feb6b68e53257b0143b Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Wed, 16 Apr 2025 17:50:44 +0900 Subject: [PATCH 355/406] . --- exp_scenario/module/commands/research.lua | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/exp_scenario/module/commands/research.lua b/exp_scenario/module/commands/research.lua index f1248acb..f75ded7e 100644 --- a/exp_scenario/module/commands/research.lua +++ b/exp_scenario/module/commands/research.lua @@ -27,7 +27,7 @@ for _, mod_name in ipairs(config.mod_set_lookup) do end if script.active_mods["PHI-CL"] and settings.startup["PHI-VP"] and settings.startup["PHI-VP-MAIN"] then - config.mod_set = "base" + config.mod_set = "space-age" end --- @param force LuaForce @@ -35,9 +35,6 @@ end function module.res_queue(force, silent) local res_q = force.research_queue local res = force.technologies[config.bonus_inventory.res[config.mod_set].name] - game.print(config.mod_set) - game.print(config.bonus_inventory.res[config.mod_set].name) - game.print(force.technologies[config.bonus_inventory.res[config.mod_set].name].name) if #res_q < config.queue_amount then for i = #res_q, config.queue_amount - 1 do From 79f67e0442f27812b16ade43928b1bd4aa40e14b Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Wed, 16 Apr 2025 17:52:20 +0900 Subject: [PATCH 356/406] . --- exp_scenario/module/commands/research.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exp_scenario/module/commands/research.lua b/exp_scenario/module/commands/research.lua index f75ded7e..a33a4875 100644 --- a/exp_scenario/module/commands/research.lua +++ b/exp_scenario/module/commands/research.lua @@ -38,7 +38,7 @@ function module.res_queue(force, silent) if #res_q < config.queue_amount then for i = #res_q, config.queue_amount - 1 do - -- force.add_research(res) + force.add_research(res) if not silent then game.print{ "exp-commands_research.queue", res.name, res.level + i } From f09f3f2b8a83872c9afb70337613115352a22f5c Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Wed, 16 Apr 2025 17:57:33 +0900 Subject: [PATCH 357/406] . --- exp_scenario/module/commands/research.lua | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/exp_scenario/module/commands/research.lua b/exp_scenario/module/commands/research.lua index a33a4875..fd9dffbf 100644 --- a/exp_scenario/module/commands/research.lua +++ b/exp_scenario/module/commands/research.lua @@ -26,7 +26,7 @@ for _, mod_name in ipairs(config.mod_set_lookup) do end end -if script.active_mods["PHI-CL"] and settings.startup["PHI-VP"] and settings.startup["PHI-VP-MAIN"] then +if script.active_mods["space-age"] and script.active_mods["PHI-CL"] and settings.startup["PHI-VP"] and settings.startup["PHI-VP-MAIN"] then config.mod_set = "space-age" end @@ -34,11 +34,12 @@ end --- @param silent boolean True when no message should be printed function module.res_queue(force, silent) local res_q = force.research_queue + game.print(config.bonus_inventory.res[config.mod_set].name) local res = force.technologies[config.bonus_inventory.res[config.mod_set].name] if #res_q < config.queue_amount then for i = #res_q, config.queue_amount - 1 do - force.add_research(res) + -- force.add_research(res) if not silent then game.print{ "exp-commands_research.queue", res.name, res.level + i } From f64d17772c17db177c9af5612fc38a1033200039 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Wed, 16 Apr 2025 17:59:43 +0900 Subject: [PATCH 358/406] . --- exp_scenario/module/commands/research.lua | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/exp_scenario/module/commands/research.lua b/exp_scenario/module/commands/research.lua index fd9dffbf..a86aaf13 100644 --- a/exp_scenario/module/commands/research.lua +++ b/exp_scenario/module/commands/research.lua @@ -19,23 +19,25 @@ Storage.register(research, function(tbl) research = tbl end) +local mod_set = "base" + for _, mod_name in ipairs(config.mod_set_lookup) do if script.active_mods[mod_name] then - config.mod_set = mod_name + mod_set = mod_name break end end if script.active_mods["space-age"] and script.active_mods["PHI-CL"] and settings.startup["PHI-VP"] and settings.startup["PHI-VP-MAIN"] then - config.mod_set = "space-age" + mod_set = "space-age" end --- @param force LuaForce --- @param silent boolean True when no message should be printed function module.res_queue(force, silent) local res_q = force.research_queue - game.print(config.bonus_inventory.res[config.mod_set].name) - local res = force.technologies[config.bonus_inventory.res[config.mod_set].name] + game.print(config.bonus_inventory.res[mod_set].name) + local res = force.technologies[config.bonus_inventory.res[mod_set].name] if #res_q < config.queue_amount then for i = #res_q, config.queue_amount - 1 do From e2667ada9fe146b1fc442e28293e723fb11fa907 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Wed, 16 Apr 2025 18:00:47 +0900 Subject: [PATCH 359/406] . --- exp_scenario/module/commands/research.lua | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/exp_scenario/module/commands/research.lua b/exp_scenario/module/commands/research.lua index a86aaf13..a53fe786 100644 --- a/exp_scenario/module/commands/research.lua +++ b/exp_scenario/module/commands/research.lua @@ -36,12 +36,11 @@ end --- @param silent boolean True when no message should be printed function module.res_queue(force, silent) local res_q = force.research_queue - game.print(config.bonus_inventory.res[mod_set].name) local res = force.technologies[config.bonus_inventory.res[mod_set].name] if #res_q < config.queue_amount then for i = #res_q, config.queue_amount - 1 do - -- force.add_research(res) + force.add_research(res) if not silent then game.print{ "exp-commands_research.queue", res.name, res.level + i } From bfc91902c9011be15a6a3f21bac8000ac5b2eab4 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Wed, 16 Apr 2025 18:04:30 +0900 Subject: [PATCH 360/406] . --- exp_scenario/module/commands/research.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exp_scenario/module/commands/research.lua b/exp_scenario/module/commands/research.lua index a53fe786..fc78c970 100644 --- a/exp_scenario/module/commands/research.lua +++ b/exp_scenario/module/commands/research.lua @@ -84,7 +84,7 @@ local function on_research_finished(event) if not research.res_queue_enable then return end local force = event.research.force - if config.bonus_inventory.res[config.mod_set] and force.technologies[config.bonus_inventory.res[config.mod_set].name] and force.technologies[config.bonus_inventory.res[config.mod_set].name].level > config.bonus_inventory.res[config.mod_set].level then + if config.bonus_inventory.res[mod_set] and force.technologies[config.bonus_inventory.res[mod_set].name] and force.technologies[config.bonus_inventory.res[mod_set].name].level > config.bonus_inventory.res[mod_set].level then module.res_queue(force, event.by_script) end end From 4e51816a6924f8ec73e913b6f18b9ba9cd5c9d12 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Fri, 18 Apr 2025 15:29:22 +0900 Subject: [PATCH 361/406] . --- exp_legacy/module/config/research.lua | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/exp_legacy/module/config/research.lua b/exp_legacy/module/config/research.lua index 41a102f0..6e0d7d1c 100644 --- a/exp_legacy/module/config/research.lua +++ b/exp_legacy/module/config/research.lua @@ -78,15 +78,15 @@ return { ["space-age"] = { ["logistic-science-pack"] = 3600, ["military-science-pack"] = 3600, - ["chemical-science-pack"] = 4500, - ["utility-science-pack"] = 5400, - ["production-science-pack"] = 5400, - ["space-science-pack"] = 5400, - ["metallurgic-science-pack"] = 6300, - ["electromagnetic-science-pack"] = 6300, - ["agricultural-science-pack"] = 6300, - ["cryogenic-science-pack"] = 6300, - ["promethium-science-pack"] = 7200 + ["chemical-science-pack"] = 5400, + ["utility-science-pack"] = 7200, + ["production-science-pack"] = 7200, + ["space-science-pack"] = 7200, + ["metallurgic-science-pack"] = 12600, + ["electromagnetic-science-pack"] = 12600, + ["agricultural-science-pack"] = 12600, + ["cryogenic-science-pack"] = 12600, + ["promethium-science-pack"] = 14400 } }, inf_res = { From 01269ec755dbb62630d9fd28a78dc2c72129760e Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Fri, 18 Apr 2025 23:19:14 +0900 Subject: [PATCH 362/406] . --- exp_legacy/module/config/research.lua | 16 +++++++++++----- exp_legacy/module/modules/gui/research.lua | 18 ++++++------------ 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/exp_legacy/module/config/research.lua b/exp_legacy/module/config/research.lua index 6e0d7d1c..8d0e639c 100644 --- a/exp_legacy/module/config/research.lua +++ b/exp_legacy/module/config/research.lua @@ -12,16 +12,22 @@ return { -- this enable 20 more inventory for each mining productivity level up to 4 bonus_inventory = { enabled = true, - res = { - -- Mining Productivity + log = { ["base"] = { ["name"] = "mining-productivity-4", - ["level"] = 4, + ["level"] = 4 }, ["space-age"] = { ["name"] = "mining-productivity-3", - ["level"] = 3, - } + ["level"] = 3 + }, + }, + res = { + -- Mining Productivity + ["mining-productivity"] = true, + ["mining-productivity-2"] = true, + ["mining-productivity-3"] = true, + ["mining-productivity-4"] = true }, name = "character_inventory_slots_bonus", rate = 5, diff --git a/exp_legacy/module/modules/gui/research.lua b/exp_legacy/module/modules/gui/research.lua index e08b3004..b294da30 100644 --- a/exp_legacy/module/modules/gui/research.lua +++ b/exp_legacy/module/modules/gui/research.lua @@ -90,15 +90,11 @@ end local function research_notification(event) if config.inf_res[config.mod_set][event.research.name] then if event.research.name == config.bonus_inventory.res[config.mod_set].name then - if event.research.level == config.bonus_inventory.res[config.mod_set].level + 1 then + if event.research.level == config.bonus_inventory.log[config.mod_set].level + 1 then -- Add run result to log research_add_log() end - if config.bonus_inventory.enabled then - event.research.force[config.bonus_inventory.name] = math.max((event.research.level - 1) * config.bonus_inventory.rate, config.bonus_inventory.limit) - end - if config.pollution_ageing_by_research then game.map_settings.pollution.ageing = math.min(10, event.research.level / 5) end @@ -107,14 +103,12 @@ local function research_notification(event) if not (event.by_script) then game.print{ "research.inf", research_time_format(game.tick), event.research.name, event.research.level - 1 } end - else - if not (event.by_script) then - game.print{ "research.msg", research_time_format(game.tick), event.research.name } - end + elseif not (event.by_script) then + game.print{ "research.msg", research_time_format(game.tick), event.research.name } + end - if config.bonus_inventory.enabled and (event.research.name == "mining-productivity-1" or event.research.name == "mining-productivity-2" or event.research.name == "mining-productivity-3") then - event.research.force[config.bonus_inventory.name] = event.research.level * config.bonus_inventory.rate - end + if config.bonus_inventory.enabled and config.bonus_inventory.res[event.research.name] then + event.research.force[config.bonus_inventory.name] = math.min((event.research.level - 1) * config.bonus_inventory.rate, config.bonus_inventory.limit) end end From c6848b7a6e06c55e036cfc1fc8e2f2bdf240f57a Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Fri, 18 Apr 2025 23:27:39 +0900 Subject: [PATCH 363/406] . --- exp_legacy/module/modules/gui/research.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exp_legacy/module/modules/gui/research.lua b/exp_legacy/module/modules/gui/research.lua index b294da30..65972c64 100644 --- a/exp_legacy/module/modules/gui/research.lua +++ b/exp_legacy/module/modules/gui/research.lua @@ -89,7 +89,7 @@ end local function research_notification(event) if config.inf_res[config.mod_set][event.research.name] then - if event.research.name == config.bonus_inventory.res[config.mod_set].name then + if event.research.name == config.bonus_inventory.log[config.mod_set].name then if event.research.level == config.bonus_inventory.log[config.mod_set].level + 1 then -- Add run result to log research_add_log() From 02774919cb63176d7a88af6ad757da1e7381dc2b Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Fri, 18 Apr 2025 23:42:55 +0900 Subject: [PATCH 364/406] . --- exp_scenario/module/commands/waterfill.lua | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/exp_scenario/module/commands/waterfill.lua b/exp_scenario/module/commands/waterfill.lua index d59d912d..8d31f2b1 100644 --- a/exp_scenario/module/commands/waterfill.lua +++ b/exp_scenario/module/commands/waterfill.lua @@ -7,6 +7,14 @@ local Commands = require("modules/exp_commands") local Selection = require("modules.exp_legacy.modules.control.selection") --- @dep modules.control.selection local SelectionName = "ExpCommand_Waterfill" +local planet = { + ["nauvis"] = "water-mud", + ["gleba"] = "water-mud", + ["vulcanus"] = "lava", + ["fulgora"] = "oil-ocean-shallow", + ["aquilo"] = "ammoniacal-ocean" +} + --- Toggle player selection mode for artillery Commands.new("waterfill", { "exp-commands_waterfill.description" }) :register(function(player) @@ -41,6 +49,7 @@ Selection.on_selection(SelectionName, function(event) ]] local area_size = (area.right_bottom.x - area.left_top.x) * (area.right_bottom.y - area.left_top.y) + if area_size > 1000 then player.print({ "exp-commands_waterfill.area-too-large", 1000, area_size }, Commands.print_settings.error) return @@ -61,14 +70,14 @@ Selection.on_selection(SelectionName, function(event) for y = area.left_top.y, area.right_bottom.y do tile_count = tile_count + 1 tiles_to_make[tile_count] = { - name = "water-mud", + name = (surface.planet and planet[surface.planet]) or "water-mud", position = { x, y }, } end end surface.set_tiles(tiles_to_make, true, "abort_on_collision", true, false, player, 0) - local remaining_tiles = surface.count_tiles_filtered{ area = area, name = "water-mud" } + local remaining_tiles = surface.count_tiles_filtered{ area = area, name = (surface.planet and planet[surface.planet]) or "water-mud" } local t_diff = tile_count - remaining_tiles if item_count_cliff >= t_diff then From 8ad47a16739c94307e331c6c968fd4f2fd6e8a0d Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Sat, 19 Apr 2025 00:16:31 +0900 Subject: [PATCH 365/406] . --- exp_scenario/module/commands/waterfill.lua | 33 ++++++++++++++++------ 1 file changed, 25 insertions(+), 8 deletions(-) diff --git a/exp_scenario/module/commands/waterfill.lua b/exp_scenario/module/commands/waterfill.lua index 8d31f2b1..633d5188 100644 --- a/exp_scenario/module/commands/waterfill.lua +++ b/exp_scenario/module/commands/waterfill.lua @@ -66,18 +66,35 @@ Selection.on_selection(SelectionName, function(event) local tile_count = 0 local tiles_to_make = {} - for x = area.left_top.x, area.right_bottom.x do - for y = area.left_top.y, area.right_bottom.y do - tile_count = tile_count + 1 - tiles_to_make[tile_count] = { - name = (surface.planet and planet[surface.planet]) or "water-mud", - position = { x, y }, - } + local chest = surface.find_entities_filtered{ area = area, name = "steel-chest", force = player.force } + local tile_to_apply = (surface.planet and planet[surface.planet]) or "water-mud" + + if #chest > 0 then + for _, v in pairs(chest) do + if v.get_inventory(defines.inventory.chest).is_empty() then + tile_count = tile_count + 1 + tiles_to_make[tile_count] = { + name = tile_to_apply, + position = { math.floor(v.position.x), math.floor(v.position.y) }, + } + v.destroy() + end + end + + else + for x = area.left_top.x, area.right_bottom.x do + for y = area.left_top.y, area.right_bottom.y do + tile_count = tile_count + 1 + tiles_to_make[tile_count] = { + name = tile_to_apply, + position = { x, y }, + } + end end end surface.set_tiles(tiles_to_make, true, "abort_on_collision", true, false, player, 0) - local remaining_tiles = surface.count_tiles_filtered{ area = area, name = (surface.planet and planet[surface.planet]) or "water-mud" } + local remaining_tiles = surface.count_tiles_filtered{ area = area, name = tile_to_apply } local t_diff = tile_count - remaining_tiles if item_count_cliff >= t_diff then From 93ea19e2906714aeff755545f4931b754a26295e Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Sat, 19 Apr 2025 00:20:48 +0900 Subject: [PATCH 366/406] . --- exp_scenario/module/commands/waterfill.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exp_scenario/module/commands/waterfill.lua b/exp_scenario/module/commands/waterfill.lua index 633d5188..04f37bfd 100644 --- a/exp_scenario/module/commands/waterfill.lua +++ b/exp_scenario/module/commands/waterfill.lua @@ -95,7 +95,7 @@ Selection.on_selection(SelectionName, function(event) surface.set_tiles(tiles_to_make, true, "abort_on_collision", true, false, player, 0) local remaining_tiles = surface.count_tiles_filtered{ area = area, name = tile_to_apply } - local t_diff = tile_count - remaining_tiles + local t_diff = math.max(tile_count - remaining_tiles, 0) if item_count_cliff >= t_diff then player.remove_item{ name = "cliff-explosives", count = t_diff } From 24aafc36da0dbe33b59b747c4a3fc4009ad3d4bc Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Sat, 19 Apr 2025 00:26:08 +0900 Subject: [PATCH 367/406] . --- exp_scenario/module/commands/waterfill.lua | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/exp_scenario/module/commands/waterfill.lua b/exp_scenario/module/commands/waterfill.lua index 04f37bfd..8477aa3b 100644 --- a/exp_scenario/module/commands/waterfill.lua +++ b/exp_scenario/module/commands/waterfill.lua @@ -73,10 +73,7 @@ Selection.on_selection(SelectionName, function(event) for _, v in pairs(chest) do if v.get_inventory(defines.inventory.chest).is_empty() then tile_count = tile_count + 1 - tiles_to_make[tile_count] = { - name = tile_to_apply, - position = { math.floor(v.position.x), math.floor(v.position.y) }, - } + tiles_to_make[tile_count] = { name = tile_to_apply, position = { v.position.x, v.position.y } } v.destroy() end end @@ -85,10 +82,7 @@ Selection.on_selection(SelectionName, function(event) for x = area.left_top.x, area.right_bottom.x do for y = area.left_top.y, area.right_bottom.y do tile_count = tile_count + 1 - tiles_to_make[tile_count] = { - name = tile_to_apply, - position = { x, y }, - } + tiles_to_make[tile_count] = { name = tile_to_apply, position = { x, y } } end end end From e78920c4e696906b831e8b1a215f7e8bd1f67cd5 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Sat, 19 Apr 2025 00:26:51 +0900 Subject: [PATCH 368/406] . --- exp_scenario/module/commands/waterfill.lua | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/exp_scenario/module/commands/waterfill.lua b/exp_scenario/module/commands/waterfill.lua index 8477aa3b..87e092af 100644 --- a/exp_scenario/module/commands/waterfill.lua +++ b/exp_scenario/module/commands/waterfill.lua @@ -89,8 +89,11 @@ Selection.on_selection(SelectionName, function(event) surface.set_tiles(tiles_to_make, true, "abort_on_collision", true, false, player, 0) local remaining_tiles = surface.count_tiles_filtered{ area = area, name = tile_to_apply } - local t_diff = math.max(tile_count - remaining_tiles, 0) + local t_diff = tile_count - remaining_tiles + game.print(tile_count) + game.print(remaining_tiles) + --[[ if item_count_cliff >= t_diff then player.remove_item{ name = "cliff-explosives", count = t_diff } else @@ -104,6 +107,7 @@ Selection.on_selection(SelectionName, function(event) player.remove_item{ name = "grenade", count = item_count_needed } end end + ]] if remaining_tiles > 0 then player.print({ "exp-commands_waterfill.part-complete", tile_count, remaining_tiles }, Commands.print_settings.default) From 717955608fa0c211ba60e6c9de4c24acbfef4cb7 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Sat, 19 Apr 2025 00:30:46 +0900 Subject: [PATCH 369/406] . --- exp_scenario/module/commands/waterfill.lua | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/exp_scenario/module/commands/waterfill.lua b/exp_scenario/module/commands/waterfill.lua index 87e092af..63df4cba 100644 --- a/exp_scenario/module/commands/waterfill.lua +++ b/exp_scenario/module/commands/waterfill.lua @@ -90,8 +90,7 @@ Selection.on_selection(SelectionName, function(event) surface.set_tiles(tiles_to_make, true, "abort_on_collision", true, false, player, 0) local remaining_tiles = surface.count_tiles_filtered{ area = area, name = tile_to_apply } local t_diff = tile_count - remaining_tiles - game.print(tile_count) - game.print(remaining_tiles) + game.print("T " .. tile_count .. " R " .. remaining_tiles) --[[ if item_count_cliff >= t_diff then From 7983992371a28ae8ec6f2833725dc4859c8d0d80 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Sat, 19 Apr 2025 00:34:37 +0900 Subject: [PATCH 370/406] . --- exp_scenario/module/commands/waterfill.lua | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/exp_scenario/module/commands/waterfill.lua b/exp_scenario/module/commands/waterfill.lua index 63df4cba..02a32ad8 100644 --- a/exp_scenario/module/commands/waterfill.lua +++ b/exp_scenario/module/commands/waterfill.lua @@ -90,10 +90,8 @@ Selection.on_selection(SelectionName, function(event) surface.set_tiles(tiles_to_make, true, "abort_on_collision", true, false, player, 0) local remaining_tiles = surface.count_tiles_filtered{ area = area, name = tile_to_apply } local t_diff = tile_count - remaining_tiles - game.print("T " .. tile_count .. " R " .. remaining_tiles) - --[[ - if item_count_cliff >= t_diff then + if item_count_cliff >= t_diff and t_diff > 0 then player.remove_item{ name = "cliff-explosives", count = t_diff } else if item_count_cliff > 0 then @@ -106,7 +104,6 @@ Selection.on_selection(SelectionName, function(event) player.remove_item{ name = "grenade", count = item_count_needed } end end - ]] if remaining_tiles > 0 then player.print({ "exp-commands_waterfill.part-complete", tile_count, remaining_tiles }, Commands.print_settings.default) From 0f54eaee0b05aa877dd2d3beea735759449dfcdc Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Sat, 19 Apr 2025 00:40:09 +0900 Subject: [PATCH 371/406] . --- exp_scenario/module/commands/waterfill.lua | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/exp_scenario/module/commands/waterfill.lua b/exp_scenario/module/commands/waterfill.lua index 02a32ad8..1adbb29b 100644 --- a/exp_scenario/module/commands/waterfill.lua +++ b/exp_scenario/module/commands/waterfill.lua @@ -65,16 +65,19 @@ Selection.on_selection(SelectionName, function(event) end local tile_count = 0 + local remaining_tiles = 0 local tiles_to_make = {} local chest = surface.find_entities_filtered{ area = area, name = "steel-chest", force = player.force } local tile_to_apply = (surface.planet and planet[surface.planet]) or "water-mud" if #chest > 0 then for _, v in pairs(chest) do - if v.get_inventory(defines.inventory.chest).is_empty() then + if v.get_inventory(defines.inventory.chest).is_empty() and tile_count < item_count_total then tile_count = tile_count + 1 tiles_to_make[tile_count] = { name = tile_to_apply, position = { v.position.x, v.position.y } } v.destroy() + elseif v.get_inventory(defines.inventory.chest).is_empty() then + remaining_tiles = remaining_tiles + 1 end end @@ -85,10 +88,11 @@ Selection.on_selection(SelectionName, function(event) tiles_to_make[tile_count] = { name = tile_to_apply, position = { x, y } } end end + + local remaining_tiles = surface.count_tiles_filtered{ area = area, name = tile_to_apply } end surface.set_tiles(tiles_to_make, true, "abort_on_collision", true, false, player, 0) - local remaining_tiles = surface.count_tiles_filtered{ area = area, name = tile_to_apply } local t_diff = tile_count - remaining_tiles if item_count_cliff >= t_diff and t_diff > 0 then From e808e11dd49085835b4527691d217590a557703c Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Sat, 19 Apr 2025 00:40:25 +0900 Subject: [PATCH 372/406] . --- exp_scenario/module/commands/waterfill.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exp_scenario/module/commands/waterfill.lua b/exp_scenario/module/commands/waterfill.lua index 1adbb29b..4ef722bd 100644 --- a/exp_scenario/module/commands/waterfill.lua +++ b/exp_scenario/module/commands/waterfill.lua @@ -89,7 +89,7 @@ Selection.on_selection(SelectionName, function(event) end end - local remaining_tiles = surface.count_tiles_filtered{ area = area, name = tile_to_apply } + remaining_tiles = surface.count_tiles_filtered{ area = area, name = tile_to_apply } end surface.set_tiles(tiles_to_make, true, "abort_on_collision", true, false, player, 0) From e368278d3bd92d66b66ef0d2b87027440c5563bf Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Sat, 19 Apr 2025 12:40:35 +0900 Subject: [PATCH 373/406] . --- exp_legacy/module/config/research.lua | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/exp_legacy/module/config/research.lua b/exp_legacy/module/config/research.lua index 8d0e639c..fcf16fc8 100644 --- a/exp_legacy/module/config/research.lua +++ b/exp_legacy/module/config/research.lua @@ -7,7 +7,7 @@ return { queue_amount = 3, mod_set = "base", mod_set_lookup = { - "space-age" + "space-age", }, -- this enable 20 more inventory for each mining productivity level up to 4 bonus_inventory = { @@ -27,7 +27,7 @@ return { ["mining-productivity"] = true, ["mining-productivity-2"] = true, ["mining-productivity-3"] = true, - ["mining-productivity-4"] = true + ["mining-productivity-4"] = true, }, name = "character_inventory_slots_bonus", rate = 5, @@ -79,7 +79,7 @@ return { ["productivity-module-3"] = 300, ["speed-module-3"] = 300, ["rocket-silo"] = 300, - ["space-science-pack"] = 300 + ["space-science-pack"] = 300, }, ["space-age"] = { ["logistic-science-pack"] = 3600, @@ -88,11 +88,11 @@ return { ["utility-science-pack"] = 7200, ["production-science-pack"] = 7200, ["space-science-pack"] = 7200, - ["metallurgic-science-pack"] = 12600, - ["electromagnetic-science-pack"] = 12600, - ["agricultural-science-pack"] = 12600, - ["cryogenic-science-pack"] = 12600, - ["promethium-science-pack"] = 14400 + ["metallurgic-science-pack"] = 10800, + ["electromagnetic-science-pack"] = 10800, + ["agricultural-science-pack"] = 10800, + ["cryogenic-science-pack"] = 10800, + ["promethium-science-pack"] = 14400, } }, inf_res = { From 0afd445da94f75cfb448420fd0eb7e79cc412826 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Sat, 19 Apr 2025 12:40:58 +0900 Subject: [PATCH 374/406] . --- exp_legacy/module/config/research.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exp_legacy/module/config/research.lua b/exp_legacy/module/config/research.lua index fcf16fc8..e9e53f63 100644 --- a/exp_legacy/module/config/research.lua +++ b/exp_legacy/module/config/research.lua @@ -163,7 +163,7 @@ return { ["rocket-part-productivity"] = 1, -- Follower Robot Count ["follower-robot-count-5"] = 5, - } + }, }, -- prevent research up to a certain level limit_res = { From 9e0ccf87e4423bc06ca43bd9d3bf566fcca950f6 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Sat, 19 Apr 2025 12:41:56 +0900 Subject: [PATCH 375/406] . --- exp_legacy/module/modules/gui/research.lua | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/exp_legacy/module/modules/gui/research.lua b/exp_legacy/module/modules/gui/research.lua index 65972c64..f78da4de 100644 --- a/exp_legacy/module/modules/gui/research.lua +++ b/exp_legacy/module/modules/gui/research.lua @@ -27,10 +27,6 @@ for _, mod_name in ipairs(config.mod_set_lookup) do end end -if script.active_mods["PHI-CL"] and settings.startup["PHI-VP"] and settings.startup["PHI-VP-MAIN"] then - config.mod_set = "base" -end - local research_time_format = ExpUtil.format_time_factory{ format = "clock", hours = true, minutes = true, seconds = true } local empty_time = research_time_format(nil) @@ -89,15 +85,9 @@ end local function research_notification(event) if config.inf_res[config.mod_set][event.research.name] then - if event.research.name == config.bonus_inventory.log[config.mod_set].name then - if event.research.level == config.bonus_inventory.log[config.mod_set].level + 1 then - -- Add run result to log - research_add_log() - end - - if config.pollution_ageing_by_research then - game.map_settings.pollution.ageing = math.min(10, event.research.level / 5) - end + if event.research.name == config.bonus_inventory.log[config.mod_set].name and event.research.level == config.bonus_inventory.log[config.mod_set].level + 1 then + -- Add run result to log + research_add_log() end if not (event.by_script) then @@ -110,6 +100,10 @@ local function research_notification(event) if config.bonus_inventory.enabled and config.bonus_inventory.res[event.research.name] then event.research.force[config.bonus_inventory.name] = math.min((event.research.level - 1) * config.bonus_inventory.rate, config.bonus_inventory.limit) end + + if config.pollution_ageing_by_research and config.bonus_inventory.res[event.research.name] then + game.map_settings.pollution.ageing = math.min(10, event.research.level / 5) + end end local function research_gui_update() From f0da6a65078c9bc895e24b9a28f50b5c7985502a Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Sat, 19 Apr 2025 12:46:12 +0900 Subject: [PATCH 376/406] . --- exp_scenario/module/commands/waterfill.lua | 47 +++++++++++----------- 1 file changed, 24 insertions(+), 23 deletions(-) diff --git a/exp_scenario/module/commands/waterfill.lua b/exp_scenario/module/commands/waterfill.lua index 4ef722bd..bb6beb17 100644 --- a/exp_scenario/module/commands/waterfill.lua +++ b/exp_scenario/module/commands/waterfill.lua @@ -9,7 +9,7 @@ local SelectionName = "ExpCommand_Waterfill" local planet = { ["nauvis"] = "water-mud", - ["gleba"] = "water-mud", + ["gleba"] = "wetland-blue-slime", ["vulcanus"] = "lava", ["fulgora"] = "oil-ocean-shallow", ["aquilo"] = "ammoniacal-ocean" @@ -59,29 +59,29 @@ Selection.on_selection(SelectionName, function(event) local item_count_craft = math.min(math.floor(player.get_item_count("explosives") / 10), player.get_item_count("barrel"), player.get_item_count("grenade")) local item_count_total = item_count_cliff + item_count_craft - if item_count_total < area_size then - player.print({ "exp-commands_waterfill.too-few-explosives", area_size, item_count_total }, Commands.print_settings.error) - return - end - local tile_count = 0 - local remaining_tiles = 0 + local failed_tiles = 0 local tiles_to_make = {} - local chest = surface.find_entities_filtered{ area = area, name = "steel-chest", force = player.force } + local chests = surface.find_entities_filtered{ area = area, name = "steel-chest", force = player.force } local tile_to_apply = (surface.planet and planet[surface.planet]) or "water-mud" - if #chest > 0 then - for _, v in pairs(chest) do - if v.get_inventory(defines.inventory.chest).is_empty() and tile_count < item_count_total then - tile_count = tile_count + 1 - tiles_to_make[tile_count] = { name = tile_to_apply, position = { v.position.x, v.position.y } } - v.destroy() - elseif v.get_inventory(defines.inventory.chest).is_empty() then - remaining_tiles = remaining_tiles + 1 + if #chests > 0 then + for _, chest in pairs(chests) do + tile_count = tile_count + 1 + if chest.get_inventory(defines.inventory.chest).is_empty() and tile_count <= item_count_total then + tiles_to_make[tile_count] = { name = tile_to_apply, position = { chest.position.x, chest.position.y } } + chest.destroy() + else + failed_tiles = failed_tiles + 1 end end else + if item_count_total < area_size then + player.print({ "exp-commands_waterfill.too-few-explosives", area_size, item_count_total }, Commands.print_settings.error) + return + end + for x = area.left_top.x, area.right_bottom.x do for y = area.left_top.y, area.right_bottom.y do tile_count = tile_count + 1 @@ -89,19 +89,20 @@ Selection.on_selection(SelectionName, function(event) end end - remaining_tiles = surface.count_tiles_filtered{ area = area, name = tile_to_apply } + failed_tiles = surface.count_tiles_filtered{ area = area, name = tile_to_apply } end surface.set_tiles(tiles_to_make, true, "abort_on_collision", true, false, player, 0) - local t_diff = tile_count - remaining_tiles + local tiles_made = tile_count - failed_tiles + assert(tiles_made >= 0) - if item_count_cliff >= t_diff and t_diff > 0 then - player.remove_item{ name = "cliff-explosives", count = t_diff } + if item_count_cliff >= tiles_made then + player.remove_item{ name = "cliff-explosives", count = tiles_made } else if item_count_cliff > 0 then player.remove_item{ name = "cliff-explosives", count = item_count_cliff } end - local item_count_needed = t_diff - item_count_cliff + local item_count_needed = tiles_made - item_count_cliff if item_count_needed > 0 then player.remove_item{ name = "explosives", count = 10 * item_count_needed } player.remove_item{ name = "barrel", count = item_count_needed } @@ -109,8 +110,8 @@ Selection.on_selection(SelectionName, function(event) end end - if remaining_tiles > 0 then - player.print({ "exp-commands_waterfill.part-complete", tile_count, remaining_tiles }, Commands.print_settings.default) + if failed_tiles > 0 then + player.print({ "exp-commands_waterfill.part-complete", tile_count, failed_tiles }, Commands.print_settings.default) else player.print({ "exp-commands_waterfill.complete", tile_count }, Commands.print_settings.default) end From 4365facdb5f6d7008864819ab26a7a09ca5e7c10 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Sun, 20 Apr 2025 13:54:04 +0900 Subject: [PATCH 377/406] . --- exp_scenario/module/commands/research.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exp_scenario/module/commands/research.lua b/exp_scenario/module/commands/research.lua index fc78c970..a1c8fa84 100644 --- a/exp_scenario/module/commands/research.lua +++ b/exp_scenario/module/commands/research.lua @@ -84,7 +84,7 @@ local function on_research_finished(event) if not research.res_queue_enable then return end local force = event.research.force - if config.bonus_inventory.res[mod_set] and force.technologies[config.bonus_inventory.res[mod_set].name] and force.technologies[config.bonus_inventory.res[mod_set].name].level > config.bonus_inventory.res[mod_set].level then + if config.bonus_inventory.log[mod_set] and force.technologies[config.bonus_inventory.log[mod_set].name] and force.technologies[config.bonus_inventory.log[mod_set].name].level > config.bonus_inventory.log[mod_set].level then module.res_queue(force, event.by_script) end end From 61644d1aef6f399ee475b71d22214cb0c70e9368 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Sun, 20 Apr 2025 14:02:16 +0900 Subject: [PATCH 378/406] . --- exp_scenario/module/commands/research.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exp_scenario/module/commands/research.lua b/exp_scenario/module/commands/research.lua index a1c8fa84..9355f6b9 100644 --- a/exp_scenario/module/commands/research.lua +++ b/exp_scenario/module/commands/research.lua @@ -36,7 +36,7 @@ end --- @param silent boolean True when no message should be printed function module.res_queue(force, silent) local res_q = force.research_queue - local res = force.technologies[config.bonus_inventory.res[mod_set].name] + local res = force.technologies[config.bonus_inventory.log[mod_set].name] if #res_q < config.queue_amount then for i = #res_q, config.queue_amount - 1 do From 29bb17ed55598bf8608c08f57372241d95a80c94 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Mon, 21 Apr 2025 14:21:03 +0900 Subject: [PATCH 379/406] . --- exp_legacy/module/modules/addons/spawn-area.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/exp_legacy/module/modules/addons/spawn-area.lua b/exp_legacy/module/modules/addons/spawn-area.lua index 5c22c7ff..a4ed321b 100644 --- a/exp_legacy/module/modules/addons/spawn-area.lua +++ b/exp_legacy/module/modules/addons/spawn-area.lua @@ -219,6 +219,7 @@ Event.add(defines.events.on_player_created, function(event) local s = player.physical_surface game.forces["neutral"].set_cease_fire("player", true) game.forces["player"].set_cease_fire("neutral", true) + game.forces["neutral"].set_cease_fire("enemy", false) game.forces["neutral"].set_ammo_damage_modifier("bullet", 1) game.forces["neutral"].set_gun_speed_modifier("bullet", 1) game.forces["neutral"].set_turret_attack_modifier("gun-turret", 1) From ee2b2b429de1db2b208f4ec9bbf08a43db4ab276 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Mon, 21 Apr 2025 14:27:04 +0900 Subject: [PATCH 380/406] . --- .../module/modules/addons/spawn-area.lua | 27 ++++++++++++------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/exp_legacy/module/modules/addons/spawn-area.lua b/exp_legacy/module/modules/addons/spawn-area.lua index a4ed321b..f629940d 100644 --- a/exp_legacy/module/modules/addons/spawn-area.lua +++ b/exp_legacy/module/modules/addons/spawn-area.lua @@ -10,6 +10,18 @@ Storage.register(turrets, function(tbl) turrets = tbl end) +do + local force = game.forces["spawn"] + + if force and force.valid then + return force + end + + force = game.create_force("spawn") + force.set_cease_fire("player", true) + game.forces["player"].set_cease_fire("spawn", true) +end + -- Apply an offset to a LuaPosition local function apply_offset(position, offset) return { x = position.x + (offset.x or offset[1]), y = position.y + (offset.y or offset[2]) } @@ -44,15 +56,15 @@ local function spawn_turrets() -- Makes a new turret if it is not found if not turret or not turret.valid then - turret = surface.create_entity{ name = "gun-turret", position = pos, force = "neutral" } + turret = surface.create_entity{ name = "gun-turret", position = pos, force = "spawn" } if not turret then return end protect_entity(turret) end -- Adds ammo to the turret local inv = turret.get_inventory(defines.inventory.turret_ammo) - if inv and inv.can_insert{ name = config.turrets.ammo_type, count = 10 } then - inv.insert{ name = config.turrets.ammo_type, count = 10 } + if inv and inv.can_insert{ name = config.turrets.ammo_type, count = 20 } then + inv.insert{ name = config.turrets.ammo_type, count = 20 } end end end @@ -217,12 +229,9 @@ Event.add(defines.events.on_player_created, function(event) local player = game.players[event.player_index] local p = { x = 0, y = 0 } local s = player.physical_surface - game.forces["neutral"].set_cease_fire("player", true) - game.forces["player"].set_cease_fire("neutral", true) - game.forces["neutral"].set_cease_fire("enemy", false) - game.forces["neutral"].set_ammo_damage_modifier("bullet", 1) - game.forces["neutral"].set_gun_speed_modifier("bullet", 1) - game.forces["neutral"].set_turret_attack_modifier("gun-turret", 1) + game.forces["spawn"].set_ammo_damage_modifier("bullet", 1) + game.forces["spawn"].set_gun_speed_modifier("bullet", 1) + game.forces["spawn"].set_turret_attack_modifier("gun-turret", 1) spawn_area(s, p) if config.pattern.enabled then spawn_pattern(s, p) end if config.water.enabled then spawn_water(s, p) end From 41dd7517d82092fcaf5b0b63a1d92fa68bc52fd9 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Mon, 21 Apr 2025 14:37:30 +0900 Subject: [PATCH 381/406] . --- exp_legacy/module/modules/addons/spawn-area.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/exp_legacy/module/modules/addons/spawn-area.lua b/exp_legacy/module/modules/addons/spawn-area.lua index f629940d..093f2f86 100644 --- a/exp_legacy/module/modules/addons/spawn-area.lua +++ b/exp_legacy/module/modules/addons/spawn-area.lua @@ -10,7 +10,7 @@ Storage.register(turrets, function(tbl) turrets = tbl end) -do +local function spawn_force() local force = game.forces["spawn"] if force and force.valid then @@ -49,6 +49,8 @@ end -- Will spawn all infinite ammo turrets and keep them refilled local function spawn_turrets() + spawn_force() + for _, turret_pos in pairs(turrets) do local surface = game.surfaces[turret_pos.surface] local pos = turret_pos.position From 90a351006857e13c54d051660e559d9d3cb6641e Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Mon, 21 Apr 2025 14:39:23 +0900 Subject: [PATCH 382/406] . --- .../module/modules/addons/spawn-area.lua | 23 ++++++++----------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/exp_legacy/module/modules/addons/spawn-area.lua b/exp_legacy/module/modules/addons/spawn-area.lua index 093f2f86..ca7ae481 100644 --- a/exp_legacy/module/modules/addons/spawn-area.lua +++ b/exp_legacy/module/modules/addons/spawn-area.lua @@ -10,18 +10,6 @@ Storage.register(turrets, function(tbl) turrets = tbl end) -local function spawn_force() - local force = game.forces["spawn"] - - if force and force.valid then - return force - end - - force = game.create_force("spawn") - force.set_cease_fire("player", true) - game.forces["player"].set_cease_fire("spawn", true) -end - -- Apply an offset to a LuaPosition local function apply_offset(position, offset) return { x = position.x + (offset.x or offset[1]), y = position.y + (offset.y or offset[2]) } @@ -49,8 +37,6 @@ end -- Will spawn all infinite ammo turrets and keep them refilled local function spawn_turrets() - spawn_force() - for _, turret_pos in pairs(turrets) do local surface = game.surfaces[turret_pos.surface] local pos = turret_pos.position @@ -231,6 +217,15 @@ Event.add(defines.events.on_player_created, function(event) local player = game.players[event.player_index] local p = { x = 0, y = 0 } local s = player.physical_surface + + local force = game.forces["spawn"] + + if not (force or force.valid) then + force = game.create_force("spawn") + force.set_cease_fire("player", true) + game.forces["player"].set_cease_fire("spawn", true) + end + game.forces["spawn"].set_ammo_damage_modifier("bullet", 1) game.forces["spawn"].set_gun_speed_modifier("bullet", 1) game.forces["spawn"].set_turret_attack_modifier("gun-turret", 1) From e405bd70accb59f36ac20da8038e7eec9b036ee4 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Mon, 21 Apr 2025 14:41:52 +0900 Subject: [PATCH 383/406] . --- exp_legacy/module/modules/addons/spawn-area.lua | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/exp_legacy/module/modules/addons/spawn-area.lua b/exp_legacy/module/modules/addons/spawn-area.lua index ca7ae481..9ed8755f 100644 --- a/exp_legacy/module/modules/addons/spawn-area.lua +++ b/exp_legacy/module/modules/addons/spawn-area.lua @@ -218,14 +218,12 @@ Event.add(defines.events.on_player_created, function(event) local p = { x = 0, y = 0 } local s = player.physical_surface - local force = game.forces["spawn"] - - if not (force or force.valid) then - force = game.create_force("spawn") - force.set_cease_fire("player", true) - game.forces["player"].set_cease_fire("spawn", true) + if not game.forces["spawn"] or game.forces["spawn"].valid then + game.create_force("spawn") end + game.forces["spawn"].set_cease_fire("player", true) + game.forces["player"].set_cease_fire("spawn", true) game.forces["spawn"].set_ammo_damage_modifier("bullet", 1) game.forces["spawn"].set_gun_speed_modifier("bullet", 1) game.forces["spawn"].set_turret_attack_modifier("gun-turret", 1) From 350f8c3f8d212f362630638013aa6cf2cf665ac7 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Mon, 21 Apr 2025 14:51:05 +0900 Subject: [PATCH 384/406] . --- exp_legacy/module/config/_file_loader.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exp_legacy/module/config/_file_loader.lua b/exp_legacy/module/config/_file_loader.lua index c04554f8..be5ba943 100644 --- a/exp_legacy/module/config/_file_loader.lua +++ b/exp_legacy/module/config/_file_loader.lua @@ -62,7 +62,7 @@ return { "modules.gui.surveillance", "modules.gui._role_updates", - "modules.graftorio.require", -- graftorio + -- "modules.graftorio.require", -- graftorio --- Config Files "config.expcore.permission_groups", -- loads some predefined permission groups "config.expcore.roles", -- loads some predefined roles From 9a6e0560084c3cc86f080cd79466b37e9c2e1fe6 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Sat, 26 Apr 2025 13:55:24 +0900 Subject: [PATCH 385/406] . --- exp_legacy/module/config/expcore/roles.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/exp_legacy/module/config/expcore/roles.lua b/exp_legacy/module/config/expcore/roles.lua index a9841870..5fd1ffc4 100644 --- a/exp_legacy/module/config/expcore/roles.lua +++ b/exp_legacy/module/config/expcore/roles.lua @@ -324,6 +324,7 @@ Roles.define_role_order{ Roles.override_player_roles{ ["PHIDIAS0303"] = { "Senior Administrator" }, + ["MadKatz"] = { "Moderator" }, ["majoro"] = { "Trainee Moderator" }, ["konohaScarlet_"] = { "Trainee Moderator" }, ["hihicome3"] = { "Trainee Moderator" }, From 2b3a49391f86cd7cdfb0b1f3486c369ca5cc8cc7 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Sat, 26 Apr 2025 14:16:06 +0900 Subject: [PATCH 386/406] . --- exp_legacy/module/config/expcore/roles.lua | 45 ++++++++++++---------- 1 file changed, 25 insertions(+), 20 deletions(-) diff --git a/exp_legacy/module/config/expcore/roles.lua b/exp_legacy/module/config/expcore/roles.lua index 5fd1ffc4..96e0b502 100644 --- a/exp_legacy/module/config/expcore/roles.lua +++ b/exp_legacy/module/config/expcore/roles.lua @@ -324,48 +324,53 @@ Roles.define_role_order{ Roles.override_player_roles{ ["PHIDIAS0303"] = { "Senior Administrator" }, - ["MadKatz"] = { "Moderator" }, - ["majoro"] = { "Trainee Moderator" }, - ["konohaScarlet_"] = { "Trainee Moderator" }, - ["hihicome3"] = { "Trainee Moderator" }, - ["Athenaa"] = { "Trainee Moderator" }, - ["rongli"] = { "Trainee Moderator" }, - ["JamesJung"] = { "Trainee Moderator" }, + ["7h3w1z4rd"] = { "Moderator" }, ["aldldl"] = { "Moderator" }, ["arty714"] = { "Moderator" }, - ["Cooldude2606"] = { "Moderator" }, - ["Drahc_pro"] = { "Moderator" }, - ["mark9064"] = { "Moderator" }, - ["7h3w1z4rd"] = { "Moderator" }, - ["FlipHalfling90"] = { "Moderator" }, - ["hamsterbryan"] = { "Moderator" }, - ["HunterOfGames"] = { "Moderator" }, - ["NextIdea"] = { "Moderator" }, - ["TheKernel32"] = { "Moderator" }, - ["TheKernel64"] = { "Moderator" }, - ["tovernaar123"] = { "Moderator" }, - ["UUBlueFire"] = { "Moderator" }, ["AssemblyStorm"] = { "Moderator" }, ["banakeg"] = { "Moderator" }, ["connormkii"] = { "Moderator" }, ["cydes"] = { "Moderator" }, + ["Cooldude2606"] = { "Moderator" }, ["darklich14"] = { "Moderator" }, + ["Drahc_pro"] = { "Moderator" }, ["facere"] = { "Moderator" }, ["freek18"] = { "Moderator" }, + ["FlipHalfling90"] = { "Moderator" }, ["Gizan"] = { "Moderator" }, + ["hamsterbryan"] = { "Moderator" }, + ["hidden_relic"] = { "Moderator" }, + ["Hova"] = { "Moderator" }, + ["HunterOfGames"] = { "Moderator" }, ["LoicB"] = { "Moderator" }, ["M74132"] = { "Moderator" }, + ["MadKatz"] = { "Moderator" }, ["mafisch3"] = { "Moderator" }, ["maplesyrup01"] = { "Moderator" }, + ["mark9064"] = { "Moderator" }, + ["nallaj"] = { "Moderator" }, + ["NextIdea"] = { "Moderator" }, + ["oof2win2"] = { "Moderator" }, ["ookl"] = { "Moderator" }, ["Phoenix27833"] = { "Moderator" }, ["porelos"] = { "Moderator" }, + ["rongli"] = { "Trainee Moderator" }, ["Ruuyji"] = { "Moderator" }, ["samy115"] = { "Moderator" }, ["SilentLog"] = { "Moderator" }, ["Tcheko"] = { "Moderator" }, ["thadius856"] = { "Moderator" }, + ["TheKernel32"] = { "Moderator" }, + ["TheKernel64"] = { "Moderator" }, + ["tovernaar123"] = { "Moderator" }, + ["UUBlueFire"] = { "Moderator" }, ["whoami32"] = { "Moderator" }, ["Windbomb"] = { "Moderator" }, - ["XenoCyber"] = { "Moderator" } + ["Windsinger"] = { "Moderator" }, + ["XenoCyber"] = { "Moderator" }, + ["Athenaa"] = { "Trainee Moderator" }, + ["hihicome3"] = { "Trainee Moderator" }, + ["JamesJung"] = { "Trainee Moderator" }, + ["konohaScarlet_"] = { "Trainee Moderator" }, + ["majoro"] = { "Trainee Moderator" }, } From c36b92c401d614c5f925436cd3ca179f6dca1d54 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Mon, 12 May 2025 20:25:30 +0900 Subject: [PATCH 387/406] . --- exp_scenario/module/commands/trains.lua | 2 ++ 1 file changed, 2 insertions(+) diff --git a/exp_scenario/module/commands/trains.lua b/exp_scenario/module/commands/trains.lua index 0df7b2c7..2a122377 100644 --- a/exp_scenario/module/commands/trains.lua +++ b/exp_scenario/module/commands/trains.lua @@ -11,8 +11,10 @@ local module = {} function module.manual(player, surface, force) local trains = game.train_manager.get_trains{ + stock = "locomotive", has_passenger = false, is_manual = true, + is_moving = false, surface = surface, force = force, } From 268feab5f775c35d99f3737a6ff4ec2d31f25b0d Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Mon, 12 May 2025 21:56:09 +0900 Subject: [PATCH 388/406] . --- exp_commands/module/locale/en.cfg | 4 ++-- exp_commands/module/locale/zh-CN.cfg | 4 ++-- exp_commands/module/locale/zh-TW.cfg | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/exp_commands/module/locale/en.cfg b/exp_commands/module/locale/en.cfg index 5ccb8f70..6a483445 100644 --- a/exp_commands/module/locale/en.cfg +++ b/exp_commands/module/locale/en.cfg @@ -2,8 +2,8 @@ help=__1__- __2____3__ usage=/__1__ __2__ aliases=\n Aliaies: __1__ -argument=<__1__> -optional=[__1__] +argument=<__1__> +optional=[__1__] argument-verbose=\n <__1__> - __2__ optional-verbose=\n [__1__] - __2__ success=Command Complete. diff --git a/exp_commands/module/locale/zh-CN.cfg b/exp_commands/module/locale/zh-CN.cfg index 1fb16d73..6b0fa0dc 100644 --- a/exp_commands/module/locale/zh-CN.cfg +++ b/exp_commands/module/locale/zh-CN.cfg @@ -2,8 +2,8 @@ help=__1__- __2____3__ usage=/__1__ __2__ aliases=\n 別名: __1__ -argument=<__1__> -optional=[__1__] +argument=<__1__> +optional=[__1__] argument-verbose=\n <__1__> - __2__ optional-verbose=\n [__1__] - __2__ success=指令完成。 diff --git a/exp_commands/module/locale/zh-TW.cfg b/exp_commands/module/locale/zh-TW.cfg index 1fb16d73..4297d724 100644 --- a/exp_commands/module/locale/zh-TW.cfg +++ b/exp_commands/module/locale/zh-TW.cfg @@ -2,8 +2,8 @@ help=__1__- __2____3__ usage=/__1__ __2__ aliases=\n 別名: __1__ -argument=<__1__> -optional=[__1__] +argument=<__1__> +optional=[__1__] argument-verbose=\n <__1__> - __2__ optional-verbose=\n [__1__] - __2__ success=指令完成。 @@ -41,7 +41,7 @@ disabled=此命令目前已停用。 description=列出和查找指令 arg-keyword=關鍵詞 arg-page=頁數 -header="__1__" 的幫助: +header="__1__" 的幫助: footer=[__1__ 項已找到: 頁 __2__ ,共 __3__] format=/__1__ __2__ __3__ aliases=別名: __1__ From f79408d37c2e116321bb278634c6d306a5deecca Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Mon, 12 May 2025 22:03:43 +0900 Subject: [PATCH 389/406] . --- exp_legacy/module/modules/gui/tool.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/exp_legacy/module/modules/gui/tool.lua b/exp_legacy/module/modules/gui/tool.lua index 6ccfc7ff..fd3878c1 100644 --- a/exp_legacy/module/modules/gui/tool.lua +++ b/exp_legacy/module/modules/gui/tool.lua @@ -50,10 +50,11 @@ local tool_gui_arty_b = Gui.element("tool_gui_arty_b") ):on_click(function(def, player, element) if Selection.is_selecting(player, SelectionArtyArea) then Selection.stop(player) + player.print{ "exp-commands_waterfill.exit" } else Selection.start(player, SelectionArtyArea) - player.print{ "tool.entered-area-selection" } + player.print{ "exp-commands_waterfill.enter" } end end) From cf2b4476d563edf40755a435779b2752be680100 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Mon, 12 May 2025 22:22:22 +0900 Subject: [PATCH 390/406] . --- exp_legacy/module/modules/gui/vlayer.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exp_legacy/module/modules/gui/vlayer.lua b/exp_legacy/module/modules/gui/vlayer.lua index c5512799..c2a55fd2 100644 --- a/exp_legacy/module/modules/gui/vlayer.lua +++ b/exp_legacy/module/modules/gui/vlayer.lua @@ -378,7 +378,7 @@ local vlayer_gui_control_see = Gui.element("vlayer_gui_control_see") }:on_click(function(def, player, element, event) local target = element.parent[vlayer_gui_control_type.name].selected_index local n = element.parent[vlayer_gui_control_list.name].selected_index - + if target and vlayer_control_type_list[target] and n > 0 then local i = vlayer.get_interfaces() local entity = i[vlayer_control_type_list[target]][n] From 5914aced5ec01f0126d40c672c12e8c8aa58f044 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Tue, 13 May 2025 13:24:33 +0900 Subject: [PATCH 391/406] . --- exp_legacy/module/modules/gui/tool.lua | 4 ++-- exp_scenario/module/locale/zh-CN.cfg | 4 ++-- exp_scenario/module/locale/zh-TW.cfg | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/exp_legacy/module/modules/gui/tool.lua b/exp_legacy/module/modules/gui/tool.lua index fd3878c1..cce6b157 100644 --- a/exp_legacy/module/modules/gui/tool.lua +++ b/exp_legacy/module/modules/gui/tool.lua @@ -50,11 +50,11 @@ local tool_gui_arty_b = Gui.element("tool_gui_arty_b") ):on_click(function(def, player, element) if Selection.is_selecting(player, SelectionArtyArea) then Selection.stop(player) - player.print{ "exp-commands_waterfill.exit" } + player.print{ "exp-commands_artillery.exit" } else Selection.start(player, SelectionArtyArea) - player.print{ "exp-commands_waterfill.enter" } + player.print{ "exp-commands_artillery.enter" } end end) diff --git a/exp_scenario/module/locale/zh-CN.cfg b/exp_scenario/module/locale/zh-CN.cfg index 09cc70d3..29d134fd 100644 --- a/exp_scenario/module/locale/zh-CN.cfg +++ b/exp_scenario/module/locale/zh-CN.cfg @@ -13,8 +13,8 @@ format=[AC] __1__: __2__ [exp-commands_artillery] description=火炮遙控 invalid-area=所選地區無效 -enter=現在進入區域選擇 -exit=已進入區域選擇 +enter=現在進入火炮區域選擇 +exit=已進入火炮區域選擇 [exp-commands_bot-queue] description=取得或更改建設隊列數量。 diff --git a/exp_scenario/module/locale/zh-TW.cfg b/exp_scenario/module/locale/zh-TW.cfg index 09cc70d3..29d134fd 100644 --- a/exp_scenario/module/locale/zh-TW.cfg +++ b/exp_scenario/module/locale/zh-TW.cfg @@ -13,8 +13,8 @@ format=[AC] __1__: __2__ [exp-commands_artillery] description=火炮遙控 invalid-area=所選地區無效 -enter=現在進入區域選擇 -exit=已進入區域選擇 +enter=現在進入火炮區域選擇 +exit=已進入火炮區域選擇 [exp-commands_bot-queue] description=取得或更改建設隊列數量。 From 0fa264ab0a059cf0dd692565147e09fc69fdccbf Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Fri, 16 May 2025 00:45:47 +0900 Subject: [PATCH 392/406] . --- exp_legacy/module/config/expcore/roles.lua | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/exp_legacy/module/config/expcore/roles.lua b/exp_legacy/module/config/expcore/roles.lua index 96e0b502..757ccb37 100644 --- a/exp_legacy/module/config/expcore/roles.lua +++ b/exp_legacy/module/config/expcore/roles.lua @@ -172,14 +172,6 @@ Roles.new_role("Senior Member", "SMem") :set_flag("instant-respawn") :set_parent("Member") :allow{ - "command/set-join-message", - "command/remove-join-message", - "command/goto", - "command/jail", - "command/unjail", - "command/spectate", - "command/follow", - "command/repair" } --- Standard User Roles @@ -190,6 +182,8 @@ Roles.new_role("Member", "Mem") :set_flag("deconlog-bypass") :set_parent("Veteran") :allow{ + "command/set-join-message", + "command/remove-join-message", "gui/vlayer-edit", "gui/rocket-info/toggle-active", "gui/rocket-info/remote_launch", @@ -203,6 +197,12 @@ Roles.new_role("Member", "Mem") "command/set-home", "command/get-home", "command/return", + "command/goto", + "command/jail", + "command/unjail", + "command/spectate", + "command/follow", + "command/repair", "fast-tree-decon" } @@ -354,7 +354,6 @@ Roles.override_player_roles{ ["ookl"] = { "Moderator" }, ["Phoenix27833"] = { "Moderator" }, ["porelos"] = { "Moderator" }, - ["rongli"] = { "Trainee Moderator" }, ["Ruuyji"] = { "Moderator" }, ["samy115"] = { "Moderator" }, ["SilentLog"] = { "Moderator" }, @@ -373,4 +372,5 @@ Roles.override_player_roles{ ["JamesJung"] = { "Trainee Moderator" }, ["konohaScarlet_"] = { "Trainee Moderator" }, ["majoro"] = { "Trainee Moderator" }, + ["rongli"] = { "Trainee Moderator" }, } From a42802f50937decf66a482ff40d630a216918863 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Mon, 19 May 2025 15:22:56 +0900 Subject: [PATCH 393/406] .. --- exp_legacy/module/config/advanced_start.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exp_legacy/module/config/advanced_start.lua b/exp_legacy/module/config/advanced_start.lua index 539fa4f3..021252f8 100644 --- a/exp_legacy/module/config/advanced_start.lua +++ b/exp_legacy/module/config/advanced_start.lua @@ -83,7 +83,7 @@ return { skip_victory = true, --- @setting skip_victory will skip the victory screen when a rocket is launched friendly_fire = false, --- @setting friendly_fire weather players will be able to attack each other on the same force enemy_expansion = false, --- @setting enemy_expansion a catch all for in case the map settings file fails to load - chart_radius = 10 * 32, --- @setting chart_radius the number of tiles that will be charted when the map starts + chart_radius = 20 * 32, --- @setting chart_radius the number of tiles that will be charted when the map starts items = { --- @setting items items and there condition for being given ["iron-ore"] = cutoff_time(20 * minutes, 80, 0), ["stone"] = cutoff_time(20 * minutes, 20, 0), From 6add30adf31cd8443d62db5eaac01dd8e2fe7d84 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Mon, 19 May 2025 15:23:20 +0900 Subject: [PATCH 394/406] . --- exp_legacy/module/config/advanced_start.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exp_legacy/module/config/advanced_start.lua b/exp_legacy/module/config/advanced_start.lua index 021252f8..e4985c9f 100644 --- a/exp_legacy/module/config/advanced_start.lua +++ b/exp_legacy/module/config/advanced_start.lua @@ -83,7 +83,7 @@ return { skip_victory = true, --- @setting skip_victory will skip the victory screen when a rocket is launched friendly_fire = false, --- @setting friendly_fire weather players will be able to attack each other on the same force enemy_expansion = false, --- @setting enemy_expansion a catch all for in case the map settings file fails to load - chart_radius = 20 * 32, --- @setting chart_radius the number of tiles that will be charted when the map starts + chart_radius = 16 * 32, --- @setting chart_radius the number of tiles that will be charted when the map starts items = { --- @setting items items and there condition for being given ["iron-ore"] = cutoff_time(20 * minutes, 80, 0), ["stone"] = cutoff_time(20 * minutes, 20, 0), From 524654e93596e75bf96dfeae24007d0025a37221 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Thu, 22 May 2025 14:17:16 +0900 Subject: [PATCH 395/406] . --- exp_legacy/module/modules/addons/afk-kick.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exp_legacy/module/modules/addons/afk-kick.lua b/exp_legacy/module/modules/addons/afk-kick.lua index de1e2ec2..bb57f98a 100644 --- a/exp_legacy/module/modules/addons/afk-kick.lua +++ b/exp_legacy/module/modules/addons/afk-kick.lua @@ -30,7 +30,7 @@ Event.on_nth_tick(config.update_time, function() -- Check for active players for _, player in ipairs(game.connected_players) do if player.afk_time < config.afk_time - or (config.active_role and Roles.get_player_highest_role(player).index >= Roles.get_role_from_any(config.active_role).index) + or (config.active_role and Roles.get_player_highest_role(player).index <= Roles.get_role_from_any(config.active_role).index) or (config.admin_as_active and player.admin) or (config.trust_as_active and player.online_time > config.trust_time) then -- Active player was found From 6ba8316cffc5cbbbc8c582af26ba0f5412d46a25 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Mon, 16 Jun 2025 00:21:16 +0900 Subject: [PATCH 396/406] . --- exp_gui/package.json | 2 +- exp_legacy/package.json | 2 +- exp_scenario/package.json | 4 ++-- exp_util/package.json | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/exp_gui/package.json b/exp_gui/package.json index 1bd59be4..af6148f6 100644 --- a/exp_gui/package.json +++ b/exp_gui/package.json @@ -16,7 +16,7 @@ "@clusterio/lib": "^2.0.0-alpha.19" }, "devDependencies": { - "@clusterio/lib": "2.0.0-alpha.19", + "@clusterio/lib": "^2.0.0-alpha.19", "@types/node": "^20.14.9", "typescript": "^5.5.3" }, diff --git a/exp_legacy/package.json b/exp_legacy/package.json index 089d643c..dffa543a 100644 --- a/exp_legacy/package.json +++ b/exp_legacy/package.json @@ -16,7 +16,7 @@ "@clusterio/lib": "^2.0.0-alpha.19" }, "devDependencies": { - "@clusterio/lib": "2.0.0-alpha.20", + "@clusterio/lib": "^2.0.0-alpha.20", "@types/node": "^20.4.5", "typescript": "^5.5.3" }, diff --git a/exp_scenario/package.json b/exp_scenario/package.json index 963df025..e14d008e 100644 --- a/exp_scenario/package.json +++ b/exp_scenario/package.json @@ -16,8 +16,8 @@ "@clusterio/lib": "^2.0.0-alpha.19" }, "devDependencies": { - "@clusterio/lib": "2.0.0-alpha.20", - "@clusterio/web_ui": "2.0.0-alpha.20.b", + "@clusterio/lib": "^2.0.0-alpha.20", + "@clusterio/web_ui": "^2.0.0-alpha.20.b", "@types/node": "^20.4.5", "@types/react": "^18.2.21", "antd": "^5.13.0", diff --git a/exp_util/package.json b/exp_util/package.json index ea90794e..cb576faf 100644 --- a/exp_util/package.json +++ b/exp_util/package.json @@ -16,7 +16,7 @@ "@clusterio/lib": "^2.0.0-alpha.19" }, "devDependencies": { - "@clusterio/lib": "2.0.0-alpha.20", + "@clusterio/lib": "^2.0.0-alpha.20", "@types/node": "^20.14.9", "typescript": "^5.5.3" }, From 6df40ac157baa80fea4d2365f0fdfc8eb2d765a7 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Mon, 25 Aug 2025 16:28:41 +0900 Subject: [PATCH 397/406] . --- exp_legacy/module/modules/addons/spawn-area.lua | 3 +++ 1 file changed, 3 insertions(+) diff --git a/exp_legacy/module/modules/addons/spawn-area.lua b/exp_legacy/module/modules/addons/spawn-area.lua index 9ed8755f..31c13482 100644 --- a/exp_legacy/module/modules/addons/spawn-area.lua +++ b/exp_legacy/module/modules/addons/spawn-area.lua @@ -194,6 +194,9 @@ end if config.turrets.enabled then Event.on_nth_tick(config.turrets.refill_time, function() if game.tick < 10 then return end + if game.tick < (config.turrets.refill_time + 10) and (not game.forces["spawn"] or game.forces["spawn"].valid) then + game.create_force("spawn") + end spawn_turrets() end) end From 301d8647ecd3b2cc31f08d5172454fc7af1919a7 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Tue, 26 Aug 2025 13:14:52 +0900 Subject: [PATCH 398/406] . --- .../module/modules/addons/spawn-area.lua | 34 ++++++++++++------- 1 file changed, 21 insertions(+), 13 deletions(-) diff --git a/exp_legacy/module/modules/addons/spawn-area.lua b/exp_legacy/module/modules/addons/spawn-area.lua index 31c13482..3bc963d7 100644 --- a/exp_legacy/module/modules/addons/spawn-area.lua +++ b/exp_legacy/module/modules/addons/spawn-area.lua @@ -20,6 +20,23 @@ for _, turret in ipairs(turrets) do turret.position = apply_offset(turret.position, config.turrets.offset) end +-- Get or create the force used for entities in spawn +local function get_spawn_force() + local force = game.forces["spawn"] + + if force and force.valid then + return force + end + + force = game.create_force("spawn") + force.set_cease_fire("player", true) + -- force.set_friend('player', true) + game.forces["player"].set_cease_fire("spawn", true) + -- game.forces['player'].set_friend('spawn', true) + + return force +end + -- Protects an entity -- and sets its force to the spawn force local function protect_entity(entity, set_force) @@ -30,7 +47,7 @@ local function protect_entity(entity, set_force) entity.operable = false if set_force then - entity.force = game.forces["neutral"] + entity.force = get_spawn_force() end end end @@ -194,8 +211,8 @@ end if config.turrets.enabled then Event.on_nth_tick(config.turrets.refill_time, function() if game.tick < 10 then return end - if game.tick < (config.turrets.refill_time + 10) and (not game.forces["spawn"] or game.forces["spawn"].valid) then - game.create_force("spawn") + if game.tick < (config.turrets.refill_time + 10) then + get_spawn_force() end spawn_turrets() end) @@ -220,16 +237,7 @@ Event.add(defines.events.on_player_created, function(event) local player = game.players[event.player_index] local p = { x = 0, y = 0 } local s = player.physical_surface - - if not game.forces["spawn"] or game.forces["spawn"].valid then - game.create_force("spawn") - end - - game.forces["spawn"].set_cease_fire("player", true) - game.forces["player"].set_cease_fire("spawn", true) - game.forces["spawn"].set_ammo_damage_modifier("bullet", 1) - game.forces["spawn"].set_gun_speed_modifier("bullet", 1) - game.forces["spawn"].set_turret_attack_modifier("gun-turret", 1) + get_spawn_force() spawn_area(s, p) if config.pattern.enabled then spawn_pattern(s, p) end if config.water.enabled then spawn_water(s, p) end From 3891e48acd358369d178857e5d7d10c437a1fa33 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Sun, 31 Aug 2025 01:36:03 +0900 Subject: [PATCH 399/406] . --- exp_legacy/module/modules/control/protection.lua | 1 + exp_legacy/module/modules/control/vlayer.lua | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/exp_legacy/module/modules/control/protection.lua b/exp_legacy/module/modules/control/protection.lua index 4f0d5c95..79415756 100644 --- a/exp_legacy/module/modules/control/protection.lua +++ b/exp_legacy/module/modules/control/protection.lua @@ -199,6 +199,7 @@ local function event_remove_entity(event) EntityProtection.remove_entity(event.entity) end +Event.add(defines.events.on_space_platform_pre_mined, event_remove_entity) Event.add(defines.events.on_pre_player_mined_item, event_remove_entity) Event.add(defines.events.on_robot_pre_mined, event_remove_entity) Event.add(defines.events.on_entity_died, event_remove_entity) diff --git a/exp_legacy/module/modules/control/vlayer.lua b/exp_legacy/module/modules/control/vlayer.lua index deefad4e..e5f6f59f 100644 --- a/exp_legacy/module/modules/control/vlayer.lua +++ b/exp_legacy/module/modules/control/vlayer.lua @@ -608,7 +608,11 @@ local function handle_circuit_interfaces() -- Set the item signals based on stored items for item_name, count in pairs(vlayer_data.storage.items) do if prototypes.item[item_name] and count > 0 then - circuit_oc.set_slot(signal_index, { value = { type = "item", name = item_name, quality = "normal" }, min = count }) + local existing_index = circuit_oc.set_slot(signal_index, { value = { type = "item", name = item_name, quality = "normal" }, min = count }) + if existing_index then + circuit_oc.clear_slot(existing_index) + circuit_oc.set_slot(signal_index, { value = { type = "item", name = item_name, quality = "normal" }, min = count }) + end signal_index = signal_index + 1 end end From 0d519700b6f3b60c43a4e8422fa8da02311f74d4 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Sun, 31 Aug 2025 01:41:02 +0900 Subject: [PATCH 400/406] . --- exp_commands/module/commands/ipc.lua | 3 +++ exp_commands/module/commands/rcon.lua | 3 --- exp_legacy/module/control.lua | 2 +- exp_legacy/module/utils/event.lua | 4 ++-- exp_util/module/async.lua | 7 ++----- exp_util/module/include/package.lua | 7 ++----- exp_util/module/storage.lua | 12 +++++------- 7 files changed, 15 insertions(+), 23 deletions(-) diff --git a/exp_commands/module/commands/ipc.lua b/exp_commands/module/commands/ipc.lua index b4799405..efc0e856 100644 --- a/exp_commands/module/commands/ipc.lua +++ b/exp_commands/module/commands/ipc.lua @@ -10,6 +10,9 @@ local Clustorio = require("modules/clusterio/api") local json_to_table = helpers.json_to_table +Commands.add_rcon_static("Clustorio", Clustorio) +Commands.add_rcon_static("ipc", Clustorio.send_json) + Commands.new("_ipc", { "exp-commands_ipc.description" }) :argument("channel", { "exp-commands_ipc.arg-channel" }, Commands.types.string) :argument("message", { "exp-commands_ipc.arg-message" }, Commands.types.string) diff --git a/exp_commands/module/commands/rcon.lua b/exp_commands/module/commands/rcon.lua index 3e7b7059..1e1d2ec5 100644 --- a/exp_commands/module/commands/rcon.lua +++ b/exp_commands/module/commands/rcon.lua @@ -11,7 +11,6 @@ System command which runs arbitrary code within a custom (not sandboxed) environ local ExpUtil = require("modules/exp_util") local Async = require("modules/exp_util/async") local Storage = require("modules/exp_util/storage") -local Clustorio = require("modules/clusterio/api") local Commands = require("modules/exp_commands") --- @class Commands @@ -26,9 +25,7 @@ setmetatable(rcon_env, { __index = rcon_static }) rcon_static.Async = Async rcon_static.ExpUtil = ExpUtil rcon_static.Commands = Commands -rcon_static.Clustorio = Clustorio rcon_static.print = Commands.print -rcon_static.ipc = Clustorio.send_json --- @diagnostic enable: name-style-check --- Some common callback values which are useful when a player uses the command diff --git a/exp_legacy/module/control.lua b/exp_legacy/module/control.lua index b1c46a23..f5033af3 100644 --- a/exp_legacy/module/control.lua +++ b/exp_legacy/module/control.lua @@ -41,6 +41,6 @@ for _, error in ipairs(errors) do log(error) end log("[END] -----| Explosive Gaming Scenario Loader |-----") ---- Register all event handlers via clusterio +--- Register all event handlers via event handler local Event = require("modules/exp_legacy/utils/event") return Event.real_handlers diff --git a/exp_legacy/module/utils/event.lua b/exp_legacy/module/utils/event.lua index 216eac16..f2407f06 100644 --- a/exp_legacy/module/utils/event.lua +++ b/exp_legacy/module/utils/event.lua @@ -1,4 +1,3 @@ -local Clustorio = require("modules/clusterio/api") local ExpUtil = require("modules/exp_util") local Event = { @@ -66,7 +65,8 @@ function Event.on_init(handler) end handlers[#handlers + 1] = handler - Event.add(Clustorio.events.on_server_startup, handler) + Event.add(defines.events.on_singleplayer_init, handler) + Event.add(defines.events.on_multiplayer_init, handler) end function Event.on_load(handler) diff --git a/exp_util/module/async.lua b/exp_util/module/async.lua index ba37af7f..b31554f6 100644 --- a/exp_util/module/async.lua +++ b/exp_util/module/async.lua @@ -408,13 +408,10 @@ end local e = defines.events local events = { [e.on_tick] = on_tick, + [e.on_singleplayer_init] = Async.on_init, + [e.on_multiplayer_init] = Async.on_init, } -local Clustorio = ExpUtil.optional_require("modules/clusterio/api") -if Clustorio then - events[Clustorio.events.on_server_startup] = Async.on_init -end - Async._function_metatable.__call = Async._function_prototype.start_soon Async.events = events --- @package return Async diff --git a/exp_util/module/include/package.lua b/exp_util/module/include/package.lua index 8d09dcea..96181735 100644 --- a/exp_util/module/include/package.lua +++ b/exp_util/module/include/package.lua @@ -1,7 +1,5 @@ -- luacheck:ignore global package -local Clustorio = require("modules/clusterio/api") - --- Enum values for the different lifecycle stages within a factorio module -- Info on the data lifecycle and how we use it: https://lua-api.factorio.com/latest/auxiliary/data-lifecycle.html -- We start in control stage and so values 1 thorough 3 are only present for completeness @@ -25,10 +23,9 @@ return setmetatable({ on_load = function() package.lifecycle = package.lifecycle_stage.load end, on_configuration_changed = function() package.lifecycle = package.lifecycle_stage.config_change end, events = { - -- TODO find a reliable way to set to runtime because currently it will desync if accessed before player joined - -- TODO make clusterio optional dependency [defines.events.on_player_joined_game] = function() package.lifecycle = package.lifecycle_stage.runtime end, - [Clustorio.events.on_server_startup] = function() package.lifecycle = package.lifecycle_stage.runtime end, + [defines.events.on_singleplayer_init] = function() package.lifecycle = package.lifecycle_stage.runtime end, + [defines.events.on_multiplayer_init] = function() package.lifecycle = package.lifecycle_stage.runtime end, }, }, { __index = package, diff --git a/exp_util/module/storage.lua b/exp_util/module/storage.lua index 5ec30318..2347c882 100644 --- a/exp_util/module/storage.lua +++ b/exp_util/module/storage.lua @@ -119,12 +119,10 @@ function Storage.on_init() end end -local events = {} +--- @package +Storage.events = { + [defines.events.on_multiplayer_init] = Storage.on_init, + [defines.events.on_singleplayer_init] = Storage.on_init, +} -local Clustorio = ExpUtil.optional_require("modules/clusterio/api") -if Clustorio then - events[Clustorio.events.on_server_startup] = Storage.on_init -end - -Storage.events = events --- @package return Storage From d917c50e3e5feb90bfef866f11c30a3569169d1f Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Sun, 31 Aug 2025 01:43:29 +0900 Subject: [PATCH 401/406] . --- exp_server_ups/instance.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/exp_server_ups/instance.ts b/exp_server_ups/instance.ts index 9cbe1e63..661c18bd 100644 --- a/exp_server_ups/instance.ts +++ b/exp_server_ups/instance.ts @@ -24,6 +24,14 @@ export class InstancePlugin extends BaseInstancePlugin { } } + async onPlayerEvent(event: lib.PlayerEvent): Promise { + if (event.type === "join" && !this.updateInterval) { + await this.onStart(); + } else if (event.type === "leave" && this.instance.playersOnline.size == 0 && this.instance.config.get("factorio.settings")["auto_pause"] as boolean) { + this.onExit(); + } + } + async updateUps() { let ups = 0; const collected = this.gameTimes.length - 1; From b69653e85f88da355bb12541f6bdc68627264f6c Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Sun, 31 Aug 2025 01:54:19 +0900 Subject: [PATCH 402/406] . --- exp_legacy/module/locale/zh-TW/gui.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exp_legacy/module/locale/zh-TW/gui.cfg b/exp_legacy/module/locale/zh-TW/gui.cfg index f63ef663..ec8f6120 100644 --- a/exp_legacy/module/locale/zh-TW/gui.cfg +++ b/exp_legacy/module/locale/zh-TW/gui.cfg @@ -245,7 +245,7 @@ control-type-energy=電力 control-type-circuit=回路 control-type-storage-input=放入箱 control-type-storage-output=提取箱 -power-on-space-research=你要研究 [technology=__1__] 在 __2__ 級才可使用太空平台 vlayer 功能。 +power-on-space-research=你要研究 [technology=__1__] 在 __2__ 級 才可使用太空平台 vlayer 功能。 enter=現在進入 vlayer 區域選擇 exit=已進入 vlayer 區域選擇 From c00470e58c4f76b2ae4bd2539d1e257d33f4e6f4 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Sun, 31 Aug 2025 02:13:45 +0900 Subject: [PATCH 403/406] . --- exp_legacy/module/config/bonus.lua | 54 +++++++++++++++--------------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/exp_legacy/module/config/bonus.lua b/exp_legacy/module/config/bonus.lua index cc12a6da..d7e04635 100644 --- a/exp_legacy/module/config/bonus.lua +++ b/exp_legacy/module/config/bonus.lua @@ -94,7 +94,7 @@ return { value_step = 1, scale = 1, cost = 1, - is_percentage = false, + is_percentage = false }, ['character_loot_pickup_distance_bonus'] = { initial_value = 0, @@ -102,7 +102,7 @@ return { value_step = 1, scale = 1, cost = 1, - is_percentage = false, + is_percentage = false }, ['character_item_drop_distance_bonus'] = { initial_value = 0, @@ -110,8 +110,8 @@ return { value_step = 1, scale = 1, cost = 1, - is_percentage = false, - }, + is_percentage = false + } ]] }, force_bonus = { @@ -122,7 +122,7 @@ return { value_step = 0.5, scale = 1, cost = 10, - is_percentage = true, + is_percentage = true }, ['character_running_speed_modifier'] = { initial_value = 0, @@ -130,7 +130,7 @@ return { value_step = 0.25, scale = 1, cost = 40, - is_percentage = true, + is_percentage = true }, ['character_crafting_speed_modifier'] = { initial_value = 0, @@ -138,7 +138,7 @@ return { value_step = 1, scale = 1, cost = 4, - is_percentage = true, + is_percentage = true }, ['character_inventory_slots_bonus'] = { initial_value = 0, @@ -146,14 +146,14 @@ return { value_step = 10, scale = 100, cost = 2, - is_percentage = false, + is_percentage = false }, ['character_health_bonus'] = { initial_value = 0, max_value = 400, value_step = 50, cost = 4, - is_percentage = false, + is_percentage = false }, ['character_reach_distance_bonus'] = { initial_value = 0, @@ -164,8 +164,8 @@ return { is_percentage = false, combined_bonus = { 'character_resource_reach_distance_bonus', - 'character_build_distance_bonus', - }, + 'character_build_distance_bonus' + } }, ['worker_robots_speed_modifier'] = { initial_value = 0, @@ -173,7 +173,7 @@ return { value_step = 0, scale = 1, cost = 1, - is_percentage = false, + is_percentage = false }, ]] ["worker_robots_battery_modifier"] = { @@ -207,7 +207,7 @@ return { value_step = 1, scale = 1, cost = 1, - is_percentage = false, + is_percentage = false }, ['character_loot_pickup_distance_bonus'] = { initial_value = 0, @@ -215,7 +215,7 @@ return { value_step = 1, scale = 1, cost = 1, - is_percentage = false, + is_percentage = false }, ['character_item_drop_distance_bonus'] = { initial_value = 0, @@ -223,7 +223,7 @@ return { value_step = 1, scale = 1, cost = 1, - is_percentage = false, + is_percentage = false }, ['character_trash_slot_count'] = { initial_value = 0, @@ -231,7 +231,7 @@ return { value_step = 0, scale = 1, cost = 1, - is_percentage = false, + is_percentage = false }, ['mining_drill_productivity_bonus'] = { initial_value = 0, @@ -239,7 +239,7 @@ return { value_step = 0, scale = 1, cost = 1, - is_percentage = false, + is_percentage = false }, ['train_braking_force_bonus'] = { initial_value = 0, @@ -247,7 +247,7 @@ return { value_step = 0, scale = 1, cost = 1, - is_percentage = false, + is_percentage = false }, ['laboratory_speed_modifier'] = { initial_value = 0, @@ -255,7 +255,7 @@ return { value_step = 0, scale = 1, cost = 1, - is_percentage = false, + is_percentage = false }, ['laboratory_productivity_bonus'] = { initial_value = 0, @@ -263,7 +263,7 @@ return { value_step = 0, scale = 1, cost = 1, - is_percentage = false, + is_percentage = false }, ['inserter_stack_size_bonus'] = { initial_value = 0, @@ -271,7 +271,7 @@ return { value_step = 0, scale = 1, cost = 1, - is_percentage = false, + is_percentage = false }, ['stack_inserter_capacity_bonus'] = { initial_value = 0, @@ -279,7 +279,7 @@ return { value_step = 0, scale = 1, cost = 1, - is_percentage = false, + is_percentage = false }, ['artillery_range_modifier'] = { initial_value = 0, @@ -287,8 +287,8 @@ return { value_step = 0, scale = 1, cost = 1, - is_percentage = false, - }, + is_percentage = false + } ]] }, surface_bonus = { @@ -299,8 +299,8 @@ return { value_step = 1, scale = 1, cost = 1, - is_percentage = false, - }, + is_percentage = false + } ]] }, -} +} \ No newline at end of file From a6aad24c77642c5cbbfc0f3b6cd8cd523a8db503 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Tue, 2 Sep 2025 22:53:08 +0900 Subject: [PATCH 404/406] . --- exp_scenario/module/control.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exp_scenario/module/control.lua b/exp_scenario/module/control.lua index 8c24e0f6..131aea9e 100644 --- a/exp_scenario/module/control.lua +++ b/exp_scenario/module/control.lua @@ -56,5 +56,5 @@ add(require("modules/exp_scenario/gui/player_stats")) add(require("modules/exp_scenario/gui/production_stats")) add(require("modules/exp_scenario/gui/quick_actions")) add(require("modules/exp_scenario/gui/research_milestones")) -add(require("modules/exp_scenario/gui/science_production")) +-- add(require("modules/exp_scenario/gui/science_production")) add(require("modules/exp_scenario/gui/surveillance")) From a32095ae2db9334ee30a8e716ebae3e1dfaab8d6 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Tue, 23 Sep 2025 19:33:39 +0900 Subject: [PATCH 405/406] . --- .../module/gui/research_milestones.lua | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/exp_scenario/module/gui/research_milestones.lua b/exp_scenario/module/gui/research_milestones.lua index 4f6d9f19..b1d2cb3a 100644 --- a/exp_scenario/module/gui/research_milestones.lua +++ b/exp_scenario/module/gui/research_milestones.lua @@ -46,16 +46,19 @@ do --- Calculate the research targets local research_index = 1 local total_time = 0 for name, time in pairs(config.milestone[config.mod_set]) do - research_targets.index_lookup[name] = research_index - total_time = total_time + time * 60 + if prototypes.technology[name] and (not prototypes.technology[name].hidden) then + research_targets.index_lookup[name] = research_index + total_time = total_time + time * 60 - research_targets.target_times[research_index] = { - name = name, - target = total_time, - label = research_time_format(total_time), - } + research_targets.target_times[research_index] = { + name = name, + target = total_time, + label = research_time_format(total_time), + } - research_index = research_index + 1 + research_index = research_index + 1 + + end end research_targets.length = research_index - 1 research_targets.max_start_index = math.max(1, research_index - display_size) From 255cf1e51b9752c4062eabe8e38a049f53d918c4 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Tue, 23 Sep 2025 19:35:49 +0900 Subject: [PATCH 406/406] . --- exp_scenario/module/gui/research_milestones.lua | 1 - 1 file changed, 1 deletion(-) diff --git a/exp_scenario/module/gui/research_milestones.lua b/exp_scenario/module/gui/research_milestones.lua index 8b2b3fdf..d7cb2716 100644 --- a/exp_scenario/module/gui/research_milestones.lua +++ b/exp_scenario/module/gui/research_milestones.lua @@ -57,7 +57,6 @@ do --- Calculate the research targets } research_index = research_index + 1 - end end research_targets.length = research_index - 1