freeslot( "SPR_FAST", "S_BOOST_SPARK", "S_BOOST_SPARK2", "S_BOOST_SPARK3","SPR_BRHA","SPR_BRHC", "S_BOOSTPARTICLE", "SPR_BVFX", "S_BOOSTVFX", "sfx_stm", "sfx_lan", "sfx_tik1", "sfx_tik2", "sfx_tik3", "MT_STOMPER", "MT_BOOSTVFX", "sfx_boost" ,"sfx_one" ,"sfx_fard" ,"sfx_roll","sfx_gener","sfx_rusher","sfx_fronti", "sfx_step" ,"sfx_onee" ,"sfx_impac" ,"sfx_bvfx" ,"sfx_bvfx2" , "sfx_fx2e", "sfx_fx1e")



states[S_BOOSTPARTICLE] = {
        sprite = SPR_FAST,
        frame = A|FF_ANIMATE|FF_PAPERSPRITE,
        tics = 10,
        var1 = 4,
        var2 = 1,
        nextstate = S_NULL
}

states[S_BOOST_SPARK] = {
	sprite = SPR_BARX,
	frame = A|FF_FULLBRIGHT,
	tics = 3,
	action = A_RollAngle,
	var1 = 20,
	nextstate = S_BOOST_SPARK2,
}

states[S_BOOST_SPARK2] = {
	sprite = SPR_BARX,
	frame = B|FF_FULLBRIGHT,
	tics = 3,
	action = A_RollAngle,
	var1 = 20,
	nextstate = S_BOOST_SPARK3,
}

states[S_BOOST_SPARK3] = {
	sprite = SPR_BARX,
	frame = C|FF_FULLBRIGHT,
	tics = 3,
	action = A_RollAngle,
	var1 = 20,
	nextstate = S_NULL,
}


mobjinfo[MT_BOOSTVFX] = {
	doomednum = -1,
	spawnstate = S_BOOSTVFX,
	flags = MF_NOCLIP|MF_SCENERY|MF_NOGRAVITY
}
states[S_BOOSTVFX] = {
    sprite = SPR_BVFX,
	frame = A|FF_ANIMATE|FF_FULLBRIGHT,
	tics = 16,
	var1 = 9,
	var2 = 1,
	nextstate = S_DEATHSTATE
}

freeslot("SKINCOLOR_GREENRAY") -- freesloting colors 
skincolors[SKINCOLOR_GREENRAY] = {
    name = "Ggray",
    ramp = {112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112},
    chatcolor = V_BLUEMAP,
    accessible = false
}

freeslot("SKINCOLOR_SHADOWSUPP")
skincolors[SKINCOLOR_SHADOWSUPP] = {
    name = "Supsha",
    ramp = {73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73},
    chatcolor = V_BLUEMAP,
    accessible = false
}

freeslot("SKINCOLOR_CYLOOP")
skincolors[SKINCOLOR_CYLOOP] = {
    name = "Cyloop",
    ramp = skincolors[SKINCOLOR_CYAN].ramp, 
    invcolor = SKINCOLOR_MAGENTA,
    invshade = 9,
    chatcolor = V_SKYMAP,
    accessible = true
}

local cyloopPattern = {
    SKINCOLOR_CYAN,
    SKINCOLOR_MAGENTA,
    SKINCOLOR_WHITE,
	SKINCOLOR_TEAL,
	SKINCOLOR_PURPLE,
	SKINCOLOR_RED
}


addHook("PlayerSpawn", function(player)
    if not (player and player.mo and player.mo.valid) then return end
player.mo.givehiddenanddark = true
    player.mo.shadowform_stamina = 30
end)

addHook("PlayerThink", function(player)
    if not (player and player.mo and player.mo.valid) then return end
    local mo = player.mo
    if mo.shadowform_stamina == nil then 
        mo.shadowform_stamina = 49
        mo.givehiddenanddark = true
    end
    if player.bvfxing == true then
	if leveltime % 4 == 0 then
        mo.shadowform_stamina = $ - 1
        
        if mo.shadowform_stamina <= 0 then
            mo.shadowform_stamina = 0
            player.bvfxing = false
            mo.vfx = 0
            if mo.skin then
                player.charflags = $ & ~SF_RUNONWATER
                player.charflags = $ & ~SF_CANBUSTWALLS
            end
        end
    end
end
end)

