/*
CREDITS:
Gun sprite - 3DRealms, mainly (Kill me, I recently remembered who made that chamber on right, but now I don't D:)
Gun sprite construction - Duducrazy

Sounds:
Reloads, Up, Dry fire when meteor shower beacon is out - dunno from which game are the original sounds, but those are modified ones from NeoCore. Ripped by Sangelothi.
Meteor hit, flying down swoosh - Tiberian Sun (Westwood Ent.)
Beacon sounds - UT2004, mainly (Epic Games)
Fire, Add, Alt - ??
*/

ACTOR Chton : Weapon 24537
{
   //$Category Weapons
   //$Title Chton
   //$Sprite CHMGX0
   Inventory.PickupSound "misc/w_pkup"
   Inventory.PickupMessage "You got the ''Chton'' meteor cannon! A fireball in the night! (6)"
   Obituary "%o was tampered %k's firebolt."
   Weapon.UpSound "Chton/Up"
   Weapon.SelectionOrder 6
   Weapon.AmmoType "RawketAmmo"
   Weapon.AmmoGive 25
   Weapon.AmmoUse 5
   Weapon.AmmoType2 "RawketAmmo"
   Weapon.AmmoUse2 25
   Weapon.Kickback 90
   Weapon.SlotNumber 6
   +NOAUTOFIRE
   +NOALERT
   Scale 0.9
   States
   {
   Spawn:
      CHMG X -1
      Loop
   ReadyMain:
      CHMG A 1 A_WeaponReady
      Loop
   Deselect:
      CHMG A 0 A_ZoomFactor(1)
      CHMT A 1 A_Lower
      CHMT A 0 A_Lower
      Loop
   Select:
      CHMT A 0 A_Raise
	  Loop
   Ready:
      CHMT P 1 Offset(-34,90)
      CHMT P 1 Offset(-30,82)
      CHMT P 1 Offset(-26,74)
      CHMT P 1 Offset(-23,68)
      CHMT P 1 Offset(-20,62)
      CHMT P 1 Offset(-18,58)
      CHMT P 1 Offset(-16,54)
      CHMT O 1 Offset(-14,51)
      CHMT N 1 Offset(-12,46)
      CHMT M 1 Offset(-11,44)
      CHMT L 1 Offset(-10,42)
      CHMT K 1 Offset(-8,40)
      CHMT J 1 Offset(-6,38)
      CHMT I 1 Offset(-5,37)
      CHMT H 1 Offset(-4,36)
      CHMT G 1 Offset(-3,35)
      CHMT F 1 Offset(-2,34)
      CHMT E 1 Offset(1,32)
	  CHMT DCBA 1
	  CHMG A 2
	  Goto ReadyMain
   Looplet:
      CHMT P 1 A_Raise
      CHMT P 0 A_Raise
      CHMT P 0 A_Raise
      Loop
   Fire:
      CHMF A 0 A_GunFlash
      CHMF A 0 A_Recoil(20)
      CHMF A 0 A_AlertMonsters
      CHMF A 0 A_PlaySound("Chton/Fire",1,1.0)
      CHMF A 0 A_PlaySound("Chton/Add",5,0.7)
      CHMF A 0 A_PlaySound("Chton/Fly",6,0.6)
      CHMF A 0 A_FireCustomMissile("ChtonMeteor",0, 1, 10, 0, 0, 0) 
      
      CHMF A 0 A_SetPitch(pitch-6)
      CHMF A 0 A_SetAngle(angle-5)
      CHMF A 1 Bright Offset(1,33) A_ZoomFactor(0.99)
      CHMF A 1 Bright Offset(2,34) A_ZoomFactor(0.97)
      CHMF A 0 A_SetPitch(pitch-4)
      CHMF A 0 A_SetAngle(angle-3)
      CHMF B 1 Bright Offset(5,37) A_ZoomFactor(0.95)
      CHMF B 1 Bright Offset(10,42) A_ZoomFactor(0.92)
      CHMF A 0 A_SetPitch(pitch-3)
      CHMF A 0 A_SetAngle(angle-2)
      CHMF C 1 Bright Offset(13,45) A_ZoomFactor(0.9)
      CHMF C 1 Bright Offset(15,47) A_ZoomFactor(0.89)
      CHMF A 0 A_SetPitch(pitch-2)
      CHMF A 0 A_SetAngle(angle-1)
      CHMF D 1 Bright Offset(16,48) A_ZoomFactor(0.9)
      CHMF D 1 Bright Offset(15,47) A_ZoomFactor(0.92)
      CHMF E 1 Bright Offset(12,44) A_ZoomFactor(0.94)
      CHMF E 1 Bright Offset(9,41) A_ZoomFactor(0.96)
      CHMT A 1 Offset(7,39) A_ZoomFactor(0.97)
      CHMT A 1 Offset(5,37) A_ZoomFactor(0.98)
      CHMT A 1 Offset(3,35) A_ZoomFactor(0.99)
      CHMT A 1 Offset(2,34) A_ZoomFactor(1)
      CHMT A 1 Offset(1,33)
	  CHMT A 1 Offset(0,32)
      CHMT A 0 A_PlaySound("Chton/Reload1",0,0.5)
      CHMT A 1 Offset(1,33)
      CHMT B 1 Offset(2,34)
      CHMT C 1 Offset(3,35)
      CHMT D 1 Offset(4,37)
      CHMT E 1 Offset(5,39)
      CHMT F 1 Offset(6,42)
      CHMT G 1 Offset(6,45)
      CHMT H 1 Offset(7,50)
      CHMT I 1 Offset(8,55)
      CHMT J 1 Offset(9,59)
      CHMT K 1 Offset(10,62)
      CHMT L 1 Offset(11,64)
      CHMT M 1 Offset(12,66)
	  CHMT N 1 Offset(13,67)
	  CHMT O 1 Offset(14,68)
	  CHMT P 0 A_PlaySound("Chton/Reload2",0,0.5)
      CHMT P 18
      CHMT A 0 A_PlaySound("Chton/Reload3",0,0.5)
      CHMT O 1 Offset(13,67)
      CHMT N 1 Offset(12,66)
      CHMT M 1 Offset(11,64)
      CHMT L 1 Offset(10,62)
      CHMT K 1 Offset(9,59)
      CHMT J 1 Offset(8,55)
      CHMT H 1 Offset(7,50)
      CHMT G 1 Offset(6,45)
      CHMT F 1 Offset(6,42)
      CHMT E 1 Offset(5,39)
      CHMT D 1 Offset(4,37)
      CHMT C 1 Offset(3,35)
      CHMT B 1 Offset(2,34)
      CHMT A 1 Offset(1,33)
      CHMT A 10
      TDGT A 0 A_ReFire
      CHMT A 3
      CHMG A 4
      Goto ReadyMain
   AltFire:
      //CHMF A 0 A_JumpIfInventory("ChtonBeaconDeployed",1,"Nope") 
      CHMF A 0 A_GunFlash
      CHMF A 0 A_Recoil(9)
      CHMF A 0 A_AlertMonsters
      CHMF A 0 A_PlaySound("Chton/Fire",1,1.0)
      CHMF A 0 A_PlaySound("Chton/Alt",5,0.9)
      //CHMF A 0 A_GiveInventory("ChtonBeaconDeployed",1) 
      CHMF A 0 A_FireCustomMissile("ChtonBeaconDropper",0, 1, 10, 0, 0, 0) 
      
      CHMF A 0 A_SetPitch(pitch-3)
      CHMF A 0 A_SetAngle(angle-2)
      CHMF A 1 Bright Offset(1,33) A_ZoomFactor(0.99)
      CHMF A 1 Bright Offset(3,35) A_ZoomFactor(0.98)
      CHMF A 0 A_SetPitch(pitch-2)
      CHMF A 0 A_SetAngle(angle-1)
      CHMF B 1 Bright Offset(5,37) A_ZoomFactor(0.96)
      CHMF B 1 Bright Offset(6,38) A_ZoomFactor(0.955)
      CHMF A 0 A_SetPitch(pitch-1)
      CHMF A 0 A_SetAngle(angle-0.5)
      CHMF C 1 Bright Offset(5,37) A_ZoomFactor(0.96)
      CHMF C 1 Bright Offset(4,36) A_ZoomFactor(0.97)
      CHMF A 0 A_SetPitch(pitch-0.5)
      CHMF A 0 A_SetAngle(angle-0.25)
      CHMF D 1 Bright Offset(3,35) A_ZoomFactor(0.98)
      CHMF D 1 Bright Offset(2,34) A_ZoomFactor(0.99)
      CHMF E 1 Bright Offset(1,33) A_ZoomFactor(0.995)
      CHMF E 1 Bright Offset(0,32) A_ZoomFactor(1)
      CHMT A 6 A_PlaySound("Chton/Reload1",0,0.5)
      Goto ReadyMain
   Nope:
      CHMT A 6 A_PlaySound("Chton/Nope",1,0.6)
      CHMT A 1 Offset(1,33)
      CHMT A 1 Offset(2,34)
      CHMT A 1 Offset(4,36)
      CHMT A 1 Offset(5,37)
      CHMT A 1 Offset(5,38)
      CHMT A 1 Offset(5,37)
      CHMT A 1 Offset(4,36)
      CHMT A 1 Offset(3,35)
      CHMT A 1 Offset(2,34)
      CHMT A 1 Offset(1,33)
      CHMT A 5 Offset(0,32)
      Goto ReadyMain
   Flash:
      TNT1 A 4 Bright A_Light2
      TNT1 A 6 Bright A_Light1
      TNT1 A 0 Bright A_Light0
      Stop
   }
}

