Skip to content

Commit

Permalink
Add a bit of QoL related to the Tank (#154)
Browse files Browse the repository at this point in the history
  • Loading branch information
woisalreadytaken authored Apr 7, 2024
1 parent e391c6b commit fb08539
Show file tree
Hide file tree
Showing 5 changed files with 69 additions and 10 deletions.
1 change: 1 addition & 0 deletions addons/sourcemod/configs/szf/classes.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,7 @@
{
"class" "heavy"
"glow" "1"
"message" "SpecialInfected_Tank"
"menu" "Menu_ClassesInfectedSpecialTank"
"worldmodel" "models/kirillian/infected/hank_v4.mdl"
Expand Down
1 change: 1 addition & 0 deletions addons/sourcemod/scripting/superzombiefortress.sp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
21 changes: 11 additions & 10 deletions addons/sourcemod/scripting/szf/convar.sp
Original file line number Diff line number Diff line change
Expand Up @@ -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));

Expand Down
51 changes: 51 additions & 0 deletions addons/sourcemod/scripting/szf/infected.sp
Original file line number Diff line number Diff line change
Expand Up @@ -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");

Expand Down Expand Up @@ -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)
Expand All @@ -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");
Expand Down
5 changes: 5 additions & 0 deletions addons/sourcemod/translations/superzombiefortress.phrases.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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."
Expand Down

0 comments on commit fb08539

Please sign in to comment.