//PULSE RIFLE

actor PulseRifle : Weapon replaces Chaingun 
{
   Game Doom
   Weapon.SelectionOrder 700
   Weapon.SlotNumber 2
   Weapon.SlotPriority 1
   Weapon.AmmoUse1 1
   Weapon.AmmoUse2 1
   Weapon.AmmoGive1 95
   Weapon.AmmoGive2 60
   Decal BulletChip
   Weapon.BobSpeed 2.5
   Weapon.BobRangeY 0.3
   Weapon.BobRangeX 0.0
   +Weapon.Ammo_Optional
   +WEAPON.ALT_AMMO_OPTIONAL
   +WEAPON.NOAUTOAIM
   scale 0.20
   Weapon.AmmoType1 "PulseLoaded"
   Weapon.AmmoType2 "PulseRifleClip"
   Inventory.Pickupsound  "misc/Pulse_PickUp"
   weapon.upsound "PULSEUP"
   Inventory.PickupMessage "You got the Pulse Rifle!"
   Obituary "$o got blasted by %k's Pulse Rifle"
   States
   {
   Ready:
     TNT1 A 0 A_JumpifInventory("NormalStance", 1, "RealReady")	 
     Loop
   RealReady:
     TNT1 A 0 Bright A_ZoomFactor(1.0)
	 TNT1 A 0 A_SetCrosshair(0)
     PULS A 1 A_WeaponReady(WRF_ALLOWRELOAD)	 
     Goto Ready
   Deselect:
     TNT1 A 0 Bright A_ZoomFactor(1.0)
	 TNT1 A 0 A_SetCrosshair(0)
	 TNT1 A 0 A_TakeInventory("NormalStance", 1)
     PULS A 1 A_Lower
	 TNT1 B 0 A_StopSound(1)
     Loop
   Select:
     TNT1 A 0 A_GiveInventory("NormalStance", 1)
     PULS A 1 A_Raise
     Loop
   Dryfire:
	 PULS A 15 A_PlayWeaponSound("DRYFIRE")
	 Goto Reload
     Goto Reload
   Fire:
     TNT1 A 0 A_JumpIfnoAmmo("Dryfire")
     TNT1 A 0 A_playsound("PULSFIRE")
     TNT1 A 0 A_AlertMonsters
     PULS B 1 bright A_FireBullets(1, 1, -1, 12, "CustomPuff1")
     PULS B 1 Bright A_FireBullets(1, 1, -1, 12, "CustomPuff1")
     PULS C 1 bright A_FireBullets(1, 1, -1, 12, "CustomPuff1")
     PULS A 1 Bright
     TNT1 A 0 A_SetPitch(-0.5 + pitch)
	 //PULS A 1 Bright A_Light2
	 PULS B 1 Bright A_Light(3)
	 PULS A 0 A_GunFlash
     TNT1 B 0 A_ReFire
	 TNT1 B 0 A_StopSound(1)
     Goto Ready
	 Reload:
     PULS f 0 A_JumpIfInventory("PulseLoaded", 95, 2)
     PULS f 0 A_JumpIfInventory("PulseRifleClip", 1, "ReloadWork")
     PULS f 0
     Goto Ready
	 ReloadWork:
	 TNT1 A 0 Bright A_ZoomFactor(1.0)
	 PULS f 0 A_PlayWeaponSound("PULSCLIP")
         PULS f 0 A_FireCustomMissile("EmptyClipSpawn",-5,0,8,-4)
     PULS f 0
	  ReloadLoop:
     TNT1 A 0 A_TakeInventory("PulseRifleClip", 1)
     TNT1 A 0 A_GiveInventory("PulseLoaded", 1)
     TNT1 A 0 A_JumpIfInventory("PulseLoaded", 95, "ReloadFinish")
     TNT1 A 0 A_JumpIfInventory("PulseRifleClip", 1, "ReloadLoop")
     Goto ReloadFinish
     ReloadFinish:             
     PULS F 3 A_ResetReloadCounter
     PULS G 3 
     PULS H 5
     PULS F 3         
     PULS A 1
     Goto Ready 
    AltFire:
	 TNT1 A 0 A_JumpIfInventory("GrenadeAmmo", 1, "GrenadeFire")
	 PULS A 15 A_PlayWeaponSound("DRYFIRE")
	 Goto Ready
	GrenadeFire:
	 TNT1 A 0 A_TakeInventory("GrenadeAmmo", 1)
     PULS B 4 A_PlayWeaponSound("GRENFIRE")
     TNT1 A 0 A_AlertMonsters
	 PULS A 10 A_FireCustomMissile ("PulseGrenade", 2,0,2,-10)
    PULS A 0 
    PULS E 3 A_playsound("pulsrel3")
    PULS H 3
    PULS E 3    
    PULS E 0 A_ReFire
    goto ready
   Flash:
     TNT1 A 0 Bright A_Light1
     TNT1 B 0 Bright A_Light2
     Goto LightDone
   Spawn:
     PLSP A -1
     Stop
   }
}

