From d6b5edd28902627d17419bdfcdc655b6b658026b Mon Sep 17 00:00:00 2001 From: richard Date: Wed, 8 Jul 2009 02:16:29 +0200 Subject: [PATCH] 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. --- .../sourcemod/configs/zr/playerclasses.txt | 185 +++++++++++++++++- docs/zr_manual.txt | 17 +- src/zr/cvars.inc | 2 +- src/zr/playerclasses/classevents.inc | 36 +++- 4 files changed, 219 insertions(+), 21 deletions(-) diff --git a/cstrike/addons/sourcemod/configs/zr/playerclasses.txt b/cstrike/addons/sourcemod/configs/zr/playerclasses.txt index e353721..fc6417f 100644 --- a/cstrike/addons/sourcemod/configs/zr/playerclasses.txt +++ b/cstrike/addons/sourcemod/configs/zr/playerclasses.txt @@ -1,9 +1,8 @@ // ============================================================================ // -// ZOMBIE:RELOADED -// Class configuration +// Zombie:Reloaded 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 // // ------------------------------------------ - "classic" + "zombie_classic" { // General "enabled" "1" @@ -95,7 +94,7 @@ "jump_distance" "1.2" } - "fast" + "zombie_fast" { // General "enabled" "1" @@ -138,7 +137,7 @@ "jump_distance" "1.2" } - "mutated" + "zombie_mutated" { // General "enabled" "1" @@ -181,7 +180,7 @@ "jump_distance" "1.3" } - "heavy" + "zombie_heavy" { // General "enabled" "1" @@ -224,6 +223,92 @@ "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 @@ -273,6 +358,92 @@ "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" { // General diff --git a/docs/zr_manual.txt b/docs/zr_manual.txt index f9e00ba..4955a32 100644 --- a/docs/zr_manual.txt +++ b/docs/zr_manual.txt @@ -563,11 +563,12 @@ below. 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. -Admins-only classes are currently incomplete and will be validated, but ignored -in the game. +Admin-mode classes are currently incomplete and will be validated, but ignored +in the game. This is a special mode in the game, but not the same as admin-only +classes. 3.7.2 CLASS ATTRIBUTES @@ -590,12 +591,14 @@ The list below explains all available class attributes in detail: 0 - Zombie classes 1 - Human classes - 2 - Admin-only classes + 2 - Admin-mode classes 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 won't affect the game rules in any way. This feature is incomplete and classes of this type is ignored in the game. + + See the "flags" attribute for admin-only classes. team_default boolean 0 or 1 --------------------------------------------------------------------------- @@ -855,7 +858,7 @@ Class console variables: "default" - Use the default class in 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 zombie class exist it will use the class selected by the player. @@ -878,8 +881,8 @@ Class console variables: zr_classes_default_admin "random" --------------------------------------------------------------------------- - Default admin class selected for all players when they connect, if any - admin class found. + Default admin-mode class selected for all players when they connect, if + found. This feature is incomplete and ignored. Options: - Specify a class name to use as default. diff --git a/src/zr/cvars.inc b/src/zr/cvars.inc index a0811c8..9426865 100644 --- a/src/zr/cvars.inc +++ b/src/zr/cvars.inc @@ -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_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_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_ADMIN] = CreateConVar("zr_classes_default_admin", "random", "Admin class assigned to admins on connect. [\"random\" = Random admin class | \"\" = Class config default]"); diff --git a/src/zr/playerclasses/classevents.inc b/src/zr/playerclasses/classevents.inc index 17d9802..9dcbada 100644 --- a/src/zr/playerclasses/classevents.inc +++ b/src/zr/playerclasses/classevents.inc @@ -93,6 +93,12 @@ ClassOnClientSpawn(client) GetClientModel(client, originalmodel, sizeof(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. new bool:randomclass = GetConVarBool(g_hCvarsList[CVAR_CLASSES_RANDOM]); @@ -101,15 +107,15 @@ ClassOnClientSpawn(client) if (randomclass || StrEqual(steamid, "BOT")) { // Get random classes for each type. - new randomzombie = ClassGetRandomClass(ZR_CLASS_TEAM_ZOMBIES); - new randomhuman = ClassGetRandomClass(ZR_CLASS_TEAM_HUMANS); + new randomzombie = ClassGetRandomClass(ZR_CLASS_TEAM_ZOMBIES, _, _, denyflags); + 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; ClassGetName(randomzombie, classname, sizeof(classname), ZR_CLASS_TEAM_ZOMBIES); TranslationPrintToChat(client, "Classes random assignment", classname); - // Mark human class as selected. + // Save selected human class index. ClassSelected[client][ZR_CLASS_TEAM_HUMANS] = randomhuman; ClassGetName(randomhuman, classname, sizeof(classname), ZR_CLASS_TEAM_HUMANS); 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. 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)) { - // Get random mother zombie class. - motherindex = ClassGetRandomClass(ZR_CLASS_TEAM_ZOMBIES, _, ZR_CLASS_FLAG_MOTHER_ZOMBIE, isadmin); + // Get random mother zombie class. Include admin classes if admin. + 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 {