Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions addons/sourcemod/configs/vsh/vsh.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -2433,6 +2433,7 @@
"vsh_rps_enable" "0" //Allow everyone use Rock Paper Scissors Taunt?
"vsh_blacklist_amount" "2" //How many bosses can a player blacklist? (0 disables this feature)
"vsh_top_score_outline" "0" //Should bosses see the top scoring player through walls via an outline?
"vsh_block_fake_hit_sound" "1" //Should melee hitsound desync be blocked by the gamemode?

"vsh_boss_chance_saxton" "0.30" //% chance for next boss to be Saxton Hale from normal bosses pool (0.0 - 1.0)
"vsh_boss_chance_multi" "0.15" //% chance for next boss to be Multiple bosses (0.0 - 1.0)
Expand Down
28 changes: 28 additions & 0 deletions addons/sourcemod/gamedata/vsh.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,12 @@
"linux" "@_ZN16CObjectDispenser15CouldHealTargetEP11CBaseEntity"
"windows" "\x55\x8B\xEC\x53\x56\x8B\x75\x08\x57\x8B\xF9\x8B\x87\x38\x01\x00\x00"
}
"CTFWeaponBaseMelee::DoSwingTraceInternal"
{
"library" "server"
"linux" "@_ZN18CTFWeaponBaseMelee20DoSwingTraceInternalER10CGameTracebP10CUtlVectorIS0_10CUtlMemoryIS0_iEE"
"windows" "\x53\x8B\xDC\x83\xEC\x08\x83\xE4\xF0\x83\xC4\x04\x55\x8B\x6B\x04\x89\x6C\x24\x04\x8B\xEC\x81\xEC\x38\x05\x00\x00"
}
}
"Functions"
{
Expand Down Expand Up @@ -93,6 +99,28 @@
}
}
}
"CTFWeaponBaseMelee::DoSwingTraceInternal"
{
"signature" "CTFWeaponBaseMelee::DoSwingTraceInternal"
"callconv" "thiscall"
"return" "bool"
"this" "entity"
"arguments"
{
"trace"
{
"type" "objectptr"
}
"bCleave"
{
"type" "bool"
}
"pTargetTraceVector"
{
"type" "vectorptr"
}
}
}
}
"Offsets"
{
Expand Down
22 changes: 20 additions & 2 deletions addons/sourcemod/scripting/saxtonhale.sp
Original file line number Diff line number Diff line change
Expand Up @@ -462,6 +462,7 @@ ConVar tf_arena_preround_time;
#include "vsh/function/func_native.sp"

#include "vsh/blacklist.sp"
#include "vsh/custommelee.sp"
#include "vsh/classlimit.sp"
#include "vsh/command.sp"
#include "vsh/console.sp"
Expand Down Expand Up @@ -540,6 +541,7 @@ public void OnPluginStart()
Command_Init();
Console_Init();
Cookies_Init();
CustomMelee_Init();
Dome_Init();
Event_Init();
FuncClass_Init();
Expand Down Expand Up @@ -601,6 +603,7 @@ public void OnPluginStart()
SaxtonHaleFunction("OnWeaponSwitchPost", ET_Ignore, Param_Cell);
SaxtonHaleFunction("OnConditionAdded", ET_Ignore, Param_Cell);
SaxtonHaleFunction("OnConditionRemoved", ET_Ignore, Param_Cell);
SaxtonHaleFunction("OnArenaRoundStart", ET_Ignore);

func = SaxtonHaleFunction("OnSoundPlayed", ET_Hook, Param_Array, Param_CellByRef, Param_String, Param_CellByRef, Param_FloatByRef, Param_CellByRef, Param_CellByRef, Param_CellByRef, Param_String, Param_CellByRef);
func.SetParam(1, Param_Array, VSHArrayType_Static, MAXPLAYERS);
Expand Down Expand Up @@ -763,6 +766,7 @@ public void OnPluginStart()
g_ConfigConvar.Create("vsh_rps_enable", "1", "Allow everyone use Rock Paper Scissors Taunt?", _, true, 0.0, true, 1.0);
g_ConfigConvar.Create("vsh_blacklist_amount", "2", "Maximum amount of bosses a player can blacklist for themselves (0 disables the feature)", _, true, 0.0);
g_ConfigConvar.Create("vsh_top_score_outline", "0", "Lets bosses see the top scoring player through walls via an outline.", _, true, 0.0, true, 1.0);
g_ConfigConvar.Create("vsh_block_fake_hit_sound", "1", "Makes the gamemode block fake client predicted melee hit sounds.", _, true, 0.0, true, 1.0);

//Incase of lateload, call client join functions
for (int iClient = 1; iClient <= MaxClients; iClient++)
Expand Down Expand Up @@ -828,6 +832,7 @@ public void OnPluginEnd()
RemoveClientGlowEnt(iClient);
}

