Resolved #12461 - added 'unit remove all' console command

This commit is contained in:
yairm210 2024-11-13 16:02:35 +02:00
parent 8ab193b125
commit e8e87edb29

View File

@ -19,9 +19,15 @@ internal class ConsoleUnitCommands : ConsoleCommandNode {
DevConsoleResponse.OK
},
"remove" to ConsoleAction("unit remove") { console, _ ->
val unit = console.getSelectedUnit()
unit.destroy()
"remove" to ConsoleAction("unit remove [all]") { console, params ->
if (params.isNotEmpty() && params[0].equals("all")) {
for (civ in console.gameInfo.civilizations)
for (unit in civ.units.getCivUnits())
unit.destroy()
} else {
val unit = console.getSelectedUnit()
unit.destroy()
}
DevConsoleResponse.OK
},