ACTOR Unmaker : BrutalWeapon
{
	Weapon.SelectionOrder 3000
	Weapon.AmmoUse1 1
	Weapon.AmmoGive 50
	Weapon.AmmoType1 "SoulAmmo"
    Inventory.PickupSound "BFGREADY"
    +WEAPON.BFG
	+WEAPON.NOAUTOAIM
	+WEAPON.NOAUTOFIRE
	+WEAPON.EXPLOSIVE
	Inventory.PickupMessage "$GOTUNMAKER"
	YScale 1.0
	XScale 1.2
	DropItem "UnmakerSpawner"
	States
	{
	Ready:
	Ready3:
		UNHG ABCD 2 A_WeaponReady
		UNHG A 0 A_JumpIfInventory("GoFatality", 1, "Steady")
        UNHG A 0 A_JumpIfInventory("Kicking",1,"DoKick")
        UNHG A 0 A_JumpIfInventory("Taunting",1,"Taunt")
		UNHG A 0 A_JumpIfInventory("Salute1", 1, "Salute")
		UNHG A 0 A_JumpIfInventory("Salute2", 1, "Salute")
		UNHG A 0 A_JumpIfInventory("TossGrenade",1,"TossGrenade")
		TNT1 A 0 A_JumpIfInventory("ExecuteDownedEnemy", 1, "DoExecution")
		UNHG A 0 A_JumpIfInventory("IsRunning",1,"StartSprint")

		UNHG DCBA 2 A_WeaponReady
		UNHG A 0 A_JumpIfInventory("GoFatality", 1, "Steady")
        UNHG A 0 A_JumpIfInventory("Kicking",1,"DoKick")
        UNHG A 0 A_JumpIfInventory("Taunting",1,"Taunt")
		UNHG A 0 A_JumpIfInventory("Salute1", 1, "Salute")
		UNHG A 0 A_JumpIfInventory("Salute2", 1, "Salute")
		UNHG A 0 A_JumpIfInventory("TossGrenade",1,"TossGrenade")
		TNT1 A 0 A_JumpIfInventory("ExecuteDownedEnemy", 1, "DoExecution")
		UNHG A 0 A_JumpIfInventory("IsRunning",1,"StartSprint")
		Goto Ready3

	StartSprint:
		UNHG A 1 A_WeaponReady
		SHTN A 0 A_Takeinventory("Zoomed",1)
        SHTN A 0 A_ZoomFactor(1.0)
		SHTN A 0 A_Takeinventory("ADSmode",1)
		RIFG A 0 A_SetCrosshair(0)
		SHTN A 0 A_Giveinventory("GoSpecial",1)
		TNT1 A 0 ACS_NamedExecuteAlways("BDSprint", 0, 0, 0, 0)//Makes player faster.

	Sprinting:
		UNHS A 1 offset(-9,34) A_SetPitch(pitch -0.5)
		UNHS A 1 offset(-6,36) A_SetPitch(pitch -0.5)
		UNHS A 1 offset(-3,38) A_SetPitch(pitch -0.5)
		UNHS A 1 offset(0,38) A_SetPitch(pitch -0.5)
		UNHS A 1 offset(3,36) A_SetPitch(pitch -0.5)
		UNHS A 1 offset(6,34) A_SetPitch(pitch -0.5)
		UNHS A 1 offset(9,32) A_SetPitch(pitch -0.5)
		TNT1 A 0 A_GiveInventory("UsedStamina", 3)
		SMGG A 0 A_WeaponReady(WRF_NOBOB)
		SMGG A 0 A_JumpIfInventory("Kicking",1,"DoKick")
        SMGG A 0 A_JumpIfInventory("Taunting",1,"Taunt")

		UNHS A 1 offset(9,34) A_SetPitch(pitch +0.5)
		UNHS A 1 offset(6,36) A_SetPitch(pitch +0.5)
		UNHS A 1 offset(3,38) A_SetPitch(pitch +0.5)
		UNHS A 1 offset(0,38) A_SetPitch(pitch +0.5)
		UNHS A 1 offset(-3,36) A_SetPitch(pitch +0.5)
		UNHS A 1 offset(-6,34) A_SetPitch(pitch +0.5)
		UNHS A 1 offset(-9,32) A_SetPitch(pitch +0.5)
		TNT1 A 0 A_GiveInventory("UsedStamina", 3)
		SMGG A 0 A_WeaponReady(WRF_NOBOB)
		SMGG A 0 A_JumpIfInventory("Kicking",1,"DoKick")
        SMGG A 0 A_JumpIfInventory("Taunting",1,"Taunt")

		PLAY A 0 ACS_NamedExecuteAlways("BDSprint", 0, 0, 0, 0)//Makes player faster.
		SMGG A 0 A_JumpIfInventory("IsRunning", 1, "Sprinting")
		Goto StopSprint

	StopSprint:
		UNHS A 0 A_JumpIfInventory("PowerStrength", 1, 2)
		UNHG A 0 A_JumpIfInventory("UsedStamina", 100, "StopSprintTired")
		UNHS A 1 ACS_NamedExecuteAlways("BDTacticalSpeed", 0, 0, 0, 0)//Makes player slower.
		Goto Ready

	StopSprintTired:
		UNHS A 1 ACS_NamedExecuteAlways("BDTacticalSpeed", 0, 0, 0, 0)//Makes player slower.
		UNHG A 0 A_PlaySound("Tired", 2)
		Goto Ready

	Deselect:
		UNHG A 0 A_StopSOund(1)
		UNHG A 0 A_StopSOund(6)
		UNHG A 0 A_TakeInventory("TossGrenade", 1)
		TNT1 A 0 A_TakeInventory("Unloading", 1)
		TNT1 A 0 A_TakeInventory("Reloading", 1)
		TNT1 A 0 A_TakeInventory("StartDualWield",1)
		TNT1 AAAAAAAAAAAA 0 A_Lower
		UNHS DCBA 1 A_Lower
		Loop
	Select:
		UNHG A 0 A_Giveinventory("GoSpecial",1)
		TNT1 A 0 A_TakeInventory("FistsSelected", 1)
		TNT1 A 0 A_TakeInventory("ShotgunSelected", 1)
		TNT1 A 0 A_TakeInventory("MinigunSelected", 1)
		TNT1 A 0 A_TakeInventory("SSGSelected", 1)
		TNT1 A 0 A_TakeInventory("RocketLauncherSelected", 1)
		TNT1 A 0 A_TakeInventory("GrenadeLauncherSelected", 1)
		TNT1 A 0 A_TakeInventory("PlasmaGunSelected", 1)
		TNT1 A 0 A_TakeInventory("RailGunSelected", 1)
		TNT1 A 0 A_TakeInventory("RevenantLauncherSelected", 1)
		TNT1 A 0 A_TakeInventory("SubMachineGunSelected", 1)
		TNT1 A 0 A_TakeInventory("BFG10KSelected", 1)
		TNT1 A 0 A_TakeInventory("BFGSelected", 1)
		TNT1 A 0 A_GiveInventory("FlameCannonSelected", 1)
		TNT1 A 0 A_TakeInventory("SawSelected", 1)
		UNHG A 0 A_Takeinventory("HasBarrel",1)
		UNHG A 0 A_TakeInventory("TossGrenade", 1)
		UNHG A 0 A_GunFlash
		TNT1 A 1 A_Raise
		TNT1 AAAAAAAAAAAA 0 A_Raise
		UNHG A 0 A_PlaySound("BFGREADY")
		Goto SelectAnimation

	SelectAnimation:
		UNHS ABCD 1
		GOto Ready

    Spawn:
		UNHW A -1
		Stop

	Fire:
		UNHG A 0
		UNHG A 0 A_PlaySOund("UNMSTA", 1)
		UNHF ABCD 1
		TNT1 A 0 A_ZoomFactor(0.97)
	Hold:
		TNT1 A 0 A_FireCustomMissile("Alerter",0,0)
	    UNHF E 1 BRIGHT A_SpawnItemEX("RedFlareSpawn",32,0,28)
		UNHG A 0 A_PlaySOund("UNMLOP", 6, 1, 1)
		UNHG A 0 A_RailAttack((random(50,50)), 0, 1, "none", "red", RGF_NOPIERCING | RGF_SILENT | RGF_FULLBRIGHT, 0, "UnmakerLaserPuff", 0, 0, 0, 1, 32.0, 0, "UnmakerLaserTrail")

		UNHF F 1 BRIGHT A_SpawnItemEX("RedFlareSpawn",32,0,28)
		UNHG A 0 A_RailAttack((random(50,50)), 0, 1, "none", "red", RGF_NOPIERCING | RGF_SILENT | RGF_FULLBRIGHT, 0, "UnmakerLaserPuff2", 0, 0, 0, 1, 32.0, 0, "UnmakerLaserTrail")

		UNHF G 1 BRIGHT A_SpawnItemEX("RedFlareSpawn",32,0,28)
		UNHG A 0 A_RailAttack((random(50,50)), 0, 1, "none", "red", RGF_NOPIERCING | RGF_SILENT | RGF_FULLBRIGHT, 0, "UnmakerLaserPuff", 0, 0, 0, 1, 32.0, 0, "UnmakerLaserTrail")

		UNHF H 1 BRIGHT A_SpawnItemEX("RedFlareSpawn",32,0,28)
		UNHG A 0 A_RailAttack((random(50,50)), 0, 1, "none", "red", RGF_NOPIERCING | RGF_SILENT | RGF_FULLBRIGHT, 0, "UnmakerLaserPuff2", 0, 0, 0, 1, 32.0, 0, "UnmakerLaserTrail")

		UNHG A 0 A_Refire

		TNT1 A 0 A_ZoomFactor(1.0)
		UNHG A 0 A_StopSOund(1)
		UNHG A 0 A_StopSOund(6)
		UNHG A 0 A_PlaySOund("UNMSTO", 1)
		UNHF DCBA 1
		Goto Ready3
	}
}