CustomMelee_OnPluginEnd();
Plugin_Cvars(false);
}

Expand Down Expand Up @@ -987,6 +992,7 @@ public void OnMapStart()
g_iSpritesLaserbeam = PrecacheModel("materials/sprites/laserbeam.vmt", true);
g_iSpritesGlow = PrecacheModel("materials/sprites/glow01.vmt", true);

CustomMelee_OnMapStart();
Dome_MapStart();

CreateTimer(60.0, Timer_WelcomeMessage);
Expand Down Expand Up @@ -1083,6 +1089,11 @@ public void OnEntityCreated(int iEntity, const char[] sClassname)
}
}

public void OnEntityDestroyed(int iEntity)
{
CustomMelee_OnEntityDestroyed(iEntity);
}

public Action Crossbow_OnTouch(int iEntity, int iToucher)
{
if (iToucher <= 0 || iToucher > MaxClients || !IsClientInGame(iToucher))
Expand Down Expand Up @@ -1748,8 +1759,13 @@ void Client_OnButtonRelease(int iClient, int button)

public Action TF2_CalcIsAttackCritical(int iClient, int iWeapon, char[] sWepClassName, bool &bResult)
{
if (!g_bEnabled) return Plugin_Continue;
if (g_iTotalRoundPlayed <= 0) return Plugin_Continue;
if (!g_bEnabled)
return Plugin_Continue;

CustomMelee_CalcIsAttackCritical(iWeapon, sWepClassName);

if (g_iTotalRoundPlayed <= 0)
return Plugin_Continue;

SaxtonHaleBase boss = SaxtonHaleBase(iClient);
if (boss.bValid)
Expand Down Expand Up @@ -1790,6 +1806,8 @@ public Action NormalSoundHook(int clients[MAXPLAYERS], int &numClients, char sam
if (boss.bValid)
return boss.CallFunction("OnSoundPlayed", clients, numClients, sample, channel, volume, level, pitch, flags, soundEntry, seed);
}

CustomMelee_OnSoundHook(clients, numClients, entity, channel);
return Plugin_Continue;
}

Expand Down
7 changes: 7 additions & 0 deletions addons/sourcemod/scripting/vsh/abilities/ability_dash_jump.sp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,13 @@ public void DashJump_GetHudInfo(SaxtonHaleBase boss, char[] sMessage, int iLengt
Format(sMessage, iLength, "%s\nDash charge: %d%%%%", sMessage, iCharge);
}

public void DashJump_OnArenaRoundStart(SaxtonHaleBase boss)
{
float flTimeUntilMaxCharge = boss.GetPropFloat("DashJump", "Cooldown") * boss.GetPropFloat("DashJump", "MaxCharge");
g_flDashJumpCooldownWait[boss.iClient] = GetGameTime() + flTimeUntilMaxCharge;
boss.CallFunction("UpdateHudInfo", 0.0, flTimeUntilMaxCharge); // Update every frame until dash charge maxes out
}

public void DashJump_OnButtonPress(SaxtonHaleBase boss, int iButton)
{
if (iButton == IN_RELOAD && GameRules_GetRoundState() != RoundState_Preround && !TF2_IsPlayerInCondition(boss.iClient, TFCond_Dazed))
Expand Down
7 changes: 7 additions & 0 deletions addons/sourcemod/scripting/vsh/abilities/ability_lunge.sp
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,13 @@ public void Lunge_GetHudInfo(SaxtonHaleBase boss, char[] sMessage, int iLength,
}
}

public void Lunge_OnArenaRoundStart(SaxtonHaleBase boss)
{
float flTimeUntilMaxCharge = boss.GetPropFloat("Lunge", "Cooldown");
g_flLungeCooldownWait[boss.iClient] = GetGameTime() + flTimeUntilMaxCharge;
boss.CallFunction("UpdateHudInfo", 0.0, flTimeUntilMaxCharge); // Update every frame until charge maxes out
}

static bool CanLunge(SaxtonHaleBase boss)
{
return !TF2_IsPlayerInCondition(boss.iClient, TFCond_Dazed) &&
Expand Down
2 changes: 1 addition & 1 deletion addons/sourcemod/scripting/vsh/bosses/boss_pyrocar.sp
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ public Action PyroCar_OnAttackDamageAlive(SaxtonHaleBase boss, int victim, int &
}
}

g_hPyrocarHealTimer[victim] = CreateTimer(0.6, Timer_RemoveLessHealing, GetClientSerial(victim));
g_hPyrocarHealTimer[victim] = CreateTimer(1.0, Timer_RemoveLessHealing, GetClientSerial(victim));
}

