Routed Passenger Transport Agent
This tutorial assumes you are familiar with setting up a point-to-point delivery agent.
Agents can modify variables after completing a behaviour or service. This tutorial shows how to use this behaviour to create a circular transportation route to distribute inhabitants between multiple stopping points.
Open the faction agent panel and click the add icon and choose a name for the new agent. A blank agent will now appear in the agent panel ready for configuration
Variables
For this agent, we need a single variable containing a definition of the route. Open the agent and create a new variable ROUTE of type FleetList.
Create a route by selecting the variable and clicking the cog icon.
Fleets are added to the route by clicking the add icon.
When complete press [Ok]
to confirm the setting.
Behaviour
This agent will always be active so only has a single behaviour. From the behaviours tab create a new Transport behaviour and set its task to TransferPassengers( GetFleet( var( ROUTE ), 0.0 ) )
. This task instructs the agent to travel to and disembark passengers at the first fleet of the ROUTE variable.
This task will always be active, so set the precondition to simply True()
. When the task is complete the postconditions will be processed. Each postcondition rebinds an agent variable to a new value.
In this case the fleet list is rotated by a value of -1
. which moves the head of the list to the tail and shifts all other elements towards the front of the list. Now the Transport behaviour will set the agent to travel towards the new head of the fleet list and cycle through all the members indefinitely.
Not all targets in a fleet list have to be in the same system; inter-system routes can be set up as long as care is taken to ensure that the agent is bound to a fleet with jump capability.
An alternative method for setting up a similar behaviour would be to keep the fleet list constant but add a variable for the next target index to use, then have a postcondition on the task that instead increments this variable to the next value, or resets it to zero when the last fleet has been visited.