Base

This file holds central, important functions or features.

Summary
BaseThis file holds central, important functions or features.
Functions
queryThis is quite possibly the most important function in all of UPS.
queryAllThis function calls query for all entities connected to and including a specified entity.
entSpawnDO NOT CALL DIRECTLY, UPS HANDLES THIS FUNCTION This function is called to assign ownership to the player spawning the object via hooks.
PLAYER: AddCountDO NOT CALL DIRECTLY, UPS HANDLES THIS FUNCTION We’re going to override the AddCount function.
GAMEMODE: UPSPreQueryThis hook is called before query begins any processing.
GAMEMODE: UPSPostQueryThis read-only hook is called after query does all of it’s processing.
GAMEMODE: UPSPlayerLoadedThis read-only hook is called after a player reports that it has loaded UPS.

Functions

query

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.

Parameters

plyThe player entity requesting access.
entThe entity the player wants access to.
actionidWhat action they’re trying to perform on the object.  (IE, freeze, move, use)
flagsA table of special instructions for this query.  (IE, reassign ownership, no deny sound, etc)

Returns

False if they should not be allowed to perform the action, true otherwise.

queryAll

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.

Parameters

plyThe player entity requesting access.
entThe entity the player wants access to.  Checks the entity chain off this entity.
actionidWhat action they’re trying to perform on the object.  (IE, freeze, move, use)
flagsA table of special instructions for this query.  (IE, reassign ownership, no deny sound, etc)

Returns

False if they should not be allowed to perform the action, true otherwise.

entSpawn

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.

Parameters

plyThe player spawning
entEither the entity spawned or a string depending on the callback.
ent2The entity spawned on certain callbacks.  (the function figures out which is the correct argument)

PLAYER: AddCount

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.

Parameters

strThe string of the limit being used.
entThe entity that was spawned.

GAMEMODE: UPSPreQuery

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).

Parameters

plyThe player entity requesting access.
entThe entity the player wants access to.
actionidWhat action they’re trying to perform on the object.  (IE, freeze, move, use)
flagsA table of special instructions for this query.  (IE, reassign ownership, no deny sound, etc)

GAMEMODE: UPSPostQuery

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.

Parameters

plyThe player entity requesting access.
entThe entity the player wants access to.
actionidWhat action they’re trying to perform on the object.  (IE, freeze, move, use)
flagsA table of special instructions for this query.  (IE, reassign ownership, no deny sound, etc)
allowedWhether or not the player acheived access to the requested operation.

GAMEMODE: UPSPlayerLoaded

function GAMEMODE:UPSPlayerLoaded(ply)

This read-only hook is called after a player reports that it has loaded UPS.  This is called directly after the player is assigned a short id and stuck into the name table.

Parameters

plyThe player entity that’s loaded
function query(ply,
ent,
actionid,
flags)
This is quite possibly the most important function in all of UPS.
function queryAll(ply,
ent,
actionid,
flags)
This function calls query for all entities connected to and including a specified entity.
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.
function GAMEMODE:UPSPreQuery(ply,
ent,
actionid,
flags)
This hook is called before query begins any processing.
function GAMEMODE:UPSPostQuery(ply,
ent,
actionid,
flags,
allowed)
This read-only hook is called after query does all of it’s processing.
function GAMEMODE:UPSPlayerLoaded(ply)
This read-only hook is called after a player reports that it has loaded UPS.
Close