Skip to content

Latest commit

 

History

History
59 lines (51 loc) · 3.06 KB

EVENTS.md

File metadata and controls

59 lines (51 loc) · 3.06 KB

Custom Events provided by SandboxPlus

  • IPropSpawnedEvent

Custom Concommands

  • weapon_switch physgun
  • undo
  • reload_hud, though it typically hotreloads nicely in the editor
  • reload_spawnlists - for use after updating Assets/spawnlists/x.button.spawnlist files
  • spawn_dynplate [length] [width] [height]

----

Older stuff we once had back in 2023-entity-system, maybe portable to Scene

  • "game.init": run on initial addon load
  • "package.mounted": run when a package is async mounted via spawnpackage
  • "sandbox.hud.loaded": run after the Sandbox.Hud has loaded, eg. for extending the spawnmenu
  • "entity.spawned"
    • Event.Run( "entity.spawned", IEntity spawned, IEntity owner )
  • "undo.add"
    • Event.Run( "undo.add", Func<string> undo, IEntity owner )
    • Add an "Undoable" lambda, which will be called if the player wants to undo.
      Should return the string to show in the toast, or empty string if the undoable is redundant and should be skipped over (eg. if the weld was already removed)
  • "spawnlists.initialize"
    • Takes no parameters; you're expected to call ModelSelector.AddToSpawnlist( "screen", string[] models)
  • "player.cantool": called by traces.
    • Takes a single CanToolParams parameter. Writing params.preventDefault = true will prevent the tool action.
    • This may be better handled via the tool.{toolName} permission, see below.
  • "player.simulate"
    • Event.Run( "player.simulate", SandboxPlayer player )
  • "player.killed"
    • void OnKilled( SandboxPlayer player )
  • "client.say"
    • Event.Run( "client.say", IClient client, string message )
  • "trace.prepare": used to modify Player movement traces
    • [Event( "trace.prepare" )]
      public static void OnTracePrepare( Trace trace, Entity ent, Action<Trace> returnFn ) {
          returnFn(trace.WithoutTags( StargateTags.InBufferFront ) );
      }
      
  • "weapon.shootbullet": used to allow overriding bullet behaviour, such as when shooting through a Stargate
    • Takes a single ShootBulletParams parameter. Writing params.preventDefault = true will disable the default bullet behaviour.

For more usage examples, see Wirebox.

Custom Concommands

  • spawnpackage wiremod.sbox_tool_auto - extended to work on runtime addons beyond just 'npc' + 'entity', see Event("package.mounted")
  • tool_duplicator_savefile file.dupe + tool_duplicator_openfile file.dupe
  • tool_cloud_model tool_wirebutton facepunch.button 0 - mounts a new Package and sets that tool to use it
  • noclip
  • package.mount.asset.{packageIdent} - allows client to mount codeless packages from asset.party (recommended for everyone)
  • package.mount.code.{packageIdent} - allows client to mount packages from asset.party with code, which could do anything (recommended admin-only)
  • spawn.prop_physics
  • spawn.{entityName}
  • tool.{toolName} EntityTarget - called for all Sandbox tools, eg. tool.tool_constraint.Ent123, tool.tool_wirebutton.Ent123, tool.use.Ent123, tool.physgun.Ent123, useful for Prop Protection