User:Luigi budd

From SRB2 Wiki
Jump to navigation Jump to search

PTSR/Functions

This is a comprehensive list of all functions that can be utilized by Lua scripting for PTSR, excluding those that are part of userdata structures.

In the "function" column of each table below, bolded text is the actual name of the function, text in italics represents argument types (e.g.: int, mobj_t or boolean) which should not be written in actual Lua scripts when using the function, while arguments surrounded by brackets ( [ ] ) are optional and can be omitted when using the function. Unless noted otherwise, the argument names can be chosen freely; the argument names used in this article have no special meaning and are only there to simplify the explanations. Some functions have an alternative syntax, using a different number of arguments or different argument types, for instance.

/main_game.lua

These are the functions included in PTSR's main_game.lua file. These are generally simple functions that are related to Pizza Time.

Function Return value(s) Description
PTSR.RegisterGamemode(string name, table input_table) int Format of input_table: table{string name, string defaultvalue, int flags, table PossibleValue, function(consvar_t var) func}

Note: abs(INT32_MIN) does not have a corresponding value, since it would be out of the 32-bit integer range.

PTSR.ChangeGamemode(int gm) nil Changes the current gamemode to the gamemode number of gm.

Example: PTSR.ChangeGamemode(1) will set the gamemode to Casual.

max(int a, int b) int Returns the larger value of a or b.

/pizzaface.lua

Function Return value(s) Description
PTSR.PlayerIsChasable(player_t player) bool Returns if player is abled to be chased by Pizzaface, i.e., they're not a spectator, finished, using the portal, or other situations which would take away the player's controls.