ACTOR ChtonMeteor : FastProjectile
{
   Obituary "%o was incinerated and blasted off by %k's inglorious meteor."
   Radius 10
   Height 14
   Speed 90
   Damage 100
   Scale 0.8
   Renderstyle Add
   PROJECTILE
   +RANDOMIZE
   +THRUGHOST
   +EXPLODEONWATER
   DamageType Fire
   MissileType "ChtonTrailer"
   States
   {
   Spawn:
      10MM A 0
      10MM A 0 ThrustThingZ(0,15,0,1)
      10MM A 0 A_PlaySound("Torchglow/Wall",5,1.0,1)
   Maocopter:
      10MM A 0 A_Explode(300,128,0)
      10MM A 1 bright ThrustThingZ(0,random(-2,-3),0,1)
      Loop
   Death:
      TNT1 A 0 A_PlaySound("Chton/Hit",6,1.0)
      TNT1 A 0 A_PlaySound("Chton/MeteorExplode",5,0.6)
      TNT1 A 0 A_SpawnItemEx("ChtonExplode",0,0,0,0,0,0,0,SXF_TRANSFERPOINTERS,0)
      Stop
   }
}

ACTOR ChtonTrailer
{ 
    +NOGRAVITY
    +NOINTERACTION
	+CLIENTSIDEONLY
    States
    {
    Spawn:
      TNT1 A 0
 			TNT1 A 0 A_SpawnItemEx("Firewall_Flame", FRandom(-10, 10),
									FRandom(-10, 10), FRandom(-10, 10),
									FRandom(-1.5, -2.8), FRandom(-1.0, 1.0),
									FRandom(-1.0, 2.0), 0, SXF_CLIENTSIDE, 10)
			TNT1 A 0 A_SpawnItemEx("Firewall_Smoke", FRandom(-10, 10),
									FRandom(-10, 10), FRandom(-10, 10),
									FRandom(1.5, -2.5), FRandom(-1.0, 1.0),
									FRandom(-1.0, 1.0), 0, SXF_CLIENTSIDE, 10)
			TNT1 A 0 A_SpawnItemEx("Firewall_Glow", FRandom(-10, 10),
									FRandom(-10, 10), FRandom(-10, 10),
									FRandom(-1.5, -3.5), FRandom(-1.0, 1.0),
									FRandom(-1.0, 1.0), 0, SXF_CLIENTSIDE, 10)
			TNT1 A 0 A_SpawnItemEx("Firewall_Flare", FRandom(-10, 10),
									FRandom(-10, 10), FRandom(-10, 10),
									0, 0, 0, 0, SXF_CLIENTSIDE)
			TNT1 A 1
			TNT1 A 0 A_SpawnItemEx("Firewall_Glow", FRandom(-10, 10),
									FRandom(-10, 10), FRandom(-10, 10),
									FRandom(-1.5, -3.5), FRandom(-1.0, 1.0),
									FRandom(-1.0, 1.0), 0, SXF_CLIENTSIDE, 10)
			TNT1 A 0 A_SpawnItemEx("Firewall_Flare", FRandom(-10, 10),
									FRandom(-10, 10), FRandom(-10, 10),
									0, 0, 0, 0, SXF_CLIENTSIDE)
			TNT1 A 1
      Stop
    }
}

