From 6e2695ff949ab2cf88a658ce6d2c10fcbd0713a5 Mon Sep 17 00:00:00 2001 From: Cooldude2606 Date: Sat, 24 Jun 2017 22:26:40 +0100 Subject: [PATCH] /revive-entiies changed to /repair and it now heals entitys --- control.lua | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/control.lua b/control.lua index fbf6f137..8b667872 100644 --- a/control.lua +++ b/control.lua @@ -563,24 +563,28 @@ function commandInit() print('Command Complete') end end) - --revive-entities - commands.add_command('revive-entities',' Reives all entitys in this range. Admins can use all as range #4#',function(event) + --repair + commands.add_command('repair',' Reives all entitys in this range. Admins can use all as range #4#',function(event) if event.player_index then local byPlayer = game.players[event.player_index] - if event.parameter then else byPlayer.print('Invaild Input, /revive-entities ') return end + if event.parameter then else byPlayer.print('Invaild Input, /repair ') return end local pos = byPlayer.position if getRank(byPlayer).power > 4 then byPlayer.print('401 - Unauthorized: Access is denied due to invalid credentials') return end local args = {} for word in event.parameter:gmatch('%S+') do table.insert(args,word) end - if #args == 1 then else byPlayer.print('Invaild Input, /revive-entities ') return end + if #args == 1 then else byPlayer.print('Invaild Input, /repair ') return end local range = tonumber(args[1]) if range or args[1] == 'all' then else byPlayer.print('Invaild Range, must be number below 50') return end if args[1] == 'all' then if getRank(byPlayer).power > 2 then byPlayer.print('401 - Unauthorized: Access is denied due to invalid credentials') return end - for key, entity in pairs(game.surfaces[1].find_entities_filtered({type = "entity-ghost"})) do entity.revive() end return + for key, entity in pairs(game.surfaces[1].find_entities_filtered({type = "entity-ghost"})) do entity.revive() end + for key, entity in pairs(game.surfaces[1].find_entities()) do if entity.health then entity.health = 10000 end return elseif range < 50 and range > 0 then else byPlayer.print('Invaild Range, must be number below 50') return end for key, entity in pairs(game.surfaces[1].find_entities_filtered({area={{pos.x-range,pos.y-range},{pos.x+range,pos.y+range}},type = "entity-ghost"})) do entity.revive() + for key, entity in pairs(game.surfaces[1].find_entities({{pos.x-range,pos.y-range},{pos.x+range,pos.y+range}})) do if entity.health then entity.health = 10000 end return end else - for key, entity in pairs(game.surfaces[1].find_entities_filtered({type = "entity-ghost"})) do entity.revive() end print('Command Complete') + for key, entity in pairs(game.surfaces[1].find_entities_filtered({type = "entity-ghost"})) do entity.revive() end + for key, entity in pairs(game.surfaces[1].find_entities()) do if entity.health then entity.health = 10000 end + print('Command Complete') end end) -- tp