diff --git a/cstrike/addons/sourcemod/configs/zr/playerclasses.txt b/cstrike/addons/sourcemod/configs/zr/playerclasses.txt
index 66d9938..b0ec557 100644
--- a/cstrike/addons/sourcemod/configs/zr/playerclasses.txt
+++ b/cstrike/addons/sourcemod/configs/zr/playerclasses.txt
@@ -32,8 +32,17 @@
// fov number Field of view value. 90 is default.
// has_napalm yes/no Allows player to throw napalm grenades. Humans only.
// napalm_time decimal Napalm burn duration. Zombies only.
-// immunity_mode number Sets the immunity mode.
-// immunity_amount decimal Sets the immunity value.
+// immunity_mode test How the human is infected (humans only):
+// "none" - Instant infection.
+// "full" - Immune to infection. Careful with this, it might not be that fun.
+// "damage" - Allow zombies to stab humans to death, or below a HP threshold.
+// "delay" - Delay infection for a certain number of seconds.
+// "shield" - Allow human to deploy a shield that will give a temporary full immunity against infections.
+// immunity_amount number Immunity data value (humans only). Depends on the immunity mode above:
+// "damage" - HP threshold. Infection will be allowed when HP go below this value. Zero will enable stabbing to death.
+// "delay" - Number of seconds the infection is delayed since first hit by a zombie.
+// "shield" - Number of seconds the shield is active.
+// immunity_cooldown number Number of seconds of cooldown for temporary immunity effects (currently just shield mode).
// no_fall_damage on/off Disables fall damage.
// health number How many health points to give.
// health_regen_interval decimal Sets the regeneration interval. 0 to disable.
@@ -79,9 +88,9 @@
"has_napalm" "no"
"napalm_time" "10.0"
- // Player behaviour
- "immunity_mode" "0"
- "immunity_amount" "0.0"
+ // Player behavior
+ "immunity_mode" "none"
+ "immunity_amount" "0"
"no_fall_damage" "yes"
"health" "2500"
@@ -123,9 +132,9 @@
"has_napalm" "no"
"napalm_time" "5.0"
- // Player behaviour
- "immunity_mode" "0"
- "immunity_amount" "0.0"
+ // Player behavior
+ "immunity_mode" "none"
+ "immunity_amount" "0"
"no_fall_damage" "yes"
"health" "2000"
@@ -167,9 +176,9 @@
"has_napalm" "no"
"napalm_time" "15.0"
- // Player behaviour
- "immunity_mode" "0"
- "immunity_amount" "0.0"
+ // Player behavior
+ "immunity_mode" "none"
+ "immunity_amount" "0"
"no_fall_damage" "yes"
"health" "3500"
@@ -211,9 +220,9 @@
"has_napalm" "no"
"napalm_time" "20.0"
- // Player behaviour
- "immunity_mode" "0"
- "immunity_amount" "0.0"
+ // Player behavior
+ "immunity_mode" "none"
+ "immunity_amount" "0"
"no_fall_damage" "yes"
"health" "4000"
@@ -255,9 +264,9 @@
"has_napalm" "0"
"napalm_time" "5.0"
- // Player behaviour
- "immunity_mode" "0"
- "immunity_amount" "0.0"
+ // Player behavior
+ "immunity_mode" "none"
+ "immunity_amount" "0"
"no_fall_damage" "yes"
"health" "2500"
@@ -299,9 +308,9 @@
"has_napalm" "no"
"napalm_time" "3.0"
- // Player behaviour
- "immunity_mode" "0"
- "immunity_amount" "0.0"
+ // Player behavior
+ "immunity_mode" "none"
+ "immunity_amount" "0"
"no_fall_damage" "yes"
"health" "3500"
@@ -349,9 +358,9 @@
"has_napalm" "yes"
"napalm_time" "0.0"
- // Player behaviour
- "immunity_mode" "0"
- "immunity_amount" "0.0"
+ // Player behavior
+ "immunity_mode" "none"
+ "immunity_amount" "0"
"no_fall_damage" "no"
"health" "100"
@@ -393,9 +402,9 @@
"has_napalm" "yes"
"napalm_time" "0.0"
- // Player behaviour
- "immunity_mode" "0"
- "immunity_amount" "0.0"
+ // Player behavior
+ "immunity_mode" "none"
+ "immunity_amount" "0"
"no_fall_damage" "yes"
"health" "200"
@@ -437,9 +446,9 @@
"has_napalm" "yes"
"napalm_time" "0.0"
- // Player behaviour
- "immunity_mode" "0"
- "immunity_amount" "0.0"
+ // Player behavior
+ "immunity_mode" "none"
+ "immunity_amount" "0"
"no_fall_damage" "yes"
"health" "200"
@@ -481,9 +490,9 @@
"has_napalm" "no"
"napalm_time" "0.0"
- // Player behaviour
- "immunity_mode" "0"
- "immunity_amount" "0.0"
+ // Player behavior
+ "immunity_mode" "none"
+ "immunity_amount" "0"
"no_fall_damage" "0"
"health" "100"
@@ -525,9 +534,9 @@
"has_napalm" "yes"
"napalm_time" "0.0"
- // Player behaviour
- "immunity_mode" "0"
- "immunity_amount" "0.0"
+ // Player behavior
+ "immunity_mode" "none"
+ "immunity_amount" "0"
"no_fall_damage" "yes"
"health" "100"
diff --git a/src/zombiereloaded.sp b/src/zombiereloaded.sp
index 06318af..09a4f48 100644
--- a/src/zombiereloaded.sp
+++ b/src/zombiereloaded.sp
@@ -55,6 +55,7 @@
// Header includes.
#include "zr/log.h"
#include "zr/models.h"
+#include "zr/immunityhandler.h"
#if defined ADD_VERSION_INFO
#include "zr/hgversion.h"
@@ -89,6 +90,7 @@
#include "zr/roundstart"
#include "zr/roundend"
#include "zr/infect"
+#include "zr/immunityhandler"
#include "zr/damage"
#include "zr/event"
#include "zr/zadmin"
diff --git a/src/zr/immunityhandler.h.inc b/src/zr/immunityhandler.h.inc
new file mode 100644
index 0000000..7181634
--- /dev/null
+++ b/src/zr/immunityhandler.h.inc
@@ -0,0 +1,41 @@
+/*
+ * ============================================================================
+ *
+ * Zombie:Reloaded
+ *
+ * File: immunityhandler.h.inc
+ * Type: Header
+ * Description: Immunity modes.
+ *
+ * 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 .
+ *
+ * ============================================================================
+ */
+
+/**
+ * Immunity modes.
+ */
+enum ImmunityMode
+{
+ Immunity_Invalid = -1, /** Invalid immunity mode. Used by validators. */
+ Immunity_None, /** No immunity mode. */
+
+ Immunity_Full, /** Completely immune. Humans can't be infected, zombies don't receive damage or knock back. Admin commands may override this. */
+ Immunity_Infect, /** Humans are immune to infections until HP go below a threshold. Threshold at zero enable stabbing to death. */
+ Immunity_Damage, /** Zombies are immune to damage from humans/grenades, but still vulnerable to knock back. */
+ Immunity_Delay, /** Delay infection for a certain amount of seconds. */
+ Immunity_Shield /** Shield against infections (humans) or knock back (zombies) for a certain amount of seconds (similar to TF2's übercharge). */
+}
diff --git a/src/zr/immunityhandler.inc b/src/zr/immunityhandler.inc
new file mode 100644
index 0000000..ef3369a
--- /dev/null
+++ b/src/zr/immunityhandler.inc
@@ -0,0 +1,234 @@
+/*
+ * ============================================================================
+ *
+ * Zombie:Reloaded
+ *
+ * File: immunityhandler.inc
+ * Type: Core module
+ * Description: Manages infection immunity modes for every player.
+ *
+ * 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 .
+ *
+ * ============================================================================
+ */
+
+/**
+ * Current immunity modes.
+ */
+new ImmunityMode:PlayerImmunityMode[MAXPLAYERS + 1] = {Immunity_None, ...};
+
+/**
+ * Timers for handling timed immunity actions.
+ */
+new Handle:PlayerImmunityTimer[MAXPLAYERS + 1] = {INVALID_HANDLE, ...};
+
+/**
+ * Last time a temporary immunity action was used (currently just shield mode).
+ * Used with cooldown of actions.
+ */
+new PlayerImmunityLastUse[MAXPLAYERS + 1] = {-1, ...};
+
+/**
+ * Handles immunity when a client is about to be infected. This function may
+ * delay or block infection according to the immunity mode class settings.
+ *
+ * @param client Client that's being infected.
+ *
+ * @return True if infection will be handled by this module, false if
+ * infection can be applied instantly.
+ */
+bool:ImmunityOnClientInfect(client)
+{
+ // Get immunity data from client class.
+ new ImmunityMode:mode = ClassGetImmunityMode(client);
+
+ // Check mode.
+ switch(mode)
+ {
+ case Immunity_None:
+ {
+ // Instant infection.
+ return false;
+ }
+ case Immunity_Full:
+ {
+ // Full immunity, do nothing.
+ return true;
+ }
+ case Immunity_Damage:
+ {
+ return ImmunityDamageModeHandler(client);
+ }
+ case Immunity_Delay:
+ {
+ return ImmunityDelayModeHandler(client);
+ }
+ case Immunity_Shield:
+ {
+ return ImmunityShieldModeHandler(client);
+ }
+ default:
+ {
+ ThrowError("Invalid immunity mode. This is a bug in ZR.");
+ return true;
+ }
+ }
+}
+
+/**
+ * Client is about to receive damage (zombie).
+ *
+ * @param Client that's receiving damage.
+ *
+ * @return True if damage should be blocked, false otherwise.
+ */
+bool:ImmunityOnClientHurt(client)
+{
+}
+
+/**
+ * Client is about to receive knock back (zombie).
+ *
+ * @param Client that's receiving knock back.
+ *
+ * @return True if knock back should be blocked, false otherwise.
+ */
+bool:ImmunityOnClientKnockBack(client)
+{
+}
+
+/**
+ * Handles damage mode immunity.
+ *
+ * @param client Client that's being infected.
+ *
+ * @return True if infection will be handled by this module, false if
+ * infection can be applied instantly.
+ */
+bool:ImmunityDamageModeHandler(client)
+{
+}
+
+/**
+ * Handles delayed infections.
+ *
+ * @param client Client that's being infected.
+ *
+ * @return True if infection will be handled by this module, false if
+ * infection can be applied instantly.
+ */
+bool:ImmunityDelayModeHandler(client)
+{
+}
+
+/**
+ * Handles shield mode immunity.
+ *
+ * @param client Client that's being infected.
+ *
+ * @return True if infection will be handled by this module, false if
+ * infection can be applied instantly.
+ */
+bool:ImmunityShieldModeHandler(client)
+{
+}
+
+/**
+ * Aborts any immunity mode in action (shields, delays, etc.).
+ *
+ * @param client Client that's aborting immunity mode actions.
+ */
+ImmunityAbortHandler(client)
+{
+ // TODO: Stop timers, disable shield.
+}
+
+ImmunityAbortAll()
+{
+}
+
+ImmunityOnClientHuman(client)
+{
+}
+
+ImmunityOnClientDeath(client, attacker)
+{
+}
+
+ImmunityClientInit(client)
+{
+ // Abord old actions, initialize variables.
+}
+
+ImmunityOnClientDisconnect(client, attacker)
+{
+}
+
+ImmunityOnClientTeam(client, team)
+{
+}
+
+ImmunityOnRoundEnd()
+{
+ ImmunityAbortAll();
+}
+
+ImmunityOnMapEnd()
+{
+ ImmunityAbortAll();
+}
+
+/**
+ * Converts a string to an immunity mode.
+ *
+ * @param mode String to convert.
+ *
+ * @return Immunity mode or Immunity_Invalid on error.
+ */
+ImmunityMode:ImmunityStringToMode(const String:mode[])
+{
+ if (strlen(mode) == 0)
+ {
+ return Immunity_Invalid;
+ }
+
+ if (StrEqual(mode, "none", false))
+ {
+ return Immunity_None;
+ }
+ else if (StrEqual(mode, "full", false))
+ {
+ return Immunity_Full;
+ }
+ else if (StrEqual(mode, "infect", false))
+ {
+ return Immunity_Infect;
+ }
+ else if (StrEqual(mode, "damage", false))
+ {
+ return Immunity_Damage;
+ }
+ else if (StrEqual(mode, "delay", false))
+ {
+ return Immunity_Delay;
+ }
+ else if (StrEqual(mode, "shield", false))
+ {
+ return Immunity_Shield;
+ }
+
+ return Immunity_Invalid;
+}
diff --git a/src/zr/playerclasses/attributes.inc b/src/zr/playerclasses/attributes.inc
index c16471f..84d31e2 100644
--- a/src/zr/playerclasses/attributes.inc
+++ b/src/zr/playerclasses/attributes.inc
@@ -640,7 +640,7 @@ stock Float:ClassGetNapalmTime(index, cachetype = ZR_CLASS_CACHE_PLAYER)
*/
/**
- * Gets the immunity mode to the specified class.
+ * Gets the immunity mode for the specified class.
*
* @param index Index of the class in a class cache or a client index,
* depending on the cache type specified.
@@ -649,9 +649,10 @@ stock Float:ClassGetNapalmTime(index, cachetype = ZR_CLASS_CACHE_PLAYER)
* ZR_CLASS_CACHE_MODIFIED - Changed/newest class data.
* ZR_CLASS_CACHE_PLAYER (default) - Player cache. If this one
* is used, index will be used as a client index.
- * @return Current immunity mode to the specified class. -1 on error.
+ * @return Current immunity mode to the specified class. Immunity_Invalid on
+ * error.
*/
-stock ClassGetImmunityMode(index, cachetype = ZR_CLASS_CACHE_PLAYER)
+stock ImmunityMode:ClassGetImmunityMode(index, cachetype = ZR_CLASS_CACHE_PLAYER)
{
switch (cachetype)
{
@@ -668,11 +669,11 @@ stock ClassGetImmunityMode(index, cachetype = ZR_CLASS_CACHE_PLAYER)
return ClassPlayerCache[index][Class_ImmunityMode];
}
}
- return -1;
+ return Immunity_Invalid;
}
/**
- * Gets the immunity amount to the specified class.
+ * Gets the immunity amount for the specified class.
*
* @param index Index of the class in a class cache or a client index,
* depending on the cache type specified.
@@ -681,9 +682,9 @@ stock ClassGetImmunityMode(index, cachetype = ZR_CLASS_CACHE_PLAYER)
* ZR_CLASS_CACHE_MODIFIED - Changed/newest class data.
* ZR_CLASS_CACHE_PLAYER (default) - Player cache. If this one
* is used, index will be used as a client index.
- * @return Current immunity amount to the specified class. -1.0 on error.
+ * @return Current immunity amount fot the specified class. -1 on error.
*/
-stock Float:ClassGetImmunityAmount(index, cachetype = ZR_CLASS_CACHE_PLAYER)
+stock ClassGetImmunityAmount(index, cachetype = ZR_CLASS_CACHE_PLAYER)
{
switch (cachetype)
{
@@ -700,7 +701,39 @@ stock Float:ClassGetImmunityAmount(index, cachetype = ZR_CLASS_CACHE_PLAYER)
return ClassPlayerCache[index][Class_ImmunityAmount];
}
}
- return -1.0;
+ return -1;
+}
+
+/**
+ * Gets the immunity cooldown for the specified class.
+ *
+ * @param index Index of the class in a class cache or a client index,
+ * depending on the cache type specified.
+ * @param cachetype Optional. Specifies what class cache to read from. Options:
+ * ZR_CLASS_CACHE_ORIGINAL - Unchanced class data.
+ * ZR_CLASS_CACHE_MODIFIED - Changed/newest class data.
+ * ZR_CLASS_CACHE_PLAYER (default) - Player cache. If this one
+ * is used, index will be used as a client index.
+ * @return Current immunity cooldown for the specified class. -1 on error.
+ */
+stock ClassGetImmunityCooldown(index, cachetype = ZR_CLASS_CACHE_PLAYER)
+{
+ switch (cachetype)
+ {
+ case ZR_CLASS_CACHE_ORIGINAL:
+ {
+ return ClassData[index][Class_ImmunityCooldown];
+ }
+ case ZR_CLASS_CACHE_MODIFIED:
+ {
+ return ClassDataCache[index][Class_ImmunityCooldown];
+ }
+ case ZR_CLASS_CACHE_PLAYER:
+ {
+ return ClassPlayerCache[index][Class_ImmunityCooldown];
+ }
+ }
+ return -1;
}
/**
diff --git a/src/zr/playerclasses/filtertools.inc b/src/zr/playerclasses/filtertools.inc
index 6171d93..f6637cb 100644
--- a/src/zr/playerclasses/filtertools.inc
+++ b/src/zr/playerclasses/filtertools.inc
@@ -103,8 +103,6 @@ stock bool:ClassValidateTeamDefaults(cachetype = ZR_CLASS_CACHE_ORIGINAL)
*/
stock ClassValidateAttributes(classindex, bool:logErrors = false)
{
- // TODO: Validate immunity mode and amount.
-
new flags;
// Team.
@@ -287,8 +285,19 @@ stock ClassValidateAttributes(classindex, bool:logErrors = false)
}
}
- // Immunity mode (not implemented).
+ // Immunity mode.
+ new ImmunityMode:immunityMode = ClassData[classindex][Class_ImmunityMode];
+ if (immunityMode == Immunity_Invalid)
+ {
+ flags += ZR_CLASS_IMMUNITY_MODE;
+ if (logErrors)
+ {
+ LogEvent(false, LogType_Error, LOG_CORE_EVENTS, LogModule_Playerclasses, "Config Validation", "Warning: Invalid immunity_mode at index %d.", classindex);
+ }
+ }
+ // Immunity amount.
+ // TODO: Validate amount value. This depends on the immunity mode.
// Health.
new health = ClassData[classindex][Class_Health];
@@ -484,8 +493,16 @@ stock ClassValidateEditableAttributes(attributes[ClassEditableAttributes])
}
}
- // Immunity mode not implemented yet.
-
+ // Immunity mode.
+ new ImmunityMode:immunityMode = attributes[ClassEdit_ImmunityMode];
+ if (immunityMode == Immunity_Invalid)
+ {
+ flags += ZR_CLASS_IMMUNITY_MODE;
+ }
+
+ // Immunity amount.
+ // TODO: Validate amount value. This depends on the immunity mode.
+
// Health regen interval.
new Float:healthRegenInterval = attributes[ClassEdit_RegenInterval];
if (healthRegenInterval >= 0.0)
diff --git a/src/zr/playerclasses/playerclasses.inc b/src/zr/playerclasses/playerclasses.inc
index f3f42bf..02d9af0 100644
--- a/src/zr/playerclasses/playerclasses.inc
+++ b/src/zr/playerclasses/playerclasses.inc
@@ -115,8 +115,9 @@
#define ZR_CLASS_DEFAULT_FOV 90
#define ZR_CLASS_DEFAULT_HAS_NAPALM "no"
#define ZR_CLASS_DEFAULT_NAPALM_TIME 10.0
-#define ZR_CLASS_DEFAULT_IMMUNITY_MODE ZR_CLASS_IMMUNITY_DISABLED
-#define ZR_CLASS_DEFAULT_IMMUNITY_AMOUNT 0.0
+#define ZR_CLASS_DEFAULT_IMMUNITY_MODE "none"
+#define ZR_CLASS_DEFAULT_IMMUNITY_AMOUNT 1
+#define ZR_CLASS_DEFAULT_IMMUNITY_COOLDOWN 60
#define ZR_CLASS_DEFAULT_NO_FALL_DAMAGE "yes"
#define ZR_CLASS_DEFAULT_HEALTH 6000
#define ZR_CLASS_DEFAULT_HEALTH_REGEN_INTERVAL 0.0
@@ -152,6 +153,8 @@
#define ZR_CLASS_FOV_MAX 165
#define ZR_CLASS_NAPALM_TIME_MIN 0.0
#define ZR_CLASS_NAPALM_TIME_MAX 600.0
+#define ZR_CLASS_IMMUNITY_COOLDOWN_MIN 0
+#define ZR_CLASS_IMMUNITY_COOLDOWN_MAX 600
#define ZR_CLASS_HEALTH_MIN 1
#define ZR_CLASS_HEALTH_MAX 20000
#define ZR_CLASS_REGEN_INTERVAL_MIN 0.0
@@ -198,16 +201,17 @@
#define ZR_CLASS_NAPALM_TIME (1<<15)
#define ZR_CLASS_IMMUNITY_MODE (1<<16)
#define ZR_CLASS_IMMUNITY_AMOUNT (1<<17)
-#define ZR_CLASS_NO_FALL_DAMAGE (1<<18)
-#define ZR_CLASS_HEALTH (1<<19)
-#define ZR_CLASS_HEALTH_REGEN_INTERVAL (1<<20)
-#define ZR_CLASS_HEALTH_REGEN_AMOUNT (1<<21)
-#define ZR_CLASS_HEALTH_INFECT_GAIN (1<<22)
-#define ZR_CLASS_KILL_BONUS (1<<23)
-#define ZR_CLASS_SPEED (1<<24)
-#define ZR_CLASS_KNOCKBACK (1<<25)
-#define ZR_CLASS_JUMP_HEIGHT (1<<26)
-#define ZR_CLASS_JUMP_DISTANCE (1<<27)
+#define ZR_CLASS_IMMUNITY_COOLDOWN (1<<18)
+#define ZR_CLASS_NO_FALL_DAMAGE (1<<19)
+#define ZR_CLASS_HEALTH (1<<20)
+#define ZR_CLASS_HEALTH_REGEN_INTERVAL (1<<21)
+#define ZR_CLASS_HEALTH_REGEN_AMOUNT (1<<22)
+#define ZR_CLASS_HEALTH_INFECT_GAIN (1<<23)
+#define ZR_CLASS_KILL_BONUS (1<<24)
+#define ZR_CLASS_SPEED (1<<25)
+#define ZR_CLASS_KNOCKBACK (1<<26)
+#define ZR_CLASS_JUMP_HEIGHT (1<<27)
+#define ZR_CLASS_JUMP_DISTANCE (1<<28)
/**
* @endsection
*/
@@ -258,8 +262,9 @@ enum ClassAttributes
Float:Class_NapalmTime,
/* Player behaviour */
- Class_ImmunityMode,
- Float:Class_ImmunityAmount,
+ ImmunityMode:Class_ImmunityMode,
+ Class_ImmunityAmount,
+ Class_ImmunityCooldown,
bool:Class_NoFallDamage,
Class_Health,
@@ -300,9 +305,10 @@ enum ClassEditableAttributes
ClassEdit_HasNapalm,
Float:ClassEdit_NapalmTime,
- /* Player behaviour */
- ClassEdit_ImmunityMode,
- Float:ClassEdit_ImmunityAmount,
+ /* Player behavior */
+ ImmunityMode:ClassEdit_ImmunityMode,
+ ClassEdit_ImmunityAmount,
+ ClassEdit_ImmunityCooldown,
ClassEdit_NoFallDamage,
Float:ClassEdit_RegenInterval,
@@ -398,13 +404,13 @@ new ClassNoFilter[ClassFilter];
new ClassNoSpecialClasses[ClassFilter] = {false, 0, ZR_CLASS_SPECIALFLAGS, -1};
/**
- * The original class data. This array only changed when class data is loaded.
- * ZR_CLASS_CACHE_ORIGINAL is the cache type to this array.
+ * The original class data. This array is only changed when class data is
+ * loaded. ZR_CLASS_CACHE_ORIGINAL is the cache type to this array.
*/
new ClassData[ZR_CLASS_MAX][ClassAttributes];
/**
- * The class thata cache that can be modified. ZR_CLASS_CACHE_MODIFIED is the
+ * The class data cache that can be modified. ZR_CLASS_CACHE_MODIFIED is the
* cache type to this array.
*/
new ClassDataCache[ZR_CLASS_MAX][ClassAttributes];
@@ -545,11 +551,12 @@ ClassLoad()
LogEvent(false, LogType_Fatal, LOG_CORE_EVENTS, LogModule_Playerclasses, "Config Validation", "Can't find any classes in \"%s\"", pathclasses);
}
- decl String:name[64];
- decl String:group[64];
- decl String:description[256];
- decl String:model_path[PLATFORM_MAX_PATH];
- decl String:overlay_path[PLATFORM_MAX_PATH];
+ new String:name[64];
+ new String:group[64];
+ new String:description[256];
+ new String:model_path[PLATFORM_MAX_PATH];
+ new String:immunity_mode[32];
+ new String:overlay_path[PLATFORM_MAX_PATH];
ClassCount = 0;
new failedcount;
@@ -605,8 +612,9 @@ ClassLoad()
/* Player behaviour */
- ClassData[ClassCount][Class_ImmunityMode] = KvGetNum(kvClassData, "immunity_mode", ZR_CLASS_DEFAULT_IMMUNITY_MODE);
- ClassData[ClassCount][Class_ImmunityAmount] = KvGetFloat(kvClassData, "immunity_amount", ZR_CLASS_DEFAULT_IMMUNITY_AMOUNT);
+ KvGetString(kvClassData, "immunity_mode", immunity_mode, sizeof(immunity_mode), ZR_CLASS_DEFAULT_IMMUNITY_MODE);
+ ClassData[ClassCount][Class_ImmunityMode] = ImmunityStringToMode(immunity_mode);
+ ClassData[ClassCount][Class_ImmunityAmount] = KvGetNum(kvClassData, "immunity_amount", ZR_CLASS_DEFAULT_IMMUNITY_AMOUNT);
ClassData[ClassCount][Class_NoFallDamage] = ConfigKvGetStringBool(kvClassData, "no_fall_damage", ZR_CLASS_DEFAULT_NO_FALL_DAMAGE);
ClassData[ClassCount][Class_Health] = KvGetNum(kvClassData, "health", ZR_CLASS_DEFAULT_HEALTH);
diff --git a/src/zr/volfeatures/volclassedit.inc b/src/zr/volfeatures/volclassedit.inc
index 529f680..0536f26 100644
--- a/src/zr/volfeatures/volclassedit.inc
+++ b/src/zr/volfeatures/volclassedit.inc
@@ -41,8 +41,9 @@ new VolEmptyAttributes[ClassEditableAttributes] = {
-1, /** HasNapalm */
-1.0, /** NapalmTime */
- -1, /** ImmunityMode */
- -1.0, /** ImmunityAmount */
+ Immunity_Invalid, /** ImmunityMode */
+ -1, /** ImmunityAmount */
+ -1, /** ImmunityCooldown */
-1, /** NoFallDamage */
-1.0, /** RegenInterval */