
ACTOR RLGaussRifle : RLWeapon
{
  Obituary "%k demonstrated to %o how to correctly use a gauss rifle."
  Decal BulletChip
  Tag "Gauss Rifle"
  Weapon.Kickback 250
  Weapon.SelectionOrder 1900
  Weapon.SlotNumber 6
  Weapon.AmmoUse1 0
  Weapon.AmmoGive1 0
  Weapon.AmmoType1 "RLGaussRifleCharge"
  Weapon.AmmoType2 "Clip"
  Inventory.Icon "GAUSICON"
  States
  {
  Ready:
	TNT1 A 0 A_JumpIfInventory("RLMisfireSpamPreventionCooldown",1,"MisfirePrevention")
	TNT1 A 0 A_JumpIfInventory("RLGaussRifleZoom",1,2)
    GAUS A 1 A_WeaponReady (WRF_ALLOWZOOM | WRF_ALLOWRELOAD)
    Goto Ready+1
    ZOOM A 1 Bright A_WeaponReady (WRF_ALLOWZOOM | WRF_ALLOWRELOAD | WRF_NOBOB)
    Goto Ready+1
    Loop
  ReadyExtra:
	TNT1 A 0 A_JumpIfInventory("RLGaussRifleZoom",1,2)
    GAUS A 1 A_WeaponReady (WRF_ALLOWZOOM)
    Goto Ready
    ZOOM A 1 Bright A_WeaponReady (WRF_ALLOWZOOM | WRF_NOBOB)
    Goto Ready
	
  ScavengerDrop:
	TNT1 A 0 A_JumpIfInventory("RLScavengerDrop",1,"WeaponDropConfirm")
	TNT1 A 0 A_GiveInventory("RLScavengerDrop",1)
	TNT1 A 0 A_Print("Press again to drop current weapon,\nor press \crAlt Fire\c- to scrap it to retrieve a Mod Pack.")
	Goto AfterModDrop
  WeaponDropConfirm:
	TNT1 A 0 A_GiveInventory("RLMisfireSpamPreventionCooldown",1)
	TNT1 A 0 A_TakeInventory("RLScavengerDrop",1)
	TNT1 A 0 A_TakeInventory("RLWeaponDrop",1)
	TNT1 A 0 A_TakeInventory("PowerRLTechnicianMasterDamage", 1)
	TNT1 A 0 A_SpawnItemEx("RLGaussRiflePickup", 0, 0, 40, 8, 0, 0, 0, SXF_SETMASTER)
	TNT1 A 0 A_GiveInventory("RLRarityTokenRemover", 1)
	TNT1 A 0 A_TakeInventory("RLGaussRifleSelected", 1)
	TNT1 A 0 A_TakeInventory("RLGaussRifleZoom",1)
	TNT1 A 0 A_ZoomFactor(1.0)
    TNT1 A 0 A_SetCrosshair (0)
	TNT1 A 0 A_TakeInventory("RLWeaponLimit",1)
	TNT1 A 1 A_TakeInventory("RLGaussRifle",1)
	Stop
	
  AfterModDrop:
	TNT1 A 0 A_JumpIfInventory("RLGaussRifleZoom",1,2)
    GAUS A 8 A_WeaponReady (WRF_NOSECONDARY | WRF_ALLOWRELOAD)
    Goto Ready
    ZOOM A 8 Bright A_WeaponReady (WRF_NOSECONDARY | WRF_ALLOWRELOAD | WRF_NOBOB)
    Goto Ready
  MisfirePrevention:
	TNT1 A 0 A_JumpIfInventory("RLGaussRifleZoom",1,3)
    GAUS A 1 A_WeaponReady (WRF_NOFIRE | WRF_NOBOB)
    TNT1 A 0 A_JumpIfInventory("RLMisfireSpamPreventionCooldown", 1, "MisfirePrevention")
    Goto Ready
    ZOOM A 1 Bright A_WeaponReady (WRF_NOFIRE | WRF_NOBOB)
    TNT1 A 0 A_JumpIfInventory("RLMisfireSpamPreventionCooldown", 1, "MisfirePrevention")
    Goto Ready
	
  Deselect:
	TNT1 A 0
	TNT1 A 0 A_GiveInventory("RLDeselectionFunction",1)
	TNT1 A 0 A_TakeInventory("RLGaussRifleSelected", 1)
	TNT1 A 0 A_TakeInventory("RLGaussRifleZoom",1)
	TNT1 A 0 A_ZoomFactor(1.0)
    TNT1 A 0 A_SetCrosshair (0)
	TNT1 A 0 A_GiveInventory("RLRarityTokenRemover", 1)
	TNT1 A 0 A_TakeInventory("PowerRLTechnicianMasterDamage", 1)
  DeselectLoop:
    TNT1 A 0 A_JumpIfInventory("RLShellshockPerk", 1, "DeselectRenegade")
    TNT1 A 0 A_Lower
    GAUS A 1 A_Lower
    Loop
  DeselectRenegade:
    TNT1 A 0 A_Lower
    loop
  SelectRenegade: 
    TNT1 A 0 A_Raise
    loop
  SelectSetWeapon:
	TNT1 A 0 A_GiveInventory("RLMasterAssemblyTypeWeapon", 1)
	TNT1 A 0 A_GiveInventory("RLEfficientAmmoTypeWeapon", 1)
	TNT1 A 0 A_GiveInventory("RLSingleShotRifleTypeWeapon", 1)
	TNT1 A 0 A_GiveInventory("RLMultiAmmoWeapon", 1)
	TNT1 A 0 A_GiveInventory("RLAssembledWeaponToken", 1)
	TNT1 A 0 A_GiveInventory("RLGaussRifleSelected", 1)
	TNT1 A 0 A_JumpIfInventory("RLScavengerPerk",1, 1)
    Goto SelectLoop
	TNT1 A 0 A_GiveInventory("PowerRLTechnicianMasterDamage", 1)
    Goto SelectLoop
  SelectLoop:
    TNT1 A 0 A_JumpIfInventory("RLShellshockPerk", 1, "SelectRenegade")
    TNT1 A 0 A_Raise
    GAUS A 1 A_Raise
    Loop
	
  Fire:
	GAUS A 0 A_JumpIfInventory("RLRestrictionMeleeOnly",1,"MeleeRestricted") // Cannot fire in levels that restrict it
	GAUS A 0 A_JumpIfInventory("RLRestrictionSilencedOnly",1,"SilencedRestricted") // Cannot fire in levels that restrict it
	GAUS A 0 A_JumpIfInventory("RLRestrictionBoomOnly",1,"BoomRestricted") // Cannot fire in levels that restrict it
	GAUS A 0 A_JumpIfInventory("RLRestrictionLowTechOnly",1,"LowTechRestricted") // Cannot fire in levels that restrict it
	GAUS A 0 A_JumpIfInventory("RLRestrictionCunningOnly",1,"CunningRestricted") // Cannot fire in levels that restrict it
	
	TNT1 A 0 A_JumpIfInventory("RLGaussRifleClip", 1, 1)
	Goto Reload
    TNT1 A 0 A_PlaySound("weapons/gaussriflecharge", CHAN_WEAPON, 0.75, 0, 1.8)
  Hold:
	TNT1 A 0 A_JumpIfInventory("RLGaussRifleZoom",1,"Hold2")
    GAUS A 1
	TNT1 A 0 A_GiveInventory("RLGaussRifleCharge", 1)
	TNT1 A 0 A_Refire("Hold")
    Goto FireContinue
  Hold2:
    ZOOM B 1 Bright
	TNT1 A 0 A_GiveInventory("RLGaussRifleCharge", 1)
	TNT1 A 0 A_Refire("Hold")
    Goto FireContinue
  FireContinue:
	TNT1 A 0 A_AlertMonsters
	TNT1 A 0 A_FireCustomMissile("RLGaussRifleHaximusMaximus")
	TNT1 A 0 A_JumpIfInventory("RLGaussRifleCharge",100,"FireContinueX")
	TNT1 A 0 A_JumpIfInventory("RLGaussRifleCharge",90,"FireContinue9")
	TNT1 A 0 A_JumpIfInventory("RLGaussRifleCharge",80,"FireContinue8")
	TNT1 A 0 A_JumpIfInventory("RLGaussRifleCharge",70,"FireContinue7")
	TNT1 A 0 A_JumpIfInventory("RLGaussRifleCharge",60,"FireContinue6")
	TNT1 A 0 A_JumpIfInventory("RLGaussRifleCharge",50,"FireContinue5")
	TNT1 A 0 A_JumpIfInventory("RLGaussRifleCharge",40,"FireContinue4")
	TNT1 A 0 A_JumpIfInventory("RLGaussRifleCharge",30,"FireContinue3")
	TNT1 A 0 A_JumpIfInventory("RLGaussRifleCharge",20,"FireContinue2")
	TNT1 A 0 A_JumpIfInventory("RLGaussRifleCharge",10,"FireContinue1")
  FireContinue0:
	TNT1 A 0 A_JumpIfInventory("RLEnclaveSetBonusActive", 1, 2) //sekrit set bonus effect oh my
	TNT1 A 0 A_RailAttack (random(300,400), 0, 0, "None", "LightBlue", RGF_FULLBRIGHT | RGF_SILENT, 0, "RLGaussRifleDamagePuff", 0, 0, 0, 16, 15, 0, "RLGaussRifleTrail")
    Goto FireFinish
	TNT1 A 0 A_RailAttack (random(600,800), 0, 0, "None", "LightBlue", RGF_FULLBRIGHT | RGF_SILENT, 0, "RLGaussRifleDamagePuff", 0, 0, 0, 16, 15, 0, "RLGaussRifleTrail")
    Goto FireFinish
  FireContinue1:
	TNT1 A 0 A_JumpIfInventory("RLEnclaveSetBonusActive", 1, 2) //sekrit set bonus effect oh my
	TNT1 A 0 A_RailAttack (random(400,500), 0, 0, "None", "LightBlue", RGF_FULLBRIGHT | RGF_SILENT, 0, "RLGaussRifleDamagePuff", 0, 0, 0, 16, 15, 0, "RLGaussRifleTrail")
    Goto FireFinish
	TNT1 A 0 A_RailAttack (random(800,1000), 0, 0, "None", "LightBlue", RGF_FULLBRIGHT | RGF_SILENT, 0, "RLGaussRifleDamagePuff", 0, 0, 0, 16, 15, 0, "RLGaussRifleTrail")
    Goto FireFinish
  FireContinue2:
	TNT1 A 0 A_JumpIfInventory("RLEnclaveSetBonusActive", 1, 2) //sekrit set bonus effect oh my
	TNT1 A 0 A_RailAttack (random(500,600), 0, 0, "None", "LightBlue", RGF_FULLBRIGHT | RGF_SILENT, 0, "RLGaussRifleDamagePuff", 0, 0, 0, 16, 15, 0, "RLGaussRifleTrail")
    Goto FireFinish
	TNT1 A 0 A_RailAttack (random(1000,1200), 0, 0, "None", "LightBlue", RGF_FULLBRIGHT | RGF_SILENT, 0, "RLGaussRifleDamagePuff", 0, 0, 0, 16, 15, 0, "RLGaussRifleTrail")
    Goto FireFinish
  FireContinue3:
	TNT1 A 0 A_JumpIfInventory("RLEnclaveSetBonusActive", 1, 2) //sekrit set bonus effect oh my
	TNT1 A 0 A_RailAttack (random(600,700), 0, 0, "None", "LightBlue", RGF_FULLBRIGHT | RGF_SILENT, 0, "RLGaussRifleDamagePuff", 0, 0, 0, 16, 15, 0, "RLGaussRifleTrail")
    Goto FireFinish
	TNT1 A 0 A_RailAttack (random(1200,1400), 0, 0, "None", "LightBlue", RGF_FULLBRIGHT | RGF_SILENT, 0, "RLGaussRifleDamagePuff", 0, 0, 0, 16, 15, 0, "RLGaussRifleTrail")
    Goto FireFinish
  FireContinue4:
	TNT1 A 0 A_JumpIfInventory("RLEnclaveSetBonusActive", 1, 2) //sekrit set bonus effect oh my
	TNT1 A 0 A_RailAttack (random(700,800), 0, 0, "None", "LightBlue", RGF_FULLBRIGHT | RGF_SILENT, 0, "RLGaussRifleDamagePuff", 0, 0, 0, 16, 15, 0, "RLGaussRifleTrail")
    Goto FireFinish
	TNT1 A 0 A_RailAttack (random(1400,1600), 0, 0, "None", "LightBlue", RGF_FULLBRIGHT | RGF_SILENT, 0, "RLGaussRifleDamagePuff", 0, 0, 0, 16, 15, 0, "RLGaussRifleTrail")
    Goto FireFinish
  FireContinue5:
	TNT1 A 0 A_JumpIfInventory("RLEnclaveSetBonusActive", 1, 2) //sekrit set bonus effect oh my
	TNT1 A 0 A_RailAttack (random(800,900), 0, 0, "None", "LightBlue", RGF_FULLBRIGHT | RGF_SILENT, 0, "RLGaussRifleDamagePuff", 0, 0, 0, 16, 15, 0, "RLGaussRifleTrail")
    Goto FireFinish
	TNT1 A 0 A_RailAttack (random(1600,1800), 0, 0, "None", "LightBlue", RGF_FULLBRIGHT | RGF_SILENT, 0, "RLGaussRifleDamagePuff", 0, 0, 0, 16, 15, 0, "RLGaussRifleTrail")
    Goto FireFinish
  FireContinue6:
	TNT1 A 0 A_JumpIfInventory("RLEnclaveSetBonusActive", 1, 2) //sekrit set bonus effect oh my
	TNT1 A 0 A_RailAttack (random(900,1000), 0, 0, "None", "LightBlue", RGF_FULLBRIGHT | RGF_SILENT, 0, "RLGaussRifleDamagePuff", 0, 0, 0, 16, 15, 0, "RLGaussRifleTrail")
    Goto FireFinish
	TNT1 A 0 A_RailAttack (random(1800,2000), 0, 0, "None", "LightBlue", RGF_FULLBRIGHT | RGF_SILENT, 0, "RLGaussRifleDamagePuff", 0, 0, 0, 16, 15, 0, "RLGaussRifleTrail")
    Goto FireFinish
  FireContinue7:
	TNT1 A 0 A_JumpIfInventory("RLEnclaveSetBonusActive", 1, 2) //sekrit set bonus effect oh my
	TNT1 A 0 A_RailAttack (random(1000,1100), 0, 0, "None", "LightBlue", RGF_FULLBRIGHT | RGF_SILENT, 0, "RLGaussRifleDamagePuff", 0, 0, 0, 16, 15, 0, "RLGaussRifleTrail")
    Goto FireFinish
	TNT1 A 0 A_RailAttack (random(2000,2200), 0, 0, "None", "LightBlue", RGF_FULLBRIGHT | RGF_SILENT, 0, "RLGaussRifleDamagePuff", 0, 0, 0, 16, 15, 0, "RLGaussRifleTrail")
    Goto FireFinish
  FireContinue8:
	TNT1 A 0 A_JumpIfInventory("RLEnclaveSetBonusActive", 1, 2) //sekrit set bonus effect oh my
	TNT1 A 0 A_RailAttack (random(1100,1200), 0, 0, "None", "LightBlue", RGF_FULLBRIGHT | RGF_SILENT, 0, "RLGaussRifleDamagePuff", 0, 0, 0, 16, 15, 0, "RLGaussRifleTrail")
    Goto FireFinish
	TNT1 A 0 A_RailAttack (random(2200,2400), 0, 0, "None", "LightBlue", RGF_FULLBRIGHT | RGF_SILENT, 0, "RLGaussRifleDamagePuff", 0, 0, 0, 16, 15, 0, "RLGaussRifleTrail")
    Goto FireFinish
  FireContinue9:
	TNT1 A 0 A_JumpIfInventory("RLEnclaveSetBonusActive", 1, 2) //sekrit set bonus effect oh my
	TNT1 A 0 A_RailAttack (random(1200,1300), 0, 0, "None", "LightBlue", RGF_FULLBRIGHT | RGF_SILENT, 0, "RLGaussRifleDamagePuff", 0, 0, 0, 16, 15, 0, "RLGaussRifleTrail")
    Goto FireFinish
	TNT1 A 0 A_RailAttack (random(2400,2600), 0, 0, "None", "LightBlue", RGF_FULLBRIGHT | RGF_SILENT, 0, "RLGaussRifleDamagePuff", 0, 0, 0, 16, 15, 0, "RLGaussRifleTrail")
    Goto FireFinish
  FireContinueX:
	TNT1 A 0 A_JumpIfInventory("RLEnclaveSetBonusActive", 1, 2) //sekrit set bonus effect oh my
	TNT1 A 0 A_RailAttack (random(1300,1400), 0, 0, "None", "LightBlue", RGF_FULLBRIGHT | RGF_SILENT, 0, "RLGaussRifleDamagePuff", 0, 0, 0, 16, 15, 0, "RLGaussRifleTrail")
    Goto FireFinish
	TNT1 A 0 A_RailAttack (random(2600,2800), 0, 0, "None", "LightBlue", RGF_FULLBRIGHT | RGF_SILENT, 0, "RLGaussRifleDamagePuff", 0, 0, 0, 16, 15, 0, "RLGaussRifleTrail")
    Goto FireFinish
  FireFinish:
    TNT1 A 0 A_SpawnItemEx ("RLRocketLauncherRecoil", 0,0,0, 0,0,0, 0, SXF_NOCHECKPOSITION | SXF_SETMASTER) // Pitch-based recoil
	TNT1 A 0 A_TakeInventory("RLGaussRifleClip",1)
	TNT1 A 0 A_TakeInventory("RLGaussRifleCharge",100)
    TNT1 A 0 A_PlaySound("weapons/gaussrifle", CHAN_WEAPON, 1, 0, 0.3)
    TNT1 A 0 A_PlaySound("weapons/gaussrifle", 7, 0.05, 0, 0.10)
	TNT1 A 0 A_CheckFloor (2)
	TNT1 A 0 A_Jump(256,4)
	TNT1 A 0 A_JumpIfInventory("RLGrapplingSteelBootsToken",1,4)
	TNT1 A 0 A_JumpIfInventory("RLGrapplingProtectiveBootsToken",1,3)
	TNT1 A 0 A_JumpIfInventory("RLGrapplingPlasteelBootsToken",1,2)
    TNT1 A 0 A_ChangeVelocity (Cos(Pitch) * -2, 0, Sin(Pitch) * 2, 1)
	TNT1 A 0 A_JumpIfInventory("RLGaussRifleZoom",1,"FireFinishZoom")
    GAUS B 2 Bright A_GunFlash
    GAUS C 2
    GAUS DEF 1
	TNT1 A 0 A_JumpIf(CallACS("DRLA_AutoReload"), "Reload")
    Goto Ready
  FireFinishZoom:
    ZOOM B 7 Bright A_GunFlash
	TNT1 A 0 A_JumpIf(CallACS("DRLA_AutoReload"), "Reload")
    Goto Ready
	
  Reload:
	TNT1 A 0 A_JumpIfInventory("RLGaussRifleClip", 1, "ReadyExtra")
	TNT1 A 0 A_JumpIfInventory("RLFireangelPerk",1,2)
	TNT1 A 0 A_JumpIfInventory("Clip", 10, "ReloadCheck")
	Goto ReadyExtra
	TNT1 A 0 A_JumpIfInventory("Clip", 5, "ReloadCheck")
	Goto ReadyExtra
  ReloadCheck:
	TNT1 A 0 A_JumpIf(CallACS("DRLA_ScopeStay"), 2)
	TNT1 A 0 A_TakeInventory("RLGaussRifleZoom",1)
	TNT1 A 0 A_ZoomFactor(1.0)
    TNT1 A 0 A_SetCrosshair (0)
	TNT1 A 0 // Play the reload animation.
    GAUS F 2
    GAUS G 2
    GAUS H 2
    GAUS I 2
    GAUS J 2
    GAUS K 2
    GAUS L 2
	TNT1 A 0 A_PlaySound("weapons/gaussrifleunload", CHAN_ITEM)
    TNT1 A 0 A_SpawnItemEx ("RLStandardReloadOutRecoil", 0,0,0, 0,0,0, 0, SXF_NOCHECKPOSITION | SXF_SETMASTER) // Pitch-based recoil
	TNT1 A 32
  ReloadWorking:
	TNT1 A 0 A_JumpIfInventory("RLFireangelPerk",1,3)
	TNT1 A 0 A_TakeInventory("Clip", 10, TIF_NOTAKEINFINITE)
	TNT1 A 0 A_GiveInventory("RLGaussRifleClip", 1)
	Goto ReloadFinish
	TNT1 A 0 A_TakeInventory("Clip", 5, TIF_NOTAKEINFINITE)
	TNT1 A 0 A_GiveInventory("RLGaussRifleClip", 1)
	Goto ReloadFinish
  ReloadFinish:
	TNT1 A 0 A_PlaySound("weapons/gaussrifleload", 7)
    TNT1 A 0 A_SpawnItemEx ("RLStandardReloadInRecoil", 0,0,0, 0,0,0, 0, SXF_NOCHECKPOSITION | SXF_SETMASTER) // Pitch-based recoil
    GAUS L 2
    GAUS K 2
    GAUS J 2
    GAUS I 2
    GAUS H 2
    GAUS G 2
    GAUS F 2
	TNT1 A 0 A_JumpIfInventory("RLGaussRifleZoom",1,"ZoomInReload")
	Goto Ready
  Flash:
    TNT1 A 1 A_Light1
    TNT1 A 1 A_Light2
    TNT1 A 0 A_Light0
    Goto LightDone
  Spawn:
	TNT1 A 0 NoDelay A_SpawnItemEx("RLGaussRiflePickup",0,0,0, 0,0,0, 0,SXF_NOCHECKPOSITION, 0, tid)
    Stop
	
  Altfire:
	TNT1 A 0 A_JumpIfInventory("RLArmorModItemActivate",1, "ArmorModConversion")
	TNT1 A 0 A_JumpIfInventory("RLScavengerDrop",1,"ScavengerTime")
	TNT1 A 0 A_JumpIfInventory("RLWeaponZoomCooldown",1,"Ready")
	TNT1 A 0 A_JumpIfInventory("RLGaussRifleZoom",1,"ZoomOut")
	Goto ZoomIn
  ZoomIn:
	TNT1 A 0 A_GiveInventory("RLWeaponZoomCooldown",1)
	TNT1 A 0 A_GiveInventory("RLGaussRifleZoom",1)
  ZoomInReload:
    TNT1 A 0 A_SetCrosshair (83)
    TNT1 A 0 A_PlaySound("weapons/gaussriflezoom", CHAN_ITEM, 1, 0, 4)
	ZOOM B 1 Bright A_ZoomFactor(1.25)
	ZOOM B 1 Bright A_ZoomFactor(2)
	ZOOM B 1 Bright A_ZoomFactor(3)
	ZOOM B 1 Bright A_ZoomFactor(3.75)
	TNT1 A 0 A_ZoomFactor(4.0)
	Goto Ready
  ZoomOut:
	TNT1 A 0 A_GiveInventory("RLWeaponZoomCooldown",1)
	TNT1 A 0 A_TakeInventory("RLGaussRifleZoom",1)
    TNT1 A 0 A_PlaySound("weapons/gaussriflezoom", CHAN_ITEM, 1, 0, 4)
	ZOOM B 1 Bright A_ZoomFactor(3.75)
	ZOOM B 1 Bright A_ZoomFactor(3)
	ZOOM B 1 Bright A_ZoomFactor(2)
	ZOOM B 1 Bright A_ZoomFactor(1.25)
	TNT1 A 0 A_ZoomFactor(1.0)
    TNT1 A 0 A_SetCrosshair (0)
	Goto Ready
	
  ScavengerTime:
	TNT1 A 0 A_GiveInventory("RLScavengingExtraEffects", 1)
    TNT1 A 0 A_GiveInventory("RLGaussRifleAssemblyLearntToken", 1) // Assembly is now listed in the HUD menus
	TNT1 A 0 A_TakeInventory("RLGaussRifleZoom",1)
	TNT1 A 0 A_ZoomFactor(1.0)
    TNT1 A 0 A_SetCrosshair (0)
	TNT1 A 0 A_Print("Mod pack extracted from discarded weapon.")
	TNT1 A 0 A_TakeInventory("RLScavengerDrop",1)
	TNT1 A 0 A_GiveInventory("RLRarityTokenRemover", 1)
	TNT1 A 0 A_TakeInventory("RLGaussRifleSelected", 1)
	TNT1 A 0 A_TakeInventory("RLWeaponLimit",1)
	TNT1 A 0 A_TakeInventory("PowerRLTechnicianMasterDamage", 1)
	TNT1 A 0 A_Jump(256,1,2,3,4)
	TNT1 A 0 A_FireCustomMissile("DroppedRLPowerMod",0,0,0)
	Goto ScavengerTimeEnd
	TNT1 A 0 A_FireCustomMissile("DroppedRLAgilityMod",0,0,0)
	Goto ScavengerTimeEnd
	TNT1 A 0 A_FireCustomMissile("DroppedRLFirestormMod",0,0,0)
	Goto ScavengerTimeEnd
	TNT1 A 0 A_FireCustomMissile("DroppedRLSniperMod",0,0,0)
	Goto ScavengerTimeEnd
  ScavengerTimeEnd:
	TNT1 A 1 A_TakeInventory("RLGaussRifle",1)
	Stop
  }
}