Actor ChtonExplode
{
	+NOINTERACTION
	+NOGRAVITY
	+FORCERADIUSDMG
	ReactionTime 5
	DamageType Fire
	States
	{
		Spawn:
			TNT1 A 0
			TNT1 A 0 A_Quake(9, 45, 0, 1024, none)
			TNT1 A 0 A_Quake(7, 45, 0, 1280, none)
			TNT1 A 0 A_Explode(2500,486,0) //That's right. NO DAMAGE FOR YOU. HAR HAR HAR!... wait.
			TNT1 A 0 A_PlaySound("Chton/Hit",5,1.0,0)
			TNT1 A 0 A_PlaySound("Chton/MeteorExplode",5,0.5,0)
			//Why so half-assed? Because bunnies, that's why
			TNT1 A 5
			TNT1 A 0 A_SpawnItemEx("Meteor_MegaFlare",0,0,-60,0,0,0,0,SXF_CLIENTSIDE,0)
			TNT1 A 0 A_SpawnItemEx("Meteor_MegaGlow",0,0,-60,0,0,0,0,SXF_CLIENTSIDE,0)
			TNT1 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 0 A_SpawnItemEx("Meteor_Ember", FRandom(-60, 60),
									FRandom(-60, 60), FRandom(-30, 70),
									FRandom(-16.0, -20.0), 0,
									FRandom(7.0, 10.0), random(0,359), SXF_CLIENTSIDE, 10)
			//Shockwave
		GloriousSausageAbominationOfDoom:
			TNT1 A 0 A_Countdown
			TNT1 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 0 A_SpawnItemEx("Meteor_Flame", FRandom(-60, 60),
									FRandom(-60, 60), FRandom(-10, 10)-30,
									FRandom(8.0, 8.5), FRandom(7.0, 7.5),
									FRandom(-3.50, 3.50), random(0,359), SXF_CLIENTSIDE, 10)
			TNT1 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 0 A_SpawnItemEx("Meteor_Smoke", FRandom(-60, 60),
									FRandom(-60, 60), FRandom(-10, 10)-30,
									FRandom(6.5, 7.0), FRandom(5.0, 5.5),
									FRandom(-3.50, 3.50), random(0,359), SXF_CLIENTSIDE, 10)
			TNT1 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 0 A_SpawnItemEx("Meteor_Glow", FRandom(-60, 60),
									FRandom(-60, 60), FRandom(-10, 10)-30,
									FRandom(8.0, 8.5), FRandom(7.0, 7.5),
									FRandom(-3.50, 3.50), random(0,359), SXF_CLIENTSIDE, 10)
			TNT1 A 6
			Loop
		Death:
			TNT1 A 0 A_Explode(3000,320)
			TNT1 A 0 A_SpawnItemEx("Meteor_Skullblast",0,0,60,0,0,0,0,SXF_CLIENTSIDE,0)
			TNT1 A 0 A_SpawnItemEx("Meteor_Impact",0,0,0,0,0,0,0,SXF_CLIENTSIDE,0)
			TNT1 A 26
			Stop
	}
}

