codeAPI Reference

s&box DynamiteEntity: Explosive entity

calendar_today May 12, 2026 schedule ~1 min read person PatrickJr verified 50

DynamiteEntity Component API Reference

DynamiteEntity is a Component that implements IPlayerControllable and IDamageable for an explosive entity. It can be triggered by player input or by taking damage.

Type Signature

CSHARP
[Alias("dynamite")]
public class DynamiteEntity : Component, IPlayerControllable, Component.IDamageable
{
    [Property, Range(1, 500), Step(1), ClientEditable]
    public float Damage { get; set; } = 128;

    [Property, Range(16, 4096), Step(16), ClientEditable]
    public float Radius { get; set; } = 1024f;

    [Property, Range(1, 100), Step(1), ClientEditable]
    public float Force { get; set; } = 1;

    [Property, Sync, ClientEditable]
    public ClientInput Activate { get; set; }

    [Rpc.Host]
    public void Explode();
}

Properties

Methods

Explode()

Triggers the explosion. Host-only RPC that spawns an explosion prefab with RadiusDamage, then destroys the GameObject.

IPlayerControllable Implementation

IDamageable Implementation

Usage

CSHARP
// Dynamite explodes when Activate input is pressed or when damaged
var dynamite = GameObject.Components.Create<DynamiteEntity>();
dynamite.Damage = 200;
dynamite.Radius = 512;
dynamite.Force = 2;

Notes

  • Alias is "dynamite" for spawning via console
  • Uses /prefabs/engine/explosion_med.prefab for explosion effect
  • RadiusDamage component is configured on the spawned explosion
  • GameObject is destroyed after explosion
  • Can only explode once (tracked by _isDead flag)
Was this helpful?