1
0
mirror of https://github.com/Refactorio/RedMew.git synced 2024-12-14 10:13:13 +02:00

Merge pull request #146 from Valansch/dev_antigrief_fix

fixed that antigrief would kick players nading ghosts
This commit is contained in:
Valansch 2018-01-09 20:48:32 +01:00 committed by GitHub
commit 0d4acf5951
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -90,7 +90,11 @@ local function on_capsule_used(event)
local player = game.players[event.player_index]
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 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 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))