Skip to content

Commit

Permalink
Fixes, ff2_special Enchantment
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Batfoxkid committed Aug 13, 2024
1 parent 0feb9da commit caa6564
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 12 deletions.
10 changes: 6 additions & 4 deletions addons/sourcemod/scripting/ff2r_default_abilities.sp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand All @@ -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))
Expand All @@ -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;
}

Expand All @@ -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<int>(TFTeam_Spectator))
Expand All @@ -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;
}

Expand Down
19 changes: 17 additions & 2 deletions addons/sourcemod/scripting/freak_fortress_2/bosses.sp
Original file line number Diff line number Diff line change
Expand Up @@ -831,7 +831,12 @@ static void LoadCharacter(const char[] character, int charset, const char[] map,
{
ConfigMap cfgsound = val.cfg;
if(cfgsound)
music = view_as<bool>(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)
Expand Down Expand Up @@ -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];
Expand Down Expand Up @@ -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)
{
Expand All @@ -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);
Expand Down
2 changes: 0 additions & 2 deletions addons/sourcemod/scripting/freak_fortress_2/gamemode.sp
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
6 changes: 6 additions & 0 deletions addons/sourcemod/scripting/freak_fortress_2/goomba.sp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
7 changes: 5 additions & 2 deletions addons/sourcemod/scripting/freak_fortress_2/preference.sp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down
8 changes: 6 additions & 2 deletions addons/sourcemod/scripting/freak_fortress_2/weapons.sp
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,8 @@ void Weapons_ShowChanges(int client, int entity)
{
CPrintToChat(client, "%t%s:", "Prefix", localizedWeaponName);
}

delete kv;
}
else
#endif
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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;
}
}
}
Expand Down

0 comments on commit caa6564

Please sign in to comment.