actor Junkman_W : BaseMM8BDMWep_CBM
{
tag "$TAGC_7B"
dropitem "JunkShieldWep"
Weapon.AmmoUse 300//60
Weapon.AmmoGive 28
Obituary "$OB_JUNKSHIELD"
weapon.ammotype "TrunkAmmo"
States
{
Spawn:
C_07 B 1
loop

Deselect:
7B_H A 0
goto DeselectSwap
Select:
7B_H X 0
goto SelectSwap

Ready:
7B_H X 0 ACS_NamedExecuteWithResult("core_weaponcolor",DYE_JUNKMAN)
7B_H X 0 A_GunFlash("NoFlash",0)
7B_H X 0 A_GiveInventory("SpawningMisfire",1)
goto Ready0
Ready0:
7B_H XYZ 3 A_WeaponReady
7B_H A 0 A_TakeInventory("SpawningMisfire",1)
Goto Ready1

Ready1:
7B_H A 0 A_JumpIfInventory("TrunkAmmo",300,"Ready2")//60
7B_H A 2 A_WeaponReady(4)
7B_H A 0 A_GiveInventory("TrunkAmmo",3)
loop
Ready2:
7B_H A 0 A_JumpIfInventory("UseJunkmanShield_F",1,"JunkShield")
7B_H A 2 A_WeaponReady
7B_H A 0 A_GiveInventory("TrunkAmmo",3)
loop

SpawnProtect:
7B_H A 1
Goto Ready0

Flash.Main:
TNT1 AAAAAA 2 A_TakeInventory("TrunkAmmo",25)
stop

Fire:
7B_H A 0 A_JumpIfInventory("SpawningMisfire",1,"SpawnProtect")
7B_H A 0 A_GiveInventory("VivifyDelay4",1)
7B_H A 0 A_Refire(1)
7B_H A 0 A_GunFlash("Flash.Main",1)
7B_H BCDEFG 2 A_TakeInventory("TrunkAmmo",25,1)
7B_H H 19 A_GiveInventory("Junkman_Fire_P")
7B_H GFEDCB 3
7B_H A 1
7B_H A 0 A_TakeInventory("UseJunkmanShield_F")
goto Ready1

Altfire:
7B_H I 0 A_FireCustomMissile("JunkPunch",0,0,-8,0)
7B_H I 0 A_GiveInventory("JunkmanPunchFlag")
7B_H I 0 A_PlaySoundEx("Weapon/napalm","Weapon")
7B_H I 2 A_GiveInventory("TrunkAmmo",1)
7B_H J 3 A_GiveInventory("JunkPunchShot_P",1)
7B_H J 5 A_GiveInventory("TrunkAmmo",1)
//7B_H J 0 A_TakeInventory("JunkmanPunchFlag")
7B_H JKKLLI 2 A_GiveInventory("TrunkAmmo",1)
//7B_H I 0 A_ReFire("Altfire")
7B_H A 0 A_TakeInventory("UseJunkmanShield_F")
Goto Ready1

JunkShield:
7B_H A 0 A_JumpIfInventory("TrunkAmmo",300,"ShieldUp1")//45
7B_H A 0 A_TakeInventory("UseJunkmanShield_F")
Goto Ready1
ShieldUp1:
7B_H O 0 A_PlaySoundEx("item/JunkArmor","SoundSlot7")
7B_H O 0 A_GunFlash("NoFlash",0)
7B_H O 0 A_TakeInventory("JunkM_ResetShield")
7B_H O 0 A_TakeInventory("TrunkAmmo",150)
7B_H O 0 A_TakeInventory("TrunkAmmo",150,1)
7B_H O 0 A_JumpIfInventory("ShieldCheck",1,"ShieldUp2")
7B_H O 2
7B_H O 0 A_JumpIf(1,1)
7B_H PQRS 2
goto ShieldUpEnd
ShieldUp2:
7B_H O 0 A_PlaySoundEx("item/JunkArmorTrash","SoundSlot7")
7B_H O 0 A_GiveInventory("JunkM_ResetShield",1)
7B_H O 2
7B_H O 0 A_JumpIf(1,1)
7B_H PQ 2
7B_H R 0 A_TakeInventory("JunkM_ResetShield",1)
//7B_H R 0 A_PlaySoundEx("weapon/junkshield","Weapon")
7B_H R 2 A_GiveInventory("Junkman_Item1_P")
7B_H S 2 A_GiveInventory("Junkman_Item2_P")
goto ShieldUpEnd
ShieldUpEnd:
7B_H T 0 A_TakeInventory("BasicArmor")
7B_H T 0 A_GiveInventory("JunkM_BasicArmor_P",1)
7B_H T 0 A_GiveInventory("SetDynamicArmorDosage")
7B_H T 0 A_GiveInventory("ShieldCheck",1)
7B_H T 0 A_SpawnItemEx("JunkmanShieldWatcher_H")
7B_H TUVW 2
7B_H A 0 A_TakeInventory("UseJunkmanShield_F")
Goto Ready1
}
}

