Skip to content

Commit

Permalink
Firstperson Spectating Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Batfoxkid committed Sep 22, 2024
1 parent 1c50971 commit 30e78e1
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 3 deletions.
14 changes: 14 additions & 0 deletions addons/sourcemod/scripting/saxtonhale.sp
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,20 @@ enum
CHANNEL_MAX = 6,
};

enum
{
OBS_MODE_NONE = 0, // not in spectator mode
OBS_MODE_DEATHCAM, // special mode for death cam animation
OBS_MODE_FREEZECAM, // zooms to a target, and freeze-frames on them
OBS_MODE_FIXED, // view from a fixed camera position
OBS_MODE_IN_EYE, // follow a player in first person view
OBS_MODE_CHASE, // follow a player in third person view
OBS_MODE_POI, // PASSTIME point of interest - game objective, big fight, anything interesting; added in the middle of the enum due to tons of hard-coded "<ROAMING" enum compares
OBS_MODE_ROAMING, // free roaming

NUM_OBSERVER_MODES,
};

char g_strPreferencesName[][] = {
"Boss Selection",
"",
Expand Down
13 changes: 10 additions & 3 deletions addons/sourcemod/scripting/vsh/base_boss.sp
Original file line number Diff line number Diff line change
Expand Up @@ -436,12 +436,19 @@ Action AttachEnt_SetTransmit(int iAttachEnt, int iClient)
if (iOwner == INVALID_ENT_REFERENCE)
return Plugin_Stop;

if (iOwner != iClient)
{
if (GetEntPropEnt(iClient, Prop_Send, "m_hObserverTarget") == iOwner && GetEntProp(iClient, Prop_Send, "m_iObserverMode") == OBS_MODE_IN_EYE)
return Plugin_Stop;
}
else if (TF2_IsPlayerInCondition(iOwner, TFCond_Taunting))
{
return Plugin_Continue;
}

if (TF2_IsPlayerInCondition(iOwner, TFCond_Cloaked) || TF2_IsPlayerInCondition(iOwner, TFCond_Disguised) || TF2_IsPlayerInCondition(iOwner, TFCond_Stealthed))
return Plugin_Stop;

if (iOwner != iClient || TF2_IsPlayerInCondition(iOwner, TFCond_Taunting))
return Plugin_Continue;

return Plugin_Stop;
}

Expand Down

0 comments on commit 30e78e1

Please sign in to comment.