
ACTOR RLDemolitionAmmoMinigun : RLWeapon
{
  Obituary "%o was transformed into a fine spray by %k's minigun."
  Decal RevenantScorch
  Tag "Demolition Ammo Minigun"
  Weapon.SelectionOrder 25
  Weapon.SlotNumber 5
  Weapon.AmmoUse1 1
  Weapon.AmmoGive1 0
  Weapon.AmmoType1 "RLDemolitionAmmoMinigunClip"
  Weapon.AmmoType2 "Clip"
  Inventory.Icon "DMINICON"
  States
  {
  Ready:
	TNT1 A 0 A_JumpIfInventory("RLMisfireSpamPreventionCooldown",1,"MisfirePrevention")
	TNT1 A 0 A_TakeInventory("RLDemolitionAmmoMinigunState",1)
    DMIN A 1 A_WeaponReady (WRF_ALLOWZOOM | WRF_ALLOWRELOAD)
	Goto Ready+2
	
  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_StopSound (CHAN_WEAPON)
	TNT1 A 0 A_StopSound (7)
	TNT1 A 0 A_StopSound (6)
	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("RLDemolitionAmmoMinigunPickup", 0, 0, 40, 10, 0, 0, 0, SXF_SETMASTER)
	TNT1 A 0 A_GiveInventory("RLRarityTokenRemover", 1)
	TNT1 A 0 A_TakeInventory("RLDemolitionAmmoMinigunSelected", 1)
	TNT1 A 0 A_TakeInventory("RLWeaponLimit",1)
	TNT1 A 1 A_TakeInventory("RLDemolitionAmmoMinigun",1)
	Stop
	
  AfterModDrop:
    DMIN A 8 A_WeaponReady (16)
    Goto Ready
  MisfirePrevention:
    DMIN A 1 A_WeaponReady (WRF_NOFIRE | WRF_NOBOB)
    TNT1 A 0 A_JumpIfInventory("RLMisfireSpamPreventionCooldown", 1, "MisfirePrevention")
    Goto Ready
	
  Deselect:
	TNT1 A 0
    TNT1 A 0 A_ClearReFire
	TNT1 A 0 A_StopSound (CHAN_WEAPON)
	TNT1 A 0 A_StopSound (7)
	TNT1 A 0 A_StopSound (6)
	TNT1 A 0 A_GiveInventory("RLDeselectionFunction",1)
	TNT1 A 0 A_TakeInventory("RLDemolitionAmmoMinigunSelected", 1)
	TNT1 A 0 A_GiveInventory("RLRarityTokenRemover", 1)
	TNT1 A 0 A_TakeInventory("PowerRLTechnicianMasterDamage", 1)
  DeselectLoop:
    TNT1 A 0 A_JumpIfInventory("RLShellshockPerk", 1, "DeselectRenegade")
    DMIN 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("RLRapidfireTypeWeapon", 1)
	TNT1 A 0 A_GiveInventory("RLAssembledWeaponToken", 1)
	TNT1 A 0 A_GiveInventory("RLDemolitionAmmoMinigunSelected", 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")
    DMIN A 1 A_Raise
    Loop
	
  Fire:
	DMIN A 0 A_JumpIfInventory("RLRestrictionMeleeOnly",1,"MeleeRestricted") // Cannot fire in levels that restrict it
	DMIN A 0 A_JumpIfInventory("RLRestrictionSilencedOnly",1,"SilencedRestricted") // Cannot fire in levels that restrict it
	DMIN A 0 A_JumpIfInventory("RLRestrictionNoBoom",1,"NoBoomRestricted") // Cannot fire in levels that restrict it
	DMIN A 0 A_JumpIfInventory("RLRestrictionHighTechOnly",1,"HighTechRestricted") // Cannot fire in levels that restrict it
	DMIN A 0 A_JumpIfInventory("RLRestrictionCunningOnly",1,"CunningRestricted") // Cannot fire in levels that restrict it
	
	TNT1 A 0 A_JumpIfNoAmmo("Reload")
  FireWindUp:
	TNT1 A 0 A_JumpIfInventory("RLAmmochainPerk",1,"FireStartPowerupCheck") // Check for powerups.
  FireStartPowerupCheckDone: // No valid powerups detected.
	DMIN B 4 A_PlaySound("weapons/demominigunwindup", 6, 1, 0, 1.8)
	DMIN CD 3
	DMIN AB 3
	DMIN CD 2
	DMIN ABCD 1
    Goto FireStart
  FireWindUp1:
	DMIN B 3 A_PlaySound("weapons/demominigunwindup", 6, 1, 0, 1.8)
	DMIN CD 2
	DMIN AB 2
	DMIN CD 1
    Goto FireStart
  Hold:
	TNT1 A 0 A_JumpIfNoAmmo("Reload")
  FireStart:
    TNT1 A 0 A_PlaySound("weapons/demominigunspin", 6, 1, 1, 1.8)
	TNT1 A 0 A_AlertMonsters
	TNT1 A 0 A_JumpIfInventory("RLDemolitionAmmoMinigunAmmochain",0,2)
	TNT1 A 0 A_JumpIfInventory("RLAmmochainPerk",1,2)
	TNT1 A 0 A_FireBullets (6, 2, -1, 5, "RLDemoMinigunPuff")
    Goto FireFinish
	TNT1 A 0 A_FireBullets (6, 2, -1, 5, "RLDemoMinigunPuff", 0)
    Goto FireFinish
  FireFinish:
    TNT1 A 0 A_SpawnItemEx ("RLMinigunRecoil", 0,0,0, 0,0,0, 0, SXF_NOCHECKPOSITION | SXF_SETMASTER) // Pitch-based recoil
	TNT1 A 0 A_JumpIfInventory("RLDemolitionAmmoMinigunState",1,"FireState")
    TNT1 A 0 A_PlaySound("weapons/demominigun", CHAN_WEAPON, 1, 1, 0.7)
    TNT1 A 0 A_PlaySound("weapons/demominigun", 7, 0.05, 1, 0.20)
    DMIN E 1 Bright A_GunFlash
	TNT1 A 0 A_GiveInventory("RLDemolitionAmmoMinigunState",1)
    Goto FireFinishContinue
  FireState:
    DMIN F 1 Bright A_GunFlash
	TNT1 A 0 A_TakeInventory("RLDemolitionAmmoMinigunState",1)
    Goto FireFinishContinue
	
  FireFinishContinue:
	TNT1 A 0 A_JumpIfInventory("RLDemolitionAmmoMinigunAmmochain",0,2)
	TNT1 A 0 A_Jump(256,3)
	TNT1 A 0 A_TakeInventory("RLDemolitionAmmoMinigunAmmochain",0)
    TNT1 A 0 A_ReFire
    Goto WindDownMain
	TNT1 A 0 A_GiveInventory("RLDemolitionAmmoMinigunAmmochain",1)
    TNT1 A 0 A_ReFire
    Goto WindDownMain

//-------------------------------------------------------------------------------------------------
  FireStartPowerupCheck: // Marine fires one Firestorm's worth faster while affected by powerups.
	TNT1 A 0 A_JumpIfInventory("PowerInvulnerable",1,"FireStartPowerupCheckConfirmed")
	TNT1 A 0 A_JumpIfInventory("PowerInvisibility",1,"FireStartPowerupCheckConfirmed")
	TNT1 A 0 A_JumpIfInventory("PowerIronFeet",1,"FireStartPowerupCheckConfirmed")
	TNT1 A 0 A_JumpIfInventory("PowerLightAmp",1,"FireStartPowerupCheckConfirmed")
	TNT1 A 0 A_JumpIfInventory("PowerInfiniteAmmo",1,"FireStartPowerupCheckConfirmed")
	TNT1 A 0 A_JumpIfInventory("PowerDrain",1,"FireStartPowerupCheckConfirmed")
	TNT1 A 0 A_JumpIfInventory("PowerRLBerserkResistance",1,"FireStartPowerupCheckConfirmed")
	Goto FireStartPowerupCheckDone
  FireStartPowerupCheckConfirmed:
	TNT1 A 0
	Goto FireWindUp1
	
  FireFinishPowerupCheck: // Marine fires one Firestorm's worth faster while affected by powerups.
	TNT1 A 0 A_JumpIfInventory("PowerInvulnerable",1,"FireFinishPowerupCheckConfirmed")
	TNT1 A 0 A_JumpIfInventory("PowerInvisibility",1,"FireFinishPowerupCheckConfirmed")
	TNT1 A 0 A_JumpIfInventory("PowerIronFeet",1,"FireFinishPowerupCheckConfirmed")
	TNT1 A 0 A_JumpIfInventory("PowerLightAmp",1,"FireFinishPowerupCheckConfirmed")
	TNT1 A 0 A_JumpIfInventory("PowerInfiniteAmmo",1,"FireFinishPowerupCheckConfirmed")
	TNT1 A 0 A_JumpIfInventory("PowerDrain",1,"FireFinishPowerupCheckConfirmed")
	TNT1 A 0 A_JumpIfInventory("PowerRLBerserkResistance",1,"FireFinishPowerupCheckConfirmed")
	Goto FireFinishPowerupCheckDone
  FireFinishPowerupCheckConfirmed:
	TNT1 A 0
	Goto WindDown1
	
  FireFinishPowerupCheck2: // Marine fires one Firestorm's worth faster while affected by powerups.
	TNT1 A 0 A_JumpIfInventory("PowerInvulnerable",1,"FireFinishPowerupCheckConfirmed2")
	TNT1 A 0 A_JumpIfInventory("PowerInvisibility",1,"FireFinishPowerupCheckConfirmed2")
	TNT1 A 0 A_JumpIfInventory("PowerIronFeet",1,"FireFinishPowerupCheckConfirmed2")
	TNT1 A 0 A_JumpIfInventory("PowerLightAmp",1,"FireFinishPowerupCheckConfirmed2")
	TNT1 A 0 A_JumpIfInventory("PowerInfiniteAmmo",1,"FireFinishPowerupCheckConfirmed2")
	TNT1 A 0 A_JumpIfInventory("PowerDrain",1,"FireFinishPowerupCheckConfirmed2")
	TNT1 A 0 A_JumpIfInventory("PowerRLBerserkResistance",1,"FireFinishPowerupCheckConfirmed2")
	Goto FireFinishPowerupCheckDone2
  FireFinishPowerupCheckConfirmed2:
	TNT1 A 0
	Goto WindDown2
	
//-------------------------------------------------------------------------------------------------
	
  WindDownMain:
	TNT1 A 0 A_StopSound (CHAN_WEAPON)
	TNT1 A 0 A_StopSound (7)
	TNT1 A 0 A_PlaySound("weapons/demominigunwinddown", 6, 1, 0, 1.8)
  WindDownMain2:
	TNT1 A 0 A_JumpIfInventory("RLAmmochainPerk",1,"FireFinishPowerupCheck") // Check for powerups.
  FireFinishPowerupCheckDone: // No valid powerups detected.
	TNT1 A 0 A_JumpIfNoAmmo("WinddownNoAmmo")
	DMIN I 1
	DMIN I 1 A_JumpIfInventory("RLSynthFireLeft",1,"WinddownContinueA")
	DMIN JJ 1 A_JumpIfInventory("RLSynthFireLeft",1,"WinddownContinueB")
	DMIN KK 1 A_JumpIfInventory("RLSynthFireLeft",1,"WinddownContinueC")
	DMIN LL 1 A_JumpIfInventory("RLSynthFireLeft",1,"WinddownContinueD")
	DMIN AAA 1 A_JumpIfInventory("RLSynthFireLeft",1,"WinddownContinueA")
	DMIN BBB 1 A_JumpIfInventory("RLSynthFireLeft",1,"WinddownContinueB")
	DMIN CCC 1 A_JumpIfInventory("RLSynthFireLeft",1,"WinddownContinueC")
	DMIN DDD 1 A_JumpIfInventory("RLSynthFireLeft",1,"WinddownContinueD")
	DMIN AAAA 1 A_JumpIfInventory("RLSynthFireLeft",1,"WinddownContinueA")
	DMIN BBBB 1 A_JumpIfInventory("RLSynthFireLeft",1,"WinddownContinueB")
	DMIN CCCC 1 A_JumpIfInventory("RLSynthFireLeft",1,"WinddownContinueC")
	DMIN DDDD 1 A_JumpIfInventory("RLSynthFireLeft",1,"WinddownContinueD")
	Goto Ready
  WindDownNoAmmo:
	DMIN IJKL 2
	DMIN ABCD 3
	DMIN ABCD 4
	Goto Ready
  WindDown1:
	TNT1 A 0 A_JumpIfNoAmmo("Winddown1NoAmmo")
	DMIN I 1
	DMIN J 1 A_JumpIfInventory("RLSynthFireLeft",1,"WinddownContinueB")
	DMIN K 1 A_JumpIfInventory("RLSynthFireLeft",1,"WinddownContinueC")
	DMIN L 1 A_JumpIfInventory("RLSynthFireLeft",1,"WinddownContinueD")
	DMIN AA 1 A_JumpIfInventory("RLSynthFireLeft",1,"WinddownContinueA")
	DMIN BB 1 A_JumpIfInventory("RLSynthFireLeft",1,"WinddownContinueB")
	DMIN CC 1 A_JumpIfInventory("RLSynthFireLeft",1,"WinddownContinueC")
	DMIN DD 1 A_JumpIfInventory("RLSynthFireLeft",1,"WinddownContinueD")
	Goto Ready
  WindDown1NoAmmo:
	DMIN IJKL 1
	DMIN ABCD 2
	Goto Ready
	
  WindDownMain2:
	TNT1 A 0 A_PlaySound("weapons/demominigunwinddown2", 6, 1, 0, 1.8)
	TNT1 A 0 A_JumpIfInventory("RLAmmochainPerk",1,"FireFinishPowerupCheck2") // Check for powerups.
  FireFinishPowerupCheckDone2: // No valid powerups detected.
	TNT1 A 0 A_JumpIfNoAmmo("Winddown3NoAmmo")
	DMIN A 1
	DMIN A 1 A_JumpIfInventory("RLSynthFireLeft",1,"WinddownContinueA")
	DMIN BB 1 A_JumpIfInventory("RLSynthFireLeft",1,"WinddownContinueB")
	DMIN CC 1 A_JumpIfInventory("RLSynthFireLeft",1,"WinddownContinueC")
	DMIN DD 1 A_JumpIfInventory("RLSynthFireLeft",1,"WinddownContinueD")
	DMIN AAA 1 A_JumpIfInventory("RLSynthFireLeft",1,"WinddownContinueA")
	DMIN BBB 1 A_JumpIfInventory("RLSynthFireLeft",1,"WinddownContinueB")
	DMIN CCC 1 A_JumpIfInventory("RLSynthFireLeft",1,"WinddownContinueC")
	DMIN DDD 1 A_JumpIfInventory("RLSynthFireLeft",1,"WinddownContinueD")
	DMIN AAAA 1 A_JumpIfInventory("RLSynthFireLeft",1,"WinddownContinueA")
	DMIN BBBB 1 A_JumpIfInventory("RLSynthFireLeft",1,"WinddownContinueB")
	DMIN CCCC 1 A_JumpIfInventory("RLSynthFireLeft",1,"WinddownContinueC")
	DMIN DDDD 1 A_JumpIfInventory("RLSynthFireLeft",1,"WinddownContinueD")
	Goto Ready
  WindDown3NoAmmo:
	DMIN ABCD 2
	DMIN ABCD 3
	DMIN ABCD 4
	Goto Ready
  WindDown2:
	TNT1 A 0 A_JumpIfNoAmmo("Winddown4NoAmmo")
	DMIN A 1
	DMIN B 1 A_JumpIfInventory("RLSynthFireLeft",1,"WinddownContinueB")
	DMIN C 1 A_JumpIfInventory("RLSynthFireLeft",1,"WinddownContinueC")
	DMIN D 1 A_JumpIfInventory("RLSynthFireLeft",1,"WinddownContinueD")
	DMIN AA 1 A_JumpIfInventory("RLSynthFireLeft",1,"WinddownContinueA")
	DMIN BB 1 A_JumpIfInventory("RLSynthFireLeft",1,"WinddownContinueB")
	DMIN CC 1 A_JumpIfInventory("RLSynthFireLeft",1,"WinddownContinueC")
	DMIN DD 1 A_JumpIfInventory("RLSynthFireLeft",1,"WinddownContinueD")
	Goto Ready
  WindDown4NoAmmo:
	DMIN ABCD 1
	DMIN ABCD 2
	Goto Ready
	
  WinddownContinueA:
	DMIN ABCD 1
	TNT1 A 0 A_JumpIfInventory("RLSynthFireLeft",1,"Hold")
    Goto WinddownMain2
  WinddownContinueB:
	DMIN BCD 1
	TNT1 A 0 A_JumpIfInventory("RLSynthFireLeft",1,"Hold")
    Goto WinddownMain2
  WinddownContinueC:
	DMIN CD 1
	TNT1 A 0 A_JumpIfInventory("RLSynthFireLeft",1,"Hold")
    Goto WinddownMain2
  WinddownContinueD:
	DMIN D 1
	TNT1 A 0 A_JumpIfInventory("RLSynthFireLeft",1,"Hold")
    Goto WinddownMain2
	
  Reload:
    TNT1 A 0 A_ClearReFire
	TNT1 A 0 A_StopSound (CHAN_WEAPON)
	TNT1 A 0 A_StopSound (7)
	TNT1 A 0 A_StopSound (6)
	DMIN A 1 A_WeaponReady (WRF_NOPRIMARY | WRF_ALLOWZOOM)
	TNT1 A 0 A_JumpIfInventory("RLDemolitionAmmoMinigunClip", 200, "Ready")
	TNT1 A 0 A_JumpIfInventory("Clip", 1, 1)
	Goto Ready
	TNT1 A 0 // Play the reload animation.
	TNT1 A 0 A_StopSound(6)
    DMIN M 2
    DMIN N 2
    DMIN O 2
    DMIN P 2
    DMIN Q 2
    DMIN R 3
    TNT1 A 0 A_PlaySound("weapons/demominigununload", CHAN_ITEM)
    TNT1 A 0 A_SpawnItemEx ("RLHeavyReloadOutRecoil", 0,0,0, 0,0,0, 0, SXF_NOCHECKPOSITION | SXF_SETMASTER) // Pitch-based recoil
    TNT1 A 44
	Goto ReloadWorking
  ReloadWorking:
	TNT1 A 0 A_TakeInventory("Clip", 1)
	TNT1 A 0 A_GiveInventory("RLDemolitionAmmoMinigunClip", 1)
	TNT1 A 0 A_JumpIfInventory("RLDemolitionAmmoMinigunClip",200, "ReloadFinish")
	TNT1 A 0 A_JumpIfInventory("Clip",1,"ReloadWorking")
	Goto ReloadFinish
  ReloadFinish:
    TNT1 A 0 A_PlaySound("weapons/demominigunload", 7)
    TNT1 A 0 A_SpawnItemEx ("RLHeavyReloadOutRecoil", 0,0,0, 0,0,0, 0, SXF_NOCHECKPOSITION | SXF_SETMASTER) // Pitch-based recoil
    TNT1 A 8
    DMIN R 3
    DMIN Q 2
    DMIN P 2
    DMIN O 2
    DMIN N 2
    DMIN M 2
	Goto ReloadSpin
  ReloadSpin:
	TNT1 A 0 A_PlaySound("weapons/demominigunwinddown2", 6)
	TNT1 A 0 A_JumpIfNoAmmo("ReloadSpinNoAmmo")
	DMIN AAA 1 A_JumpIfInventory("RLSynthFireLeft",1,"WinddownContinueA")
	DMIN BBB 1 A_JumpIfInventory("RLSynthFireLeft",1,"WinddownContinueB")
	DMIN CCC 1 A_JumpIfInventory("RLSynthFireLeft",1,"WinddownContinueC")
	DMIN DDD 1 A_JumpIfInventory("RLSynthFireLeft",1,"WinddownContinueD")
	DMIN AAAA 1 A_JumpIfInventory("RLSynthFireLeft",1,"WinddownContinueA")
	DMIN BBBB 1 A_JumpIfInventory("RLSynthFireLeft",1,"WinddownContinueB")
	DMIN CCCCC 1 A_JumpIfInventory("RLSynthFireLeft",1,"WinddownContinueC")
	DMIN DDDDD 1 A_JumpIfInventory("RLSynthFireLeft",1,"WinddownContinueD")
	Goto Ready
  ReloadSpinNoAmmo:
	DMIN A 3
	DMIN B 3
	DMIN C 3
	DMIN D 4
	DMIN A 4
	DMIN B 4
	DMIN C 5
	DMIN D 5
	Goto Ready
	
  Flash:
	TNT1 A 0 A_JumpIfInventory("RLDemolitionAmmoMinigunState",1,2)
    TNT1 A 1 A_Light2
    Goto LightDone
    TNT1 A 1 A_Light1
    Goto LightDone
	
  Spawn:
	TNT1 A 0 NoDelay A_SpawnItemEx("RLDemolitionAmmoMinigunPickup",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")
	Goto Ready
  ScavengerTime:
	TNT1 A 0 A_GiveInventory("RLScavengingExtraEffects", 1)
    TNT1 A 0 A_GiveInventory("RLDemolitionAmmoAssemblyLearntToken", 1) // Assembly is now listed in the HUD menus
	TNT1 A 0 A_Print("Mod pack extracted from discarded weapon.")
	TNT1 A 0 A_StopSound(6)
	TNT1 A 0 A_TakeInventory("RLScavengerDrop",1)
	TNT1 A 0 A_GiveInventory("RLRarityTokenRemover", 1)
	TNT1 A 0 A_TakeInventory("RLDemolitionAmmoMinigunSelected", 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("DroppedRLTechnicalMod",0,0,0)
	Goto ScavengerTimeEnd
	TNT1 A 0 A_FireCustomMissile("DroppedRLTechnicalMod",0,0,0)
	Goto ScavengerTimeEnd
	TNT1 A 0 A_FireCustomMissile("DroppedRLFirestormMod",0,0,0)
	Goto ScavengerTimeEnd
  ScavengerTimeEnd:
	TNT1 A 1 A_TakeInventory("RLDemolitionAmmoMinigun",1)
	Stop
  }
}

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

ACTOR RLDemoMinigunPuff : RLDemoPuffBase
{
	Scale 0.6
	States
	{
		Spawn:
			TNT1 A 0
			TNT1 A 0 A_GiveToTarget ("RLFireangelBonusCheck", 1)
			TNT1 A 0 A_RadiusGive ("RLFireangelRadiusBonusCheck", 6, RGF_PLAYERS)
			TNT1 A 0 A_JumpIf(CallACS("DRLA_QuakeNShake") == 0, 3)
			TNT1 A 0 A_Quake (1, 8, 0, 128, "")
			TNT1 A 0 A_Quake (3, 8, 0, 32, "")
			TNT1 A 0 A_PlaySound ("weapons/bulletexp", 7, 0.3, 0, 0.7)
			TNT1 A 0 A_PlaySound("weapons/bulletexp", CHAN_ITEM, 0.05, 0, 0.05)
			//TNT1 A 0 A_Explode (8, 6, 1, 1, 6)
			TNT1 A 0 A_Explode (10, 64, 1, 1, 64) // New experimental damage calculation
			Goto RLDemoPuffBase::Spawn.Normal
	}
}

//==============================================================================
//DEMOLITION AMMO FUN CHART OF MATHING
//SIDDOYLE IS A MATH FRISBEE
//==============================================================================
//					Firerate	Mag		Exp DMG		Exp DPS		Avg DMG		DPS		Ammo Eff.	Total DPS
//Pistol			14			6		77.33		193.325		12			30		5			223.325
//Chaingun			4			40		20.43		178.763		12			105		2.625		283.763
//Battle Rifle		4			20		25.43		222.513		10			87.5	4.375		310.013
//Uzi				3			32		18.82		219.567		8			93.333	2.917		312.9
//Minigun			1			200		7.86		275.1 		10			350		1.75		625.1
//Combat Pistol		10			15		45.9		160.65		14			49		3.267		209.65
//Marksman Pistol	13			10		61.14		164.608		12			32.308	3.231		196.916
//Handcannon		19			7		86.86		160.005		32			58.947	8.421		218.952
//==============================================================================

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

Actor RLDemolitionAmmoMinigunSelected : RLPermanentInventory {}
Actor RLDemolitionAmmoMinigunState : RLPermanentInventory {}
Actor RLDemolitionAmmoMinigunAmmochain : RLAmmochainDefault {}

ACTOR RLDemolitionAmmoMinigunClip : Ammo
{
   +INVENTORY.IGNORESKILL
   Inventory.MaxAmount 200
   Inventory.Icon ""
}

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

ACTOR RLDemolitionAmmoMinigunPickup : RLMasterAssembledWeaponPickup
{
	//$Sprite DMINX0
	Tag "Demolition Ammo Minigun [Pickup]"
	States
	{
	SpawnFrame:
		DMIN 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("RLDemolitionAmmoMinigun",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("RLDemolitionAmmoMinigun",1)
		"####" "#" 0 A_GiveInventory("RLWeaponLimit",1)
		"####" "#" 0 A_Print("\ccPicked up a \cvDemolition Ammo Minigun.")
		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= Demolition Ammo Minigun =", 2, "CONFONT")
		Goto NotPickup_NoPrint
	NotPickup_NoPrint:
		"####" "#" 0
		Fail
	PickupSound:
		"####" "#" 0 A_PlaySound("weapons/DemoMinigunpickup")
		Stop
//==============================================================================
	MarathonStuff:
		"####" "#" 0 A_SpawnItemEx("RLMarathonClip",0,0,0, 0,0,0, 0,SXF_NOCHECKPOSITION)
		Stop
	SuperweaponStuff:
		"####" "#" 0 A_Jump(256, "NoSpecialStartsStuff")
		Goto NoSpecialStartsStuff
	}
}

ACTOR RLDemolitionAmmoMinigunWorldSpawnPickup : RLDemolitionAmmoMinigunPickup 17827
{
	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:
		DMIN 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("RLDemolitionAmmoMinigun",1)
		"####" "#" 0 A_GiveInventory("RLWeaponLimit",1)
		"####" "#" 0 A_Print("\ccPicked up a \cvDemolition Ammo Minigun.")
		"####" "#" 0 A_GiveInventory("RLDangerLevelMasterGiver",1, AAPTR_PLAYER1)
		Goto PickupSound
	}
}
