
// This weapon was created by amv2k9, and it emits spiders.
// You secretly always wanted an smg that emits spiders, and he has fulfilled this deep desire of yours.
// Praise be unto amv2k9

// (i totally didnt butcher it nosiree)

ACTOR RLWidowmakerSMG : RLWeapon
{
  Inventory.Pickupsound "weapons/unique"
  Obituary "%o felt the fatal bite of %k's Widowmaker SMG."
  Decal BulletChip
  Tag "Widowmaker SMG"
  Weapon.SelectionOrder 25
  Weapon.SlotNumber 4
  Weapon.AmmoUse1 1
  Weapon.AmmoGive1 0
  Weapon.AmmoType1 "RLWidowmakerSMGClip"
  Weapon.AmmoType2 "Clip"
  Inventory.Icon "WSMGICON"
  States
  {
				 // DAMMIT RENEGADE STOP BREAKING THINGS
				 // This 1-tic frame is necessary because APPARENTLY, if a
				 // weapon's Select state is 0 tics long, a call to A_GunFlash
				 // made on the first tic of the Ready state will be IGNORED the
				 // first time the state runs. Once the weapon enters another
				 // state, the A_GunFlash call will be executed as normal...
				 // until you deselect and reselect the weapon, at which point
				 // the problem will rear its ugly stupid head again.
				 // Fortunately, it doesn't really create any visual issues, as
				 // Goto Ready+1 can be used to skip the frame when the weapon
				 // is ending other states and returning to Ready.
				 //												- amv2k9
				 
				 // Hahaha, amv2k9's jimmies are rustled
				 // Mine were too when I was implementing the synthfire stuff, heh
				 //												- Yholl
	Ready:
		TNT1 A 0 A_JumpIfInventory("RLMisfireSpamPreventionCooldown",1,"MisfirePrevention")
		TNT1 A 0 A_PlaySound("misc/static",6, 1, 1, 1.8)
		TNT1 A 0 A_GunFlash("Flash_Static",GFF_NOEXTCHANGE)
		TNT1 A 0 A_Jump(256, 1,2,3,4,5,6)
		WSMG YZYZYZYZ 1 A_WeaponReady(WRF_NOFIRE)
		TNT1 A 0 A_GunFlash("FlashClear",GFF_NOEXTCHANGE)
		TNT1 A 0 A_StopSound(6)
	ReadyDisplay:
		TNT1 A 0 A_GunFlash("Flash_ReadyDisplay",GFF_NOEXTCHANGE)
		// The Widowmaker (ab)uses the Flash state to show what the active 
		// altfire is; whenever you see an A_GunFlash call that points towards a
		// state whose name ends in 'Display', that's why. What sprites will be 
		// shown is determined down in the respective Flash state so that 
		// there's less code up here.
	ReadyLoop:
		TNT1 A 0 A_StopSound(6)
		WSMG A 1 A_WeaponReady(WRF_ALLOWZOOM | WRF_ALLOWRELOAD)
		Goto ReadyLoop+1
  ReadyNoReload:
    WSMG A 1 A_WeaponReady (WRF_ALLOWZOOM | WRF_NOSECONDARY)
    Goto ReadyDisplay
  ReadyNoReloadLong:
    WSMG AAAAAAAAA 1 A_WeaponReady (WRF_ALLOWZOOM | WRF_NOSECONDARY)
    Goto ReadyDisplay
	
  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_StopSound(6)
	TNT1 A 0 A_JumpIfInventory("RLWidowmakerSMGModLimit", 1, "WeaponDropModded")
	TNT1 A 0 A_SpawnItemEx("RLWidowmakerSMGPickup", 0, 0, 40, 12, 0, 0, 0, SXF_SETMASTER)
	Goto WeaponDropRemoval
  WeaponDropModded:
	TNT1 A 2 A_SpawnItemEx("RLWidowmakerSMGPickupModded", 0, 0, 40, 12, 0, 0, 0, SXF_SETMASTER)
  WeaponDropRemoval:
    TNT1 A 0 A_TakeInventory("RLWidowmakerSMGModLimit", 3)
    TNT1 A 0 A_TakeInventory("RLWidowmakerSMGSniperMod", 1)
    TNT1 A 0 A_TakeInventory("RLWidowmakerSMGFirestormMod", 1)
    TNT1 A 0 A_TakeInventory("RLWidowmakerSMGNanoMod", 1)
	TNT1 A 0 A_GiveInventory("RLRarityTokenRemover", 1)
	TNT1 A 0 A_TakeInventory("RLWidowmakerSMGSelected", 1)
	TNT1 A 0 A_TakeInventory("RLWeaponLimit",1)
	TNT1 A 1 A_TakeInventory("RLWidowmakerSMG",1)
	Stop
	
  AfterModDrop:
    WSMG A 8 A_WeaponReady (WRF_NOSECONDARY | WRF_ALLOWRELOAD)
    Goto ReadyDisplay
  MisfirePrevention:
	TNT1 A 0 A_PlaySound("misc/static",6, 1, 1, 1.8)
	TNT1 A 0 A_GunFlash("Flash_Static",GFF_NOEXTCHANGE)
	WSMG YZ 1 A_WeaponReady(WRF_NOFIRE)
    TNT1 A 0 A_JumpIfInventory("RLMisfireSpamPreventionCooldown", 1, "MisfirePrevention")
	TNT1 A 0 A_GunFlash("FlashClear",GFF_NOEXTCHANGE)
	TNT1 A 0 A_StopSound(6)
    Goto ReadyDisplay
	
  Deselect:
	TNT1 A 0
	TNT1 A 0 A_GiveInventory("RLDeselectionFunction",1)
	TNT1 A 0 A_TakeInventory("RLWidowmakerSMGSelected", 1)
	TNT1 A 0 A_GiveInventory("RLRarityTokenRemover", 1)
  DeselectLoop:
    TNT1 A 0 A_JumpIfInventory("RLShellshockPerk", 1, "DeselectRenegade")
    TNT1 A 0 A_Lower
    WSMG A 1 A_Lower
    Goto DeselectLoop
  DeselectRenegade:
    TNT1 A 0 A_Lower
    loop
  SelectRenegade: 
    TNT1 A 0 A_Raise
    loop
  SelectSetWeapon:
	TNT1 A 0 A_GiveInventory("RLRapidfireTypeWeapon", 1)
	TNT1 A 0 A_GiveInventory("RLEfficientAmmoTypeWeapon", 1)
	TNT1 A 0 A_GiveInventory("RLMultiAmmoWeapon", 1)
	TNT1 A 0 A_GiveInventory("RLUniqueWeaponToken", 1)
	TNT1 A 0 A_GiveInventory("RLWidowmakerSMGSelected", 1)
	TNT1 A 0 A_TakeInventory("RLWidowmakerSMGSniperAltActive", 1)
	TNT1 A 0 A_TakeInventory("RLWidowmakerSMGFirestormAltActive", 1)
	TNT1 A 0 A_TakeInventory("RLWidowmakerSMGNanoAltActive", 1)
    Goto SelectLoop
  SelectLoop:
    TNT1 A 0 A_JumpIfInventory("RLShellshockPerk", 1, "SelectRenegade")
    TNT1 A 0 A_Raise
    WSMG A 1 A_Raise
    Loop
	
  Fire:
	WSMG A 0 A_JumpIfInventory("RLRestrictionMeleeOnly",1,"MeleeRestricted") // Cannot fire in levels that restrict it
	WSMG A 0 A_JumpIfInventory("RLRestrictionSilencedOnly",1,"SilencedRestricted") // Cannot fire in levels that restrict it
	WSMG A 0 A_JumpIfInventory("RLRestrictionBoomOnly",1,"BoomRestricted") // Cannot fire in levels that restrict it
	WSMG A 0 A_JumpIfInventory("RLRestrictionLowTechOnly",1,"LowTechRestricted") // Cannot fire in levels that restrict it
	WSMG A 0 A_JumpIfInventory("RLRestrictionCunningOnly",1,"CunningRestricted") // Cannot fire in levels that restrict it
	
	TNT1 A 0 A_JumpIfNoAmmo("Reload")
	TNT1 A 0 A_AlertMonsters
	TNT1 A 0 A_JumpIfInventory("RLWidowmakerSMGAmmochain",0,2)
	TNT1 A 0 A_JumpIfInventory("RLAmmochainPerk",1,2)
	TNT1 A 0 A_FireBullets (6, 2, -1, 7, "RLBulletPuff")
    Goto FireFinish
	TNT1 A 0 A_FireBullets (6, 2, -1, 7, "RLBulletPuff", 0)
    Goto FireFinish
  FireFinish:
    TNT1 A 0 A_SpawnItemEx ("RLThompsonRecoil", 0,0,0, 0,0,0, 0, SXF_NOCHECKPOSITION | SXF_SETMASTER) // Pitch-based recoil
    TNT1 A 0 A_PlaySound("weapons/widowmakersmg", CHAN_WEAPON, 1, 0, 0.7)
    TNT1 A 0 A_PlaySound("weapons/widowmakersmg", 7, 0.05, 0, 0.20)
	TNT1 A 0 A_JumpIfInventory("RLAmmochainPerk",1,"FireFinishPowerupCheck") // Check for powerups.
  FireFinishPowerupCheckDone: // No valid powerups detected.
    WSMG C 1 Bright A_GunFlash
    WSMG D 1 Bright
	Goto FireFinishContinue
	
  FireFinishContinue:
	TNT1 A 0 A_JumpIfInventory("RLWidowmakerSMGAmmochain",0,2)
	TNT1 A 0 A_Jump(256,3)
	TNT1 A 0 A_TakeInventory("RLWidowmakerSMGAmmochain",0)
    TNT1 A 0 A_ReFire
    Goto ReadyDisplay
	TNT1 A 0 A_GiveInventory("RLWidowmakerSMGAmmochain",1)
    TNT1 A 0 A_ReFire
    Goto ReadyDisplay

//-------------------------------------------------------------------------------------------------
  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 A_SpawnItemEx ("RLMinigunRecoil", 0,0,0, 0,0,0, 0, SXF_NOCHECKPOSITION | SXF_SETMASTER) // Pitch-based recoil
	TNT1 A 0 A_JumpIfInventory("RLWidowmakerSMGState",1,3)
	TNT1 A 0 A_GiveInventory("RLWidowmakerSMGState",1)
    WSMG C 1 Bright A_GunFlash ("FlashFF")
	Goto FireFinishContinue
	TNT1 A 0 A_TakeInventory("RLWidowmakerSMGState",1)
    WSMG D 1 Bright A_GunFlash ("FlashFF")
	Goto FireFinishContinue
//-------------------------------------------------------------------------------------------------
  
//==============================================================================
//			Copied this mostly as is, although I changed the weird
//			"change modes after reloading thing" to change modes
//			when full of ammo instead.
//==============================================================================
	Reload:
		TNT1 A 0 A_JumpIfInventory("RLWidowmakerSMGClip",32,"ChangeAltfire")
		Goto ReloadModeDetectionDone
	ReloadModeDetectionDone:
		TNT1 A 0 A_GunFlash("FlashClear",GFF_NOEXTCHANGE)
		TNT1 A 0 A_JumpIfInventory("Clip",1,"Reload_HaveAmmo")
	 Reload_NoAmmoHold:
		TNT1 A 0 A_GunFlash("Flash_AltfireNoAmmoHoldDisplay",GFF_NOEXTCHANGE)
		WSMG AAAAAAAAAAAAAAA 1 A_WeaponReady(WRF_NOPRIMARY)
		TNT1 A 0 A_ReFire("Reload_NoAmmoHold")
		Goto ReadyDisplay
	 Reload_HaveAmmo:
		WSMG A 1 A_WeaponReady(WRF_NOPRIMARY|WRF_ALLOWZOOM)
		TNT1 A 0 A_JumpIfInventory("RLWidowmakerSMGClip",32,"Ready")
		Goto ReloadStart
	 ReloadStart:
		WSMG LMNOPQ 2
		TNT1 A 0 A_PlaySound("weapons/widowmakersmgunload",CHAN_ITEM)
		TNT1 A 0 A_SpawnItemEx ("RLStandardReloadOutRecoil", 0,0,0, 0,0,0, 0, SXF_NOCHECKPOSITION | SXF_SETMASTER) // Pitch-based recoil
		WSMG RRRRRRRRRSSSSTTTUU 2
		Goto ReloadWorking
	ReloadWorking:
		TNT1 A 0 A_TakeInventory("Clip",1)
		TNT1 A 0 A_GiveInventory("RLWidowmakerSMGClip",1)
		TNT1 A 0 A_JumpIfInventory("RLWidowmakerSMGClip",32,"ReloadFinish")
		TNT1 A 0 A_JumpIfInventory("Clip",1,"ReloadWorking")
	  ReloadFinish:
		TNT1 A 0 A_PlaySound("weapons/widowmakersmgload",7)
		TNT1 A 0 A_SpawnItemEx ("RLStandardReloadInRecoil", 0,0,0, 0,0,0, 0, SXF_NOCHECKPOSITION | SXF_SETMASTER) // Pitch-based recoil
		WSMG VUTSRQPONML 2
		Goto ReadyDisplay

	// fancypants mode change tiem.
	ChangeAltfire:
		TNT1 A 0 A_JumpIfInventory("RLWidowmakerSMGSniperMod",1,"ModeSelect")
		TNT1 A 0 A_JumpIfInventory("RLWidowmakerSMGFirestormMod",1,"ModeSelect")
		TNT1 A 0 A_JumpIfInventory("RLWidowmakerSMGNanoMod",1,"ModeSelect")
		Goto ReadyNoReloadLong
	ModeChanged:
		TNT1 A 0 A_PlaySound("misc/static",6, 1, 1, 1.8)
		TNT1 A 0 A_GunFlash("Flash_Static",GFF_NOEXTCHANGE)
		TNT1 A 0 A_Jump(256, 1,2,3,4,5,6)
		WSMG YZYZYZYZ 1 A_WeaponReady(WRF_NOFIRE)
		TNT1 A 0 A_GunFlash("FlashClear",GFF_NOEXTCHANGE)
		TNT1 A 0 A_StopSound(6)
		Goto ReadyNoReloadLong
  ModeSelect:
	TNT1 A 0 A_JumpIfInventory("RLWidowmakerSMGSniperAltActive", 1, "ModeSelectFirestorm")
	TNT1 A 0 A_JumpIfInventory("RLWidowmakerSMGFirestormAltActive", 1, "ModeSelectNano")
	TNT1 A 0 A_JumpIfInventory("RLWidowmakerSMGNanoAltActive", 1, "ModeSelectDefault")
    Goto ModeSelectSniper
	
  ModeSelectSniper:
	TNT1 A 0 A_JumpIfInventory("RLWidowmakerSMGSniperMod", 1, 1)
    Goto ModeSelectFirestorm
	TNT1 A 0 A_TakeInventory("RLWidowmakerSMGSniperAltActive", 1)
	TNT1 A 0 A_TakeInventory("RLWidowmakerSMGFirestormAltActive", 1)
	TNT1 A 0 A_TakeInventory("RLWidowmakerSMGNanoAltActive", 1)
	TNT1 A 0 A_GiveInventory("RLWidowmakerSMGSniperAltActive", 1)
    Goto ModeChanged
  ModeSelectFirestorm:
	TNT1 A 0 A_JumpIfInventory("RLWidowmakerSMGFirestormMod", 1, 1)
    Goto ModeSelectNano
	TNT1 A 0 A_TakeInventory("RLWidowmakerSMGSniperAltActive", 1)
	TNT1 A 0 A_TakeInventory("RLWidowmakerSMGFirestormAltActive", 1)
	TNT1 A 0 A_TakeInventory("RLWidowmakerSMGNanoAltActive", 1)
	TNT1 A 0 A_GiveInventory("RLWidowmakerSMGFirestormAltActive", 1)
    Goto ModeChanged
  ModeSelectNano:
	TNT1 A 0 A_JumpIfInventory("RLWidowmakerSMGNanoMod", 1, 1)
    Goto ModeSelectDefault
	TNT1 A 0 A_TakeInventory("RLWidowmakerSMGSniperAltActive", 1)
	TNT1 A 0 A_TakeInventory("RLWidowmakerSMGFirestormAltActive", 1)
	TNT1 A 0 A_TakeInventory("RLWidowmakerSMGNanoAltActive", 1)
	TNT1 A 0 A_GiveInventory("RLWidowmakerSMGNanoAltActive", 1)
    Goto ModeChanged
  ModeSelectDefault:
	TNT1 A 0 A_TakeInventory("RLWidowmakerSMGSniperAltActive", 1)
	TNT1 A 0 A_TakeInventory("RLWidowmakerSMGFirestormAltActive", 1)
	TNT1 A 0 A_TakeInventory("RLWidowmakerSMGNanoAltActive", 1)
    Goto ModeChanged
//==============================================================================
//			Again, mostly copied as is.
//==============================================================================
	// Such flash many states wow
	//					- amv2k9
	//
	// Pfft, this is babby tier. Check the High Power Plasma Rifle for maxflashtiems
	//					- Yholl
	
	Flash:
		TNT1 A 1 A_Light2
		TNT1 A 1 A_Light1
		TNT1 A 0 A_Light0
		Goto LightDone
	FlashFF:
		TNT1 A 1 A_Light (random(1,2))
		TNT1 A 0 A_Light0
		Goto LightDone
	FlashClear:
		TNT1 A 0 A_Light0
		Goto LightDone
	Flash_ReadyDisplay:
		TNT1 A 0 A_Light0
		TNT1 A 0 A_JumpIfInventory("RLWidowmakerSMGSniperAltActive",1,"Flash_ReadySniper")
		TNT1 A 0 A_JumpIfInventory("RLWidowmakerSMGFirestormAltActive",1,"Flash_ReadyFirestorm")
		TNT1 A 0 A_JumpIfInventory("RLWidowmakerSMGNanoAltActive",1,"Flash_ReadyNano")
	 Flash_ReadyStandard:
		WSMX YABCDEFGHIJKLMNOPQRSTUVWX 2 Bright
		WSMX Y 35 Bright
		Loop
	 Flash_ReadySniper:
		WSMS TABCDEFGHIJKLMNOPQRS 2 Bright
		WSMS T 35 Bright
		Loop
	 Flash_ReadyFirestorm:
		WSMF ZABCDEFGHIJKLMNOPQRSTUVWXY 2 Bright
		WSMF Z 35 Bright
		Loop
	 Flash_ReadyNano:
		WSMN QABCDEFGHIJKLMNOP 2 Bright
		WSMN Q 35 Bright
		Loop
	Flash_FireFinishDisplay:
		TNT1 A 0 A_Light0
		TNT1 A 0 A_JumpIfInventory("RLWidowmakerSMGSniperAltActive",1,"Flash_FireFinishSniper")
		TNT1 A 0 A_JumpIfInventory("RLWidowmakerSMGFirestormAltActive",1,"Flash_FireFinishFirestorm")
		TNT1 A 0 A_JumpIfInventory("RLWidowmakerSMGNanoAltActive",1,"Flash_FireFinishNano")
	 Flash_FireFinishStandard:
		WSMX Z 2 Bright
		WSMX Y 1 Bright
		Goto LightDone
	 Flash_FireFinishSniper:
		WSMS U 2 Bright
		WSMS T 1 Bright
		Goto LightDone
	 Flash_FireFinishFirestorm:
		WSMQ A 2 Bright
		WSMF Z 1 Bright
		Goto LightDone
	 Flash_FireFinishNano:
		WSMN R 2 Bright
		WSMN Q 1 Bright
		Goto LightDone
	Flash_AltfireNoAmmoHoldDisplay:
		TNT1 A 0 A_Light0
		TNT1 A 0 A_JumpIfInventory("RLWidowmakerSMGSniperAltActive",1,"Flash_AltfireNoAmmoHoldSniper")
		TNT1 A 0 A_JumpIfInventory("RLWidowmakerSMGFirestormAltActive",1,"Flash_AltfireNoAmmoHoldFirestorm")
		TNT1 A 0 A_JumpIfInventory("RLWidowmakerSMGNanoAltActive",1,"Flash_AltfireNoAmmoHoldNano")
	 Flash_AltfireNoAmmoHoldStandard:
		WSMX Y 5 Bright
		WSMQ CC 5 Bright
		Goto LightDone
	 Flash_AltfireNoAmmoHoldSniper:
		WSMS TVV 5 Bright
		Goto LightDone
	 Flash_AltfireNoAmmoHoldFirestorm:
		WSMF Z 5 Bright
		WSMQ BB 5 Bright
		Goto LightDone
	 Flash_AltfireNoAmmoHoldNano:
		WSMN QSS 5 Bright
		Goto LightDone
	Flash_AltfireDisplay:
		TNT1 A 0 A_Light0
		TNT1 A 0 A_JumpIfInventory("RLWidowmakerSMGSniperAltActive",1,"Flash_AltfireSniper")
		TNT1 A 0 A_JumpIfInventory("RLWidowmakerSMGFirestormAltActive",1,"Flash_AltfireFirestorm")
		TNT1 A 0 A_JumpIfInventory("RLWidowmakerSMGNanoAltActive",1,"Flash_AltfireNano")
	 Flash_AltfireStandard:
		WSMX YY 1 Bright
		WSMX ZZZZZZZZZZZZ 1 Bright
		WSMX YYYY 1 Bright
		Goto LightDone
	 Flash_AltfireSniper:
		WSMS TT 1 Bright
		WSMS UUUUUUUUUUUU 1 Bright
		WSMS TTTT 1 Bright
		Goto LightDone
	 Flash_AltfireFirestorm:
		WSMF ZZ 1 Bright
		WSMQ CCCCCCCCCCCC 1 Bright
		WSMF ZZZZ 1 Bright
		Goto LightDone
	 Flash_AltfireNano:
		WSMN QQ 1 Bright
		WSMN RRRRRRRRRRRR 1 Bright
		WSMN QQQQ 1 Bright
		Goto LightDone
	 Flash_Static:
		WSMQ DEDEDEDE 1 Bright
		Goto LightDone
		
// I hate / [ ] \ frames
// I will avoid them at any cost
// This I vow on the bones of the cosmic explodogoat
//==============================================================================
  Spawn:
	TNT1 A 0 NoDelay A_SpawnItemEx("RLWidowmakerSMGPickup",0,0,0, 0,0,0, 0,SXF_NOCHECKPOSITION, 0, tid)
    Stop
//==============================================================================
//			such copy very ctrl+c ctrl+v wow
//==============================================================================
  Altfire:
	TNT1 A 0 A_JumpIfInventory("RLArmorModItemActivate",1, "ArmorModConversion")
	TNT1 A 0 A_JumpIfInventory("RLScavengerDrop",1,"ScavengerTime")
	 CheckAlt:
	"####" "#" 0 A_JumpIfInventory("RLRestrictionMeleeOnly",1,"MeleeRestricted") // Cannot fire in levels that restrict it
	"####" "#" 0 A_JumpIfInventory("RLRestrictionSilencedOnly",1,"SilencedRestricted") // Cannot fire in levels that restrict it
	"####" "#" 0 A_JumpIfInventory("RLRestrictionBoomOnly",1,"BoomRestricted") // Cannot fire in levels that restrict it
	"####" "#" 0 A_JumpIfInventory("RLRestrictionLowTechOnly",1,"LowTechRestricted") // Cannot fire in levels that restrict it
	"####" "#" 0 A_JumpIfInventory("RLRestrictionCunningOnly",1,"CunningRestricted") // Cannot fire in levels that restrict it
	
		TNT1 A 0 A_JumpIfInventory("RLWidowmakerSMGSniperAltActive",1,"Altfire_SniperSpider")
		TNT1 A 0 A_JumpIfInventory("RLWidowmakerSMGFirestormAltActive",1,"Altfire_FirestormSpider")
		TNT1 A 0 A_JumpIfInventory("RLWidowmakerSMGNanoAltActive",1,"Altfire_NanoSpider")
		
	  Altfire_StandardSpider:
		TNT1 A 0 A_JumpIfInventory("RLFireangelPerk",1,2)
		TNT1 A 0 A_JumpIfInventory("Clip",10,"Altfire_LaunchStandard")
		Goto AltfireStandard_NoAmmo
		TNT1 A 0 A_JumpIfInventory("Clip",5,"Altfire_LaunchStandard")
		Goto AltfireStandard_NoAmmo
	   AltfireStandard_NoAmmo:
		TNT1 A 0 A_GunFlash("Flash_AltfireNoAmmoHoldDisplay",GFF_NOEXTCHANGE)
		WSMG AAAAAAAAAAAAAAA 1 A_WeaponReady(WRF_NOSECONDARY)
		TNT1 A 0 A_ReFire("AltfireStandard_NoAmmo")
		Goto ReadyDisplay
	   Altfire_LaunchStandard:
		TNT1 A 0 A_FireCustomMissile("RLStandardSpiderCapsule")
		TNT1 A 0 A_JumpIfInventory("RLFireangelPerk",1,2)
		TNT1 A 0 A_TakeInventory("Clip",10, TIF_NOTAKEINFINITE)
		Goto AltfireFinish
		TNT1 A 0 A_TakeInventory("Clip",5, TIF_NOTAKEINFINITE)
		Goto AltfireFinish
		
	  Altfire_SniperSpider:
		TNT1 A 0 A_JumpIfInventory("RLFireangelPerk",1,2)
		TNT1 A 0 A_JumpIfInventory("Clip",30,"Altfire_LaunchSniper")
		Goto AltfireSniper_NoAmmo
		TNT1 A 0 A_JumpIfInventory("Clip",15,"Altfire_LaunchSniper")
		Goto AltfireSniper_NoAmmo
	   AltfireSniper_NoAmmo:
		TNT1 A 0 A_GunFlash("Flash_AltfireNoAmmoHoldDisplay",GFF_NOEXTCHANGE)
		WSMG AAAAAAAAAAAAAAA 1 A_WeaponReady(WRF_NOSECONDARY)
		TNT1 A 0 A_ReFire("AltfireSniper_NoAmmo")
		Goto ReadyDisplay
	   Altfire_LaunchSniper:
		TNT1 A 0 A_FireCustomMissile("RLSniperSpiderCapsule")
		TNT1 A 0 A_JumpIfInventory("RLFireangelPerk",1,2)
		TNT1 A 0 A_TakeInventory("Clip",30, TIF_NOTAKEINFINITE)
		Goto AltfireFinish
		TNT1 A 0 A_TakeInventory("Clip",15, TIF_NOTAKEINFINITE)
		Goto AltfireFinish
		
	 Altfire_FirestormSpider:
		TNT1 A 0 A_JumpIfInventory("RocketAmmo",1,"Altfire_LaunchFirestorm")
		Goto AltfireFirestorm_NoAmmo
	  AltfireFirestorm_NoAmmo:
		TNT1 A 0 A_GunFlash("Flash_AltfireNoAmmoHoldDisplay",GFF_NOEXTCHANGE)
		WSMG AAAAAAAAAAAAAAAA 1 A_WeaponReady(WRF_NOSECONDARY)
		TNT1 A 0 A_ReFire("AltfireFirestorm_NoAmmo")
		Goto ReadyDisplay
	  Altfire_LaunchFirestorm:
		TNT1 A 0 A_FireCustomMissile("RLFirestormSpiderCapsule")
		TNT1 A 0 A_TakeInventory("RocketAmmo",1, TIF_NOTAKEINFINITE)
		Goto AltfireFinish
		
	  Altfire_NanoSpider:
		TNT1 A 0 A_JumpIfInventory("RLFireangelPerk",1,2)
		TNT1 A 0 A_JumpIfInventory("Cell",10,"Altfire_LaunchNano")
		Goto AltfireNano_NoAmmo
		TNT1 A 0 A_JumpIfInventory("Cell",5,"Altfire_LaunchNano")
		Goto AltfireNano_NoAmmo
	   AltfireNano_NoAmmo:
		TNT1 A 0 A_GunFlash("Flash_AltfireNoAmmoHoldDisplay",GFF_NOEXTCHANGE)
		WSMG AAAAAAAAAAAAAAAA 1 A_WeaponReady(WRF_NOSECONDARY)
		TNT1 A 0 A_ReFire("AltfireNano_NoAmmo")
		Goto ReadyDisplay
	   Altfire_LaunchNano:
		TNT1 A 0 A_FireCustomMissile("RLNanoSpiderCapsule")
		TNT1 A 0 A_JumpIfInventory("RLFireangelPerk",1,2)
		TNT1 A 0 A_TakeInventory("Cell",10, TIF_NOTAKEINFINITE)
		Goto AltfireFinish
		TNT1 A 0 A_TakeInventory("Cell",5, TIF_NOTAKEINFINITE)
		Goto AltfireFinish
		
	   AltfireFinish:
		TNT1 A 0 A_PlaySound("weapons/widowmakersmglaunch",CHAN_WEAPON)
		TNT1 A 0 A_GunFlash("Flash_AltfireDisplay",GFF_NOEXTCHANGE)
		TNT1 A 0 A_AlertMonsters
		TNT1 A 0 A_Light2
		WSMG EEFFGGG 1 Bright
		TNT1 A 0 A_Light1
		WSMG HHHIIJJ 1 Bright
		TNT1 A 0 A_Light0
		WSMG AAAA 1// WHOOPS
		Goto ReadyDisplay
//==============================================================================
  ModDiscombobulation:
	TNT1 A 0 A_Print("Applied Mod pack extracted from discarded weapon.")
	TNT1 A 0 ACS_NamedExecuteAlways("ScavengeMods", 0)
	TNT1 A 3
	TNT1 A 0 A_TakeInventory("RLScavengerDrop",1)
    TNT1 A 0 A_TakeInventory("RLWidowmakerSMGModLimit", 3)
    TNT1 A 0 A_TakeInventory("RLWidowmakerSMGSniperMod", 1)
    TNT1 A 0 A_TakeInventory("RLWidowmakerSMGNanoMod", 1)
	TNT1 A 0 A_GiveInventory("RLRarityTokenRemover", 1)
	TNT1 A 0 A_TakeInventory("RLWidowmakerSMGSelected", 1)
	TNT1 A 0 A_TakeInventory("RLWeaponLimit",1)
	Goto ScavengerTimeEnd
  ScavengerTime:
	TNT1 A 0 A_GiveInventory("RLScavengingExtraEffects", 1)
	TNT1 A 0 A_JumpIfInventory("RLWidowmakerSMGModLimit",1,"ModDiscombobulation")
	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_TakeInventory("RLWidowmakerSMGModLimit", 3)
    TNT1 A 0 A_TakeInventory("RLWidowmakerSMGSniperMod", 1)
    TNT1 A 0 A_TakeInventory("RLWidowmakerSMGNanoMod", 1)
	TNT1 A 0 A_GiveInventory("RLRarityTokenRemover", 1)
	TNT1 A 0 A_TakeInventory("RLWidowmakerSMGSelected", 1)
	TNT1 A 0 A_TakeInventory("RLWeaponLimit",1)
	TNT1 A 0 A_GiveInventory("RLEmitScavengedModUnique", 1) // Determines what mods this can generate when scavenged.
	Goto ScavengerTimeEnd
  ScavengerTimeEnd:
	TNT1 A 1 A_TakeInventory("RLWidowmakerSMG",1)
	Stop
  }
}

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

