Rainyan / sourcemod-nt-competitive

SourceMod plugin for competitive Neotokyo.
1 stars 3 forks source link

sourcemod-nt-competitive

SourceMod plugin for competitive Neotokyo. WIP.


Recommended additional plugins for competitive

Features

Build requirements

Some optional features also require:

Cvars

nt_competitive.sp

Ghost overtime

To illustrate how the timer behaves with default settings: Ghost overtime kicks in at 15 seconds on the clock and will add a maximum of 45 seconds to the round. This gives us a total of 15 + 45 = 60 seconds for the timer of 15 seconds to decay. 60 / 15 = 4, meaning each second on the clock during ghost overtime will last for 4 real seconds.

* Ghost is picked up at 15 seconds and is held for 16 seconds. The timer shows 10 (15 - 16/4 = 11, rounded down to 10 for simplicity).
* The ghost is dropped, making the timer speed up.
* 8 seconds later the ghost is picked up again. Since grace reset is enabled, the timer jumps from 2 to 8 seconds (10 - 8/4 = 8).

Player score manipulation

The nt_competitive plugin modifies player score/deaths values under some conditions. If you're a plugin developer and would like to override this behaviour, a global forward is exposed for this:

function Action Competitive_OnPlayerScoreChange(PlayerScoreChangeReason reason, int client);

The shared header is available at scripting/nt_competitive/nt_competitive_shared.inc.

Example of overriding the score change behaviour from your plugin:

#include <sourcemod>

// needed for the PlayerScoreChangeReason enum definition
#include "nt_competitive/nt_competitive_shared"

// optional: handle cases where the forward doesn't exist,
// if it's critical to your plugin
public void OnAllPluginsLoaded()
{
    if (!LibraryExists("CompetitiveFwds"))
    {
        PrintToServer("Competitive forwards don't exist!");

        if (null != FindConVar("sm_competitive_version"))
        {
            // nt_competitive exists, but it doesn't have the forward.
            // Is the nt_competitive plugin out of date?
        }
        else
        {
            // nt_competitive plugin does not exist
        }
    }
}

// listener for the global forward from nt_competitive
public Action Competitive_OnPlayerScoreChange(PlayerScoreChangeReason reason, int client)
{
    bool allow = true;

    if ( true /* replace with your custom condition! */ )
    {
        allow = false; // Block the nt_competitive score change!
    }

    // return Plugin_Continue to allow the nt_competitive score change.
    // return Plugin_Handled to block the nt_competitive score change.
    return allow ? Plugin_Continue : Plugin_Handled;
}