ACTOR GE007RocketLauncher : Weapon
{
  Weapon.Kickback 100
  Scale 0.1
  
        Weapon.Ammotype1 "RocketLauncherClip"
   Weapon.AmmoUse1 1
  Weapon.AmmoGive1 0
      Weapon.AmmoUse2 0
	Weapon.AmmoGive2 1
	Weapon.AmmoType2 "GE007RocketAmmo"
	+WEAPON.AMMO_OPTIONAL
    tag "Rocket Launcher"
  Inventory.PickupMessage "Picked up a Rocket Launcher."
  Obituary  "%o took %k's Rocket Launcher round straight to the spine."
  	Inventory.PickupSound "GE007/Weapons/WeaponSFX1"
  States
  {
  Spawn:
    TKA1 S -1
    Loop
  Ready:
  TNT1 A 0 A_PlaySound ("GE007/Weapons/WeaponSFX1","Weapon")
    TK50 A 1 
    TK50 B 1
    TK50 C 1
    TK50 D 1
    TK50 EFGHIJKLM 1
    TK50 N 2 A_WeaponReady
	goto ReloadCheck
	TK50 N 1 A_WeaponReady
	RLAU A 0 A_JumpIfNoAmmo("EmptyReady")
    Goto Ready+5
	
	  EmptyReady:
	RLAU C 0 A_JumpIfInventory("RocketLauncherClip",1,3)
	TK50 S 1 A_WeaponReady
	RLAU C 0 A_JumpIfInventory("RocketLauncherClip",1,1)
	loop
	RLAU C 0
	goto Ready
	
	ReloadCheck:
	 KLBG A 0 A_JumpIfInventory("RocketLauncherClip",1,2)
	 KLBG A 0 A_JumpIfInventory("GE007RocketAmmo",1,"ReloadStart")
	 KLBG A 0
	 goto Ready+14

  ReloadStart:
	 KLBR A 0 A_PlayWeaponSound("GE007/Weapons/Reload")
     TK50 TUVXYZ 1
	 TK51 A 1
	 TNT1 A 5
	 goto ReloadAmmo

  ReloadAmmo:
	 TNT1 A 0 A_TakeInventory("GE007RocketAmmo",1)
	 TNT1 A 0 A_GiveInventory("RocketLauncherClip",1)
	 TNT1 A 0 A_JumpIfInventory("RocketLauncherClip",1,"ReloadDone")
	 TNT1 A 0 A_JumpIfInventory("GE007RocketAmmo",1,"ReloadAmmo")
	 goto ReloadDone
	 
	 ReloadDone:
	 TNT1 A 5
     TK50 ABCDEFGHIJKLMN 1
	 goto Ready+14
	
  Deselect:
    TK50 MLKJIHGFEDCB 1
    TK50 A 1
    TK08 A 0 A_Lower
    wait
  Select: 
    TK08 A 0 A_Raise 
    Loop  
  Fire: 
   KLBG A 0 A_JumpIfNoAmmo("ReloadCheck")
 	TNT1 A 0 A_PlaySound ("GE007/Weapons/RL","Weapon")
	TK50 S 1 A_FireCustomMissile("GE007Rocket", 0, 1, 4, 6, 0)
	TK50 S 20
    Goto Ready+14
	AltFire:
		TK04 A 0
		goto ReloadCheck
  }
}

ACTOR RocketLauncherClip : Ammo
{
Inventory.MaxAmount 1 // size of the clip
Ammo.BackpackAmount 0
Ammo.BackpackMaxAmount 1 //MUST be the same as Inventory.MaxAmmount
+INVENTORY.IGNORESKILL
}

actor RollingExplosion3
{
  Radius 1
  Height 1
  Speed 0
  obituary "%k's Rocket Launcher's Rolling Explosion burned %o's corpse away."
  Scale 1.32
  RenderStyle Translucent
  Alpha 0.9
  -SOLID
  +NOGRAVITY
  +NODAMAGETHRUST
  +FORCERADIUSDMG
  +FORCEXYBILLBOARD
  States
  {
  Spawn:
   FIR2 ABCDEFGH 2 BRIGHT A_Explode(16, 76, 1)
   FIR2 IJKLMN 2 BRIGHT
   stop
  }
}

