actor Dustman_W : BaseMM8BDMWep_CBM
{
tag "$TAGC_4F"
dropitem "DustCrusherWep"
Weapon.AmmoUse 2
Weapon.AmmoGive 0
Obituary "$OB_DUSTCRUSHER"
Inventory.Pickupmessage "Power up! Yo momma!"
weapon.ammotype "CrushEmAmmo"
+WEAPON.NOAUTOAIM
inventory.icon "DUSTSI"
States
{
Spawn:
C_04 F 1
loop

Deselect:
DUSB Y 0 A_StopSound(4)
goto DeselectSwap
Select:
DUSB Y 0
goto SelectSwap

Ready:
DUSB A 0 ACS_NamedExecuteWithResult("core_weaponcolor",DYE_DUSTMAN)
Ready2:
DUSB A 12 A_WeaponReady
DUSB A 0 A_GiveInventory("CrushEmAmmo",1)
loop

Fire:
DUSB A 0 A_JumpIfInventory("CrushEmAmmo",16,"FireJunk")
goto NoAmmoFire
FireJunk:
DUSB A 0 A_PlaySoundEx("weapon/shoomp","Weapon")
DUSB A 0 A_GiveInventory("VivifyDelay4",1)
DUSB A 0 A_FireCustomMissile("DustCrusherDust",0,0,0,28)
DUSB A 0 A_TakeInventory("CrushEmAmmo",12)
DUSB A 0 A_TakeInventory("CrushEmAmmo",12,1)//16
DUSB A 0 A_Refire(1)
DUSB HIH 4
DUSB A 12
DUSB A 0 A_Refire
Goto Ready2
NoAmmoFire:
DUSB A 0 A_PlaySoundEx("Weapon/Mbuster","Weapon")
DUSB A 0 A_FireCustomMissile("DustShot",random(-3,3),0,8,0)
DUSB CB 3
DUSB A 2
DUSB A 0 A_ReFire
goto Ready2
AltFire:
DUSB D 2 A_GunFlash("Flash",1)
goto AltSuck
AltSuck:
DUSB E 2 A_GiveInventory("DustmanAltSuction_P",1)
DUSB E 0 A_Refire("AltSuck2")
DUSB D 1
Goto AltSuckEnd
AltSuck2:
DUSB F 2 A_GiveInventory("DustmanAltSuction_P",1)
DUSB F 0 A_Refire("AltSuck3")
DUSB D 1
Goto AltSuckEnd
AltSuck3:
DUSB G 2 A_GiveInventory("DustmanAltSuction_P",1)
DUSB G 0 A_Refire("AltSuck4")
DUSB D 1
Goto AltSuckEnd
AltSuck4:
DUSB F 2 A_GiveInventory("DustmanAltSuction_P",1)
DUSB F 0 A_Refire("AltSuck")
DUSB D 1
Goto AltSuckEnd
AltSuckEnd:
DUSB D 0 A_GunFlash("NoFlash",1)
DUSB D 1 A_StopSound(4)
Goto Ready2

Flash:
TNT1 A 0 A_PlaySound("weapon/DustVacuum1",4)
TNT1 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 1 A_RailWait//34 A's
TNT1 A 1 A_PlaySound("weapon/DustVacuum2",4,1,1)
stop
}
}

