mirror of
https://github.com/PHIDIAS0303/ExpCluster.git
synced 2025-12-29 20:16:38 +09:00
Feature Update (#237)
See PR for details, there are too many to be included here.
This commit is contained in:
22
modules/commands/train.lua
Normal file
22
modules/commands/train.lua
Normal file
@@ -0,0 +1,22 @@
|
||||
--[[-- Commands Module - Set Automatic Train
|
||||
- Adds a command that set all train back to automatic
|
||||
@commands Set Automatic Train
|
||||
]]
|
||||
|
||||
local Commands = require 'expcore.commands' --- @dep expcore.commands
|
||||
require 'config.expcore.command_general_parse'
|
||||
local format_number = require('util').format_number
|
||||
|
||||
Commands.new_command('set-trains-to-automatic', 'Set All Trains to Automatic')
|
||||
:register(function(player)
|
||||
local count = 0
|
||||
|
||||
for _, v in pairs(player.force.get_trains()) do
|
||||
if v.manual_mode then
|
||||
count = count + 1
|
||||
v.manual_mode = false
|
||||
end
|
||||
end
|
||||
|
||||
return Commands.success{'expcom-train.manual-result', format_number(count)}
|
||||
end)
|
||||
Reference in New Issue
Block a user