ACTOR RLSpiderCapsule
{
	PROJECTILE
	-NOGRAVITY
	+DOOMBOUNCE
	+ALLOWBOUNCEONACTORS
	+BOUNCEONACTORS
	+DONTFALL
	+MTHRUSPECIES
	+FORCEXYBILLBOARD
	BounceFactor 0.5
	Speed 8
	Height 4
	Radius 4
	DeathSound "weapons/widowmakersmgegg"
	States
	{
	Spawn:
		TNT1 A 4
	 SpLoop:
		CAPS AB 4
		Loop
	Death:
		TNT1 A 1
		Stop
	}
}

/*
This is my attempt to alleviate the issue of things not spawning. Using a 
combination of a wonderful new flag for A_SpawnItemEx, and a check for the 
actor's own TID, we can determine spawn success, and make jumps accordingly! If 
the capsule succeeds in spawning its respective spider type, it sets its own TID
to 0, which then causes a jump on the same tic to the rest of its Death state. 
If the spider fails to spawn at the exact xy coordinates of the capsule, it then 
begins to attempt spawning spiders at sixteen, then thirty-two, then forty-eight 
mapunits away, in eight directions, each time checking to see if spawn was 
successful. Testing this out by standing next to a wall and firing capsules ever 
so slightly into the wall so that they explode right next to it, or by firing 
capsules into the feet of enemies seems to work suprisingly well; this method, 
so far, seems to spawn spiders every time. That's a whole lot better than the 
way it was before, where it was a crapshoot if the capsule was anywhere near a 
wall or enemy. Thank you based SXF_CLEARCALLERTID gods.
																	- amv2k9
																	
Oh wow, this is... this is cunning. I actually understand this yaaaaay
brb emitting spiders at things
																	- Yholl
*/

