on_entity_damaged - health of entity before damage was dealt

Place to ask discuss and request the modding support of Factorio. Don't request mods here.
Post Reply
User avatar
MewMew
Long Handed Inserter
Long Handed Inserter
Posts: 55
Joined: Thu May 19, 2016 11:02 am
Contact:

on_entity_damaged - health of entity before damage was dealt

Post by MewMew »

It does not seem to be possible to get the health of an entity, before it was damaged.
Adding final_damage_amount to the entity.health is only accurate if it's health is > 0.

If the entity.health is 0 then there is no way to get the health it had before the damage happened.
The only way around seem to be big global tables, saving health values,
which will ignore stats like health regeneration or repaired entities.

The use for this would be to be able to give entities damage resistance,
in a less performance costly way, which values can be modified during the ongoing game.

Post Reply

Return to “Modding interface requests”