if (g_flPyrocarGasCharge[boss.iClient] <= g_iMaxGasPassers * g_flGasMinCharge)
Expand Down
89 changes: 89 additions & 0 deletions addons/sourcemod/scripting/vsh/command.sp
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ public void Command_Init()
Command_Create("special", Command_ForceSpecialRound);
Command_Create("dome", Command_ForceDome);
Command_Create("rage", Command_SetRage);
Command_Create("blacklistdata", Command_BlacklistData);
}

stock void Command_Create(const char[] sCommand, ConCmd callback)
Expand Down Expand Up @@ -517,5 +518,93 @@ public Action Command_SetRage(int iClient, int iArgs)
}

ReplyToCommand(iClient, "%s%s You do not have permission to use this command.", TEXT_TAG, TEXT_ERROR);
return Plugin_Handled;
}

enum struct BlacklistData
{
int iAmount;
char sType[32];
char sName[64];
}

public Action Command_BlacklistData(int iClient, int iArgs)
{
if (!g_bEnabled) return Plugin_Continue;

// Command has no menu option and doesn't a reply to people without access on purpose
if (Client_HasFlag(iClient, ClientFlags_Admin))
{
ArrayList aList = new ArrayList(sizeof(BlacklistData));
for (int iOther = 1; iOther <= MaxClients; iOther++)
{
if (!IsClientInGame(iOther) || IsFakeClient(iOther))
continue;

ArrayList aBlacklist = Blacklist_Get(iOther);
int iLength = aBlacklist.Length;
if (iLength == 0)
{
delete aBlacklist;
continue;
}

for (int i = 0; i < iLength; i++)
{
BlacklistData data;
aBlacklist.GetString(i, data.sType, sizeof(data.sType));

int iIndex = aList.FindString(data.sType, BlacklistData::sType);
if (iIndex == -1)
{
SaxtonHale_CallFunction(data.sType, "GetBossName", data.sName, sizeof(data.sName));
data.iAmount = 1;
aList.PushArray(data);
}
else
{
aList.GetArray(iIndex, data);
data.iAmount++;
aList.SetArray(iIndex, data);
}
}

delete aBlacklist;
}

aList.Sort(Sort_Descending, Sort_Integer);

char sMessage[2048];
int iLength = aList.Length;
if (iLength == 0)
{
sMessage = " \nNo bosses are blacklisted in this session.\n "
}
else
{
sMessage = " \nList of bosses blacklisted in this session:\n \n"

for (int i = 0; i < iLength; i++)
{
BlacklistData data;
aList.GetArray(i, data, sizeof(data));

Format(sMessage, sizeof(sMessage), "%s- %s: %d\n", sMessage, data.sName, data.iAmount);
}
}

delete aList;

if (iClient == 0)
{
PrintToServer(sMessage);
}
else
{
PrintToChat(iClient, "%s%s Blacklist data has been sent to your console, if it exists.", TEXT_TAG, TEXT_COLOR);
PrintToConsole(iClient, sMessage);
}
}

return Plugin_Handled;
}
Loading