/sourcemod-nt-deadtools

Advanced player alive status control for Neotokyo. Respawn players and more.

Primary LanguageSourcePawnGNU General Public License v3.0GPL-3.0

sourcemod-nt-deadtools

SourceMod plugin for Neotokyo, for controlling the player dead/alive state. This plugin adds the ability to bring "dead"/downed players back to life during the same round, for custom things like respawning or reviving players.

This base plugin encapsulates the respawning functionality, and aims to provide a clean API for calling these methods from other plugins in a modular fashion, for easier creation of custom game modes.

(YouTube link) Example of a custom game mode using this plugin, from the ANP 2023 Summer Skirmish showmatch: YouTube example video thumbnail

Outline

For server operators

If you just want to enable the basic respawns feature on your NT server, follow the installation instructions for this base plugin, and then install the desired respawns plugin from the list of example plugins.

For plugin developers

Please refer to the API reference. If you need more example code, check out the example plugins list.

/****
* Returns the nt_deadtools plugin natives API version.
* The version number follows Semantic Versioning MAJOR.MINOR scheme,
* except for the PATCH version being unused.
*
* @param int Optional SemVer MINOR version by reference.
* @return int SemVer MAJOR version.
****/
native int DeadTools_GetApiVersion(int& minor=0);
/****
* Convenience function that throws a NativeError with help message
* if the expected DeadTools MAJOR version mismatches what the server
* is currently running.
* Recommended to be called once, inside the OnAllPluginsLoaded forward.
*
* @param int Expected SemVer MAJOR version.
* Defaults to the value in nt_deadtools_shared.
* @param int Expected SemVer MINOR version.
* Defaults to the value in nt_deadtools_shared.
* @param bool Whether to print a non-error warning to server
* log on MINOR version violation. Defaults to
* true.
* @throws NativeError If API version violates SemVer.
****/
native void DeadTools_VerifyApiVersion(int expected_major=DEADTOOLS_VER_MAJOR,
int expected_minor=DEADTOOLS_VER_MINOR,
bool log_minor_warning=true);
/****
* Return nt_deadtools state bit flags for a client.
* See the "DEADTOOLS_FLAG..." defines for details.
*
* @param int Client index.
* @throws NativeError Client index <1, >MaxClients, !IsClientInGame
* @return int DEADTOOLS_FLAG bitflags for this client.
****/
native int DeadTools_GetClientFlags(int client);
/****
* Set whether a client can be "downed".
* Downed is a special nt_deadtools state where the player feigns dead,
* but can be potentially revived by another plugin calling
* DeadTools_Revive.
*
* @param int Client index.
* @throws NativeError Client index <1, >MaxClients, !IsClientInGame
****/
native void DeadTools_SetIsDownable(int client, bool downable);
/****
* Revives a downed client.
* If client is not downed, this call is a no-op.
*
* @param int Client index.
* @throws NativeError client <1, client >MaxClients, !IsClientInGame
****/
native void DeadTools_Revive(int client);

Build requirements

  • SourceMod 1.8 or newer
    • If using SourceMod older than 1.11: you also need the DHooks extension. Download links are at the bottom of the opening post of the AlliedMods thread. Be sure to choose the correct one for your SM version! You don't need this if you're using SourceMod 1.11 or newer.
  • Neotokyo include, version 1.0 or newer

Installation

  • Place the gamedata file to the addons/sourcemod/gamedata/neotokyo folder (create the "neotokyo" folder if it doesn't exist).

Important

Note that the DeadTools include folder structure should look like <...>/include/nt_deadtools/nt_deadtools_<thing>.inc, and not <...>/include/nt_deadtools_<thing>.inc, the incorrect path lacking the "nt_deadtools" folder inside "include".

  • Compile the plugin, and place the .smx binary file to addons/sourcemod/plugins
    • You'll need to add the include files folder to your SM compiler's include folder (typically the include directory inside your compiler directory), or specify the additional include directory using the -i <path> argument syntax.

Example plugins using this plugin

  • nt_respawns — Adds a simple respawn mechanic for the CTG game mode.
  • Your plugin here? 😄