Skip to content

Commit

Permalink
Fix Modifier Particle Rendering (#412)
Browse files Browse the repository at this point in the history
  • Loading branch information
Batfoxkid authored Nov 24, 2024
1 parent 41de3c2 commit 2d3f490
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 11 deletions.
25 changes: 21 additions & 4 deletions addons/sourcemod/scripting/saxtonhale.sp
Original file line number Diff line number Diff line change
Expand Up @@ -1159,11 +1159,18 @@ public void TF2_OnConditionAdded(int iClient, TFCond nCond)
if (SaxtonHale_IsValidBoss(iClient))
{
SaxtonHaleBase(iClient).CallFunction("OnConditionAdded", nCond);
if (nCond == TFCond_Milked)

switch (nCond)
{
EmitSoundToClient(iClient, SOUND_JAR_EXPLODE);
PrintCenterText(iClient, "You were milked!");
case TFCond_Cloaked, TFCond_Disguised, TFCond_Stealthed:
{
ClearBossEffects(iClient);
}
case TFCond_Milked:
{
EmitSoundToClient(iClient, SOUND_JAR_EXPLODE);
PrintCenterText(iClient, "You were milked!");
}
}
}

Expand All @@ -1183,7 +1190,17 @@ public void TF2_OnConditionRemoved(int iClient, TFCond nCond)
if (g_iTotalRoundPlayed <= 0) return;

if (SaxtonHale_IsValidBoss(iClient))
{
SaxtonHaleBase(iClient).CallFunction("OnConditionRemoved", nCond);

switch (nCond)
{
case TFCond_Cloaked, TFCond_Disguised, TFCond_Stealthed:
{
ApplyBossEffects(SaxtonHaleBase(iClient));
}
}
}

if (nCond == TFCond_Disguising || nCond == TFCond_Disguised)
UpdateClientGlowEnt(iClient);
Expand Down
24 changes: 17 additions & 7 deletions addons/sourcemod/scripting/vsh/base_boss.sp
Original file line number Diff line number Diff line change
Expand Up @@ -435,8 +435,6 @@ public Action Timer_BossRageMusic(Handle hTimer, SaxtonHaleBase boss)

Action AttachEnt_SetTransmit(int iAttachEnt, int iClient)
{
SetEdictFlags(iAttachEnt, GetEdictFlags(iAttachEnt) &~ FL_EDICT_ALWAYS);

int iOwner = GetEntPropEnt(iAttachEnt, Prop_Data, "m_pParent");
if (iOwner == INVALID_ENT_REFERENCE)
return Plugin_Stop;
Expand All @@ -446,15 +444,15 @@ Action AttachEnt_SetTransmit(int iAttachEnt, int 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))
else if (!TF2_IsPlayerInCondition(iOwner, TFCond_Taunting))
{
return Plugin_Continue;
return Plugin_Stop;
}

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

return Plugin_Stop;
return Plugin_Continue;
}

void ApplyBossEffects(SaxtonHaleBase boss)
Expand All @@ -469,13 +467,25 @@ void ApplyBossEffects(SaxtonHaleBase boss)
break;

int iEntity = TF2_AttachParticle(sEffect, boss.iClient);
SetEdictFlags(iEntity, GetEdictFlags(iEntity) &~ FL_EDICT_ALWAYS);
SDKHook(iEntity, SDKHook_SetTransmit, AttachEnt_SetTransmit);
SetEdictFlags(iEntity, GetEdictFlags(iEntity) | FL_EDICT_ALWAYS);
CreateTimer(0.2, Timer_ApplySetTransmit, iEntity, TIMER_FLAG_NO_MAPCHANGE);

sEffect[0] = 0;
}
}

static Action Timer_ApplySetTransmit(Handle hTimer, int iEntity)
{
// Entity reference here
if(IsValidEntity(iEntity))
{
SetEdictFlags(iEntity, GetEdictFlags(iEntity) &~ FL_EDICT_ALWAYS);
SDKHook(iEntity, SDKHook_SetTransmit, AttachEnt_SetTransmit);
}

return Plugin_Continue;
}

void ClearBossEffects(int iClient)
{
int iEntity = INVALID_ENT_REFERENCE;
Expand Down

0 comments on commit 2d3f490

Please sign in to comment.