Skip to main content

Player Classified

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

Overview

player_classified is a classified component that encapsulates comprehensive player state data and handles bidirectional communication between server and client. It serves as the central synchronization point for player attributes like health, hunger, sanity, temperature, camera settings, HUD visibility, crafting state, and more. It uses net_* variables for network replication and registers event listeners for both server and client to drive client-side effects and state updates (e.g., HUD rendering, sound playback, camera changes). The component is attached automatically to the player entity via AttachClassified() and is not typically added manually by mods.

Usage example

This component is internal to the engine and not intended for direct modder usage. However, a modder may interact with it indirectly through high-level APIs (e.g., inst.components.player_classified:SetGhostMode(true) or inst.components.player_classified:BufferBuild("campfire")). Typically, you interact with components like health, sanity, playercontroller, or playervision, which coordinate changes via player_classified.

Dependencies & tags

Components used: None directly accessed via inst.components.X. However, it integrates closely with:

  • health, hunger, sanity, wereness, locomotor, playercontroller, playervision, playerspeedmult, playervoter, boatcannonuser, focalpoint
  • Network layer via net_* types (net_ushortint, net_bool, net_event, etc.) Tags: Adds "CLASSIFIED" tag to the entity instance.

Properties

PropertyTypeDefault ValueDescription
currenthealthnet_ushortint100Current health value (0–65535 range).
maxhealthnet_ushortint100Maximum health value.
currenthungernet_ushortint100Current hunger value.
maxhungernet_ushortint100Maximum hunger value.
currentsanitynet_ushortint100Current sanity value.
maxsanitynet_ushortint100Maximum sanity value.
currenttemperaturenumberTUNING.STARTING_TEMPCurrent player temperature (client-side computed).
currenttemperaturedatanet_byte0Network-encoded temperature (used for replication).
isghostmodenet_boolfalseWhether player is in ghost mode.
cameradistancenet_smallbyte0Camera zoom distance offset.
iscamerazoomednet_boolfalseWhether camera is currently zoomed.
ishudvisiblenet_booltrueWhether HUD is visible.
isactionsvisiblenet_booltrueWhether action ring is visible.
iscraftingenablednet_booltrueWhether crafting UI should be shown/enabled.
inspirationdrainingnet_boolfalseWhether inspiration is currently draining.
inspirationsongsarray of net_tinybyte3 slotsActive inspiration battle songs (by net ID).
inmightygymnet_tinybyte0Weight class on mighty gym (0 = not on gym; 1–7 = weight level).
upgrademodulesarray of net_smallbyte6 slotsUpgrade module IDs for WX78.
freesoulhopsnet_tinybyte0Free soulhops count for Wortox.
isattackedbydangernet_boolfalseWhether last attack came from a "danger" attacker.
isattackredirectednet_boolfalseWhether last attack was redirected.
wormholetraveleventnet_tinybyte0Stores wormhole travel type on client (WORM, TENTAPILLAR, etc.).
hou ndwarningeventnet_smallbyte0Stores hound/worm warning level/type.
techtreestableTECH.NONELocal copy of unlocked tech levels (client/server).
techtrees_no_temptableTECH.NONETech levels without temporary bonuses.
player_classified._parententity instancenilReference to the owning player entity (set on replication).

Note: Most net_* variables are not directly accessed by modders; interactions happen through component APIs or public methods (see "Main functions").

Main functions

SetValue(name, value)

  • Description: Server-only helper that asserts and sets a net_ushortint variable with clamped, ceiling-normalized values.
  • Parameters:
    • name (string) — field name (e.g., "health.currenthealth").
    • value (number) — integer value in range [0, 65535].
  • Returns: Nothing.
  • Error states: Asserts if value is out of bounds.

SetOldagerRate(dps)

  • Description: Sets the oldager rate (damage per second) in the range [-30, 30]. Encodes signed DPS into an unsigned network variable.
  • Parameters: dps (number) — rate of oldager damage/restore per second.
  • Returns: Nothing.
  • Error states: Asserts if dps is outside [-30, 30].

GetOldagerRate()

  • Description: Retrieves the current oldager rate from the network-encoded value.
  • Parameters: None.
  • Returns: number — decoded DPS value.

SetTemperature(temperature)

  • Description: Server-only function to set the player’s current temperature and encode it into currenttemperaturedata for network sync.
  • Parameters: temperature (number) — temperature in world units.
  • Returns: Nothing.

PushPausePredictionFrames(frames)

  • Description: Forces a dirty update for pausepredictionframes, triggering a client cancelmovementprediction event.
  • Parameters: frames (number) — number of frames to pause.
  • Returns: Nothing.