Actor PulseRifleBullet : StandartBullet { Damage 3 DeathSound "9MMRIC" }

ACTOR PulseLoaded : Ammo
{
 Inventory.MaxAmount 95
 +IGNORESKILL
 Inventory.icon "ICO1A0"
}

ACTOR PulseRifleClip : Ammo
{
  +IGNORESKILL
  Scale 0.2
  Inventory.PickupMessage "Got some Pulse Rifle Ammo"
  Inventory.PickupSound "misc/Pulse_PickUp"
  Inventory.Amount 99
  Inventory.MaxAmount 500
  Ammo.BackpackAmount 99
  Ammo.BackpackMaxAmount 999
  Inventory.Icon "CLIPA0"
  States
  {
  Spawn:
    CLIP A -1
    Stop
  }
}

actor PulseRifleAmmoBox : custominventory replaces clipbox
{ 
  inventory.pickupmessage "You've got some Pulse Rifle ammo."
  Inventory.PickupSound "misc/Pulse_PickUp"
  +COUNTITEM
  scale 0.2
  states
  {
  Spawn:
    PAMO A -1
    stop
  Pickup:
	TNT1 A 0 A_GiveInventory ("PulseRifleClip", 180)
    stop
  }
}

ACTOR grenadeammo : Ammo 
{
  +IGNORESKILL
  scale 0.2
  Inventory.PickupMessage "Picked up a Grenade."
  Inventory.PickupSound "misc/Grenade_PickUp"
  Inventory.Amount 1
  Inventory.MaxAmount 50
  Ammo.BackpackAmount 1
  Ammo.BackpackMaxAmount 100
  Inventory.Icon "ROCKA0"
  States
  {
  Spawn:
    NADE A -1
    stop
  }
}

ACTOR grenadeBox : custominventory replaces rocketbox
{
  Inventory.PickupMessage "Picked up a box of grenades."
  Inventory.PickupSound "misc/Grenade_PickUp"
  +COUNTITEM
  scale 0.2
  States
  {
  Spawn:
    BGRN A -1
    Stop
  Pickup:
  TNT1 A 0 A_GiveInventory ("grenadeammo", 5)
  stop
  }
}

Actor PulseGrenade
{
Projectile
+RANDOMIZE
+FORCEXYBILLBOARD
+BLOODSPLATTER 
-NOGRAVITY
+EXTREMEDEATH
damage 50
radius 4
height 4
speed 45
Gravity 0.9
renderstyle Translucent
alpha 1.0
scale 1.0
states
	{
	Spawn:
		MISL A 1 BRIGHT
		Loop
    Death:
	   TNT1 A 0 A_Explode(300,150)
	   EXPL A 0 Radius_Quake (12, 54, 0, 15, 0)
	   TNT1 A 0 A_PlaySound("EXPLO1", 1)
	   TNT1 A 0 A_PlaySound("misc/Grenade_Expl", 2, 100)
	   EXPL AAAAAAAAAAAAAAA 0 A_CustomMissile ("BigSpark", 1, 0, random (0, 360), 2, random (0, 360))
	   EXPL AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 0 A_CustomMissile ("FastSpark", 1, 0, random (0, 360), 2, random (0, 90))
	    EXPL AAAAAA 0 A_CustomMissile ("ExplosionFire", 1, 0, random (0, 360), 2, random (0, 360))
		TNT1 A 10 BRIGHT
       Stop
	}
}

actor NormalStance : Inventory
{
    Inventory.MaxAmount 1
}

actor IsSight : Inventory
{
    Inventory.MaxAmount 1
}