Actor Typhoon : Weapon Replaces BFG9000 25008
{
  obituary "%o was shredded by %k's TY-99A."
  radius 20
  height 16
  +NOEXTREMEDEATH
  +WEAPON.AMMO_OPTIONAL
  +NOAUTOFIRE
  +NOAUTOAIM
  Tag "TY-99A Typhoon"
  Weapon.PreferredSkin "Typhoon"
  inventory.pickupmessage "You got the NDTR Industries TY-99A 'Typhoon' It knows only one purpose, Only one end."
  Inventory.PickupSound "misc/w_pkup"
  Weapon.UpSound "Weapons/LeadspitterUp"
  weapon.slotnumber 7
  weapon.kickback 100
  weapon.ammotype "LeadClip"
  Weapon.AmmoType2 "PRifle_Magazine"
  weapon.ammouse 1
  weapon.ammouse2 0
  Weapon.AmmoGive2 1
  weapon.bobstyle inversesmooth
   weapon.bobrangeX 0.4
   weapon.bobrangeY 0.6
   weapon.bobspeed 2.5
  scale 0.85
  Decal None
  states
  {
  Ready:
    QUAG A 1 A_WeaponReady(WRF_ALLOWRELOAD)
    loop
	ReadyEmpty:
    QUAG B 1 A_WeaponReady(WRF_ALLOWRELOAD)
    loop
  Deselect:
    TNT1 A 0 SetPlayerProperty(0,1,2)
	TNT1 A 0 A_SetCrosshair(1)
	TNT1 A 0 A_StopSound(115)
	TNT1 A 0 A_StopSound(114)
	QUAS ABCDE 1
	Goto DeselectLoop
  DeselectLoop:
	TNT1 A 0 A_StopSound(115)
	TNT1 A 0 A_StopSound(114)
    TNT1 A 1 A_Lower
    Loop
  Select:
	TNT1 A 0 A_JumpIfInventory("TyphoonFirstTime",1,1)
	goto Select2
	TNT1 A 0 A_PlaySoundEx("Weapons/TyphoonFirst","WeaponPickedUp",0,0)
	TNT1 A 0 SetPlayerProperty(0,0,2)
	TNT1 A 0 A_SetCrosshair(10)
	QUAS EDCBA 1
	TNT1 A 0 A_TakeInventory("TyphoonFirstTime",1)
	Goto SelectLoop
  Select2:
	TNT1 A 0 SetPlayerProperty(0,0,2)
	TNT1 A 0 A_SetCrosshair(10)
	QUAS EDCBA 1
	Goto SelectLoop
  SelectLoop:
    QUAG A 1 A_Raise
    loop
  
  Fire: // Plasma Bolts
    TNT1 A 0 A_JumpIfInventory("DryFireToken", 1, "TrueDryFire")
    TNT1 A 0 A_JumpIfInventory("LeadClip", 1, 1)
    Goto DryFire
    TNT1 A 0 
	TNT1 A 0 A_JumpIfInventory("LeadClip", 181, "FireNormal")
	TNT1 A 0 A_JumpIfInventory("LeadClip", 180, "WarnFire")
	TNT1 A 0 A_JumpIfInventory("LeadClip", 179, "FireNormal")
  FireNormal:
    TNT1 A 0 A_PlaySound("Leadspitter/fireloop",114,0.99,1,1)
	//TNT1 A 0 A_PlaySound("Leadspitter/fireloopadditive",115,0.85,1,1)
	TNT1 A 0 A_SpawnItem("Lightprojectile2",0,0,0,0)
	TNT1 AA 0 A_FireCustomMissile("PRifleCasingSpawner",-3,0,0,0)
	TNT1 A 0 A_FireCustomMissile("P_Plasma_Tracer", random(-4, 4), 1, 2.5, 5,0,random(-4,4))
	TNT1 A 0 A_FireCustomMissile("P_Plasma_Tracer_NoBlood", random(-3, 3), 1, 2.5, 5,0,random(-3,3))
	TNT1 A 0 A_FireCustomMissile("P_Plasma_Tracer", random(-4, 4), 0, 2.5, 5,0,random(-4,4))
	TNT1 A 0 A_FireCustomMissile("P_Plasma_Tracer_NoBlood", random(-4, 4), 1, 2.5, 5,0,random(-4,4))
	TNT1 A 0 A_SetPitch(pitch - 0.35)
	TNT1 A 0 A_FireCustomMissile("gausssmoke_spawner2",0,0,3,4,0)	
	QUF1 A 1 bright A_WeaponReady(WRF_NOFIRE|WRF_NOSWITCH)
	TNT1 AA 0 A_SpawnItem("Lightprojectile2",0,0,0,0)
	TNT1 AA 0 A_FireCustomMissile("PRifleCasingSpawner",-3,0,0,0)
	TNT1 A 0 A_FireCustomMissile("P_Plasma_Tracer", random(-4, 4), 1, 2.5, 5,0,random(-4,4))
	TNT1 A 0 A_FireCustomMissile("P_Plasma_Tracer_NoBlood", random(-3, 3), 1, 2.5, 5,0,random(-3,3))
	TNT1 A 0 A_FireCustomMissile("P_Plasma_Tracer", random(-4, 4), 0, 2.5, 5,0,random(-4,4))
	TNT1 A 0 A_FireCustomMissile("P_Plasma_Tracer_NoBlood", random(-4, 4), 1, 2.5, 5,0,random(-4,4))
	TNT1 A 0 A_SetPitch(pitch - 0.35)
	TNT1 A 0 A_FireCustomMissile("gausssmoke_spawner2",0,0,3,4,0)	
	QUF1 B 1 A_WeaponReady(WRF_NOFIRE|WRF_NOSWITCH)
	TNT1 A 0 A_SpawnItem("Lightprojectile2",0,0,0,0)
	TNT1 AA 0 A_FireCustomMissile("PRifleCasingSpawner",-3,0,0,0)
	TNT1 A 0 A_FireCustomMissile("P_Plasma_Tracer", random(-4, 4), 1, 2.5, 5,0,random(-4,4))
	TNT1 A 0 A_FireCustomMissile("P_Plasma_Tracer_NoBlood", random(-3, 3), 1, 2.5, 5,0,random(-3,3))
	TNT1 A 0 A_FireCustomMissile("P_Plasma_Tracer", random(-4, 4), 0, 2.5, 5,0,random(-4,4))
	TNT1 A 0 A_FireCustomMissile("P_Plasma_Tracer_NoBlood", random(-4, 4), 1, 2.5, 5,0,random(-4,4))
	TNT1 A 0 A_SetPitch(pitch - 0.35)
	TNT1 A 0 A_FireCustomMissile("gausssmoke_spawner2",0,0,3,4,0)	
	QUF1 C 1 bright A_WeaponReady(WRF_NOFIRE|WRF_NOSWITCH)
	TNT1 A 0 A_SpawnItem("Lightprojectile2",0,0,0,0)
	TNT1 AA 0 A_FireCustomMissile("PRifleCasingSpawner",-3,0,0,0)
	TNT1 A 0 A_FireCustomMissile("P_Plasma_Tracer", random(-4, 4), 1, 2.5, 5,0,random(-4,4))
	TNT1 A 0 A_FireCustomMissile("P_Plasma_Tracer_NoBlood", random(-3, 3), 1, 2.5, 5,0,random(-3,3))
	TNT1 A 0 A_FireCustomMissile("P_Plasma_Tracer", random(-4, 4), 0, 2.5, 5,0,random(-4,4))
	TNT1 A 0 A_FireCustomMissile("P_Plasma_Tracer_NoBlood", random(-4, 4), 1, 2.5, 5,0,random(-4,4))
	TNT1 A 0 A_SetPitch(pitch - 0.35)
	TNT1 A 0 A_FireCustomMissile("gausssmoke_spawner2",0,0,3,4,0)	
	QUF1 D 1 A_WeaponReady(WRF_NOFIRE|WRF_NOSWITCH)
	TNT1 A 0 A_ReFire
	TNT1 A 0 A_PlaySound("Leadspitter/firetail",114,0.6,0,1)
	//TNT1 A 0 A_PlaySound("Leadspitter/firetailadditive",115,0.8,0,1)
	QUF2 AB 1 A_WeaponReady(WRF_NOFIRE|WRF_NOSWITCH)
    Goto Ready
  Warnfire:
	TNT1 A 0 A_PlaySound("Leadspitter/fireloop",114,0.99,1,1)
	//TNT1 A 0 A_PlaySound("Leadspitter/fireloopadditive",115,0.85,1,1)
	TNT1 A 0 A_PlaySound("Leadspitter/Warn",116,1.0,0,1)//A_FireCustomMissile("HackyAmmoAlarm")
	TNT1 A 0 A_SpawnItem("Lightprojectile2",0,0,0,0)
	TNT1 AA 0 A_FireCustomMissile("PRifleCasingSpawner",-3,0,0,0)
	TNT1 A 0 A_FireCustomMissile("P_Plasma_Tracer", random(-4, 4), 1, 2.5, 5,0,random(-4,4))
	TNT1 A 0 A_FireCustomMissile("P_Plasma_Tracer_NoBlood", random(-3, 3), 1, 2.5, 5,0,random(-3,3))
	TNT1 A 0 A_FireCustomMissile("P_Plasma_Tracer", random(-4, 4), 0, 2.5, 5,0,random(-4,4))
	TNT1 A 0 A_FireCustomMissile("P_Plasma_Tracer_NoBlood", random(-4, 4), 1, 2.5, 5,0,random(-4,4))
	TNT1 A 0 A_SetPitch(pitch - 0.35)
	TNT1 A 0 A_FireCustomMissile("gausssmoke_spawner2",0,0,3,4,0)	
	QUF1 A 1 bright A_WeaponReady(WRF_NOFIRE|WRF_NOSWITCH)
	TNT1 A 0 A_SpawnItem("Lightprojectile2",0,0,0,0)
	TNT1 AA 0 A_FireCustomMissile("PRifleCasingSpawner",-3,0,0,0)
	TNT1 A 0 A_FireCustomMissile("P_Plasma_Tracer", random(-4, 4), 1, 2.5, 5,0,random(-4,4))
	TNT1 A 0 A_FireCustomMissile("P_Plasma_Tracer_NoBlood", random(-3, 3), 1, 2.5, 5,0,random(-3,3))
	TNT1 A 0 A_FireCustomMissile("P_Plasma_Tracer", random(-4, 4), 0, 2.5, 5,0,random(-4,4))
	TNT1 A 0 A_FireCustomMissile("P_Plasma_Tracer_NoBlood", random(-4, 4), 1, 2.5, 5,0,random(-4,4))
	TNT1 A 0 A_SetPitch(pitch - 0.35)
	TNT1 A 0 A_FireCustomMissile("gausssmoke_spawner2",0,0,3,4,0)	
	QUF1 B 1 A_WeaponReady(WRF_NOFIRE|WRF_NOSWITCH)
	TNT1 A 0 A_SpawnItem("Lightprojectile2",0,0,0,0)
	TNT1 AA 0 A_FireCustomMissile("PRifleCasingSpawner",-3,0,0,0)
	TNT1 A 0 A_FireCustomMissile("P_Plasma_Tracer", random(-4, 4), 1, 2.5, 5,0,random(-4,4))
	TNT1 A 0 A_FireCustomMissile("P_Plasma_Tracer_NoBlood", random(-3, 3), 1, 2.5, 5,0,random(-3,3))
	TNT1 A 0 A_FireCustomMissile("P_Plasma_Tracer", random(-4, 4), 0, 2.5, 5,0,random(-4,4))
	TNT1 A 0 A_FireCustomMissile("P_Plasma_Tracer_NoBlood", random(-4, 4), 1, 2.5, 5,0,random(-4,4))
	TNT1 A 0 A_SetPitch(pitch - 0.35)
	TNT1 A 0 A_FireCustomMissile("gausssmoke_spawner2",0,0,3,4,0)	
	QUF1 C 1 bright A_WeaponReady(WRF_NOFIRE|WRF_NOSWITCH)
	TNT1 A 0 A_SpawnItem("Lightprojectile2",0,0,0,0)
	TNT1 AA 0 A_FireCustomMissile("PRifleCasingSpawner",-3,0,0,0)
	TNT1 A 0 A_FireCustomMissile("P_Plasma_Tracer", random(-4, 4), 1, 2.5, 5,0,random(-4,4))
	TNT1 A 0 A_FireCustomMissile("P_Plasma_Tracer_NoBlood", random(-3, 3), 1, 2.5, 5,0,random(-3,3))
	TNT1 A 0 A_FireCustomMissile("P_Plasma_Tracer", random(-4, 4), 0, 2.5, 5,0,random(-4,4))
	TNT1 A 0 A_FireCustomMissile("P_Plasma_Tracer_NoBlood", random(-4, 4), 1, 2.5, 5,0,random(-4,4))
	TNT1 A 0 A_SetPitch(pitch - 0.35)
	TNT1 A 0 A_FireCustomMissile("gausssmoke_spawner2",0,0,3,4,0)	
	QUF1 D 1 A_WeaponReady(WRF_NOFIRE|WRF_NOSWITCH)
	TNT1 A 0 A_ReFire
	TNT1 A 0 A_PlaySound("Leadspitter/firetail",114,0.6,0,1)
	//TNT1 A 0 A_PlaySound("Leadspitter/firetailadditive",115,0.8,0,1)
	QUF2 AB 1 A_WeaponReady(WRF_NOFIRE|WRF_NOSWITCH)
	Goto Ready
  DryFire:
	TNT1 A 0 A_PlaySound("Leadspitter/firetail",114,0.6,0,1)
	//TNT1 A 0 A_PlaySound("Leadspitter/firetailadditive",115,0.8,0,1)
	QUAG B 0 A_PlaySound("Plasma/Empty",116,1.0,0,1)
	QUF3 AB 1 A_WeaponReady(WRF_NOFIRE|WRF_NOSWITCH)
	QUAG B 8 A_WeaponReady(WRF_NOFIRE|WRF_NOSWITCH)
	TNT1 A 0 A_GiveInventory("DryFireToken", 1)
	Goto ReadyEmpty
  TrueDryFire:
	QUAG B 0 A_PlaySound("Plasma/Empty",116,1.0,0,1)
	QUAG B 8 A_WeaponReady(WRF_NOFIRE|WRF_NOSWITCH)
	Goto ReadyEmpty
  Reload:
	TNT1 A 0 A_TakeInventory("DryFireToken", 1)
	QURL A 0 A_JumpIfInventory("LeadClip",720,"Ready")
	QURL A 0 A_JumpIfInventory("PRifle_Magazine",1,1)
	Goto TrueDryFire
	QURL A 1 A_WeaponReady(WRF_NOFIRE|WRF_NOSWITCH)
	QURL BC 1 A_WeaponReady(WRF_NOFIRE|WRF_NOSWITCH)
	QURL DEF 1 A_WeaponReady(WRF_NOFIRE|WRF_NOSWITCH)
	QUAG B 0 A_PlaySound("Leadspitter/Burst",117,0.88,0,1)
	TNT1 A 0 A_FireCustomMissile("EmptyLeadClip", random(-2, 2), 0, 5, 3,0,random(-2,2))
	QURL G 2 A_WeaponReady(WRF_NOFIRE|WRF_NOSWITCH)
	QURL HIJ 2 A_WeaponReady(WRF_NOFIRE|WRF_NOSWITCH)
  ReloadWork:
	QURL M 0 A_TakeInventory("PRifle_Magazine",1)
	QURL M 0 A_GiveInventory("LeadClip",720)
	QURL M 0 A_JumpIfInventory("LeadClip",720,"ReloadFinish")
	QURL M 0 A_JumpIfInventory("PRifle_Magazine",1,"ReloadWork")
  ReloadFinish:
    QURL KLMNO 2 A_WeaponReady(WRF_NOFIRE|WRF_NOSWITCH)
	TNT1 A 0 A_PlaySound("Leadspitter/reload",118,0.99,0,1)
	QURL PQRSTUVWX 2 A_WeaponReady(WRF_NOFIRE|WRF_NOSWITCH)
	Goto Ready
  Spawn:
    QWOP A -1
	Stop
	}
}

