Actor MegaNuke
{
 +NoBlockmap
 +NoGravity
 +ForceRadiusDmg
 DamageType "Superweapon"
 States
 {
  Spawn:
   TNT1 A 0
   TNT1 A 0 A_PlaySoundEx("Weapons/MegaNukeExp", "SoundSlot5", 0, 2)
   TNT1 A 0 A_Quake(9, 210, 0, 1048576, "None")
   TNT1 A 1 A_Explode(1048576, 256, 1)
   TNT1 A 1 A_Explode(262144, 512, 1)
   TNT1 A 1 A_Explode(65536, 1024, 1)
   TNT1 A 1 A_Explode(16384, 2048, 1)
   TNT1 A 0 A_SpawnItemEx("MegaNukeFlare", 0, 0, 0, 0, 0, 0, 0, SXF_TRANSFERPOINTERS)
   TNT1 AAAAA 0 A_SpawnItemEx("MegaNukeSmokeFloor", 0, 0, 0, 0, 0, 0, 0, SXF_CLIENTSIDE)
   TNT1 A 0 A_SpawnItemEx("MegaNukeFloor", 0, 0, 0, 0, 0, 0, 0, SXF_TRANSFERPOINTERS)
   TNT1 A 0 A_SpawnItemEx("MegaNukeMushroom", 0, 0, 0, 0, 0, 10, 0, SXF_TRANSFERPOINTERS, 0)
   TNT1 A 0 A_SpawnItemEx("MegaNukeFlareMushroom", 0, 0, 0, 0, 0, 10, 0, SXF_CLIENTSIDE, 0)
   TNT1 AA 0 A_SpawnItemEx("MegaNukeSmokeMushroom", 0, 0, 0, 0, 0, 10, 0, SXF_CLIENTSIDE, 0)
   TNT1 A 0 A_SpawnItemEx("MegaNukePillar", 0, 0, 0, 0, 0, 0, 12, SXF_TRANSFERPOINTERS, 0)
   TNT1 AA 0 A_SpawnItemEx("MegaNukeSmokePillar", 0, 0, 0, 0, 0, 12, 0, SXF_CLIENTSIDE, 0)
   Stop
 }
}

Actor MegaNukeFire : MegaNuke
{
 RenderStyle Add
 +NoInteraction
 -CLIENTSIDEONLY
 DamageType "Superweapon"
 States
 {
  Spawn:
   TNT1 AA 0 A_Jump(256, "Spawn1", "Spawn2", "Spawn3", "Spawn4")
  Spawn1:
   TNT1 A 0 A_Explode(4000,512,1)
   FLA1 A 0 //A_SetScale(ScaleX +0.002, ScaleY +0.002)
   FLA1 A 1 Bright A_FadeOut(0.005)
   Loop
  Spawn2:
   TNT1 A 0 A_Explode(4000,512,1)
   FLA2 A 0 //A_SetScale(ScaleX +0.002, ScaleY +0.002)
   FLA2 A 1 Bright A_FadeOut(0.005)
   Loop
  Spawn3:
   TNT1 A 0 A_Explode(4000,512,1)
   FLA3 A 0 //A_SetScale(ScaleX +0.002, ScaleY +0.002)
   FLA3 A 1 Bright A_FadeOut(0.005)
   Loop
  Spawn4:
   TNT1 A 0 A_Explode(4000,512,1)
   FLA4 A 0 //A_SetScale(ScaleX +0.002, ScaleY +0.002)
   FLA4 A 1 Bright A_FadeOut(0.005)
   Loop
 }
}

