Wobysmall
Based on game build 714014 | Last updated: 2026-03-07
Overview
wobysmall is a prefab script defining the small-form companion entity (Woby). It implements hunger-based progression logic: when hunger reaches ≥95%, it triggers transformation to wobybig. The entity acts as a follower, sleeper, and foraging proxy for the player, delegating object-picking via queueing. It supports dynamic alignment (lunar/shadow) and rack interactions via skilltree updates, and manages item containers and drying racks. The logic is implemented through the fn() constructor, which attaches components, sets event callbacks, and defines helper functions for synchronization with player skills.
Usage example
local inst = SpawnPrefab("wobysmall")
local player = GetPlayer()
inst:LinkToPlayer(player)
-- Hunger will auto-trigger transformation at ≥95%
-- Foraging delegation is enabled via skill "walter_woby_foraging"
Dependencies & tags
Components used: spawnfader, follower, knownlocations, sleeper, eater, hunger, locomotor, embarker, drownable, colourtweener, crittertraits, timer, container, wobyrack, inspectable, skilltreeupdater, storyteller.
Tags added: critter, fedbyall, companion, notraptrigger, noauradamage, small_livestock, noabandon, NOBLOCK, _hunger (temporary).
Properties
| Property | Type | Default Value | Description |
|---|---|---|---|
_playerlink | entity or nil | nil | The player entity Woby is linked to. |
alignment | string or nil | nil | Current alignment: "lunar", "shadow", or nil (normal). |
_forager_targets | table of entities | {} | Queue of targets queued for foraging by the player. |
_hasbigbuild | boolean | false | Flag indicating whether big build overrides are applied (set on transform). |
pet_hunger_classified | entity or nil | nil | Classified prefab for pet hunger display. |
woby_commands_classified | entity or nil | nil | Classified prefab for command/wheel controls. |
Main functions
LinkToPlayer(player, containerrestrictedoverride)
- Description: Links Woby to a player entity, sets the player as leader, initializes and attaches
pet_hunger_classifiedandwoby_commands_classified, sets container restrictions based on skill state, and registers skill refresh events. - Parameters:
player(entity) - the player to link to;containerrestrictedoverride(boolean ornil) - optional override for container restriction. - Returns: Nothing.
- Error states: Does not throw; silently skips classified creation if already attached (asserts
parent == playerin debug builds).
TriggerTransformation()
- Description: Initiates the small-to-big transformation sequence by closing the container, adding
NOCLICK, and pushing thetransformevent. Only triggers if currently not in thetransformstate. - Parameters: None.
- Returns: Nothing.
OnHungerDelta(inst, data)
- Description: Listens to
hungerdeltaevents and callsTriggerTransformation()ifdata.newpercent >= 0.95. - Parameters:
inst(entity),data(table withnewpercentnumber) - the new hunger percentage. - Returns: Nothing.
SetAlignmentBuild(inst, alignment, showfx)
- Description: Updates Woby's alignment (normal/lunar/shadow) by setting flags on
pet_hunger_classified, reskinning the entity, and optionally showing alignment-change FX. - Parameters:
alignment(string ornil),showfx(boolean) - whether to show FX and push state graph event. - Returns: Nothing.
EnableRack(inst, enable, showanim)
- Description: Adds or removes the
wobyrackcomponent on demand (e.g., via skillwalter_camp_wobyholder). When enabling, sets upwobyrackwith show/hide callbacks and rack animations. - Parameters:
enable(boolean),showanim(boolean) - whether to signal state graph event. - Returns: Nothing.
FinishTransformation()
- Description: Converts
wobysmalltowobybig. Preserves all inventory items, drying rack contents, and drying state; transfers classifiers; updates hunger/hunger modifiers; notifies the player. Called during transformation logic. - Parameters: None.
- Returns: Nothing.
QueueForagerTarget(target)
- Description: Adds a
pickableentity to Woby’s foraging queue. Enforces a timeout and queue limit (MAX_FORAGING_TARGETS = 5). Called when the player queues a valid pick action and Woby is permitted to forage. - Parameters:
target(entity) - thepickableentity to queue. - Returns: Nothing.
GetForagerTarget(inst)
- Description: Returns the first valid target in the foraging queue (within max distance), dropping stale or too-far targets.
- Parameters:
inst(entity). - Returns: entity or
nil.
UpdateOwnerNewStateListener(player)
- Description: Enables/disables the
newstateevent listener on the player based on activation ofwalter_woby_foragingskill. If disabled, clears the foraging queue. - Parameters:
player(entity ornil). - Returns: Nothing.
RefreshAttunedSkills(inst, player, data)
- Description: Synchronizes Woby’s behavior (endurance hunger rate, alignment, rack presence, and foraging) with the linked player’s active skills. Called on skill activation/deactivation and initialization.
- Parameters:
inst(entity),player(entity ornil),data(table withskillstring ornil). - Returns: Nothing.
CustomFoodStatsMod(inst, health_delta, hunger_delta, sanity_delta, food, feeder)
- Description: Modifies stats when eating. Triplies
hunger_deltaif the food iswoby_treat. - Parameters: All standard eater modifier args.
- Returns: Updated
hunger_delta(or original if not treat).
IsAllowedToQueueForaging(inst, target)
- Description: Checks if Woby is allowed to forage for the given target, respecting sit/recall commands and distance.
- Parameters:
inst(entity),target(entity). - Returns: boolean.
Events & listeners
- Listens to:
hungerdelta- triggers transformation at high hunger;onactivateskill_server,ondeactivateskill_server- skill change sync;ms_skilltreeinitialized- post-initialization sync;newstate- player action buffer for foraging;onremove(on player, target) - cleanup and queue removal. - Pushes:
transform,ondropped,playernewstate,praisewoby,treatwoby.