Merge branch 'explosivegaming:main' into aperx

This commit is contained in:
2026-06-26 14:06:50 +09:00
committed by GitHub
3 changed files with 27 additions and 6 deletions
+11 -5
View File
@@ -4,10 +4,12 @@ Adds a command that allows setting and teleporting to your home position
local ExpUtil = require("modules/exp_util") local ExpUtil = require("modules/exp_util")
local teleport = ExpUtil.teleport_player local teleport = ExpUtil.teleport_player
local Commands = require("modules/exp_commands") local Commands = require("modules/exp_commands")
local Storage = require("modules/exp_util/storage") local Storage = require("modules/exp_util/storage")
--- @class ExpCommand_Home.commands
local commands = {}
--- @type table<number, table<number, [MapPosition?, MapPosition?]>> --- @type table<number, table<number, [MapPosition?, MapPosition?]>>
local homes = {} -- homes[player_index][surface_index] = { home_pos, return_pos } local homes = {} -- homes[player_index][surface_index] = { home_pos, return_pos }
Storage.register(homes, function(tbl) Storage.register(homes, function(tbl)
@@ -28,7 +30,8 @@ local function align_to_grid(position)
end end
--- Teleports you to your home location on the current surface --- Teleports you to your home location on the current surface
Commands.new("home", { "exp-commands_home.description-home" }) --- @class ExpCommand_Home.commands.home: ExpCommand
commands.home = Commands.new("home", { "exp-commands_home.description-home" })
:add_flags{ "character_only" } :add_flags{ "character_only" }
:register(function(player) :register(function(player)
local surface = player.surface local surface = player.surface
@@ -50,7 +53,8 @@ Commands.new("home", { "exp-commands_home.description-home" })
end) end)
--- Teleports you to your previous location on the current surface --- Teleports you to your previous location on the current surface
Commands.new("return", { "exp-commands_home.description-return" }) --- @class ExpCommand_Home.commands._return: ExpCommand
commands._return = Commands.new("return", { "exp-commands_home.description-return" })
:add_flags{ "character_only" } :add_flags{ "character_only" }
:register(function(player) :register(function(player)
local surface = player.surface local surface = player.surface
@@ -72,7 +76,8 @@ Commands.new("return", { "exp-commands_home.description-return" })
end) end)
--- Sets your home location on your current surface to your current position --- Sets your home location on your current surface to your current position
Commands.new("set-home", { "exp-commands_home.description-set" }) --- @class ExpCommand_Home.commands.set_home: ExpCommand
commands.set_home = Commands.new("set-home", { "exp-commands_home.description-set" })
:add_flags{ "character_only" } :add_flags{ "character_only" }
:register(function(player) :register(function(player)
local home_position, floor_position = align_to_grid(player.position) local home_position, floor_position = align_to_grid(player.position)
@@ -97,7 +102,8 @@ Commands.new("set-home", { "exp-commands_home.description-set" })
end) end)
--- Gets your home location on your current surface, is allowed in remote view --- Gets your home location on your current surface, is allowed in remote view
Commands.new("get-home", { "exp-commands_home.description-get" }) --- @class ExpCommand_Home.commands.get_home: ExpCommand
commands.get_home = Commands.new("get-home", { "exp-commands_home.description-get" })
:register(function(player) :register(function(player)
local surface = player.surface local surface = player.surface
+9 -1
View File
@@ -5,8 +5,12 @@ Adds a virtual layer to store power to save space.
local Commands = require("modules/exp_commands") local Commands = require("modules/exp_commands")
local vlayer = require("modules.exp_legacy.modules.control.vlayer") local vlayer = require("modules.exp_legacy.modules.control.vlayer")
--- @class ExpCommand_vlayer.commands
local commands = {}
--- Print all vlayer information --- Print all vlayer information
Commands.new("vlayer-info", { "exp-commands_vlayer.description" }) --- @class ExpCommands_vlayer.commands.vlayer: ExpCommand
commands.vlayer = Commands.new("vlayer-info", { "exp-commands_vlayer.description" })
:register(function(player) :register(function(player)
local index = 3 local index = 3
local response = { "", "exp-commands_vlayer.title" } --- @type LocalisedString local response = { "", "exp-commands_vlayer.title" } --- @type LocalisedString
@@ -16,3 +20,7 @@ Commands.new("vlayer-info", { "exp-commands_vlayer.description" })
end end
return Commands.status.success(response) return Commands.status.success(response)
end) end)
return {
commands = commands,
}
@@ -11,6 +11,8 @@ local addon_research = require("modules/exp_scenario/commands/research")
local addon_trains = require("modules/exp_scenario/commands/trains") local addon_trains = require("modules/exp_scenario/commands/trains")
local addon_teleport = require("modules/exp_scenario/commands/teleport") local addon_teleport = require("modules/exp_scenario/commands/teleport")
local addon_waterfill = require("modules/exp_scenario/commands/waterfill") local addon_waterfill = require("modules/exp_scenario/commands/waterfill")
local addon_home = require("modules/exp_scenario/commands/home")
local addon_vlayer = require("modules/exp_scenario/commands/vlayer")
--- @class ExpGui_QuickActions.elements --- @class ExpGui_QuickActions.elements
local Elements = {} local Elements = {}
@@ -51,6 +53,11 @@ new_quick_action("spawn", addon_teleport.commands.spawn, function(def, player, e
end) end)
new_quick_action("waterfill", addon_waterfill.commands.waterfill) new_quick_action("waterfill", addon_waterfill.commands.waterfill)
new_quick_action("home", addon_home.commands.home)
new_quick_action("return", addon_home.commands._return)
new_quick_action("set-home", addon_home.commands.set_home)
new_quick_action("get-home", addon_home.commands.get_home)
new_quick_action("vlayer", addon_vlayer.commands.vlayer)
--- Container added to the left gui flow --- Container added to the left gui flow
--- @class ExpGui_QuickActions.elements.container: ExpElement --- @class ExpGui_QuickActions.elements.container: ExpElement