Lua-API description bug?

Place to get help with not working mods / modding interface.
Post Reply
Pi-C
Smart Inserter
Smart Inserter
Posts: 1654
Joined: Sun Oct 14, 2018 8:13 am
Contact:

Lua-API description bug?

Post by Pi-C »

In the description of the on_entity_damaged event, there is this:
final_health :: float: The health of the entity after the damage was applied.
I've been logging some data on entering the event script:

Code: Select all

36505.401 Script @__WaterTurret__/control.lua:754: event.entity.health: 12.310014724731445
36505.401 Script @__WaterTurret__/control.lua:754: event.entity.prototype.max_health: 15
36505.402 Script @__WaterTurret__/control.lua:754: event.final_health: 0.82066762447357178
The damaged entity doesn't look like it had less than 1 health left, but the value of event.final_health looks conspicuously like the quotient of event.entity.health / event.entity.prototype.max_health. So I think the description "health after the damage was applied" is misleading. It should be noted that this isn't the absolute value, but a ratio.
A good mod deserves a good changelog. Here's a tutorial (WIP) about Factorio's way too strict changelog syntax!

User avatar
Muppet9010
Filter Inserter
Filter Inserter
Posts: 278
Joined: Sat Dec 09, 2017 6:01 pm
Contact:

Re: Lua-API description bug?

Post by Muppet9010 »

Just hit this myself and so bugged for either a code fix or documentation update depending on what the devs meant it to be :)
viewtopic.php?f=7&t=86411

Post Reply

Return to “Modding help”