diff --git a/features/admin_commands.lua b/features/admin_commands.lua index cb6f092c..9e239174 100644 --- a/features/admin_commands.lua +++ b/features/admin_commands.lua @@ -241,6 +241,15 @@ local function teleport_command(args, player) end end +--- Revives ghosts around the player +local function revive_ghosts(args, player) + local radius = args.radius + local pos = player.position + for _, e in pairs(player.surface.find_entities_filtered {area = {{pos.x - radius, pos.y - radius}, {pos.x + radius, pos.y + radius}}, type = 'entity-ghost'}) do + e.revive() + end +end + -- Event registrations Event.add(defines.events.on_built_entity, built_entity) @@ -376,3 +385,14 @@ Command.add( }, teleport_command ) + +Command.add( + 'revive-ghosts', + { + description = 'Revives the ghosts within the provided radius around you', + arguments = {'radius'}, + default_values = {radius = 10}, + admin_only = true + }, + revive_ghosts +)