ACTOR TyphoonFirstTime : Inventory {Inventory.MaxAmount 1 Inventory.InterHubAmount 1}

ACTOR BlankPuff
{
	+NOGRAVITY
	+NOBLOCKMAP
	+FLOORCLIP
	+NOTELEPORT
	+FORCEXYBILLBOARD
	+NOEXTREMEDEATH
	+NOINTERACTION
	+NOTIMEFREEZE
	States
	{
	Spawn:
		TNT1 A 1
		Stop
	}
}

ACTOR DryFireToken : Inventory
{
	Inventory.MaxAmount 1
}

actor EmptyLeadClip
{
	Radius 11
	Height 8
	Speed 100
	Damage 20
	Projectile
	Gravity 0.25
	-NOGRAVITY
	+RANDOMIZE
	+BLOODSPLATTER
	+NOEXTREMEDEATH
	+NOTIMEFREEZE
	SeeSound ""
	DeathSound ""
	damagetype Normal
	obituary "%o thought it would be a good idea to try and catch %k's ejected typhoon magazine... that is until %g got %p face caved in."
	States
	{
	Spawn:
		Spawn:
		MISL A 0
		QWOP C 1
		Wait
	Death:
		TNT1 A 0 A_PlaySound("LeadClip/HitWall")
		TNT1 A 8 A_SpawnItemEx("EmptyLeadClipThunked",0,0,16,random(0,16),0,0,random(170,190))
		stop
	XDeath:
		TNT1 A 0 A_PlaySound("LeadClip/HitThing")
		TNT1 A 8 A_SpawnItemEx("EmptyLeadClipThunked",0,0,16,random(0,16),0,0,random(170,190))
		stop
	}
}