ACTOR RLStandardSpiderCapsule : RLSpiderCapsule 
{
	States
	{
	Death:
		TNT1 A 0 Thing_ChangeTID(0,999)
		TNT1 A 0 A_ChangeFlag("NoGravity",1)
		TNT1 A 0 A_SetTranslucent(1.0,1)
		TNT1 A 0 A_SpawnItemEx("RLWidowmakerSpider",0,0,0,0,0,0,0,SXF_CLEARCALLERTID | SXF_TRANSFERPOINTERS)
		TNT1 A 0 A_JumpIf(tid==0,"Succeed")
		TNT1 A 0 A_SpawnItemEx("RLWidowmakerSpider",16,0,0,0,0,0,0,SXF_CLEARCALLERTID | SXF_TRANSFERPOINTERS)
		TNT1 A 0 A_JumpIf(tid==0,"Succeed")
		TNT1 A 0 A_SpawnItemEx("RLWidowmakerSpider",-16,0,0,0,0,0,0,SXF_CLEARCALLERTID | SXF_TRANSFERPOINTERS)
		TNT1 A 0 A_JumpIf(tid==0,"Succeed")
		TNT1 A 0 A_SpawnItemEx("RLWidowmakerSpider",0,16,0,0,0,0,0,SXF_CLEARCALLERTID | SXF_TRANSFERPOINTERS)
		TNT1 A 0 A_JumpIf(tid==0,"Succeed")
		TNT1 A 0 A_SpawnItemEx("RLWidowmakerSpider",0,-16,0,0,0,0,0,SXF_CLEARCALLERTID | SXF_TRANSFERPOINTERS)
		TNT1 A 0 A_JumpIf(tid==0,"Succeed")
		TNT1 A 0 A_SpawnItemEx("RLWidowmakerSpider",16,16,0,0,0,0,0,SXF_CLEARCALLERTID | SXF_TRANSFERPOINTERS)
		TNT1 A 0 A_JumpIf(tid==0,"Succeed")
		TNT1 A 0 A_SpawnItemEx("RLWidowmakerSpider",-16,-16,0,0,0,0,0,SXF_CLEARCALLERTID | SXF_TRANSFERPOINTERS)
		TNT1 A 0 A_JumpIf(tid==0,"Succeed")
		TNT1 A 0 A_SpawnItemEx("RLWidowmakerSpider",16,-16,0,0,0,0,0,SXF_CLEARCALLERTID | SXF_TRANSFERPOINTERS)
		TNT1 A 0 A_JumpIf(tid==0,"Succeed")
		TNT1 A 0 A_SpawnItemEx("RLWidowmakerSpider",-16,16,0,0,0,0,0,SXF_CLEARCALLERTID | SXF_TRANSFERPOINTERS)
		TNT1 A 0 A_JumpIf(tid==0,"Succeed")
		
		TNT1 A 0 A_SpawnItemEx("RLWidowmakerSpider",32,0,0,0,0,0,0,SXF_CLEARCALLERTID | SXF_TRANSFERPOINTERS)
		TNT1 A 0 A_JumpIf(tid==0,"Succeed")
		TNT1 A 0 A_SpawnItemEx("RLWidowmakerSpider",-32,0,0,0,0,0,0,SXF_CLEARCALLERTID | SXF_TRANSFERPOINTERS)
		TNT1 A 0 A_JumpIf(tid==0,"Succeed")
		TNT1 A 0 A_SpawnItemEx("RLWidowmakerSpider",0,32,0,0,0,0,0,SXF_CLEARCALLERTID | SXF_TRANSFERPOINTERS)
		TNT1 A 0 A_JumpIf(tid==0,"Succeed")
		TNT1 A 0 A_SpawnItemEx("RLWidowmakerSpider",0,-32,0,0,0,0,0,SXF_CLEARCALLERTID | SXF_TRANSFERPOINTERS)
		TNT1 A 0 A_JumpIf(tid==0,"Succeed")
		TNT1 A 0 A_SpawnItemEx("RLWidowmakerSpider",32,32,0,0,0,0,0,SXF_CLEARCALLERTID | SXF_TRANSFERPOINTERS)
		TNT1 A 0 A_JumpIf(tid==0,"Succeed")
		TNT1 A 0 A_SpawnItemEx("RLWidowmakerSpider",-32,-32,0,0,0,0,0,SXF_CLEARCALLERTID | SXF_TRANSFERPOINTERS)
		TNT1 A 0 A_JumpIf(tid==0,"Succeed")
		TNT1 A 0 A_SpawnItemEx("RLWidowmakerSpider",32,-32,0,0,0,0,0,SXF_CLEARCALLERTID | SXF_TRANSFERPOINTERS)
		TNT1 A 0 A_JumpIf(tid==0,"Succeed")
		TNT1 A 0 A_SpawnItemEx("RLWidowmakerSpider",-32,32,0,0,0,0,0,SXF_CLEARCALLERTID | SXF_TRANSFERPOINTERS)
		TNT1 A 0 A_JumpIf(tid==0,"Succeed")
		
		TNT1 A 0 A_SpawnItemEx("RLWidowmakerSpider",48,0,0,0,0,0,0,SXF_CLEARCALLERTID | SXF_TRANSFERPOINTERS)
		TNT1 A 0 A_JumpIf(tid==0,"Succeed")
		TNT1 A 0 A_SpawnItemEx("RLWidowmakerSpider",-48,0,0,0,0,0,0,SXF_CLEARCALLERTID | SXF_TRANSFERPOINTERS)
		TNT1 A 0 A_JumpIf(tid==0,"Succeed")
		TNT1 A 0 A_SpawnItemEx("RLWidowmakerSpider",0,48,0,0,0,0,0,SXF_CLEARCALLERTID | SXF_TRANSFERPOINTERS)
		TNT1 A 0 A_JumpIf(tid==0,"Succeed")
		TNT1 A 0 A_SpawnItemEx("RLWidowmakerSpider",0,-48,0,0,0,0,0,SXF_CLEARCALLERTID | SXF_TRANSFERPOINTERS)
		TNT1 A 0 A_JumpIf(tid==0,"Succeed")
		TNT1 A 0 A_SpawnItemEx("RLWidowmakerSpider",48,48,0,0,0,0,0,SXF_CLEARCALLERTID | SXF_TRANSFERPOINTERS)
		TNT1 A 0 A_JumpIf(tid==0,"Succeed")
		TNT1 A 0 A_SpawnItemEx("RLWidowmakerSpider",-48,-48,0,0,0,0,0,SXF_CLEARCALLERTID | SXF_TRANSFERPOINTERS)
		TNT1 A 0 A_JumpIf(tid==0,"Succeed")
		TNT1 A 0 A_SpawnItemEx("RLWidowmakerSpider",48,-48,0,0,0,0,0,SXF_CLEARCALLERTID | SXF_TRANSFERPOINTERS)
		TNT1 A 0 A_JumpIf(tid==0,"Succeed")
		TNT1 A 0 A_SpawnItemEx("RLWidowmakerSpider",-48,48,0,0,0,0,0,SXF_CLEARCALLERTID | SXF_TRANSFERPOINTERS)
		TNT1 A 0 A_JumpIf(tid==0,"Succeed")
	Succeed:
		CAPX ABCDEFG 3 BRIGHT
		Stop
	}
}

