Page 1 of 1

Add on_pre_entity_damaged event

Posted: Sun Nov 18, 2018 5:17 pm
by Muppet9010
this event could include the same attributes as the on_entity_damaged, minus the final damage:
- entity :: LuaEntity
- damage_type :: LuaDamagePrototype
- damage_amount :: float
- cause :: LuaEntity (optional): The entity that did the attacking if available.
- force :: LuaForce (optional): The force that did the attacking if any.

Would allow mods to get any entity details prior to the damage being done. But not interfere in the game's calculation of damage as I know other events don't offer interference in core game mechanics.

For example in a Nuke Immunity mod, it would get a player's shield level and health before they suffer 10,000 damage from a nuke. Then the mod could return their health and shield to the exact previous level.

Re: Add on_pre_entity_damaged event

Posted: Mon Nov 19, 2018 10:17 am
by Rseding91
Sorry but no.

Adding the entity_damaged event was already controversial. Adding another event which 99% of the mods would never use is not going to happen unless someone finds a *much* better reason for wanting the event.

Re: Add on_pre_entity_damaged event

Posted: Mon Nov 19, 2018 10:29 am
by Muppet9010
If anyone wanted to do their own damage logic in Lua, etc.

I wanted to also use it to get the player health and shield prior to vehicle impact. So I could undo the vehicle impact affect exactly.

Fair enough.

Re: Add on_pre_entity_damaged event

Posted: Fri May 24, 2019 8:40 pm
by ownlyme
+1
Not the first time my ideas fail to the fact that my shields decrease the event's parameters to 0

Re: Add on_pre_entity_damaged event

Posted: Fri May 24, 2019 11:56 pm
by Muppet9010
Ownlyme, I made a follow on request to try and give similar usability without the negatives Rseding listed. It hasn't had any view passed on its suitability so far. Not sure if it would cover your usage thoughts.
viewtopic.php?f=28&t=70010&p=425637#p425637