Actor MegaNukeSmoke : MegaNuke
{
+CLIENTSIDEONLY
 +NoInteraction
 Scale 1.5
 Alpha 0.1
 States
 {
  Spawn:
   TNT1 AA 0 A_Jump(256, "Spawn1", "Spawn2", "Spawn3", "Spawn4", "Spawn5", "Spawn6")
  Spawn1:
   SMKH A 0 A_JumpIfInventory("SmokeCount",40,"Spawn1X")
   SMKH A 0 //A_SetScale(ScaleX +0.03, ScaleY +0.03)
   SMKH A 2 A_FadeIn(0.01)
   SMKH A 0 A_GiveInventory("SmokeCount",1)
   Loop
  Spawn1X:
   SMKH A 0 //A_SetScale(ScaleX +0.03, ScaleY +0.03)
   SMKH A 2 A_FadeOut(0.002)
   Loop
  Spawn2:
   SMKH B 0 A_JumpIfInventory("SmokeCount",40,"Spawn2X")
   SMKH B 0 //A_SetScale(ScaleX +0.03, ScaleY +0.03)
   SMKH B 2 A_FadeIn(0.01)
   SMKH B 0 A_GiveInventory("SmokeCount",1)
   Loop
  Spawn2X:
   SMKH B 0 //A_SetScale(ScaleX +0.03, ScaleY +0.03)
   SMKH B 2 A_FadeOut(0.002)
   Loop
  Spawn3:
   SMKH C 0 A_JumpIfInventory("SmokeCount",40,"Spawn3X")
   SMKH C 0 //A_SetScale(ScaleX +0.03, ScaleY +0.03)
   SMKH C 2 A_FadeIn(0.01)
   SMKH C 0 A_GiveInventory("SmokeCount",1)
   Loop
  Spawn3X:
   SMKH C 0 //A_SetScale(ScaleX +0.03, ScaleY +0.03)
   SMKH C 2 A_FadeOut(0.002)
   Loop
  Spawn4:
   SMKH D 0 A_JumpIfInventory("SmokeCount",40,"Spawn4X")
   SMKH D 0 //A_SetScale(ScaleX +0.03, ScaleY +0.03)
   SMKH D 2 A_FadeIn(0.01)
   SMKH D 0 A_GiveInventory("SmokeCount",1)
   Loop
  Spawn4X:
   SMKH D 0 //A_SetScale(ScaleX +0.03, ScaleY +0.03)
   SMKH D 2 A_FadeOut(0.002)
   Loop
  Spawn5:
   SMKH E 0 A_JumpIfInventory("SmokeCount",40,"Spawn5X")
   SMKH E 0 //A_SetScale(ScaleX +0.03, ScaleY +0.03)
   SMKH E 2 A_FadeIn(0.01)
   SMKH E 0 A_GiveInventory("SmokeCount",1)
   Loop
  Spawn5X:
   SMKH E 0 //A_SetScale(ScaleX +0.03, ScaleY +0.03)
   SMKH E 2 A_FadeOut(0.002)
   Loop
  Spawn6:
   SMKH F 0 A_JumpIfInventory("SmokeCount",40,"Spawn6X")
   SMKH F 0 //A_SetScale(ScaleX +0.03, ScaleY +0.03)
   SMKH F 2 A_FadeIn(0.01)
   SMKH F 0 A_GiveInventory("SmokeCount",1)
   Loop
  Spawn6X:
   SMKH F 0 //A_SetScale(ScaleX +0.03, ScaleY +0.03)
   SMKH F 2 A_FadeOut(0.002)
   Loop
 }
}

Actor MegaNukeSmoke2 : MegaNukeSmoke
{
 Scale 2.5
 +CLIENTSIDEONLY
 Alpha 0.05
}

Actor MegaNukeSmoke3 : MegaNukeSmoke
{
 Alpha 0.05
 +CLIENTSIDEONLY
}

Actor MegaNukeSmokeSpawner : MegaNukeSmoke
{
 +FORCERADIUSDMG
 +CLIENTSIDEONLY
 States
 {
  Spawn:
   TNT1 A 0 A_JumpIfInventory("SmokeCount",20,"SpawnX")
   TNT1 A 0 //A_SetScale(ScaleX +0.03, ScaleY +0.03)
   TNT1 A 2
   TNT1 A 0 A_GiveInventory("SmokeCount",1)
   Loop
  SpawnX:
   SMKH A 0 A_JumpIfInventory("SmokeCount",80,"SpawnEnd")
   SMKH A 0 //A_SetScale(ScaleX +0.03, ScaleY +0.03)
   TNT1 A 2
   SMKH A 0 A_GiveInventory("SmokeCount",1)
   SMKH A 0 A_Jump(9,1)
   Loop
   SMKH A 0 A_SpawnItemEx("MegaNukeSmoke2",random(32,-32),random(32,-32),random(16,-16),0.00001 * Random(0, 300000),0,0,random(0,359), SXF_CLIENTSIDE, 0)
   Goto SpawnX
  SpawnEnd:
   TNT1 A 2
   Stop
 }
}

Actor SmokeCount : Inventory { Inventory.MaxAmount 80 +IGNORESKILL }

Actor MegaNukeFlare : MegaNukeFire
{
 Scale 16
 +CLIENTSIDEONLY
 +NoInteraction
 States
 {
  Spawn:
   FLAR A 0 Bright //A_SetScale(ScaleX -0.1, ScaleY -0.1)
   FLAR A 1 Bright A_FadeOut(0.01)
   Loop
 }
}

