1
0
mirror of https://github.com/ComfyFactory/ComfyFactorio.git synced 2025-01-10 00:43:27 +02:00
ComfyFactorio/modules/no_turrets.lua
2021-03-24 16:46:00 +01:00

29 lines
664 B
Lua

local turret_types = {
['ammo-turret'] = true,
['artillery-turret'] = true,
['electric-turret'] = true,
['fluid-turret'] = true
}
local function destroy_turret(entity)
if not entity.valid then
return
end
if not turret_types[entity.type] then
return
end
entity.die()
end
local function on_built_entity(event)
destroy_turret(event.created_entity)
end
local function on_robot_built_entity(event)
destroy_turret(event.created_entity)
end
local event = require 'utils.event'
event.add(defines.events.on_built_entity, on_built_entity)
event.add(defines.events.on_robot_built_entity, on_robot_built_entity)