addHook("MobjDeath", function(target, inflictor, source)
    if (target and target.valid and target.flags & MF_ENEMY) 
    and (source and source.valid and source.player) then
        local player = source.player
        local mo = player.mo
        if mo and mo.valid and mo.shadowform_stamina ~= nil then
            mo.shadowform_stamina = $ + 25
            
            if mo.shadowform_stamina > 99 then
                mo.shadowform_stamina = 99
            end
            S_StartSound(mo, sfx_itemup)
        end
    end
end)

addHook("PlayerThink", function(player)
    if not (player and player.valid and player.mo and player.mo.valid) then return end
    local mo = player.mo
    if player.last_ring_count == nil then player.last_ring_count = player.rings or 0 end
    if mo.shadowform_stamina == nil then mo.shadowform_stamina = 49 end

    if player.rings > player.last_ring_count then
        local ringsGained = player.rings - player.last_ring_count
        
        if mo.shadowform_stamina ~= nil then
            mo.shadowform_stamina = $ + (ringsGained * 2)
            
            if mo.shadowform_stamina > 99 then
                mo.shadowform_stamina = 99
            end
        end
    end
    player.last_ring_count = player.rings
end)


addHook("ThinkFrame", function()

    if leveltime % 2 == 0 then
        local index = (leveltime / 2) % #cyloopPattern
        local targetColor = cyloopPattern[index + 1]
        skincolors[SKINCOLOR_CYLOOP].ramp = skincolors[targetColor].ramp
    end
end)
-- dont u freaking dare steal my code or else ima smack you



addHook("PlayerThink", function(player)	
if player.mo and player.mo.valid
if player.mo.shadowform_stamina >= 1
if player.speed >= player.runspeed
if player.mo.state == S_PLAY_SKID or player.mo.state == S_PLAY_GLIDE_LANDING
player.bvfxing = false
end
end
end
end
end)

addHook("PlayerThink", function(player)
if player.mo and player.mo.valid
if player.bvfxing == true 
if player.mo.state == S_PLAY_PAIN
player.bvfxing = false
end
end
end
end) 



addHook("ThinkFrame", do
	for player in players.iterate do
	if player.mo and player.mo.skin == "sonic"
		if player.bvfxing == false
			if (player.mo.state >= S_SONDASH1 and player.mo.state <= S_SONDASH8)
				and not (player.mo.tracer and player.mo.tracer.type == MT_TUBEWAYPOINT)
					player.mo.state = S_PLAY_RUN
				end    
			end
	end
end
end)

addHook("PlayerCanDamage", function(player)
    if player.bvfxing then
        return true
    end
end)



addHook("ThinkFrame", do
	for player in players.iterate do
	if player.mo and player.mo.skin == "sonic"
		if player.bvfxing == true
			if (player.mo.state >= S_PLAY_RUN and player.mo.state <= S_PLAY_RUN)
				and not (player.mo.tracer and player.mo.tracer.type == MT_TUBEWAYPOINT)
				and not (player.powers[pw_super])
					player.mo.state = S_SONDASH1
				end    
			end
			if (player.mo.state >= S_SONDASH1 and player.mo.state <= S_SONDASH8)
				player.panim = PA_RUN
		end
	end
end
end)



addHook("MobjMoveCollide", function(mo, spike) -- Spike breaking by ARJr.
    if mo.valid
    and (mo.type == MT_PLAYER)
	and mo.player.bvfxing
    and spike.type == MT_SPIKE
		if (spike.z >= (mo.z - 16*FRACUNIT)) and (spike.z <= (mo.z + mo.height + 16*FRACUNIT))
			P_KillMobj(spike, mo, mo)
		elseif (spike.flags2 & MF2_OBJECTFLIP)
		and (spike.z <= (mo.z - 16*FRACUNIT)) and (spike.z >= (mo.z + mo.height+ 16*FRACUNIT))
			P_KillMobj(spike, mo, mo)
        end
    end
end)


addHook("PlayerCanDamage", function(player) -- Player kills enemies while boosting
    if player.bvfxing then
        return true
    end
end)

