This file holds central, important functions or features.
Base | This file holds central, important functions or features. |
Functions | |
query | This is quite possibly the most important function in all of UPS. |
queryAll | This function calls query for all entities connected to and including a specified entity. |
entSpawn | DO NOT CALL DIRECTLY, UPS HANDLES THIS FUNCTION This function is called to assign ownership to the player spawning the object via hooks. |
PLAYER: AddCount | DO NOT CALL DIRECTLY, UPS HANDLES THIS FUNCTION We’re going to override the AddCount function. |
GAMEMODE: UPSPreQuery | This hook is called before query begins any processing. |
GAMEMODE: UPSPostQuery | This read-only hook is called after query does all of it’s processing. |
GAMEMODE: UPSPlayerLoaded | This read-only hook is called after a player reports that it has loaded UPS. |
function query( ply, ent, actionid, flags )
This is quite possibly the most important function in all of UPS. This is how it decides whether or not to give access to someone for any given object. There are pre- and post-hooks if you’re looking at modifying the behavior.
ply | The player entity requesting access. |
ent | The entity the player wants access to. |
actionid | What action they’re trying to perform on the object. (IE, freeze, move, use) |
flags | A table of special instructions for this query. (IE, reassign ownership, no deny sound, etc) |
False if they should not be allowed to perform the action, true otherwise.
function queryAll( ply, ent, actionid, flags )
This function calls query for all entities connected to and including a specified entity. This is useful for actions like left-click remove.
ply | The player entity requesting access. |
ent | The entity the player wants access to. Checks the entity chain off this entity. |
actionid | What action they’re trying to perform on the object. (IE, freeze, move, use) |
flags | A table of special instructions for this query. (IE, reassign ownership, no deny sound, etc) |
False if they should not be allowed to perform the action, true otherwise.
function entSpawn( ply, ent, ent2 )
DO NOT CALL DIRECTLY, UPS HANDLES THIS FUNCTION This function is called to assign ownership to the player spawning the object via hooks.
ply | The player spawning |
ent | Either the entity spawned or a string depending on the callback. |
ent2 | The entity spawned on certain callbacks. (the function figures out which is the correct argument) |
DO NOT CALL DIRECTLY, UPS HANDLES THIS FUNCTION We’re going to override the AddCount function. This will make it so we automagically catch objects that don’t call hooks like gmod buttons and wire stuff. UPS.entSpawn() might get called twice depending on the object, but it doesn’t matter if it does.
str | The string of the limit being used. |
ent | The entity that was spawned. |
function GAMEMODE:UPSPreQuery( ply, ent, actionid, flags )
This hook is called before query begins any processing. You can completely override query by returning true or false from a hook. Use this hook with great care and responsibility. Be aware that it is called before admin or sharing checks, or even the ignore list (IE, you’ll get worldspawn).
ply | The player entity requesting access. |
ent | The entity the player wants access to. |
actionid | What action they’re trying to perform on the object. (IE, freeze, move, use) |
flags | A table of special instructions for this query. (IE, reassign ownership, no deny sound, etc) |
function GAMEMODE:UPSPostQuery( ply, ent, actionid, flags, allowed )
This read-only hook is called after query does all of it’s processing. It is considered read-only because returning values does nothing to query. Note that the last parameter is whether or not the player got access.
ply | The player entity requesting access. |
ent | The entity the player wants access to. |
actionid | What action they’re trying to perform on the object. (IE, freeze, move, use) |
flags | A table of special instructions for this query. (IE, reassign ownership, no deny sound, etc) |
allowed | Whether or not the player acheived access to the requested operation. |
This is quite possibly the most important function in all of UPS.
function query( ply, ent, actionid, flags )
This function calls query for all entities connected to and including a specified entity.
function queryAll( ply, ent, actionid, flags )
DO NOT CALL DIRECTLY, UPS HANDLES THIS FUNCTION This function is called to assign ownership to the player spawning the object via hooks.
function entSpawn( ply, ent, ent2 )
This hook is called before query begins any processing.
function GAMEMODE:UPSPreQuery( ply, ent, actionid, flags )
This read-only hook is called after query does all of it’s processing.
function GAMEMODE:UPSPostQuery( ply, ent, actionid, flags, allowed )
This read-only hook is called after a player reports that it has loaded UPS.
function GAMEMODE:UPSPlayerLoaded( ply )