Walkingplankuser
Based on game build 714014 | Last updated: 2026-03-03
Overview
WalkingPlankUser tracks and manages an entity's current mounting state on a walking plank. It holds a reference to the currently mounted plank, sets up an event listener to clear that reference when the plank is removed, and provides a method to safely dismount by calling StopMounting() on the plank.
Usage example
local inst = CreateEntity()
inst:AddComponent("walkingplankuser")
-- Mount a walking plank
inst.components.walkingplankuser:SetCurrentPlank(plank_entity)
-- Later, dismount safely
inst.components.walkingplankuser:Dismount()
Dependencies & tags
Components used: walkingplank (via plank.components.walkingplank:StopMounting())
Tags: None identified.
Properties
| Property | Type | Default Value | Description |
|---|---|---|---|
current_plank | Entity or nil | nil | Reference to the walking plank entity currently mounted. |
_plank_remove_event | EventListener or nil | nil | Internal listener for the "onremove" event on the current plank. |
Main functions
SetCurrentPlank(plank)
- Description: Sets the entity's current mounted plank and establishes a one-time listener to clear the reference if the plank is removed.
- Parameters:
plank(Entityornil) — the plank entity to mount, ornilto dismount. - Returns: Nothing.
- Error states: If a previous plank was set, its
"onremove"listener is cancelled before installing the new one.
Dismount()
- Description: Safely dismounts by signaling the plank to stop mounting and cleaning up internal state.
- Parameters: None.
- Returns: Nothing.
- Error states: If no plank is mounted (
current_plank == nil), the function returns early after cleaning up the event listener.
Events & listeners
- Listens to:
onremove(on the current plank) — triggers when the plank is removed from the world, automatically clearingcurrent_plank. - Pushes: None.