1
0
mirror of https://github.com/Refactorio/RedMew.git synced 2025-03-03 14:53:01 +02:00

Add revive ghosts

This commit is contained in:
Matthew Heguy 2019-01-23 18:34:29 -05:00
parent 765a91cc56
commit 1d8e315900

View File

@ -241,6 +241,19 @@ 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}}}) do
if e.type == 'entity-ghost' then
e.revive()
else
e.health = 10000
end
end
end
-- Event registrations
Event.add(defines.events.on_built_entity, built_entity)
@ -376,3 +389,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
)