//DOUBLEJUMP/FLY
addHook("ThinkFrame", do
    for player in players.iterate
 if player.pizzanoreal
and player.charability == CA_NONE
and not ((player.mo.state == S_PLAY_PZNOMACH2JUMPDIVE) or (player.mo.state == S_PLAY_WALLCLIMBSPIN_CANCEL) or (player.mo.state == S_PLAY_SUPERJUMP_PREPARE) or (player.mo.state == S_PLAY_PZNOMACH3JUMPDIVE))
and P_IsObjectOnGround(player.mo)
and player.machxdtimerr <= 60 then
   player.charability = CA_DOUBLEJUMP
     end
 if player.pizzanoreal
and player.charability == CA_DOUBLEJUMP 
and player.machxdtimerr >= 60
or player.pizzanoreal
and player.charability == CA_DOUBLEJUMP 
and player.pznocrounch == true
and not P_IsObjectOnGround(player.mo) then
   player.charability = CA_NONE
     end
	  if player.pizzanoreal
	 and player.c1timr == 1
	 and player.machxdtimerr >= 160
	 and not P_IsObjectOnGround(player.mo)
	 and not (player.cmd.buttons & BT_CUSTOM3) 
	 and not ((player.mo.state == S_PLAY_BODYSLAM_INITIAL) or (player.mo.state == S_PLAY_DEAD) or (player.mo.state == S_PLAY_PAIN) 
	 or (player.mo.state == S_PLAY_BODYSLAMLAND) or (player.mo.state == S_PLAY_KUNGFU1)
	 or (player.mo.state == S_PLAY_KUNGFU2) or (player.mo.state == S_PLAY_CHAINSAW)
	 or (player.mo.state == S_PLAY_KUNGFU3)
	 or (player.mo.state == S_PLAY_WALLCLIMBB)
	 or (player.mo.state == S_PLAY_KUNGFU4)
	 or (player.mo.state == S_PLAY_KUNGFU5)
	 or (player.mo.state == S_PLAY_KUNGFU6)
	 or (player.mo.state == S_PLAY_SUPERJUMP_PREPARE)
	 or (player.mo.state == S_PLAY_SUPERJUMP_RELEASE)
	 or (player.mo.state == S_PLAY_WALLCLIMBSPIN_CANCEL)
	 or (player.mo.state == S_PLAY_SUPERJUMP_PREPARESIDE)
	 or (player.mo.state == S_PLAY_FIRE)
	 or (player.mo.state == S_PLAY_SUPERJUMP_SIDE)
	 or (player.mo.state == S_PLAY_FIRE_FINISH)
	 or (player.mo.state == S_PLAY_AIRKUNGFU1)
	 or (player.mo.state == S_PLAY_AIRKUNGFU2)
	 or (player.mo.state == S_PLAY_BODYSLAM_FINAL))
	
     player.mo.state = S_PLAY_SUPERJUMP_PREPARESIDE
	  P_CreateRing(player)
	    end
		 
		 if player.pizzanoreal
		 and ((player.mo.state == S_PLAY_SUPERJUMP_SIDE)) then
		 
		 P_SetObjectMomZ(player.realmo, 0*FRACUNIT, false)
		 end
		 if player.pizzanoreal
		 and ((player.mo.state == S_PLAY_MACH5PZNO)
		 or (player.mo.state == S_PLAY_SUPERJUMP_SIDE))then
		 player.pznoFlying = true
		 if player.speed <= 50*FRACUNIT
		 P_InstaThrust(player.mo, player.drawangle, 55*FRACUNIT)
		 end
		 end
		 if player.pizzanoreal
		 and ((player.mo.state == S_PLAY_SUPERJUMP_PREPARESIDE)) then
		 P_SetObjectMomZ(player.realmo, 0*FRACUNIT, false)
		 end
		 if player.pizzanoreal
	     and player.c1timr == 1
		  and player.pznoFlying == true 
		 and ((player.mo.state == S_PLAY_SUPERJUMP_SIDE))
		 
		 player.pstomp = true
		 P_InstaThrust(player.mo, player.drawangle, 0*FRACUNIT)
		 player.mo.state = S_PLAY_BODYSLAM_INITIAL
		 player.pznoFlying = false
		 
		 end
		 if player.pizzanoreal
	     and (player.cmd.buttons & BT_JUMP)
		 and ((player.mo.state == S_PLAY_SUPERJUMP_SIDE)
		 or (player.mo.state == S_PLAY_MACH5PZNO))
		 
		 player.mo.state = S_PLAY_PZNOMACH3JUMP
		 player.pznoFlying = false
		 P_SetObjectMomZ(player.realmo, 12*FRACUNIT, false)
		 player.flyytimerr = 0
		 end
		 if player.pznoFlying == true 
		 and player.mo.state == S_PLAY_PZNOMACH3JUMP
		 player.gonnarunwhilefly = false
		 player.pznoFlying = false
		 end
		 if player.pznoFlying == true 
		 and not P_IsObjectOnGround(player.mo)
		 and player.mo.state == S_PLAY_MACH5PZNO
		 player.mo.state = S_PLAY_SUPERJUMP_SIDE
		 player.gonnarunwhilefly = false
		 end 
		 if player.gonnarunwhilefly == true 
		 and not P_IsObjectOnGround(player.mo)
		 or player.mo.state == S_PLAY_PAIN
		 player.gonnarunwhilefly = false
		 end 
		 
		 if player.pznoFlying == true 
		 and P_IsObjectOnGround(player.mo)
		 player.gonnarunwhilefly = true
		 end
		 if player.gonnarunwhilefly == true 
		 player.mo.state = S_PLAY_MACH5PZNO
		 end
		 if player.gonnarunwhilefly == false
		 or player.machxdtimerr <= 10
		 or player.speed <= 3*FRACUNIT
		 if player.mo.state == S_PLAY_MACH5PZNO
		 player.mo.state = S_PLAY_STND
		 player.gonnarunwhilefly = false
		 end
		 end
		 if player.pizzanoreal
		 and player.machxdtimerr <= 10
		 player.pznoFlying = false
		 end
	 end
 end)