ACTOR RLSniperSpiderCapsule : RLSpiderCapsule
{
	States
	{
	Death:
		TNT1 A 0 Thing_ChangeTID(0,999)
		TNT1 A 0 A_ChangeFlag("NoGravity",1)
		TNT1 A 0 A_SetTranslucent(1.0,1)
		TNT1 A 0 A_SpawnItemEx("RLWidowmakerSniperSpider",0,0,0,0,0,0,0,SXF_CLEARCALLERTID | SXF_TRANSFERPOINTERS)
		TNT1 A 0 A_JumpIf(tid==0,"Succeed")
		TNT1 A 0 A_SpawnItemEx("RLWidowmakerSniperSpider",16,0,0,0,0,0,0,SXF_CLEARCALLERTID | SXF_TRANSFERPOINTERS)
		TNT1 A 0 A_JumpIf(tid==0,"Succeed")
		TNT1 A 0 A_SpawnItemEx("RLWidowmakerSniperSpider",-16,0,0,0,0,0,0,SXF_CLEARCALLERTID | SXF_TRANSFERPOINTERS)
		TNT1 A 0 A_JumpIf(tid==0,"Succeed")
		TNT1 A 0 A_SpawnItemEx("RLWidowmakerSniperSpider",0,16,0,0,0,0,0,SXF_CLEARCALLERTID | SXF_TRANSFERPOINTERS)
		TNT1 A 0 A_JumpIf(tid==0,"Succeed")
		TNT1 A 0 A_SpawnItemEx("RLWidowmakerSniperSpider",0,-16,0,0,0,0,0,SXF_CLEARCALLERTID | SXF_TRANSFERPOINTERS)
		TNT1 A 0 A_JumpIf(tid==0,"Succeed")
		TNT1 A 0 A_SpawnItemEx("RLWidowmakerSniperSpider",16,16,0,0,0,0,0,SXF_CLEARCALLERTID | SXF_TRANSFERPOINTERS)
		TNT1 A 0 A_JumpIf(tid==0,"Succeed")
		TNT1 A 0 A_SpawnItemEx("RLWidowmakerSniperSpider",-16,-16,0,0,0,0,0,SXF_CLEARCALLERTID | SXF_TRANSFERPOINTERS)
		TNT1 A 0 A_JumpIf(tid==0,"Succeed")
		TNT1 A 0 A_SpawnItemEx("RLWidowmakerSniperSpider",16,-16,0,0,0,0,0,SXF_CLEARCALLERTID | SXF_TRANSFERPOINTERS)
		TNT1 A 0 A_JumpIf(tid==0,"Succeed")
		TNT1 A 0 A_SpawnItemEx("RLWidowmakerSniperSpider",-16,16,0,0,0,0,0,SXF_CLEARCALLERTID | SXF_TRANSFERPOINTERS)
		TNT1 A 0 A_JumpIf(tid==0,"Succeed")
		
		TNT1 A 0 A_SpawnItemEx("RLWidowmakerSniperSpider",32,0,0,0,0,0,0,SXF_CLEARCALLERTID | SXF_TRANSFERPOINTERS)
		TNT1 A 0 A_JumpIf(tid==0,"Succeed")
		TNT1 A 0 A_SpawnItemEx("RLWidowmakerSniperSpider",-32,0,0,0,0,0,0,SXF_CLEARCALLERTID | SXF_TRANSFERPOINTERS)
		TNT1 A 0 A_JumpIf(tid==0,"Succeed")
		TNT1 A 0 A_SpawnItemEx("RLWidowmakerSniperSpider",0,32,0,0,0,0,0,SXF_CLEARCALLERTID | SXF_TRANSFERPOINTERS)
		TNT1 A 0 A_JumpIf(tid==0,"Succeed")
		TNT1 A 0 A_SpawnItemEx("RLWidowmakerSniperSpider",0,-32,0,0,0,0,0,SXF_CLEARCALLERTID | SXF_TRANSFERPOINTERS)
		TNT1 A 0 A_JumpIf(tid==0,"Succeed")
		TNT1 A 0 A_SpawnItemEx("RLWidowmakerSniperSpider",32,32,0,0,0,0,0,SXF_CLEARCALLERTID | SXF_TRANSFERPOINTERS)
		TNT1 A 0 A_JumpIf(tid==0,"Succeed")
		TNT1 A 0 A_SpawnItemEx("RLWidowmakerSniperSpider",-32,-32,0,0,0,0,0,SXF_CLEARCALLERTID | SXF_TRANSFERPOINTERS)
		TNT1 A 0 A_JumpIf(tid==0,"Succeed")
		TNT1 A 0 A_SpawnItemEx("RLWidowmakerSniperSpider",32,-32,0,0,0,0,0,SXF_CLEARCALLERTID | SXF_TRANSFERPOINTERS)
		TNT1 A 0 A_JumpIf(tid==0,"Succeed")
		TNT1 A 0 A_SpawnItemEx("RLWidowmakerSniperSpider",-32,32,0,0,0,0,0,SXF_CLEARCALLERTID | SXF_TRANSFERPOINTERS)
		TNT1 A 0 A_JumpIf(tid==0,"Succeed")
		
		TNT1 A 0 A_SpawnItemEx("RLWidowmakerSniperSpider",48,0,0,0,0,0,0,SXF_CLEARCALLERTID | SXF_TRANSFERPOINTERS)
		TNT1 A 0 A_JumpIf(tid==0,"Succeed")
		TNT1 A 0 A_SpawnItemEx("RLWidowmakerSniperSpider",-48,0,0,0,0,0,0,SXF_CLEARCALLERTID | SXF_TRANSFERPOINTERS)
		TNT1 A 0 A_JumpIf(tid==0,"Succeed")
		TNT1 A 0 A_SpawnItemEx("RLWidowmakerSniperSpider",0,48,0,0,0,0,0,SXF_CLEARCALLERTID | SXF_TRANSFERPOINTERS)
		TNT1 A 0 A_JumpIf(tid==0,"Succeed")
		TNT1 A 0 A_SpawnItemEx("RLWidowmakerSniperSpider",0,-48,0,0,0,0,0,SXF_CLEARCALLERTID | SXF_TRANSFERPOINTERS)
		TNT1 A 0 A_JumpIf(tid==0,"Succeed")
		TNT1 A 0 A_SpawnItemEx("RLWidowmakerSniperSpider",48,48,0,0,0,0,0,SXF_CLEARCALLERTID | SXF_TRANSFERPOINTERS)
		TNT1 A 0 A_JumpIf(tid==0,"Succeed")
		TNT1 A 0 A_SpawnItemEx("RLWidowmakerSniperSpider",-48,-48,0,0,0,0,0,SXF_CLEARCALLERTID | SXF_TRANSFERPOINTERS)
		TNT1 A 0 A_JumpIf(tid==0,"Succeed")
		TNT1 A 0 A_SpawnItemEx("RLWidowmakerSniperSpider",48,-48,0,0,0,0,0,SXF_CLEARCALLERTID | SXF_TRANSFERPOINTERS)
		TNT1 A 0 A_JumpIf(tid==0,"Succeed")
		TNT1 A 0 A_SpawnItemEx("RLWidowmakerSniperSpider",-48,48,0,0,0,0,0,SXF_CLEARCALLERTID | SXF_TRANSFERPOINTERS)
		TNT1 A 0 A_JumpIf(tid==0,"Succeed")
	Succeed:
		CAPX ABCDEFG 3 BRIGHT
		Stop
	}
}

