From 7a1cf1072b1068c8ade0d6a8f7f6a8cac739e5f6 Mon Sep 17 00:00:00 2001 From: richard Date: Fri, 17 Jul 2009 00:20:09 +0200 Subject: [PATCH 1/2] Fixed typo in docs. --- docs/zr_3.0_release_notes.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/zr_3.0_release_notes.txt b/docs/zr_3.0_release_notes.txt index 97771e5..acd7ab8 100644 --- a/docs/zr_3.0_release_notes.txt +++ b/docs/zr_3.0_release_notes.txt @@ -80,7 +80,7 @@ warning is logged in the SourceMod error logs. The validation prevents unexpected or invalid behaviour in the plugin. Dealing with errors or warnings in error logs helps a lot troubleshooting eventual -eventual issues in the plugin caused by incorrect configurations. +issues in the plugin caused by incorrect configurations. It's also possible to specify the path of configuration files. This can be used in combination with map configs, so it's possible to have different From f403386546185516f0ea85de49804b586cb535b2 Mon Sep 17 00:00:00 2001 From: Greyscale Date: Thu, 16 Jul 2009 18:34:56 -0700 Subject: [PATCH 2/2] Added a "douse" feature to napalm that makes water put out fires. Fixed zr_antistick not disabling the feature. Removed a debug message. Added napalm to logging module. --- .../zombiereloaded/zombiereloaded.cfg | 4 + src/include/zrtools.inc | 1 + src/zr/antistick.inc | 14 ++-- src/zr/cvars.inc | 2 + src/zr/damage.inc | 11 +++ src/zr/log.h.inc | 1 + src/zr/log.inc | 8 ++ src/zr/models.inc | 2 +- src/zr/napalm.inc | 81 ++++++++++++++++++- src/zr/tools.inc | 2 +- src/zr/weapons/weapons.inc | 1 + 11 files changed, 116 insertions(+), 11 deletions(-) diff --git a/cstrike/cfg/sourcemod/zombiereloaded/zombiereloaded.cfg b/cstrike/cfg/sourcemod/zombiereloaded/zombiereloaded.cfg index fd17a27..62f62c3 100644 --- a/cstrike/cfg/sourcemod/zombiereloaded/zombiereloaded.cfg +++ b/cstrike/cfg/sourcemod/zombiereloaded/zombiereloaded.cfg @@ -566,6 +566,10 @@ zr_respawn_team_zombie_world "1" // Default: "1" zr_napalm_ignite "1" +// Minimum water-saturation before flame is extinguished. ['0' = Disabled | '1' = Feet | '2' = Waist | '3' = Full submersion] +// Default: "0" +zr_napalm_douse "0" + // ---------------------------------------------------------------------------- // Jump Boost (module) diff --git a/src/include/zrtools.inc b/src/include/zrtools.inc index ed20afe..c2a6e03 100644 --- a/src/include/zrtools.inc +++ b/src/include/zrtools.inc @@ -91,6 +91,7 @@ native ZRTools_UnhookTraceAttack(hookid); // CS:S Specific damage flags. (should probably use these) #define DMG_CSS_FALL (DMG_FALL) // Client was damaged by falling. #define DMG_CSS_BLAST (DMG_BLAST) // Client was damaged by explosion. +#define DMG_CSS_BURN (DMG_DIRECT) // Client was damaged by fire. #define DMG_CSS_BULLET (DMG_NEVERGIB) // Client was shot or knifed. #define DMG_CSS_HEADSHOT (1 << 30) // Client was shot in the head. diff --git a/src/zr/antistick.inc b/src/zr/antistick.inc index e215445..4f8d3de 100644 --- a/src/zr/antistick.inc +++ b/src/zr/antistick.inc @@ -87,13 +87,6 @@ AntiStickOnCommandsCreate() */ AntiStickLoad() { - // If antistick is disabled, then stop. - new bool:antistick = GetConVarBool(g_hCvarsList[CVAR_ANTISTICK]); - if (!antistick) - { - return; - } - // Create antistick keyvalues if it hasn't been created yet. if (g_kvAntiStick == INVALID_HANDLE) { @@ -255,6 +248,13 @@ stock AntiStickSetModelHullWidth(client, const String:model[] = "", Float:hull_w */ public ZRTools_Action:AntiStickStartTouch(client, entity) { + // If antistick is disabled, then stop. + new bool:antistick = GetConVarBool(g_hCvarsList[CVAR_ANTISTICK]); + if (!antistick) + { + return; + } + // If client isn't in-game, then stop. if (!IsClientInGame(client)) { diff --git a/src/zr/cvars.inc b/src/zr/cvars.inc index 9426865..6a30bbc 100644 --- a/src/zr/cvars.inc +++ b/src/zr/cvars.inc @@ -137,6 +137,7 @@ enum CvarsList Handle:CVAR_RESPAWN_TEAM_ZOMBIE, Handle:CVAR_RESPAWN_TEAM_ZOMBIE_WORLD, Handle:CVAR_NAPALM_IGNITE, + Handle:CVAR_NAPALM_DOUSE, Handle:CVAR_JUMPBOOST_BHOP_PROTECT, Handle:CVAR_JUMPBOOST_BHOP_MAX, Handle:CVAR_VOL, @@ -414,6 +415,7 @@ CvarsCreate() // Napalm (module) // =========================== g_hCvarsList[CVAR_NAPALM_IGNITE] = CreateConVar("zr_napalm_ignite", "1", "Ignite grenade in mid-air after player throws it. [Dependency: Human Attribute 'has_napalm']"); + g_hCvarsList[CVAR_NAPALM_DOUSE] = CreateConVar("zr_napalm_douse", "0", "Minimum water-saturation before flame is extinguished. ['0' = Disabled | '1' = Feet | '2' = Waist | '3' = Full submersion]"); // =========================== diff --git a/src/zr/damage.inc b/src/zr/damage.inc index b261986..e69a5df 100644 --- a/src/zr/damage.inc +++ b/src/zr/damage.inc @@ -231,6 +231,17 @@ public ZRTools_Action:DamageOnTakeDamage(client, inflictor, attacker, Float:dama return ZRTools_Continue; } + new action; + + // Forward this hook to another module an return (or not) what it wants. + action = NapalmOnTakeDamage(client, damagetype); + + // If the napalm module wants to return here, then return the int casted into the ZRTools_Action type. + if (action > -1) + { + return ZRTools_Action:action; + } + // Client was shot or knifed. if (damagetype & DMG_CSS_BULLET) { diff --git a/src/zr/log.h.inc b/src/zr/log.h.inc index 5588165..8dd7145 100644 --- a/src/zr/log.h.inc +++ b/src/zr/log.h.inc @@ -78,6 +78,7 @@ enum LogModules bool:LogModule_Hitgroups, bool:LogModule_Infect, bool:LogModule_Models, + bool:LogModule_Napalm, bool:LogModule_Playerclasses, bool:LogModule_VEffects, bool:LogModule_SEffects, diff --git a/src/zr/log.inc b/src/zr/log.inc index db4d748..0682a3c 100644 --- a/src/zr/log.inc +++ b/src/zr/log.inc @@ -91,6 +91,10 @@ LogGetModuleNameString(String:buffer[], maxlen, LogModules:module, bool:shortNam { return shortName ? strcopy(buffer, maxlen, "models") : strcopy(buffer, maxlen, "Models"); } + case LogModule_Napalm: + { + return shortName ? strcopy(buffer, maxlen, "napalm") : strcopy(buffer, maxlen, "Napalm"); + } case LogModule_Playerclasses: { return shortName ? strcopy(buffer, maxlen, "playerclasses") : strcopy(buffer, maxlen, "Player Classes"); @@ -178,6 +182,10 @@ LogModules:LogGetModule(const String:moduleName[]) { return LogModule_Models; } + else if (StrEqual(moduleName, "napalm", false)) + { + return LogModule_Napalm; + } else if (StrEqual(moduleName, "playerclasses", false)) { return LogModule_Playerclasses; diff --git a/src/zr/models.inc b/src/zr/models.inc index d0f2e46..44389f4 100644 --- a/src/zr/models.inc +++ b/src/zr/models.inc @@ -94,7 +94,7 @@ ModelsLoad() { // Get base model path, excluding the public/non-public setting. ModelReturnPath(x, modelbase, sizeof(modelbase)); - PrintToServer("PATH BASE [%s]", modelbase); + // Explode path into pieces. (separated by "/") new strings = ExplodeString(modelbase, "/", baseexploded, MODELS_PATH_MAX_DEPTH, MODELS_PATH_DIR_MAX_LENGTH); diff --git a/src/zr/napalm.inc b/src/zr/napalm.inc index 1cca75e..c36d6d1 100644 --- a/src/zr/napalm.inc +++ b/src/zr/napalm.inc @@ -30,6 +30,71 @@ */ #define GRENADE_FUSE_TIME 3.0 +/** + * @section m_nWaterLevel defines. + */ +#define NAPALM_WLEVEL_DRY 0 +#define NAPALM_WLEVEL_FEET 1 +#define NAPALM_WLEVEL_HALF 2 +#define NAPALM_WLEVEL_FULL 3 +/** + * @endsection + */ + +/** + * Variable to store water-level offset value. + */ +new g_iToolsWaterLevel; + +/** + * Find napalm-specific offsets here. + */ +NapalmOnOffsetsFound() +{ + // If offset "m_bInBuyZone" can't be found, then stop the plugin. + g_iToolsWaterLevel = FindSendPropInfo("CBasePlayer", "m_nWaterLevel"); + if (g_iToolsWaterLevel == -1) + { + LogEvent(false, LogType_Fatal, LOG_CORE_EVENTS, LogModule_Napalm, "Offsets", "Offset \"CBaseEntity::m_nWaterLevel\" was not found."); + } +} + +/** + * Hook: OnTakeDamage + * Forwarded from the damage module to check if we should extinguish any flames. + * + * @param client The client index. + * @param damagetype The type of damage inflicted. + * @return Return ZRTools_Handled to stop the damage to client. + * ZRTools_Continue to allow damage to client. + * Return -1 to not return anything and let the damage module continue as usual. + */ +NapalmOnTakeDamage(client, damagetype) +{ + // Client was damaged by fire. + if (damagetype & DMG_CSS_BURN) + { + // Only take action if it isn't disabled, or the option is valid. + new douse = GetConVarInt(g_hCvarsList[CVAR_NAPALM_DOUSE]); + + if (douse > 0 && douse <= 3) + { + // If the client water-level is equal or higher than the given, then we want to extinguish the flame. + if (NapalmGetClientWaterLevel(client) >= douse) + { + // Put the fire out. + ExtinguishEntity(client); + + // Stop the last bit of inflicted burn damage. + return _:ZRTools_Handled; + } + } + } + + // Let the damage module continue as usual. + return -1; +} + /** * Client has been hurt. * @@ -113,8 +178,8 @@ NapalmOnWeaponFire(client, const String:weapon[]) return; } - // Wait .15 seconds. - CreateTimer(0.15, NapalmIgniteGrenade); + // Wait .1 seconds. + CreateTimer(0.1, NapalmIgniteGrenade); } /** @@ -145,3 +210,15 @@ public Action:NapalmIgniteGrenade(Handle:timer) } } } + +/** + * Checks the current water-level on a client. + * + * @param client The client index. + * @return A NAPALM_WLEVEL_ define. + */ +stock NapalmGetClientWaterLevel(client) +{ + // Return client's water-level. + return GetEntData(client, g_iToolsWaterLevel); +} \ No newline at end of file diff --git a/src/zr/tools.inc b/src/zr/tools.inc index a8a8d8f..574cf42 100644 --- a/src/zr/tools.inc +++ b/src/zr/tools.inc @@ -107,7 +107,7 @@ ToolsFindOffsets() WeaponsOnOffsetsFound(); AccountOnOffsetsFound(); VEffectsOnOffsetsFound(); - ZMarketOnOffsetsFound(); + NapalmOnOffsetsFound(); } /** diff --git a/src/zr/weapons/weapons.inc b/src/zr/weapons/weapons.inc index 8beea92..b6ff945 100644 --- a/src/zr/weapons/weapons.inc +++ b/src/zr/weapons/weapons.inc @@ -119,6 +119,7 @@ WeaponsOnOffsetsFound() // Forward event to sub-modules WeaponAmmoOnOffsetsFound(); + ZMarketOnOffsetsFound(); } /**