Add on_pre_entity_damaged event

Things that we aren't going to implement
Post Reply
User avatar
Muppet9010
Filter Inserter
Filter Inserter
Posts: 278
Joined: Sat Dec 09, 2017 6:01 pm
Contact:

Add on_pre_entity_damaged event

Post 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.

Rseding91
Factorio Staff
Factorio Staff
Posts: 13209
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: Add on_pre_entity_damaged event

Post 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.
If you want to get ahold of me I'm almost always on Discord.

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

Re: Add on_pre_entity_damaged event

Post 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.

User avatar
ownlyme
Filter Inserter
Filter Inserter
Posts: 400
Joined: Thu Dec 21, 2017 8:02 am
Contact:

Re: Add on_pre_entity_damaged event

Post by ownlyme »

+1
Not the first time my ideas fail to the fact that my shields decrease the event's parameters to 0
mods.factorio.com/user/ownlyme
My requests: uiAbove||Grenade arc||Blueprint allies||Creeps forget command/ don't get removed||Player Modifiers||textbox::selection||Better Heat IF||Singleplayer RCON||tank bug w/ min_range >= projectile_creation_distance

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

Re: Add on_pre_entity_damaged event

Post 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

Post Reply

Return to “Won't implement”