Skip to main content

Module character

Module character 

Source
Expand description

CharacterComponent and the Action task stack it runs. See docs/CITIZEN-AI.md.

  • Slot (bit 0x04 phase, every iteration): run the action stack, then turn toward the target heading, move by the animation’s root motion times the speed, and drop onto the ground.
  • Slot (bit 0x08 bucket phase): notify the running chain (action slot) on the started actions of the running chain. MoveTo’s sets whether it walks behind another character, at the description’s follow speed (ActionStack::notify_moves); HuntAnimal’s looks for prey.

Actions (registered Action types, vtable slots start, stop, abort) return Status. The stack is an array of chains; the top chain is started once, then updated each run. Done pops it and continues with the next chain in the same run, Failed clears everything, and when the stack empties the “on empty” chain runs once.

Original: FUN_14010f1f0, FUN_14010e990, FUN_1400ca120, FUN_14010e950, FUN_1400ca450, FUN_1400cde40, FUN_1400cd2b0, FUN_1400ca080.

Structs§

ActionStack
The CharacterComponent’s task stack (top index) and its “on empty” chain.
Character
The character state the actions drive.
Message
A message an action delivered (slot of the receiving component). The owner dispatches these after the character update.
MoveTo
MoveTo.
World
What a character needs from the world to move: the map, the ground and the path finder.

Enums§

Action
One task.
Component
Which component a SendMessage targets (CitizenAI, Citizen).
Status
The result of an action’s step.

Constants§

ARRIVE
Arrival distance.

Functions§

as_seconds
Manager ticks as seconds.
duration
Seconds as manager ticks, for action durations.
heading
Math::Vector3::Heading: atan2(-x, y) in degrees (0 faces +y).
work_facing
Normalize the full 3D vector before taking its heading.

Type Aliases§

StorageSearch
Map state the character and its actions read. Town::FindMaterialStorage for a redirected drop-off: the storages, the game’s Random, the material, the count and the citizen’s cell give a storage and the point to walk to.