// this is to set some vars used for later, only do this if your playing as sonic
addHook("PlayerThink", function(player)
if not player and player.valid and player.mo.skin == "sonic" and and player.playerstate == PST_LIVE return end
if player.mo.collidewall == nil
player.mo.collidewall = false
end
if player.mo.collidewall == true
player.mo.collidewall = false
end
end)
// this is for checking if your blocked from moving by say, a wall? also checks if your moving towards it as well as a character check.
addHook("MobjMoveBlocked", function(mo)
if mo.player and mo.skin == "sonic" and mo.valid and mo.player.playerstate == PST_LIVE
if not P_IsObjectOnGround(mo)
if not (mo.player.pflags & PF_ANALOGMODE)
if mo.player.cmd.forwardmove > 0
mo.collidewall = true
end
else
if not (mo.player.cmd.forwardmove == 0)
or not (mo.player.cmd.sidemove == 0)
mo.collidewall = true
end
end
end
end
end, MT_PLAYER)
// this is for when your on the wall and you hit jump, another character check as pre usaual.
addHook("JumpSpecial", function(player)
if player.mo and player.mo.skin == "sonic" and player.mo.valid and player.playerstate == PST_LIVE
if player.mo.collidewall
P_DoJump(player)
S_StartSound(player.mo, sfx_zoom)
P_InstaThrust(player.mo, player.mo.angle, -5*FRACUNIT)
P_SetObjectMomZ(player.mo, 15*FRACUNIT)
player.pflags = $1 & ~(PF_THOKKED)
player.mo.collidewall = false
return true
end
end
end)