Page 1 of 1

How to get the type of magazine which damaged the entity

Posted: Sun Aug 13, 2023 4:12 pm
by Gamker
I'm creating a mod which adds special types of magazines to the game, on of which explodes in a small area upon impact. I want to make it explode when an entity is damaged using the "on_entity_damaged" event, but I can't figure out how to get the type of magazine that damaged the entity.

Re: How to get the type of magazine which damaged the entity

Posted: Sun Aug 13, 2023 5:00 pm
by BicycleEater
There are a few ways of doing what you're wanting to do, but I wouldn't use the 'on_entity_damaged' event.
I'd either fit the explosion into the trigger effect, like the base-game does with tank shells and such, or I'd add a script trigger effect to the action effect, then add a listener to that.
(see https://wiki.factorio.com/Types/AmmoType, https://wiki.factorio.com/Types/TriggerEffect)