mirror of
https://github.com/PHIDIAS0303/ExpCluster.git
synced 2025-12-27 11:35:22 +09:00
Add Tool Gui (#20)
* Update _file_loader.lua * Create tool.lua * Update trains.lua * Update research.lua * Fix use of created_entity in events * Update trains.lua * Update tool.lua * Update research.lua * Update research.lua * Update tool.lua * Update research.lua * Update trains.lua * Fix waterfill locale * Fix bug with selection tools and remote view * Fix tool GUI * Update tool.lua --------- Co-authored-by: Cooldude2606 <25043174+Cooldude2606@users.noreply.github.com>
This commit is contained in:
@@ -4,9 +4,26 @@ Adds a command that set all train back to automatic
|
||||
|
||||
local Commands = require("modules/exp_commands")
|
||||
local format_player_name = Commands.format_player_name_locale
|
||||
|
||||
local format_number = require("util").format_number
|
||||
|
||||
--- @class Command.Trains
|
||||
local module = {}
|
||||
|
||||
function module.manual(player, surface, force)
|
||||
local trains = game.train_manager.get_trains{
|
||||
has_passenger = false,
|
||||
is_manual = true,
|
||||
surface = surface,
|
||||
force = force,
|
||||
}
|
||||
|
||||
for _, train in ipairs(trains) do
|
||||
train.manual_mode = false
|
||||
end
|
||||
|
||||
game.print{ "exp-commands_trains.response", format_player_name(player), format_number(#trains, false) }
|
||||
end
|
||||
|
||||
--- Set all trains to automatic
|
||||
Commands.new("set-trains-to-automatic", { "exp-commands_trains.description" })
|
||||
:optional("surface", { "exp-commands_trains.arg-surface" }, Commands.types.surface)
|
||||
@@ -14,16 +31,7 @@ Commands.new("set-trains-to-automatic", { "exp-commands_trains.description" })
|
||||
:register(function(player, surface, force)
|
||||
--- @cast surface LuaSurface?
|
||||
--- @cast force LuaForce?
|
||||
local trains = game.train_manager.get_trains{
|
||||
has_passenger = false,
|
||||
is_manual = true,
|
||||
surface = surface,
|
||||
force = force,
|
||||
}
|
||||
|
||||
for _, train in ipairs(trains) do
|
||||
train.manual_mode = false
|
||||
end
|
||||
|
||||
game.print{ "exp-commands_trains.response", format_player_name(player), format_number(#trains, false) }
|
||||
module.manual(player, surface, force)
|
||||
end)
|
||||
|
||||
return module
|
||||
|
||||
Reference in New Issue
Block a user