Page 1 of 1

Edits to events around entity death / damage

Posted: Fri Feb 26, 2021 11:56 am
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>

Re: Edits to events around entity death / damage

Posted: Fri Feb 26, 2021 6:22 pm
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.

Re: Edits to events around entity death / damage

Posted: Sun Feb 28, 2021 10:13 pm
by Techfish3000
That's fine, it just makes my mod idea a bit harder to do. Thanks for clarifying though.