//-------------------------------------------------------------------
//		PROJECTILES

ACTOR RLGaussRifleDamagePuff
{ 
   +PUFFGETSOWNER
   +ALWAYSPUFF
   +MTHRUSPECIES
   +THRUGHOST
   +THRUACTORS
   Decal "Scorch"
   Damagetype "Piercing"
   States
   {
   XDeath:
   Crash:
   Melee:
   Spawn:
      TNT1 A 0
      TNT1 A 10
      Stop
   }
}

ACTOR RLGaussRifleHaximusMaximus : FastProjectile
{ 
   +NOGRAVITY
   +NOBLOCKMAP
   +THRUACTORS
   +FORCEXYBILLBOARD
   Height 1
   Radius 1
   Projectile
   RenderStyle Add
   Alpha 0.9
   Scale 1.8
   Speed 32000
   Decal "Scorch"
   Damagetype "Piercing"
   States
   {
   Spawn:
      TNT1 A 1
	  Loop
   Death:
	  TNT1 A 0 A_JumpIf(CallACS("DRLA_QuakeNShake") >= 2, 3)
      TNT1 A 0 A_Quake (1, 12, 0, 768, "")
      TNT1 A 0 A_Quake (3, 8, 0, 256, "")
      TNT1 A 0 A_PlaySound ("weapons/smallexp", 7, 1, 0, 0.8)
      TNT1 A 0 A_PlaySound("weapons/smallexp", CHAN_ITEM, 0.05, 0, 0.05)
      TNT1 AAAAAAAAAAAAA 0 A_SpawnItemEx("RLGaussRifleSpark",frandom(-5, 5),frandom(-5, 5),frandom(-5, 5), frandom(-5, 5), frandom(-5, 5), frandom(-5, 5), frandom(0, 359), SXF_NOCHECKPOSITION)
      GAUX B 12 Bright
      GAUX C 6 Bright
      GAUX D 4 Bright
      GAUX E 3 Bright
      Stop
   }
}

