Skip to content

Commit

Permalink
feat: walljump
Browse files Browse the repository at this point in the history
  • Loading branch information
Nopied committed Aug 22, 2023
1 parent 99640e9 commit 2a97f73
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions addons/sourcemod/scripting/ff2_module/dhooks.sp
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,26 @@ public MRESReturn DHookCallback_OnEntityHit_Post(int weapon, DHookParam params)
}
}
}
else if(TF2_GetClientTeam(iOwner) != BossTeam && !IsBoss(iOwner)
&& ent == 0)
{
// WallJump
float velocity[3];
GetEntPropVector(iOwner, Prop_Data, "m_vecVelocity", velocity);
if(velocity[2] < -192.0) return MRES_Ignored;

// -48.0 ~ -192.0
float multiplier = 1.0;
if(velocity[2] < -48.0)
multiplier = 1.0 - ((velocity[2] * -1.0) * 0.0052083); // 1/192

velocity[2] = 600.0 * multiplier;
SetEntPropEnt(iOwner, Prop_Send, "m_hGroundEntity", -1);
SetEntityFlags(iOwner, GetEntityFlags(iOwner) & ~FL_ONGROUND);

TeleportEntity(iOwner, NULL_VECTOR, NULL_VECTOR, velocity);
SetEntPropVector(iOwner, Prop_Data, "m_vecAbsVelocity", velocity);
}

return MRES_Ignored;
}
Expand Down

0 comments on commit 2a97f73

Please sign in to comment.