addHook("MobjDamage", function(target, inflictor, source, damage)
    if not (source and source.valid and source.player and source.player.bvfxing) then return end
    if target and target.valid then
        if (target.flags & (MF_ENEMY|MF_BOSS)) then
            if (target.flags & MF_BOSS) then
                return P_DamageMobj(target, inflictor, source, damage * 2)
            end
            return true
        end
    end
end, MT_PLAYER)


addHook("PlayerThink", function(player)
	if player.mo and player.mo.valid
	if player.bvfxing == true
	if P_IsObjectOnGround(player.mo)
	player.mo.back = false
end
end
end
end)

addHook("PlayerThink", function(player)
if player.mo and player.mo.valid
if player.fastspawner == true
local fast = P_SpawnMobj(player.mo.x + (P_RandomRange(-50,50) * player.mo.scale),player.mo.y + (P_RandomRange(-50,50) * player.mo.scale),player.mo.z + (player.mo.height/2) + (P_RandomRange(-20,20) * player.mo.scale),MT_SMOKE)
	if fast and fast.valid
	fast.state = S_BOOSTPARTICLE
	fast.angle = player.drawangle
	fast.momx = player.mo.momx/2
	fast.momy = player.mo.momy/2
	fast.momz = player.mo.momz/2
	player.chosenbvfxcolorized = true
	fast.blendmode = AST_ADD
	fast.scale = player.mo.scale
	fast.frame = $|FF_FULLBRIGHT|FF_TRANS40
	fast.tics = 20
	fast.color = player.chosenbvfxcolor
end
 end	
 end
 end)
 
addHook("JumpSpecial", function(player)
if player.mo and player.mo.valid
if player.bvfxing == true
if player.mo.back == false
and (player.mo.state == S_PLAY_JUMP)
and not (player.pflags & PF_FULLSTASIS) 
local backer = P_SpawnMobj(player.mo.x, player.mo.y, player.mo.z, MT_BOOSTVFX)
backer.frame = $|FF_FLOORSPRITE
backer.angle = player.mo.angle + ANGLE_90
backer.flags = $1|MF_SOLID 
backer.tics = 10
backer.scale = FRACUNIT 
backer.scalespeed = FRACUNIT / 3
backer.destscale = FRACUNIT*2
backer.colorized = true
backer.blendmode = AST_ADD
player.mo.back = true 
backer.color = player.chosenbvfxcolor
end
end
end
end)	


-- new sheet

rawset(_G, "carry_enabled", true)

COM_AddCommand("togglecarry", function(player, arg)
    if not arg then
        local status = carry_enabled and "ENABLED" or "DISABLED"
        CONS_Printf(player, "Carry system is currently: " .. status)
        CONS_Printf(player, "Usage: togglecarry <on/off> or <1/0>")
        return
    end
    arg = arg:lower()
    if arg == "on" or arg == "1" then
        carry_enabled = true
        CONS_Printf(player, "Carry mechanic has been ENABLED.")
    elseif arg == "off" or arg == "0" then
        carry_enabled = false
        CONS_Printf(player, "Carry mechanic has been DISABLED.")
        
        for p in players.iterate do
            if p.carrying then
                if p.carrying.valid and p.carrying.player then
                    p.carrying.player.carriedby = nil
                    p.carrying.angle = 0
                    p.carrying.drawangle = 0
                end
                p.carrying = nil
            end
            p.carriedby = nil
        end
    else
        CONS_Printf(player, "Invalid argument! Use: on, off, 1, or 0")
    end
end)




local MAX_STAMINA = 50

addHook("PlayerThink", function(player)
    if not (player and player.valid and player.mo and player.mo.valid) then return end
    local mo = player.mo
    if mo.shadowform_stamina == nil then mo.shadowform_stamina = 49 end
    if P_IsObjectOnGround(mo) and player.bvfxing ~= true and player.speed < player.runspeed  then
       local chargeInterval = 15
        if player.speed < player.runspeed then
            chargeInterval = 8
        end
        if leveltime % chargeInterval == 0 then
            if mo.shadowform_stamina < MAX_STAMINA then
                mo.shadowform_stamina = $ + 1
            end
        end
    end
end)




-- walljumpo


local active_carrier_target = {}
local target_carried_by = {}
local grab_cooldown = {}

