SampSharp icon indicating copy to clipboard operation
SampSharp copied to clipboard

Add component tuple arguments for events in ECS

Open ikkentim opened this issue 5 years ago • 0 comments

Currently, entity parameters in ECS can be transformed into a component of the entity by the event system, for example:

[Event]
public void OnPlayerSpawn(Player player)
{
    // ...
}

the event is currently not invoked if the component (Player) could not be found for the argument. It would be nice to select multiple components of the same entity, most likely using a tuple:

[Event]
public void OnPlayerSpawn((Player player, CitySelectionComponent citySelection), IWorldService worldService, /* ... */)
{
    // ...
}

Like with a single component, all the components in the tuple would need to exist in the entity in order for the event to be invoked.

ikkentim avatar Jan 28 '20 21:01 ikkentim