actor TrunkAmmo : Ammo
{
inventory.amount 1
inventory.maxamount 600
+INVENTORY.IGNORESKILL
}

actor JunkLeakStock : Inventory
{
inventory.amount 1
inventory.maxamount 30000
}

actor UseJunkmanShield_F : Inventory {}
actor JunkM_ResetShield : Powerup
{
Powerup.Duration 10
}
actor JunkmanPunchFlag : Powerup
{
Powerup.Duration 10
}

actor JunkBlockWasPushed_F : Powerup
{
Powerup.Duration 11
}

actor JunkShieldUseItem : BasicClassItem
{
inventory.icon "JunIcon"
inventory.pickupmessage "I love the smell of trash in the morning."
Tag "Junk Shield Trigger"
states
{
Spawn:
WEA3 N 1
loop
UseCBM:
TNT1 A 0 A_JumpIfInventory("UseJunkmanShield_F",1,"No")
TNT1 A 0 A_JumpIfInventory("TrunkAmmo",300,"Success")
fail
Success:
TNT1 A 0 A_GiveInventory("UseJunkmanShield_F",1)
fail
}
}


actor Junkman_Fire_P : CustomInventory
{
States
{
Pickup:
TNT1 A 0 A_PlaySoundEx("weapon/thunderbolt","Weapon")
TNT1 A 0 A_SpawnItemEx("JunkmanCube",64,0,-(ceilingz-z<64)*(64-(ceilingz-z)),0,0,0,0)
TNT1 A 0 A_JumpIfInventory("PlayerPropertySpread",1,1)
stop
TNT1 A 0 A_SpawnItemEx("JunkmanCube",64,-40,-(ceilingz-z<64)*(64-(ceilingz-z)),0,0,0,45)
TNT1 A 0 A_SpawnItemEx("JunkmanCube",64,40,-(ceilingz-z<64)*(64-(ceilingz-z)),0,0,0,-45)
stop
}
}


actor Junkman_Item1_P : CustomInventory
{
States
{
Pickup:
TNT1 A 0 A_FireCustomMissile("JunkmanShieldShot",0,0,0,0)
TNT1 A 0 A_FireCustomMissile("JunkmanShieldShot",120,0,0,0)
TNT1 A 0 A_FireCustomMissile("JunkmanShieldShot",-120,0,0,0)
stop
}
}
actor Junkman_Item2_P : CustomInventory
{
States
{
Pickup:
TNT1 A 0 A_FireCustomMissile("JunkmanShieldShot2",0,0,0,0)
TNT1 A 0 A_FireCustomMissile("JunkmanShieldShot2",120,0,0,0)
TNT1 A 0 A_FireCustomMissile("JunkmanShieldShot2",-120,0,0,0)
stop
}
}

actor JunkmanSpawnStart_P : CustomInventory
{
States
{
Pickup:
TNT1 A 0 A_SpawnItemEx("JunkmanLeakGiver_H")
stop
}
}

