Skip to content
Work in progress. These docs describe Spawnite at launch, and some parts are still being built.

OrderOptions

What defineOrder takes.

Type Parameter Default type
Stage extends string string
Refusal extends string never
Property Type Default value Description
maxPerStation? number 1 How many orders of this kind may name one station at once, a whole number above 0 or Infinity, as a RimWorld reservation holds one pawn by default. Two kinds count apart.
reach? number 1.2 Metres on the ground from a stand that count as there, at least the reach a worker’s takeOrders walks to.
refusals? Readonly<Record<string, Refusal>> undefined The kind’s own reasons to refuse, a string enum, which plan may return.
stages Readonly<Record<string, Stage>> undefined The stages, a string enum, such as { Fell: "fell", Haul: "haul" }.

optional chooseWorker(context): Entity | null

Which worker takes it, a game’s rule such as a skill or a priority: an idle worker, or null for none, which refuses OrderRefusal.NoFreeWorker.

Parameter Type
context OrderChooseContext

Entity | null

the idle worker nearest from, by findIdleWorker


plan(context): OrderStageOptions<NoInfer<Stage>> | NoInfer<Refusal> | null

Whether the station named has work, and the first stage: null refuses OrderRefusal.NothingToDo, a refusal of the kind’s own refuses with it. A pure read, on the authoritative step.

Parameter Type
context OrderPlanContext

OrderStageOptions<NoInfer<Stage>> | NoInfer<Refusal> | null


work(context): void

Moves the order on, each step its worker holds it and its routine runs, travel included: setOrderStage for the next stage and endOrder once done.

Parameter Type
context OrderWorkContext<NoInfer<Stage>>

void