Is there an event I can listen to for when a command is used?

For example, I’d like to know when a consumable or trading stall is used. Is there a list of events somewhere? And can I create my own?

1 Like

So far I only created listenable events through lua, using radiant.events.trigger(entity, ‘event_name’, {args = args})
And I listen with similar function radiant.events.listen(self._entity, ‘stonehearth:on_added_to_world’, self, self.activate_the_spawner)

1 Like

Cool, makes sense. Unfortunately I’m having trouble tracking down the actual code where a command’s function is called, so I can’t tell if there’s already an event being raised whenever that happens, or know where an easy place to mixin/override to add such an event would be. Otherwise I have to mixin/override every command function I’m interested in listening for.

There’s no list. You can grep for radiant.events.trigger, I suppose, but usually looking at related code is the most effective solution.