ACTOR RLGaussRifleTrail
{
	+NOGRAVITY
	+NOCLIP
	+NOINTERACTION
	+FORCEXYBILLBOARD
	Alpha 0.3
	Scale 0.02
	RenderStyle Add
   States
   {
   Spawn:
      TNT1 A 0
      TNT1 A 0 A_Jump (190,2)
      TNT1 A 0 A_SpawnItemEx ("RLGaussRifleSmoke", frandom(-10.0,10.0), frandom(-10.0,10.0), frandom(-10.0,10.0), 0,0,0, 0, SXF_NOCHECKPOSITION)
   SpawnLoop:
      GAUX A 1 Bright A_FadeTo(0, frandom(0.01,0.03), 1)
      TNT1 A 0 A_SetScale (ScaleX+frandom(0.001,0.01))
      Loop
   }
}

ACTOR RLGaussRifleSmoke
{
	+NOGRAVITY
	+NOCLIP
	+NOINTERACTION
	+FORCEXYBILLBOARD
	Alpha 0.2
	Scale 0.4
	RenderStyle Translucent
   States
   {
   Spawn:
      TNT1 A 0
      TNT1 A 0 A_SetScale (frandom(0.3, 0.95))
   Spawn2:
      GAUX FGHIJKL random(3,5) Bright A_FadeTo(0, frandom(0.01,0.08), 1)
      Stop
   }
}