actor JunkmanLeakGiver_H : BasicHelper
{
States
{
Spawn:
TNT1 A 0
TNT1 A 5
SpawnL:
TNT1 A 0 A_JumpIf(!CallACS("cbm_PointerExists",AAPTR_TARGET),"Death")
TNT1 A 0 A_JumpIfInTargetInventory("Junkman_W",1,1)
stop
TNT1 A 1 A_GiveToTarget("JunkmanLeak_P",1)
loop
}
}

actor JunkmanLeak_P : CustomInventory
{
States
{
Pickup:
TNT1 A 0 ACS_NamedExecuteAlways("cbm_HealthDamageRage",0,13)
TNT1 A 0 A_JumpIfInventory("JunkLeakStock",100,"Pickup2") 
stop
Pickup2:
TNT1 A 0 A_TakeInventory("JunkLeakStock",100)
TNT1 A 0 A_SpawnItemEx("JunkLeakBitsX",40,0,8,random(9,11),0,random(11,14),random(0,359),1)
goto Pickup+1
}
}

actor JunkmanShieldWatcher_H : BasicHelper
{
States
{
Spawn:
TNT1 A 0
TNT1 A 0 A_GiveToTarget("JunkmanShieldLoopSnd_P",1)
Spawn2:
TNT1 A 0 A_JumpIfInTargetInventory("IsDead",1,"Death")
TNT1 A 0 A_JumpIfInTargetInventory("PlayerPropertyRage",1,2)
TNT1 AA 1 A_JumpIfInTargetInventory("JunkM_ResetShield",1,"Death")

TNT1 A 0 A_JumpIfInTargetInventory("IsDead",1,"Death")
TNT1 A 0 A_JumpIfInTargetInventory("PlayerPropertyRage",1,2)
TNT1 AA 1 A_JumpIfInTargetInventory("JunkM_ResetShield",1,"Death")

TNT1 A 0 A_JumpIfInTargetInventory("IsDead",1,"Death")
TNT1 A 0 A_JumpIfInTargetInventory("PlayerPropertyRage",1,2)
TNT1 AA 1 A_JumpIfInTargetInventory("JunkM_ResetShield",1,"Death")

TNT1 A 0 A_JumpIfInTargetInventory("IsDead",1,"Death")
TNT1 A 0 A_JumpIfInTargetInventory("PlayerPropertyRage",1,2)
TNT1 AA 1 A_JumpIfInTargetInventory("JunkM_ResetShield",1,"Death")

TNT1 A 0 A_JumpIf(ACS_NamedExecuteWithResult("core_targetexists")==0,"SuperDeath")

TNT1 A 0 A_GiveToTarget("JunkmanShieldSpawn_P",1)
TNT1 A 0 A_JumpIfInTargetInventory("BasicArmor",1,"Spawn2")
goto Death

Death:
TNT1 A 0 A_JumpIfInTargetInventory("IsDead",1,"SuperDeath")
TNT1 A 1 A_GiveToTarget("JunkmanShieldEndSnd_P",1)
TNT1 A 0 A_TakeFromTarget("DynamicArmorDosage")
TNT1 A 1 A_TakeFromTarget("ShieldCheck",1)
TNT1 A 0 A_TakeFromTarget("BasicArmor")
TNT1 A 0 A_TakeFromTarget("JunkM_ResetShield",100)
stop
SuperDeath:
TNT1 A 1 A_GiveToTarget("StopSnd_P7",1)
stop
}
}

actor JunkmanShieldLoopSnd_P  : CustomInventory
{
States
{
Pickup:
TNT1 A 0 A_PlaySound("weapon/JunkM_ShieldLoop",4,0.85,1)
stop
}
}

actor JunkmanShieldEndSnd_P  : CustomInventory
{
States
{
Pickup:
TNT1 A 0 A_PlaySound("weapon/JunkBreaker",4)
stop
}
}

actor JunkmanShieldSpawn_P : CustomInventory
{
States
{
Pickup:
TNT1 A 0 A_SpawnItemEx("JunkmanShieldBoom",0,0,32,momx,momy,momz,0,8)
stop
}
}

