mirror of
https://github.com/ComfyFactory/ComfyFactorio.git
synced 2025-02-11 13:39:14 +02:00
Use the current health when calculating health pool changes
Ideally, you could keep the health modifier in the pool structure so you dont need to calculate the inverse every time again, but since the 3rd spot meant stuff for bosses and it was used in other places, i didn't want to mess with it.
This commit is contained in:
parent
db6842b0d2
commit
b6aec3bd07
@ -98,8 +98,11 @@ local function on_entity_damaged(event)
|
||||
end
|
||||
end
|
||||
|
||||
--Calculate current actual health, accounting for regeneration
|
||||
local current_health = biter.health * (1 / health_pool[2])
|
||||
|
||||
--Reduce health pool
|
||||
health_pool[1] = health_pool[1] - event.final_damage_amount
|
||||
health_pool[1] = current_health - event.final_damage_amount
|
||||
|
||||
--Set entity health relative to health pool
|
||||
biter.health = health_pool[1] * health_pool[2]
|
||||
|
Loading…
x
Reference in New Issue
Block a user