actor EmptyLeadClipThunked
{
	+CANBOUNCEWATER
	+BOUNCEONWALLS
	+BOUNCEONFLOORS
	+BOUNCEONCEILINGS
	+ALLOWBOUNCEONACTORS
	+BOUNCEONACTORS
	+NOTIMEFREEZE
	Radius 11
	Height 8
	Speed 3
	Damage 0
	BounceCount 6
	PROJECTILE
	+RANDOMIZE
	-NOGRAVITY
	//+FORCEXYBILLBOARD
	BounceType "Doom"
	BounceSound "LeadClip/Bounce"
	DeathSound ""
	Obituary "%o Got Smacked in the face with an empty Typhoon Magazine"
	damagetype Explosive
	States
	{
	Spawn:
		TNT1 A 0
		TNT1 A 0 ThrustThingZ(0,16,0,1)
		QWOP C 180
	Death:
		QWOP C 20
		QWOP CCCCCCCCCC 1 A_Fadeout(0.1)
		stop
	}
}

ACTOR LeadClip : Ammo
{
Inventory.Amount 0
Inventory.MaxAmount 720
Ammo.BackpackAmount 0
Ammo.BackpackMaxAmount 720
+IGNORESKILL
}

actor PRifle_Magazine : ammo 26107 {
  radius 16
  height 8
  scale 0.35
  inventory.pickupmessage "Magazine of 4.5x32mmT Ammo for the TY-99A Typhoon"
  inventory.pickupsound "Leadspitter/reload"
  inventory.amount 1
  inventory.maxamount 1
  ammo.backpackamount 1
  ammo.backpackmaxamount 2
  states
  {
  Spawn:
    TYPP A -1
    stop
  }
}

