Skip to content

DoomWare API

Buu342 edited this page May 13, 2021 · 32 revisions

Table of Contents

Scripts and Functions

The following contains a list of scripts and functions which you can use to assist you during the development of new minigames for DoomWare.

Minigame Functions The following scripts are to be used to handle basic minigame logic.
Name Type Arguments Return Description
DoomWare_Server_GameWait Script int time - Sets the minigame timer to time.
DoomWare_Server_TeleportPlayers Script int tid
bool telesector
bool fog
- Teleports all the players to tid.
If telesector is enabled, the TeleportInSector method will be used. Otherwise, players will be teleported to individual TID's.
Enabling fog will enable the teleport effect+sound
DoomWare_Server_TeleportSingle Script int plynum
int destination
- Teleports a player with PlayerNumber plynum to the destination with ThingID destination
DoomWare_Server_ReturnPlayers Script bool fog - Returns all teleported players back to the main lobby.
If fog is enabled, then a teleport effect+sound will be emitted.
Player Manipulation The following functions are used to manipulate player states and abilities.
Name Type Arguments Return Description
Player_Win Function int plynum - Makes the player with PlayerNumber plynum win the current minigame.
Player_Lose Function int plynum
bool silent
- Makes the player with PlayerNumber plynum lose the current minigame.
Player_SavePosition Function int plynum - Saves the position of the player with PlayerNumber plynum (Used internally by DoomWare_Server_TeleportPlayers).
Player_InvalidatePosition Function int plynum - Clears the stored position of the player with PlayerNumber plynum.
Player_Morph Function int plynum
str class
- Morphs the player with PlayerNumber plynum into the actor class.
Player_FreezeTotally Function int who - Freezes the player totally. Set who to 1 to affect all players, or 0 to affect the activator.
Player_UnFreezeTotally Function int who - Unfreezes the player totally. Set who to 1 to affect all players, or 0 to affect the activator.
Give_Achievement Function int plynum
int achievement
- Gives the player with PlayerNumber plynum the achievement with id achievement.
Player Information The following functions are used to retrieve information about players.
Name Type Arguments Return Description
Check_LMS Function - - Iterates through all players and checks if there is only one last man standing. If so, automtically calls Player_Win on them.
Check_WonRoundItem Function - - Iterates through all players and calls Player_Win on the ones who have "WonRoundItem" in their inventory.
Check_FailRoundItem Function - - Iterates through all players and calls Player_Lose on the ones who have "FailRoundItem" in their inventory.
Check_Player_Won Function int plynum bool Checks if the player with PlayerNumber plynum has won this round.
Check_Player_Lost Function int plynum bool Checks if the player with PlayerNumber plynum has lost this round.
Observer System The following functions relate to the observer system
Name Type Arguments Return Description
Add_Observer Function int TID - Adds a camera with ThingID TID to the observers list.
Force_Observe Function int plynum - Forces the player with PlayerNumber plynum to use the observers camera. At least one camera needs to be in the observers list for this to work!
Miscellaneous The following functions don't fit in any other category, but can otherwise prove useful.
Name Type Arguments Return Description
Calc_Speed Function int xvel
int yvel
int Returns the speed from the given x and y velocities xvel & yvel. The returned value is in Fixed Point format.
Distance Function int tid1
int tid2
int Returns the distance between the actor with tid1 and tid2 in Fixed Point format.
Max Function int a
int b
int Returns the largest number between a and b.
AToI Function str s int Converts the string s to an integer.
DECORATE The following scripts are solely used in DECORATE.
Name Type Arguments Return Description
DoomWare_Entity_MarkCleanup Script - - Changes the calling entity's ThingID to TID_REMOVE.
DoomWare_Entity_CheckCleanup Script - - Checks if a minigame is ocurring, and if it isn't, it removes the calling entity. This is needed because sometimes the initial TID_REMOVE cleanup fails.

Global Variables

The following contains a list of global variables which you can modify during the execution of your minigame.

TODO

Internal Functions and Scripts

This section contains a list of internal functions and scripts used by DoomWare. You should have very little reason to use them, but they're here for documentation's sake.