Actor UnmakerLaserPuff : HitPuff
{
	scale 0.3
	decal "Scorch"
	damagetype Desintegrate
	+FORCERADIUSDMG
	+ALWAYSPUFF
	+MTHRUSPECIES
	states
	{
	Spawn:
	Melee:
		L2NR A 1 BRIGHT
		TNT1 A 0 A_Explode(20, 32, 1, 0, 1)
		EXPL A 0 A_CustomMissile ("FlamethrowerFireParticles", 6, 0, random (0, 360), 2, random (10, 90))
		Stop
	}
}

Actor UnmakerLaserPuff2: HitPuff
{
	scale 0.3
	decal "None"
	damagetype Desintegrate
	+FORCERADIUSDMG
	+ALWAYSPUFF
	+MTHRUSPECIES
	states
	{
	Spawn:
	Melee:
		L2NR A 1 BRIGHT
		TNT1 A 0 A_Explode(20, 32, 1, 0, 1)
		EXPL A 0 A_CustomMissile ("FlamethrowerFireParticles", 6, 0, random (0, 360), 2, random (10, 90))
		Stop
	}
}

Actor UnmakerLaserTrail
{
	+FORCEXYBILLBOARD
	+CLIENTSIDEONLY
	+NOBLOCKMAP
	+NOGRAVITY
	+SHADOW
	+NOTELEPORT
	+CANNOTPUSH
	+NODAMAGETHRUST
	renderstyle ADD
	alpha 0.9
	scale .15
	states
	{
	Spawn:
		LEYS R 0
		LEYS R 1 BRIGHT
		Stop
	}
}

ACTOR SoulAmmo : Ammo
{
   Inventory.Amount 0
   Inventory.MaxAmount 666
   Ammo.BackpackAmount 0
   Ammo.BackpackMaxAmount 666
   Inventory.Icon "BDSLA0"
   +INVENTORY.NOSCREENFLASH
}