mirror of
https://github.com/ComfyFactory/ComfyFactorio.git
synced 2025-01-08 00:39:30 +02:00
29 lines
664 B
Lua
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)
|