Server Logic The following scripts and functions relate to the initialization of the gamemode, as well as the main gamemode logic.
Name Type Arguments Return Description
DoomWare_Server_Boot Script - - Called when the map starts. Initializes some gamemode states and waits for players to join.
DoomWare_Server_Initialize Script - - Called after two players join or solo play starts. Initializes the rest of the gamemode and creates "threads".
DoomWare_Server_InitMap Script - - Initializes the map.
DoomWare_Server_InitHints Script - - Initializes the list of hints to display during speedup.
DoomWare_Server_InitRounds Script - - Initializes the list of minigames to play.
DoomWare_Server_InitHighscores Script - - Initializes the highscore table.
DoomWare_Server_InitGlobals Script - - Initializes all the global variables.
DoomWare_Server_InitWackymods Script - - Initializes the wacky modifiers.
DoomWare_Server_GameLogic Script - - Main game logic "thread".
DoomWare_Server_SyncGlobals Script - - Global variable networking "thread".
Client Logic The following scripts relate to the initialization of the player, as well as the main player gamemode logic.
Name Type Arguments Return Description
DoomWare_Client_Join Script - - Called when a player joins. Initializes the player and creates "threads".
DoomWare_Client_Initialize Script - - Initializes variables related to the player.
DoomWare_Client_Death Script - - Called when a player dies. Awards or punishes the player during a minigame.
DoomWare_Client_Disconnect Script int gone - Called when the player with PlayerNumber gone leaves. Cleans up after them.
DoomWare_Client_Respawn Script - - Called when a player respawns. Clears their inventory, resets their TID, and performs other fixes.
DoomWare_Client_GameLogic Script - - Main client gamemode logic "thread".
DoomWare_Client_DrawHUD Script - - HUD drawing "thread".
Checking Functions The following functions are used for checking various gamemode states
Name Type Arguments Return Description
Should_Speedup Function - bool Checks if we should speedup this round.
Should_TieBreak Function - bool Checks if we should tiebreak this round.
Is_1v1_TieBreaker Function - bool Returns if (and only if) the players in first and second place are tied.
No_MidRound_Array Function - bool Checks if every player has either won or lost the minigame.
Wackymods The following scripts and functions handle wacky modifier logic.
Name Type Arguments Return Description
Player_SetWackymod Function int plynum - Sets the wacky modifier on the player with PlayerNumber plynum.
DoomWare_WackyMod_DoubleJump Script - - A "thread" which handles double jumping on the activator.
Data Networking The following functions relate to the networking of global variables to CLIENTSIDE scripts.
Name Type Arguments Return Description
Player_SetCVar Function str cvar
int value
- Calls SetCVar on the CVar with name cvar only if its value value changed.
Player_SetCVarString Function str cvar
str value
- Calls SetCVarString on the CVar with name cvar only if its value value changed.
Pack_Global_Array Function str cvar - Packs the data relevant to the CVar cvar into a string and calls SetCVarString only if its value changed.
Unpack_CVar_Array Function str cvar int Unpacks the integer data in CVar cvar and returns only the data relevant to the activator .
Unpack_CVar_Array_String Function str cvar str Unpacks the string data in CVar cvar and returns only the data relevant to the activator.
Database Handling The following scripts and functions relate to [player stat tracking](Player-Stats).
Name Type Arguments Return Description
Load_PlayerDB Function int plynum - Loads the database of the player with PlayerNumber plynum.
DB_NetworkStats Function str namespace
str cvarname
- Networks the stats in namespace to the CVar that ends with the name cvarname.
DoomWare_Server_UpdateDB Script - - Updates the player database with this rounds' stats.
Highscore Table The following scripts handle the highscore table.
Name Type Arguments Return Description
257 Script - - Called when the player presses their highscore table bind.
DoomWare_Server_CalcHighscore Script - - A "thread" which continually updates the highscore table.
DoomWare_Client_DrawHighscore Script - - Draws the highscore table for the activator.
Observer System The following scripts handle the observer system.
Name Type Arguments Return Description
988 Script - - Called when the player presses their observe minigame bind.
DoomWare_Server_ClearObservers Script - - Clears the observers array and stops people from observing after a minigame ends.
DoomWare Menu The following scripts are related to the DoomWare menu.
Name Type Arguments Return Description
999 Script - - Called when the player presses their observe minigame bind.
DoomWare_Client_DrawMenu Script - - Draws the DoomWare menu for the activator.
Handle_Menu_Option Function int number
str command
str desc
int plynum
int mouse_x
int mouse_y
int w
int h
- Handles drawing and clicking of the menu option linked to the CVar command.
number is the number of the option.
desc is the description of the CVar.
plynum is the PlayerNumber of the activator.
mouse_x and mouse_y is the mouse's X and Y position.
wand h is the button's size.
Handle_Menu_Achievement Function int achieve_data
int number
str name
str desc
str sprite
int plynum
int mouse_x
int mouse_y
int w
int h
- Handles the drawing of the achievement with ID number.
achieve_data is the players' achievement bit field.
name and desc is the name and description of the achievement.
sprite is the achievement sprite lump name.
plynum is the PlayerNumber of the activator.
mouse_x and mouse_y is the mouse's X and Y position.
wand h is the button's size.
Player Hats The following scripts and functions handle player hats.
Name Type Arguments Return Description
IsBetaTester Function int plynum bool Returns whether the player with PlayerNumber plynum was a beta tester.
DoomWare_Server_Hats Script - - A "thread" that handles all the player hats.
Miscellaneous The following scripts did not fit into any other category, but are used in some way by the gamemode.
Name Type Arguments Return Description
DoomWare_Entity_Cleanup Script - - Removes all actors with ThingID TID_REMOVE.
DoomWare_Entity_SetPlayerTranslation Script - - Applies translation colors to morphed actors based on the activator's player color.
DoomWare_DoLightning Script - - A "thread" which handles the skybox lightning during halloween mode.
DoomWare_AchievementLog Script int plynum
int achievement
- Prints that the player with PlayerNumber plynum obtained the achievement with name achievement.

Internal Global Variables

This section contains a list of internal global variables used by DoomWare. Modifying these variables during gameplay can cause problems with the gamemode, therefore they should be treated as READ ONLY.

TODO

Clone this wiki locally