How to get the type of magazine which damaged the entity

Place to get help with not working mods / modding interface.
Post Reply
Gamker
Burner Inserter
Burner Inserter
Posts: 9
Joined: Tue Jan 12, 2021 5:38 pm
Contact:

How to get the type of magazine which damaged the entity

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

BicycleEater
Fast Inserter
Fast Inserter
Posts: 153
Joined: Sun Jul 26, 2020 4:05 pm
Contact:

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

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

Post Reply

Return to “Modding help”