addHook("MobjMoveBlocked", function(mo)
	if mo and mo.valid
and mo.player and mo.player.valid
and (mo.skin == "pizzano")
and ((mo.state == S_PLAY_SUPERJUMP_SIDE)
or (mo.state == S_PLAY_FIRE)
or (mo.state == S_PLAY_FIRE_FINISH))

or (mo.skin == "pizzano")
and mo.pznoFlying == true

		P_InstaThrust(mo, mo.player.drawangle, -12*FRACUNIT) 
		P_SetObjectMomZ(mo, 5*FRACUNIT, false)
		S_StartSound(mo, sfx_slfnl, 255)
		P_StartQuake(FRACUNIT*11, TICRATE/4*2)
		mo.pznoFlying = false
		mo.wallcrashedinidair = true
		mo.state = S_PLAY_WALLCRASSH_AIR_START
	end
end, MT_PLAYER)

addHook("ThinkFrame", function()
    for player in players.iterate do
       if player.pizzanoreal
		if player.wallcrashedinidair == true
		and P_IsObjectOnGround(player.mo)
		player.wallcrashedinidair = false
	end
	
	if player.wallcrashedinidair == true
	and player.pznoFlying == true
	player.pznoFlying = false
	end
	if player.pznoFlying == false
	and (player.mo.state == S_PLAY_SUPERJUMP_SIDE)
	and player.wallcrashedinidair == true
	player.mo.state = S_PLAY_WALLCRASSH_AIR_START
end
end
end
end)

//new pizzano superjump cancel :DD
addHook("ThinkFrame", function()
    for player in players.iterate do
       if player.pizzanoreal
		if (player.mo.state == S_PLAY_SUPERJUMP_RELEASE)
		and player.c1timr == 1
		player.mo.state = S_PLAY_SPINDASH
		 P_InstaThrust(player.mo, player.drawangle, 43*FRACUNIT)
		 P_SetObjectMomZ(player.mo, 7*FRACUNIT, false)
	end
end
end
end)
