-
Notifications
You must be signed in to change notification settings - Fork 1
Base hooks
There's some hooks that you don't really want to touch to keep the functionality of the predicted entity base, so here we will only cover the ones that are supposed to be overridden.
Called when this entity is finally attached to a player, you should use this function to prepare your variables for player use, of course, you want to keep the ones that should be persistent across players intact ( such as the fuel or ammo ).
The default behavior of this function is to do nothing.
Called when this entity is finally dropped from a player, you should reset your per-player variables here. The player parameter might be NULL. In the case of the jetpack, the entity keeps flying when the player dies while using it or if it was a forced drop.
The default behavior of this function is to do nothing.
Called when the player wants to edit any datatable variable ( that are exposed, of course ) with sandbox's edit menu. Key and Val arguments are both strings, and editor is the table that was assigned during DefineNWVar ( if there was one ).
You can return false to not allow the player to edit the specified key, in case your logic says that is not a valid operation.
The default behavior of this function is to do nothing.
Same as above, but only called when "Key" is modified, which is the button on the keyboard ( or mouse or gamepad ) that should be pressed to trigger the "InButton".
This function is not called if the button is deemed not allowed in the first place ( used by ENT.KeyAllowedFlags )
The default behavior of this function is to only allow editing by the owning player or by anyone when not carried.
Called when the player wants to pickup this entity, return false to stop the pickup.
This is not called when the pickup is forced, which is why this function does not have that argument.
The default behavior of this function is to do nothing.
Called when the player wants to drop this entity, return false to stop the drop.
This is not called when the drop is forced, which is why this function does not have that argument.
The default behavior of this function is to do nothing.
Called after the physics object has been intialized, and you want to modify some parameters such as mass or collision group.
The default behavior of this function is to do nothing.
Called before the physics object is removed.
The default behavior of this function is to do nothing.
Called during prediction or normal entity hook, but never for both at the same time.
You should play your looping sounds here, based on your networked variables.
The default behavior of this function is to do nothing.
Called when the viewmodel is drawn, useful when you want to show something on the player's viewmodel.
The default behavior of this function is to do nothing.
Similar to the viewmodel drawing hook, this uses the same depth modifiers as to not clip anything that is drawn here trough objects.
This function is ideal if you want to show something like a shoulder mounted cannon without having to rely on a viewmodel to be present ( and also to ignore the viewmodel's view bobbing )
The default behavior of this function is to do nothing.
You should know what this function does, regardless, this function is called both when the entity is not picked up and when it's attached to the player.
The default behaviour of this function is to call self:DrawModel()
Called when the entity thinks on its own, you should call your non-player equipped logic here.
You should always call the baseclass function here as it does some important checks.
The default behavior of this function is to do some internal checks about prediction and the looping sounds function.
Called when the main activity of the player needs to be configured, return the ideal ACTIVITY and ideal SEQUENCE.
The default behavior of this function is to do nothing.
Called after HandleMainActivityOverride to configure the movement parameters and other gestures.
Return true to override the default behavior from the main hook.
The default behavior of this function is to do nothing.
Called when an animation event has been triggered, return the ACTIVITY you want to be played instead, or just play the gesture here yourself.
Return ACT_INVALID when you find your event and data to stop other hooks from handling it.
The default behavior of this function is to do nothing.