Actor MegaNukeFloor : MegaNuke
{
 States
 {
  Spawn:
   TNT1 A 0
   TNT1 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 0 A_SpawnItemEx("MegaNukeFire", 0, 0, Random(64,256), 0.015 * Random(1900, 2000), 0, 0, Random(0, 359), SXF_TRANSFERPOINTERS, 0)
   TNT1 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 0 A_SpawnItemEx("MegaNukeFire", 0, 0, Random(64,256), 0.015 * Random(1900, 2000), 0, 0, Random(0, 359), SXF_TRANSFERPOINTERS, 0)
   TNT1 A 5
   TNT1 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 1 A_SpawnItemEx("MegaNukeFire", 0, 0, 0, 0.00001 * Random(0, 400000), 0.00001 * Random(0, 400000), 0.5, Random(0, 359), SXF_TRANSFERPOINTERS, 0)
   Stop
 }
}

Actor MegaNukeSmokeFloor : MegaNuke
{
+CLIENTSIDEONLY
 States
 {
  Spawn:
   TNT1 A 0
   TNT1 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 0 A_SpawnItemEx("MegaNukeSmokeSpawner", 0, 0, Random(64,256), 0.016 * Random(1900, 2000), 0, -0.4, Random(0, 359), SXF_CLIENTSIDE, 0)
   TNT1 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 0 A_SpawnItemEx("MegaNukeSmokeSpawner", 0, 0, Random(64,256), 0.015 * Random(1900, 2000), 0, -0.4, Random(0, 359), SXF_CLIENTSIDE, 0)
   TNT1 A 5
   TNT1 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 0 A_SpawnItemEx("MegaNukeSmoke3", Random(0,2048), 0, Random(64,192), 0.00001 * Random(0, -500000), 0, 0.00001 * Random(0, -500000), Random(0, 359), SXF_CLIENTSIDE, 0)
   TNT1 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 1 A_SpawnItemEx("MegaNukeSmoke3", 0, 0, Random(64,192), 0.00001 * Random(0, 500000), 0, 0, Random(0, 359), SXF_CLIENTSIDE, 0)
   Stop
 }
}

Actor MegaNukePillar : MegaNuke
{
 States
 {
  Spawn:
   TNT1 A 0
   TNT1 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 1 A_SpawnItemEx("MegaNukeFire", 0, 0, 0, 0.00001 * Random(0, 100000), 0, 0.00001 * Random(10000, 1000000), Random(0, 359), SXF_TRANSFERPOINTERS, 0)
   TNT1 AAAAAAAAAAAAAAA 1 A_SpawnItemEx("MegaNukeFire", 0, 0, 0, 0.00001 * Random(0, 100000), 0, 0.00001 * Random(10000, 1000000), Random(0, 359), SXF_TRANSFERPOINTERS, 0)
   TNT1 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 1 A_SpawnItemEx("MegaNukeFire", 0, 0, 0, 0.00001 * Random(0, 100000), 0, 0.00001 * Random(10000, 1000000), Random(0, 359), SXF_TRANSFERPOINTERS, 0)
   TNT1 A 0 A_SpawnItem("MegaNukeSmokering", 0, 1600, 0)
   TNT1 AAAAAAAAAAAAAAAAAAAAAAAAAA 1 A_SpawnItemEx("MegaNukeFire", 0, 0, 0, 0.00001 * Random(0, 100000), 0, 0.00001 * Random(10000, 1000000), Random(0, 359), SXF_TRANSFERPOINTERS, 64)
   Stop
 }
}

Actor MegaNukeSmokePillar : MegaNuke
{
+CLIENTSIDEONLY
 States
 {
  Spawn:
   TNT1 A 0
   TNT1 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 1 A_SpawnItemEx("MegaNukeSmoke", 0, 0, 0, 0.00001 * Random(0, 100000), 0, 0.00001 * Random(-250000, 1000000), Random(0, 359), 128, 0)
   Stop
 }
}