actor JunkPunch : GutPunch
{
Obituary "$OB_JUNKPUNCH"
damagetype "JunkM_Punch"
damage (250)
States
{
Death:
OMFX B 0 A_Explode(250,40,0)
goto XDeath
}
}

actor JunkCubeAmmoDelay : Powerup
{
Powerup.Duration 3
}
actor JunkCubeAmmoGive_P : CustomInventory
{
States
{
Pickup:
TNT1 A 0 A_JumpIfInventory("JunkCubeAmmoDelay",1,3)
TNT1 A 0 A_JumpIfInventory("Dustman_W",1,"PickupDust")
TNT1 A 0 A_JumpIfInventory("Junkman_W",1,"PickupJunk")
TNT1 A 0
stop
PickupDust:
TNT1 A 0 A_GiveInventory("CrushEmAmmo",1)
goto GaveAmmo
PickupJunk:
TNT1 A 0 A_GiveInventory("TrunkAmmo",3)
goto GaveAmmo
GaveAmmo:
TNT1 A 0 A_GiveInventory("JunkCubeAmmoDelay",1)
stop
}
}

actor JunkM_CubeProtect : PowerProtection
{
Powerup.Duration 4
damagefactor "JunkM_Cube", 0.0
}

actor JunkmanCube : CBM_ShootableActor//ProjSpawnFuncActor
{
var int user_P;
Obituary "$OB_JUNKCUBE"
damagetype "JunkM_Cube"
+MISSILE//PROJECTILE//-NOBLOCKMAP
+CANTSEEK
+DONTBLAST
+DONTDRAIN
+DONTREFLECT
+DONTRIP
+DONTSPLASH
+NOBLOOD
+NOEXPLODEFLOOR
+NOGRAVITY
+NOPAIN
+NOTARGETSWITCH
+RIPPER
+SHOOTABLE
+SKYEXPLODE

+STEPMISSILE
maxstepheight 32
+EXPLODEONWATER
+BOUNCEONCEILINGS
BounceFactor 0.00
WallBounceFactor 0.95
BounceCount -1
Species "JunkCubeThing"

mass 999999
Health 2500
damagefactor "JunkShield", 0.0
damagefactor "JunkM_Shield", 0.0
damagefactor "JunkM_Shot", 0.0
damagefactor "JunkM_Shock", 0.0
damagefactor "JunkM_Punch", 0.0
damagefactor "JunkM_Cube", 0.0


ReactionTime 1
Damage (20+user_P*10)
Radius 30
Height 64
Speed 0
Scale 2.5
Args 0,0,29,0,0

states
{
Spawn:
JUCT A 0
JUCT A 3// A_Stop
JUCT BCDE 3 A_SetUserVar("user_P",user_P+2)
JUCT F 0 A_ChangeFlag("NOGRAVITY",0)
JUCT F 0 //A_SetArg(2,29)
JUCT FG 3 A_SetUserVar("user_P",user_P+2)
JUCT E 0 //A_ChangeFlag("FLOORHUGGER",1)
goto SpawnSit
SpawnSit:
JUCT D 0 A_JumpIf(ACS_NamedExecuteWithResult("core_targetexists")==0,"Death")
JUCT D 0 A_RadiusGive("JunkCubeAmmoGive_P",196,512+2)
JUCT DDD 1 A_JumpIfInTargetInventory("JunkmanPunchFlag",1,"LaunchCheck")
JUCT D 0 A_RadiusGive("JunkCubeAmmoGive_P",196,514)
JUCT DDD 1 A_JumpIfInTargetInventory("JunkmanPunchFlag",1,"LaunchCheck")
JUCT D 0 A_RadiusGive("JunkCubeAmmoGive_P",196,514)
JUCT DDD 1 A_JumpIfInTargetInventory("JunkmanPunchFlag",1,"LaunchCheck")
JUCT D 0 A_RadiusGive("JunkCubeAmmoGive_P",196,514)
JUCT DDD 1 A_JumpIfInTargetInventory("JunkmanPunchFlag",1,"LaunchCheck")
JUCT D 0 A_CountDownArg(2)//DamageThing(7)
loop
LaunchCheck:
JUCT D 0 A_RadiusGive("JunkCubeAmmoGive_P",196,514)
JUCT DDD 1 A_JumpIfCloser(150,"Launched")
JUCT D 0 A_RadiusGive("JunkCubeAmmoGive_P",196,514)
JUCT DDD 1 A_JumpIfCloser(150,"Launched")
JUCT D 0 A_RadiusGive("JunkCubeAmmoGive_P",196,514)
JUCT DDD 1 A_JumpIfCloser(150,"Launched")
JUCT D 0 A_RadiusGive("JunkCubeAmmoGive_P",196,514)
JUCT DDD 1 A_JumpIfCloser(150,"Launched")
JUCT D 0 A_CountDownArg(2)
goto SpawnSit
Launched:
JUCT F 0 A_SetArg(2,Args[2]+29)
JUCT F 0 A_SetArg(1,health)
JUCT D 0 A_GiveToTarget("JunkBlockWasPushed_F",1)
JUCT D 0 A_ChangeFlag("NOGRAVITY",1)
JUCT D 0 A_Stop
JUCT D 1 ACS_NamedExecuteWithResult("cbm_CopyPointerAnglePitch",2,2)
JUCT D 0 A_SpawnItemEx("JunkmanCubePushed",0,0,0,8,0,momz,0,SXF_TRANSFERSPECIAL)//32768
stop

Death:
TNT1 A 0 A_PlaySoundEx("weapon/JunkBreaker","Weapon")
TNT1 AAAAAAAA 0 A_SpawnItemEx("JunkMetalBitsX",0,0,0,random(8,12),0,random(11,16),random(0,359))
TNT1 A 1
stop
}
}

