Initial commit v1.0.1

This commit is contained in:
ddidderr 2025-01-14 07:48:32 +01:00
commit b64f4f72a2
Signed by: ddidderr
GPG Key ID: 3841F1C27E6F0E14
2 changed files with 44 additions and 0 deletions

36
control.lua Normal file
View 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
View 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"
}