ACTOR ZedPrimary : Ammo
{
  Inventory.Amount 1
  Inventory.MaxAmount 14
  Inventory.Icon "CLIPA0"
  +INVENTORY.IGNORESKILL
}

ACTOR "Zed's Lobotomizer Thermal" : Inventory
{
	Inventory.MaxAmount 1
}

ACTOR ZedThermalHUD : Inventory
{
	Inventory.MaxAmount 1
}

ACTOR PowerNightVisiony : PowerLightAmp
{
	Powerup.Duration 1
}

ACTOR PowerNightVision : CustomInventory
{
  -COUNTITEM
  +INVENTORY.ALWAYSPICKUP
  States
  {
  Spawn:
    TNT1 A -1
    Stop
  Pickup:
    TNT1 A 0 A_GiveInventory("PowerLightAmp")
    Stop
  }
}

ACTOR SniperZoom : Inventory
{
	Inventory.MaxAmount 2
}

ACTOR ZedSecondary : Ammo
{
  Inventory.PickupMessage "You picked up a drum of PPSH-41 ammunition." // "Picked up a clip."
  Inventory.PickupSound "bullpup/magin"
  Inventory.Amount 70
  Inventory.MaxAmount 420
  Ammo.BackpackAmount 70
  Ammo.BackpackMaxAmount 420
  Inventory.Icon "CLIPA0"
  +INVENTORY.IGNORESKILL
  States
  {
  Spawn:
    CLIP A -1
    Stop
  }
}

