From fb08539286becfb5b84107ba3a3b8bc823091de9 Mon Sep 17 00:00:00 2001 From: wo <33163183+woisalreadytaken@users.noreply.github.com> Date: Sun, 7 Apr 2024 19:56:18 -0300 Subject: [PATCH] Add a bit of QoL related to the Tank (#154) --- addons/sourcemod/configs/szf/classes.cfg | 1 + .../scripting/superzombiefortress.sp | 1 + addons/sourcemod/scripting/szf/convar.sp | 21 ++++---- addons/sourcemod/scripting/szf/infected.sp | 51 +++++++++++++++++++ .../superzombiefortress.phrases.txt | 5 ++ 5 files changed, 69 insertions(+), 10 deletions(-) diff --git a/addons/sourcemod/configs/szf/classes.cfg b/addons/sourcemod/configs/szf/classes.cfg index bab4bad4..0a191fcc 100644 --- a/addons/sourcemod/configs/szf/classes.cfg +++ b/addons/sourcemod/configs/szf/classes.cfg @@ -254,6 +254,7 @@ { "class" "heavy" "glow" "1" + "message" "SpecialInfected_Tank" "menu" "Menu_ClassesInfectedSpecialTank" "worldmodel" "models/kirillian/infected/hank_v4.mdl" diff --git a/addons/sourcemod/scripting/superzombiefortress.sp b/addons/sourcemod/scripting/superzombiefortress.sp index e65edf54..fb185bcb 100644 --- a/addons/sourcemod/scripting/superzombiefortress.sp +++ b/addons/sourcemod/scripting/superzombiefortress.sp @@ -404,6 +404,7 @@ ConVar g_cvTankHealthMin; ConVar g_cvTankHealthMax; ConVar g_cvTankTime; ConVar g_cvTankStab; +ConVar g_cvTankDebrisLifetime; ConVar g_cvJockeyMovementVictim; ConVar g_cvJockeyMovementAttacker; ConVar g_cvFrenzyChance; diff --git a/addons/sourcemod/scripting/szf/convar.sp b/addons/sourcemod/scripting/szf/convar.sp index cb0c67d2..cbbf83d0 100644 --- a/addons/sourcemod/scripting/szf/convar.sp +++ b/addons/sourcemod/scripting/szf/convar.sp @@ -15,17 +15,18 @@ void ConVar_Init() g_cvForceOn = CreateConVar("sm_szf_force_on", "1", "<0/1> Force enable SZF for next map.", _, true, 0.0, true, 1.0); g_cvRatio = CreateConVar("sm_szf_ratio", "0.78", "<0.01-1.00> Percentage of players that start as survivors.", _, true, 0.01, true, 1.0); - g_cvTankHealth = CreateConVar("sm_szf_tank_health", "400", "Amount of health the Tank gets per alive survivor", _, true, 10.0); - g_cvTankHealthMin = CreateConVar("sm_szf_tank_health_min", "1000", "Minimum amount of health the Tank can spawn with", _, true, 0.0); - g_cvTankHealthMax = CreateConVar("sm_szf_tank_health_max", "6000", "Maximum amount of health the Tank can spawn with", _, true, 0.0); + g_cvTankHealth = CreateConVar("sm_szf_tank_health", "400", "Amount of health the Tank gets per alive survivor.", _, true, 10.0); + g_cvTankHealthMin = CreateConVar("sm_szf_tank_health_min", "1000", "Minimum amount of health the Tank can spawn with.", _, true, 0.0); + g_cvTankHealthMax = CreateConVar("sm_szf_tank_health_max", "6000", "Maximum amount of health the Tank can spawn with.", _, true, 0.0); g_cvTankTime = CreateConVar("sm_szf_tank_time", "30.0", "Adjusts the damage the Tank takes per second. 0 to disable.", _, true, 0.0); - g_cvTankStab = CreateConVar("sm_szf_tank_stab", "500", "Flat Damage dealt to the Tank from a backstab", _, true, 0.0); - g_cvJockeyMovementVictim = CreateConVar("sm_szf_jockey_movement_victim", "0.25", "Percentage of movement speed applied to victim from jockey grab", _, true, 0.0); - g_cvJockeyMovementAttacker = CreateConVar("sm_szf_jockey_movement_attacker", "0.75", "Percentage of movement speed applied to jockey during grab", _, true, 0.0); - g_cvFrenzyChance = CreateConVar("sm_szf_frenzy_chance", "0.0", "% Chance of a random frenzy", _, true, 0.0); - g_cvFrenzyTankChance = CreateConVar("sm_szf_frenzy_tank", "0.0", "% Chance of a Tank appearing instead of a frenzy", _, true, 0.0); - g_cvStunImmunity = CreateConVar("sm_szf_stun_immunity", "0.0", "How long until the survivor can be stunned again", _, true, 0.0); - g_cvMeleeIgnoreTeammates = CreateConVar("sm_szf_melee_ignores_teammates", "1.0", "<0/1> If enabled, melee hits will ignore teammates", _, true, 0.0, true, 1.0); + g_cvTankStab = CreateConVar("sm_szf_tank_stab", "500", "Flat Damage dealt to the Tank from a backstab.", _, true, 0.0); + g_cvTankDebrisLifetime = CreateConVar("sm_szf_tank_debris_lifetime", "20.0", "Amount of time (in seconds) it takes for debris thrown by Tanks to despawn. Use 0 to prevent despawning.", _, true, 0.0); + g_cvJockeyMovementVictim = CreateConVar("sm_szf_jockey_movement_victim", "0.25", "Percentage of movement speed applied to victim from jockey grab.", _, true, 0.0); + g_cvJockeyMovementAttacker = CreateConVar("sm_szf_jockey_movement_attacker", "0.75", "Percentage of movement speed applied to jockey during grab.", _, true, 0.0); + g_cvFrenzyChance = CreateConVar("sm_szf_frenzy_chance", "0.0", "% Chance of a random frenzy.", _, true, 0.0); + g_cvFrenzyTankChance = CreateConVar("sm_szf_frenzy_tank", "0.0", "% Chance of a Tank appearing instead of a frenzy.", _, true, 0.0); + g_cvStunImmunity = CreateConVar("sm_szf_stun_immunity", "0.0", "How long until the survivor can be stunned again.", _, true, 0.0); + g_cvMeleeIgnoreTeammates = CreateConVar("sm_szf_melee_ignores_teammates", "1.0", "<0/1> If enabled, melee hits will ignore teammates.", _, true, 0.0, true, 1.0); g_aConVar = new ArrayList(sizeof(ConVarInfo)); diff --git a/addons/sourcemod/scripting/szf/infected.sp b/addons/sourcemod/scripting/szf/infected.sp index 4fcea1e2..2f76a98e 100644 --- a/addons/sourcemod/scripting/szf/infected.sp +++ b/addons/sourcemod/scripting/szf/infected.sp @@ -176,6 +176,7 @@ public void Infected_DoTankThrow(int iClient) SetEntProp(iDebris, Prop_Data, "m_takedamage", DAMAGE_NO); SetEntityCollisionGroup(iDebris, COLLISION_GROUP_PLAYER); SetEntProp(iDebris, Prop_Send, "m_iTeamNum", GetClientTeam(iClient)); + SetEntityRenderMode(iDebris, RENDER_TRANSCOLOR); int iBonemerge = CreateBonemerge(iClient, "debris"); @@ -236,6 +237,12 @@ void Infected_ActivateDebris(int iClient, bool bVel) AnglesToVelocity(vecAngles, vecVel, 2000.0); TeleportEntity(iDebris, NULL_VECTOR, NULL_VECTOR, vecVel); } + + CreateTimer(1.0, Infected_DebrisTimerMoving, iDebris, TIMER_REPEAT | TIMER_FLAG_NO_MAPCHANGE); + + float flLifetime = g_cvTankDebrisLifetime.FloatValue; + if (flLifetime > 0.0) + CreateTimer(flLifetime, Infected_DebrisTimerFadeOutStart, iDebris); } public Action Infected_DebrisTimerEnd(Handle hTimer, int iSerial) @@ -250,6 +257,50 @@ public Action Infected_DebrisTimerEnd(Handle hTimer, int iSerial) return Plugin_Continue; } +public Action Infected_DebrisTimerMoving(Handle hTimer, int iDebris) +{ + if (!IsValidEntity(iDebris)) + return Plugin_Stop; + + if (GetEntProp(iDebris, Prop_Send, "m_bAwake")) + return Plugin_Continue; + + SetEntityCollisionGroup(iDebris, COLLISION_GROUP_DEBRIS); + SetEntityMoveType(iDebris, MOVETYPE_NONE); + + return Plugin_Stop; +} + +public Action Infected_DebrisTimerFadeOutStart(Handle hTimer, int iDebris) +{ + if (!IsValidEntity(iDebris)) + return Plugin_Stop; + + SetEntityCollisionGroup(iDebris, COLLISION_GROUP_DEBRIS); + RequestFrame(Infected_DebrisFrameFadeOut, iDebris); + + return Plugin_Continue; +} + +void Infected_DebrisFrameFadeOut(int iDebris) +{ + if (!IsValidEntity(iDebris)) + return; + + int iColor[4]; + GetEntityRenderColor(iDebris, iColor[0], iColor[1], iColor[2], iColor[3]); + + int iAlpha = iColor[3] - 10; + if (iAlpha <= 0) + { + RemoveEntity(iDebris); + return; + } + + SetEntityRenderColor(iDebris, .a = iAlpha); + RequestFrame(Infected_DebrisFrameFadeOut, iDebris); +} + public Action Infected_DebrisStartTouch(int iDebris, int iToucher) { int iClient = GetEntPropEnt(iDebris, Prop_Send, "m_hOwnerEntity"); diff --git a/addons/sourcemod/translations/superzombiefortress.phrases.txt b/addons/sourcemod/translations/superzombiefortress.phrases.txt index fd443245..f94a12cd 100644 --- a/addons/sourcemod/translations/superzombiefortress.phrases.txt +++ b/addons/sourcemod/translations/superzombiefortress.phrases.txt @@ -351,6 +351,11 @@ "en" "{1}Survivors can't change classes during a round" } + "SpecialInfected_Tank" + { + "en" "{green}YOU ARE A TANK:\n{orange}- A nearly-unstoppable force.\n- Call 'MEDIC!' to pick up and THROW DEBRIS ahead of you, hurting EVERYONE in its path! {yellow}(5 second cooldown)" + } + "SpecialInfected_Boomer" { "en" "{green}YOU ARE A BOOMER:\n{orange}- Call 'MEDIC!' to EXPLODE and JARATE nearby enemies!\n- You also explode upon dying, coating the killer and assister in JARATE."