A function decorator that adds a button to the control panel, in the shocks section, that runs the function when the button is pressed. This decorator can be used bare (i.e. without parentheses), in which case the button is labelled with the name of the function, or it can take optional arguments as necessary.
The decorated function should take one argument, the model object.
Parameters
name — str, optional
The text to be displayed on the button.
Default value: None
desc — str, optional
A long description to display as a tooltip.
Default value: None
charwick
Aug 06, 2020 at 4:05This example creates a button that zeroes out agents’ gold holdings when pressed.
If the decorator were used bare (i.e. just
@heli.button
), the button would be labeled with the name of the function, ‘reset’.