Actor SniperRifle : Weapon
{
Tag "Sniper Rifle"
Weapon.AmmoUse 1
Weapon.AmmoGive 15
Weapon.AmmoGive2 90
Weapon.AmmoType "SniperRifleAmmo"
Weapon.AmmoType2 "BulletMag"
Weapon.PreferredSkin "Sniper-Marine"
Weapon.UpSound "sniper/up"
Inventory.PickupMessage "You got the Sniper Rifle."
Inventory.PickupSound "items/assaultrifle"
Obituary "%o was sniped by %k."
AttackSound "sniper/fire2"
Decal "BulletChip"
-WEAPON.AMMO_CHECKBOTH
+WEAPON.AMMO_OPTIONAL
+WEAPON.ALT_AMMO_OPTIONAL
+NOALERT
+INVENTORY.UNDROPPABLE
Scale 0.6
States
{
  Ready:
     TNT1 A 0 A_SetCrosshair(0)
  	 TNT1 A 0 A_JumpIfInventory("HandGrenadeAction",1,"GrenadeCheck")
	 TNT1 A 0 A_JumpIfInventory("MineAction",1,"MineCheck")
     TNT1 A 0 A_JumpIfInventory("RailgunAction",1,"Zoom")
	 TNT1 A 0 A_JumpIfInventory("InZoom",1,"Ready2")
	 TNT1 A 0 A_ZoomFactor(1.0)
     SNP3 A 1 A_WeaponReady
     Loop
  Ready2:
     TNT1 A 0 A_SetCrosshair(11)
     TNT1 A 0 A_TakeInventory("HandGrenadeAction")
	 TNT1 A 0 A_TakeInventory("MineAction",1)
     TNT1 A 0 A_JumpIfInventory("RailgunAction",1,"Zoom")
     SNP3 F 0 A_ZoomFactor(3.5)
     SNP3 F 1 A_WeaponReady
     Goto Ready2+1
  Deselect:
     TNT1 A 0 A_SetCrosshair(0)
   	 TNT1 A 0 A_TakeInventory("InZoom",1)
	 TNT1 A 0 A_TakeInventory("RailgunAction",1)
	 TNT1 A 0 A_ZoomFactor(1.0)
	 TNT1 A 0 A_PlayWeaponSound("weapons/weapondown")
	 TNT1 A 0 A_Lower
     SNP3 A 1 A_Lower
     Goto Deselect+5
  Select:
     TNT1 A 0 A_SetCrosshair(0)
	 TNT1 A 0 A_Raise
     SNP3 A 1 A_Raise
     Goto Select+1
  Fire:
	 TNT1 A 0 A_JumpIfNoAmmo("Empty")
     TNT1 A 0 A_JumpIfInventory("SniperRifleAmmo",1,1)
     Goto Empty
	 TNT1 A 0 A_AlertMonsters
	 TNT1 A 0 A_JumpIfInventory("InZoom",1,"Fire2")
	 SNP3 B 0 A_SpawnItemEx("RifleCasing",30,3,25,Random(2,4),Random(3,6),Random(3,6),0)
	 TNT1 A 0 A_Recoil(0.48)
     SNP3 B 4 Bright A_FireBullets(3,3,-1,125,"SniperBulletPuff")
     SNP3 B 0 A_GunFlash
	 SNP3 A 1 Offset(0,40)
	 SNP3 A 1 Offset(0,44)
	 SNP3 A 1 Offset(0,48)
	 SNP3 A 1 Offset(0,52)
	 SNP3 A 1 Offset(0,56)
	 SNP3 A 17 Offset(0,60)
	 SNP3 A 1 Offset(0,56)
	 SNP3 A 1 Offset(0,52)
	 SNP3 A 1 Offset(0,48)
	 SNP3 A 1 Offset(0,44)
	 SNP3 A 1 Offset(0,40)
     Goto Ready
  Fire2:
	 SNP3 F 0 A_SpawnItemEx("RifleCasing",30,3,25,Random(2,4),Random(3,6),Random(3,6),0)
	 TNT1 A 0 A_Recoil(1)
	 TNT1 A 0 Radius_Quake(8,8,0,1,0)
	 SNP3 F 1 Bright A_FireBullets(1,1,1,125,"SniperBulletPuff")
     SNP3 F 0 A_GunFlash
	 SNP3 FF 1 A_SetPitch(pitch-1,SPF_INTERPOLATE)
     SNP3 F 23
     Goto Ready
  Flash:
     TNT1 A 1 Bright A_Light1
     Goto LightDone
     TNT1 A 1 Bright A_Light1
     Goto LightDone
  AltFire:
     TNT1 A 0 A_JumpIfInventory("SniperRifleAmmo",15,"Empty")
	 Goto Loading
  Empty:
     SNP3 A 15 A_PlaySound("weapons/click")
  Loading:
     TNT1 A 0 A_TakeInventory("InZoom",1)
	 TNT1 A 0 A_ZoomFactor(1)
     TNT1 A 0 A_JumpIfInventory("SniperRifleAmmo",15,2)
     TNT1 A 0 A_JumpIfInventory("BulletMag",5,2)
	 TNT1 A 0
	 Goto Ready
	 TNT1 A 0 A_TakeInventory("InZoom",1)
	 TNT1 A 0 A_ZoomFactor(1)
	 TNT1 A 0 A_SetCrosshair(0)
	 SNP3 IJK 2
	 SNP3 L 20 A_FireCustomMissile("AREmptyMagSpawner", 0, 0, 0, 1)
	 SNP3 MNOPQR 2
	 SNP3 R 2 A_PlayWeaponSound("weapons/arreload")
	 TNT1 A 0 A_JumpIfInventory("BulletMag",5,"Reload")
  LoadingDone:
	 SNP3 LKJI 2
	 Goto Ready
  Reload:
     TNT1 A 0 A_TakeInventory("BulletMag",1)
	 TNT1 A 0 A_GiveInventory("SniperRifleAmmo",1)
	 TNT1 A 0 A_JumpIfInventory("SniperRifleAmmo",15,"Full")
	 TNT1 A 0 A_JumpIfInventory("BulletMag",1,"Reload")
	 Goto LoadingDone
  Full:
	 SNP3 STUVWXYZ 2
	 SNP3 Y 0 A_PlayWeaponSound("weapons/arclick")
	 SNP3 YXWVUTS 3
	 SNP3 LKJI 2 //SNP3 LKJI 2
	 Goto Ready
  Zoom:
     SNP3 C 0
	 SNP3 C 0 A_TakeInventory("RailgunAction",1)
     SNP3 C 0 A_JumpIfInventory("InZoom",1,5)
     SNP3 C 0 A_GiveInventory("InZoom",1)
	 SNP3 CDE 4
     Goto Ready
     SNP3 E 0 A_TakeInventory("InZoom",1)
	 SNP3 EDC 4
     Goto Ready
  GrenadeCheck:
     TNT1 A 0
	 TNT1 A 0 A_TakeInventory("InZoom",1)
	 TNT1 A 0 A_ZoomFactor(1)
	 TNT1 A 0 A_JumpIfInventory("HandGrenadeAmmo",1,"GrenadeToss")
	 TNT1 A 0 A_TakeInventory("HandGrenadeAction",1)
	 Goto Ready
  GrenadeToss:
  	 TNT1 A 0 A_PlayWeaponSound("weapons/weapondown")
	 SNP3 A 1 Offset(0,30)
	 SNP3 A 1 Offset(0,40)
	 SNP3 A 1 Offset(0,50)
	 SNP3 A 1 Offset(0,60)
	 SNP3 A 1 Offset(0,70)
	 TNT1 A 4 Offset(0,32)
	HGRN ABCDEFGHI 1
	TNT1 A 0 A_PlayWeaponSound("weapons/hgrenadepin")
	HGRN JKLM 2
	TNT1 A 11
	TNT1 A 0 A_PlayWeaponSound("weapons/hgrenadethrow")
	TNT1 A 0 A_TakeInventory("HandGrenadeAmmo",1,TIF_NOTAKEINFINITE)
	HGRN N 1 A_FireCustomMissile("ThrownGrenade",0,0,0,0)
	HGRN OPQRS 1
	HGRN TU 2
	 TNT1 A 6 A_TakeInventory("HandGrenadeAction",1)
	 SNP3 A 1 Offset(0,70)
	 SNP3 A 1 Offset(0,60)
	 SNP3 A 1 Offset(0,50)
	 SNP3 A 1 Offset(0,40)
	 SNP3 A 1 Offset(0,30)
	Goto Ready
  MineCheck:
     TNT1 A 0
	 TNT1 A 0 A_TakeInventory("InZoom",1)
	 TNT1 A 0 A_ZoomFactor(1)
	 TNT1 A 0 A_JumpIfInventory("MineAmmo",1,"MineToss")
	 TNT1 A 0 A_TakeInventory("MineAction",1)
	 Goto Ready
  MineToss:
  	 TNT1 A 0 A_PlayWeaponSound("weapons/weapondown")
	 SNP3 A 1 Offset(0,30)
	 SNP3 A 1 Offset(0,40)
	 SNP3 A 1 Offset(0,50)
	 SNP3 A 1 Offset(0,60)
	 SNP3 A 1 Offset(0,70)
	 TNT1 A 8 Offset(0,32)
	TNT1 A 0 A_PlayWeaponSound("weapons/hgrenadethrow")
	MINE ABCDEF 1
	TNT1 A 0 A_TakeInventory("MineAmmo",1,TIF_NOTAKEINFINITE)
	MINE G 1 A_FireCustomMissile("ThrownMine",0,0,0,0,false)
	MINE HI 1
	MINE JKLM 1
	TNT1 A 5 A_TakeInventory("MineAction",1)
	 SNP3 A 1 Offset(0,70)
	 SNP3 A 1 Offset(0,60)
	 SNP3 A 1 Offset(0,50)
	 SNP3 A 1 Offset(0,40)
	 SNP3 A 1 Offset(0,30)
	 Goto Ready
   Spawn:
     SNP2 Z -1
     Stop
   }
}

Actor SniperBulletPuff : ModdedBulletPuff
{
DamageType "Marine"
+MTHRUSPECIES
+NOEXTREMEDEATH
}

ACTOR SniperRifleAmmo : Ammo
{
   Inventory.Amount 0
   Inventory.MaxAmount 15
   Ammo.BackpackAmount 0
   Ammo.BackpackMaxAmount 15
   Inventory.Icon "SNP2Z0"
}

ACTOR InZoom : Inventory{Inventory.MaxAmount 1}