1
0
mirror of https://github.com/ComfyFactory/ComfyFactorio.git synced 2025-01-10 00:43:27 +02:00
ComfyFactorio/modules/biters_avoid_damage.lua

13 lines
486 B
Lua
Raw Normal View History

2019-02-16 18:36:12 +02:00
-- enemy biters have pseudo double hp -- by mewmew
local event = require 'utils.event'
local function on_entity_damaged(event)
if not event.entity.valid then return end
if math.random(1,2) == 1 then return end
2019-04-12 02:55:59 +02:00
if event.entity.type ~= "unit" then return end
2019-04-14 21:14:08 +02:00
if event.final_damage_amount > event.entity.prototype.max_health then return end
2019-02-16 18:36:12 +02:00
event.entity.health = event.entity.health + event.final_damage_amount
end
event.add(defines.events.on_entity_damaged, on_entity_damaged)