
//Dusk damage chart (type: Dmg)
//SP: 500
//MP: 135


//Riverito. It's an argentinian joke. Don't know how to explain it. 
ACTOR Dusk_Riveter : DuskWeapon //replaces bfg9000 //There's no true bfg equivalent on dusk.
{
Weapon.Kickback 0
+WEAPON.NOAUTOAIM
//	+weapon.bfg
	Weapon.SelectionOrder 30
Weapon.Slotnumber 9
	Weapon.SisterWeapon Dusk_Riveter_newammo

	Weapon.AmmoUse 2//Twice the ammo to balance firerate.
	Weapon.AmmoGive 6
	Weapon.AmmoType "RocketAmmo"
	Weapon.UpSound "riveter/raise"

	Inventory.PickupMessage "$RIVETR_PICK"
	Tag "Riveter"

	States
	{
	Ready:
TNT1 A 0 A_JumpIfInventory("Doosk_ExplosiveBarrelWeapon",1,"Select_Barrel")
TNT1 A 0 A_JumpIfInventory("Doosk_HereticBarrelWeapon",1,"Select_HereticBarrel")
TNT1 A 0 A_JumpIfInventory("Doosk_SoapWeapon",1,"Select_Soap")

		W09C A 1 A_WeaponReady(WRF_ALLOWRELOAD)
		Loop
	Deselect:
    TNT1 A 0 A_TakeInventory("SetWeaponMemory",50)
    TNT1 A 0 A_GiveInventory("SetWeaponMemory",12)
	DeselectLoop:
		TST1 AAA 0 A_Lower
		TST1 A 1 A_Lower
		Loop
	Select:
		TNT1 A 0 A_SetCrosshair(18)
    TNT1 A 0 A_TakeInventory("SetWeaponActual",50)
    TNT1 A 0 A_GiveInventory("SetWeaponActual",12)
//		TNT1 A 5 A_WeaponReady//(WRF_NOFIRE)
		W09A ABCDEFGHI 1 A_WeaponReady//(WRF_NOFIRE)
		Goto Ready


	Reload://Weapon melee
	TNT1 A 0 A_PlaySound("sickles/fire")
		W01G A 0 A_CustomPunch(2 * random(1, 10), TRUE, 0, "MeleePuff")

		W09D ABCDE 1 A_WeaponReady (WRF_NOBOB)//(WRF_ALLOWRELOAD)
		W09D FGHIJK 1 A_WeaponReady (WRF_ALLOWRELOAD|WRF_NOBOB)
		W09D LMNOPQRSTUVWXY 1 A_WeaponReady (WRF_ALLOWRELOAD)
		Goto Ready


	Fire:
		TNT1 A 0 A_GunFlash		TNT1 A 0 A_GiveInventory("Player_WeaponShot",1)

TNT1 A 0 A_JumpIfInventory("Fastfire_TotemAmount",31,	"Fire_Stacked2")
TNT1 A 0 A_JumpIfInventory("Fastfire_TotemAmount",1,	"Fire_Stacked1")

		W09F ABCD 1 bright A_WeaponReady (WRF_NOFIRE|WRF_NOSWITCH)
		W09F EFGHIJKL 1 A_WeaponReady (WRF_NOFIRE|WRF_NOSWITCH)
	    TNT1 A 0 A_JumpIfInventory("DeathMatchToken",1,"Fire_DM")

		W09F MNOPQR 1 A_WeaponReady (WRF_ALLOWRELOAD)
		Goto Ready

	Fire_DM:
		W09F MNOPQR 1 A_WeaponReady (WRF_NOFIRE|WRF_NOSWITCH)

		Goto Ready


	Fire_Stacked1:
		W09F ABCD 1 bright A_WeaponReady (WRF_NOFIRE|WRF_NOSWITCH)
		W09F EF 1 A_WeaponReady (WRF_NOFIRE|WRF_NOSWITCH)
	    TNT1 A 0 A_JumpIfInventory("DeathMatchToken",1,"Fire_DM_Stacked1")

		W09F GHIJKLMNOPQR 1 A_WeaponReady (WRF_ALLOWRELOAD)
		Goto Ready

	Fire_DM_Stacked1:
		W09F GHI 1 A_WeaponReady (WRF_NOFIRE|WRF_NOSWITCH)
		W09F JKLMNOPQR 1 A_WeaponReady (WRF_ALLOWRELOAD)
		Goto Ready




	Fire_Stacked2:
		W09F ABC 1 bright A_WeaponReady (WRF_NOFIRE|WRF_NOSWITCH)
	    TNT1 A 0 A_JumpIfInventory("DeathMatchToken",1,"Fire_DM_Stacked2")

		W09F D 1 bright A_WeaponReady (WRF_ALLOWRELOAD)
		W09F EFGHIJKLMNOPQR 1 A_WeaponReady (WRF_ALLOWRELOAD)
		Goto Ready

	Fire_DM_Stacked2:
		W09F D 1 bright A_WeaponReady (WRF_NOFIRE|WRF_NOSWITCH)
		W09F E 1 A_WeaponReady (WRF_NOFIRE|WRF_NOSWITCH)

		W09F FGHIJKLMNOPQR 1 A_WeaponReady (WRF_ALLOWRELOAD)
		Goto Ready




	Flash_DM:
		TNT1 A 0 A_FireCustomMissile("Dusk_Rocket_DM")
			Goto FlashContinue

	Flash_Nerfed:
		TNT1 A 0 A_FireCustomMissile("Dusk_Rocket_Nerfed")
			Goto FlashContinue

	Flash:
	    TNT1 A 0 A_JumpIfInventory("DeathMatchToken",1,"Flash_DM")
TNT1 A 0 A_JumpIf(CallACS("nerfed_riveter")==1, "Flash_Nerfed")//If mutator is detected, spawns nerfed projectile.
		TNT1 A 0 A_FireCustomMissile("Dusk_Rocket")
	FlashContinue:
	TNT1 A 0 ACS_NamedExecuteAlways("Weapon_Recoil", 0, 1, 0, 0)
		TNT1 A 3 A_Light2
		TNT1 A 4 A_Light1
		Goto LightDone
	Spawn:
		W09Z A -1
		Stop
	}
}

