diff options
| author | aura <nw@moneybot.cc> | 2026-02-17 23:42:09 +0100 |
|---|---|---|
| committer | aura <nw@moneybot.cc> | 2026-02-17 23:42:09 +0100 |
| commit | 5e2eb7d67ae933b7566f1944d0bb7744da03d586 (patch) | |
| tree | 054acff1113270a9cd07933df760f3768c1b6853 /source/sourcemod/scripting/gokz-core/modes.sp | |
| parent | 341db13a008dc12bb22ceb50452d93d01476308c (diff) | |
move source stuff to its own folder
Diffstat (limited to 'source/sourcemod/scripting/gokz-core/modes.sp')
| -rw-r--r-- | source/sourcemod/scripting/gokz-core/modes.sp | 106 |
1 files changed, 106 insertions, 0 deletions
diff --git a/source/sourcemod/scripting/gokz-core/modes.sp b/source/sourcemod/scripting/gokz-core/modes.sp new file mode 100644 index 0000000..ce6f8ae --- /dev/null +++ b/source/sourcemod/scripting/gokz-core/modes.sp @@ -0,0 +1,106 @@ +static bool modeLoaded[MODE_COUNT]; +static int modeVersion[MODE_COUNT]; +static bool GOKZHitPerf[MAXPLAYERS + 1]; +static float GOKZTakeoffSpeed[MAXPLAYERS + 1]; + + + +// =====[ PUBLIC ]===== + +bool GetModeLoaded(int mode) +{ + return modeLoaded[mode]; +} + +int GetModeVersion(int mode) +{ + return modeLoaded[mode] ? modeVersion[mode] : -1; +} + +void SetModeLoaded(int mode, bool loaded, int version = -1) +{ + if (!modeLoaded[mode] && loaded) + { + modeLoaded[mode] = true; + modeVersion[mode] = version; + Call_GOKZ_OnModeLoaded(mode); + } + else if (modeLoaded[mode] && !loaded) + { + modeLoaded[mode] = false; + Call_GOKZ_OnModeUnloaded(mode); + } +} + +int GetLoadedModeCount() +{ + int count = 0; + for (int mode = 0; mode < MODE_COUNT; mode++) + { + if (modeLoaded[mode]) + { + count++; + } + } + return count; +} + +int GetALoadedMode() +{ + for (int mode = 0; mode < MODE_COUNT; mode++) + { + if (GOKZ_GetModeLoaded(mode)) + { + return mode; + } + } + return -1; // Uh-oh +} + +bool GetGOKZHitPerf(int client) +{ + return GOKZHitPerf[client]; +} + +void SetGOKZHitPerf(int client, bool hitPerf) +{ + GOKZHitPerf[client] = hitPerf; +} + +float GetGOKZTakeoffSpeed(int client) +{ + return GOKZTakeoffSpeed[client]; +} + +void SetGOKZTakeoffSpeed(int client, float takeoffSpeed) +{ + GOKZTakeoffSpeed[client] = takeoffSpeed; +} + + + +// =====[ EVENTS ]===== + +void OnAllPluginsLoaded_Modes() +{ + if (GetLoadedModeCount() <= 0) + { + SetFailState("At least one GOKZ mode plugin is required."); + } +} + +void OnPlayerSpawn_Modes(int client) +{ + GOKZHitPerf[client] = false; + GOKZTakeoffSpeed[client] = 0.0; +} + +void OnOptionChanged_Mode(int client, Option option) +{ + if (option == Option_Mode) + { + // Remove speed when switching modes + Movement_SetVelocityModifier(client, 1.0); + Movement_SetVelocity(client, view_as<float>( { 0.0, 0.0, 0.0 } )); + } +}
\ No newline at end of file |
