mirror of
https://github.com/ComfyFactory/ComfyFactorio.git
synced 2025-01-06 00:23:49 +02:00
24 lines
613 B
Lua
24 lines
613 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) |