ACTOR ChinaLake : BrutalWeapon
{
	Weapon.AmmoUse1 0
	Weapon.AmmoGive1 0
	Weapon.AmmoUse2 0
	Weapon.AmmoGive2 0
	Weapon.SelectionOrder 2500
	Weapon.AmmoType1 "AmmoGL"
	Weapon.AmmoType2 "ChinaLakeAmmo"
	Obituary "%o was shot down by %k's Shotgun."
    Inventory.PickupSound "CLIPIN"
	Inventory.Pickupmessage "$GOTShotgun"
    +WEAPON.NOAUTOAIM
    +WEAPON.NOALERT
	+WEAPON.NOAUTOFIRE
	+FORCEXYBILLBOARD
	Tag "China Lake"
	States
	{
	
	Spawn:
		RIFL A -1
		Stop
	
	Ready:
	Ready3:
		CHLN A 1 A_WeaponReady(WRF_ALLOWRELOAD)
		CHLN A 0 A_JumpIfInventory("TossGrenade",1,"TossGrenade")
        CHLN A 0 A_JumpIfInventory("Reloading",1,"Reload")
		CHLN A 0 A_JumpIfInventory("Kicking",1,"DoKick")
		"----" # 0 A_JumpIfInventory("UsedBandage", 1, "UseBandages")
		Loop
	
	Deselect:
		CHLN A 0
		CHLN A 0 A_TakeInventory("TossGrenade", 1)
        CHLN A 0 A_TakeInventory("Reloading",1)
		CHLN A 0 A_TakeInventory("Unloading",1)
        CHLN A 0 A_ZoomFactor(1.0)
		CHLN AAA 1 A_Lower
		TNT1 AAAAAAAAAAAAAAAAAA 0 A_Lower
		TNT1 A 1 A_Lower
		Wait
		
	Select:
		CHLN A 0
		CHLN AAA 1 A_Raise
		TNT1 A 0 A_TakeInventory("ChinaLakeBuck", 1)
		TNT1 AAAAAAAAA 0 A_Raise
		Goto Ready3
	
    Fire:
        CHLN A 0 A_JumpIfInventory("ChinaLakeAmmo",1,2)
        Goto NoAmmo
        TNT1 AA 0
		CHLN A 0 A_AlertMonsters
		GLAN A 0 A_FireCustomMissile("ShortGrenade", 0, 1, 0, 0, 0, 0)
		GLAN A 0 A_FireCustomMissile("RedFlareSpawn",-5,0,0,0)
		TNT1 AAAAAA 0 BRIGHT A_FireCustomMissile("ShotgunParticles", random(-16,16), 0, -1, random(-9,9))
		GLAN A 0 A_PlaySound("weapons/firegrenade")
		CHLA B 1 A_FireCustomMissile("SmokeSpawner", random(-0.3,0.3), 0, 0, 0, 0, random(-0.3,0.3))
		CHLN A 0 A_SpawnItemEx("PlayerMuzzle1",30,5,30)
        CHLN A 0 A_ZoomFactor(0.96)
		CHLN A 0 A_SetPitch(pitch-4.0)
		CHLN A 0 A_Takeinventory("ChinaLakeAmmo",1)
		CHLA C 1 A_FireCustomMissile("SmokeSpawner", random(-0.3,0.3), 0, 0, 0, 0, random(-0.3,0.3))
		CHLN A 0 A_SetPitch(pitch+0.5)
		CHLN A 0 A_ZoomFactor(1.0)
		CHLA DE 1 A_SetPitch(pitch+0.5)
		CHLN AAAA 1 A_SetPitch(pitch+0.5)
		
		CHLN BCD 1
		CHLN D 2
		CHLN A 0 A_FireCustomMissile("ShotCaseSpawn",40,0,-8,-26)
		CHLN A 0 A_PlaySound("weapons/sgpump", 3)
		CHLN EFGHHHH 1
		CHLN A 0 A_JumpIfInventory("Kicking",1,"DoKick")
		CHLN GFED 1
		CHLN D 2
		CHLN CB 1
		Goto Ready3
		
	
    Reload:
		CHLN A 1 A_WeaponReady
		CHLN A 0 A_ZoomFactor(1.0)
		CHLN A 0 A_Takeinventory("Reloading",1)
		CHLN A 0 A_Takeinventory("ADSmode",1)
		CHLN A 0 A_Takeinventory("Zoomed",1)
		CHLN A 0 A_JumpIfInventory("ChinaLakeAmmo",4,"Ready3")
        CHLN A 0 A_JumpIfInventory("AmmoGL",1,3)
        Goto FinishReloading
        TNT1 AAA 0
		CHLN A 0 A_Takeinventory("Zoomed",1)
		CHLN A 0 A_GiveInventory ("Pumping", 1)
		CHLN A 0 A_Takeinventory("Reloading",1)
		
		CHLN BCD 1
		Goto InsertBullets
		
		
	InsertBullets:
		TNT1 A 0
		TNT1 A 0 A_TakeInventory("FiredPrimary", 1)
		CHLN A 0 A_JumpIfInventory("ChinaLakeAmmo",4,"FinishReloading")
		CHLN A 0 A_JumpIfInventory("AmmoGL",1,3)
		Goto FinishReload3
        TNT1 AAAAAA 0
		CHLN A 0 A_JumpIfInventory("Kicking",1,"DoKick")
		CHLR H 10 A_WeaponReady(WRF_NOPRIMARY)
		CHLN A 0 A_JumpIfInventory("Kicking",1,"DoKick")
		CHLN A 0 A_JumpIfInventory("Reloading",1,"FinishReloading")
		CHLN A 0 A_JumpIfInventory("FiredPirmary",1,"FinishReloading")
		CHLR AB 1
		TNT1 A 0 A_PlaySound("insertshell")
		CHLR CDEFGH 1 A_JumpIfInventory("Kicking",1,"DoKick")
		CHLN A 0 A_Giveinventory("ChinaLakeAmmo",1)
		CHLN A 0 A_Takeinventory("AmmoGL",1)
		Goto InsertBullets
		
		
	FinishReloading:
		CHLN A 0
		CHLN A 0 A_JumpIfInventory("ShotgunWasEmpty",1,"FinishReloading2")
		TNT1 A 0 A_TakeInventory("Reloading", 1)
		CHLN DCB 1
		CHLN A 0 A_Refire
		Goto Ready3

	FinishReloading2:
		TNT1 A 0
		TNT1 A 0 A_TakeInventory("ShotgunWasEmpty", 1)
		CHLN A 0 A_PlaySound("weapons/sgpump", 3)
		CHLN EFGHHHH 1
		CHLN A 0 A_JumpIfInventory("Kicking",1,"DoKick")
		CHLN GFED 1
		CHLN D 2
		CHLN CB 1
		CHLN A 0 A_Refire
		Goto Ready3
		
		
		
	NoAmmo:
		CHLN A 0
		CHLN A 0 A_ZoomFactor(1.0)
		CHLN A 0 A_Giveinventory("ShotgunWasEmpty",1)
		CHLN A 0 A_Takeinventory("Zoomed",1)
		CHLN A 0 A_Takeinventory("ADSmode",1)
		TNT1 A 0 A_PlaySound("weapons/empty", 4)
	NoAmmo2:
		CHLN A 0 A_JumpIfInventory("TossGrenade",1,"TossGrenade")
        CHLN A 0 A_JumpIfInventory("Reloading",1,"Reload")
		CHLN A 0 A_JumpIfInventory("Kicking",1,"DoKick")
		CHLN A 5 A_WeaponReady(WRF_ALLOWRELOAD | WRF_NOPRIMARY)
		CHLN A 0 A_JumpIfInventory("Reloading",1,"Reload")
		TNT1 A 0 A_JumpIfInventory("NoAutoReload", 1, "NoAmmo2")
		CHLN A 0 A_JumpIfInventory("AmmoGL",1,"Reload")
		Goto Ready3

	AltFire:
		TNT1 A 0
		TNT1 A 0 A_JumpIFInventory("AmmoGLShell", 1, 2)
		Goto CantSwitch
		TNT1 A 0
		TNT1 A 0 A_Print("Switching to Dragonbreath Rounds")
		Goto UnloadToSwitch

	CantSwitch:
		CHLN A 3
		TNT1 A 0 A_Print("You don`t have alt ammo.")
		Goto Ready3

	UnloadToSwitch:
		TNT1 A 0
		TNT1 A 0 A_TakeInventory("FiredPrimary", 1)
		CHLN A 0 A_JumpIfInventory("ChinaLakeAmmo",1,2)
		Goto FinishUnloading
		TNT1 A 0
		CHLN A 0 A_Takeinventory("ChinaLakeAmmo",1)
		CHLN A 0 A_Giveinventory("AmmoGL",1)
		CHLN A 1
		Loop
		
		
	FinishUnloading:
		CHLN A 0
		TNT1 A 0 A_GiveInventory("ChinaLakeBuck", 1)
		TNT1 A 0 A_SelectWeapon("ChinaLakeBuck")
		Goto Ready3
	}
}

