Skip to content

Commit

Permalink
Life steal addition fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Mentrillum authored Jun 10, 2020
1 parent 53cfc35 commit a4bdee1
Show file tree
Hide file tree
Showing 5 changed files with 617 additions and 352 deletions.
8 changes: 5 additions & 3 deletions addons/sourcemod/scripting/sf2.sp
Original file line number Diff line number Diff line change
Expand Up @@ -2505,7 +2505,7 @@ public Action Command_RemoveSlender(int iClient,int args)

NPCRemove(iBossIndex);

if (SF_IsBoxingMap() && (GetRoundState() == SF2RoundState_Escape))
if (SF_IsBoxingMap() && (GetRoundState() == SF2RoundState_Escape) && view_as<bool>(GetProfileNum(sProfile,"boxing_boss",0)))
{
g_iSlenderBoxingBossCount -= 1;
}
Expand Down Expand Up @@ -2821,7 +2821,7 @@ public Action Command_AddSlender(int iClient,int args)

SpawnSlender(Npc, flPos);

if (SF_IsBoxingMap() && (GetRoundState() == SF2RoundState_Escape))
if (SF_IsBoxingMap() && (GetRoundState() == SF2RoundState_Escape) && view_as<bool>(GetProfileNum(sProfile,"boxing_boss",0)))
{
g_iSlenderBoxingBossCount += 1;
}
Expand Down Expand Up @@ -4739,11 +4739,13 @@ void SetRoundState(SF2RoundState iRoundState)
}
if (SF_IsBoxingMap())
{
char sBuffer[SF2_MAX_PROFILE_NAME_LENGTH];
for (int iBoss = 0; iBoss < MAX_BOSSES; iBoss++)
{
SF2NPC_BaseNPC Npc = view_as<SF2NPC_BaseNPC>(iBoss);
if (!Npc.IsValid()) continue;
g_iSlenderBoxingBossCount += 1;
Npc.GetProfile(sBuffer, sizeof(sBuffer));
if (view_as<bool>(GetProfileNum(sBuffer,"boxing_boss",0))) g_iSlenderBoxingBossCount += 1;
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion addons/sourcemod/scripting/sf2/chasepath.sp
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,7 @@ methodmap ChaserPathLogic
vecJumpVel[2] /= time;

vecJumpVel[2] = speed;
vecJumpVel[2] += 20.0;

float flJumpSpeed = GetVectorLength(vecJumpVel);
float flMaxSpeed = 650.0;
Expand Down Expand Up @@ -395,7 +396,6 @@ methodmap ChaserPathLogic
Handle hTrace = INVALID_HANDLE;
if (fTraceFilterFunction != view_as<TraceEntityFilter>(INVALID_FUNCTION))
{

hTrace = TR_TraceRayFilterEx(vecTracePos, forwadPos, MASK_PLAYERSOLID, RayType_EndPoint, fTraceFilterFunction, nextbot.GetEntity());
}
else
Expand Down
166 changes: 99 additions & 67 deletions addons/sourcemod/scripting/sf2/npc.sp
Original file line number Diff line number Diff line change
Expand Up @@ -1717,6 +1717,7 @@ float Boss_HitBox_Damage(int hitbox,int attacker,float damage,int damagetype,boo
{
char sProfile[SF2_MAX_PROFILE_NAME_LENGTH];
NPCGetProfile(iBossIndex, sProfile, sizeof(sProfile));
int iState = g_iSlenderState[iBossIndex];

if (NPCChaserIsStunEnabled(iBossIndex))
{
Expand All @@ -1726,7 +1727,7 @@ float Boss_HitBox_Damage(int hitbox,int attacker,float damage,int damagetype,boo
}

//(Experimental)
if (view_as<bool>(GetProfileNum(sProfile,"healthbar",0)))
if (view_as<bool>(GetProfileNum(sProfile,"healthbar",0)) && iState != STATE_STUN)
{
UpdateHealthBar(iBossIndex);
}
Expand Down Expand Up @@ -1864,46 +1865,49 @@ stock bool SlenderCanHearPlayer(int iBossIndex,int client, SoundType iSoundType)
float flMyEyePos[3];
SlenderGetEyePosition(iBossIndex, flMyEyePos);

if (iSoundType == SoundType_Footstep)
{
if (!(GetEntityFlags(client) & FL_ONGROUND)) return false;

if (GetEntProp(client, Prop_Send, "m_bDucking") || GetEntProp(client, Prop_Send, "m_bDucked")) flDistance *= 1.85;
if (IsClientReallySprinting(client)) flDistance *= 0.66;

hTrace = TR_TraceRayFilterEx(flMyPos, flHisPos, MASK_NPCSOLID, RayType_EndPoint, TraceRayDontHitCharactersOrEntity, iSlender);
bTraceHit = TR_DidHit(hTrace);
CloseHandle(hTrace);
}
else if (iSoundType == SoundType_Voice || iSoundType == SoundType_Flashlight)
{
float flHisEyePos[3];
GetClientEyePosition(client, flHisEyePos);

hTrace = TR_TraceRayFilterEx(flMyEyePos, flHisEyePos, MASK_NPCSOLID, RayType_EndPoint, TraceRayDontHitCharactersOrEntity, iSlender);
bTraceHit = TR_DidHit(hTrace);
CloseHandle(hTrace);

flDistance *= 0.5;
}
else if (iSoundType == SoundType_Weapon)
switch (iSoundType)
{
float flHisMins[3], flHisMaxs[3];
GetEntPropVector(client, Prop_Send, "m_vecMins", flHisMins);
GetEntPropVector(client, Prop_Send, "m_vecMaxs", flHisMaxs);

float flMiddle[3];
for (int i = 0; i < 2; i++) flMiddle[i] = (flHisMins[i] + flHisMaxs[i]) / 2.0;

float flEndPos[3];
GetClientAbsOrigin(client, flEndPos);
AddVectors(flHisPos, flMiddle, flEndPos);

hTrace = TR_TraceRayFilterEx(flMyEyePos, flEndPos, MASK_NPCSOLID, RayType_EndPoint, TraceRayDontHitCharactersOrEntity, iSlender);
bTraceHit = TR_DidHit(hTrace);
CloseHandle(hTrace);
case SoundType_Footstep:
{
if (!(GetEntityFlags(client) & FL_ONGROUND)) return false;

flDistance *= 0.66;
if (GetEntProp(client, Prop_Send, "m_bDucking") || GetEntProp(client, Prop_Send, "m_bDucked")) flDistance *= 1.85;
if (IsClientReallySprinting(client)) flDistance *= 0.66;

hTrace = TR_TraceRayFilterEx(flMyPos, flHisPos, MASK_NPCSOLID, RayType_EndPoint, TraceRayDontHitCharactersOrEntity, iSlender);
bTraceHit = TR_DidHit(hTrace);
CloseHandle(hTrace);
}
case SoundType_Voice, SoundType_Flashlight:
{
float flHisEyePos[3];
GetClientEyePosition(client, flHisEyePos);

hTrace = TR_TraceRayFilterEx(flMyEyePos, flHisEyePos, MASK_NPCSOLID, RayType_EndPoint, TraceRayDontHitCharactersOrEntity, iSlender);
bTraceHit = TR_DidHit(hTrace);
CloseHandle(hTrace);

flDistance *= 0.5;
}
case SoundType_Weapon:
{
float flHisMins[3], flHisMaxs[3];
GetEntPropVector(client, Prop_Send, "m_vecMins", flHisMins);
GetEntPropVector(client, Prop_Send, "m_vecMaxs", flHisMaxs);

float flMiddle[3];
for (int i = 0; i < 2; i++) flMiddle[i] = (flHisMins[i] + flHisMaxs[i]) / 2.0;

float flEndPos[3];
GetClientAbsOrigin(client, flEndPos);
AddVectors(flHisPos, flMiddle, flEndPos);

hTrace = TR_TraceRayFilterEx(flMyEyePos, flEndPos, MASK_NPCSOLID, RayType_EndPoint, TraceRayDontHitCharactersOrEntity, iSlender);
bTraceHit = TR_DidHit(hTrace);
CloseHandle(hTrace);

flDistance *= 0.66;
}
}

if (bTraceHit) flDistance *= 1.66;
Expand Down Expand Up @@ -2074,35 +2078,53 @@ void SlenderCastFootstep(int iBossIndex, const char[] sSectionName)
StrCat(sBuffer, sizeof(sBuffer), "_pitch");
int iPitch = GetProfileNum(sProfile, sBuffer, 100);

if (iState == STATE_IDLE && flCooldownIdle != 0.0)
{
float flCooldownIdle2 = flCooldownIdle;
g_flSlenderNextFootstepIdleSound[iBossIndex] = GetGameTime() + flCooldownIdle2;
EmitSoundToAll(sPath, slender, iChannel, iLevel, _, flVolume, iPitch);
}
else if (iState == STATE_WANDER || iState == STATE_ALERT && flCooldownWalk != 0.0)
{
float flCooldownWalk2 = flCooldownWalk;
g_flSlenderNextFootstepWalkSound[iBossIndex] = GetGameTime() + flCooldownWalk2;
EmitSoundToAll(sPath, slender, iChannel, iLevel, _, flVolume, iPitch);
}
else if (iState == STATE_CHASE && flCooldownRun != 0.0)
{
float flCooldownRun2 = flCooldownRun;
g_flSlenderNextFootstepRunSound[iBossIndex] = GetGameTime() + flCooldownRun2;
EmitSoundToAll(sPath, slender, iChannel, iLevel, _, flVolume, iPitch);
}
else if (iState == STATE_STUN && flCooldownStun != 0.0)
{
float flCooldownStun2 = flCooldownStun;
g_flSlenderNextFootstepStunSound[iBossIndex] = GetGameTime() + flCooldownStun2;
EmitSoundToAll(sPath, slender, iChannel, iLevel, _, flVolume, iPitch);
}
else if (iState == STATE_ATTACK && flCooldownAttack != 0.0)
switch (iState)
{
float flCooldownAttack2 = flCooldownAttack;
g_flSlenderNextFootstepAttackSound[iBossIndex] = GetGameTime() + flCooldownAttack;
EmitSoundToAll(sPath, slender, iChannel, iLevel, _, flVolume, iPitch);
case STATE_IDLE:
{
if (flCooldownIdle != 0.0)
{
float flCooldownIdle2 = flCooldownIdle;
g_flSlenderNextFootstepIdleSound[iBossIndex] = GetGameTime() + flCooldownIdle2;
EmitSoundToAll(sPath, slender, iChannel, iLevel, _, flVolume, iPitch);
}
}
case STATE_WANDER, STATE_ALERT:
{
if (flCooldownWalk != 0.0)
{
float flCooldownWalk2 = flCooldownWalk;
g_flSlenderNextFootstepWalkSound[iBossIndex] = GetGameTime() + flCooldownWalk2;
EmitSoundToAll(sPath, slender, iChannel, iLevel, _, flVolume, iPitch);
}
}
case STATE_CHASE:
{
if (flCooldownRun != 0.0)
{
float flCooldownRun2 = flCooldownRun;
g_flSlenderNextFootstepRunSound[iBossIndex] = GetGameTime() + flCooldownRun2;
EmitSoundToAll(sPath, slender, iChannel, iLevel, _, flVolume, iPitch);
}
}
case STATE_STUN:
{
if (flCooldownStun != 0.0)
{
float flCooldownStun2 = flCooldownStun;
g_flSlenderNextFootstepStunSound[iBossIndex] = GetGameTime() + flCooldownStun2;
EmitSoundToAll(sPath, slender, iChannel, iLevel, _, flVolume, iPitch);
}
}
case STATE_ATTACK:
{
if (flCooldownAttack != 0.0)
{
float flCooldownAttack2 = flCooldownAttack;
g_flSlenderNextFootstepAttackSound[iBossIndex] = GetGameTime() + flCooldownAttack;
EmitSoundToAll(sPath, slender, iChannel, iLevel, _, flVolume, iPitch);
}
}
}
}
}
Expand Down Expand Up @@ -3148,6 +3170,16 @@ public bool TraceRayDontHitEntityAndProxies(int entity,int mask,any data)
return true;
}

public bool TraceRayDontHitAnyPlayer(int entity,int mask,any data)
{
if (entity == data) return false;
if (entity > 0 && entity <= MaxClients)
{
if (g_bPlayerProxy[entity] || IsClientInGhostMode(entity)) return false;
}
return true;
}

public bool TraceRayDontHitCharactersOrEntity(int entity,int mask, any data)
{
if (entity == data) return false;
Expand Down
Loading

0 comments on commit a4bdee1

Please sign in to comment.