actor Dustman_W2 : BaseMM8BDMWep_CBM
{
tag "$TAGC_4F2"
dropitem "DustCrusherWep"
Weapon.AmmoUse 2
Weapon.AmmoGive 0
Obituary "$OB_DUSTCRUSHER"
Inventory.Pickupmessage "Power up! Yo sucker!"
weapon.ammotype "CrushEmAmmo"
+WEAPON.NOAUTOAIM
inventory.icon "DustIcon"
States
{
Spawn:
C_04 F 1
loop

Deselect:
DUSB X 0 A_StopSound(4)
goto DeselectSwap
Select:
DUSB X 0
goto SelectSwap

Ready:
DUSA A 0 ACS_NamedExecuteWithResult("core_weaponcolor",DYE_DUSTMAN)
Ready2:
DUSA A 12 A_WeaponReady
DUSA A 0 A_GiveInventory("CrushEmAmmo",1)
loop

Fire:
DUSA A 0 A_JumpIfInventory("CrushEmAmmo",1,"DustBitShot")
goto NoAmmoFire
DustBitShot:
DUSA A 0 A_PlaySoundEx("weapon/dustbit","Weapon")
DUSA A 0 A_FireCustomMissile("DustBitPew",0,1,8,0)
DUSA CB 3
DUSA A 4
DUSA A 0 A_Refire
Goto Ready+1
NoAmmoFire:
DUSA A 0 A_PlaySoundEx("Weapon/Mbuster","Weapon")
DUSA A 0 A_FireCustomMissile("DustShot",random(-3,3),0,8,0)
DUSA CB 3
DUSA A 2
DUSA A 0 A_ReFire
goto Ready2

AltFire:
DUSA D 2 A_GunFlash("Flash",1)
goto AltSuck
AltSuck:
DUSA E 2 A_GiveInventory("DustmanAltSuction_P",1)
DUSA E 0 A_Refire("AltSuck2")
DUSA D 1
Goto AltSuckEnd
AltSuck2:
DUSA F 2 A_GiveInventory("DustmanAltSuction_P",1)
DUSA F 0 A_Refire("AltSuck3")
DUSA D 1
Goto AltSuckEnd
AltSuck3:
DUSA G 2 A_GiveInventory("DustmanAltSuction_P",1)
DUSA G 0 A_Refire("AltSuck4")
DUSA D 1
Goto AltSuckEnd
AltSuck4:
DUSA F 2 A_GiveInventory("DustmanAltSuction_P",1)
DUSA F 0 A_Refire("AltSuck")
DUSA D 1
Goto AltSuckEnd
AltSuckEnd:
DUSA D 0 A_GunFlash("NoFlash",1)
DUSA D 1 A_StopSound(4)
Goto Ready2

Flash:
TNT1 A 0 A_PlaySound("weapon/DustVacuum1",4)
TNT1 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 1 A_RailWait//34 A's
TNT1 A 1 A_PlaySound("weapon/DustVacuum2",4,1,1)
stop
}
}

actor CrushEmAmmo : Ammo
{
inventory.amount 1
inventory.maxamount 224//56
+INVENTORY.IGNORESKILL
}

actor PowerDustSuctionSnd : Powerup
{
Powerup.Duration 24
}

actor DustmanAltSuction_P : CustomInventory
{
States
{
Pickup:
//TNT1 A 0 A_FireCustomMissile("DustSuckerGrabFX",0,0,0,24)
TNT1 A 0 A_SpawnItemEx("DustSuckerGrabFX",0,0,32+24,cos(pitch),0,-sin(pitch),0,SXF_MULTIPLYSPEED)//8192
//TNT1 A 0 A_FireCustomMissile("DustSuckerGrab",0,0,0,24)
TNT1 A 0 A_SpawnItemEx("DustSuckerGrab",0,0,32+24,cos(pitch),0,-sin(pitch),0,SXF_MULTIPLYSPEED)//8192
TNT1 A 0 A_FireCustomMissile("DustSucker",0,0,0,24)


//TNT1 AAA 0 A_FireCustomMissile("DustSuckerParticle",random(-15,15),0,random(-10,10),random(-10,10)+24,0,random(-10,10))

//TNT1 AAAA 0 A_FireCustomMissile("DustSuckerParticleFX_H",random(-15,15),0,random(-10,10),random(-10,10)+24,0,0)
TNT1 A 0 A_FireCustomMissile("DustSuckerParticleFX_H",0,0,0,24,0,random(-10,10))

TNT1 A 0 //A_JumpIfInventory("CrushEmAmmo",224,2)
//TNT1 A 0 A_JumpIfInventory("PowerDustSuctionSnd",1,3)
//TNT1 A 0 A_PlaySound("weapon/DustSuction",4,0.5)
//TNT1 A 0 A_GiveInventory("PowerDustSuctionSnd",1)
TNT1 A 0
stop
}
}

actor DustCrusherDust : ProjSpawnFuncActor
{
PROJECTILE
damagetype "DustM_Crush"
Obituary "$OB_DUSTCRUSHER"
+SKYEXPLODE
+EXPLODEONWATER
damage (350)
Radius 14
Height 12
speed 30
scale 2.5
States
{
Spawn:
DUSA T 4
loop
Crash:
XDeath:
NMFX A 0 A_PlaySoundEx("weapons/mm4/dustcrushersplit", "Body")
NMFX ABCD 2
stop
Death:
NMFX A 0 A_PlaySoundEx("weapons/mm4/dustcrushersplit", "Body")
NMFX A 0 A_SpawnItemEx("DustCrusherDustPickup",0,0,0,random(0,2),0,4,0,1)
NMFX A 0 A_SpawnItemEx("DustBit1Dust",0,0,0,28,0,0,45)
NMFX A 0 A_SpawnItemEx("DustBit2Dust",0,0,0,28,0,0,-45)
NMFX A 0 A_SpawnItemEx("DustBit3Dust",0,0,0,28,0,0,225)
NMFX A 0 A_SpawnItemEx("DustBit4Dust",0,0,0,28,0,0,-225)
NMFX ABCD 2
stop
}
}

