Skip to main content

Wagboss Robot

Based on game build 714014 | Last updated: 2026-03-07

Overview

The wagboss_robot.lua file defines the behavior and lifecycle of the Wagboss Robot, a large boss entity in DST's Wagpunk Arena. It orchestrates combat phases, drone control (wagdrone_flying and wagdrone_rolling), pathfinding modifications, and dynamic environmental effects (e.g., crown flames, stomp projections, lunar alignment). It integrates tightly with components like combat, commander, grouptargeter, healthtrigger, dpstracker, locomotor, and focalpoint, and handles transitions between off, friendly, and hostile modes.

Usage example

local inst = Prefab("wagboss_robot")
-- After instantiation, transition to hostile mode to enable combat
inst:PushEvent("activate")
inst.ConfigureHostile()
-- Later, to re-enable drone deployment and pathfinding:
inst.HackDrones(inst)

Dependencies & tags

Components used:
colouraddersync, updatelooper, combat, commander, grouptargeter, health, healthtrigger, dpstracker, planardamage, locomotor, lootdropper, teleportedoverride, timer, inspectable, epicscare, trader, planarentity, explosiveresist, focalpoint

Tags added:
mech, electricdamageimmune, soulless, wagboss, epic, noepicmusic, blocker, lunar_aligned, brightmareboss, largecreature, scarytoprey, hostile (conditional), notarget (conditional)

Properties

PropertyTypeDefault ValueDescription
activebooleanfalseIndicates whether the robot is active (friendly or hostile).
hostilebooleanfalseIndicates whether the robot is in hostile mode.
socketedbooleanfalseWhether the robot has been assembled with a cage.
shatteredbooleanfalseWhether the robot's containment glass has been broken.
engagedbooleanfalseWhether the robot is currently engaged in combat.
threatlevelnumber1Current threat level affecting attack speed (1–N).
flyer_t, flyer_theta, flyer_atk_delaynumber, number, number0, random, 4 + math.random()*2Internal state for flying drone positioning and attack timing.
roller_t, roller_theta, roller_xform_delay, roller_stationarynumber, number, number, boolean0, random, 19 + math.random()*5, falseInternal state for rolling drone positioning and transformation timing.
_temptbl1, _temptbl2table{}Temporary tables used for target and drone collection to avoid GC pressure.
_nocollidetable{}Tracks reasons for temporary no-collide state.
_pfposVector3 or nilnilCached position for pathfinding walls.

Main functions

ConfigureOff(inst)

  • Description: Disables all combat, movement, and AI systems; resets visual state (e.g., wires, glass).
  • Parameters: inst (Entity) — the robot instance.
  • Returns: Nothing.

ConfigureFriendly(inst)

  • Description: Activates the robot in friendly (caged) mode: enables locomotion, disables combat, plays idle animation, and overrides glass/crown visuals.
  • Parameters: inst (Entity).
  • Returns: Nothing.

ConfigureHostile(inst)

  • Description: Activates the robot in hostile mode: enables locomotion, combat, brain, and shatters containment.
  • Parameters: inst (Entity).
  • Returns: Nothing.

HackDrones(inst)

  • Description: Scans nearby for wagdrone_flying and wagdrone_rolling entities (within 40 units), adds them as soldiers via commander, sets their health if they have finiteuses, and triggers their activation.
  • Parameters: inst (Entity).
  • Returns: Nothing.

ReleaseDrones(inst, include_non_soldiers)

  • Description: Removes all soldiers (and optionally non-soldiers) and converts them to loot using WagdroneCommon.ChangeToLoot.
  • Parameters:
  • inst (Entity)
  • include_non_soldiers (boolean) — whether to also convert drones not yet added as soldiers.
  • Returns: Nothing.

SkipBarragePhase(inst)

  • Description: If the robot is in a barrage phase (canmissilebarrage), skips to the next non-barrage phase by directly invoking its fn.
  • Parameters: inst (Entity).
  • Returns: Nothing.

SetMusicLevel(inst, level)

  • Description: Sets the music level (0–3) via music netbool; starts/stops music periodic task on client.
  • Parameters:
  • inst (Entity)
  • level (number) — desired music level.
  • Returns: Nothing.

EnableCameraFocus(inst, enable)

  • Description: Starts or stops camera focus on the boss using focalpoint (client only).
  • Parameters:
  • inst (Entity)
  • enable (boolean).
  • Returns: Nothing.

MakeObstacle(inst, isobstacle)

  • Description: Toggles pathfinding obstacle status (adds/removes walls around the robot) and adjusts collision physics.
  • Parameters:
  • inst (Entity)
  • isobstacle (boolean).
  • Returns: Nothing.

StartStompFx(inst)

  • Description: Enables client-side stomp projection visual (showstompfx); creates and animates stomp FX.
  • Parameters: inst (Entity).
  • Returns: Nothing.

StopStompFx(inst, interrupted)

  • Description: Stops stomp FX and disables showstompfx. If interrupted, sets netbool to false; otherwise sets locally.
  • Parameters:
  • inst (Entity)
  • interrupted (boolean).
  • Returns: Nothing.

StartBackFx(inst)

  • Description: Enables lunar spawn back FX (showbackfx) on client.
  • Parameters: inst (Entity).
  • Returns: Nothing.

StopBackFx(inst)

  • Description: Stops and removes lunar spawn back FX.
  • Parameters: inst (Entity).
  • Returns: Nothing.

SocketCage(inst)

  • Description: Assembles the robot with its cage, overriding glass symbol and showing crown if needed.
  • Parameters: inst (Entity).
  • Returns: Nothing.

BreakGlass(inst)

  • Description: Marks the robot's glass as shattered, reveals wires, and ensures crown is enabled.
  • Parameters: inst (Entity).
  • Returns: Nothing.

Events & listeners

  • Listens to:

    • attacked — calls OnAttacked to potentially switch targets.
    • newcombattarget — calls OnNewTarget to mark robot as engaged.
    • droppedtarget — calls OnDroppedTarget to de-engage after delay.
    • soldierschanged — calls OnSoldiersChanged to start/stop drone updates.
    • doreset — calls DoReset to handle off-screen reset logic.
    • activate — calls CancelReset.
    • isobstacledirty, showstompfxdirty, showbackfxdirty, showcrowndirty, musicdirty, camerafocusdirty — client-side effects and visual sync.
  • Pushes:

    • reveal (via PushEventImmediate) — fired when cage is first placed.
    • transform_to_stationary / transform_to_mobile (via PushEvent) — sent to rolling drones.
    • doattack (via PushEvent) — sent to flying drones to initiate attack.
    • deactivate, gotcommander, lostcommander, soldierschanged, triggeredevent (music).