ACTOR PulseRifle : AliensWeapon replaces Chaingun
{
  Weapon.SelectionOrder 60
  Weapon.AmmoUse 0
  Weapon.Ammouse2 0
  Weapon.AmmoType "PulseAmmo"
  Weapon.AmmoType2 "Mag"
  Weapon.SlotNumber 4
  Weapon.Ammogive 0
  weapon.ammogive2 99
  Inventory.PickupMessage "You got the M41A Pulse Rifle!"
  Obituary "%k tore %o apart."
  +WEAPON.AMMO_OPTIONAL
  +weapon.noalert
  +NOAUTOFIRE
  States
  {
  Ready:
	PULS A 0 A_JumpIfInventory("ReloadItem", 1, "Reload")
	PULS A 0 A_JumpIfInventory("KickItem", 1, "PreKick")
	TNT1 A 0 A_JumpIfInventory("TrackerToggle", 1, "PreTrack")
    PULS A 1 A_WeaponReady
    Loop
  Deselect:
	TNT1 A 0 A_StopSound(CHAN_WEAPON)
	PULS A 0 A_Lower
    PULS A 1 A_Lower
    Loop
  Select:
	PULS A 0 A_Raise
    PULS A 1 A_Raise
    Loop
  Fire:
	TNT1 A 0 A_JumpIfInventory("RadarActive", 1, "TrackerLower")
	PULS A 0 A_JumpIfInventory("PulseAmmo",1,1)
    Goto Click
    PULS B 0 A_PlaySound("weapons/pulsefire", CHAN_WEAPON, 1.8, 1)
	TNT1 A 0 A_AlertMonsters
	TNT1 A 0 A_GunFlash("Pulse2")
	TNT1 A 0 A_TakeInventory("PulseAmmo", 1)
	TNT1 AA 0 A_FireCustomMissile("GunSpark",1.5+random(-5.5,5.5),0,0,6,0,1.5+random(-2.8,2.8))
	TNT1 A 0 A_FireCustomMissile("GunSpark2",1.5+random(-5.5,5.5),0,0,6,0,1.5+random(-2.8,2.8))
    PULS B 0 Bright A_FireCustomMissile("PulseTracer", Frandom(-5,5), 1, 0, 0, 0, Frandom(-2,2))
	TNT1 A 0 A_FireBullets(0, 0, 1, 0, "InvisiPuff")
	TNT1 A 0 Radius_Quake(3,2,0,1,0)
    PULS B 1 Bright A_SetPitch (pitch-1.0)
	PULS C 1 Bright A_SetPitch (pitch+0.8)
	PULS D 1 
	TNT1 A 0 A_Refire
	PULS D 1 A_StopSound(CHAN_WEAPON)
	PULS A 1 A_PlaySound ("weapons/pulseend", CHAN_WEAPON)
    Goto Ready
  Pulse2:
	TNT1 AA 0 A_FireCustomMissile("GunSpark",1.5+random(-5.5,5.5),0,0,6,0,1.5+random(-2.8,2.8))
	TNT1 A 0 A_FireCustomMissile("GunSpark2",1.5+random(-5.5,5.5),0,0,6,0,1.5+random(-2.8,2.8))
    TNT1 A 0 Bright A_FireCustomMissile("PulseTracer", Frandom(-5,5), 1, 0, 0, 0, Frandom(-2,2))
	TNT1 A 0 A_FireBullets(0, 0, 1, 0, "InvisiPuff")
	TNT1 A 0 Radius_Quake(3,2,0,1,0)
    TNT1 A 1 Bright A_SetPitch (pitch-1.0)
	TNT1 A 1 Bright A_SetPitch (pitch+0.8)
	goto lightdone
  Click:
	TNT1 A 0 A_StopSound(CHAN_WEAPON)
    PULS A 1 A_PlaySound ("weapons/pulseend", CHAN_WEAPON)
  Reload:
	TNT1 A 0 A_StopSound(CHAN_WEAPON)
	PULS A 1 A_WeaponReady
    TNT1 A 0 A_JumpIfInventory("PulseAmmo",99,"Ready")
    TNT1 A 0 A_JumpIfInventory("Mag",1,2)
	PULS A 0
    Goto Ready
	TNT1 A 0 A_TakeInventory("PulseAmmo", 99)
	PULS A 1 A_PlaySound("weapons/shotgunreload2")
	TNT1 A 0 A_FireCustomMissile("SpentMagA",frandom(-12,-6),0,0,-8,0,frandom(-3,3))
    PULS E 1
	PULS N 1
    PULS O 1
	PULS P 1
	PULS Q 2
	PULS R 2
	PULS S 2
	PULS T 2
	PULS U 2
	PULS V 2
	PULS W 2
	PULS A 0 A_PlaySound ("weapons/pulseload")
	PULS X 3
	PULS X 3
	PULS X 2
	Loading:
    TNT1 A 0 A_TakeInventory("Mag", 1)
    TNT1 A 0 A_GiveInventory("PulseAmmo", 1)
	TNT1 A 0 A_JumpIfInventory("Mag",1,1)
	Goto EndReloading
	TNT1 A 0 A_JumpIfInventory("PulseAmmo",99,1)
	Loop
    EndReloading:
	PULS Y 2
	PULS Z 2
	PULR A 2
	PULR B 2
	PULS P 2
	PULS O 2
	PULS N 1
	PULS F 1
	PULS E 1
	PULS A 1
    Goto Ready
  AltFire:
	TNT1 A 0 A_JumpIfInventory("RadarActive", 1, "TrackerLower")
	PULS A 0 A_JumpIfInventory("RocketAmmo",1,1)
    Goto Ready
    PULS A 0 A_PlaySound ("weapons/pulseriflesecondary")
	TNT1 A 0 A_AlertMonsters
	TNT1 A 0 A_TakeInventory("RocketAmmo", 1)
    PULS B 1 Bright A_FireCustomMissile("PulseGrenade", 0, 0, 0, 0, 0, 6)
	PULS DDDDD 1 A_SetPitch (pitch-0.8)
	PULS AAAAA 2 A_SetPitch (pitch+0.8)
	PULS EF 1
	PULS A 0 A_PlayWeaponSound ("weapons/pulsepump")
	PULS G 1
	PULS H 1
	PULS I 1
	PULS J 2
	PULS K 2
	PULS L 2
	PULS M 3
	PULS LKJIHGFE 2
	PULS A 1 A_ReFire
	Goto Ready
  Spawn:
    PGUN A -1
	Stop
  PreKick:
	PULS A 1 offset(-8, 40)
	PULS A 1 offset(-24, 56)
	PULS A 1 offset(-40, 72)
	PULS A 1 offset(-50, 88)
	PULS A 1 offset(-66, 104)
	goto Kick
  PostKick:
    PULS A 1 offset(-66, 104)
	PULS A 1 offset(-50, 88)
	PULS A 1 offset(-40, 72)
	PULS A 1 offset(-24, 56)
	PULS A 1 offset(-8, 40)
	goto ready
  PreTrack:
	PULS A 1 offset(-8, 40)
	PULS A 1 offset(-24, 56)
	PULS A 1 offset(-40, 72)
	PULS A 1 offset(-50, 88)
	PULS A 1 offset(-66, 104)
	goto TrackRaise
  PostTrack:
	PULS A 1 offset(-66, 104)
    PULS A 1 offset(-50, 88)
	PULS A 1 offset(-40, 72)
	PULS A 1 offset(-24, 56)
	PULS A 1 offset(-8, 40)
	goto ready
  }
}

ACTOR PulseAmmo : Ammo
{
  Inventory.PickupMessage "You shouldn't see this!"
  Inventory.Amount 99
  Inventory.MaxAmount 99
  +IGNORESKILL
  Ammo.BackpackAmount 0
  Ammo.BackpackMaxAmount 99
  Inventory.Icon "AMMOA0"
  States
  {
  Spawn:
    CLIP A -1
    Stop
  }
}

actor PulseGrenade
{
 radius 6
 height 6
 speed 30
 damage 10
 wallbouncefactor 0.8
 bouncecount 1
 mass 20
 gravity 0.6
 +MISSILE
 +DOOMBOUNCE
 +GRENADETRAIL
 +EXTREMEDEATH
 +THRUSPECIES
 +DONTHARMSPECIES
 BounceFactor 0.65
 ExplosionDamage 98
 ExplosionRadius 128
 seesound "weapons/grenadebounce"
 reactiontime 110
 species "Player"
 states
 {
  spawn:
	PGRN A 1 Bright
	loop
  death:
	TNT1 A 0 A_PlaySound("weapons/pulsegrenadeblow")
	MISL B 3 Bright A_Explode
    MISL CD 3 Bright
    Stop
  }
}