FTT Changes, add movement speed options

This commit is contained in:
Jackz 2022-11-11 11:01:08 -06:00
parent 8d9edf2aca
commit e4d3ae5640
No known key found for this signature in database
GPG key ID: E0BBD94CF657F603
9 changed files with 71 additions and 43 deletions

Binary file not shown.

View file

@ -4,7 +4,7 @@
//Allow MAX_TROLLS to be defined elsewhere //Allow MAX_TROLLS to be defined elsewhere
#if defined MAX_TROLLS #if defined MAX_TROLLS
#else #else
#define MAX_TROLLS 47 #define MAX_TROLLS 48
#endif #endif
enum trollModifier { enum trollModifier {

View file

@ -112,7 +112,7 @@ public Action Command_InstaSpecialFace(int client, int args) {
for (int i = 0; i < target_count; i++) { for (int i = 0; i < target_count; i++) {
int target = target_list[i]; int target = target_list[i];
if(GetClientTeam(target) == 2) { if(GetClientTeam(target) == 2) {
if(SpawnSpecialForTarget(specialType, target, Special_OnTarget)) { if(SpawnSpecialForTarget(specialType, target, view_as<int>(Special_OnTarget))) {
LogAction(client, target, "\"%L\" spawned Insta-%s™ at player \"%L\"", client, arg2, target); LogAction(client, target, "\"%L\" spawned Insta-%s™ at player \"%L\"", client, arg2, target);
successes++; successes++;
} else { } else {

View file

@ -219,12 +219,23 @@ public Action Event_WeaponReload(int weapon) {
return Plugin_Continue; return Plugin_Continue;
} }
public Action Event_ButtonPress(const char[] output, int entity, int client, float delay) { public Action Event_ButtonPress(const char[] output, int entity, int client, float delay) {
static int noButtonPressIndex;
if(!noButtonPressIndex) noButtonPressIndex = GetTrollID("No Button Touchie");
if(client > 0 && client <= MaxClients) { if(client > 0 && client <= MaxClients) {
if(Trolls[noButtonPressIndex].IsActive(client)) {
AcceptEntityInput(entity, "Lock");
RequestFrame(Frame_ResetButton, entity);
return Plugin_Handled;
}
lastButtonUser = client; lastButtonUser = client;
} }
return Plugin_Continue; return Plugin_Continue;
} }
public void Frame_ResetButton(int entity) {
AcceptEntityInput(entity, "Unlock");
}
public void Event_PanicEventCreate(Event event, const char[] name, bool dontBroadcast) { public void Event_PanicEventCreate(Event event, const char[] name, bool dontBroadcast) {
int client = GetClientOfUserId(event.GetInt("userid")); int client = GetClientOfUserId(event.GetInt("userid"));
if(client) { if(client) {
@ -301,8 +312,6 @@ public Action L4D2_OnChooseVictim(int attacker, int &curTarget) {
if(class != L4D2Infected_Tank && hMagnetTargetMode.IntValue & 1 == 0) continue; if(class != L4D2Infected_Tank && hMagnetTargetMode.IntValue & 1 == 0) continue;
} }
PrintToConsoleAll("[FTT/Debug] Adding possible magnet victim %N for %N", i, attacker);
GetClientAbsOrigin(i, survPos); GetClientAbsOrigin(i, survPos);
float dist = GetVectorDistance(survPos, spPos, true); float dist = GetVectorDistance(survPos, spPos, true);
if(dist < closestDistance || closestClient == -1) { if(dist < closestDistance || closestClient == -1) {
@ -314,7 +323,6 @@ public Action L4D2_OnChooseVictim(int attacker, int &curTarget) {
// If found, set, else just let game decide // If found, set, else just let game decide
if(closestClient > 0) { if(closestClient > 0) {
PrintToConsoleAll("[FTT/Debug] infected %N -> attack -> %N", attacker, closestClient);
pdata[attacker].attackerTargetUid = GetClientUserId(closestClient); pdata[attacker].attackerTargetUid = GetClientUserId(closestClient);
curTarget = closestClient; curTarget = closestClient;
return Plugin_Changed; return Plugin_Changed;
@ -748,7 +756,7 @@ public Action OnVocalizeCommand(int client, const char[] vocalize, int initiator
static int noRushingUsID; static int noRushingUsID;
if(vocalGagID == 0) vocalGagID = GetTrollID("Vocalize Gag"); if(vocalGagID == 0) vocalGagID = GetTrollID("Vocalize Gag");
if(noRushingUsID == 0) noRushingUsID = GetTrollID("No Rushing Us"); if(noRushingUsID == 0) noRushingUsID = GetTrollID("No Rushing Us");
if(Trolls[noRushingUsID].IsActive(client) && StrEqual(vocalize, "PlayerHurryUp") || StrEqual(vocalize, "PlayerYellRun") || StrEqual(vocalize, "PlayerMoveOn") || StrEqual(vocalize, "PlayerLeadOn")) { if(Trolls[noRushingUsID].IsActive(client) && (StrEqual(vocalize, "PlayerHurryUp") || StrEqual(vocalize, "PlayerYellRun") || StrEqual(vocalize, "PlayerMoveOn") || StrEqual(vocalize, "PlayerLeadOn"))) {
float speed = GetEntPropFloat(client, Prop_Send, "m_flLaggedMovementValue"); float speed = GetEntPropFloat(client, Prop_Send, "m_flLaggedMovementValue");
speed -= 0.01; speed -= 0.01;
if(speed < 0.0) SetEntPropFloat(client, Prop_Send, "m_flLaggedMovementValue", 0.0); if(speed < 0.0) SetEntPropFloat(client, Prop_Send, "m_flLaggedMovementValue", 0.0);
@ -775,17 +783,17 @@ public void OnSceneStageChanged(int scene, SceneStages stage) {
static char sceneFile[32]; static char sceneFile[32];
GetSceneFile(scene, sceneFile, sizeof(sceneFile)); GetSceneFile(scene, sceneFile, sizeof(sceneFile));
if(StrContains(sceneFile, "warnboomer") > -1) { if(StrContains(sceneFile, "warnboomer") > -1) {
SpawnSpecialForTarget(Special_Boomer, activator, Special_OnTarget); SpawnSpecialForTarget(Special_Boomer, activator, view_as<int>(Special_OnTarget));
} else if(StrContains(sceneFile, "warnhunter") > -1) { } else if(StrContains(sceneFile, "warnhunter") > -1) {
SpawnSpecialForTarget(Special_Hunter, activator, Special_OnTarget); SpawnSpecialForTarget(Special_Hunter, activator, view_as<int>(Special_OnTarget));
} else if(StrContains(sceneFile, "warnsmoker") > -1) { } else if(StrContains(sceneFile, "warnsmoker") > -1) {
SpawnSpecialForTarget(Special_Smoker, activator, Special_OnTarget); SpawnSpecialForTarget(Special_Smoker, activator, view_as<int>(Special_OnTarget));
} else if(StrContains(sceneFile, "warnspitter") > -1) { } else if(StrContains(sceneFile, "warnspitter") > -1) {
SpawnSpecialForTarget(Special_Spitter, activator, Special_OnTarget); SpawnSpecialForTarget(Special_Spitter, activator, view_as<int>(Special_OnTarget));
} else if(StrContains(sceneFile, "warnjockey") > -1) { } else if(StrContains(sceneFile, "warnjockey") > -1) {
SpawnSpecialForTarget(Special_Jockey, activator, Special_OnTarget); SpawnSpecialForTarget(Special_Jockey, activator, view_as<int>(Special_OnTarget));
} else if(StrContains(sceneFile, "warncharger") > -1) { } else if(StrContains(sceneFile, "warncharger") > -1) {
SpawnSpecialForTarget(Special_Charger, activator, Special_OnTarget); SpawnSpecialForTarget(Special_Charger, activator, view_as<int>(Special_OnTarget));
} }
if(Trolls[vocalizeSpecials].activeFlagClients[activator] & 1) { if(Trolls[vocalizeSpecials].activeFlagClients[activator] & 1) {
@ -911,13 +919,13 @@ public bool TraceEntityFilterPlayer(int entity, int mask, any data) {
// TODO: Increase the frequency of spawns the longer they are in antirush. Possibly increase int and decrease over time // TODO: Increase the frequency of spawns the longer they are in antirush. Possibly increase int and decrease over time
public Action OnAntiRush(int client, int &type, float distance) { public Action OnAntiRush(int client, int &type, float distance) {
if(client && client > 0 && client <= MaxClients && type == 3 && IsPlayerAlive(client) && !IsPlayerIncapped(client)) { if(client && client > 0 && client <= MaxClients && type == 3 && IsPlayerAlive(client) && !IsPlayerIncapped(client)) {
if(GetGameTime() - fLastAntiRushEvent[client] > ANTI_RUSH_DEFAULT_FREQUENCY - fAntiRushFrequencyCounter[client]) { < if(GetGameTime() - fLastAntiRushEvent[client] > ANTI_RUSH_DEFAULT_FREQUENCY - fAntiRushFrequencyCounter[client]) {
if(fAntiRushFrequencyCounter[client] < ANTI_RUSH_DEFAULT_FREQUENCY) { if(fAntiRushFrequencyCounter[client] < ANTI_RUSH_DEFAULT_FREQUENCY) {
fAntiRushFrequencyCounter[client] += ANTI_RUSH_FREQ_INC; fAntiRushFrequencyCounter[client] += ANTI_RUSH_FREQ_INC;
} }
SpecialType special = view_as<SpecialType>(GetRandomInt(1,6)); SpecialType special = view_as<SpecialType>(GetRandomInt(1,6));
fLastAntiRushEvent[client] = GetGameTime(); fLastAntiRushEvent[client] = GetGameTime();
SpawnSpecialForTarget(special, client); SpawnSpecialForTarget(special, client, view_as<int>(Special_SpawnDirectOnFailure | Special_OnTarget));
PrintToConsoleAll("[FTT] Spawning anti-rush special on %N (dist=%f) (special=%s)", client, distance, SPECIAL_NAMES[view_as<int>(special)-1]); PrintToConsoleAll("[FTT] Spawning anti-rush special on %N (dist=%f) (special=%s)", client, distance, SPECIAL_NAMES[view_as<int>(special)-1]);
} }
} }
@ -929,7 +937,7 @@ Action Timer_DecreaseAntiRush(Handle h) {
if(fAntiRushFrequencyCounter[i] > 1.0) { if(fAntiRushFrequencyCounter[i] > 1.0) {
fAntiRushFrequencyCounter[i]--; fAntiRushFrequencyCounter[i]--;
} else { } else {
fAntiRushFrequencyCounter = 0.0; fAntiRushFrequencyCounter[i] = 0.0;
} }
} }
return Plugin_Continue; return Plugin_Continue;
@ -943,10 +951,13 @@ public void L4D2_CInsectSwarm_CanHarm_Post(int acid, int spitter, int entity) {
public void Event_EnteredSpit(Event event, const char[] name, bool dontBroadcast) { public void Event_EnteredSpit(Event event, const char[] name, bool dontBroadcast) {
int client = GetClientOfUserId(event.GetInt("userid")); int client = GetClientOfUserId(event.GetInt("userid"));
if(Trolls[stickyGooIndex].IsActive(stickyGooIndex)) { if(Trolls[stickyGooIndex].IsActive(stickyGooIndex)) {
int flags = Trolls[stickyGooIndex].activeFlagClients[client];
float movement = 0.0; float movement = 0.0;
if(Trolls[stickyGooIndex].activeFlagClients[client] & 1) movement = 0.6; if(flags & 1) movement = 0.9;
else if(Trolls[stickyGooIndex].activeFlagClients[client] & 2) movement = 0.3; else if(flags & 2) movement = 0.8;
else if(flags & 4) movement = 0.7;
else if(flags & 8) movement = 0.5;
else if(flags & 16) movement = 0.3;
SetEntPropFloat(client, Prop_Send, "m_flLaggedMovementValue", movement); SetEntPropFloat(client, Prop_Send, "m_flLaggedMovementValue", movement);
pdata[client].lastInSpitTime = GetGameTime(); pdata[client].lastInSpitTime = GetGameTime();
if(~pdata[client].flags & view_as<int>(Flag_HasSpitTimer)) { if(~pdata[client].flags & view_as<int>(Flag_HasSpitTimer)) {

View file

@ -44,7 +44,7 @@ public int Insta_SpecialHandler(Menu menu, MenuAction action, int client, int pa
} }
SpecialType special = view_as<SpecialType>(specialInt); SpecialType special = view_as<SpecialType>(specialInt);
if(inFace) { if(inFace) {
if(SpawnSpecialForTarget(special, target, Special_OnTarget)) { if(SpawnSpecialForTarget(special, target, view_as<int>(Special_OnTarget))) {
LogAction(client, target, "\"%L\" spawned Insta-%s™ on \"%L\"", client, SPECIAL_NAMES[specialInt-1], target); LogAction(client, target, "\"%L\" spawned Insta-%s™ on \"%L\"", client, SPECIAL_NAMES[specialInt-1], target);
ShowActivityEx(client, "[FTT] ", "spawned Insta-%s™ on %N", SPECIAL_NAMES[specialInt-1], target); ShowActivityEx(client, "[FTT] ", "spawned Insta-%s™ on %N", SPECIAL_NAMES[specialInt-1], target);
} else { } else {

View file

@ -41,21 +41,25 @@ bool ToggleMarkPlayer(int client, int target) {
return true; return true;
}else{ }else{
bool isClientAdmin = GetUserAdmin(client) != INVALID_ADMIN_ID; bool isClientAdmin = GetUserAdmin(client) != INVALID_ADMIN_ID;
if(!isClientAdmin) {
ReplyToCommand(client, "cannot mark %N as troll as you are not an admin.", target);
return false;
}
bool isTargetAdmin = GetUserAdmin(target) != INVALID_ADMIN_ID; bool isTargetAdmin = GetUserAdmin(target) != INVALID_ADMIN_ID;
if(isClientAdmin && !isTargetAdmin) { if(isTargetAdmin) {
Call_StartForward(g_PlayerMarkedForward);
Call_PushCell(client);
Call_PushCell(target);
Call_Finish();
pdata[target].pendingTrollBan = GetClientUserId(client);
EnableTroll(target, "No Profanity");
LogAction(client, target, "\"%L\" marked \"%L\" as troll", client, target);
ShowActivityEx(client, "[FTT] ", "marked %N as troll", target);
return true;
}else{
ReplyToCommand(client, "cannot mark %N as troll as they are an admin.", target); ReplyToCommand(client, "cannot mark %N as troll as they are an admin.", target);
return false; return false;
} }
Call_StartForward(g_PlayerMarkedForward);
Call_PushCell(client);
Call_PushCell(target);
Call_Finish();
pdata[target].pendingTrollBan = GetClientUserId(client);
EnableTroll(target, "No Profanity");
LogAction(client, target, "\"%L\" marked \"%L\" as troll", client, target);
ShowActivityEx(client, "[FTT] ", "marked %N as troll", target);
return true;
} }
} }

View file

@ -24,10 +24,10 @@ ArrayList g_spSpawnQueue;
// Finds position, sends to SpawnSpecialAtPosition // Finds position, sends to SpawnSpecialAtPosition
// target client index // target client index
stock bool SpawnSpecialForTarget(SpecialType specialType, int target, SpecialSpawnFlags spawnFlags = Special_Anywhere) { stock bool SpawnSpecialForTarget(SpecialType specialType, int target, int spawnFlags = view_as<int>(Special_Anywhere)) {
static float pos[3]; static float pos[3];
int internalFlags = view_as<int>(SPI_AlwaysTarget); int internalFlags = view_as<int>(SPI_AlwaysTarget);
if(spawnFlags == Special_OnTarget) { if(spawnFlags & view_as<int>(Special_OnTarget)) {
static float ang[3]; static float ang[3];
static float testPos[3]; static float testPos[3];
testPos = pos; testPos = pos;
@ -45,7 +45,10 @@ stock bool SpawnSpecialForTarget(SpecialType specialType, int target, SpecialSpa
float minDistance = GetIdealMinDistance(specialType); float minDistance = GetIdealMinDistance(specialType);
GetHorizontalPositionFromOrigin(pos, ang, minDistance, testPos); GetHorizontalPositionFromOrigin(pos, ang, minDistance, testPos);
if(!FindSuitablePosition(pos, testPos, minDistance, 100)) { if(!FindSuitablePosition(pos, testPos, minDistance, 100)) {
L4D_GetRandomPZSpawnPosition(target, view_as<int>(specialType), 10, testPos); if(spawnFlags & view_as<int>(Special_SpawnDirectOnFailure))
GetClientAbsOrigin(target, pos);
else
L4D_GetRandomPZSpawnPosition(target, view_as<int>(specialType), 10, testPos);
} }
pos = testPos; pos = testPos;
} }

View file

@ -37,7 +37,10 @@ void SetupTrolls() {
SetupTroll("Goo", "Spawns a spitter puddle underneath them", TrollMod_Instant); SetupTroll("Goo", "Spawns a spitter puddle underneath them", TrollMod_Instant);
index = SetupTroll("Sticky Goo", "Slows player down in goo", TrollMod_Constant); index = SetupTroll("Sticky Goo", "Slows player down in goo", TrollMod_Constant);
Trolls[index].AddFlagPrompt(false); Trolls[index].AddFlagPrompt(false);
Trolls[index].AddFlag("60% Movement Speed", true); Trolls[index].AddFlag("90% Movement Speed", true);
Trolls[index].AddFlag("80% Movement Speed", false);
Trolls[index].AddFlag("70% Movement Speed", false);
Trolls[index].AddFlag("50% Movement Speed", false);
Trolls[index].AddFlag("30% Movement Speed", false); Trolls[index].AddFlag("30% Movement Speed", false);
Trolls[index].AddFlag("0% Movement Speed", false); Trolls[index].AddFlag("0% Movement Speed", false);
stickyGooIndex = index; stickyGooIndex = index;
@ -166,7 +169,10 @@ void SetupTrolls() {
SetCategory("Movement"); SetCategory("Movement");
index = SetupTroll("Slow Speed", "Sets player speed to 0.8x of normal speed", TrollMod_Constant); index = SetupTroll("Slow Speed", "Sets player speed to 0.8x of normal speed", TrollMod_Constant);
Trolls[index].AddFlagPrompt(false); Trolls[index].AddFlagPrompt(false);
Trolls[index].AddFlag("60% Movement Speed", true); Trolls[index].AddFlag("90% Movement Speed", true);
Trolls[index].AddFlag("80% Movement Speed", false);
Trolls[index].AddFlag("70% Movement Speed", false);
Trolls[index].AddFlag("50% Movement Speed", false);
Trolls[index].AddFlag("30% Movement Speed", false); Trolls[index].AddFlag("30% Movement Speed", false);
Trolls[index].AddFlag("0% 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("Higher Gravity", "Sets player gravity to 1.3x of normal gravity", TrollMod_Constant);
@ -185,6 +191,7 @@ void SetupTrolls() {
SetCategory("Misc"); SetCategory("Misc");
SetupTroll("Gun Jam", "On reload, small chance their gun gets jammed - Can't reload.", TrollMod_Constant); SetupTroll("Gun Jam", "On reload, small chance their gun gets jammed - Can't reload.", TrollMod_Constant);
SetupTroll("No Shove", "Prevents a player from shoving", TrollMod_Constant); SetupTroll("No Shove", "Prevents a player from shoving", TrollMod_Constant);
SetupTroll("No Button Touchie", "Stops people from pressing buttons", TrollMod_Constant);
index = SetupTroll("Meta: Inverse", "Uhm you are not supposed to see this...", TrollMod_Instant); index = SetupTroll("Meta: Inverse", "Uhm you are not supposed to see this...", TrollMod_Instant);
Trolls[index].hidden = true; Trolls[index].hidden = true;
Trolls[index].AddFlagPrompt(false); Trolls[index].AddFlagPrompt(false);
@ -224,8 +231,11 @@ bool ApplyAffect(int victim, const Troll troll, int activator, trollModifier mod
} else if(StrEqual(troll.name, "Slow Speed")) { } else if(StrEqual(troll.name, "Slow Speed")) {
if(toActive) { if(toActive) {
float movement = 0.0; float movement = 0.0;
if(flags & 1) movement = 0.6; if(flags & 1) movement = 0.9;
else if(flags & 2) movement = 0.3; else if(flags & 2) movement = 0.8;
else if(flags & 4) movement = 0.7;
else if(flags & 8) movement = 0.5;
else if(flags & 16) movement = 0.3;
SetEntPropFloat(victim, Prop_Send, "m_flLaggedMovementValue", movement); SetEntPropFloat(victim, Prop_Send, "m_flLaggedMovementValue", movement);
} else } else
SetEntPropFloat(victim, Prop_Send, "m_flLaggedMovementValue", 1.0); SetEntPropFloat(victim, Prop_Send, "m_flLaggedMovementValue", 1.0);

View file

@ -84,14 +84,14 @@ public void OnPluginStart() {
RegAdminCmd("sm_ftp", Command_FeedTheCrescendoTroll, ADMFLAG_KICK, "Applies a manual punish on the last crescendo activator"); RegAdminCmd("sm_ftp", Command_FeedTheCrescendoTroll, ADMFLAG_KICK, "Applies a manual punish on the last crescendo activator");
RegAdminCmd("sm_ftc", Command_ApplyComboTrolls, ADMFLAG_KICK, "Applies predefined combinations of trolls"); RegAdminCmd("sm_ftc", Command_ApplyComboTrolls, ADMFLAG_KICK, "Applies predefined combinations of trolls");
#if defined _actions_included #if defined _actions_included
RegAdminCmd("sm_witch_attack", Command_WitchAttack, ADMFLAG_CHEATS, "Makes all witches target a player"); RegAdminCmd("sm_witch_attack", Command_WitchAttack, ADMFLAG_BAN, "Makes all witches target a player");
#endif #endif
RegAdminCmd("sm_insta", Command_InstaSpecial, ADMFLAG_KICK, "Spawns a special that targets them, close to them."); RegAdminCmd("sm_insta", Command_InstaSpecial, ADMFLAG_KICK, "Spawns a special that targets them, close to them.");
RegAdminCmd("sm_stagger", Command_Stagger, ADMFLAG_KICK, "Stagger a player"); RegAdminCmd("sm_stagger", Command_Stagger, ADMFLAG_KICK, "Stagger a player");
RegAdminCmd("sm_inface", Command_InstaSpecialFace, ADMFLAG_KICK, "Spawns a special that targets them, right in their face."); RegAdminCmd("sm_inface", Command_InstaSpecialFace, ADMFLAG_KICK, "Spawns a special that targets them, right in their face.");
RegAdminCmd("sm_bots_attack", Command_BotsAttack, ADMFLAG_CHEATS, "Instructs all bots to attack a player until they have X health."); RegAdminCmd("sm_bots_attack", Command_BotsAttack, ADMFLAG_BAN, "Instructs all bots to attack a player until they have X health.");
RegAdminCmd("sm_scharge", Command_SmartCharge, ADMFLAG_CHEATS, "Auto Smart charge"); RegAdminCmd("sm_scharge", Command_SmartCharge, ADMFLAG_BAN, "Auto Smart charge");
RegAdminCmd("sm_healbots", Command_HealTarget, ADMFLAG_CHEATS, "Make bots heal a player"); RegAdminCmd("sm_healbots", Command_HealTarget, ADMFLAG_BAN, "Make bots heal a player");
HookEvent("player_spawn", Event_PlayerSpawn); HookEvent("player_spawn", Event_PlayerSpawn);
HookEvent("player_first_spawn", Event_PlayerFirstSpawn); HookEvent("player_first_spawn", Event_PlayerFirstSpawn);