addHook("PlayerThink", function(player)
    if not (player and player.valid and player.mo and player.mo.valid) then return end
    if not player.cmd or player.spectator then return end
    if not grab_cooldown[player] then grab_cooldown[player] = 0 end
    if grab_cooldown[player] > 0 then grab_cooldown[player] = $ - 1 end
    if player.carrying == nil then player.carrying = nil end
    if player.carriedby == nil then player.carriedby = nil end 
    if player.carrying and player.carrying.valid then
        local targetmo = player.carrying local target = targetmo.player
        if not target or not target.valid then player.carrying = nil return end
        local idx = #target local target_menu = _G["BVFX_DATA"] and _G["BVFX_DATA"][idx] local target_carry_on = true
        if _G["BVFX_DATA"] ~= nil and target_menu ~= nil then
            if target_menu.menu_open == nil then target_carry_on = _G["carry_enabled"] end
        end
        if (player.cmd.buttons & BT_SPIN) then
            player.carrying = nil target.carriedby = nil grab_cooldown[player] = 18
            local forwardLaunch = 28 * FRACUNIT local upwardLaunch = 14 * FRACUNIT
            targetmo.momx = player.mo.momx + P_ReturnThrustX(player.mo, player.mo.angle, forwardLaunch)
            targetmo.momy = player.mo.momy + P_ReturnThrustY(player.mo, player.mo.angle, forwardLaunch)
            targetmo.momz = player.mo.momz + upwardLaunch
            target.pflags = $ | PF_JUMPED
            target.panim = PA_JUMP
            if targetmo.state ~= S_PLAY_ROLL then targetmo.state = S_PLAY_ROLL end
            S_StartSound(player.mo, sfx_zoom)
            local finalVfxColor = target.chosenbvfxcolor or targetmo.color
            local fast = P_SpawnMobj(targetmo.x + (P_RandomRange(-50, 50) * targetmo.scale), targetmo.y + (P_RandomRange(-50, 50) * targetmo.scale), targetmo.z + (targetmo.height / 2) + (P_RandomRange(-20, 20) * targetmo.scale), MT_SMOKE)
            if fast and fast.valid then
                fast.state = S_BOOSTPARTICLE fast.angle = player.drawangle fast.momx = targetmo.momx / 2 fast.momy = targetmo.momy / 2 fast.momz = targetmo.momz / 2
                fast.colorized = true fast.blendmode = AST_ADD fast.scale = targetmo.scale fast.frame = $ | FF_FULLBRIGHT | FF_TRANS40 fast.color = finalVfxColor
            end
            local fast2 = P_SpawnMobj(targetmo.x + (P_RandomRange(-50, 50) * targetmo.scale), targetmo.y + (P_RandomRange(-50, 50) * targetmo.scale), targetmo.z + (targetmo.height / 2) + (P_RandomRange(-20, 20) * targetmo.scale), MT_SMOKE)
            if fast2 and fast2.valid then
                fast2.state = S_BOOSTPARTICLE fast2.angle = player.drawangle fast2.momx = targetmo.momx / 2 fast2.momy = targetmo.momy / 2 fast2.momz = targetmo.momz / 2
                fast2.colorized = true fast2.blendmode = AST_ADD fast2.scale = targetmo.scale fast2.frame = $ | FF_FULLBRIGHT | FF_TRANS40 fast2.color = finalVfxColor
            end
            local trail = P_SpawnGhostMobj(targetmo)
            if trail and trail.valid then
                trail.colorized = true trail.tics = 3 trail.blendmode = AST_ADD trail.frame = $ | FF_FULLBRIGHT
                P_MoveOrigin(trail, targetmo.x, targetmo.y, targetmo.z) trail.color = finalVfxColor
            end
            targetmo.angle = player.drawangle
            targetmo.drawangle = player.drawangle
            target.drawangle = player.drawangle
            return
        end
        if not _G["carry_enabled"] or not target_carry_on or not (player.bvfxing == true) then
            target.carriedby = nil player.carrying = nil targetmo.angle = 0 targetmo.drawangle = 0 return
        end
        target.bvfxing = false local dist = -30 * FRACUNIT local height = 9 * FRACUNIT 
        local goalX = player.mo.x + P_ReturnThrustX(player.mo, player.drawangle, dist) local goalY = player.mo.y + P_ReturnThrustY(player.mo, player.drawangle, dist) local goalZ = player.mo.z + height
        if not P_TryMove(targetmo, goalX, goalY, true) then end
        targetmo.angle = player.drawangle + ANGLE_180 targetmo.drawangle = player.drawangle + ANGLE_180 targetmo.z = goalZ
        targetmo.momx = player.mo.momx targetmo.momy = player.mo.momy targetmo.momz = player.mo.momz
        local finalVfxColor = target.chosenbvfxcolor or targetmo.color
        local fast = P_SpawnMobj(targetmo.x + (P_RandomRange(-50, 50) * targetmo.scale), targetmo.y + (P_RandomRange(-50, 50) * targetmo.scale), targetmo.z + (targetmo.height / 2) + (P_RandomRange(-20, 20) * targetmo.scale), MT_SMOKE)
        if fast and fast.valid then
            fast.state = S_BOOSTPARTICLE fast.angle = player.drawangle fast.momx = targetmo.momx / 2 fast.momy = targetmo.momy / 2 fast.momz = targetmo.momz / 2
            fast.colorized = true fast.blendmode = AST_ADD fast.scale = targetmo.scale fast.frame = $ | FF_FULLBRIGHT | FF_TRANS40 fast.color = finalVfxColor
        end
        local fast2 = P_SpawnMobj(targetmo.x + (P_RandomRange(-50, 50) * targetmo.scale), targetmo.y + (P_RandomRange(-50, 50) * targetmo.scale), targetmo.z + (targetmo.height / 2) + (P_RandomRange(-20, 20) * targetmo.scale), MT_SMOKE)
        if fast2 and fast2.valid then
            fast2.state = S_BOOSTPARTICLE fast2.angle = player.drawangle fast2.momx = targetmo.momx / 2 fast2.momy = targetmo.momy / 2 fast2.momz = targetmo.momz / 2
            fast2.colorized = true fast2.blendmode = AST_ADD fast2.scale = targetmo.scale fast2.frame = $ | FF_FULLBRIGHT | FF_TRANS40 fast2.color = finalVfxColor
        end
        local trail = P_SpawnGhostMobj(targetmo)
        if trail and trail.valid then
            trail.colorized = true trail.tics = 3 trail.blendmode = AST_ADD trail.frame = $ | FF_FULLBRIGHT
            P_MoveOrigin(trail, targetmo.x, targetmo.y, targetmo.z) trail.color = finalVfxColor
        end
        local sparkle = P_SpawnMobj(targetmo.x + P_RandomRange(-20, 20) * targetmo.scale, targetmo.y + P_RandomRange(-30, 30) * targetmo.scale, targetmo.z + P_RandomRange(-30, 0) * targetmo.scale + targetmo.height, MT_WATERZAP)
        if sparkle and sparkle.valid then
            sparkle.flags2 = $ | MF2_OBJECTFLIP sparkle.colorized = true sparkle.state = S_BOOST_SPARK sparkle.scale = FRACUNIT / 3 sparkle.destscale = -2 sparkle.blendmode = AST_ADD sparkle.tics = 20 sparkle.color = finalVfxColor
        end
        local sparkle2 = P_SpawnMobj(targetmo.x + P_RandomRange(-20, 20) * targetmo.scale, targetmo.y + P_RandomRange(-50, 50) * targetmo.scale, targetmo.z + P_RandomRange(-30, 0) * targetmo.scale + targetmo.height, MT_WATERZAP)
        if sparkle2 and sparkle2.valid then sparkle2.flags2 = $ | MF2_OBJECTFLIP sparkle2.colorized = true sparkle2.destscale = FRACUNIT * 3 / 2 sparkle2.blendmode = AST_ADD sparkle2.tics = 25 sparkle2.color = finalVfxColor end
        targetmo.angle = player.drawangle + ANGLE_180 targetmo.drawangle = player.drawangle + ANGLE_180 target.drawangle = player.drawangle + ANGLE_180 targetmo.state = S_PLAY_PAIN
    end
end)