actor JunkmanCubePushed : CBM_ShootableActor//ProjSpawnFuncActor
{
damagetype "JunkM_Cube"
Obituary "$OB_JUNKCUBE"
+MISSILE
+SKYEXPLODE
+BOUNCEONCEILINGS
+CANTSEEK
+DONTBLAST
+DONTDRAIN
+DONTREFLECT
+DONTRIP
+DONTSPLASH
+EXPLODEONWATER
//+INVULNERABLE
+NOBLOOD
+NOEXPLODEFLOOR
+NOPAIN
//+NORADIUSDMG
+NOTARGETSWITCH
+RIPPER
+SHOOTABLE
+STEPMISSILE
MaxStepHeight 24
+THRUSPECIES
Species "JunkCubeThing"
BounceFactor 1.0

mass 9999999
Health 2500
damagefactor "JunkShield", 0.0
damagefactor "JunkM_Shield", 0.0
damagefactor "JunkM_Shot", 0.0
damagefactor "JunkM_Shock", 0.0
damagefactor "JunkM_Punch", 0.0
damagefactor "JunkM_Cube", 0.0


ReactionTime 62
Damage (160)
Radius 30
Height 64
Speed 8
Scale 2.5
states
{
Spawn:
JUCT E 0
JUCT E 0 ACS_NamedExecuteWithResult("cbm_Re_SetThingSpecial",0,Args[1],Args[2],0)
JUCT E 0 DamageThing((health+1)-Args[1])
JUCT E 0 A_RadiusGive("JunkCubeAmmoGive_P",150,514)
JUCT E 3 A_PlaySoundEx("weapon/ClownBall","Weapon")
JUCT F 0 A_RadiusGive("JunkCubeAmmoGive_P",150,514)
JUCT F 3 A_PlaySoundEx("weapon/ClownBall","Weapon")
JUCT G 0 A_RadiusGive("JunkCubeAmmoGive_P",150,514)
JUCT G 3 A_PlaySoundEx("weapon/ClownBall","Weapon")
JUCT D 0 A_RadiusGive("JunkCubeAmmoGive_P",150,514)
JUCT D 3 A_PlaySoundEx("weapon/ClownBall","Weapon")
JUCT E 0 A_CountDownArg(2)
SpawnL:
JUCT E 0 A_RadiusGive("JunkCubeAmmoGive_P",150,514)
JUCT E 0 A_PlaySoundEx("weapon/ClownBall","Weapon")
JUCT EEE 1 A_JumpIfInTargetInventory("JunkmanPunchFlag",1,"SpawnLCheck")
JUCT F 0 A_RadiusGive("JunkCubeAmmoGive_P",150,514)
JUCT F 0 A_PlaySoundEx("weapon/ClownBall","Weapon")
JUCT FFF 1 A_JumpIfInTargetInventory("JunkmanPunchFlag",1,"SpawnLCheck")
JUCT G 0 A_RadiusGive("JunkCubeAmmoGive_P",150,514)
JUCT G 0 A_PlaySoundEx("weapon/ClownBall","Weapon")
JUCT GGG 1 A_JumpIfInTargetInventory("JunkmanPunchFlag",1,"SpawnLCheck")
JUCT D 0 A_RadiusGive("JunkCubeAmmoGive_P",150,514)
JUCT D 0 A_PlaySoundEx("weapon/ClownBall","Weapon")
JUCT DDD 1 A_JumpIfInTargetInventory("JunkmanPunchFlag",1,"SpawnLCheck")
JUCT E 0 A_CountDownArg(2)
loop
SpawnLCheck:
JUCT E 0 A_RadiusGive("JunkCubeAmmoGive_P",150,514)
JUCT E 0 A_PlaySoundEx("weapon/ClownBall","Weapon")
JUCT EEE 1 A_JumpIfCloser(150,"Launched")
JUCT F 0 A_RadiusGive("JunkCubeAmmoGive_P",150,514)
JUCT F 0 A_PlaySoundEx("weapon/ClownBall","Weapon")
JUCT FFF 1 A_JumpIfCloser(150,"Launched")
JUCT G 0 A_RadiusGive("JunkCubeAmmoGive_P",150,514)
JUCT G 0 A_PlaySoundEx("weapon/ClownBall","Weapon")
JUCT GGG 1 A_JumpIfCloser(150,"Launched")
JUCT D 0 A_RadiusGive("JunkCubeAmmoGive_P",150,514)
JUCT D 0 A_PlaySoundEx("weapon/ClownBall","Weapon")
JUCT DDD 1 A_JumpIfCloser(150,"Launched")
JUCT E 0 A_CountDownArg(2)
goto SpawnL
Launched:
JUCT D 0 A_SetArg(1,health)
JUCT D 0 A_SetArg(4,Args[4]+6)
JUCT D 0 A_GiveToTarget("JunkBlockWasPushed_F",1)
JUCT D 0 A_ChangeFlag("NOGRAVITY",1)
JUCT D 0 //A_Stop
JUCT D 1 ACS_NamedExecuteWithResult("cbm_CopyPointerAnglePitch",2,2)
JUCT D 0 A_SpawnItemEx("JunkmanCubePushed2",0,0,0,20+Args[4],0,momz,0,32768)
stop

Death:
TNT1 A 0 A_PlaySoundEx("weapon/JunkBreaker","Weapon")
TNT1 AAAAAAAA 0 A_SpawnItemEx("JunkMetalBitsX",0,0,0,random(8,12),0,random(11,16),random(0,359))
TNT1 A 1
stop
}
}

