
addHook("PlayerSpawn", function(player)// fhnbijosfejnaefjno
local bluecooldown
player.bluecooldown = 60
local bluesplitcooldown
player.bluesplitcooldown = 10
end)

addHook("PlayerThink", function(player) //oh for heck sake
if player.mo
and (player.mo.skin == "blues")
if player.powers[pw_super]

if player.realmo.subsector.sector.lightlevel < 190
P_SpawnLightningFlash(player.realmo.subsector.sector)
player.realmo.subsector.sector.lightlevel = 190
end

for f in player.realmo.subsector.sector.ffloors()
if f.valid and (f.flags & FF_EXISTS)
and (f.bottomheight >= player.realmo.z
or (player.realmo.z < f.topheight
and player.realmo.z+player.realmo.height > f.bottomheight))
and f.sector.valid and f.sector.lightlevel <  190
P_SpawnLightningFlash(f.sector)
f.sector.lightlevel = 190
end
end

end
player.bluecooldown = $ or 0
player.bluesplitcooldown = $ or 0
if player.bluecooldown > 0
if player.bluecooldown < 2
S_StartSound(player.mo, sfx_s257, player)
P_SpawnParaloop(player.mo.x, player.mo.y, player.mo.z + (player.mo.height/2),
10*FRACUNIT, 16, MT_NIGHTSPARKLE, 180*ANGLE_22h, MT_NULL, false)
end
if player.powers[pw_super]
player.bluecooldown = player.bluecooldown - 2
else
player.bluecooldown = player.bluecooldown - 1
end
end

if player.bluesplitcooldown > 0
if player.bluesplitcooldown < 2
S_StartSound(player.mo, sfx_allgon, player)
P_SpawnParaloop(player.mo.x, player.mo.y, player.mo.z + (player.mo.height/2),
10*FRACUNIT, 16, MT_NIGHTSPARKLE, 180*ANGLE_22h, MT_NULL, false)
end
if player.powers[pw_super]
player.bluesplitcooldown = $ - 2
else
player.bluesplitcooldown = $ - 1
end
end

end
end)


addHook("AbilitySpecial", function(player)//using as platforms/springs
if player.mo
and (player.mo.skin == "blues")// is the eastern bluejays
and not (player.pflags & PF_JUMPSTASIS or player.pflags & PF_STASIS or player.pflags & PF_FULLSTASIS) 
if player.bluecooldown < 1
player.bluecooldown = 6*TICRATE
FeatherSpawn(player.mo, 15, player.mo)
S_StartSound(player.mo, sfx_buslit, player)

local idiot = (skins["blues"].height+20)+(2*25)*P_MobjFlip(player.mo)
local bluez = P_SpawnMobjFromMobj(player.mo, 0, 0, idiot*FRACUNIT, MT_BLUEBOIS)
bluez.target = player.mo 
bluez.angle = player.drawangle
bluez.skin = player.mo.skin
bluez.sprite = SPR_PLAY
bluez.sprite2 = SPR2_SPIN
bluez.flags = $ + MF_SPRING
bluez.flags = $ & ~MF_NOBLOCKMAP
bluez.tics = 3*TICRATE + 65
bluez.color = player.skincolor
bluez.height = skins[player.mo.skin].height
bluez.radius = skins[player.mo.skin].radius
bluez.target = player.mo
if (player.speed <= 0)
P_MoveOrigin(player.mo, player.mo.x, player.mo.y,
 ((skins["blues"].height+20)+(2*25)*P_MobjFlip(player.mo))*FRACUNIT + player.mo.z)
else
P_SetObjectMomZ(player.mo, 10*FRACUNIT, false)
end
end
end
end)

addHook("SpinSpecial", function(player) //split!
if player.mo
and (player.mo.skin == "blues") and player.pflags & ~PF_THOKKED and player.speed > 5*FRACUNIT
and not(player.exiting)
and not (player.pflags & PF_JUMPSTASIS or player.pflags & PF_STASIS or player.pflags & PF_FULLSTASIS) 
if player.bluesplitcooldown <= 1
player.bluesplitcooldown = 60
if player.mo.state != S_BLUES_SPLIT and player.mo.state != S_PLAY_ROLL
player.mo.state = S_BLUES_SPLIT
end
FeatherSpawn(player.mo, 15, player.mo)
S_StartSound(player.mo, sfx_buslit, player)

for i = -1,1 do //spawn into 3
local bluet = P_SpawnMobjFromMobj(player.mo, 
FixedMul(cos(player.drawangle + ANGLE_90*i), 45*FRACUNIT), 
FixedMul(sin(player.drawangle + ANGLE_90*i), 45*FRACUNIT), 
0, MT_BLUEBOIS)
bluet.target = player.mo
bluet.angle = player.drawangle
bluet.color = player.skincolor
bluet.state = S_BSPEC
bluet.sprite = SPR_BUPH
bluet.frame = P_RandomRange(A, C)
bluet.tics = -1
bluet.flags = $|MF_MISSILE
bluet.flags = $ & ~MF_PUSHABLE
bluet.flags = $ & ~MF_BOUNCE
if (player.mo.flags2 & MF2_TWOD) or (twodlevel) 
P_MoveOrigin(bluet, player.mo.x, player.mo.y,
player.mo.z + ((5*FRACUNIT)*i))
bluet.momz = player.mo.momz+(5*FRACUNIT)*i
else
P_InstaThrust(player.mo, player.drawangle, player.speed+16*FRACUNIT)
bluet.momz = player.mo.momz
end
bluet.momx = player.mo.momx
bluet.momy = player.mo.momy
bluet.height = skins[player.mo.skin].height
bluet.radius = skins[player.mo.skin].radius
bluet.target = player.mo


if i == 0//super-only holograms
bluet.sprite = SPR_PLAY
bluet.sprite2 = SPR2_ROLL
bluet.colorized = true
bluet.frame = $|FF_TRANS30
if not (player.powers[pw_super])
 P_KillMobj(bluet, nil, nil, DMG_INSTAKILL) //not super? remove with force
end
end

end
end
end
end)

addHook("MobjRemoved", function(mobj)
	if mobj
	if mobj.target.player.mo and mobj.target.player and mobj.target
	FeatherSpawn(mobj, 15, mobj.target.player.mo)
	end
		local sound = P_SpawnMobjFromMobj(mobj, 0, 0, 0, MT_THOK)
		sound.fuse = 35
		sound.flags2 = $|MF2_DONTDRAW
		S_StartSound(sound,sfx_allgon)
	end
end, MT_BLUEBOIS)
