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

fixed that antigrief would kick players nading ghosts

This commit is contained in:
Valansch 2018-01-07 11:14:36 +01:00
parent eedfcb49fa
commit 9d491f7cac

View File

@ -90,7 +90,11 @@ local function on_capsule_used(event)
local player = game.players[event.player_index] local player = game.players[event.player_index]
if (not allowed_to_nuke(player)) then if (not allowed_to_nuke(player)) then
local area = {{event.position.x-5, event.position.y-5}, {event.position.x+5, event.position.y+5}} local area = {{event.position.x-5, event.position.y-5}, {event.position.x+5, event.position.y+5}}
local count = player.surface.count_entities_filtered{force=player.force, area=area} local count = 0
local entities = player.surface.find_entities_filtered{force=player.force, area=area}
for _,e in pairs(entities) do
if e.name ~= "entity-ghost" then count = count + 1 end
end
if count > 4 then if count > 4 then
if global.players_warned[event.player_index] then if global.players_warned[event.player_index] then
game.ban_player(player, string.format("Damaged %i entities with %s. This action was performed automatically. If you want to contest this ban please visit redmew.com/discord.", count, event.item.name)) game.ban_player(player, string.format("Damaged %i entities with %s. This action was performed automatically. If you want to contest this ban please visit redmew.com/discord.", count, event.item.name))