//slam
addHook("PlayerThink",function(player)
 if player.pizzanoreal
and player.mo.state == S_PLAY_BODYSLAM_INITIAL then
   P_SetObjectMomZ(player.realmo, 5*FRACUNIT, false)
end
end)

addHook("PlayerThink",function(player)
 if player.pizzanoreal
and player.mo.state == S_PLAY_BODYSLAM_FINAL then
   P_SetObjectMomZ(player.realmo, -65*FRACUNIT, false)
   player.powers[pw_strong] = STR_HEAVY|STR_SPRING|STR_SPIKE|STR_ANIM|STR_FLOOR
end
end)

addHook("ThinkFrame", do
    for player in players.iterate
         if player.pizzanoreal
                if player.c2timr == 1
				and not (player.mo.eflags & MFE_GOOWATER)
				and not P_IsObjectOnGround(player.mo) 
				and player.machxdtimerr <= 10 then
		            player.pstomp = true
					player.slamTimer = $+1
	                  else
					player.slamTimer = 0
					
					end
					if player.slamTimer == 1
					and not ((player.mo.state == S_PLAY_BODYSLAM_INITIAL) 
					or (player.mo.state == S_PLAY_CROUNCH_AIR) or (player.mo.state == S_PLAY_WALLCRASSH) or (player.mo.state == S_PLAY_STUN) or (player.mo.state == S_PLAY_SUPERJUMP_PREPARE) or (player.mo.state == S_PLAY_SUPERJUMP_RELEASE) or (player.mo.state == S_PLAY_DEAD) or (player.mo.state == S_PLAY_PAIN) or (player.mo.state == S_PLAY_BODYSLAM_FINAL)) then
					     player.mo.state = S_PLAY_BODYSLAM_INITIAL
					end
				end
			end
end)

addHook("ThinkFrame", function()
     for player in players.iterate do
	  if player.pizzanoreal
and player.pstomp == true
and P_IsObjectOnGround(player.mo)

player.pstomp = false
player.mo.state = S_PLAY_BODYSLAMLAND
P_NukeEnemies(player.mo, player.mo, 300*FRACUNIT)
S_StartSound(player.mo, sfx_slfnl)
P_StartQuake(FRACUNIT*11, TICRATE/4*2)
P_SetObjectMomZ(player.realmo, 0*FRACUNIT, false)
P_InstaThrust(player.mo, player.mo.angle, 0*FRACUNIT)
P_Thrust(player.mo, player.mo.angle, 0*FRACUNIT)
end
end
end)

addHook("ThinkFrame", function()
     for player in players.iterate do
	  if player.pizzanoreal
and player.pstomp == true
and ((player.mo.state == S_PLAY_STUN) or (player.mo.state == S_PLAY_PAIN) or (player.mo.state == S_PLAY_DEAD) or (player.mo.state == S_PLAY_WALLCRASSH) or (player.mo.state == S_PLAY_KUNGFU2) or (player.mo.state == S_PLAY_CROUNCH_AIR) or (player.mo.state == S_PLAY_KUNGFU1)) then
 
player.pstomp = false
end
end
end)

addHook("ThinkFrame", function()
     for player in players.iterate do
	  if player.pizzanoreal
and player.pstomp == true
and player.mo.state == S_PLAY_SPRING then

player.pstomp = false
end
end
end)

addHook("ThinkFrame", function()
     for player in players.iterate do
	 if player.pizzanoreal
and player.pstomp == true
and ((player.mo.state == S_PLAY_BODYSLAM_INITIAL) or (player.mo.state == S_PLAY_BODYSLAM_FINAL))
and (player.mo.eflags & MFE_GOOWATER)

player.pstomp = false
player.mo.state = S_PLAY_FALL
end
end
end)

//slam effect(superjumptoo)
addHook("ThinkFrame", do
	for p in players.iterate
	if p.pizzanoreal
		if ((p.mo.state == S_PLAY_BODYSLAM_FINAL) 
		or (p.mo.state == S_PLAY_SUPERJUMP_RELEASE))
		and leveltime%5 == 0
			local ring = P_SpawnMobj(p.mo.x,p.mo.y,p.mo.z,MT_THOK)
			ring.state = S_MACH4RING
			ring.fuse = 999
			ring.tics = 20
			ring.angle = p.drawangle+ANGLE_90
			ring.scale = p.mo.scale-FRACUNIT/2
			ring.destscale = p.mo.scale*2
			ring.colorized = true
			ring.renderflags = $|RF_FLOORSPRITE
			ring.color = SKINCOLOR_WHITE
			if (p.mo.eflags & MFE_VERTICALFLIP)
				ring.flags2 = $|MF2_OBJECTFLIP
				ring.eflags = $|MFE_VERTICALFLIP
			end
		end
	end
	end
end)