From caa6564656c15c04fd0a9dd05f5206775e326e5d Mon Sep 17 00:00:00 2001 From: Batfoxkid Date: Tue, 13 Aug 2024 09:57:32 -0700 Subject: [PATCH] Fixes, ff2_special Enchantment Rcon permission grants full access to ff2_special command Goomba no longer recoils bosses Fixes #124 Fixes #199 Fixes #200 Fixes #202 Fixes #203 Fixes #205 Fixes #212 --- .../scripting/ff2r_default_abilities.sp | 10 ++++++---- .../scripting/freak_fortress_2/bosses.sp | 19 +++++++++++++++++-- .../scripting/freak_fortress_2/gamemode.sp | 2 -- .../scripting/freak_fortress_2/goomba.sp | 6 ++++++ .../scripting/freak_fortress_2/preference.sp | 7 +++++-- .../scripting/freak_fortress_2/weapons.sp | 8 ++++++-- 6 files changed, 40 insertions(+), 12 deletions(-) diff --git a/addons/sourcemod/scripting/ff2r_default_abilities.sp b/addons/sourcemod/scripting/ff2r_default_abilities.sp index dfee2dd..5ac6995 100644 --- a/addons/sourcemod/scripting/ff2r_default_abilities.sp +++ b/addons/sourcemod/scripting/ff2r_default_abilities.sp @@ -2591,7 +2591,7 @@ void Rage_CloneAttack(int client, ConfigData cfg) FF2R_CreateBoss(target, null); } - // Same team dead players + // 1st: Same team dead players victim[victims++] = target; } @@ -2601,9 +2601,10 @@ void Rage_CloneAttack(int client, ConfigData cfg) if(amount) { + victims = 0; for(int target = 1; target <= MaxClients; target++) { - if(client == target || !IsClientInGame(target) || IsPlayerAlive(target) || GetClientTeam(target) == team) + if(client == target || !IsClientInGame(target) || !IsPlayerAlive(target) || GetClientTeam(target) != team) continue; if(FF2R_GetBossData(target)) @@ -2614,7 +2615,7 @@ void Rage_CloneAttack(int client, ConfigData cfg) FF2R_CreateBoss(target, null); } - // Same team alive players + // 2nd: Same team alive players victim[victims++] = target; } @@ -2623,6 +2624,7 @@ void Rage_CloneAttack(int client, ConfigData cfg) if(amount) { + victims = 0; for(int target = 1; target <= MaxClients; target++) { if(client == target || !IsClientInGame(target) || IsPlayerAlive(target) || GetClientTeam(target) <= view_as(TFTeam_Spectator)) @@ -2636,7 +2638,7 @@ void Rage_CloneAttack(int client, ConfigData cfg) FF2R_CreateBoss(target, null); } - // Any dead players + // 3rd: Any non-spec dead players victim[victims++] = target; } diff --git a/addons/sourcemod/scripting/freak_fortress_2/bosses.sp b/addons/sourcemod/scripting/freak_fortress_2/bosses.sp index b63cdd5..9995e40 100644 --- a/addons/sourcemod/scripting/freak_fortress_2/bosses.sp +++ b/addons/sourcemod/scripting/freak_fortress_2/bosses.sp @@ -831,7 +831,12 @@ static void LoadCharacter(const char[] character, int charset, const char[] map, { ConfigMap cfgsound = val.cfg; if(cfgsound) - music = view_as(cfgsound.GetInt("time", length2)); + { + length2 = 0; + cfgsound.GetInt("time", length2); + if(length2) + music = true; + } } if(StrContains(key, SndExts[0]) != -1 || StrContains(key, SndExts[1]) != -1) @@ -1576,6 +1581,14 @@ bool Bosses_CanAccessBoss(int client, int special, bool playing = false, int tea if(enabled && (!cfg.GetBool("enabled", blocked) || !blocked)) return false; + if(playing) + { + // Don't select duo bosses at random + int duo = -1; + if(cfg.GetInt("companion", duo) && duo != -1) + return false; + } + cfg.GetBool("preview", preview, false); static char buffer1[512]; @@ -1680,6 +1693,8 @@ void Bosses_CreateFromConfig(int client, ConfigMap cfg, int team, int leader = 0 } } } + + ConfigMap copy = cfg.Clone(ThisPlugin); if(Client(client).Cfg) { @@ -1690,7 +1705,7 @@ void Bosses_CreateFromConfig(int client, ConfigMap cfg, int team, int leader = 0 EnableSubplugins(); - Client(client).Cfg = cfg.Clone(ThisPlugin); + Client(client).Cfg = copy; if(GetClientTeam(client) != team) SDKCall_ChangeClientTeam(client, team); diff --git a/addons/sourcemod/scripting/freak_fortress_2/gamemode.sp b/addons/sourcemod/scripting/freak_fortress_2/gamemode.sp index 90b4f27..bcb6562 100644 --- a/addons/sourcemod/scripting/freak_fortress_2/gamemode.sp +++ b/addons/sourcemod/scripting/freak_fortress_2/gamemode.sp @@ -471,9 +471,7 @@ void Gamemode_RoundStart() { if(!bvb && IsFakeClient(client) && GetClientTeam(client) != mercTeam) { - SetEntProp(client, Prop_Send, "m_lifeState", 2); ChangeClientTeam(client, mercTeam); - SetEntProp(client, Prop_Send, "m_lifeState", 0); } else { diff --git a/addons/sourcemod/scripting/freak_fortress_2/goomba.sp b/addons/sourcemod/scripting/freak_fortress_2/goomba.sp index 1360203..50fc701 100644 --- a/addons/sourcemod/scripting/freak_fortress_2/goomba.sp +++ b/addons/sourcemod/scripting/freak_fortress_2/goomba.sp @@ -63,5 +63,11 @@ public Action OnStomp(int attacker, int victim, float &damageMultiplier, float & JumpPower *= 1.5; return Plugin_Changed; } + else if(Client(attacker).IsBoss) + { + JumpPower = 0.0; + return Plugin_Changed; + } + return Plugin_Continue; } \ No newline at end of file diff --git a/addons/sourcemod/scripting/freak_fortress_2/preference.sp b/addons/sourcemod/scripting/freak_fortress_2/preference.sp index f01eacb..621f9fd 100644 --- a/addons/sourcemod/scripting/freak_fortress_2/preference.sp +++ b/addons/sourcemod/scripting/freak_fortress_2/preference.sp @@ -1506,12 +1506,14 @@ static Action Preference_ForceBossCmd(int client, int args) { special = Bosses_GetByName(name, false, _, lang); } + + bool rcon = !client || CheckCommandAccess(client, "sm_rcon", ADMFLAG_RCON); if(special == -1) { FReplyToCommand(client, "%t", "Boss Not Found"); } - else if(!client || Bosses_CanAccessBoss(client, special, true)) + else if(rcon || Bosses_CanAccessBoss(client, special, false) || Bosses_CanAccessBoss(client, special, true)) { BossOverride = special; Bosses_GetBossName(special, name, sizeof(name), lang); @@ -1553,9 +1555,10 @@ static void ForceBossMenu(int client, int item) char num[12]; int lang = GetClientLanguage(client); int length = Bosses_GetConfigLength(); + bool rcon = CheckCommandAccess(client, "sm_rcon", ADMFLAG_RCON); for(int i; i < length; i++) { - if(Bosses_CanAccessBoss(client, i, true)) + if(rcon || Bosses_CanAccessBoss(client, i, false) || Bosses_CanAccessBoss(client, i, true)) { IntToString(i, num, sizeof(num)); Bosses_GetBossName(i, name, sizeof(name), lang); diff --git a/addons/sourcemod/scripting/freak_fortress_2/weapons.sp b/addons/sourcemod/scripting/freak_fortress_2/weapons.sp index ca73c81..1af8f5b 100644 --- a/addons/sourcemod/scripting/freak_fortress_2/weapons.sp +++ b/addons/sourcemod/scripting/freak_fortress_2/weapons.sp @@ -306,6 +306,8 @@ void Weapons_ShowChanges(int client, int entity) { CPrintToChat(client, "%t%s:", "Prefix", localizedWeaponName); } + + delete kv; } else #endif @@ -582,10 +584,10 @@ stock void Weapons_OnHitBossPre(int attacker, int victim, float &damage, int wea } } } + + delete kv; } - delete kv; - if(GetEntityClassname(weapon, buffer, sizeof(buffer))) { int slot = TF2_GetClassnameSlot(buffer); @@ -634,6 +636,8 @@ stock void Weapons_OnHitBoss(int attacker, int newPlayerDamage, int lastPlayerDa if(value) SetEntProp(attacker, Prop_Data, "m_iAmmo", GetEntProp(attacker, Prop_Data, "m_iAmmo", _, 2) + value, _, 2); } + + delete kv; } } }