addHook("PlayerThink", function(player) -- Resets if the player bonks when they touch the ground. if player and player.valid and player.mo.valid then if P_IsObjectOnGround(player.mo) or (player.mo.eflags & MFE_SPRUNG) -- Checks if player is on the ground or used a spring. player.bonk = false -- resets bonk to false.. end end end) addHook("MobjMoveBlocked", function(mo) -- Checks if player is hitting a wall local player = mo.player if player.bonk == false and player.speed >= player.runspeed -- checks if player can bonk. P_DoPlayerPain(player) if player.speed >= 60*FRACUNIT -- checks if player is going fast enough to bounce of the wall. P_InstaThrust(player.mo, player.mo.angle, (player.speed - 36*FRACUNIT) * -1) -- Bounces the player back. player.mo.angle = $*-1 -- reverses their view. end S_StartSound(player.mo, sfx_s3ka2) -- Plays the bonk sound effect. end end, MT_PLAYER)