mirror of
https://github.com/ComfyFactory/ComfyFactorio.git
synced 2025-01-06 00:23:49 +02:00
339189c8d5
soft reset deletes entities before they can get unmarked for deconstruction
17 lines
527 B
Lua
17 lines
527 B
Lua
local blacklist = {
|
|
["cliff"] = true,
|
|
["item-entity"] = true,
|
|
}
|
|
|
|
local function on_marked_for_deconstruction(event)
|
|
local entity = event.entity
|
|
if not entity.valid then return end
|
|
if not event.player_index then return end
|
|
if entity.force.name ~= "neutral" then return end
|
|
if blacklist[entity.type] then return end
|
|
entity.cancel_deconstruction(game.players[event.player_index].force.name)
|
|
end
|
|
|
|
local Event = require 'utils.event'
|
|
Event.add(defines.events.on_marked_for_deconstruction, on_marked_for_deconstruction)
|