actor JunkmanCubePushed2 : JunkmanCubePushed
{
Speed 26//2
States
{
Launched:
JUCT D 0 A_SetArg(1,health)
JUCT D 0 A_GiveToTarget("JunkBlockWasPushed_F",1)
JUCT D 0 A_ChangeFlag("NOGRAVITY",1)
JUCT D 0 //A_Stop
JUCT D 1 ACS_NamedExecuteWithResult("cbm_CopyPointerAnglePitch",2,2)
JUCT D 0 A_SpawnItemEx("JunkmanCubePushed2",0,0,0,26+sqrt(momx*momx+momy*momy)/4,0,momz,0,32768)
//JUCT D 0 A_SpawnItemEx("JunkmanCubePushed2",0,0,0,sqrt(momx*momx+momy*momy),momz,0,0,8192)
stop
}
}

actor JunkMetalBits1 : ScrapMetalBase
{
+USESPAWNEVENTSCRIPT
var int user_UseProjSpawnFunc;
+INVENTORY.QUIET
States
{
Spawn2:
JUCT H 500
stop
}
}

actor JunkMetalBits2 : JunkMetalBits1
{
States
{
Spawn2:
JUCT I 500
stop
}
}

actor JunkMetalBits3 : JunkMetalBits1
{
States
{
Spawn2:
JUCT J 500
stop
}
}