Actor MegaNukeMushroom : MegaNuke
{
 States
 {
  Spawn:
   TNT1 A 0
   TNT1 AAAAAAAAAAAAAAAAAAAA 1 A_SpawnItemEx("MegaNukeFire", Random(0, 128), 0, 0, 0.00001 * Random(0, 25000), 0, 0.00001 * Random(900000, 1100000), Random(0, 359), SXF_TRANSFERPOINTERS, 0)
   TNT1 AAAAAAAAAAAAAAAAAAAA 1 A_SpawnItemEx("MegaNukeFire", Random(0, 192), 0, 0, 0.00001 * Random(0, 50000), 0, 0.00001 * Random(910000, 1090000), Random(0, 359), SXF_TRANSFERPOINTERS, 0)
   TNT1 AAAAAAAAAAAAAAAAAAAA 1 A_SpawnItemEx("MegaNukeFire", Random(0, 256), 0, 0, 0.00001 * Random(0, 75000), 0, 0.00001 * Random(920000, 1080000), Random(0, 359), SXF_TRANSFERPOINTERS, 0)
   TNT1 AAAAAAAAAAAAAAAAAAAA 1 A_SpawnItemEx("MegaNukeFire", Random(0, 320), 0, 0, 0.00001 * Random(0, 100000), 0, 0.00001 * Random(930000, 1070000), Random(0, 359), SXF_TRANSFERPOINTERS, 0)
   TNT1 AAAAAAAAAAAAAAAAAAAA 1 A_SpawnItemEx("MegaNukeFire", Random(0, 384), 0, 0, 0.00001 * Random(0, 200000), 0, 0.00001 * Random(940000, 1060000), Random(0, 359), SXF_TRANSFERPOINTERS, 0)
   TNT1 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 1 A_SpawnItemEx("MegaNukeFire", Random(0, 448), 0, 0, 0.00001 * Random(0, 350000), 0, 0.00001 * Random(950000, 1050000), Random(0, 359), SXF_TRANSFERPOINTERS, 0)
   Stop
 }
}

Actor MegaNukeSmokeMushroom : MegaNuke
{
+CLIENTSIDEONLY
 States
 {
  Spawn:
   TNT1 A 0
   TNT1 AAAAAAAAAAAAAAAAAAAA 1 A_SpawnItemEx("MegaNukeSmoke2", Random(0, 192), 0, 0, 0.00001 * Random(0, 100000), 0, 0.00001 * Random(1000000, 1100000), Random(0, 359), SXF_CLIENTSIDE, 0)
   TNT1 AAAAAAAAAAAAAAAAAAAA 1 A_SpawnItemEx("MegaNukeSmoke2", Random(0, 240), 0, 0, 0.00001 * Random(0, 150000), 0, 0.00001 * Random(950000, 1050000), Random(0, 359), SXF_CLIENTSIDE, 0)
   TNT1 AAAAAAAAAAAAAAAAAAAA 1 A_SpawnItemEx("MegaNukeSmoke2", Random(0, 288), 0, 0, 0.00001 * Random(0, 200000), 0, 0.00001 * Random(900000, 1000000), Random(0, 359), SXF_CLIENTSIDE, 0)
   TNT1 AAAAAAAAAAAAAAAAAAAA 1 A_SpawnItemEx("MegaNukeSmoke2", Random(0, 336), 0, 0, 0.00001 * Random(0, 250000), 0, 0.00001 * Random(850000, 950000), Random(0, 359), SXF_CLIENTSIDE, 0)
   TNT1 AAAAAAAAAAAAAAAAAAAA 1 A_SpawnItemEx("MegaNukeSmoke2", Random(0, 384), 0, 0, 0.00001 * Random(0, 300000), 0, 0.00001 * Random(800000, 900000), Random(0, 359), SXF_CLIENTSIDE, 0)
   TNT1 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 1 A_SpawnItemEx("MegaNukeSmoke2", Random(0, 432), 0, 0, 0.00001 * Random(0, 350000), 0, 0.00001 * Random(750000, 850000), Random(0, 359), SXF_CLIENTSIDE, 0)
   Stop
 }
}

Actor MegaNukeFlareMushroom : MegaNukeFlare
{
 Scale 10
 +CLIENTSIDEONLY
 States
 {
  Spawn:
   FLAR A 0 Bright //A_SetScale(ScaleX -0.02, ScaleY -0.02)
   FLAR A 1 Bright A_FadeOut(0.002)
   Loop
 }
}

Actor MegaNukeSmokering : MegaNuke
{
+CLIENTSIDEONLY
 States
 {
  Spawn:
   TNT1 A 0
   TNT1 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 0 A_SpawnItemEx("MegaNukeSmoke2", Random(256, 512), 0, 0, 0.01 * Random(750, 850), 0, 0.01 * random(175, 225), Random(0, 179)*2, 128, 0)
   TNT1 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 0 A_SpawnItemEx("MegaNukeSmoke2", Random(256, 512), 0, 0, 0.01 * Random(750, 850), 0, 0.01 * random(175, 225), Random(0, 179)*2, 128, 128)
   Stop
 }
}