addHook("PlayerQuit", function(player)
    if grab_cooldown[player] then grab_cooldown[player] = nil end
end)


addHook("MobjCollide", function(pmo, targetmo)
    if not (pmo and pmo.valid and pmo.player and pmo.player.valid) then return end
    if not (targetmo and targetmo.valid and targetmo.player and targetmo.player.valid) then return end
    local player = pmo.player
    local target = targetmo.player
        if grab_cooldown[player] and grab_cooldown[player] > 0 then
        return
    end
    if player.bvfxing == true and _G["carry_enabled"] then
        local idx = #target
        local target_menu = _G["BVFX_DATA"] and _G["BVFX_DATA"][idx]
        local target_carry_on = true
        if _G["BVFX_DATA"] ~= nil and target_menu ~= nil then
            if target_menu.menu_open == nil then
                target_carry_on = _G["carry_enabled"]
            end
        end

        if target_carry_on then
            if (player.carrying == nil and player.carriedby == nil)
            and (target.carrying == nil and target.carriedby == nil) then
                player.carrying = targetmo
                target.carriedby = pmo
                S_StartSound(pmo, sfx_s3k4a)
                targetmo.state = S_PLAY_PAIN
                return false 
            end
        end
    end
end, MT_PLAYER)


addHook("PlayerThink", function(player)
	if not (player and player.valid and player.mo and player.mo.valid) then return end
	local mo = player.mo
	if player.charging == true then
		local fx = P_SpawnMobj(mo.x, mo.y, mo.z, MT_THOK)
		fx.state = S_INSTA
		fx.rollangle = $ - (ANG1 * 10)
	end
end)







