"Source" and "Target" entity dependencies

Upvotes: 16
Issue description

Some procedure triggers like "when entity hit with item", "when mob/player collides this entity", "when player hit with bullet" could use two entities as dependency rather than just one.

For example, in the "when entity hit with item", the "user" is the player that uses the item and the "target" is the entity hit with the item. This way it would be possible to do something like this:

(When mob/player hit with item:)

If has (user) in inventory item (mana)


   Add potion effect (poison) to (target)

   Remove item (mana) from (user)


Of course these dependencies could only be used with compatible triggers, like the others. Otherwise they will simply stay "entity" like default.

This isn't very important but would make events more dynamic.

Issue comments

This is a very nice idea, but I am not sure how to implement this in UI. Right now, entity blocks automatically add new dependency entity. If we wanted to add support for multiple entities, there would need to be some kind of selector on which entity to use or two types of block depending on the target.

I will think on how to implement this and I also accept ideas here. But we will definitely implement this in later updates.

Maybe for each event you add a define parameter to show which entity values will be changed/returned from. 

Yeah, this will help me with bosses, as if i use the trigger [When mob die], Add achievement

It won't add the achievement to player but to the mob die so it would be useful