SetGhostMode(isghostmode)

  • Description: Server-side setter that sets isghostmode and immediately invokes the dirty handler to update client vision and HUD state.
  • Parameters: isghostmode (boolean) — ghost mode toggle.
  • Returns: Nothing.

ShowHUD(show)

  • Description: Server-side helper to show/hide the HUD and trigger playerhuddirty event.
  • Parameters: show (boolean).
  • Returns: Nothing.

ShowCrafting(show)

  • Description: Server-side helper to enable/disable crafting UI and show/hide crafting controls.
  • Parameters: show (boolean).
  • Returns: Nothing.

EnableMapControls(enable)

  • Description: Server-side helper to toggle minimap button visibility and HUD controls state.
  • Parameters: enable (boolean).
  • Returns: Nothing.

BufferBuild(recipename)

  • Description: Client-side function to queue a build for preview and cost deduction (only if ingredients are available). Triggers a network RPC and refreshcrafting event.
  • Parameters: recipename (string) — recipe name (must be valid and cost-deductible).
  • Returns: Nothing.

OnEntityReplicated(inst)

  • Description: Client-side callback (not exported, but invoked automatically). Attaches this classified to the parent player and links replica components.
  • Parameters: inst — the classified instance.
  • Returns: Nothing.

BufferBuild(inst, recipename)

  • Description: Internal helper for BufferBuild — actually removes ingredients if valid and sends RPC to server.
  • Parameters:
    • inst — classified instance.
    • recipename (string).
  • Returns: Nothing.

Events & listeners

Listens to (server-side, RegisterNetListeners_mastersim)

  • healthdelta, hungerdelta, sanitydelta, werenessdelta — triggers pulse updates on dirty values.
  • attacked, builditem, buildstructure, consumehealthcost — fires client pulse events.
  • learnrecipe, learnmap, repair, performaction, actionfailed — triggers client sounds and events.
  • carefulwalking, wormholetravel, houndwarning, play_theme_music, craftedextraelixir — state sync and sound triggers.
  • makefriend, feedincontainer, idplantseed — event triggers.

Listens to (client-side, RegisterNetListeners_local)

  • Dirty events like healthdirty, hungerdirty, sanitydirty, temperaturedirty, moisturedirty, techtreesdirty, recipesdirty, iscraftingenableddirty, bufferedbuildsdirty, isperformactionsuccessdirty, pausepredictionframesdirty, isstrafingdirty, iscarefulwalkingdirty, externalvelocityvectordirty, playerspeedmultdirty, isghostmodedirty, actionmeterdirty, playerhuddirty, playercamerashake, playerscreenflashdirty, attunedresurrectordirty, cannondirty, bathingpooldirty, and many more — drives state updates, event pushing, and client-side effects (HUD, camera, sounds).

Listens to (common, RegisterNetListeners_common)

  • gym_bell_start, playworkcritsound, inmightygymdirty, stormleveldirty, isinmiasmadirty, isacidsizzlingdirty, hasinspirationbuffdirty, builder.build, builder.damaged, builder.opencraftingmenu, builder.learnrecipe, inked, MapExplorer.learnmap, MapSpotRevealer.revealmapspot, repair.repair, giftsdirty, yotbskindirty, ismounthurtdirty, playercameradirty, playercameraextradistdirty, playercamerasnap, playerminimapcenter, playerminimapclose, playerfadedirty, wormholetraveldirty, leader.makefriend, eater.feedincontainer, morguedirty, houndwarningdirty, idplantseedevent, startfarmingmusicevent, ingredientmoddirty, inspectacles_gamedirty, roseglasses_cooldowndirty, wortoxpanflutebuffdirty, craftedextraelixirdirty.

Pushes

  • healthdelta, hungerdelta, sanitydelta, werenessdelta, inspirationdelta, mightinessdelta, energylevelupdate, upgrademodulesdirty, freesoulhopschanged, item_buff_changed, inspectaclesgamechanged, roseglassescooldownchanged, moisturedelta, temperaturedelta, techtreechange, refreshcrafting, unlockrecipe, performaction, startfiredamage, stopfiredamage, changefiredamage, startlunarburn, stoplunarburn, startstrafing, stopstrafing, carefulwalking, attacked, buildsuccess, damaged, inked, mounthurt, giftreceiverupdate, yotbskinupdate, aimingcannonchanged, cancelmovementprediction, and many client-side UI/sound state events.

Special Events

  • ghostvision — pushed on isghostmodedirty change; toggles ghost vision mode.
  • startfreezing, stopfreezing, startoverheating, stopoverheating, startstarving, stopstarving — state change events based on thresholds.