
//Dusk damage chart (type: Dmg)
//SP: Unknown
//MP: Unknown


//The Buzzsaw. Multiplayer only.


//The ammotype. Exclusive for this weapon.
ACTOR Dusk_BuzzsawAmmo : Ammo 
{
	Game Doom
	SpawnID 11
	Inventory.PickupMessage "$PICKUP_BULLETS_12"
	Inventory.Amount 5
	Inventory.MaxAmount 30
	Ammo.BackpackAmount 5
	Ammo.BackpackMaxAmount 30
	Inventory.Icon "CLIPA0"
	Height 48
	Radius 20
	Scale 0.3
	States
	{
	Spawn:
		BUL1 ABCDEFGHIJKLMNOP 4 bright
		Loop
	}
}

//The weapon. Self explanatory.
ACTOR Dusk_Buzzsaw : DuskWeapon
{
Weapon.Kickback 0
	+WEAPON.NOALERT
+WEAPON.NOAUTOAIM
+WEAPON.EXPLOSIVE
+weapon.CHEATNOTWEAPON
	Weapon.SelectionOrder 99
Weapon.Slotnumber 5

	Weapon.AmmoUse 1
	Weapon.AmmoGive 5
	Weapon.AmmoType "Dusk_BuzzsawAmmo"
	Weapon.UpSound "mortar/raise"

	Inventory.PickupMessage "$BSAW_PICK"
	Tag "Buzzsaw"
	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")

		W20C Z 1 A_WeaponReady(WRF_ALLOWRELOAD)
		Loop
	Deselect:
    TNT1 A 0 A_TakeInventory("SetWeaponMemory",50)
    TNT1 A 0 A_GiveInventory("SetWeaponMemory",15)
	DeselectLoop:
		TST1 AAA 0 A_Lower
		TST1 A 1 A_Lower
		Loop
	Select:
		TNT1 A 0 A_SetCrosshair(17)
    TNT1 A 0 A_TakeInventory("SetWeaponActual",50)
    TNT1 A 0 A_GiveInventory("SetWeaponActual",15)
		TNT1 A 5 A_WeaponReady//(WRF_NOFIRE)
		W20A ABCDEFGHIJ 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")

		W20B ABCDE 1 A_WeaponReady (WRF_NOBOB)//(WRF_ALLOWRELOAD)
		W20B FGHIJK 1 A_WeaponReady (WRF_ALLOWRELOAD|WRF_NOBOB)
		W20B 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")

		W20C ABCDEFGHIJKLMNOPQRSTUVWXYZ 1 A_WeaponReady (WRF_NOFIRE|WRF_NOSWITCH)
		Goto Ready

	Fire_Stacked1:
		W20C ABCDEFGHIJKLM 1 A_WeaponReady (WRF_NOFIRE|WRF_NOSWITCH)
		W20C NOPQRSTUVWXYZ 1 A_WeaponReady (WRF_ALLOWRELOAD)
		Goto Ready


	Fire_Stacked2:
		W20C ABCDEFG 1 A_WeaponReady (WRF_NOFIRE|WRF_NOSWITCH)
		W20C HIJKLMNOPQRSTUVWXYZ 1 A_WeaponReady (WRF_ALLOWRELOAD)
		Goto Ready











	Flash:
//	TNT1 A 0 A_AlertMonsters

	TNT1 A 0 A_PlaySound("sickles/fire", CHAN_WEAPON)
		TNT1 A 0 A_FireCustomMissile("Dusk_buzzsaw_3sec",0,1,0,0,0,2)
	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:
		W08Z A -1
		Stop
	}
}




ACTOR Dusk_buzzsaw_3sec
{
    Radius 16
    Height 12
    Health 50 //(50+50+20direct = 120)
    Damage (random(75,125))//(randompick(40,45,50,55,60,65))
    Speed 40
    Mass 0
    BounceFactor 0.79//420//69
	WallBounceFactor 0.620

    Gravity 0.25
    BounceType "Hexen"
//+MBFBOUNCER
    -ROCKETTRAIL
    PROJECTILE
    +CANBOUNCEWATER
    -NOGRAVITY
    +FORCERADIUSDMG
//+BOUNCEAUTOOFF
//+BOUNCEAUTOOFFFLOORONLY
+USEBOUNCESTATE

  ReactionTime 120 
    +NOBLOCKMAP
    +MISSILE
    +BRIGHT
	+SEEKERMISSILE //Not actually used for anything other than checking radius.
SeeSound "Sil/Encio"
//    BounceSound "mortar/bounce"
//    DeathSound "weapons/rocklx"
    Obituary "$BSAW_OB"
Scale 0.15
    States
    {
    Spawn:
    Idle:
    BSAW AABBCCDDEEFFGGHHIIJJKKLLMMNNOOPP 1 A_CountDown
	Loop
IdleSound:
		BLLT A 0 BRIGHT A_SpawnItem("BuzzsawPuff")
tnt1 a 0 A_PlaySound("mortar/bounce")
Goto Idle


bounce.ceiling:
bounce.wall:
		BLLT A 0 BRIGHT A_SpawnItem("BuzzsawPuff")
tnt1 a 0 A_PlaySound("mortar/bounce")
Goto Idle
bounce.floor:
TNT1 A 0 A_JumpIf(velz > 1, "IdleSound")
Goto BounceDed

BounceDed:
BSAW A 0 A_Stop
BounceDead:
BSAW H 1 A_CountDown
Loop




	Death: //crashed somewhere and checks for splash
        MISL B 0 //A_Explode
        Stop
		
		XDeath:	//splash damage beep
			TNT1 A 0 A_GiveToTarget("DamageDealtSoundItemHack",1)
		BLLT A 0 BRIGHT A_SpawnItem("Dusk_BloodParticle")
        MISL B 0 //A_Explode
        Stop
		

    }
}
 