if rawget(_G, "carry_enabled") == nil then _G["carry_enabled"] = false end
local cheatcodechampion = nil
addHook("MobjCollide", function(pmo, targetmo)
    if _G["carry_enabled"] == true then return end
    if not (pmo and pmo.valid and pmo.player) then return end
    if not (targetmo and targetmo.valid and targetmo.player) then return end
    local player1 = pmo.player
    local player2 = targetmo.player
    if player1.clash_tick == leveltime or player2.clash_tick == leveltime then return end
    if (player1.bvfxing == true and player1.speed > 10*FRACUNIT) and player2.speed < 5*FRACUNIT then
        player1.clash_tick, player2.clash_tick = leveltime, leveltime
        local launchAngle = pmo.angle
        local launchForce = FixedMul(player1.speed, 2*FRACUNIT)
        if launchForce > 45*FRACUNIT then launchForce = 45*FRACUNIT end
        P_DoPlayerPain(player2, pmo, pmo)
        targetmo.state, targetmo.sprite2, targetmo.frame = S_PLAY_FALL, SPR2_PAIN, A
        player2.ragequittimer, player2.pflags = leveltime + 9, $ | PF_THOKKED | PF_FULLSTASIS
        P_InstaThrust(targetmo, launchAngle, launchForce)
        targetmo.momz = 12*FRACUNIT
        P_FlashPal(player2, PAL_WHITE, 1)
        S_StartSound(targetmo, sfx_impac)
        P_StartQuake(10*FRACUNIT, TICRATE / 2)
        return false
    end
    if (player2.bvfxing == true and player2.speed > 10*FRACUNIT) and player1.speed < 5*FRACUNIT then
        player1.clash_tick, player2.clash_tick = leveltime, leveltime
        local launchAngle = targetmo.angle
        local launchForce = FixedMul(player2.speed, 2*FRACUNIT)
        if launchForce > 45*FRACUNIT then launchForce = 45*FRACUNIT end
        P_DoPlayerPain(player1, targetmo, targetmo)
        pmo.state, pmo.sprite2, pmo.frame = S_PLAY_FALL, SPR2_PAIN, A
        player1.ragequittimer, player1.pflags = leveltime + 9, $ | PF_THOKKED | PF_FULLSTASIS
        P_InstaThrust(pmo, launchAngle, launchForce)
        pmo.momz = 12*FRACUNIT
        P_FlashPal(player1, PAL_WHITE, 1)
        S_StartSound(pmo, sfx_impac)
        P_StartQuake(10*FRACUNIT, TICRATE / 2)
        return false
    end
    if player1.bvfxing == true and player2.bvfxing == true then
        if cos(pmo.angle - targetmo.angle) < -FRACUNIT/2 then
            player1.clash_tick, player2.clash_tick = leveltime, leveltime
            local speedshoesmaxxer1 = player1.powers[pw_sneakers] and player1.powers[pw_sneakers] > 0
            local speedshoesmaxxer2 = player2.powers[pw_sneakers] and player2.powers[pw_sneakers] > 0
            if speedshoesmaxxer1 and not speedshoesmaxxer2 then 
                cheatcodechampion = pmo
            elseif speedshoesmaxxer2 and not speedshoesmaxxer1 then 
                cheatcodechampion = targetmo
            else 
                cheatcodechampion = nil 
            end
            local angle1 = R_PointToAngle2(targetmo.x, targetmo.y, pmo.x, pmo.y)
            local angle2 = angle1 + ANGLE_180
            local speed1 = FixedHypot(pmo.momx, pmo.momy)
            local speed2 = FixedHypot(targetmo.momx, targetmo.momy)
            local combinedSpeed = (speed1 + speed2) / 2
            if combinedSpeed < 15*FRACUNIT then combinedSpeed = 15*FRACUNIT end
            local launchForce = FixedMul(combinedSpeed, 2*FRACUNIT)
            if launchForce > 45*FRACUNIT then launchForce = 45*FRACUNIT end
            local verticalLift = 10*FRACUNIT + (combinedSpeed / 3)
            if verticalLift > 10*FRACUNIT then verticalLift = 10*FRACUNIT end
            local nuclearfart = P_SpawnMobjFromMobj(pmo, (targetmo.x - pmo.x)/2, (targetmo.y - pmo.y)/2, (targetmo.z - pmo.z)/2, MT_THOK)
            if speedshoesmaxxer1 or speedshoesmaxxer2 then 
                P_StartQuake(35*FRACUNIT, TICRATE)
            else 
                P_StartQuake(10*FRACUNIT, TICRATE / 2) 
            end
            local gigachad, absolutebozo, winnerplayer, loserplayer, yeetangle
            if cheatcodechampion ~= nil then
                if cheatcodechampion == pmo then 
                    gigachad, absolutebozo, winnerplayer, loserplayer, yeetangle = pmo, targetmo, player1, player2, angle2
                else 
                    gigachad, absolutebozo, winnerplayer, loserplayer, yeetangle = targetmo, pmo, player2, player1, angle1 
                end
            else
                if P_RandomChance(FRACUNIT/2) then 
                    gigachad, absolutebozo, winnerplayer, loserplayer, yeetangle = pmo, targetmo, player1, player2, angle2
                else 
                    gigachad, absolutebozo, winnerplayer, loserplayer, yeetangle = targetmo, pmo, player2, player1, angle1 
                end
            end
            if nuclearfart and nuclearfart.valid then
                nuclearfart.state = S_STRA1
                nuclearfart.scale = pmo.scale
                nuclearfart.destscale = FRACUNIT*2
                nuclearfart.scalespeed = FRACUNIT / 3
                nuclearfart.blendmode = 1
                nuclearfart.colorized = true
                nuclearfart.color = (speedshoesmaxxer1 and speedshoesmaxxer2) and ((P_RandomRange(0, 1) == 0) and pmo.color or targetmo.color) or gigachad.color
                nuclearfart.frame = $|FF_FULLBRIGHT|FF_TRANS30
                P_RadiusAttack(nuclearfart, pmo, 1, 256 * FRACUNIT, DMG_NORMAL, false)
            end
            if speedshoesmaxxer1 and speedshoesmaxxer2 then
                player1.bvfxing, player2.bvfxing = false, false
                if player1.shadowform_stamina ~= nil then player1.shadowform_stamina = Max(0, $ - 20) end
                if player2.shadowform_stamina ~= nil then player2.shadowform_stamina = Max(0, $ - 20) end
                player1.powers[pw_flashing], player2.powers[pw_flashing] = TICRATE/2, TICRATE/2
                pmo.momz, targetmo.momz = verticalLift, verticalLift
                pmo.state, pmo.sprite2, pmo.frame, player1.ragequittimer = S_PLAY_FALL, SPR2_PAIN, A, leveltime + 9
                targetmo.state, targetmo.sprite2, targetmo.frame, player2.ragequittimer = S_PLAY_FALL, SPR2_PAIN, A, leveltime + 9
                player1.pflags, player2.pflags = $ | PF_THOKKED | PF_FULLSTASIS, $ | PF_THOKKED | PF_FULLSTASIS
                P_InstaThrust(pmo, angle1, launchForce) 
                P_InstaThrust(targetmo, angle2, launchForce)
                P_FlashPal(player1, PAL_WHITE, 1) 
                P_FlashPal(player2, PAL_WHITE, 1)
                S_StartSound(pmo, sfx_impac) 
                S_StartSound(targetmo, sfx_impac) 
                cheatcodechampion = nil 
                return false
            end
            winnerplayer.bvfxing = true
            if loserplayer.shadowform_stamina ~= nil then loserplayer.shadowform_stamina = Max(0, $ - 20) end
            loserplayer.powers[pw_flashing] = TICRATE/2
            absolutebozo.momz = verticalLift
            absolutebozo.state, absolutebozo.sprite2, absolutebozo.frame, loserplayer.ragequittimer = S_PLAY_FALL, SPR2_PAIN, A, leveltime + 9
            loserplayer.pflags, loserplayer.bvfxing = $ | PF_THOKKED | PF_FULLSTASIS, false
            P_InstaThrust(absolutebozo, yeetangle, launchForce) 
            P_FlashPal(loserplayer, PAL_WHITE, 1)
            S_StartSound(absolutebozo, sfx_impac) 
            cheatcodechampion = nil 
            return false
        else
            local pushAng = R_PointToAngle2(pmo.x, pmo.y, targetmo.x, targetmo.y)
            pmo.momx = $ + P_ReturnThrustX(nil, pushAng + ANGLE_180, 25 * FRACUNIT)
            pmo.momy = $ + P_ReturnThrustY(nil, pushAng + ANGLE_180, 25 * FRACUNIT)
            targetmo.momx = $ + P_ReturnThrustX(nil, pushAng, 25 * FRACUNIT)
            targetmo.momy = $ + P_ReturnThrustY(nil, pushAng, 25 * FRACUNIT)
            S_StartSound(pmo, sfx_impac)
        end
    end
end, MT_PLAYER)

