auto_stories

s&box MCP Knowledgebase

Documentation, API references, code examples and community knowledge for s&box development.

library_books 595 entries menu_book 352 Documentation code 133 API Reference terminal 100 Code Example groups 10 Community
Results for "events" in terminalCode Example 18 results closeClear
terminalCode Example
May 3, 2026

Component Event Interfaces for Tool Interactions

Component Event Interfaces (IPhysgunEvent, IToolgunEvent) Event interfaces that allow components to respond to tool interactions. These use s&box's pattern for …

terminalCode Example
May 4, 2026

Sandbox: Player spawn flow with PlayerData, events, and NetworkSpawn

Player Spawn Flow in s&box Sandbox The Sandbox game uses a (a ) to handle player connections and spawning. Here's the full pattern: GameManager spawns players o…

terminalCode Example
May 3, 2026

GameManager INetworkListener Pattern

GameManager INetworkListener Pattern Game manager implementing connection lifecycle with player spawning and cleanup. Implemented Interfaces INetworkListener - …

terminalCode Example
May 3, 2026

Playing Sounds

Playing Sounds in s&box s&box provides both 2D and 3D sound playback through code and components. Quick Sound Playback Sound Handle Store the handle to control …

terminalCode Example
May 4, 2026

Sandbox: ISpawner interface — custom spawner pattern with ISpawnEvents

ISpawner Interface — Custom Spawner Pattern The interface defines the contract for anything that can be spawned via the spawn menu. Implementations include , , …

terminalCode Example
May 3, 2026

PlayerInventory Weapon Switching

PlayerInventory Weapon Switching Weapon switching with host authority and IPlayerEvents delegation. Key Features Sync'd ActiveWeapon with Change callback for ne…

terminalCode Example
May 3, 2026

Collision and Triggers

Working with physics collisions and trigger volumes. Collision Components Basic Collision Trigger Volumes Triggers detect overlap without blocking movement: Col…

terminalCode Example
May 4, 2026

Sandbox: ToolMode system — creating custom Tool Gun modes

ToolMode System — Creating Custom Tool Gun Modes is the base class for all Tool Gun tools in Sandbox. Tools are components on the Toolgun and are enabled/disabl…

terminalCode Example
May 3, 2026

WebSockets

Use WebSockets for real-time communication with external servers. Basic Setup With Auth Token Common Use Cases Custom networking — External matchmaking, chat se…

terminalCode Example
May 10, 2026

Trigger-Based Background Music Crossfade Framework

This pattern replaces area music with a small local-client music framework. Each zone requests a target , while one controller crossfades the currently playing …

terminalCode Example
May 12, 2026

Slot-based inventory UI with BuildHash optimization

Slot-Based Inventory UI with BuildHash Optimization This example shows a slot-based inventory UI with BuildHash() optimization to prevent unnecessary rebuilds a…

terminalCode Example
May 20, 2026

NavMesh Links: Custom Jump and Ladder Traversal for AI Agents

NavMesh Links connect disconnected NavMesh regions (jumps, ladders, teleports). By default agents linearly interpolate between endpoints, but you can implement …

terminalCode Example
May 3, 2026

CleanupSystem Pattern for Map Reset and Scene Management

CleanupSystem - Scene State Management and Map Cleanup A that captures the baseline scene state and allows resetting the map to its original state. Removes spaw…

terminalCode Example
May 3, 2026

DynamiteEntity Explosive Entity Pattern

DynamiteEntity - Simple Explosive Entity A simple explosive entity that can be triggered via damage or player input. Demonstrates , , and prefab cloning pattern…

terminalCode Example
May 3, 2026

Multiplayer and Networking

Complete guide to multiplayer setup in s&box. Creating a Lobby Joining a Lobby Spawning Networked Players Host/Client Checks Connection Events Networked Object …

terminalCode Example
May 3, 2026

Inventory Hotbar UI Component

Inventory HUD with Hotbar A Razor PanelComponent that displays player inventory slots as a hotbar with mouse wheel and number key support. Implementation Key Fe…

terminalCode Example
May 3, 2026

Ownable Component Pattern for Prop Ownership

Ownable Component - Prop Ownership and Permission System A component that tracks which player spawned an object and enforces ownership-based permissions. Useful…

terminalCode Example
May 4, 2026

Sandbox: BaseConstraintToolMode — two-stage constraint creation with IToolActionEvents

BaseConstraintToolMode — Two-Stage Constraint Creation Pattern is the base for all two-point constraint tools (Weld, Rope, BallSocket, Elastic, Hydraulic, NoCol…