ACTOR SKS : BrutalWeapon
{
	Weapon.AmmoUse1 0
	Weapon.AmmoGive1 0
	Weapon.AmmoUse2 0
	Weapon.AmmoGive2 0
	YScale 0.6
	XScale 0.8
	Weapon.SelectionOrder 2500
	Weapon.AmmoType1 "762"
	Weapon.AmmoType2 "SKSAmmo"
	Obituary "%o was shot down by %k's assault M14."
    AttackSound "None"
    Inventory.PickupSound "CLIPIN"
	Inventory.Pickupmessage "$GOTM14"
    +WEAPON.NOALERT
	+WEAPON.NOAUTOFIRE
	+FORCEXYBILLBOARD
	Tag "SKS Rifle"
    Scale 0.8
	States
	{
 	Spawn:
		WM14 A 1
		TNT1 A 0 A_SpawnItemEx("SKSWeapon", 0, 0, 0, momx, momy, momz)
		Stop
	
	Ready:
	Ready3:
		SKSG A 1 A_WeaponReady(WRF_ALLOWRELOAD)
		SKSG A 0 A_JumpIfInventory("TossGrenade",1,"TossGrenade")
        SKSG A 0 A_JumpIfInventory("Reloading",1,"Reload")
		SKSG A 0 A_JumpIfInventory("Kicking",1,"DoKick")
		"----" # 0 A_JumpIfInventory("UsedBandage", 1, "UseBandages")
		Loop
	
		
	Deselect:
		SKSG A 0
		SKSG A 0 A_TakeInventory("TossGrenade", 1)
        SKSG A 0 A_TakeInventory("Reloading",1)
		SKSG A 0 A_TakeInventory("Unloading",1)
        SKSG A 0 A_ZoomFactor(1.0)
		SKSG AAAAA 1 A_Lower
		TNT1 AAAAAAAAAAAAAAAAAA 0 A_Lower
		TNT1 A 1 A_Lower
		Wait

	
	Select:
		SKSG A 0
		SKSG AAAAA 1 A_Raise
		TNT1 AAAAAAAAA 0 A_Raise
		Goto Ready3
	
    Fire:
        SKSG A 0 A_JumpIfInventory("SKSAmmo",1,2)
        Goto NoAmmo
        TNT1 AA 0
		SKSG A 0 A_AlertMonsters
		SKSG A 0 A_PlaySound("M14FIRE", 1)
		SMGG A 0 A_PlaySound("FARAKM", 6)

		SKSF A 1 BRIGHT A_FireBullets (0.25, 0.25, 1, 22, "M14Puff", FBF_NORANDOM)
		SKSF B 1 A_FireCustomMissile("SmokeSpawner", random(-0.3,0.3), 0, 0, 0, 0, random(-0.3,0.3))
		SKSG A 0 A_SpawnItemEx("PlayerMuzzle1",30,5,30)
        SKSF A 0 A_FireCustomMissile("m14Tracer", 0, 0, 0, 0, 0, 0)
		SKSG A 0 A_ZoomFactor(0.98)
		SKSG A 0 A_SetPitch(pitch-2.0)
		SKSG A 0 A_SetANgle(angle-1.0)
		SKSG A 0 A_Takeinventory("SKSAmmo",1)
		SKSF C 1 A_FireCustomMissile("RifleCaseSpawn",5,0,6,-14)
		SKSG A 0 A_ZoomFactor(1.0)
		SKSG A 0 A_SetPitch(pitch+0.4)
		SKSG A 0 A_SetANgle(angle+0.2)
		SKSG A 1 A_WeaponReady
		SKSG A 0 A_SetPitch(pitch+0.4)
		SKSG A 0 A_SetANgle(angle+0.2)
		SKSG A 1 A_WeaponReady
		SKSG A 0 A_SetPitch(pitch+0.4)
		SKSG A 0 A_SetANgle(angle+0.2)
		SKSG A 1 A_WeaponReady
		SKSG A 0 A_SetPitch(pitch+0.4)
		SKSG A 0 A_SetANgle(angle+0.1)
		SKSG A 1 A_WeaponReady
		SKSG A 0 A_SetPitch(pitch+0.2)
		SKSG A 0 A_SetANgle(angle+0.1)
		SKSG A 1 A_WeaponReady
		SKSG A 1 A_WeaponReady
		SKSG A 0 A_Refire
		Goto Ready3
		
   
	NoAmmo:
		SKSG A 0
		SKSG A 0 A_ZoomFactor(1.0)
		SKSG A 0 A_Takeinventory("Zoomed",1)
		SKSG A 0 A_Takeinventory("ADSmode",1)
		TNT1 A 0 A_PlaySound("weapons/empty", 4)
	NoAmmo2:
		SKSG A 0 A_JumpIfInventory("TossGrenade",1,"TossGrenade")
        SKSG A 0 A_JumpIfInventory("Reloading",1,"Reload")
		SKSG A 0 A_JumpIfInventory("Kicking",1,"DoKick")
		SKSG A 5 A_WeaponReady(WRF_ALLOWRELOAD | WRF_NOPRIMARY)
		SKSG A 0 A_JumpIfInventory("Reloading",1,"Reload")
		TNT1 A 0 A_JumpIfInventory("NoAutoReload", 1, "NoAmmo2")
		SKSG A 0 A_JumpIfInventory("762",1,"Reload")
		Goto Ready3
	
    Reload:
		SKSG A 1 A_WeaponReady
		SKSG A 0 A_ZoomFactor(1.0)
		SKSG A 0 A_Takeinventory("Reloading",1)
		SKSG A 0 A_Takeinventory("ADSmode",1)
		SKSG A 0 A_Takeinventory("Zoomed",1)
		SKSG A 0 A_JumpIfInventory("SKSAmmo",21,76)
        SKSG A 0 A_JumpIfInventory("762",1,3)
        Goto FinishReloading
        TNT1 AAA 0
		SKSG A 0 A_Takeinventory("Zoomed",1)
		SKSG A 0 A_GiveInventory ("Pumping", 1)
		SKSG A 0 A_Takeinventory("Reloading",1)
		
		SKSG A 0
        SKSR ABCDDDD 1  A_JumpIfInventory("Kicking",1,"DoKick")
		TNT1 A 0 A_PLaySound("RELO1", 3)
		SKSR EFGGGGHI 1
		SKSR J 10
        SKSR KLMNNN 1
		SKSR OPQ 1
		SKSR Q 5
		TNT1 A 0 A_PLaySound("RELO2", 4)
		SKSR RSTUVWX 1
		SKSR X 5
		SKSR YG 1
		TNT1 A 0 A_PLaySound("RELO4", 3)
		SKSR GGGFEDDDDDCBA 1
		SKSG A 0 A_JumpIfInventory("SKSAmmo",1,"InsertBullets2")
		Goto InsertBullets
		
		
	InsertBullets:
		TNT1 AAAA 0
		SKSG A 0 A_JumpIfInventory("SKSAmmo",10,15)
		SKSG A 0 A_JumpIfInventory("762",1,3)
		Goto FinishReload3
        TNT1 AAAAAA 0
		SKSG A 0 A_Giveinventory("SKSAmmo",1)
		SKSG A 0 A_Giveinventory("DoubleSKSAmmo",1)
		SKSG A 0 A_Takeinventory("762",1)
		Goto InsertBullets
		
		TNT1 AAAAAAAAAA 0
		SKSG A 0 A_Takeinventory("Reloading",1)
        Goto FinishReload3	
		TNT1 AAAA 0
		SKSG A 0 A_Takeinventory("Reloading",1)
        Goto FinishReload3	
		
	InsertBullets2:
		TNT1 AAAA 0
		SKSG A 0 A_JumpIfInventory("SKSAmmo",10,15)
		SKSG A 0 A_JumpIfInventory("762",1,3)
		Goto FinishReload2	
        TNT1 AAAAAA 0
		SKSG A 0 A_Giveinventory("SKSAmmo",1)
		SKSG A 0 A_Giveinventory("DoubleSKSAmmo",1)
		SKSG A 0 A_Takeinventory("762",1)
		Goto InsertBullets2
		
		TNT1 AAAAAAAAAA 0
		SKSG A 0 A_Takeinventory("Reloading",1)
        Goto FinishReload2	
		TNT1 AAAA 0
		SKSG A 0 A_Takeinventory("Reloading",1)
        Goto FinishReload2	
		
	FinishReloading:
		SKSG A 0
		SKSG A 0 A_Refire
		Goto Ready3
		
		

		
	FinishReload2:
		SKSG A 1
		SKSR A 0 A_Takeinventory("HasUnloaded",1)
		Goto Ready3
		

	FinishReload3:
		SKSG A 1
		SKSR A 0 A_Takeinventory("HasUnloaded",1)
		Goto Ready3		
		
		
	DoKick:
		SKSM AB 1
		TNT1 A 2
	DoKick2:	
		SKSB ABC 1
		TNT1 A 0 A_PlaySound("KICK")
		KNIF A 0 A_FireCustomMissile("KnifeAttack2", 0, 0, 0, 0, 0, 0)
		KNIF A 0 A_ZoomFactor(0.97)
		TNT1 A 0 A_TakeInventory("Kicking", 1)
		M72G A 0 A_ZoomFactor(1.0)
		SKSB D 6
		SKSB CBA 1
		SHTN A 0 A_JumpIfInventory("Kicking",1,"DoKick2")
		TNT1 A 2
		SHTN A 0 A_JumpIfInventory("Kicking",1,"DoKick2")
		SKSM BA 1
		TNT1 A 0 A_TakeInventory("Kicking", 1)
		Goto Ready3	
	
	}
}

ACTOR SKSAmmo : Ammo
{
   Inventory.Amount 0
   Inventory.MaxAmount 10
   Ammo.BackpackAmount 0
   Ammo.BackpackMaxAmount 10
   Inventory.Icon "WM14A0"
}