ACTOR RLGaussRifleSpark
{
	Height 4
	Radius 4
	Projectile
	Alpha 0.98
	Scale 0.85
	RenderStyle Add
	Gravity 0.4
	BounceType "Hexen"
	BounceFactor 1
	WallBounceFactor 1
	+NOGRAVITY
	+THRUACTORS
	+DONTSPLASH
	+NOTELEPORT
	+FORCEXYBILLBOARD
   States
   {
   Spawn:
      TNT1 A 0
      TNT1 A 0 A_SetScale (frandom(0.25, 1.35))
      TNT1 A 0 A_ScaleVelocity (frandom (0.5, 1.5))
   Spawn2:
      GAUX BBBBBBB 1 Bright A_FadeTo(0, frandom(0.02,0.08), 1)
      GAUX CCCCCC 1 Bright A_FadeTo(0, frandom(0.02,0.08), 1)
      GAUX DDDDD 1 Bright A_FadeTo(0, frandom(0.02,0.08), 1)
      GAUX EEEE 1 Bright A_FadeTo(0, frandom(0.02,0.08), 1)
      Stop
   }
}

//-------------------------------------------------------------------
//		MECHANICS

Actor RLGaussRifleSelected : RLPermanentInventory {}
Actor RLGaussRifleZoom : RLPermanentInventory {}

