Skip to content

Commit

Permalink
Prevent bunnyhopping in push triggers with upward push direction (#7)
Browse files Browse the repository at this point in the history
  • Loading branch information
Mikusch committed Apr 13, 2021
1 parent de472ba commit 95d9a77
Showing 1 changed file with 14 additions and 11 deletions.
25 changes: 14 additions & 11 deletions addons/sourcemod/scripting/tf-bhop.sp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public Plugin myinfo =
name = "Team Fortress 2 Bunnyhop",
author = "Mikusch",
description = "Simple TF2 bunnyhopping plugin",
version = "1.4.3",
version = "1.4.4",
url = "https://github.com/Mikusch/tf-bhop"
}

Expand Down Expand Up @@ -210,17 +210,20 @@ public bool HitTrigger(int entity)
char classname[16];
if (GetEntityClassname(entity, classname, sizeof(classname)) && StrEqual(classname, "trigger_push"))
{
Handle trace = TR_ClipCurrentRayToEntityEx(MASK_ALL, entity);
bool didHit = TR_DidHit(trace);
delete trace;

g_InTriggerPush = didHit;
return !didHit;
}
else
{
return true;
float pushdir[3];
GetEntPropVector(entity, Prop_Data, "m_vecPushDir", pushdir);
if (pushdir[2] > 0.0)
{
Handle trace = TR_ClipCurrentRayToEntityEx(MASK_ALL, entity);
bool didHit = TR_DidHit(trace);
delete trace;

g_InTriggerPush = didHit;
return !didHit;
}
}

return true;
}

void CreateMemoryPatch(MemoryPatch &handle, const char[] name)
Expand Down

0 comments on commit 95d9a77

Please sign in to comment.