listenable Interfaces/Functions Should Pass this as the First Argument

I agree more info passed would be extremally helpful. But for now, you can create a callback handler class that passes the additional references you need to what device triggered the event. Something like this: (untested!)

# custom callback handler that passes the device that triggered the event
CustomCallbackHandler := class():
    Manager : test_callback_device 
    Device : vehicle_spawner_device
    HandlerFunction(Agent:agent):void=
        Manager.OnEventTriggered(Agent, Device)

test_callback_device := class(creative_device):

    @editable
    Devices : []vehicle_spawner_device = array{}

    OnBegin<override>()<suspends>:void=
        for(X -> Device : Devices):
            # pass reference to callback 
Device.AgentExitsVehicleEvent.Subscribe(CustomCallbackHandler{Manager:=Self, Device:=Device}.HandlerFunction)

    OnEventTriggered(Agent:agent, Device:vehicle_spawner_device):void=
        # do something....
3 Likes