Actor RLGaussRifleCharge : Ammo
{
   +INVENTORY.UNTOSSABLE
   +INVENTORY.IGNORESKILL
   Inventory.MaxAmount 100
   Inventory.Icon STTPRCNT
}

ACTOR RLGaussRifleClip : Ammo
{
   +INVENTORY.IGNORESKILL
   Inventory.MaxAmount 1
   Inventory.Icon ""
}

//-------------------------------------------------------------------
//		PICKUPS

ACTOR RLGaussRiflePickup : RLMasterAssembledWeaponPickup
{
	//$Sprite GAUSX0
	Tag "Gauss Rifle [Pickup]"
	States
	{
	SpawnFrame:
		GAUS X 4
		"####" "#" 0 A_Jump(256, "SpawnLoop")
		Goto SpawnLoop
	SpawnLoop:
		"####" "#" 0 A_JumpIf(Abs(VelZ) <= 0.01 && user_floorhit == 0, "FloorHit")
		"####" "#" 1
		Loop
	FloorHit:
		"####" "#" 0 A_PlaySound("weapons/gundropbig")
		"####" "#" 0 A_ScaleVelocity (0.25)
		"####" "#" 0 A_ChangeFlag("SPECIAL", true)
		"####" "#" 0 A_ChangeFlag("THRUACTORS", false)
		"####" "#" 0 A_SetUserVar("user_floorhit", 1)
		"####" "#" 0 A_Jump(256, "SpawnLoop")
		Stop
	Pickup:
		"####" "#" 0
		"####" "#" 0 A_JumpIfInventory("RLGaussRifle",1,"NotPickup") // If the player already has this weapon, they are not given the weapon
		"####" "#" 0 A_JumpIfInventory("RLWeaponLimit",0,"NotPickupLimit") // The absolute max limit check for weapons
		"####" "#" 0 A_Jump(256, "GiveWeapon")
		Goto GiveWeapon
	GiveWeapon:
		"####" "#" 0 A_GiveInventory("RLGaussRifle",1)
		"####" "#" 0 A_GiveInventory("RLWeaponLimit",1)
		"####" "#" 0 A_Print("\ccPicked up a \cvGauss Rifle.")
		Goto PickupSound
	NotPickupLimit:
		"####" "#" 0 A_Jump(256, "NotPickup")
		Goto NotPickup
	NotPickup:
		"####" "#" 0 A_JumpIfInventory("DRLA_WeaponAntiLogFloodCheck",1,"NotPickup_NoPrint")
		"####" "#" 0 A_GiveInventory("DRLA_WeaponAntiLogFloodCheck")
		"####" "#" 0 A_Print("\cv= Gauss Rifle =", 2, "CONFONT")
		Goto NotPickup_NoPrint
	NotPickup_NoPrint:
		"####" "#" 0
		Fail
	PickupSound:
		"####" "#" 0 A_PlaySound("weapons/GaussRiflepickup")
		Stop
//==============================================================================
	MarathonStuff:
		"####" "#" 0 A_SpawnItemEx("RLMarathonGrenades",0,0,0, 0,0,0, 0,SXF_NOCHECKPOSITION)
		Stop
	SuperweaponStuff:
		"####" "#" 0 A_Jump(256, "NoSpecialStartsStuff")
		Goto NoSpecialStartsStuff
	}
}