ACTOR "Zed's Lobotomizer" : Weapon 11508
{
  Weapon.AmmoUse 0
  Weapon.AmmoGive2 14
  Weapon.AmmoType "ZedPrimary"
  Weapon.AmmoType2 "ZedSecondary"
  Obituary "\cJ%k \cG> \cTZed's Lobotmizer \cG> \cJ%o"
  Inventory.Pickupmessage "You picked up \cKZed's Lobotomizer."
  Inventory.PickupSound "zed/magin"
	//$Category ZT2 - Weapons
	//$Title Zed's Lobotomizer
	//$Sprite SNPRI0
  Tag "Zed's Lobotomizer"
  +WEAPON.NOAUTOFIRE
  States
  {
  Ready:
	PPSS A 0 A_PlaySoundEx("zed/select","SoundSlot6")
	SNSS ABCD 1
	PNSS A 0 A_JumpIfInventory("SniperZoom",1,"ReadyIS")
	PPSS A 0 A_JumpIfInventory("DoBlocking",1,"QuickMelee")
	PPSS A 0 //A_JumpIfInventory("QuickGrenading",1,"ToGrenade")
	PPSS A 0 A_JumpIfInventory("IsReloading",1,"ReloadCheck")
    SNID A 1 A_WeaponReady
    Goto Ready+5
  ToGrenade:
	PPSS A 0 A_SelectWeapon("Type-97 Grenade")
	Goto Deselect
  ReadyIS:
    PPSS A 0 A_JumpIfInventory("DoBlocking",1,"QuickMelee")
	PPSS A 0 A_JumpIfInventory("IsReloading",1,"ReloadCheck")
    LDHR S 1 bright A_WeaponReady(1)
    Loop
  QuickMelee:
	PPBL A 1
	PPBL B 0 A_PlaySoundEx("fist/swing","Weapon")
	PPBL BC 1
	PPBL D 0 A_CustomPunch (random(4,5),1,0,"BlockPuff")
	PPBL D 2
	PPBL E 4
	PPBL DCBA 2
	PPBL A 0 A_TakeInventory("DoBlocking",1)
	Goto Ready+5
  ToReady:
	NULL A 0
	Goto Ready+5
	NULL AAA 0
	NULL A 0 A_PlaySoundEx("dryfire/smg","SoundSlot6")
	Goto Ready+5
  Deselect:
	 SNSS A 0 A_ZoomFactor(1.0)
	 SNSS A 0 A_TakeInventory("SniperZoom",2)
	 TNT1 A 0 A_TakeInventory("PowerLightAmp",1)
	 TNT1 A 0 A_TakeInventory("ZedThermalHUD",1)
	 SNSS DCBA 1
     TNT1 AAAAAAAAAA 0 A_Lower
	 TNT1 A 1 A_Lower
     Goto Deselect+8
  Select:
	 TNT1 A 0 A_SetCrosshair(14)
	 TNT1 A 0 A_JumpIfInventory("Zed's Lobotomizer Thermal",1,"SelectThermal")
     TNT1 A 0 A_Raise
     Wait
  SelectThermal:
	 TNT1 A 0 A_GiveInventory("ZedThermalHUD",1)
     TNT1 A 0 A_Raise
     Wait
  //==============================================================
  // AMMO CHECK
  //==============================================================
  ReloadCheck:
	 TNT1 A 0 A_TakeInventory("IsReloading",1)
	 TNT1 A 0 A_JumpIfInventory("Perk_Rifleman",1,"RCP")
	 TNT1 A 0 A_JumpIfInventory("ZedPrimary",7,"ToReady")
	 TNT1 A 0 A_JumpIfInventory("ZedSecondary",1,"ReloadAnim")
	 Goto ToReady
  RCP:
	 TNT1 A 0 A_JumpIfInventory("PerkLevel",10,"RCP10")
	 TNT1 A 0 A_JumpIfInventory("ZedPrimary",10,"ToReady")
	 TNT1 A 0 A_JumpIfInventory("ZedSecondary",1,"ReloadAnim")
	 Goto ToReady
  RCP10:
	 TNT1 A 0 A_JumpIfInventory("ZedPrimary",14,"ToReady")
	 TNT1 A 0 A_JumpIfInventory("ZedSecondary",1,"ReloadAnim")
	 Goto ToReady
  //==============================================================
  IronToReload:
	 TNT1 A 0 A_TakeInventory("SniperZoom",2)
	 TNT1 A 0 A_ZoomFactor(1.0)
	 TNT1 A 0 A_TakeInventory("PowerLightAmp",1)
	 SNID A 2 A_WeaponReady(WRF_NOPRIMARY | WRF_NOSECONDARY)
	 Goto ReloadAnim+1
  ReloadAnim:
     9MRL A 0 ACS_ExecuteAlways(820,0,0,0,0)
	 SNRL A 0 A_JumpIfInventory("SniperZoom",1,"IronToReload")
	 SNRL ABC 2
	 SNRL D 5
	 SNRL D 0 A_PlaySoundEx("zed/magout","SoundSlot6")
	 SNRL D 1
	 SNRL EF 2
	 SNRL G 17
	 SNRL HIJ 1
	 SNRL D 0 A_PlaySoundEx("zed/magin","SoundSlot6")
	 SNRL K 3
	 SNRL L 2
	 SNRL D 2
	 SNRL CBA 2
	 TNT1 A 0 A_TakeInventory("IsReloading",1)
	 Goto CalculateAmmo
  //==============================================================
  // CALCULATE AMMO
  //==============================================================
  CalculateAmmo:
     TNT1 A 0 A_JumpIfInventory("Perk_Rifleman",1,"CalculateAmmoPerk")
     TNT1 A 0 A_JumpIfInventory("ZedSecondary",1,2)
	 Goto Ready+5
	 TNT1 AAA 0
	 TNT1 A 0 A_JumpIfInventory("ZedPrimary",7,"ToReady")
	 TNT1 A 0 A_TakeInventory("ZedSecondary",1)
	 TNT1 A 0 A_GiveInventory("ZedPrimary",1)
	 Loop
  CalculateAmmoPerk:
     TNT1 A 0 A_JumpIfInventory("PerkLevel",10,"CalculateAmmoPerk10")
     TNT1 A 0 A_JumpIfInventory("ZedSecondary",1,2)
	 Goto Ready+5
	 TNT1 AAA 0
	 TNT1 A 0 A_JumpIfInventory("ZedPrimary",10,"ToReady")
	 TNT1 A 0 A_TakeInventory("ZedSecondary",1)
	 TNT1 A 0 A_GiveInventory("ZedPrimary",1)
	 Loop
  CalculateAmmoPerk10:
     TNT1 A 0 A_JumpIfInventory("ZedSecondary",1,2)
	 Goto Ready+5
	 TNT1 AAA 0
	 TNT1 A 0 A_JumpIfInventory("ZedPrimary",14,"ToReady")
	 TNT1 A 0 A_TakeInventory("ZedSecondary",1)
	 TNT1 A 0 A_GiveInventory("ZedPrimary",1)
	 Loop
  //==============================================================
  Fire:
	 PPFI A 0 A_JumpIfInventory("ZedPrimary",1,1)
	 Goto ToReady+2
	 PPFI A 0 A_TakeInventory("ZedPrimary",1)
	 PPFI A 0 A_FireBullets (0.0, 0.0, 1, 30, "BulletPuff2", 4)
	 BPSS A 0 A_JumpIfInventory("SniperZoom",1,"FireIS")
	 BPSS A 0 A_FireCustomMissile("LongRifleCaseSpawn",5,0,16,-3)
	 PPFI A 0 A_PlaySound("zed/fire", CHAN_WEAPON)
	 TNT1 A 0 A_SpawnItemEx("ShooterLight",0,0,0)
	 PPFI A 0 A_SetPitch(pitch+1)
	 SNFI A 1 bright
	 PPFI A 0 A_SetPitch(pitch-1)
	 SNFI BC 1 A_WeaponReady(1)
	 Goto Ready+5
  FireIS:
     SNFI A 0
	 BPSS A 0 A_FireCustomMissile("LongRifleCaseSpawn",5,0,16,-3)
	 PPFI A 0 A_PlaySound("zed/fire", CHAN_WEAPON)
	 TNT1 A 0 A_SpawnItemEx("ShooterLight",0,0,0)
	 PPFI A 0 A_SetPitch(pitch+0.2)
	 LDHR S 1 bright
	 PPFI A 0 A_SetPitch(pitch-0.2)
	 LDHR SS 1 bright A_WeaponReady(1)
	 Goto ReadyIS
  AltFire:
     SNFI A 0 A_JumpIfInventory("SniperZoom",2,"ZoomOut")
	 SNFI A 0 A_JumpIfInventory("SniperZoom",1,"ZoomIn2")
	 Goto ZoomIn1
  ZoomIn1:
	 TNT1 A 0 ACS_ExecuteAlways(82,0,0,0,0)
	 LHDR S 0 A_GiveInventory("SniperZoom",1)
	 LDHR S 0 A_ZoomFactor(3.0)
	 LDHR S 1 bright
	 LDHR S 0 A_JumpIfInventory("Zed's Lobotomizer Thermal",1,"TurnNVOn")
	 Goto ReadyIS
  ZoomIn2:
     LHDR S 0 A_GiveInventory("SniperZoom",1)
	 LDHR S 0 A_ZoomFactor(5.0)
	 LDHR S 1 bright
	 Goto ReadyIS
  TurnNVOn:
	 TNT1 A 0 A_GiveInventory("PowerNightVision",1)
	 Goto ReadyIS
  TurnNVOff:
	 TNT1 A 0 A_TakeInventory("PowerLightAmp",1)
	 Goto ZoomOut+1
  ZoomOut:
	 LDHR S 0 A_JumpIfInventory("Zed's Lobotomizer Thermal",1,"TurnNVOff")
	 TNT1 A 0 ACS_ExecuteAlways(82,0,14,0,0)
     LHDR S 0 A_TakeInventory("SniperZoom",2)
	 LDHR S 0 A_ZoomFactor(1.0)
	 LDHR S 1 bright
	 Goto Ready+5
  Spawn:
    SNPR I -1
    Stop
  }
}