actor PRifleCasingSpawner {
	speed 15
	PROJECTILE
	+NOCLIP
	+CLIENTSIDEONLY
	states{
		spawn:
			TNT1 A 0
			TNT1 A 1 A_SpawnItemEx("PRifle_Casing", 0, 10, 3, 1, random(4,5), random(1,2), 0) 
			stop
	}

}

ACTOR PRifle_Casing
{
   Radius 2
   Height 4
   Speed 8
   Scale 0.125
   BounceSound "Weapons/PistolCasing"
   PROJECTILE
   -NOGRAVITY
   +BOUNCEONACTORS
   +BOUNCEONCEILINGS
   +DONTSPLASH
   +CLIENTSIDEONLY
   Gravity 0.75
   BounceType Doom
   BounceCount 6
   BounceFactor 0.6
   DamageType Nope
   States
   {
   Spawn:
	  TYPC A 0
      TYPC ABCDEF 1
      Goto Roflcopter
   Roflcopter:
      TYPC A 0 A_Jump(128,1,3,5,7)
      TYPC ABCDEF 1
      Loop
   Death:
      TYPC A 0 A_SpawnItemEx("PRifle_Casing_Liedown")
      stop
   }
}

actor PRifle_Casing_Liedown
{
	-NOGRAVITY
    Scale 0.125
	States
	{
	Spawn:
	  TNT1 A 0
	  TNT1 A 0 A_Jump(255,"Spawn1","Spawn2","Spawn3")
	  stop
	Spawn1:
	  TYPC A 1
	  Goto Ded
	Spawn2:
	  TYPC D 1
	  Goto Ded
	Spawn3:
	  TYPC C 1
	  Goto Ded
	Ded:
	  "####" "#" 210 A_CheckSight("Fadying")
	  Loop
	Fadying:
	  "####" "#" 1 A_FadeOut(0.1)
	  Wait
   }
}