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.
This commit is contained in:
Greyscale 2009-07-16 18:34:56 -07:00
parent e48b480029
commit f403386546
11 changed files with 116 additions and 11 deletions

View File

@ -566,6 +566,10 @@ zr_respawn_team_zombie_world "1"
// Default: "1" // Default: "1"
zr_napalm_ignite "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) // Jump Boost (module)

View File

@ -91,6 +91,7 @@ native ZRTools_UnhookTraceAttack(hookid);
// CS:S Specific damage flags. (should probably use these) // CS:S Specific damage flags. (should probably use these)
#define DMG_CSS_FALL (DMG_FALL) // Client was damaged by falling. #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_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_BULLET (DMG_NEVERGIB) // Client was shot or knifed.
#define DMG_CSS_HEADSHOT (1 << 30) // Client was shot in the head. #define DMG_CSS_HEADSHOT (1 << 30) // Client was shot in the head.

View File

@ -87,13 +87,6 @@ AntiStickOnCommandsCreate()
*/ */
AntiStickLoad() 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. // Create antistick keyvalues if it hasn't been created yet.
if (g_kvAntiStick == INVALID_HANDLE) if (g_kvAntiStick == INVALID_HANDLE)
{ {
@ -255,6 +248,13 @@ stock AntiStickSetModelHullWidth(client, const String:model[] = "", Float:hull_w
*/ */
public ZRTools_Action:AntiStickStartTouch(client, entity) 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 client isn't in-game, then stop.
if (!IsClientInGame(client)) if (!IsClientInGame(client))
{ {

View File

@ -137,6 +137,7 @@ enum CvarsList
Handle:CVAR_RESPAWN_TEAM_ZOMBIE, Handle:CVAR_RESPAWN_TEAM_ZOMBIE,
Handle:CVAR_RESPAWN_TEAM_ZOMBIE_WORLD, Handle:CVAR_RESPAWN_TEAM_ZOMBIE_WORLD,
Handle:CVAR_NAPALM_IGNITE, Handle:CVAR_NAPALM_IGNITE,
Handle:CVAR_NAPALM_DOUSE,
Handle:CVAR_JUMPBOOST_BHOP_PROTECT, Handle:CVAR_JUMPBOOST_BHOP_PROTECT,
Handle:CVAR_JUMPBOOST_BHOP_MAX, Handle:CVAR_JUMPBOOST_BHOP_MAX,
Handle:CVAR_VOL, Handle:CVAR_VOL,
@ -414,6 +415,7 @@ CvarsCreate()
// Napalm (module) // 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_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]");
// =========================== // ===========================

View File

@ -231,6 +231,17 @@ public ZRTools_Action:DamageOnTakeDamage(client, inflictor, attacker, Float:dama
return ZRTools_Continue; 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. // Client was shot or knifed.
if (damagetype & DMG_CSS_BULLET) if (damagetype & DMG_CSS_BULLET)
{ {

View File

@ -78,6 +78,7 @@ enum LogModules
bool:LogModule_Hitgroups, bool:LogModule_Hitgroups,
bool:LogModule_Infect, bool:LogModule_Infect,
bool:LogModule_Models, bool:LogModule_Models,
bool:LogModule_Napalm,
bool:LogModule_Playerclasses, bool:LogModule_Playerclasses,
bool:LogModule_VEffects, bool:LogModule_VEffects,
bool:LogModule_SEffects, bool:LogModule_SEffects,

View File

@ -91,6 +91,10 @@ LogGetModuleNameString(String:buffer[], maxlen, LogModules:module, bool:shortNam
{ {
return shortName ? strcopy(buffer, maxlen, "models") : strcopy(buffer, maxlen, "Models"); 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: case LogModule_Playerclasses:
{ {
return shortName ? strcopy(buffer, maxlen, "playerclasses") : strcopy(buffer, maxlen, "Player Classes"); return shortName ? strcopy(buffer, maxlen, "playerclasses") : strcopy(buffer, maxlen, "Player Classes");
@ -178,6 +182,10 @@ LogModules:LogGetModule(const String:moduleName[])
{ {
return LogModule_Models; return LogModule_Models;
} }
else if (StrEqual(moduleName, "napalm", false))
{
return LogModule_Napalm;
}
else if (StrEqual(moduleName, "playerclasses", false)) else if (StrEqual(moduleName, "playerclasses", false))
{ {
return LogModule_Playerclasses; return LogModule_Playerclasses;

View File

@ -94,7 +94,7 @@ ModelsLoad()
{ {
// Get base model path, excluding the public/non-public setting. // Get base model path, excluding the public/non-public setting.
ModelReturnPath(x, modelbase, sizeof(modelbase)); ModelReturnPath(x, modelbase, sizeof(modelbase));
PrintToServer("PATH BASE [%s]", modelbase);
// Explode path into pieces. (separated by "/") // Explode path into pieces. (separated by "/")
new strings = ExplodeString(modelbase, "/", baseexploded, MODELS_PATH_MAX_DEPTH, MODELS_PATH_DIR_MAX_LENGTH); new strings = ExplodeString(modelbase, "/", baseexploded, MODELS_PATH_MAX_DEPTH, MODELS_PATH_DIR_MAX_LENGTH);

View File

@ -30,6 +30,71 @@
*/ */
#define GRENADE_FUSE_TIME 3.0 #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. * Client has been hurt.
* *
@ -113,8 +178,8 @@ NapalmOnWeaponFire(client, const String:weapon[])
return; return;
} }
// Wait .15 seconds. // Wait .1 seconds.
CreateTimer(0.15, NapalmIgniteGrenade); 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);
}

View File

@ -107,7 +107,7 @@ ToolsFindOffsets()
WeaponsOnOffsetsFound(); WeaponsOnOffsetsFound();
AccountOnOffsetsFound(); AccountOnOffsetsFound();
VEffectsOnOffsetsFound(); VEffectsOnOffsetsFound();
ZMarketOnOffsetsFound(); NapalmOnOffsetsFound();
} }
/** /**

View File

@ -119,6 +119,7 @@ WeaponsOnOffsetsFound()
// Forward event to sub-modules // Forward event to sub-modules
WeaponAmmoOnOffsetsFound(); WeaponAmmoOnOffsetsFound();
ZMarketOnOffsetsFound();
} }
/** /**