// LASER RIFLE
actor StealthLaserRifle : AOWWeapon {
    Weapon.BobSpeed 1.75
    Weapon.BobRangeX 0.2
    Weapon.BobRangeY 0.4
    Weapon.BobStyle Alpha
	+NOEXTREMEDEATH
	+ALT_AMMO_OPTIONAL
	Obituary "$OB_LASERRIFLE"
	Inventory.PickupMessage "You got the laser rifle!"
	Weapon.SelectionOrder 8
	Weapon.KickBack 100
	Weapon.AmmoType "LaserRifleAmmo"
	Weapon.AmmoUse 1
	Weapon.AmmoGive 20
	weapon.SlotNumber 8
	Weapon.PreferredSkin "MarineGrenade"
	Weapon.UpSound "weapons/up/laserrifle"
	Tag "Stealth Laser Rifle"
	decal "LaserScorch"
	States {
	Select:
	    TNT1 A 0 A_TakeInventory ("StealthFire", 1)
		TNT1 A 0 A_JumpIfInventory ("IsBlue", 1, "Select.Blue")
		LSRF A 1 offset (90,100)
		LSRF A 1 offset (80,89)
		LSRF A 1 offset (70,79)
		LSRF A 1 offset (60,70)
		LSRF A 1 offset (50,62)
		LSRF A 1 offset (40,55)
		LSRF A 1 offset (30,49)
		LSRF A 1 offset (20,44)
		LSRF A 1 offset (15,40)
		LSRF A 1 offset (10,37)
		LSRF A 1 offset (5,34)
		LSRF A 1 offset (0,0)
		TNT1 A 0 A_TakeInventory("SelectAnimation",1)
		goto ready
	Select.Blue:
	    LSRB A 1 offset (90,100)
		LSRB A 1 offset (80,89)
		LSRB A 1 offset (70,79)
		LSRB A 1 offset (60,70)
		LSRB A 1 offset (50,62)
		LSRB A 1 offset (40,55)
		LSRB A 1 offset (30,49)
		LSRB A 1 offset (20,44)
		LSRB A 1 offset (15,40)
		LSRB A 1 offset (10,37)
		LSRB A 1 offset (5,34)
		LSRB A 1 offset (0,0)
		TNT1 A 0 A_TakeInventory("SelectAnimation",1)
		goto ready
	Deselect:
		LSRF A 0 A_TakeInventory ("StealthFire", 1)
		LSRF A 0 ACS_ExecuteAlways (SC_STEALTH, 0, STEALTH_FORCEOFF)
		TNT1 A 0 A_TakeInventory("ActionFragGrenade",1)	
        TNT1 A 0 A_TakeInventory("ActionFlashbang",1)
        TNT1 A 0 A_TakeInventory("ActionRemoteC4",1)	
        TNT1 A 0 A_TakeInventory("ActionMeleeAttack",1)
		TNT1 A 0 A_TakeInventory("ActionReload",1)	
		TNT1 A 0 A_JumpIfInventory ("IsBlue", 1, "Deselect.Blue")
		LSRF A 1 offset (4,34)
		LSRF A 1 offset (8,40)
		LSRF A 1 offset (16,49)
		LSRF A 1 offset (24,62)
		LSRF A 1 offset (32,79)
		LSRF A 1 offset (40,100)
		TNT1 A 0 offset (1, 33)
		TNT1 A 0 A_Lower
		wait
	Deselect.Blue:
		LSRB A 1 offset (4,34)
		LSRB A 1 offset (8,40)
		LSRB A 1 offset (16,49)
		LSRB A 1 offset (24,62)
		LSRB A 1 offset (32,79)
		LSRB A 1 offset (40,100)
		TNT1 A 0 offset (1, 33)
		TNT1 A 0 A_Lower
		wait
	Ready:
	    TNT1 A 0 A_JumpIfInventory("SelectAnimation",1,"Select")
		TNT1 A 0 A_JumpIfInventory ("IsBlue", 1, "Ready.Blue")
		TNT1 A 0 A_JumpIfInventory ("StealthMode",1,"Ready.Stealth")
		TNT1 A 0 A_JumpIfInventory("ActionFragGrenade",1,"UseFragGrenade")
		TNT1 A 0 A_JumpIfInventory("ActionFlashbang",1,"UseFlashbang")
		TNT1 A 0 A_JumpIfInventory("ActionRemoteC4",1,"UseRemoteC4")
		TNT1 A 0 A_JumpIfInventory("ActionMeleeAttack",1,"UseMeleeAttack")
		TNT1 A 0 A_TakeInventory("ActionReload",1)
		LSRF A 1 A_WeaponReady
		TNT1 A 0 A_TakeInventory ("StealthFire", 1)
		loop
	Ready.Blue:
		TNT1 A 0 A_JumpIfInventory("StealthMode",1,"Ready.StealthBlue")
		TNT1 A 0 A_JumpIfInventory("ActionFragGrenade",1,"UseFragGrenade")
		TNT1 A 0 A_JumpIfInventory("ActionFlashbang",1,"UseFlashbang")
		TNT1 A 0 A_JumpIfInventory("ActionRemoteC4",1,"UseRemoteC4")
		TNT1 A 0 A_JumpIfInventory("ActionMeleeAttack",1,"UseMeleeAttack")
		TNT1 A 0 A_TakeInventory("ActionReload",1)
		LSRB A 1 A_WeaponReady
		TNT1 A 0 A_TakeInventory ("StealthFire", 1)
		loop
	Ready.Stealth:
		TNT1 A 0 A_JumpIfInventory("StealthCharge", 1, 1)
		goto AltFireOff
		TNT1 A 0 A_JumpIfInventory("ActionFragGrenade",1,"UseFragGrenade")
		TNT1 A 0 A_JumpIfInventory("ActionFlashbang",1,"UseFlashbang")
		TNT1 A 0 A_JumpIfInventory("ActionRemoteC4",1,"UseRemoteC4")
		TNT1 A 0 A_JumpIfInventory("ActionMeleeAttack",1,"UseMeleeAttack")
		TNT1 A 0 A_TakeInventory("ActionReload",1)
		LSRF A 5 A_WeaponReady
		TNT1 A 0 A_JumpIfInventory("ActionFragGrenade",1,"UseFragGrenade")
		TNT1 A 0 A_JumpIfInventory("ActionFlashbang",1,"UseFlashbang")
		TNT1 A 0 A_JumpIfInventory("ActionRemoteC4",1,"UseRemoteC4")
		TNT1 A 0 A_JumpIfInventory("ActionMeleeAttack",1,"UseMeleeAttack")
		TNT1 A 0 A_TakeInventory("ActionReload",1)
		LSRF A 5 A_WeaponReady
		TNT1 A 0 A_JumpIfInventory("ActionFragGrenade",1,"UseFragGrenade")
		TNT1 A 0 A_JumpIfInventory("ActionFlashbang",1,"UseFlashbang")
		TNT1 A 0 A_JumpIfInventory("ActionRemoteC4",1,"UseRemoteC4")
		TNT1 A 0 A_JumpIfInventory("ActionMeleeAttack",1,"UseMeleeAttack")
		TNT1 A 0 A_TakeInventory("ActionReload",1)
		LSRF A 5 A_WeaponReady
		TNT1 A 0 A_JumpIfInventory("ActionFragGrenade",1,"UseFragGrenade")
		TNT1 A 0 A_JumpIfInventory("ActionFlashbang",1,"UseFlashbang")
		TNT1 A 0 A_JumpIfInventory("ActionRemoteC4",1,"UseRemoteC4")
		TNT1 A 0 A_JumpIfInventory("ActionMeleeAttack",1,"UseMeleeAttack")
		TNT1 A 0 A_TakeInventory("ActionReload",1)
		LSRF A 5 A_WeaponReady
		TNT1 A 0 A_JumpIfInventory("ActionFragGrenade",1,"UseFragGrenade")
		TNT1 A 0 A_JumpIfInventory("ActionFlashbang",1,"UseFlashbang")
		TNT1 A 0 A_JumpIfInventory("ActionRemoteC4",1,"UseRemoteC4")
		TNT1 A 0 A_JumpIfInventory("ActionMeleeAttack",1,"UseMeleeAttack")
		TNT1 A 0 A_TakeInventory("ActionReload",1)
		LSRF A 5 A_WeaponReady
		TNT1 A 0 A_JumpIfInventory("ActionFragGrenade",1,"UseFragGrenade")
		TNT1 A 0 A_JumpIfInventory("ActionFlashbang",1,"UseFlashbang")
		TNT1 A 0 A_JumpIfInventory("ActionRemoteC4",1,"UseRemoteC4")
		TNT1 A 0 A_JumpIfInventory("ActionMeleeAttack",1,"UseMeleeAttack")
		TNT1 A 0 A_TakeInventory("ActionReload",1)
		LSRF A 5 A_WeaponReady
		TNT1 A 0 A_JumpIfInventory("ActionFragGrenade",1,"UseFragGrenade")
		TNT1 A 0 A_JumpIfInventory("ActionFlashbang",1,"UseFlashbang")
		TNT1 A 0 A_JumpIfInventory("ActionRemoteC4",1,"UseRemoteC4")
		TNT1 A 0 A_JumpIfInventory("ActionMeleeAttack",1,"UseMeleeAttack")
		TNT1 A 0 A_TakeInventory("ActionReload",1)
		LSRF A 5 A_WeaponReady
		TNT1 A 0 A_TakeInventory("StealthCharge",1)
		goto Ready
	Ready.StealthBlue:
		TNT1 A 0 A_JumpIfInventory("StealthCharge", 1, 1)
		goto AltFireOff.Blue
		TNT1 A 0 A_JumpIfInventory("ActionFragGrenade",1,"UseFragGrenade")
		TNT1 A 0 A_JumpIfInventory("ActionFlashbang",1,"UseFlashbang")
		TNT1 A 0 A_JumpIfInventory("ActionRemoteC4",1,"UseRemoteC4")
		TNT1 A 0 A_JumpIfInventory("ActionMeleeAttack",1,"UseMeleeAttack")
		TNT1 A 0 A_TakeInventory("ActionReload",1)
		LSRB A 5 A_WeaponReady
		TNT1 A 0 A_JumpIfInventory("ActionFragGrenade",1,"UseFragGrenade")
		TNT1 A 0 A_JumpIfInventory("ActionFlashbang",1,"UseFlashbang")
		TNT1 A 0 A_JumpIfInventory("ActionRemoteC4",1,"UseRemoteC4")
		TNT1 A 0 A_JumpIfInventory("ActionMeleeAttack",1,"UseMeleeAttack")
		TNT1 A 0 A_TakeInventory("ActionReload",1)
		LSRB A 5 A_WeaponReady
		TNT1 A 0 A_JumpIfInventory("ActionFragGrenade",1,"UseFragGrenade")
		TNT1 A 0 A_JumpIfInventory("ActionFlashbang",1,"UseFlashbang")
		TNT1 A 0 A_JumpIfInventory("ActionRemoteC4",1,"UseRemoteC4")
		TNT1 A 0 A_JumpIfInventory("ActionMeleeAttack",1,"UseMeleeAttack")
		TNT1 A 0 A_TakeInventory("ActionReload",1)
		LSRB A 5 A_WeaponReady
		TNT1 A 0 A_JumpIfInventory("ActionFragGrenade",1,"UseFragGrenade")
		TNT1 A 0 A_JumpIfInventory("ActionFlashbang",1,"UseFlashbang")
		TNT1 A 0 A_JumpIfInventory("ActionRemoteC4",1,"UseRemoteC4")
		TNT1 A 0 A_JumpIfInventory("ActionMeleeAttack",1,"UseMeleeAttack")
		TNT1 A 0 A_TakeInventory("ActionReload",1)
		LSRB A 5 A_WeaponReady
		TNT1 A 0 A_JumpIfInventory("ActionFragGrenade",1,"UseFragGrenade")
		TNT1 A 0 A_JumpIfInventory("ActionFlashbang",1,"UseFlashbang")
		TNT1 A 0 A_JumpIfInventory("ActionRemoteC4",1,"UseRemoteC4")
		TNT1 A 0 A_JumpIfInventory("ActionMeleeAttack",1,"UseMeleeAttack")
		TNT1 A 0 A_TakeInventory("ActionReload",1)
		LSRB A 5 A_WeaponReady
		TNT1 A 0 A_JumpIfInventory("ActionFragGrenade",1,"UseFragGrenade")
		TNT1 A 0 A_JumpIfInventory("ActionFlashbang",1,"UseFlashbang")
		TNT1 A 0 A_JumpIfInventory("ActionRemoteC4",1,"UseRemoteC4")
		TNT1 A 0 A_JumpIfInventory("ActionMeleeAttack",1,"UseMeleeAttack")
		TNT1 A 0 A_TakeInventory("ActionReload",1)
		LSRB A 5 A_WeaponReady
		TNT1 A 0 A_JumpIfInventory("ActionFragGrenade",1,"UseFragGrenade")
		TNT1 A 0 A_JumpIfInventory("ActionFlashbang",1,"UseFlashbang")
		TNT1 A 0 A_JumpIfInventory("ActionRemoteC4",1,"UseRemoteC4")
		TNT1 A 0 A_JumpIfInventory("ActionMeleeAttack",1,"UseMeleeAttack")
		TNT1 A 0 A_TakeInventory("ActionReload",1)
		LSRB A 5 A_WeaponReady
		TNT1 A 0 A_TakeInventory("StealthCharge",1)
		goto Ready
	Fire:
		TNT1 A 0 A_JumpIfInventory ("IsInSpawnRoom", 1, "Ready")
		TNT1 A 0 A_JumpIfInventory ("InMenu", 1, "Ready")
		LSRF A 0 A_JumpIfInventory("StealthMode", 1, "Fire.Stealth")
	FireGo:
		LSRF A 0 A_JumpIfInventory ("IsBlue", 1, "Fire.Blue")
		//LSRF A 0 A_PlayWeaponSound ("laser/fire")
		LSRF A 0 A_PlaySound("laser/fire", CHAN_WEAPON, 0.5)
		LSRF B 1 bright offset (0, 34) A_Light2
		LSRF C 0 bright offset (0, 34) A_FireBullets (0, 0, 1, 0, "LaserPuff", 0, 5000)
		LSRF B 1 bright offset (0, 36) A_RailAttack (16, 0, 1, none, "FF 00 00", 1, 0, "LaserPuff")
		LSRF C 2 bright offset (0, 34)
		LSRF A 5 offset (0, 32) A_Light0
		LSRF A 0 A_Refire
		LSRF D 3 offset(3,34)
		LSRF D 3 offset(1,31)
		LSRF E 2 offset(-2,28)
		LSRF E 2 offset(-6,27)
		LSRF FFFF 2 A_FireCustomMissile ("OverheatSmokeSpawner", 0, false)
		LSRF F 1 offset(-3,30)
		LSRF F 1 offset(-1,33)
		LSRF F 1 offset(2,37)
		LSRF F 1 offset(5,42)
		LSRF F 1 offset(7,43)
		LSRF F 1 offset(9,44)
		goto Restealth
	Fire.Blue:
		//LSRB A 0 A_PlayWeaponSound ("laser/fire")
		LSRF A 0 A_PlaySound("laser/fire", CHAN_WEAPON, 0.5)
		LSRB B 1 bright offset (0, 34) A_Light2
		LSRB C 0 bright offset (0, 34) A_FireBullets (0, 0, 1, 0, "LaserPuffBlue", 0, 5000)
		LSRB B 1 bright offset (0, 36) A_RailAttack (16, 0, 1, none, "00 80 FF", 1, 0, "LaserPuffBlue")
		LSRB C 2 bright offset (0, 34)
		LSRB A 5 offset (0, 32) A_Light0
		LSRB A 0 A_Refire
		LSRB D 3 offset(3,34)
		LSRB D 3 offset(1,31)
		LSRB E 2 offset(-2,28)
		LSRB E 2 offset(-6,27)
		LSRB FFFF 2 A_FireCustomMissile ("OverheatSmokeSpawner", 0, false)
		LSRB F 1 offset(-3,30)
		LSRB F 1 offset(-1,33)
		LSRB F 1 offset(2,37)
		LSRB F 1 offset(5,42)
		LSRB F 1 offset(7,43)
		LSRB F 1 offset(9,44)
		goto Restealth
	Fire.Stealth:
		LSRF A 0 A_JumpIfInventory ("StealthMode", 3, "FireGo")
		LSRF A 0 A_GiveInventory ("StealthFire", 1)
		LSRF A 0 ACS_ExecuteAlways (SC_STEALTH, 0, STEALTH_FORCEOFF)
		goto FireGo
	Restealth:
		LSRF A 0 A_JumpIfInventory ("StealthFire", 1, 2)
		goto Ready
		LSRF A 0 A_TakeInventory ("StealthFire", 1)
		LSRF A 0 ACS_ExecuteAlways (SC_STEALTH, 0, STEALTH_ON)
		LSRF A 0 A_JumpIfInventory ("IsBlue", 1, "Restealth.Blue")
		LSRF AAAAAAAAAAAAAAA 1 A_WeaponReady
		goto Ready
	Restealth.Blue:
		LSRB AAAAAAAAAAAAAAA 1 A_WeaponReady
		goto Ready
	AltFire:
		TNT1 A 0 A_JumpIfInventory ("IsBlue", 1, "AltFire.Blue")
		TNT1 A 0 A_JumpIfInventory ("IsInSpawnRoom", 1, "AltRejected")
		TNT1 A 0 A_JumpIfInventory ("InMenu", 1, "AltRejected")
	    LSRF A 0 A_JumpIfInventory ("IsStealth", 1, "AltFire2")
		TNT1 A 0 A_Print("You need a Stealth Suit!")
		goto Ready
	AltFire2:
		TNT1 A 0 A_JumpIfInventory ("StealthCharge", 1, 1)
		goto AltRejected
		LSRF A 5 A_JumpIfInventory("StealthMode", 1, "AltFireOff")
		LSRF A 50 ACS_ExecuteAlways (SC_STEALTH, 0, STEALTH_ON)
		goto Ready
	AltFireOff:
		LSRF A 5 A_JumpIfInventory("StealthMode", 3, "AltRejected")
		LSRF A 5
		LSRF A 0 ACS_ExecuteAlways (SC_STEALTH, 0, STEALTH_OFF)
		LSRF A 40 A_WeaponReady (WRF_NOSECONDARY)
		goto Ready
	AltRejected:
		LSRF A 16 A_WeaponReady (WRF_NOSECONDARY)
		goto Ready
	AltFire.Blue:
		TNT1 A 0 A_JumpIfInventory ("IsInSpawnRoom", 1, "AltRejected.Blue")
		TNT1 A 0 A_JumpIfInventory ("InMenu", 1, "AltRejected.Blue")
	    LSRB A 0 A_JumpIfInventory ("IsStealth", 1, "AltFire2.Blue")
		TNT1 A 0 A_Print("You need a Stealth Suit!")
		goto Ready
	AltFire2.Blue:
		TNT1 A 0 A_JumpIfInventory ("StealthCharge", 1, 1)
		goto AltRejected.Blue
		LSRB A 5 A_JumpIfInventory("StealthMode", 1, "AltFireOff.Blue")
		LSRB A 50 ACS_ExecuteAlways (SC_STEALTH, 0, STEALTH_ON)
		goto Ready
	AltFireOff.Blue:
		LSRB A 5 A_JumpIfInventory("StealthMode", 3, "AltRejected.Blue")
		LSRB A 5
		LSRB A 0 ACS_ExecuteAlways (SC_STEALTH, 0, STEALTH_OFF)
		LSRB A 40 A_WeaponReady (WRF_NOSECONDARY)
		goto Ready
	AltRejected.Blue:
		LSRB A 16 A_WeaponReady (WRF_NOSECONDARY)
		goto Ready
	Spawn:
		LSRF X -1
		stop
	}
}

actor LaserPuff : HHBulletPuff {
	-ALLOWPARTICLES +PUFFONACTORS
	Scale 0.5
	DamageType "Energy"
	Translation "192:207=224:247"
	RenderStyle Add
	Alpha 0.75
	VSpeed 0
	
	States {
	Spawn:
	Melee:
	Crash:
		VOLX ABCDEFEDCB 2 BRIGHT A_FadeOut(0.01)
		VOLX A 1 A_FadeOut
		wait
	}
}

actor LaserPuffBlue : LaserPuff {
	Translation "0:0=0:0"
}