actor JunkMetalBits4 : JunkMetalBits1
{
States
{
Spawn2:
JUCT K 500
stop
}
}

actor JunkMetalBits5 : JunkMetalBits1
{
States
{
Spawn2:
JUCT L 500
stop
}
}

actor JunkMetalBits6 : JunkMetalBits1
{
States
{
Spawn2:
JUCT M 500
stop
}
}

actor JunkMetalBits7 : JunkMetalBits1
{
States
{
Spawn2:
JUCT N 500
stop
}
}

actor JunkMetalBits8 : JunkMetalBits1
{
States
{
Spawn2:
JUCT O 500
stop
}
}

actor JunkMetalBits9 : JunkMetalBits1
{
States
{
Spawn2:
JUCT P 500
stop
}
}

actor JunkMetalBitsX : JunkMetalBits1
{
States
{
Spawn2:
TNT1 A 0 A_Jump(256,"S_1","S_2","S_3","S_4","S_5","S_6","S_7","S_8","S_9")
TNT1 A 1
loop
S_1:
JUCT H 500
stop
S_2:
JUCT I 500
stop
S_3:
JUCT J 500
stop
S_4:
JUCT K 500
stop
S_5:
JUCT L 500
stop
S_6:
JUCT M 500
stop
S_7:
JUCT N 500
stop
S_8:
JUCT O 500
stop
S_9:
JUCT P 500
stop
}
}

actor JunkLeakBitsX : JunkMetalBitsX//No 1
{
States
{
Spawn2:
TNT1 A 0 A_Jump(256,"S_2","S_3","S_4","S_5","S_6","S_7","S_8","S_9")
TNT1 A 1
loop
}
}

actor ClassJunkMetalBit : JunkMetalBitsX// No 1 and 2
{
States
{
Spawn2:
TNT1 A 0 A_Jump(256,"S_3","S_4","S_5","S_6","S_7","S_8","S_9")
TNT1 A 1
loop
}
}


actor JunkPunchShot_P : CustomInventory
{
States
{
Pickup:
TNT1 A 0 A_JumpIfInventory("JunkBlockWasPushed_F",1,"PunchEnd")
TNT1 A 0 A_JumpIfInventory("TrunkAmmo",40,"ThrowJunk")
stop
PunchEnd:
TNT1 A 0
stop
ThrowJunk:
TNT1 A 0 A_TakeInventory("TrunkAmmo",80,1)
TNT1 A 0 A_FireCustomMissile("JunkPunchShot",0,0,-8,0)
stop
}
}

actor JunkPunchShot : ProjSpawnFuncActor
{
PROJECTILE
damagetype "JunkM_Shot"
Obituary "$OB_JUNKSHOT"
//+DONTBLAST
-NOGRAVITY
+SKYEXPLODE
+EXPLODEONWATER
+THRUSPECIES
Species "JunkCubeThing"
Damage (150)
Radius 16
Height 16
Speed 50
scale 2.5
States
{
Spawn:
JUCT H 0
JUCT H 0 A_ChangeVelocity(0,0,2)
JUCT H 2
wait
Death:
DUSA A 0 A_Jump(256,"B","C","D","E","F","G")
B:
JUCT A 0 A_SpawnItemEx("JunkMetalBits7",0,0,0,random(2,5),0,random(2,3),random(0,359))
JUCT A 0 A_SpawnItemEx("JunkMetalBits8",0,0,0,random(2,5),0,random(3,2),random(0,359))
stop
C:
JUCT A 0 A_SpawnItemEx("JunkMetalBits8",0,0,0,random(2,5),0,random(3,2),random(0,359))
JUCT A 0 A_SpawnItemEx("JunkMetalBits9",0,0,0,random(2,5),0,random(2,3),random(0,359))
stop
D:
JUCT A 0 A_SpawnItemEx("JunkMetalBits7",0,0,0,random(2,5),0,random(2,3),random(0,359))
goto C+1
E:
JUCT A 0 A_SpawnItemEx("JunkMetalBits7",0,0,0,random(2,5),0,random(2,3),random(0,359))
JUCT A 0 A_SpawnItemEx("JunkMetalBits5",0,0,0,random(2,5),0,random(2,3),random(0,359))
stop
F:
JUCT A 0 A_SpawnItemEx("JunkMetalBits5",0,0,0,random(2,5),0,random(2,3),random(0,359))
goto B+1
G:
JUCT A 0 A_SpawnItemEx("JunkMetalBits5",0,0,0,random(2,5),0,random(2,3),random(0,359))
goto C+1
}
}

