Pillar
Based on game build 714014 | Last updated: 2026-03-06
Overview
The pillar prefab factory defines reusable prefabs for static environmental pillars used in the game world (e.g., ruins, algae formations, cave columns). It establishes core entity components (Transform, AnimState, Network) and conditionally adds SoundEmitter, obstacle physics, and special tags like charge_barrier and quake_on_charge. The component is not a reusable entity component but a prefab generator — each returned instance is a distinct entity type initialized via Prefab().
Usage example
-- The prefabs are typically used internally by the game via `require("prefabs/pillar")`
-- Example of spawning one manually:
local inst = Prefab("pillar_ruins", makefn("pillar_ruins", true), makeassetlist("pillar_ruins"))()
inst.Transform:SetPosition(x, y, z)
TheWorld:PushEvent("shake", { source = inst }) -- triggers visual shake effect
Dependencies & tags
Components used: Transform, AnimState, Network, SoundEmitter (conditional), MakeObstaclePhysics (conditional helper).
Tags: Adds charge_barrier, quake_on_charge for pillar_ruins; adds NOBLOCK when collide is false.
Properties
No public properties.
Main functions
makeassetlist(name)
- Description: Returns a list containing the animation asset reference for a given pillar name.
- Parameters:
name(string) — base name of the pillar (e.g.,"pillar_ruins"). - Returns:
{ Asset("ANIM", "anim/"..name..".zip") }— an array with oneAssetobject.
doshake(inst)
- Description: Plays the
hitanimation followed by theidleanimation on the entity’sAnimState. Intended to simulate a shake/vibration effect. - Parameters:
inst(Entity) — the pillar entity instance. - Returns: Nothing.
makefn(name, collide)
- Description: Factory function returning a closure that constructs a pillar entity. Sets up components, animation bank, build, physics, and tags based on
nameandcollide. - Parameters:
name(string) — identifier used for animation bank and build.collide(boolean) — iftrue, applies obstacle physics with radius2.35; otherwise adds theNOBLOCKtag.
- Returns: A function that, when called, creates and returns a configured entity instance.
- Error states: If
name == "pillar_ruins"and the instance is not master (i.e., client-side), it still addsSoundEmitterand the tags, but the master sim branch is skipped.
pillar(name, collide)
- Description: Wraps
makefnandmakeassetlistinto aPrefabdefinition. - Parameters:
name(string) — passed tomakefnandmakeassetlist.collide(boolean) — passed tomakefn.
- Returns: A
Prefabdefinition object (suitable for return inprefabs/pillar.lua).
Events & listeners
- Listens to:
shake— triggersdoshakecallback on the pillar entity (only on master sim). - Pushes: None.