Actor Meteor_Ember : Firewall_Ember
{
    +CLIENTSIDEONLY
	States
	{
		Spawn:
			TNT1 AA 0 A_Jump(255, "SpriteA", "SpriteB", "SpriteC")
		SpriteA:
			FALC J 0 A_Jump(255, "FadeIn")
			Goto SpriteA
		SpriteB:
			FALC K 0 A_Jump(255, "FadeIn")
			Goto SpriteB
		SpriteC:
			FALC L 0 A_Jump(255, "FadeIn")
			Goto SpriteC
		FadeIn:
			"####" "#" 0 Bright //A_SetScale(FRandom(0.16, 0.22))
			Goto Idle
		Idle:
			"####" "#" 2 Bright A_Jump(200, "FadeOut")
			Loop
		FadeOut:
			"####" "#" 1 Bright A_Weave(FRandom(0.9, 1.0), FRandom(0.9, 1.0),
										FRandom(70, 90), FRandom(70, 90))
			"####" "#" 0 //A_JumpIf(ScaleX <= 0.0, "NULL")
			"####" "#" 0 A_ChangeVelocity(VelX * FRandom(0.93, 0.99),
										  VelY * FRandom(0.93, 0.99),
										  VelZ - FRandom(0.1, 0.2),
										  CVF_REPLACE)
			"####" "#" 0 A_FadeOut(FRandom(0.003, 0.0015))
			Loop
	}
}