actor JunkmanShieldShot : ProjSpawnFuncActor
{
PROJECTILE
Obituary "$OB_JUNKSHIELD"
Damagetype "JunkM_Shock"
Damage (120)
Radius 32
Height 10
Speed 26
scale 2.5
States
{
Spawn:
JUCT I 4
loop
Death:
OMFX OBCE 2
stop
}
}

actor JunkmanShieldShot2 : JunkmanShieldShot
{
Damage (30)
Speed 26//18
States
{
Spawn:
JUCT M 4
loop
}
}

actor JunkmanShieldBoom : BasicExplosion
{
Obituary "$OB_JUNKSHIELDB"
Damagetype "JunkM_Shield"
States
{
Spawn:
TNT1 A 0
TNT1 A 0 A_SetArg(0,CallACS("cbm_countinv_acs",71,2)*(0.14-(CallACS("core_getarmorinfo",1,2)==200)*0.126))
TNT1 A 0 A_SpawnItemEx("JunkmanShieldBoom_H",0,0,0,0,0,Args[0],0,1)
TNT1 A 2 A_Explode((30+Args[0]*10)*(CallACS("core_checkrune",RUNE_SPREAD,2)*2+1),160,0,0,16)
stop
}
}

actor JunkmanShieldBoom_H : BasicExplosion//Double spawn to sync FX
{
RenderStyle None
States
{
Spawn:
TNT1 A 0
TNT1 A 0 A_SetArg(0,momz)
TNT1 A 0 A_SpawnItemEx("JunkmanShieldBitFX_H",0,0,-momz,0,0,0,0,1+32768)
stop
}
}

actor JunkmanShieldBitFX_H : BasicGraphicEffect
{
RenderStyle None
Args 5
States
{
SpawnFrame://Can't sync the arg transfer online, so momz is used above.
TNT1 A 0 A_SpawnItemEx("JunkmanShieldBitFX",0,0,0,5,0,random(-4,4),random(0,35)*10,1)
TNT1 A 0 A_CountDownArg(0)
loop
Death:
TNT1 A 1
stop
}
}

actor JunkmanShieldBitFX : BasicGraphicEffect
{
Alpha 0.5
Speed 15
States
{
SpawnFrame:
TNT1 A 0
TNT1 A 3
TNT1 A 0 A_Jump(256,"SpawnJ","SpawnK","SpawnL","SpawnM","SpawnN","SpawnO","SpawnP")
SpawnJ:
JUCT J 1
goto SpawnDone
SpawnK:
JUCT K 1
goto SpawnDone
SpawnL:
JUCT L 1
goto SpawnDone
SpawnM:
JUCT M 1
goto SpawnDone
SpawnN:
JUCT N 1
goto SpawnDone
SpawnO:
JUCT O 1
goto SpawnDone
SpawnP:
JUCT P 1
goto SpawnDone

SpawnDone:
"####" "#" 4
"####" "#" 7 A_ScaleVelocity(-1.0)
stop

}
}


//actor Junkman_W_NormalBar : NormalBar {Args 68,94}
actor Junkman_W_ScriptBar : ScriptBar {}//DUSBAR