Misc: Move shared stuff to shared git.

This commit is contained in:
zaCade
2018-12-08 21:12:39 +01:00
parent d4378f6476
commit 8cdcb01100
97 changed files with 25215 additions and 0 deletions
+127
View File
@@ -0,0 +1,127 @@
/*
* ============================================================================
*
* Zombie:Reloaded
*
* File: class.zr.inc
* Type: Include
* Description: Player class API.
*
* Copyright (C) 2009-2013 Greyscale, Richard Helgeby
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* ============================================================================
*/
/**
* @section Internal class cache types. Specifies which class data to access.
*/
#define ZR_CLASS_CACHE_ORIGINAL 0 /** Original class data loaded from file. */
#define ZR_CLASS_CACHE_MODIFIED 1 /** Default cache. Class data modified by eventual multipliers, map configs, commands, etc. */
#define ZR_CLASS_CACHE_PLAYER 2 /** Current player class attributes. The class index parameter is used as client index when reading from this cache. */
/**
* @endsection
*/
/**
* Results when selecting a class for a player.
*/
enum ClassSelectResult
{
ClassSelected_NoChange, /** No class change was necessary (class already selected). */
ClassSelected_Instant, /** Class was instantly changed. */
ClassSelected_NextSpawn /** Class will be used next spawn. */
}
/**
* Returns whether a class index is valid or not.
*
* @param classIndex Class index to validate.
*
* @return True if valid, false otherwise.
*/
native bool ZR_IsValidClassIndex(int classIndex);
/**
* Gets the currently active class index that the player is using.
*
* @param client The client index.
*
* @return The active class index.
*/
native bool ZR_GetActiveClass(int client);
/**
* Gets the current human class index that the player is using.
*
* @param client The client index.
*
* @return The human class index.
*/
native bool ZR_GetHumanClass(int client);
/**
* Gets the current zombie class index that the player is using.
*
* @param client The client index.
*
* @return The zombie class index.
*/
native bool ZR_GetZombieClass(int client);
/**
* Selects a class for a player.
*
* Human class attribute may be instantly applied if player is alive, human and
* instant class change is enabled. Otherwise only the selected index will be
* updated for next spawn.
*
* Class selection will be saved in client cookies if enabled.
*
* @param client Client index.
* @param classIndex Class index.
* @param applyIfPossible Optional. Apply class attributes if conditions allow
* it. Default is true.
* @param saveIfEnabled Optional. Save class selection in client cookies if
* enabled. Default is true.
*
* @return Class selection result. See enum ClassSelectResult.
*/
native ClassSelectResult ZR_SelectClientClass(int client, int classIndex, bool applyIfPossible = true, bool saveIfEnabled = true);
/**
* Gets the class index of the class with the specified name.
*
* Note: This search is linear and probably won't perform well in large loops.
*
* @param className Class name to search for.
* @param cacheType Optional. Specifies which class cache to read from,
* except player cache.
*
* @return Class index, or -1 if none found.
*/
native int ZR_GetClassByName(const char[] className, int cacheType = ZR_CLASS_CACHE_MODIFIED);
/**
* Gets the class name displayed in the class menu.
*
* @param index Index of the class in a class cache or a client index,
* depending on the cache type specified.
* @param buffer The destination string buffer.
* @param maxlen The length of the destination string buffer.
* @param cacheType Optional. Specifies which class cache to read from.
* @return Number of cells written. -1 on error.
*/
native int ZR_GetClassDisplayName(int index, char[] buffer, int maxlen, int cacheType = ZR_CLASS_CACHE_MODIFIED);
+133
View File
@@ -0,0 +1,133 @@
/*
* ============================================================================
*
* Zombie:Reloaded
*
* File: infect.zr.inc
* Type: Include
* Description: Infect-related natives/forwards.
*
* Copyright (C) 2009-2013 Greyscale, Richard Helgeby
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* ============================================================================
*/
/**
* Returns true if the player is a zombie, false if not.
*
* @param client The client index.
*
* @return True if zombie, false if not.
* @error Invalid client index, not connected or not alive.
*/
native bool ZR_IsClientZombie(int client);
/**
* Returns true if the player is a human, false if not.
*
* @param client The client index.
*
* @return True if human, false if not.
* @error Invalid client index, not connected or not alive.
*/
native bool ZR_IsClientHuman(int client);
/**
* Infects a player.
*
* Note: If the player already is a zombie, the player will be re-infected.
*
* @param client The client to infect.
* @param attacker (Optional) The attacker who did the infect.
* @param motherInfect (Optional) Infect as a mother zombie.
* @param respawnOverride (Optional) Set to true to override respawn cvar.
* @param respawn (Optional) Value to override with.
*
* @error Invalid client index, not connected or not alive.
*/
native int ZR_InfectClient(int client, int attacker = -1, bool motherInfect = false, bool respawnOverride = false, bool respawn = false);
/**
* Turns a zombie back into a human.
*
* Note: If the player already is a human, this code will still run as the
* player was a zombie.
*
* @param client The client to make human.
* @param respawn Teleport client back to spawn.
* @param protect Start spawn protection on client.
*
* @error Invalid client index, not connected or not alive.
*/
native int ZR_HumanClient(int client, bool respawn = false, bool protect = false);
/**
* Called when a player is about to become a zombie.
* Here you can modify any variable or block the infection entirely.
*
* @param client The client index.
* @param attacker The the infecter. (-1 if there is no infecter)
* @param motherInfect If the client is becoming a mother zombie.
* @param respawnOverride True if the respawn cvar is being overridden.
* @param respawn The value that respawn is being overridden with.
*
* @return Plugin_Handled to block infection. Anything else
* (like Plugin_Continue) to allow infection.
*/
forward Action ZR_OnClientInfect(int &client, int &attacker, bool &motherInfect, bool &respawnOverride, bool &respawn);
/**
* Called after a player has become a zombie.
*
* @param client The client that was infected.
* @param attacker The the infecter. (-1 if there is no infecter)
* @param motherInfect If the client is a mother zombie.
* @param respawnOverride True if the respawn cvar was overridden.
* @param respawn The value that respawn was overridden with.
*/
forward void ZR_OnClientInfected(int client, int attacker, bool motherInfect, bool respawnOverride, bool respawn);
/**
* Called when a player is about to become a human. (Through an admin command).
* Here you can modify any variable or block the action entirely.
*
* @param client The client index.
* @param respawn True if the client was respawned, false if not.
* @param protect True if the client spawn protected, false if not.
*
* @return Plugin_Handled to block infection. Anything else
* (like Plugin_Continue) to allow acion.
*/
forward Action ZR_OnClientHuman(int &client, bool &respawn, bool &protect);
/**
* Called after a player has become a human. (Through an admin command.)
*
* @param client The client index.
* @param respawn Whether the client was respawned.
* @param protect Whether the client has spawn protection.
*/
forward void ZR_OnClientHumanPost(int client, bool respawn, bool protect);
/**
* Called in ZRCreateEligibleClientList to determine if a client is eligible to become infected.
*
* @param client The client index.
*
* @return Plugin_Handled is not eligible. Anything else
* (like Plugin_Continue) is eligible.
*/
forward Action ZR_OnClientMotherZombieEligible(int client);
+95
View File
@@ -0,0 +1,95 @@
/*
* ============================================================================
*
* Zombie:Reloaded
*
* File: respawn.zr.inc
* Type: Include
* Description: Infect-related natives/forwards.
*
* Copyright (C) 2009-2013 Greyscale, Richard Helgeby
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* ============================================================================
*/
/**
* Conditions for respawning players.
*/
enum ZR_RespawnCondition
{
ZR_Repsawn_Default = -1, /** Let ZR decide according to its settings. */
ZR_Respawn_Human = 0, /** Respawn as a human. */
ZR_Respawn_Zombie, /** Respawn as a zombie. */
ZR_Respawn_ZombieIfSuicide /** Respawn as a zombie if killed by world damage. */
}
/**
* Spawns a player into the round.
*
* @param client The client index.
* @param condition Optional. Set respawn condition, defaults to current
* ZR settings. See ZR_RespawnCondition for details.
* @error Invalid client index, not connected or already alive.
*/
native void ZR_RespawnClient(int client, ZR_RespawnCondition condition = ZR_Repsawn_Default);
/**
* Called right before ZR is about to respawn a player.
* Here you can modify any variable or stop the action entirely.
*
* @param client The client index.
* @param condition Respawn condition. See ZR_RespawnCondition for
* details.
*
* @return Plugin_Handled to block respawn.
*/
forward Action ZR_OnClientRespawn(int &client, ZR_RespawnCondition &condition);
/**
* Called after ZR respawned a player.
*
* @param client The client index.
* @param condition Current condition of the respawned player. See
* ZR_RespawnCondition for details.
*/
forward void ZR_OnClientRespawned(int client, ZR_RespawnCondition condition);
/**
* Set if a player died by a suicide or world damage.
* Note: This will change the respawn condition.
* Note: This value is reset to default by ZR when a zombie player dies.
*
* @param client The client index.
* @param suicide True to say the player suicided, false if killed by another
* player.
*
* @error Invalid client index or not connected.
*/
native void ZR_SetKilledByWorld(int client, bool suicide);
/**
* Get whether the player died by a suicide or world damage.
*
* Note: This value is only valid after death event, and before respawn.
*
* @param client The client index.
*
* @return True if the player died by suicide, false if killed by
* another player.
* @error Invalid client index or not connected.
*/
native bool ZR_GetKilledByWorld(int client);