S&box Wiki

Event System

The event system is like the Hook system in Garry's Mod. It allows you to register functions on classes to receive a callback on certain global events.

Registering a callback

Adding an [Event] attribute will add it to the list to be called.

[Event( "server.tick" )] public void MyCallback() { // will get called every server tick }

Current Engine Events

The various events called from the engine currently:

  • client.disconnect - called from GameLoop.ClientDisconnected
  • frame - called from GameLoop.PreRender
  • client.tick server.tick tick - tick is always called, client/server are appropriate to their state
  • physics.step - called from GameLoop.PostPhysicsStep
  • client.hotloaded - called from HotloadManager.DoSwap

Custom Events

You can call your own events.

Event.Run( "gameover" )

Page Links


Special Pages


Wikis

?

Render Time: 105ms

DB GetPage 94
Generate Html 0
SaveChanges (1) 8
Render Body 0
Render Sidebar 0