commit ea394a5a30795be374cea939915f25a27b14143e Author: ddidderr Date: Tue Jan 14 07:48:32 2025 +0100 Initial commit v1.0.1 diff --git a/control.lua b/control.lua new file mode 100644 index 0000000..ed001d9 --- /dev/null +++ b/control.lua @@ -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) diff --git a/info.json b/info.json new file mode 100644 index 0000000..10a1221 --- /dev/null +++ b/info.json @@ -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" + }