mirror of
https://github.com/ComfyFactory/ComfyFactorio.git
synced 2025-01-08 00:39:30 +02:00
12 lines
372 B
Lua
12 lines
372 B
Lua
|
local event = require 'utils.event'
|
||
|
|
||
|
local function on_entity_damaged(event)
|
||
|
if event.entity.name ~= "market" then return false end
|
||
|
if event.cause then
|
||
|
if event.cause.force.name == "enemy" then return false end
|
||
|
end
|
||
|
event.entity.health = event.entity.health + event.final_damage_amount
|
||
|
return true
|
||
|
end
|
||
|
|
||
|
event.add(defines.events.on_entity_damaged, on_entity_damaged)
|