I've got a working mock up for custom location actions if we want them.
Currently in the label for the locations, before we show the location-specific screen we put:
# If we have no actions
python:
if pytfall.world_actions.location("city_beach"):
pytfall.world_actions.meet_girls()
pytfall.world_actions.look_around()
pytfall.world_actions.add("Sunbathe", "sunbathe")
pytfall.world_actions.finish()
Which creates the actions for the location. The location() function either returns False if the location is already set up, or True and creates a set list of actions for it.
These functions create controls there were considered general enough to have a ease-of-use function:
meet_girls() creates the normal Meet Girls button.
look_around() creates the normal Look Around button.
slave_market() creates the Go Shopping slave market button.
work(flag=None) creates the Work button.
add() adds a new action button, with the arguments:
- button = The name of the button.
- action = The string to use as an event trigger, or a screen action.
- label = The label to go to if no event can be run ("_events_not_found" for Look Around for instance).
- cost = The cost of triggering the event. 1 by default.
- flag = The global flag to check for screen actions.
- null_button = The label to use if the button should be null ("No Slaves Available" for instance).
- null_condition = The condition to check to see if the button should be null (can be a string, a function or a variable).
In the actual screen we put:
use location_actions(pytfall.world_actions("location name")
Which simply adds a vbox that loops through the available actions and adds a textbutton for them. Actions are only added if they have a default label or at least 1 action in the WorldEventsManager.label_cache that uses its action as a trigger if they are an event trigger, else checks its flag.
The WorldEventsManager.run_events() function has been modified to accept "default=None" and "cost=0" arguments as well, so the run_events("auto") calls don't need to be updated.