Actor Meteor_Glow : Firewall_Glow
{
	+CLIENTSIDEONLY
	States
	{
		Spawn:
			TNT1 AA 0 A_Jump(255, "SpriteA", "SpriteB")
		SpriteA:
			FWAL M 0 A_Jump(255, "FadeIn")
			Goto SpriteA
		SpriteB:
			FWAL R 0 A_Jump(255, "FadeIn")
			Goto SpriteB
		FadeIn:
			"####" "#" 0 Bright //A_SetScale(FRandom(3.5, 3.6))
			Goto Idle
		Idle:
			"####" "#" 2 Bright A_Jump(200, "FadeOut")
			Loop
		FadeOut:
			"####" "#" 1 Bright A_FadeOut(0.015)
			"####" "#" 0 A_ScaleVelocity(FRandom(0.97, 0.99))
			"####" "#" 0 //A_SetScale(ScaleX + FRandom(0.04, 0.08))
			Loop
	}
}

Actor Meteor_Flame : Firewall_Flame
{
	+CLIENTSIDEONLY
	States
	{
		Spawn:
			TNT1 AA 0 A_Jump(255, "SpriteA", "SpriteB", "SpriteC", "SpriteD",
								 "SpriteE", "SpriteF", "SpriteG", "SpriteH")
		SpriteA:
			FWAL A 0 A_Jump(255, "FadeIn")
			Goto SpriteA
		SpriteB:
			FWAL B 0 A_Jump(255, "FadeIn")
			Goto SpriteB
		SpriteC:
			FWAL C 0 A_Jump(255, "FadeIn")
			Goto SpriteC
		SpriteD:
			FWAL D 0 A_Jump(255, "FadeIn")
			Goto SpriteD
		SpriteE:
			FWAL E 0 A_Jump(255, "FadeIn")
			Goto SpriteE
		SpriteF:
			FWAL F 0 A_Jump(255, "FadeIn")
			Goto SpriteF
		SpriteG:
			FWAL G 0 A_Jump(255, "FadeIn")
			Goto SpriteG
		SpriteH:
			FWAL H 0 A_Jump(255, "FadeIn")
			Goto SpriteH
		FadeIn:
			"####" "#" 0 Bright //A_SetScale(FRandom(3.5, 3.55))
			Goto Idle
		Idle:
			"####" "#" 2 Bright A_Jump(190, "FadeOut")
			Loop
		FadeOut:
			"####" "#" 1 Bright A_FadeOut(0.035)
			"####" "#" 0 A_ScaleVelocity(FRandom(1.01, 1.03))
			"####" "#" 0 //A_SetScale(ScaleX - FRandom(0.02, 0.06))
			Loop
	}
}

