Edits to events around entity death / damage

Things that we aren't going to implement
Post Reply
Techfish3000
Burner Inserter
Burner Inserter
Posts: 14
Joined: Fri Mar 29, 2019 9:11 am
Contact:

Edits to events around entity death / damage

Post by Techfish3000 »

TL;DR
Edits to :

Code: Select all

on_entity_damaged, on_entity_died, on_player_died, on_pre_player_died.
that specify what weapon was used (if applicable) and what ammo was used (if applicable)

What ?
For these events, it would be good to be able to access the weapon and ammo that was used to damage / kill the entity / player, like how

Code: Select all

on_entity_damaged.cause
will return the entity that attacked.

Image

This is the current event structure for this specific event, what I am suggesting is:

Image


Example return of a spidertron nukes a car:

Code: Select all


event = {
	entity = car,
	damage_type = "explosion",

	all of the yada yada damage values

	cause = spidertron,
	force = enemy,
	weapon = Spidertron-rocket-launcher-1,
	ammo = atomic-bomb

}


Why ?
This would allow mod creators like myself to tailor specific effects to happen depending on what an entity is attacked with.

This would also mean PvP mod creators could create death messages like:
<Player> killed <Player> with <Weapon> loaded with <Ammo>
Hey, I exist. Sometimes.

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

Re: Edits to events around entity death / damage

Post by Rseding91 »

Sorry, but that information simply isn't available in the game to include in the events and isn't something we are likely to add soon if ever.

Since a lot of damage is done after a shot has happened - and possibly after the thing that shot has died (worm spit, rockets, fire, grenades) the information about who or what did the damage gets long lost. If we wanted to keep all of it available it would mean that every projectile, every thing that does damage would have to track, save, and pass along that information - increasing memory usage and save file size.

So with that said: I don't see this ever happening. Sorry.
If you want to get ahold of me I'm almost always on Discord.

Techfish3000
Burner Inserter
Burner Inserter
Posts: 14
Joined: Fri Mar 29, 2019 9:11 am
Contact:

Re: Edits to events around entity death / damage

Post by Techfish3000 »

That's fine, it just makes my mod idea a bit harder to do. Thanks for clarifying though.
Hey, I exist. Sometimes.

Post Reply

Return to “Won't implement”