ACTOR RLFirestormSpiderCapsule : RLSpiderCapsule
{
	States
	{
	Death:
		TNT1 A 0 Thing_ChangeTID(0,999)
		TNT1 A 0 A_ChangeFlag("NoGravity",1)
		TNT1 A 0 A_SetTranslucent(1.0,1)
		TNT1 A 0 A_SpawnItemEx("RLWidowmakerFirestormSpider",0,0,0,0,0,0,0,SXF_CLEARCALLERTID | SXF_TRANSFERPOINTERS)
		TNT1 A 0 A_JumpIf(tid==0,"Succeed")
		TNT1 A 0 A_SpawnItemEx("RLWidowmakerFirestormSpider",16,0,0,0,0,0,0,SXF_CLEARCALLERTID | SXF_TRANSFERPOINTERS)
		TNT1 A 0 A_JumpIf(tid==0,"Succeed")
		TNT1 A 0 A_SpawnItemEx("RLWidowmakerFirestormSpider",-16,0,0,0,0,0,0,SXF_CLEARCALLERTID | SXF_TRANSFERPOINTERS)
		TNT1 A 0 A_JumpIf(tid==0,"Succeed")
		TNT1 A 0 A_SpawnItemEx("RLWidowmakerFirestormSpider",0,16,0,0,0,0,0,SXF_CLEARCALLERTID | SXF_TRANSFERPOINTERS)
		TNT1 A 0 A_JumpIf(tid==0,"Succeed")
		TNT1 A 0 A_SpawnItemEx("RLWidowmakerFirestormSpider",0,-16,0,0,0,0,0,SXF_CLEARCALLERTID | SXF_TRANSFERPOINTERS)
		TNT1 A 0 A_JumpIf(tid==0,"Succeed")
		TNT1 A 0 A_SpawnItemEx("RLWidowmakerFirestormSpider",16,16,0,0,0,0,0,SXF_CLEARCALLERTID | SXF_TRANSFERPOINTERS)
		TNT1 A 0 A_JumpIf(tid==0,"Succeed")
		TNT1 A 0 A_SpawnItemEx("RLWidowmakerFirestormSpider",-16,-16,0,0,0,0,0,SXF_CLEARCALLERTID | SXF_TRANSFERPOINTERS)
		TNT1 A 0 A_JumpIf(tid==0,"Succeed")
		TNT1 A 0 A_SpawnItemEx("RLWidowmakerFirestormSpider",16,-16,0,0,0,0,0,SXF_CLEARCALLERTID | SXF_TRANSFERPOINTERS)
		TNT1 A 0 A_JumpIf(tid==0,"Succeed")
		TNT1 A 0 A_SpawnItemEx("RLWidowmakerFirestormSpider",-16,16,0,0,0,0,0,SXF_CLEARCALLERTID | SXF_TRANSFERPOINTERS)
		TNT1 A 0 A_JumpIf(tid==0,"Succeed")
		
		TNT1 A 0 A_SpawnItemEx("RLWidowmakerFirestormSpider",32,0,0,0,0,0,0,SXF_CLEARCALLERTID | SXF_TRANSFERPOINTERS)
		TNT1 A 0 A_JumpIf(tid==0,"Succeed")
		TNT1 A 0 A_SpawnItemEx("RLWidowmakerFirestormSpider",-32,0,0,0,0,0,0,SXF_CLEARCALLERTID | SXF_TRANSFERPOINTERS)
		TNT1 A 0 A_JumpIf(tid==0,"Succeed")
		TNT1 A 0 A_SpawnItemEx("RLWidowmakerFirestormSpider",0,32,0,0,0,0,0,SXF_CLEARCALLERTID | SXF_TRANSFERPOINTERS)
		TNT1 A 0 A_JumpIf(tid==0,"Succeed")
		TNT1 A 0 A_SpawnItemEx("RLWidowmakerFirestormSpider",0,-32,0,0,0,0,0,SXF_CLEARCALLERTID | SXF_TRANSFERPOINTERS)
		TNT1 A 0 A_JumpIf(tid==0,"Succeed")
		TNT1 A 0 A_SpawnItemEx("RLWidowmakerFirestormSpider",32,32,0,0,0,0,0,SXF_CLEARCALLERTID | SXF_TRANSFERPOINTERS)
		TNT1 A 0 A_JumpIf(tid==0,"Succeed")
		TNT1 A 0 A_SpawnItemEx("RLWidowmakerFirestormSpider",-32,-32,0,0,0,0,0,SXF_CLEARCALLERTID | SXF_TRANSFERPOINTERS)
		TNT1 A 0 A_JumpIf(tid==0,"Succeed")
		TNT1 A 0 A_SpawnItemEx("RLWidowmakerFirestormSpider",32,-32,0,0,0,0,0,SXF_CLEARCALLERTID | SXF_TRANSFERPOINTERS)
		TNT1 A 0 A_JumpIf(tid==0,"Succeed")
		TNT1 A 0 A_SpawnItemEx("RLWidowmakerFirestormSpider",-32,32,0,0,0,0,0,SXF_CLEARCALLERTID | SXF_TRANSFERPOINTERS)
		TNT1 A 0 A_JumpIf(tid==0,"Succeed")
		
		TNT1 A 0 A_SpawnItemEx("RLWidowmakerFirestormSpider",48,0,0,0,0,0,0,SXF_CLEARCALLERTID | SXF_TRANSFERPOINTERS)
		TNT1 A 0 A_JumpIf(tid==0,"Succeed")
		TNT1 A 0 A_SpawnItemEx("RLWidowmakerFirestormSpider",-48,0,0,0,0,0,0,SXF_CLEARCALLERTID | SXF_TRANSFERPOINTERS)
		TNT1 A 0 A_JumpIf(tid==0,"Succeed")
		TNT1 A 0 A_SpawnItemEx("RLWidowmakerFirestormSpider",0,48,0,0,0,0,0,SXF_CLEARCALLERTID | SXF_TRANSFERPOINTERS)
		TNT1 A 0 A_JumpIf(tid==0,"Succeed")
		TNT1 A 0 A_SpawnItemEx("RLWidowmakerFirestormSpider",0,-48,0,0,0,0,0,SXF_CLEARCALLERTID | SXF_TRANSFERPOINTERS)
		TNT1 A 0 A_JumpIf(tid==0,"Succeed")
		TNT1 A 0 A_SpawnItemEx("RLWidowmakerFirestormSpider",48,48,0,0,0,0,0,SXF_CLEARCALLERTID | SXF_TRANSFERPOINTERS)
		TNT1 A 0 A_JumpIf(tid==0,"Succeed")
		TNT1 A 0 A_SpawnItemEx("RLWidowmakerFirestormSpider",-48,-48,0,0,0,0,0,SXF_CLEARCALLERTID | SXF_TRANSFERPOINTERS)
		TNT1 A 0 A_JumpIf(tid==0,"Succeed")
		TNT1 A 0 A_SpawnItemEx("RLWidowmakerFirestormSpider",48,-48,0,0,0,0,0,SXF_CLEARCALLERTID | SXF_TRANSFERPOINTERS)
		TNT1 A 0 A_JumpIf(tid==0,"Succeed")
		TNT1 A 0 A_SpawnItemEx("RLWidowmakerFirestormSpider",-48,48,0,0,0,0,0,SXF_CLEARCALLERTID | SXF_TRANSFERPOINTERS)
		TNT1 A 0 A_JumpIf(tid==0,"Succeed")
	Succeed:
		CAPX ABCDEFG 3 BRIGHT
		Stop
	}
}

