Add LuaEntity::unit_health_bonus modifier

Place to ask discuss and request the modding support of Factorio. Don't request mods here.
cogito123
Inserter
Inserter
Posts: 33
Joined: Thu Feb 28, 2019 7:05 pm
Contact:

Add LuaEntity::unit_health_bonus modifier

Post by cogito123 »

TL;DR
Add unit_health_bonus modifier to unit entities, similar to LuaControler::character_health_bonus
What ?
The unit_health_bonus modifier multiplies biters health and by default is set to float 1.0 (no effect)
Why ?
In biter battles scenario, we implement "boss" mechanics. At the moment a global table is used to store "real" health value which is decreased on every on_entity_damaged event. Each time this event is handled we have to find a force of unit, find it's record and access global table, decide to update health or kill entity. As there are a lot of source of this events (hundreds of turrets and flamers) and multiple bosses, it has been identified as major bottleneck performance wise. This API could help us and others to implement features related to "boss"-like entities without performance hit in soft scenarios.

I figured that you might even have code for such API due to mentioned Quality health bonuses so from my perspective, maintenance of this API should play nicely long-term.
Post Reply

Return to “Modding interface requests”