Actor Meteor_Smoke : Firewall_Smoke
{
	+CLIENTSIDEONLY
	States
	{
		Spawn:
			TNT1 AA 0 A_Jump(255, "SpriteA", "SpriteB", "SpriteC", "SpriteD")
		SpriteA:
			FWAL N 0 A_Jump(255, "FadeIn")
			Goto SpriteA
		SpriteB:
			FWAL O 0 A_Jump(255, "FadeIn")
			Goto SpriteB
		SpriteC:
			FWAL P 0 A_Jump(255, "FadeIn")
			Goto SpriteC
		SpriteD:
			FWAL Q 0 A_Jump(255, "FadeIn")
			Goto SpriteD
		FadeIn:
			"####" "#" 0 //A_SetScale(FRandom(3.7, 3.8))
			Goto RealFadeIn
		RealFadeIn:
			"####" "#" 1 A_FadeIn(FRandom(0.02, 0.05))
			"####" "#" 0 A_JumpIf(Alpha >= 0.4, "Idle")
			Loop
		Idle:
			"####" "#" 4 A_Jump(35, "FadeOut")
			Loop
		FadeOut:
			"####" "#" 1 A_FadeOut(0.02)
			/* "####" "#" 0 A_ChangeVelocity(VelX * FRandom(0.97, 0.99),
										  VelY * FRandom(0.97, 0.99),
										  VelZ + FRandom(0.02, 0.06),
										  CVF_REPLACE) */
			"####" "#" 0 A_ScaleVelocity(0.96)
			"####" "#" 0 //A_SetScale(ScaleX + FRandom(0.015, 0.025))
			Loop
	}
}

Actor Meteor_MegaGlow : Firewall_Glow
{
	+CLIENTSIDEONLY
	States
	{
		Spawn:
			TNT1 AA 0 A_Jump(255, "SpriteA", "SpriteB")
		SpriteA:
			FWAL M 0 A_Jump(255, "FadeIn")
			Goto SpriteA
		SpriteB:
			FWAL R 0 A_Jump(255, "FadeIn")
			Goto SpriteB
		FadeIn:
			"####" "#" 0 Bright //A_SetScale(FRandom(6.5, 6.6))
			Goto Idle
		Idle:
			"####" "#" 2 Bright A_Jump(200, "FadeOut")
			Loop
		FadeOut:
			"####" "#" 1 Bright A_FadeOut(0.01)
			"####" "#" 0 A_ScaleVelocity(FRandom(0.97, 0.99))
			"####" "#" 0 //A_SetScale(ScaleX + FRandom(0.04, 0.08))
			Loop
	}
}

Actor Meteor_MegaFlare : Firewall_Flare
{
	RenderStyle Add
	+CLIENTSIDEONLY
	Scale 7.5
	States
	{
		Spawn:
			FWAL I 1 Bright A_FadeOut(0.04)
			Loop
	}
}

Actor Meteor_SkullBlast
{
	Alpha 0.9
	Renderstyle Add
	Scale 3.0
	+NOINTERACTION
	+CLIENTSIDEONLY
	States
	{
		Spawn:
			YSKX A 0
			YSKX A 0 //A_SetScale(ScaleX+0.05,ScaleY+0.05)
			YSKX A 1 Bright A_FadeOut(frandom(0.015,0.019))
			Loop
	}
}