actor DustBit1Dust : ProjSpawnFuncActor
{
PROJECTILE
damagetype "DustM_CrushBit"
Obituary "$OB_DUSTCRUSHER"
ReactionTime 90
damage (150)
Radius 9
Height 7
speed 28
scale 2.5
states
{
Spawn:
DUSA U 4 
loop
}
}

actor DustBit2Dust : DustBit1Dust
{
states
{
Spawn:
DUSA V 4
loop
}
}

actor DustBit3Dust : DustBit1Dust
{
states
{
Spawn:
DUSA W 4
loop
}
}

actor DustBit4Dust : DustBit1Dust
{
states
{
Spawn:
DUSA X 4
loop
}
}



actor DustBitPew : DustBit1Dust
{
-THRUACTORS
damage (150)
Radius 10
Height 8
speed 34
states
{
Spawn:
TNT1 A 0
DUSA U 0 A_Jump(256,"U","V","W","X")
U:
DUSA U 1
loop
V:
DUSA V 1
loop
W:
DUSA W 1
loop
X:
DUSA X 1
loop
Death:
TNT1 A 1
stop
}
}


actor DustShot : ProjSpawnFuncActor
{
PROJECTILE
damagetype "DustM_Shot"
Obituary "$OB_DUSTBUSTER"
+FORCEXYBILLBOARD
+BRIGHT
damage (100)
Radius 10
Height 6
speed 28
scale 2.5
States
{
Spawn:
TNT1 A 1
Q_0D B 1
wait
}
}


actor DustBits : ScrapMetalBase
{
inventory.pickupmessage "Picked up some scrap metal."
States
{
Spawn2:
TNT1 A 1 A_Jump(256,"One","Two","Three","Four")
TNT1 A 1
loop
One:
DUST B 500
stop
Two:
DUST C 500
stop
Three:
DUST D 500
stop
Four:
DUST E 500
stop
}
}

actor DustCrusherDustPickup : ScrapMetalBase
{
+USESPAWNEVENTSCRIPT
var int user_UseProjSpawnFunc;
States
{
Spawn2:
TNT1 A 1 A_Jump(256,"S_J","S_K","S_L","S_M","S_N","S_O","S_P")
TNT1 A 1
loop
S_J:
DUSA J 500
stop
S_K:
DUSA K 500
stop
S_L:
DUSA L 500
stop
S_M:
DUSA M 500
stop
S_N:
DUSA N 500
stop
S_O:
DUSA O 500
stop
S_P:
DUSA P 500
stop
}
}

actor DustSucker : BasicHelper
{
+SERVERSIDEONLY
states
{
Spawn:
TNT1 A 0
TNT1 A 0 A_JumpIfInTargetInventory("CrushEmAmmo",224,2)
TNT1 A 3 ACS_NamedExecuteWithResult("cbm_ConedPushPull",700,10,-3,-2)//Range,Angle,Power,Type
stop
TNT1 A 3 ACS_NamedExecuteWithResult("cbm_ConedPushPull",700,10,-1,-2)
stop
}
}

actor DustSuckerParticle : FastProjectile
{
+SKYEXPLODE
+EXPLODEONWATER
+DONTBLAST
+DONTSPLASH
+DONTREFLECT
//+CLIENTSIDEONLY
//-PICKUP
RenderStyle None
Damage (0)
radius 12
height 12
Speed 650//450
States
{
Spawn:
TNT1 A 1
goto Death
Crash:
XDeath:
Death:
//TNT1 A 0 A_Stop
TNT1 A 0 A_CustomMissile("DustSuckerParticleFX",0,0,0,0)
stop
}
}