ACTOR RLGaussRifleWorldSpawnPickup : RLGaussRiflePickup 17840
{
	States
	{
	NoSpecialStartsStuff:
		TNT1 A 0 A_JumpIf(CallACS("DRLA_opengl"), 3) // If enabled, rarity beam will be cyan, rather than blue
		TNT1 A 0 A_SpawnItemEx("RLRarityBeamAssembledWorld", 0, 0, 0, 0, 0, 0, 0, SXF_SETMASTER)
		TNT1 A 0 A_Jump(256,2)
		TNT1 A 0 A_SpawnItemEx("RLRarityBeamAssembledWorldDRPG", 0, 0, 0, 0, 0, 0, 0, SXF_SETMASTER)
		TNT1 A 0 A_JumpIf(CallACS("DRPGCheckTiem"), "DRPGInit")
	SpawnFrame:
		GAUS X 4
		"####" "#" 0 A_GiveInventory("RLMasterItemSpawnMessageSender",1)
		"####" "#" 0 A_PlaySound("weapons/masterspawned", 7, 0.25, 0, 0)
		"####" "#" 0 A_Jump(256, "SpawnLoop")
		Goto SpawnLoop
		
	GiveWeapon:
		"####" "#" 0 A_GiveInventory("RLGaussRifle",1)
		"####" "#" 0 A_GiveInventory("RLWeaponLimit",1)
		"####" "#" 0 A_Print("\ccPicked up a \cvGauss Rifle.")
		"####" "#" 0 A_GiveInventory("RLDangerLevelMasterGiver",1, AAPTR_PLAYER1)
		Goto PickupSound
	}
}
