more hs bug fixes

This commit is contained in:
Jackzie 2022-06-18 17:57:24 -05:00
parent f6b51ee495
commit a1b239f394
No known key found for this signature in database
GPG key ID: E0BBD94CF657F603
4 changed files with 30 additions and 15 deletions

Binary file not shown.

View file

@ -2,6 +2,8 @@
int slipperyShoesIndex = 0;
int stickyGooIndex = 0;
int invertedTrollIndex;
// int fireSpitMagnetTrollIndex;
void SetupTrolls() {
trollKV = new StringMap();
@ -17,6 +19,7 @@ void SetupTrolls() {
index = SetupTroll("Tank Magnet", "Attracts ALL tanks to any alive target with this troll enabled", TrollMod_Constant);
AddMagnetFlags(index);
index = SetupTroll("Witch Magnet", "All witches when startled will target any player with this troll", TrollMod_Constant);
// fireSpitMagnetTrollIndex = SetupTroll("Fire & Acid Magnet", "Make the player gravitate toward danger", TRollMod_Constant);
/// CATEGORY: Infected
SetCategory("Infected");
@ -118,7 +121,7 @@ void SetupTrolls() {
Trolls[index].AddFlag("30% Movement Speed", false);
Trolls[index].AddFlag("0% Movement Speed", false);
SetupTroll("Higher Gravity", "Sets player gravity to 1.3x of normal gravity", TrollMod_Constant);
SetupTroll("Inverted Controls", "Well, aint it obvious", TrollMod_Constant);
invertedTrollIndex = SetupTroll("Inverted Controls", "Well, aint it obvious", TrollMod_Constant);
SetupTroll("Stagger", "Like a slap, but different", TrollMod_Instant);
index = SetupTroll("Slippery Shoes", "Periodically stumbles around.", TrollMod_Constant);
Trolls[index].AddFlagPrompt(true);
@ -165,7 +168,7 @@ void AddMagnetFlags(int index) {
}
bool ApplyAffect(int victim, const Troll troll, int activator, trollModifier modifier, int flags) {
bool isActive = IsTrollActiveByRawID(victim, troll.id);
bool toActive = IsTrollActiveByRawID(victim, troll.id);
if(StrEqual(troll.name, "Reset User")) {
LogAction(activator, victim, "\"%L\" reset all effects for \"%L\"", activator, victim);
ShowActivityEx(activator, "[FTT] ", "reset effects for %N. ", victim);
@ -174,17 +177,18 @@ bool ApplyAffect(int victim, const Troll troll, int activator, trollModifier mod
}
SetEntPropFloat(victim, Prop_Send, "m_flLaggedMovementValue", 1.0);
SetEntityGravity(victim, 1.0);
SetEntPropFloat(victim, Prop_Send, "m_flLaggedMovementValue", 1.0);
return false;
} else if(StrEqual(troll.name, "Slow Speed")) {
if(isActive) {
float movement = 1.0;
if(toActive) {
float movement = 0.0;
if(flags & 1) movement = 0.6;
else if(flags & 2) movement = 0.3;
SetEntPropFloat(victim, Prop_Send, "m_flLaggedMovementValue", movement);
} else
SetEntPropFloat(victim, Prop_Send, "m_flLaggedMovementValue", 1.0);
} else if(StrEqual(troll.name, "Higher Gravity"))
SetEntityGravity(victim, isActive ? 1.0 : 1.3);
SetEntityGravity(victim, toActive ? 1.3 : 1.0);
else if(StrEqual(troll.name, "Half Primary Ammo")) {
int current = GetPrimaryReserveAmmo(victim);
SetPrimaryReserveAmmo(victim, current / 2);
@ -248,7 +252,7 @@ bool ApplyAffect(int victim, const Troll troll, int activator, trollModifier mod
} else if(StrEqual(troll.name, "Stagger")) {
L4D_StaggerPlayer(victim, victim, NULL_VECTOR);
} else if(StrEqual(troll.name, "Voice Mute")) {
BaseComm_SetClientMute(victim, !isActive);
BaseComm_SetClientMute(victim, toActive);
} else if(StrEqual(troll.name, "Spicy Gas")) {
SDKHook(victim, SDKHook_WeaponCanUse, Event_ItemPickup);
} else if(StrEqual(troll.name, "Car Splat")) {

View file

@ -261,8 +261,11 @@ bool IsPeekCamActive(int client) {
void SetPeekCamActive(int client, bool active) {
if(seekerCam != INVALID_ENT_REFERENCE) {
AcceptEntityInput(seekerCam, "Enable", client); // Need to always activate before deactivating to fix a semi-common bug
if(!active)
if(!active) {
AcceptEntityInput(seekerCam, "Disable", client);
AcceptEntityInput(seekerCam, "Kill");
seekerCam = INVALID_ENT_REFERENCE;
}
} else {
PrintToServer("WARN: SetPeekCamActive(%d, %b) when seekerCam invalid", client, active);
}

View file

@ -12,6 +12,7 @@
#include <sdktools>
#include <left4dhooks>
#include <sceneprocessor>
#include <multicolors>
#if defined DEBUG_BLOCKERS
#include <smlib/effects>
int g_iLaserIndex;
@ -111,6 +112,7 @@ bool ignoreSeekerBalance;
ConVar cvar_peekCam;
ConVar cvar_seekerBalance;
ConVar cvar_abm_autohard;
#include <hideandseek/hscore>
@ -140,6 +142,8 @@ public void OnPluginStart() {
hGamemode.AddChangeHook(Event_GamemodeChange);
Event_GamemodeChange(hGamemode, gamemode, gamemode);
cvar_abm_autohard = FindConVar("cvar_abm_autohard");
RegConsoleCmd("sm_joingame", Command_Join, "Joins or joins someone else");
RegAdminCmd("sm_hs", Command_HideAndSeek, ADMFLAG_CHEATS, "The main command. see /hs help");
@ -180,7 +184,9 @@ public void OnMapStart() {
seekerCam = INVALID_ENT_REFERENCE;
currentSeeker = 0;
if(cvar_abm_autohard != null) {
cvar_abm_autohard.IntValue = 0;
}
char map[64];
GetCurrentMap(map, sizeof(map));
@ -320,17 +326,19 @@ public void Event_PlayerDeath(Event event, const char[] name, bool dontBroadcast
}
if(client == currentSeeker && alive == 1) {
PrintToChatAll("Hiders win!");
// If seeker died
CPrintToChatAll("{green}Hiders win!");
gameOver = true;
} else {
if(alive == 2) {
PrintToChatAll("One hider remains.");
CPrintToChatAll("{green}One hider remains.");
} else if(alive <= 0) {
// Player died and not seeker, therefore seeker killed em
if(client != currentSeeker) {
PrintToChatAll("Seeker %N won!", currentSeeker);
// If who died was not the seeker
if(client == currentSeeker) {
CPrintToChatAll("{green}Hiders win! The seeker has perished.");
} else {
PrintToChatAll("Hiders win! The last survivor was %N!", client);
CPrintToChatAll("{green}The seeker %N won!", currentSeeker);
}
if(cvar_peekCam.IntValue & 1) {
SetPeekCamTarget(client, false);
@ -338,7 +346,7 @@ public void Event_PlayerDeath(Event event, const char[] name, bool dontBroadcast
gameOver = true;
return;
} else if(alive > 2 && client != currentSeeker) {
PrintToChatAll("%d hiders remain", alive - 1);
CPrintToChatAll("{green}%d hiders remain", alive - 1);
}
}
CreateTimer(2.0, Timer_StopPeekCam);
@ -402,7 +410,7 @@ public void Event_ItemPickup(Event event, const char[] name, bool dontBroadcast)
}
}
ignoreSeekerBalance = false;
PrintToChatAll("%N is the seeker", currentSeeker);
CPrintToChatAll("{green}%N{yellow} is the seeker", currentSeeker);
}
}
}