actor GE007RocketTrail
{
  Projectile
  Radius 1
  Height 1
  Damage 0
  Speed 0
  Scale 0.1
  RenderStyle Translucent
  Alpha 0.5
  +NOCLIP
  States
  {
   Spawn:
   TNT1 A 0
   TNT1 A 2
   SMOK ABCDEFGHIJKLMNOPQ 2
   stop
  }
}

actor ExplosionSmoke
{
  Projectile
  Radius 1
  Height 1
  Damage 0
  Speed 0
  Scale 0.8
  RenderStyle Translucent
  Alpha 0.3
  +NOCLIP
  +FORCEXYBILLBOARD
  States
  {
   Spawn:
   SMO2 ABCDEFGHIJKLMNOPQ 10
   stop
  }
}

actor GE007Rocket
{
  spawnid 127
  obituary "%o took %k's Rocket Launcher round straight to the spine."
  radius 8
  height 8
  speed 28
  damage 100
  DamageType Rocket
  deathsound "GE007/Weapons/Boom"
  Decal BigScorch
  Gravity 0.01
  Scale 0.2
  PROJECTILE
  -NOGRAVITY
  +RANDOMIZE
  -ROCKETTRAIL
  states
  {
  Spawn:
	TF02 A 0
	TF02 A 0 Thing_ChangeTID(0, 255)
	TF02 A 1 A_SpawnItemEx("GE007RocketTrail", Random(-4,4), Random(-4,4), Random(-4,4), 0, 0, 0, 0, 128, 0)
	goto Spawn+2
  Death:
	MISL B 0 bright A_Explode
	TNT1 A 0 radius_quake(2, 10, 0, 3, 0)
	TNT1 AAAAAAAAAAAA 0 A_SpawnItemEx("Debris1", Random(-8, 8), Random(-8, 8), Random(-8, 8), Random(-5, 5), Random(-5, 5), Random(-6, 7), Random(-360, 360), 128, 24)
	TNT1 AAAAAAAAAAAA 0 A_SpawnItemEx("Debris2", Random(-8, 8), Random(-8, 8), Random(-8, 8), Random(-5, 5), Random(-5, 5), Random(-6, 7), Random(-360, 360), 128, 24)
	TNT1 AAAAAAAAAAAA 0 A_SpawnItemEx("Debris3", Random(-8, 8), Random(-8, 8), Random(-8, 8), Random(-5, 5), Random(-5, 5), Random(-6, 7), Random(-360, 360), 128, 24)
	TNT1 AAAAAAAAAAAA 0 A_SpawnItemEx("Debris4", Random(-8, 8), Random(-8, 8), Random(-8, 8), Random(-5, 5), Random(-5, 5), Random(-6, 7), Random(-360, 360), 128, 24)
	TNT1 AAAAAAAAAAAA 0 A_SpawnItemEx("Debris5", Random(-8, 8), Random(-8, 8), Random(-8, 8), Random(-5, 5), Random(-5, 5), Random(-6, 7), Random(-360, 360), 128, 24)
	TNT1 AAAAAAAAAAAA 0 A_SpawnItemEx("Debris1", Random(-8, 8), Random(-8, 8), Random(-8, 8), Random(-3, 3), Random(-3, 3), Random(1, 6), Random(-360, 360), 128, 24)
	TNT1 AAAAAAAAAAAA 0 A_SpawnItemEx("Debris2", Random(-8, 8), Random(-8, 8), Random(-8, 8), Random(-3, 3), Random(-3, 3), Random(1, 6), Random(-360, 360), 128, 24)
	TNT1 AAAAAAAAAAAA 0 A_SpawnItemEx("Debris3", Random(-8, 8), Random(-8, 8), Random(-8, 8), Random(-3, 3), Random(-3, 3), Random(1, 6), Random(-360, 360), 128, 24)
	TNT1 AAAAAAAAAAAA 0 A_SpawnItemEx("Debris4", Random(-8, 8), Random(-8, 8), Random(-8, 8), Random(-3, 3), Random(-3, 3), Random(1, 6), Random(-360, 360), 128, 24)
	TNT1 AAAAAAAAAAAA 0 A_SpawnItemEx("Debris5", Random(-8, 8), Random(-8, 8), Random(-8, 8), Random(-3, 3), Random(-3, 3), Random(1, 6), Random(-360, 360), 128, 24)
	TNT1 A 3 A_SpawnItemEx ("RollingExplosion3", 0, 0, 0, 0, 0, 0, 0, 0, 0)
	TNT1 A 0 A_SpawnItemEx ("ExplosionSmoke", Random(-44, 44), Random(-44, 44), Random(0, 38), 0, 0, 0, 0, 128, 0)
	TNT1 A 3 A_SpawnItemEx ("RollingExplosion3", Random(-24, 24), Random(-24, 24), Random(0, 38), 0, 0, 0, Random(-360, 360), 0, 0)
	TNT1 A 0 A_SpawnItemEx ("ExplosionSmoke", Random(-44, 44), Random(-44, 44), Random(0, 38), 0, 0, 0, 0, 128, 0)
	TNT1 A 3 A_SpawnItemEx ("RollingExplosion3", Random(-24, 24), Random(-24, 24), Random(0, 38), 0, 0, 0, Random(-360, 360), 0, 0)
	TNT1 A 0 A_SpawnItemEx ("ExplosionSmoke", Random(-44, 44), Random(-44, 44), Random(0, 38), 0, 0, 0, 0, 128, 0)
	TNT1 A 3 A_SpawnItemEx ("RollingExplosion3", Random(-24, 24), Random(-24, 24), Random(0, 38), 0, 0, 0, Random(-360, 360), 0, 0)
	TNT1 A 0 A_SpawnItemEx ("ExplosionSmoke", Random(-44, 44), Random(-44, 44), Random(0, 38), 0, 0, 0, 0, 128, 0)
	TNT1 A 3 A_SpawnItemEx ("RollingExplosion3", Random(-24, 24), Random(-24, 24), Random(0, 38), 0, 0, 0, Random(-360, 360), 0, 0)
	TNT1 A 0 A_SpawnItemEx ("ExplosionSmoke", Random(-44, 44), Random(-44, 44), Random(0, 38), 0, 0, 0, 0, 128, 0)
	TNT1 A 3 A_SpawnItemEx ("RollingExplosion3", Random(-24, 24), Random(-24, 24), Random(0, 38), 0, 0, 0, Random(-360, 360), 0, 0)
	TNT1 A 0 A_SpawnItemEx ("ExplosionSmoke", Random(-44, 44), Random(-44, 44), Random(0, 38), 0, 0, 0, 0, 128, 0)
	TNT1 A 3 A_SpawnItemEx ("RollingExplosion3", Random(-24, 24), Random(-24, 24), Random(0, 38), 0, 0, 0, Random(-360, 360), 0, 0)
	TNT1 A 0 A_SpawnItemEx ("ExplosionSmoke", Random(-44, 44), Random(-44, 44), Random(0, 38), 0, 0, 0, 0, 128, 0)
	TNT1 A 3 A_SpawnItemEx ("RollingExplosion3", Random(-24, 24), Random(-24, 24), Random(0, 38), 0, 0, 0, Random(-360, 360), 0, 0)
	TNT1 A 0 A_SpawnItemEx ("ExplosionSmoke", Random(-44, 44), Random(-44, 44), Random(0, 38), 0, 0, 0, 0, 128, 0)
	TNT1 A 3 A_SpawnItemEx ("RollingExplosion3", Random(-24, 24), Random(-24, 24), Random(0, 38), 0, 0, 0, Random(-360, 360), 0, 0)
	TNT1 A 0 A_SpawnItemEx ("ExplosionSmoke", Random(-44, 44), Random(-44, 44), Random(0, 38), 0, 0, 0, 0, 128, 0)
	TNT1 A 3 A_SpawnItemEx ("RollingExplosion3", Random(-24, 24), Random(-24, 24), Random(0, 38), 0, 0, 0, Random(-360, 360), 0, 0)
	TNT1 AAAAAAA 5 A_SpawnItemEx ("RollingExplosion3", Random(-24, 24), Random(-24, 24), Random(0, 38), 0, 0, 0, Random(-360, 360), 0, 0)
	stop
  }
}

ACTOR GE007RocketLauncherPickup : Custominventory
{
   Scale 0.2
  Inventory.PickupMessage "Picked up a Rocket Launcher."
  	Inventory.PickupSound "GE007/Weapons/WeaponSFX1"
   States
   {
   Spawn:
	  TKA4 K -1
	  loop
   Pickup:
	  TNT1 A 0 A_GiveInventory("GE007RocketLauncher")
	  stop
   }
}