actor DustSuckerParticleFX_H : BasicHelper//Sync FX being spawned
{
+NOTIMEFREEZE
speed 1
Args 4
States
{
Spawn:
TNT1 A 0
TNT1 A 0
TNT1 A 0 ACS_NamedExecuteWithResult("cbm_CopyPointerAnglePitch",2,0)
TNT1 A 0
//TNT1 AAAA 0 A_SpawnItemEx("DustSuckerParticleFX1",0,0,0,cos(pitch+random(-10,10)),0,-sin(pitch+random(-10,10)),random(-10,10),1+SXF_TRANSFERPITCH+SXF_TRANSFERPOINTERS+SXF_MULTIPLYSPEED)//512+1024+8192
//TNT1 A 1
TNT1 A 0 A_SetArg(1,random(-10,10))
TNT1 A 0 A_SpawnItemEx("DustSuckerParticleFX1",0,0,random(-10,10),cos(pitch+Args[1]),0,-sin(pitch+Args[1]),random(-15,15),1+1024+8192)
TNT1 A 0 A_SetArg(1,random(-10,10))
TNT1 A 0 A_SpawnItemEx("DustSuckerParticleFX1",0,0,random(-10,10),cos(pitch+Args[1]),0,-sin(pitch+Args[1]),random(-15,15),1+1024+8192)
TNT1 A 0 A_SetArg(1,random(-10,10))
TNT1 A 0 A_SpawnItemEx("DustSuckerParticleFX1",0,0,random(-10,10),cos(pitch+Args[1]),0,-sin(pitch+Args[1]),random(-15,15),1+1024+8192)
TNT1 A 0 A_SetArg(1,random(-10,10))
TNT1 A 0 A_SpawnItemEx("DustSuckerParticleFX1",0,0,random(-10,10),cos(pitch+Args[1]),0,-sin(pitch+Args[1]),random(-15,15),1+1024+8192)
TNT1 A 2
stop
}
}

actor DustSuckerParticleFX1 : DustSuckerParticle
{
+CLIENTSIDEONLY
States
{
Spawn:
TNT1 A 1
TNT1 A 0
goto Death
Crash:
XDeath:
Death:
TNT1 A 0 A_CustomMissile("DustSuckerParticleFX",0,0,0,CMF_OFFSETPITCH,2)
stop
}
}

actor DustSuckerParticleFX
{
+MISSILE
+CLIENTSIDEONLY
+DONTSPLASH
+DONTBLAST
+THRUACTORS
//+NOINTERACTION
-SOLID
+NOGRAVITY
height 5
radius 5
Speed 45
Scale 2.5
States
{
Spawn:
COSS B 0
COSS BBBBBBBBBBBBBBBB 1 A_JumpIfCloser(60,"Death")
stop
Death:
TNT1 A 0
stop
}
}

actor DustSuckerGrab : DustSuckerParticle
{
+SERVERSIDEONLY
States
{
Spawn:
TNT1 A 1
Crash:
XDeath:
Death:
TNT1 A 0 A_Stop
TNT1 A 2 A_SpawnItemEx("DustSuckerGrabber_H",0,0,0,0,0,0,0,0,0,-CallACS("core_getptrtid",2)-3500)
stop
}
}//-CallACS("core_getptrtid",2)-3500 >> -4500 to -4563
actor DustSuckerGrabber_H : BasicHelper
{
+SERVERSIDEONLY
States
{
Spawn:
TNT1 A 0
//TNT1 A 0 Thing_ChangeTID(0,(-CallACS("core_getptrtid",2)-3500))
TNT1 A 2
stop
}
}


actor DustSuckerGrabFX : DustSuckerParticle
{
+CLIENTSIDEONLY
//ReactionTime 1
States
{
Spawn:
TNT1 A 1
Crash:
XDeath:
Death:
TNT1 A 0 A_Stop
TNT1 A 1 A_JumpIf(CallACS("cbm_IsPointerClient",2)==1,"DeathClient")
TNT1 A 1
stop
DeathClient:
TNT1 A 0 A_GiveInventory("MM8BDMProjSpawnFuncClient")
TNT1 A 1 A_SpawnItemEx("DustSuckerGrabFX2",0,0,0,0,0,0,0,1)
stop
}
}

actor DustSuckerGrabFX2 : BasicGraphicEffect
{
RenderStyle Add
Alpha 1.0
States
{
Spawn:
DUSB K 0
DUSB KL 1
stop
}
}

//actor Dustman_W_NormalBar : NormalBar {Args 4,93}
actor Dustman_W_ScriptBar : ScriptBar {}
actor Dustman_W2_ScriptBar : ScriptBar {}