Initial commit v1.0.1
This commit is contained in:
commit
ea394a5a30
36
control.lua
Normal file
36
control.lua
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
script.on_event(defines.events.on_entity_damaged, function(event)
|
||||||
|
local entity = event.entity
|
||||||
|
|
||||||
|
-- Check if the damaged entity is a stone wall or a construction robot
|
||||||
|
if entity and entity.valid and (entity.name == "stone-wall" or entity.name == "construction-robot") then
|
||||||
|
-- Check if the damage would destroy the entity
|
||||||
|
if event.final_health <= 0 then
|
||||||
|
local surface = entity.surface
|
||||||
|
local position = entity.position
|
||||||
|
local force = entity.force
|
||||||
|
local direction = entity.direction
|
||||||
|
local name = entity.name
|
||||||
|
|
||||||
|
-- Remove the original entity
|
||||||
|
entity.destroy()
|
||||||
|
|
||||||
|
-- Check if the force has researched ghost placement
|
||||||
|
if force.technologies["construction-robotics"] and force.technologies["construction-robotics"].researched then
|
||||||
|
|
||||||
|
-- Don't create a ghost for construction robots (not possible)
|
||||||
|
if name == "construction-robot" then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Create a ghost of the entity
|
||||||
|
surface.create_entity {
|
||||||
|
name = "entity-ghost",
|
||||||
|
inner_name = name,
|
||||||
|
position = position,
|
||||||
|
force = force,
|
||||||
|
direction = direction
|
||||||
|
}
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end)
|
8
info.json
Normal file
8
info.json
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
{
|
||||||
|
"name": "no-stone-wall-alarm",
|
||||||
|
"version": "1.0.1",
|
||||||
|
"title": "No Stone Wall and Construction Robot Alarm",
|
||||||
|
"author": "ddidderr",
|
||||||
|
"description": "Disables the alarm sound and notifications for destroyed stone walls and construction robots.",
|
||||||
|
"factorio_version": "2.0"
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user