Actor Meteor_Impact
{
	+NOINTERACTION
	+NOGRAVITY
	+CLIENTSIDEONLY
	States
	{
		Spawn:
			TNT1 AA 0 A_SpawnItemEx("Meteor_Impact_Flame",0,0,0,0,0,0,0,SXF_CLIENTSIDE,0)
			TNT1 A 0 A_SpawnItemEx("Meteor_Impact_Smoke",0,0,0,0,0,0,0,SXF_CLIENTSIDE,0)
			TNT1 A 0 A_SpawnItemEx("Meteor_Impact_Ember",0,0,0,0,0,0,0,SXF_CLIENTSIDE,0)
			Stop
	}
}

Actor Meteor_Impact_Flame
{
	+NOINTERACTION
	+NOGRAVITY
	+CLIENTSIDEONLY
	States
	{
		Spawn:
			TNT1 A 0
			TNT1 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 1 A_SpawnItemEx("Meteor_Glow", FRandom(-50, 50),
									FRandom(-50, 50), FRandom(-50, 50)-50,
									FRandom(1.0, 1.5), FRandom(1.0, 1.5),
									FRandom(-1.5, -1.5), random(0,359), SXF_CLIENTSIDE, 10)
			Stop
	}
}

Actor Meteor_Impact_Smoke
{
	+NOINTERACTION
	+NOGRAVITY
	+CLIENTSIDEONLY
	States
	{
		Spawn:
			TNT1 A 25
			TNT1 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 1 A_SpawnItemEx("Meteor_Smoke", FRandom(-50, 50),
									FRandom(-50, 50), FRandom(-50, 50)-50,
									FRandom(1.0, 1.5), FRandom(1.0, 1.5),
									FRandom(-1.5, -1.5), random(0,359), SXF_CLIENTSIDE, 10)
			Stop
	}
}

Actor Meteor_Impact_Ember
{
	+NOINTERACTION
	+CLIENTSIDEONLY
	+NOGRAVITY
	States
	{
		Spawn:
			TNT1 A 0
			TNT1 AAAAAAAAAAAAAAAAAAAAAAAAA 1 A_SpawnItemEx("Meteor_Ember", FRandom(-70, 70),
									FRandom(-70, 70), FRandom(-70, 70),
									FRandom(5.0, 6.5), FRandom(5.0, 6.5),
									FRandom(2.0, 6.0), random(0,359), SXF_CLIENTSIDE, 10)
			Stop
	}
}



//Alt-Fire

Actor ChtonBeaconDropper
{
	Speed 40
	Radius 8
	Height 14
	PROJECTILE
	+EXPLODEONWATER
	+THRUGHOST
	-NOGRAVITY
	+SKYEXPLODE
	States
	{
		Spawn:
			YERO D 1
			Loop
		Death:
			TNT1 A 1 A_SpawnItemEx("ChtonBeacon",0,0,0,0,0,0,0,SXF_TRANSFERPOINTERS,0)
			Stop
	}
}