ACTOR RLNanoSpiderCapsule : RLSpiderCapsule
{
	States
	{
	Death:
		TNT1 A 0 Thing_ChangeTID(0,999)
		TNT1 A 0 A_ChangeFlag("NoGravity",1)
		TNT1 A 0 A_SetTranslucent(1.0,1)
		TNT1 A 0 A_SpawnItemEx("RLWidowmakerNanoSpider",0,0,0,0,0,0,0,SXF_CLEARCALLERTID | SXF_TRANSFERPOINTERS)
		TNT1 A 0 A_JumpIf(tid==0,"Succeed")
		TNT1 A 0 A_SpawnItemEx("RLWidowmakerNanoSpider",16,0,0,0,0,0,0,SXF_CLEARCALLERTID | SXF_TRANSFERPOINTERS)
		TNT1 A 0 A_JumpIf(tid==0,"Succeed")
		TNT1 A 0 A_SpawnItemEx("RLWidowmakerNanoSpider",-16,0,0,0,0,0,0,SXF_CLEARCALLERTID | SXF_TRANSFERPOINTERS)
		TNT1 A 0 A_JumpIf(tid==0,"Succeed")
		TNT1 A 0 A_SpawnItemEx("RLWidowmakerNanoSpider",0,16,0,0,0,0,0,SXF_CLEARCALLERTID | SXF_TRANSFERPOINTERS)
		TNT1 A 0 A_JumpIf(tid==0,"Succeed")
		TNT1 A 0 A_SpawnItemEx("RLWidowmakerNanoSpider",0,-16,0,0,0,0,0,SXF_CLEARCALLERTID | SXF_TRANSFERPOINTERS)
		TNT1 A 0 A_JumpIf(tid==0,"Succeed")
		TNT1 A 0 A_SpawnItemEx("RLWidowmakerNanoSpider",16,16,0,0,0,0,0,SXF_CLEARCALLERTID | SXF_TRANSFERPOINTERS)
		TNT1 A 0 A_JumpIf(tid==0,"Succeed")
		TNT1 A 0 A_SpawnItemEx("RLWidowmakerNanoSpider",-16,-16,0,0,0,0,0,SXF_CLEARCALLERTID | SXF_TRANSFERPOINTERS)
		TNT1 A 0 A_JumpIf(tid==0,"Succeed")
		TNT1 A 0 A_SpawnItemEx("RLWidowmakerNanoSpider",16,-16,0,0,0,0,0,SXF_CLEARCALLERTID | SXF_TRANSFERPOINTERS)
		TNT1 A 0 A_JumpIf(tid==0,"Succeed")
		TNT1 A 0 A_SpawnItemEx("RLWidowmakerNanoSpider",-16,16,0,0,0,0,0,SXF_CLEARCALLERTID | SXF_TRANSFERPOINTERS)
		TNT1 A 0 A_JumpIf(tid==0,"Succeed")
		
		TNT1 A 0 A_SpawnItemEx("RLWidowmakerNanoSpider",32,0,0,0,0,0,0,SXF_CLEARCALLERTID | SXF_TRANSFERPOINTERS)
		TNT1 A 0 A_JumpIf(tid==0,"Succeed")
		TNT1 A 0 A_SpawnItemEx("RLWidowmakerNanoSpider",-32,0,0,0,0,0,0,SXF_CLEARCALLERTID | SXF_TRANSFERPOINTERS)
		TNT1 A 0 A_JumpIf(tid==0,"Succeed")
		TNT1 A 0 A_SpawnItemEx("RLWidowmakerNanoSpider",0,32,0,0,0,0,0,SXF_CLEARCALLERTID | SXF_TRANSFERPOINTERS)
		TNT1 A 0 A_JumpIf(tid==0,"Succeed")
		TNT1 A 0 A_SpawnItemEx("RLWidowmakerNanoSpider",0,-32,0,0,0,0,0,SXF_CLEARCALLERTID | SXF_TRANSFERPOINTERS)
		TNT1 A 0 A_JumpIf(tid==0,"Succeed")
		TNT1 A 0 A_SpawnItemEx("RLWidowmakerNanoSpider",32,32,0,0,0,0,0,SXF_CLEARCALLERTID | SXF_TRANSFERPOINTERS)
		TNT1 A 0 A_JumpIf(tid==0,"Succeed")
		TNT1 A 0 A_SpawnItemEx("RLWidowmakerNanoSpider",-32,-32,0,0,0,0,0,SXF_CLEARCALLERTID | SXF_TRANSFERPOINTERS)
		TNT1 A 0 A_JumpIf(tid==0,"Succeed")
		TNT1 A 0 A_SpawnItemEx("RLWidowmakerNanoSpider",32,-32,0,0,0,0,0,SXF_CLEARCALLERTID | SXF_TRANSFERPOINTERS)
		TNT1 A 0 A_JumpIf(tid==0,"Succeed")
		TNT1 A 0 A_SpawnItemEx("RLWidowmakerNanoSpider",-32,32,0,0,0,0,0,SXF_CLEARCALLERTID | SXF_TRANSFERPOINTERS)
		TNT1 A 0 A_JumpIf(tid==0,"Succeed")
		
		TNT1 A 0 A_SpawnItemEx("RLWidowmakerNanoSpider",48,0,0,0,0,0,0,SXF_CLEARCALLERTID | SXF_TRANSFERPOINTERS)
		TNT1 A 0 A_JumpIf(tid==0,"Succeed")
		TNT1 A 0 A_SpawnItemEx("RLWidowmakerNanoSpider",-48,0,0,0,0,0,0,SXF_CLEARCALLERTID | SXF_TRANSFERPOINTERS)
		TNT1 A 0 A_JumpIf(tid==0,"Succeed")
		TNT1 A 0 A_SpawnItemEx("RLWidowmakerNanoSpider",0,48,0,0,0,0,0,SXF_CLEARCALLERTID | SXF_TRANSFERPOINTERS)
		TNT1 A 0 A_JumpIf(tid==0,"Succeed")
		TNT1 A 0 A_SpawnItemEx("RLWidowmakerNanoSpider",0,-48,0,0,0,0,0,SXF_CLEARCALLERTID | SXF_TRANSFERPOINTERS)
		TNT1 A 0 A_JumpIf(tid==0,"Succeed")
		TNT1 A 0 A_SpawnItemEx("RLWidowmakerNanoSpider",48,48,0,0,0,0,0,SXF_CLEARCALLERTID | SXF_TRANSFERPOINTERS)
		TNT1 A 0 A_JumpIf(tid==0,"Succeed")
		TNT1 A 0 A_SpawnItemEx("RLWidowmakerNanoSpider",-48,-48,0,0,0,0,0,SXF_CLEARCALLERTID | SXF_TRANSFERPOINTERS)
		TNT1 A 0 A_JumpIf(tid==0,"Succeed")
		TNT1 A 0 A_SpawnItemEx("RLWidowmakerNanoSpider",48,-48,0,0,0,0,0,SXF_CLEARCALLERTID | SXF_TRANSFERPOINTERS)
		TNT1 A 0 A_JumpIf(tid==0,"Succeed")
		TNT1 A 0 A_SpawnItemEx("RLWidowmakerNanoSpider",-48,48,0,0,0,0,0,SXF_CLEARCALLERTID | SXF_TRANSFERPOINTERS)
		TNT1 A 0 A_JumpIf(tid==0,"Succeed")
	Succeed:
		CAPX ABCDEFG 3 BRIGHT
		Stop
	}
}