addHook("PlayerThink", function(player)
    if player.ragequittimer and leveltime >= player.ragequittimer then
        player.ragequittimer = nil
        player.pflags = $ & ~PF_FULLSTASIS
        if player.mo and player.mo.valid and player.mo.state == S_PLAY_FALL then 
            player.mo.state = S_PLAY_PAIN 
        end
    end
end)



addHook("PlayerThink", function(player)
    if not (player and player.valid and player.mo and player.mo.valid) then return end
    local mo = player.mo
    if player.quickstepcooldown == nil then player.quickstepcooldown = 0 end
    if player.quicksteptimer == nil then player.quicksteptimer = 0 end
    if player.quickstepdir == nil then player.quickstepdir = 0 end
    if player.quickstepcooldown > 0 then player.quickstepcooldown = $ - 1 end
    if player.bvfxing == false and player.quicksteptimer > 0 then
        player.quicksteptimer = 0
        mo.rollangle = 0
    end
    if player.quicksteptimer > 0 then
        player.quicksteptimer = $ - 1
        local fwd_speed = P_AproxDistance(mo.momx, mo.momy)
        P_InstaThrust(mo, mo.angle, fwd_speed)
        local side_ang = mo.angle + (ANGLE_90 * player.quickstepdir)
        mo.momx = $ + P_ReturnThrustX(nil, side_ang, 38 * FRACUNIT)
        mo.momy = $ + P_ReturnThrustY(nil, side_ang, 38 * FRACUNIT)
        mo.rollangle = player.quickstepdir * (ANGLE_45 / 3)
        if player.quicksteptimer == 0 then mo.rollangle = 0 end
    elseif player.quickstepcooldown == 0 and P_IsObjectOnGround(mo) and player.bvfxing == true then
        local triggered = false
        if (player.cmd.buttons & BT_WEAPONPREV) and not (player.quicksteplastbuttons & BT_WEAPONPREV) then
            player.quickstepdir = 1
            triggered = true
        elseif (player.cmd.buttons & BT_WEAPONNEXT) and not (player.quicksteplastbuttons & BT_WEAPONNEXT) then
            player.quickstepdir = -1
            triggered = true
        end
        if triggered then
            player.quicksteptimer = 5
            player.quickstepcooldown = 10
            S_StartSound(mo, sfx_step)
        end
    end
    player.quicksteplastbuttons = player.cmd.buttons
end)