Actor ChtonBeacon
{
	Radius 12
	Height 18
	+NOBLOCKMAP
	PushFactor 0.5
	States
	{
		Spawn:
			YERO D 0
			YERO D 6 A_PlaySound("Chton/Beacon/Start",5,0.8,0,1)
			YERO CBA 2
			YERB A 5
			YERO D 0 A_PlaySound("Chton/Beacon/Loop",6,0.7,1,1)
			YERB AA 4 A_SpawnItemEx("ChtonBeaconParticle", 0, 0, 8, FRandom(9.0, 8.5), 0, FRandom(-9.0, 9.0), Random(0, 359), 128)
			YERB AAA 3 A_SpawnItemEx("ChtonBeaconParticle", 0, 0, 8, FRandom(9.0, 8.5), 0, FRandom(-9.0, 9.0), Random(0, 359), 128)
			YERB BBBCCCDDDEEEFFF 1 A_SpawnItemEx("ChtonBeaconParticle", 0, 0, 8, FRandom(9.0, 8.5), 0, FRandom(-9.0, 9.0), Random(0, 359), 128)
			Goto Looplo
		Looplo:
			YERB F 0 A_JumpIfInventory("ChtonBeaconCounter",80,"BombsAway")
			YERB F 0 A_GiveInventory("ChtonBeaconCounter",1)
			YERB F 1 A_SpawnItemEx("ChtonBeaconParticle", 0, 0, 8, FRandom(9.0, 8.5), 0, FRandom(-9.0, 9.0), Random(0, 359), 128)
			Loop
		BombsAway:
			YERB F 0 A_ChangeFlag("Invulnerable",1)
			YERB F 0 A_ChangeFlag("Shootable",0)
			YERO F 0 A_StopSound(6)
			YERB FFFEEEDDDCCC 1 A_SpawnItemEx("ChtonBeaconParticle", 0, 0, 8, FRandom(9.0, 8.5), 0, FRandom(-9.0, 9.0), Random(0, 359), 128)
			YERO D 0 A_PlaySound("Chton/Beacon/Stop",5,0.9,0,1)
			YERB BBBAAA 1 A_SpawnItemEx("ChtonBeaconParticle", 0, 0, 8, FRandom(9.0, 8.5), 0, FRandom(-9.0, 9.0), Random(0, 359), 128)
			YERO ABCD 2
			YERO D 35
			YERO D 0 A_CustomMissile("ChtonShower",0,0,0,CMF_TRACKOWNER)
			YERO D 135
			//YERO D 0 A_TakeFromTarget("ChtonBeaconDeployed",1)
			YERO D 35
			YERO D 1 A_FadeOut(0.05)
			Wait
		Death:
			//TNT1 A 0 A_TakeFromTarget("ChtonBeaconDeployed",1)
			TNT1 A 0 A_PlaySound("Weapons/LarpaExp",6,0.8)
			TNT1 A 0 A_Explode(40,96,0)
			TNT1 A 0 A_Explode(10,96)
			TNT1 A 0 A_SpawnItemEx("PelletExplode",0,0,0,0,0,0,0,128,0)
			TNT1 BCD 4
			stop
	}
}

Actor ChtonBeaconParticle
{
	Scale 0.4
	Alpha 0.0
	RenderStyle Add
	+NOINTERACTION
	+NOGRAVITY
	+CLIENTSIDEONLY
	+NOBLOCKMAP
	States
	{
		Spawn:
			TNT1 A 0
			TNT1 A 5
			TNT1 A 1 A_ScaleVelocity(-0.1)
			OBSK AAAAA 1 Bright A_FadeIn(0.2)
		Looplet:
			OBSK A 0 //A_SetScale(ScaleX-0.01,ScaleY-0.01)
			OBSK A 1 Bright A_FadeOut(0.05)
			Wait
	}
}

ACTOR ChtonShower
{
	Radius 1
	Height 2
	PROJECTILE
	+CEILINGHUGGER
	ReactionTime 12
	States
	{
	Spawn:
	TNT1 A 0
	TNT1 A 0 A_Countdown
	TNT1 A 17 A_SpawnItemEx("ChtonMeteor",random(500,-500),random(500,-500),-15,frandom(15.0,5.0),frandom(3.0,1.0),frandom(-75.0,-80.0),random(-0,359))	
	TNT1 A 0 A_PlaySound("Chton/Fly2",0,0.6,0)
	Loop
	Death:
	Stop
	}
}

Actor ChtonBeaconCounter : Inventory
{
	Inventory.MaxAmount 999
}

Actor ChtonBeaconDeployed : Inventory
{
	Inventory.MaxAmount 1
}
