Log inGet started
World

Excavator Sim — dig, load, haul

Branchmain
Branchesmain
Commit5227986045

README.md

Hud

Puts the operator's display on the glass and keeps it honest.

The screen itself is ExcavatorHud.module — a pure function of one reading of the game. This component is the two halves around it: it finds the machine, takes a reading, and re-registers the screen only when that reading has actually changed.

A HUD rebuilt every frame would cost a widget tree a frame for nothing; a HUD updated only when something moves costs one rebuild per meaningful event. Every number the display shows is flattened to a string and compared, so a bucket that is filling redraws and a machine sitting still does not.

Where it goes

Attach it to a plain scene entity that exists in both modes. It finds the machine by name, so it works whether the machine came from the PlayerPrototype or was placed by hand.

It reads these fields off ExcavatorController: bucketFill, truckLoad, loadsDelivered, heapRemaining, status, truckCapacity.

Fields

FieldMeaning
screenNameThe name the screen registers under.
machineNameThe machine entity to read, by name.
showInEditorDraw the display while authoring, not only in play.

Related

  • ExcavatorHud.module — the widget tree.
  • topics/ui, gui — the toolbox that drives and reads a screen.