ACTOR ChinaLakeAmmo : Ammo
{
   Inventory.Amount 0
   Inventory.MaxAmount 4
   Ammo.BackpackAmount 0
   Ammo.BackpackMaxAmount 4
   Inventory.Icon "RIFLA0"
}









//









ACTOR ChinaLakeBuck : BrutalWeapon
{
	Weapon.AmmoUse1 0
	Weapon.AmmoGive1 0
	Weapon.AmmoUse2 0
	Weapon.AmmoGive2 0
	Weapon.SelectionOrder 2500
	Weapon.AmmoType1 "AmmoGLShell"
	Weapon.AmmoType2 "ChinaLakeAmmo"
	Obituary "%o was shot down by %k's Shotgun."
    Inventory.PickupSound "CLIPIN"
	Inventory.Pickupmessage "$GOTShotgun"
    +WEAPON.NOAUTOAIM
    +WEAPON.NOALERT
	+WEAPON.NOAUTOFIRE
	+FORCEXYBILLBOARD
	Tag "ChinaLake 37 Shotgun"
	States
	{
	
	Spawn:
		TNT1 A 1
		TNT1 A 0 A_SpawnItemEx("ChinaLakeWeapon", 0, 0, 0, momx, momy, momz)
		Stop
	
	Ready:
	Ready3:
		CHLN A 1 A_WeaponReady(WRF_ALLOWRELOAD)
		CHLN A 0 A_JumpIfInventory("TossGrenade",1,"TossGrenade")
        CHLN A 0 A_JumpIfInventory("Reloading",1,"Reload")
		"----" # 0 A_JumpIfInventory("UsedBandage", 1, "UseBandages")
		CHLN A 0 A_JumpIfInventory("Kicking",1,"DoKick")
		Loop
	
	Deselect:
		CHLN A 0
		CHLN A 0 A_TakeInventory("TossGrenade", 1)
        CHLN A 0 A_TakeInventory("Reloading",1)
		CHLN A 0 A_TakeInventory("Unloading",1)
        CHLN A 0 A_ZoomFactor(1.0)
		CHLN AAA 1 A_Lower
		TNT1 AAAAAAAAAAAAAAAAAA 0 A_Lower
		TNT1 A 1 A_Lower
		Wait
		
	Select:
		CHLN A 0
		CHLN AAA 1 A_Raise
		TNT1 A 0 A_TakeInventory("ChinaLake", 1)
		TNT1 AAAAAAAAA 0 A_Raise
		Goto Ready3
	
    Fire:
        CHLN A 0 A_JumpIfInventory("ChinaLakeAmmo",1,2)
        Goto NoAmmo
        TNT1 AA 0
		CHLN A 0 A_AlertMonsters
		GLAN A 0 A_FireCustomMissile("RedFlareSpawn",-5,0,0,0)
		CHLA A 0 A_FireBullets (12.0, 5.0, 20, 18, "ShotgunPuff", FBF_NORANDOM)
		CHLA A 0 A_FireBullets (4.0, 2.0, 7, 18, "ShotgunPuff", FBF_NORANDOM)
		TNT1 AAAAAA 0 BRIGHT A_FireCustomMissile("ShotgunParticles", random(-16,16), 0, -1, random(-9,9))
		CHLN A 0 A_PlaySound("weapons/sg", 1)
		RIFF A 0 A_FireCustomMissile("DistantFireSoundShotgun", random(-1,1), 0, 0, 0, 0, random(-1,1))
        CHLN A 0 A_ZoomFactor(0.96)
		CHLN A 0 A_SetPitch(pitch-4.0)
		CHLN A 0 A_Takeinventory("ChinaLakeAmmo",1)
		CHLA C 1 A_FireCustomMissile("SmokeSpawner", random(-0.3,0.3), 0, 0, 0, 0, random(-0.3,0.3))
		CHLN A 0 A_SetPitch(pitch+0.5)
		CHLN A 0 A_ZoomFactor(1.0)
		CHLA DE 1 A_SetPitch(pitch+0.5)
		CHLN AAAA 1 A_SetPitch(pitch+0.5)
		
		CHLN BCD 1
		CHLN D 2
		CHLN A 0 A_FireCustomMissile("ShotCaseSpawn",40,0,-8,-26)
		CHLN A 0 A_PlaySound("weapons/sgpump", 3)
		CHLN EFGHHHH 1
		CHLN A 0 A_JumpIfInventory("Kicking",1,"DoKick")
		CHLN GFED 1
		CHLN D 2
		CHLN CB 1
		Goto Ready3

    Reload:
		CHLN A 1 A_WeaponReady
		CHLN A 0 A_ZoomFactor(1.0)
		CHLN A 0 A_Takeinventory("Reloading",1)
		CHLN A 0 A_Takeinventory("ADSmode",1)
		CHLN A 0 A_Takeinventory("Zoomed",1)
		CHLN A 0 A_JumpIfInventory("ChinaLakeAmmo",4,"Ready3")
        CHLN A 0 A_JumpIfInventory("AmmoGLShell",1,3)
        Goto FinishReloading
        TNT1 AAA 0
		CHLN A 0 A_Takeinventory("Zoomed",1)
		CHLN A 0 A_GiveInventory ("Pumping", 1)
		CHLN A 0 A_Takeinventory("Reloading",1)
		
		CHLN BCD 1
		Goto InsertBullets
		
		
	InsertBullets:
		TNT1 A 0
		TNT1 A 0 A_TakeInventory("FiredPrimary", 1)
		CHLN A 0 A_JumpIfInventory("ChinaLakeAmmo",4,"FinishReloading")
		CHLN A 0 A_JumpIfInventory("AmmoGLShell",1,3)
		Goto FinishReload3
        TNT1 AAAAAA 0
		CHLN A 0 A_JumpIfInventory("Kicking",1,"DoKick")
		CHLR H 10 A_WeaponReady(WRF_NOPRIMARY)
		CHLN A 0 A_JumpIfInventory("Kicking",1,"DoKick")
		CHLN A 0 A_JumpIfInventory("Reloading",1,"FinishReloading")
		CHLN A 0 A_JumpIfInventory("FiredPirmary",1,"FinishReloading")
		CHLR AB 1
		TNT1 A 0 A_PlaySound("insertshell")
		CHLR CDEFGH 1 A_JumpIfInventory("Kicking",1,"DoKick")
		CHLN A 0 A_Giveinventory("ChinaLakeAmmo",1)
		CHLN A 0 A_Takeinventory("AmmoGLShell",1)
		Goto InsertBullets
		
		
	FinishReloading:
		CHLN A 0
		CHLN A 0 A_JumpIfInventory("ShotgunWasEmpty",1,"FinishReloading2")
		TNT1 A 0 A_TakeInventory("Reloading", 1)
		CHLN DCB 1
		CHLN A 0 A_Refire
		Goto Ready3

	FinishReloading2:
		TNT1 A 0
		TNT1 A 0 A_TakeInventory("ShotgunWasEmpty", 1)
		CHLN A 0 A_PlaySound("weapons/sgpump", 3)
		CHLN EFGHHHH 1
		CHLN A 0 A_JumpIfInventory("Kicking",1,"DoKick")
		CHLN GFED 1
		CHLN D 2
		CHLN CB 1
		CHLN A 0 A_Refire
		Goto Ready3
		
		
		
	NoAmmo:
		CHLN A 0
		CHLN A 0 A_ZoomFactor(1.0)
		CHLN A 0 A_Giveinventory("ShotgunWasEmpty",1)
		CHLN A 0 A_Takeinventory("Zoomed",1)
		CHLN A 0 A_Takeinventory("ADSmode",1)
		TNT1 A 0 A_PlaySound("weapons/empty", 4)
	NoAmmo2:
		CHLN A 0 A_JumpIfInventory("TossGrenade",1,"TossGrenade")
        CHLN A 0 A_JumpIfInventory("Reloading",1,"Reload")
		CHLN A 0 A_JumpIfInventory("Kicking",1,"DoKick")
		CHLN A 5 A_WeaponReady(WRF_ALLOWRELOAD | WRF_NOPRIMARY)
		CHLN A 0 A_JumpIfInventory("Reloading",1,"Reload")
		TNT1 A 0 A_JumpIfInventory("NoAutoReload", 1, "NoAmmo2")
		CHLN A 0 A_JumpIfInventory("AmmoGLShell",1,"Reload")
		Goto Ready3

	AltFire:
		TNT1 A 0
		TNT1 A 0 A_JumpIFInventory("AmmoGL", 1, 2)
		Goto CantSwitch
		TNT1 A 0
		TNT1 A 0 A_Print("Switching to 00 Buck Rounds")
		Goto UnloadToSwitch

	CantSwitch:
		CHLN A 3
		TNT1 A 0 A_Print("You don`t have alt ammo.")
		Goto Ready3

	UnloadToSwitch:
		TNT1 A 0
		TNT1 A 0 A_TakeInventory("FiredPrimary", 1)
		CHLN A 0 A_JumpIfInventory("ChinaLakeAmmo",1,2)
		Goto FinishUnloading
		TNT1 A 0
		CHLN A 0 A_Takeinventory("ChinaLakeAmmo",1)
		CHLN A 0 A_Giveinventory("AmmoGLShell",1)
		CHLN A 1
		Loop
		
		
	FinishUnloading:
		CHLN A 0
		TNT1 A 0 A_GiveInventory("ChinaLake", 1)
		TNT1 A 0 A_SelectWeapon("ChinaLake")
		Goto Ready3
	}
}