Fixes in class system. See details.

Fixed admin classes assigned to non-admin when zr_classes_random is 1.
Fixed mother zombie classes not assigned when they should be.
Fixed improved class skills on mother infection also applied to mother zombie classes.
Updated class configuration with new special classes.
This commit is contained in:
richard 2009-07-08 02:16:29 +02:00
parent cf429d2e0f
commit d6b5edd289
4 changed files with 219 additions and 21 deletions

View File

@ -1,9 +1,8 @@
// ============================================================================ // ============================================================================
// //
// ZOMBIE:RELOADED // Zombie:Reloaded Class configuration
// Class configuration
// //
// Check the class configuration section in the manual for detailed info. // Check Class Configuration (3.7) in the manual for detailed info.
// //
// ============================================================================ // ============================================================================
// //
@ -52,7 +51,7 @@
// Zombie classes // Zombie classes
// //
// ------------------------------------------ // ------------------------------------------
"classic" "zombie_classic"
{ {
// General // General
"enabled" "1" "enabled" "1"
@ -95,7 +94,7 @@
"jump_distance" "1.2" "jump_distance" "1.2"
} }
"fast" "zombie_fast"
{ {
// General // General
"enabled" "1" "enabled" "1"
@ -138,7 +137,7 @@
"jump_distance" "1.2" "jump_distance" "1.2"
} }
"mutated" "zombie_mutated"
{ {
// General // General
"enabled" "1" "enabled" "1"
@ -181,7 +180,7 @@
"jump_distance" "1.3" "jump_distance" "1.3"
} }
"heavy" "zombie_heavy"
{ {
// General // General
"enabled" "1" "enabled" "1"
@ -224,6 +223,92 @@
"jump_distance" "0.9" "jump_distance" "0.9"
} }
"mother_zombie"
{
// General
"enabled" "1"
"team" "0"
"team_default" "0"
"flags" "2"
"name" "Mother zombie"
"description" "+HP regen | +Speed | +Jump | -Knockback"
// Model
"model_path" "models/player/zh/zh_charple001.mdl"
"alpha_initial" "255"
"alpha_damaged" "255"
"alpha_damage" "0"
// Hud
"overlay_path" "overlays/zr/zvision"
"nvgs" "0"
"fov" "110"
// Effects
"has_napalm" "0"
"napalm_time" "5.0"
// Player behaviour
"immunity_mode" "0"
"immunity_amount" "0.0"
"no_fall_damage" "1"
"health" "2500"
"health_regen_interval" "0.25"
"health_regen_amount" "10"
"health_infect_gain" "700"
"kill_bonus" "1"
"speed" "400"
"knockback" "2.8"
"jump_height" "1.2"
"jump_distance" "1.3"
}
"mother_zombie_admin"
{
// General
"enabled" "1"
"team" "0"
"team_default" "0"
"flags" "3"
"name" "Admin mother zombie"
"description" "+HP regen | +Speed | +Jump | -Knockback"
// Model
"model_path" "models/player/zh/zh_charple001.mdl"
"alpha_initial" "255"
"alpha_damaged" "255"
"alpha_damage" "0"
// Hud
"overlay_path" "overlays/zr/zvision"
"nvgs" "0"
"fov" "110"
// Effects
"has_napalm" "0"
"napalm_time" "3.0"
// Player behaviour
"immunity_mode" "0"
"immunity_amount" "0.0"
"no_fall_damage" "1"
"health" "3500"
"health_regen_interval" "0.25"
"health_regen_amount" "10"
"health_infect_gain" "700"
"kill_bonus" "1"
"speed" "425"
"knockback" "2.8"
"jump_height" "1.2"
"jump_distance" "1.3"
}
// ------------------------------------------ // ------------------------------------------
// //
// Human classes // Human classes
@ -273,6 +358,92 @@
"jump_distance" "1.0" "jump_distance" "1.0"
} }
"human_vip"
{
// General
"enabled" "1"
"team" "1"
"team_default" "0"
"flags" "0"
"name" "VIP Human"
"description" "Human class for important players"
// Model
"model_path" "default"
"alpha_initial" "255"
"alpha_damaged" "255"
"alpha_damage" "0"
// Hud
"overlay_path" ""
"nvgs" "0"
"fov" "90"
// Effects
"has_napalm" "1"
"napalm_time" "0.0"
// Player behaviour
"immunity_mode" "0"
"immunity_amount" "0.0"
"no_fall_damage" "0"
"health" "200"
"health_regen_interval" "1.0"
"health_regen_amount" "10"
"health_infect_gain" "0"
"kill_bonus" "2"
"speed" "320"
"knockback" "0"
"jump_height" "1.1"
"jump_distance" "1.1"
}
"human_admin"
{
// General
"enabled" "1"
"team" "1"
"team_default" "0"
"flags" "1"
"name" "Admin Human"
"description" "Human class for admins"
// Model
"model_path" "default"
"alpha_initial" "255"
"alpha_damaged" "255"
"alpha_damage" "0"
// Hud
"overlay_path" ""
"nvgs" "0"
"fov" "90"
// Effects
"has_napalm" "1"
"napalm_time" "0.0"
// Player behaviour
"immunity_mode" "0"
"immunity_amount" "0.0"
"no_fall_damage" "1"
"health" "200"
"health_regen_interval" "1.0"
"health_regen_amount" "10"
"health_infect_gain" "0"
"kill_bonus" "2"
"speed" "320"
"knockback" "0"
"jump_height" "1.1"
"jump_distance" "1.1"
}
"human_speedy" "human_speedy"
{ {
// General // General

View File

@ -563,11 +563,12 @@ below.
3.7.1 CLASS TYPES 3.7.1 CLASS TYPES
There are three class types; zombies, humans and admins-only. Default classes There are three class types; zombies, humans and admin-mode. Default classes
are selected on the player depending on console variables and the class file. are selected on the player depending on console variables and the class file.
Admins-only classes are currently incomplete and will be validated, but ignored Admin-mode classes are currently incomplete and will be validated, but ignored
in the game. in the game. This is a special mode in the game, but not the same as admin-only
classes.
3.7.2 CLASS ATTRIBUTES 3.7.2 CLASS ATTRIBUTES
@ -590,12 +591,14 @@ The list below explains all available class attributes in detail:
0 - Zombie classes 0 - Zombie classes
1 - Human classes 1 - Human classes
2 - Admin-only classes 2 - Admin-mode classes
The admin class type sets the player in spectacting like mode, but The admin class type sets the player in spectacting like mode, but
allows admins to walk around. They can't take or give damage, and they allows admins to walk around. They can't take or give damage, and they
won't affect the game rules in any way. This feature is incomplete and won't affect the game rules in any way. This feature is incomplete and
classes of this type is ignored in the game. classes of this type is ignored in the game.
See the "flags" attribute for admin-only classes.
team_default boolean 0 or 1 team_default boolean 0 or 1
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
@ -855,7 +858,7 @@ Class console variables:
"default" - Use the default class in the class configuration. "default" - Use the default class in the class configuration.
"random" - Select a random class from the class configuration. "random" - Select a random class from the class configuration.
zr_classes_default_mother_zombie "random" zr_classes_default_mother_zombie "motherzombies"
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
Default mother zombie class to be set on mother zombies. If no mother Default mother zombie class to be set on mother zombies. If no mother
zombie class exist it will use the class selected by the player. zombie class exist it will use the class selected by the player.
@ -878,8 +881,8 @@ Class console variables:
zr_classes_default_admin "random" zr_classes_default_admin "random"
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
Default admin class selected for all players when they connect, if any Default admin-mode class selected for all players when they connect, if
admin class found. found. This feature is incomplete and ignored.
Options: Options:
<class name> - Specify a class name to use as default. <class name> - Specify a class name to use as default.

View File

@ -236,7 +236,7 @@ CvarsCreate()
g_hCvarsList[CVAR_CLASSES_SPAWN] = CreateConVar("zr_classes_spawn", "0", "Re-display class selection menu every spawn."); g_hCvarsList[CVAR_CLASSES_SPAWN] = CreateConVar("zr_classes_spawn", "0", "Re-display class selection menu every spawn.");
g_hCvarsList[CVAR_CLASSES_RANDOM] = CreateConVar("zr_classes_random", "0", "Player is assigned a random class every spawn. [Override: zr_classes_spawn and zr_classes_default_*]"); g_hCvarsList[CVAR_CLASSES_RANDOM] = CreateConVar("zr_classes_random", "0", "Player is assigned a random class every spawn. [Override: zr_classes_spawn and zr_classes_default_*]");
g_hCvarsList[CVAR_CLASSES_DEFAULT_ZOMBIE] = CreateConVar("zr_classes_default_zombie", "random", "Zombie class assigned to players on connect. [\"random\" = Random zombie class | \"\" = Class config default]"); g_hCvarsList[CVAR_CLASSES_DEFAULT_ZOMBIE] = CreateConVar("zr_classes_default_zombie", "random", "Zombie class assigned to players on connect. [\"random\" = Random zombie class | \"\" = Class config default]");
g_hCvarsList[CVAR_CLASSES_DEFAULT_M_ZOMB] = CreateConVar("zr_classes_default_mother_zombie", "random", "Zombie class assigned to mother zombies. [\"motherzombies\" = Random mother zombie class | \"random\" = Random regular zombie class | \"disabled\" = Don't change class on mother zombies]"); g_hCvarsList[CVAR_CLASSES_DEFAULT_M_ZOMB] = CreateConVar("zr_classes_default_mother_zombie", "motherzombies","Zombie class assigned to mother zombies. [\"motherzombies\" = Random mother zombie class | \"random\" = Random regular zombie class | \"disabled\" = Don't change class on mother zombies]");
g_hCvarsList[CVAR_CLASSES_DEFAULT_HUMAN] = CreateConVar("zr_classes_default_human", "random", "Human class assigned to players on connect. [\"random\" = Random human class | \"\" = Class config default]"); g_hCvarsList[CVAR_CLASSES_DEFAULT_HUMAN] = CreateConVar("zr_classes_default_human", "random", "Human class assigned to players on connect. [\"random\" = Random human class | \"\" = Class config default]");
g_hCvarsList[CVAR_CLASSES_DEFAULT_ADMIN] = CreateConVar("zr_classes_default_admin", "random", "Admin class assigned to admins on connect. [\"random\" = Random admin class | \"\" = Class config default]"); g_hCvarsList[CVAR_CLASSES_DEFAULT_ADMIN] = CreateConVar("zr_classes_default_admin", "random", "Admin class assigned to admins on connect. [\"random\" = Random admin class | \"\" = Class config default]");

View File

@ -93,6 +93,12 @@ ClassOnClientSpawn(client)
GetClientModel(client, originalmodel, sizeof(originalmodel)); GetClientModel(client, originalmodel, sizeof(originalmodel));
strcopy(ClassOriginalPlayerModel[client], PLATFORM_MAX_PATH, originalmodel); strcopy(ClassOriginalPlayerModel[client], PLATFORM_MAX_PATH, originalmodel);
// Exclude special class flags like mother zombies and admin classes.
new denyflags = ZR_CLASS_SPECIALFLAGS;
// Allow admin classes if admin.
denyflags -= ZRIsClientAdmin(client) ? ZR_CLASS_FLAG_ADMIN_ONLY : 0;
// Get random class setting. // Get random class setting.
new bool:randomclass = GetConVarBool(g_hCvarsList[CVAR_CLASSES_RANDOM]); new bool:randomclass = GetConVarBool(g_hCvarsList[CVAR_CLASSES_RANDOM]);
@ -101,15 +107,15 @@ ClassOnClientSpawn(client)
if (randomclass || StrEqual(steamid, "BOT")) if (randomclass || StrEqual(steamid, "BOT"))
{ {
// Get random classes for each type. // Get random classes for each type.
new randomzombie = ClassGetRandomClass(ZR_CLASS_TEAM_ZOMBIES); new randomzombie = ClassGetRandomClass(ZR_CLASS_TEAM_ZOMBIES, _, _, denyflags);
new randomhuman = ClassGetRandomClass(ZR_CLASS_TEAM_HUMANS); new randomhuman = ClassGetRandomClass(ZR_CLASS_TEAM_HUMANS, _, _, denyflags);
// Mark zombie class as selected. // Save selected zombie class index.
ClassSelected[client][ZR_CLASS_TEAM_ZOMBIES] = randomzombie; ClassSelected[client][ZR_CLASS_TEAM_ZOMBIES] = randomzombie;
ClassGetName(randomzombie, classname, sizeof(classname), ZR_CLASS_TEAM_ZOMBIES); ClassGetName(randomzombie, classname, sizeof(classname), ZR_CLASS_TEAM_ZOMBIES);
TranslationPrintToChat(client, "Classes random assignment", classname); TranslationPrintToChat(client, "Classes random assignment", classname);
// Mark human class as selected. // Save selected human class index.
ClassSelected[client][ZR_CLASS_TEAM_HUMANS] = randomhuman; ClassSelected[client][ZR_CLASS_TEAM_HUMANS] = randomhuman;
ClassGetName(randomhuman, classname, sizeof(classname), ZR_CLASS_TEAM_HUMANS); ClassGetName(randomhuman, classname, sizeof(classname), ZR_CLASS_TEAM_HUMANS);
TranslationPrintToChat(client, "Classes random assignment", classname); TranslationPrintToChat(client, "Classes random assignment", classname);
@ -193,11 +199,29 @@ ClassOnClientInfected(client, bool:motherzombie = false)
{ {
// Get random regular zombie class. Remove admin flag if admin. // Get random regular zombie class. Remove admin flag if admin.
motherindex = ClassGetRandomClass(ZR_CLASS_TEAM_ZOMBIES, _, _, ZR_CLASS_SPECIALFLAGS - isadmin); motherindex = ClassGetRandomClass(ZR_CLASS_TEAM_ZOMBIES, _, _, ZR_CLASS_SPECIALFLAGS - isadmin);
// Validate index. Do not change class if it's invalid.
if (ClassValidateIndex(motherindex))
{
// Change class.
classindex = motherindex;
}
} }
else if (StrEqual(motherzombiesetting, "motherzombies", false)) else if (StrEqual(motherzombiesetting, "motherzombies", false))
{ {
// Get random mother zombie class. // Get random mother zombie class. Include admin classes if admin.
motherindex = ClassGetRandomClass(ZR_CLASS_TEAM_ZOMBIES, _, ZR_CLASS_FLAG_MOTHER_ZOMBIE, isadmin); motherindex = ClassGetRandomClass(ZR_CLASS_TEAM_ZOMBIES, _, ZR_CLASS_FLAG_MOTHER_ZOMBIE + isadmin, ZR_CLASS_FLAG_ADMIN_ONLY - isadmin);
// Validate index. Do not change class if it's invalid.
if (ClassValidateIndex(motherindex))
{
// This is a mother zombie class. Reset mother zombie setting so
// class skills aren't improved.
motherzombie = false;
// Change class.
classindex = motherindex;
}
} }
else else
{ {