Peon

Peons are MultiMall's representation of people.

They come to the mall looking for a pre-generated list of items. Once they've got what they came for, they will head to a Bus Stop a leave.

center
Fig (1) Peons are the simplest form of "person" GameObject.

Peon Update Cycle

Peon

Update

Yes

No

Once in the world

Next update call

Though Bubble Updates

Constructor

Generate apperance and name

Jobs in the Job queue

Process job queue

Generate Jobs

End of update

Remove from world

Jobs

Everything that a Peon does in game can be described via a PeonJob.

Property DataType Description
targetLocation vec2 Point in world space where the peon needs to be to do the task
updateTime float how long in seconds between calling the onUpdate function
jobTime float how long in seconds should the job take to complete. Once reaches 0 onComplete is called and the job terminates
postJobIdleTime float how long in seconds to wait after completing job before starting the next job
preJobIdleTime float how long in seconds to wait before starting the current job, WARNING: Peons will not move until this timer has reached 0
onComplete void delegate(PeonJob* self) function called when job is complete. Can be useful to give the peon a job related to the one they just completed.
onUpdate void delegate(PeonJob* self) function called every time updateTime reaches 0.
valid bool if false then it will be rejected from the queue, if true the job will be added to the queue
queuing bool used to signal that we are queuing to pay up, overrides the path finding system for a minute.
started bool used internally for path finding controll
type PeonJobType used internally for serialisation
peon Peon the peon who has been given the job
neededItems Inventory an items the job might require to be completed
currentPath PathfindingRoute used internally for navigating the world
tag srting used in logging information
serialTag string saved to the game data file and then used as a lookup value in de-serialisation.
needsPathUpdate bool When true will re-calculate the path to target, expensive so use wisely.

[Shop Jobs](Shop Jobs.md) are an extension as PeonJob's but with some added Lua flavour.