ACTOR RLWidowmakerSpider
{
	MONSTER
	+FRIENDLY
	+LOOKALLAROUND
	+NOBLOOD
	+THRUSPECIES
	+NOTELEFRAG
	+DONTHARMSPECIES
	+NOTAUTOAIMED
	MaxStepHeight 20
	RadiusDamageFactor 0.25
	DamageFactor "Bullet", 0.25
	DamageFactor "Melee", 0.25
	DamageFactor "Fire", 0.80
	Height 24
	Radius 16
	Speed 10
	Health 40
	Scale 0.5
	Translation "48:79=176:191",
				"128:151=176:191"
	DeathSound "weapons/widowmakerspiderded"
	Tag "Widow Spider"
	Species "Player"
	States
	{
	Spawn:
		TNT1 A 0
		TNT1 A 0 A_JumpIfInventory ("RLSpidLovesItsMama", 1, "SpawnLoop")
		TNT1 A 0 A_GiveInventory ("RLSpidLovesItsMama", 1)
		TNT1 A 0 A_RearrangePointers (AAPTR_NULL, AAPTR_TARGET, AAPTR_DEFAULT)
	SpawnLoop:
		WSPI ABCB 3 A_Look
		Loop
	See:
		WSPI ABCB 3 A_Chase
		Loop
	Melee:
		WSPI A 4 A_FaceTarget
		WSPI C 4 A_CustomMeleeAttack(4,"weapons/widowmakerspidernom","none")
		WSPI A 4
		Goto See
	Death:
		WSPI F 4
		WSPI G 4 A_Scream
		WSPI HIJK 4
		WSPI L 4 A_NoBlocking
		WSPI MN 4
		WSPI OPQR 4 Bright
		Stop
	}
}

ACTOR RLSpidLovesItsMama : RLPermanentInventory {}

ACTOR RLSpiderBullets : Inventory{Inventory.MaxAmount 30}

ACTOR RLWidowmakerSniperSpider : RLWidowmakerSpider
{
	+MISSILEMORE
	+MISSILEEVENMORE
	+AVOIDMELEE
	MinMissileChance 32
	Translation "48:79=250:254",
				"128:151=250:254"
	States
	{
	Spawn:
		TNT1 A 0
		TNT1 A 0 A_JumpIfInventory ("RLSpidLovesItsMama", 1, "SpawnLoop")
		TNT1 A 0 A_GiveInventory ("RLSpidLovesItsMama", 1)
		TNT1 A 0 A_RearrangePointers (AAPTR_NULL, AAPTR_TARGET, AAPTR_DEFAULT)
		TNT1 A 0 A_GiveInventory("RLSpiderBullets",30)
	 SpawnLoop:
		WSPI ABCB 3 A_Look
		Loop
	See:
		WSPI ABCB 3 A_Chase
		Loop
	Missile:
		TNT1 A 0 A_JumpIfInventory("RLSpiderBullets",1,"FireBullet")
		TNT1 A 0 A_ChangeFlag("MissileEvenMore",0)
		TNT1 A 0 A_ChangeFlag("MissileMore",0)
		TNT1 A 0 A_ChangeFlag("AvoidMelee",0)
		Goto See
	 FireBullet:
		TNT1 A 0 A_TakeInventory("RLSpiderBullets",1)
		WSPI E 4 A_FaceTarget
		TNT1 A 0 A_PlaySound("weapons/pistol",CHAN_ITEM)
		WSPI D 4 BRIGHT A_CustomBulletAttack(3,4,1,5,"RLBulletPuff")
		Goto See
	}
}

ACTOR RLFirestormSpiderExplosion
{
	+THRUACTORS
	+DONTHARMSPECIES
	Projectile
	DamageType "Fire"
	PainType "Explosion"
	DeathType "Explosion"
	States
	{
	Spawn:
		TNT1 A 0
		TNT1 A 0 A_PlaySound("weapons/missileexplosion",CHAN_ITEM)
		TNT1 A 0 A_Explode(160,160, 0)
		MEXP AAABBBCCCDDDDEEEEFFFFF 1 BRIGHT
		Stop
	}
}

