Skip to content
Artiom Parygin edited this page Jan 4, 2023 · 11 revisions

The TARDIS features it's own hook system, separate from GMods one. It was created so that parts of the entity could easily communicate and ask questions to other parts of it. A good example of this is the ShouldDraw hook on the interior, which asks all the modules if it shouldn't be drawing for any reason. This type of system is extendible and allows multiple features to work together in harmony.

Most hooks in the TARDIS work in an "override principle", meaning you shouldn't return anything unless you want to "override" default behaviour. One example is EXTERIOR::CanTurnOnFlight. Returning false in this hook will prevent flight toggling, anything else (including nothing) will allow it. Obviously this only works with hooks that expect a return value. (Most hooks beggining with Can or Should expect at least one boolean)

For viewing convenience, the hooks list has been split between Client and Server in each case

Beware some hooks may not actually pass values listed here to functions when they're called. Always check for invalid values!

Hook Arguments Returns Interior / Exterior / Common SERVER / CLIENT / SHARED Description
Use Entity/Player activator, Entity/Player caller - Interior SERVER Direct hook to the ENT:Use()
OnRemove - - Interior SERVER Direct hook to the ENT:OnRemove()
PartUsed - - Interior SERVER TardisPart part, Player activator
Think - - Interior SHARED Direct hook into ENT:Think()
Initialize - - Interior SHARED Direct hook into ENT:Initialize()
OnRemove - - Interior CLIENT Direct hook into ENT:OnRemove()
PlayerEnter Player ply, Bool notp - Interior SERVER Called when a player has entered the interior
PowerToggled Bool on - Interior SERVER Called when power has been toggled. Bool on is the new power state.
ShouldTakeDamage DamageInfo dmgInfo Bool Interior SERVER Called when damage is received. Return false to negate the damage
OnHealthDepleted - - Interior SERVER Called when health is zero
OnHealthChange Number newhealth, Number oldhealth - Interior SERVER Triggered when health changes
CanStartControlSequence - Bool Interior SERVER Return false to prevent control sequence start
PlayerInitialize Player ply - Interior SERVER Called to initialize player data. net.Write* functions are available here to send data to the client
PlayerInitialize Player ply - Interior CLIENT Used to initialize client data, net.Read* functions are available to read server sent data
PostPlayerInitialize Player ply - Interior SERVER Called after player data has been initialized
OnTakeDamage DamageInfo damageinfo - Interior SERVER Called whenever the TARDIS takes damage
CanUsePart TardisPart part, Player activator Bool Interior SERVER Called before a part is used. Return false to refuse
Draw - - Interior CLIENT Called when the interior is drawn
DrawPart - - Interior CLIENT Called when a part is drawn
PreDraw - - Interior CLIENT Called before the interior is drawn
PreDrawPart - - Interior CLIENT Called before a part is drawn
ShouldDraw - Bool Interior CLIENT Return false to hide the interior in the current drawing context
ShouldDrawLight Int? lightID, DLight? light Bool Interior CLIENT Queried to know if the current light should be drawn
PostDrawTranslucentRenderables - - Interior CLIENT Called after translucent models are drawn

Exterior

Interior