ACTOR RLWidowmakerFirestormSpider : RLWidowmakerSpider
{
	Translation "48:79=208:223",
				"128:151=208:223"
	States
	{
	See:
		WSPI ABCB 3 A_Chase
		Loop
	Melee:
		TNT1 A 0 A_Die
		Goto Death
	Death:
		TNT1 A 0 A_NoBlocking
		WSPI FGHI 2
		TNT1 A 0 A_SpawnItemEx("RLFirestormSpiderExplosion",0,0,12, 0,0,0, 0,SXF_NOCHECKPOSITION | SXF_SETTARGET)
		Stop
	}
}

// Every five successful melee attacks by Nano spider, it spawns a small bullet
// or shell ammo.
ACTOR RLSuccessfulNanoHits : Inventory{Inventory.MaxAmount 5}

// Spawning a small bullet or shell ammo EVERY five hits until the spider dies
// is perhaps too OP. So after five successful ammo spawns, spider dies.
ACTOR RLNanoAmmoSpawns : Inventory{Inventory.MaxAmount 5}

ACTOR RLNanoSpiderMelee
// This is actually the Nano spider's 'melee' attack. A_CustomMelee doesn't 
// support puffs for whatever reason, and we need to track successful hits, so 
// a limited lifespan projectile is the next best thing.
{
	PROJECTILE
	Speed 10
	+MTHRUSPECIES
	SeeSound "weapons/widowmakerspidernom"
	Damage 4
	States
	{
	Spawn:
		TNT1 AA 1
		Stop
	Death:
		TNT1 A 1
		Stop
	Crash:
	XDeath:
		TNT1 A 1 A_GiveToTarget("RLSuccessfulNanoHits",1)
		Stop
	}
}

ACTOR RLWidowmakerNanoSpider : RLWidowmakerSpider 
{
	Translation "48:79=80:95",
				"128:151=80:95"
	States
	{
	See:
		TNT1 A 0 A_JumpIfInventory("RLSuccessfulNanoHits",0,"ThrowAmmo")
	 SeeCont:
		WSPI ABCB 3 A_Chase
		Loop
	ThrowAmmo:
		TNT1 A 0 A_JumpIfInventory("RLNanoAmmoSpawns",0,"Destruct")
		TNT1 A 0 A_GiveInventory("RLNanoAmmoSpawns")
		TNT1 A 0 A_TakeInventory("RLSuccessfulNanoHits")
		TNT1 A 0 A_Jump(128,2)
		TNT1 A 0 A_SpawnItemEx("RLClip",0,0,0,frandom(2,6),0,frandom(2,6),random(1,359))
		Goto SeeCont
		TNT1 A 0 A_SpawnItemEx("RLShell",0,0,0,frandom(2,6),0,frandom(2,6),random(1,359))
		Goto SeeCont
	Destruct:
		TNT1 A 0 A_Die
		Stop
	Melee:
		WSPI A 4 A_FaceTarget
		WSPI C 4 A_CustomMissile("RLNanoSpiderMelee",5)
		Goto See
	}
}

ACTOR RLamv2k9Spider : RLWidowmakerSpider
{
	-FRIENDLY
	Species "Authors"
	Health 1
	Speed 20
	States
	{
	Spawn:
		WSPI ABCB 2 A_Look
		Loop
	See:
		WSPI ABCB 2 A_Chase
		Loop
	}
}

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

Actor RLWidowmakerSMGSelected : RLPermanentInventory {}
Actor RLWidowmakerSMGState : RLPermanentInventory {}
Actor RLWidowmakerSMGAmmochain : RLAmmochainDefault {}

Actor RLWidowmakerSMGModLimit : RLPermanentInventory
{
inventory.maxamount 3
}

Actor RLWidowmakerSMGNanoMod : RLUniqueModAmount {}
Actor RLWidowmakerSMGFirestormMod : RLUniqueModAmount {}
Actor RLWidowmakerSMGSniperMod : RLUniqueModAmount {}

// These next four items are for the altfire; the "Standard" is given when you
// pick up the weapon. If you Exotic-mod the Widowmaker, the other three help 
// track which should be used when you press the altfire key, and which to 
// switch to/from when reloading. Reloading changes the altfire; not a great 
// system, but there's not a lot of choices in how to change it.
ACTOR RLWidowmakerSMGSniperAltActive : RLPermanentInventory {}
ACTOR RLWidowmakerSMGFirestormAltActive : RLPermanentInventory {}
ACTOR RLWidowmakerSMGNanoAltActive : RLPermanentInventory {}
ACTOR RLWidowmakerSMGStandardAltActive : RLPermanentInventory {}


ACTOR RLWidowmakerSMGClip : Ammo
{
   +INVENTORY.IGNORESKILL
   Inventory.MaxAmount 42
   Inventory.Icon ""
}

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

ACTOR RLWidowmakerSMGPickup : RLUniqueWeaponPickup
{
	//$Sprite WSMGX0
	Tag "Widowmaker SMG [Pickup]"
	States
	{
	SpawnFrame:
		WSMG 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/gundropmedium")
		"####" "#" 0 A_ScaleVelocity (0.5)
		"####" "#" 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("RLWidowmakerSMG",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("RLWidowmakerSMG",1)
		"####" "#" 0 A_GiveInventory("RLWeaponLimit",1)
		"####" "#" 0 A_GiveInventory("RLUniqueItemFound",1, AAPTR_PLAYER1)
		"####" "#" 0 A_Print("\ccPicked up the \cdWidowmaker SMG.")
		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("\cd= Widowmaker SMG =", 2, "CONFONT")
		Goto NotPickup_NoPrint
	NotPickup_NoPrint:
		"####" "#" 0
		Fail
	PickupSound:
		"####" "#" 0 A_PlaySound("weapons/WidowmakerSMGpickup")
		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 RLWidowmakerSMGWorldSpawnPickup : RLWidowmakerSMGPickup 17122
{
	States
	{
	NoSpecialStartsStuff:
		TNT1 A 0 A_SpawnItemEx("RLRarityBeamUniqueWorld", 0,0,0, 0,0,0, 0, SXF_SETMASTER)
		TNT1 A 0 A_JumpIf(CallACS("DRPGCheckTiem"), "DRPGInit")
		"####" "#" 0 A_Jump(256, "SpawnFrame")
		Goto SpawnFrame
		
	SpawnFrame:
		WSMG X 4
		"####" "#" 0 A_GiveInventory("RLUniqueItemSpawnMessageSender",1)
		"####" "#" 0 A_PlaySound("weapons/uniquespawned", 7, 0.25, 0, 0)
		"####" "#" 0 A_Jump(256, "SpawnLoop")
		Goto SpawnLoop
		
	GiveWeapon:
		"####" "#" 0 A_GiveInventory("RLWidowmakerSMG",1)
		"####" "#" 0 A_GiveInventory("RLWeaponLimit",1)
		"####" "#" 0 A_GiveInventory("RLUniqueItemFound",1, AAPTR_PLAYER1)
		"####" "#" 0 A_Print("\ccPicked up the \cdWidowmaker SMG.")
		"####" "#" 0 A_GiveInventory("RLDangerLevelUniqueGiver",1, AAPTR_PLAYER1)
		Goto PickupSound
	}
}

ACTOR RLWidowmakerSMGPickupModded : RLWidowmakerSMGPickup
{
	+INVENTORY.TRANSFER
	States
	{
	Spawn:
		TNT1 A 0 NoDelay ACS_NamedExecuteAlways("GetWeaponMods", 0)
		TNT1 A 0 A_JumpIf(CallACS("DRLA_specialstarts") == 0, "NoSpecialStartsStuff")
		"####" "#" 0 A_Jump(256, "SpecialStartsStuff")
		Goto SpecialStartsStuff
		
	SpawnFrame:
		WSMG X 4
		"####" "#" 0 A_Jump(256, "SpawnLoop")
		Goto SpawnLoop
	SpawnLoop:
		"####" "#" 0 A_JumpIf(VelZ <= 0.01 && user_floorhit == 0, "FloorHit")
		"####" "#" 0 ACS_NamedExecuteAlways("RLWeaponModDisplay", 0)
		"####" "#" 1
		Loop
	GiveWeapon:
		"####" "#" 0 A_GiveInventory("RLWidowmakerSMG",1)
		"####" "#" 0 A_GiveInventory("RLWeaponLimit",1)
		"####" "#" 0 A_Print("\ccPicked up a \cbmodded \cdWidowmaker SMG.")
		Goto PickupSound
	NotPickupLimit:
		"####" "#" 0 A_JumpIfInventory("DRLA_WeaponAntiLogFloodCheck",1,"NotPickup_NoPrint")
		"####" "#" 0 A_GiveInventory("DRLA_WeaponAntiLogFloodCheck")
		"####" "#" 0 A_Print("\cd= Widowmaker SMG =", 2, "CONFONT")
		Goto NotPickup_NoPrint
	NotPickup:
		"####" "#" 0 A_JumpIfInventory("RLWidowmakerSMGModLimit", 1, "NotPickup_Modded")
		"####" "#" 0 A_JumpIfInventory("DRLA_WeaponAntiLogFloodCheck",1,"NotPickup_NoPrint")
		"####" "#" 0 A_GiveInventory("DRLA_WeaponAntiLogFloodCheck")
		"####" "#" 0 A_Print("\cd= Widowmaker SMG =\n\n\ccYou replace your unmodded\n\ccweapon with the one you picked up.", 5, "CONFONT")
		"####" "#" 0 A_GiveInventory("Clip",48)
		Goto PickupSound
	NotPickup_Modded:
		"####" "#" 0 A_Print("\cd= Widowmaker SMG =\n\n\caYou are already carrying a modded\n\caweapon of this type", 5, "CONFONT")
		Fail
	}
}
