actor ChainBlastWep : Weapon {}

actor ChainBlastWepSH : BaseMM8BDMWep
{
+INVENTORY.RESTRICTABSOLUTELY Inventory.RestrictedTo megamans
Weapon.AmmoUse 4
Weapon.AmmoGive 28
Weapon.SlotNumber 5
Inventory.Pickupmessage "$PU_CHAINBLAST"
Obituary "$OB_CHAINBLAST"
Tag "$TAG_CHAINBLAST"
weapon.ammotype "ChainBlastAmmo"
inventory.icon "CBLAICON"
States
{
SpawnLoop:
11WP F 1
loop
Ready:
CBLA A 0 ACS_ExecuteAlways(998,0,245)
CBLA A 1 A_WeaponReady
Goto Ready+1
Deselect:
TNT1 AAAAAAAAAAAAAAAAAAAAAA 0 A_Lower
CBLA A 1 A_Lower
Goto Deselect+1
Select:
TNT1 AAAAAAAAAAAAAAAAAAAAAA 0 A_Raise
CBLA A 1 A_Raise
Goto Select+1
Fire:
CBLA D 0 A_JumpIfNoAmmo("NoAmmo")
CBLA B 1
CBLA C 1
CBLA D 0 A_PlaySoundEx("weapon/mbuster", "Weapon")
CBLA D 0 A_FireCustomMissile("ChainBomb",0,1,0,0)
CBLA EEE 2
CBLA ECB 3
CBLA A 6
goto Ready+1
NoAmmo:
CBLA A 1 ACS_Execute(979,0)
Goto Ready+1

NoAmmo:
CBLA A 1 ACS_Execute(979,0)
CBLA A 0
Goto Ready+1
}
}

actor ChainBlastAmmo : Ammo
{
inventory.amount 1
inventory.maxamount 28
+INVENTORY.IGNORESKILL
}

actor ChainBomb
{
PROJECTILE
+SKYEXPLODE
+HITTRACER
damagetype "ChainBlast"
Obituary "$OB_CHAINBLAST"
Radius 16
Height 16
scale 2.5
damage (0)
speed 45
var int User_PosX;
var int User_PosY;
var int User_PosZ;
var int User_ChainBlastCount;
States
{
Spawn:
CBLB A 4
CBLB D 0 A_Scalevelocity(1.05)
CBLB B 4
CBLB B 0 A_Scalevelocity(1.05)
CBLB C 4
CBLB D 0 A_Scalevelocity(1.05)
CBLB D 4
CBLB D 0 A_Scalevelocity(1.05)
loop
Crash:
XDeath:
CBLB A 0 A_PlaySound("weapon/crashland")
TNT1 A 0 A_SetUserVar(User_PosX,random(-5,5))
TNT1 A 0 A_SetUserVar(User_PosY,random(-5,5))
TNT1 A 0 A_SetUserVar(User_PosZ,random(0,6))
TNT1 A 0 A_GiveInventory("ChainBlastFlag",1,AAPTR_TRACER)

Goto Latch
Death:
REMI A 0 A_Stop
REMI A 0 A_PlaySound("weapon/crashland")
Latch:
CBLB A 0 A_Changeflag("NOINTERACTION",1)
TNT1 A 0 A_JumpIfInventory("CutterFlag",2,"Latch2")
CBLB D 0 A_JumpIfInventory("NoRemoteMineLatch", 1, "Detonate", AAPTR_TRACER)
CBLB A 1 A_Warp(AAPTR_TRACER,User_PosX,User_PosY,User_PosZ,0,WARPF_COPYINTERPOLATION|WARPF_NOCHECKPOSITION)
CBLB A 1 A_Warp(AAPTR_TRACER,User_PosX,User_PosY,User_PosZ,0,WARPF_COPYINTERPOLATION|WARPF_NOCHECKPOSITION)
CBLB A 1 A_Warp(AAPTR_TRACER,User_PosX,User_PosY,User_PosZ,0,WARPF_COPYINTERPOLATION|WARPF_NOCHECKPOSITION)
CBLB A 1 A_Warp(AAPTR_TRACER,User_PosX,User_PosY,User_PosZ,0,WARPF_COPYINTERPOLATION|WARPF_NOCHECKPOSITION)

CBLB B 1 A_Warp(AAPTR_TRACER,User_PosX,User_PosY,User_PosZ,0,WARPF_COPYINTERPOLATION|WARPF_NOCHECKPOSITION)
CBLB B 1 A_Warp(AAPTR_TRACER,User_PosX,User_PosY,User_PosZ,0,WARPF_COPYINTERPOLATION|WARPF_NOCHECKPOSITION)
CBLB B 1 A_Warp(AAPTR_TRACER,User_PosX,User_PosY,User_PosZ,0,WARPF_COPYINTERPOLATION|WARPF_NOCHECKPOSITION)
CBLB B 1 A_Warp(AAPTR_TRACER,User_PosX,User_PosY,User_PosZ,0,WARPF_COPYINTERPOLATION|WARPF_NOCHECKPOSITION)

CBLB C 1 A_Warp(AAPTR_TRACER,User_PosX,User_PosY,User_PosZ,0,WARPF_COPYINTERPOLATION|WARPF_NOCHECKPOSITION)
CBLB C 1 A_Warp(AAPTR_TRACER,User_PosX,User_PosY,User_PosZ,0,WARPF_COPYINTERPOLATION|WARPF_NOCHECKPOSITION)
CBLB C 1 A_Warp(AAPTR_TRACER,User_PosX,User_PosY,User_PosZ,0,WARPF_COPYINTERPOLATION|WARPF_NOCHECKPOSITION)
CBLB C 1 A_Warp(AAPTR_TRACER,User_PosX,User_PosY,User_PosZ,0,WARPF_COPYINTERPOLATION|WARPF_NOCHECKPOSITION)

CBLB D 1 A_Warp(AAPTR_TRACER,User_PosX,User_PosY,User_PosZ,0,WARPF_COPYINTERPOLATION|WARPF_NOCHECKPOSITION)
CBLB D 1 A_Warp(AAPTR_TRACER,User_PosX,User_PosY,User_PosZ,0,WARPF_COPYINTERPOLATION|WARPF_NOCHECKPOSITION)
CBLB D 1 A_Warp(AAPTR_TRACER,User_PosX,User_PosY,User_PosZ,0,WARPF_COPYINTERPOLATION|WARPF_NOCHECKPOSITION)
CBLB D 1 A_Warp(AAPTR_TRACER,User_PosX,User_PosY,User_PosZ,0,WARPF_COPYINTERPOLATION|WARPF_NOCHECKPOSITION)

CBLB E 0 A_PlaySound("misc/scorebounce",0,0.6,0,0.8)
CBLB E 1 A_Warp(AAPTR_TRACER,User_PosX,User_PosY,User_PosZ,0,WARPF_COPYINTERPOLATION|WARPF_NOCHECKPOSITION)
CBLB E 1 A_Warp(AAPTR_TRACER,User_PosX,User_PosY,User_PosZ,0,WARPF_COPYINTERPOLATION|WARPF_NOCHECKPOSITION)
CBLB E 1 A_Warp(AAPTR_TRACER,User_PosX,User_PosY,User_PosZ,0,WARPF_COPYINTERPOLATION|WARPF_NOCHECKPOSITION)
CBLB E 1 A_Warp(AAPTR_TRACER,User_PosX,User_PosY,User_PosZ,0,WARPF_COPYINTERPOLATION|WARPF_NOCHECKPOSITION)
TNT1 A 0 A_GiveInventory("CutterFlag",1)
Goto Latch
Latch2:
CBLB A 0 A_Changeflag("NOINTERACTION",1)
TNT1 A 0 A_JumpIfInventory("CutterFlag",4,"Latch3")
CBLB D 0 A_JumpIfInventory("NoRemoteMineLatch", 1, "Detonate", AAPTR_TRACER)
CBLB A 1 A_Warp(AAPTR_TRACER,User_PosX,User_PosY,User_PosZ,0,WARPF_COPYINTERPOLATION|WARPF_NOCHECKPOSITION)
CBLB A 1 A_Warp(AAPTR_TRACER,User_PosX,User_PosY,User_PosZ,0,WARPF_COPYINTERPOLATION|WARPF_NOCHECKPOSITION)
CBLB E 0 A_PlaySound("misc/scorebounce",0,0.6,0,0.8)
CBLB A 1 A_Warp(AAPTR_TRACER,User_PosX,User_PosY,User_PosZ,0,WARPF_COPYINTERPOLATION|WARPF_NOCHECKPOSITION)
CBLB A 1 A_Warp(AAPTR_TRACER,User_PosX,User_PosY,User_PosZ,0,WARPF_COPYINTERPOLATION|WARPF_NOCHECKPOSITION)

CBLB B 1 A_Warp(AAPTR_TRACER,User_PosX,User_PosY,User_PosZ,0,WARPF_COPYINTERPOLATION|WARPF_NOCHECKPOSITION)
CBLB B 1 A_Warp(AAPTR_TRACER,User_PosX,User_PosY,User_PosZ,0,WARPF_COPYINTERPOLATION|WARPF_NOCHECKPOSITION)
CBLB E 0 A_PlaySound("misc/scorebounce",0,0.6,0,0.8)
CBLB B 1 A_Warp(AAPTR_TRACER,User_PosX,User_PosY,User_PosZ,0,WARPF_COPYINTERPOLATION|WARPF_NOCHECKPOSITION)
CBLB B 1 A_Warp(AAPTR_TRACER,User_PosX,User_PosY,User_PosZ,0,WARPF_COPYINTERPOLATION|WARPF_NOCHECKPOSITION)

CBLB C 1 A_Warp(AAPTR_TRACER,User_PosX,User_PosY,User_PosZ,0,WARPF_COPYINTERPOLATION|WARPF_NOCHECKPOSITION)
CBLB C 1 A_Warp(AAPTR_TRACER,User_PosX,User_PosY,User_PosZ,0,WARPF_COPYINTERPOLATION|WARPF_NOCHECKPOSITION)
CBLB E 0 A_PlaySound("misc/scorebounce",0,0.6,0,0.8)
CBLB C 1 A_Warp(AAPTR_TRACER,User_PosX,User_PosY,User_PosZ,0,WARPF_COPYINTERPOLATION|WARPF_NOCHECKPOSITION)
CBLB C 1 A_Warp(AAPTR_TRACER,User_PosX,User_PosY,User_PosZ,0,WARPF_COPYINTERPOLATION|WARPF_NOCHECKPOSITION)

CBLB D 1 A_Warp(AAPTR_TRACER,User_PosX,User_PosY,User_PosZ,0,WARPF_COPYINTERPOLATION|WARPF_NOCHECKPOSITION)
CBLB D 1 A_Warp(AAPTR_TRACER,User_PosX,User_PosY,User_PosZ,0,WARPF_COPYINTERPOLATION|WARPF_NOCHECKPOSITION)
CBLB E 0 A_PlaySound("misc/scorebounce",0,0.6,0,0.8)
CBLB D 1 A_Warp(AAPTR_TRACER,User_PosX,User_PosY,User_PosZ,0,WARPF_COPYINTERPOLATION|WARPF_NOCHECKPOSITION)
CBLB D 1 A_Warp(AAPTR_TRACER,User_PosX,User_PosY,User_PosZ,0,WARPF_COPYINTERPOLATION|WARPF_NOCHECKPOSITION)

CBLB E 1 A_Warp(AAPTR_TRACER,User_PosX,User_PosY,User_PosZ,0,WARPF_COPYINTERPOLATION|WARPF_NOCHECKPOSITION)
CBLB E 1 A_Warp(AAPTR_TRACER,User_PosX,User_PosY,User_PosZ,0,WARPF_COPYINTERPOLATION|WARPF_NOCHECKPOSITION)
CBLB E 0 A_PlaySound("misc/scorebounce",0,0.6,0,0.8)
CBLB E 1 A_Warp(AAPTR_TRACER,User_PosX,User_PosY,User_PosZ,0,WARPF_COPYINTERPOLATION|WARPF_NOCHECKPOSITION)
CBLB E 1 A_Warp(AAPTR_TRACER,User_PosX,User_PosY,User_PosZ,0,WARPF_COPYINTERPOLATION|WARPF_NOCHECKPOSITION)
TNT1 A 0 A_GiveInventory("CutterFlag",1)
Goto Latch2
Latch3:
CBLB A 0 A_Changeflag("NOINTERACTION",1)
TNT1 A 0 A_JumpIfInventory("CutterFlag",5,"Detonate")
CBLB D 0 A_JumpIfInventory("NoRemoteMineLatch", 1, "Detonate", AAPTR_TRACER)
CBLB E 0 A_PlaySound("misc/scorebounce",0,0.6,0,0.8)
CBLB A 1 A_Warp(AAPTR_TRACER,User_PosX,User_PosY,User_PosZ,0,WARPF_COPYINTERPOLATION|WARPF_NOCHECKPOSITION)
CBLB E 0 A_PlaySound("misc/scorebounce",0,0.6,0,0.8)
CBLB A 1 A_Warp(AAPTR_TRACER,User_PosX,User_PosY,User_PosZ,0,WARPF_COPYINTERPOLATION|WARPF_NOCHECKPOSITION)
CBLB E 0 A_PlaySound("misc/scorebounce",0,0.6,0,0.8)
CBLB A 1 A_Warp(AAPTR_TRACER,User_PosX,User_PosY,User_PosZ,0,WARPF_COPYINTERPOLATION|WARPF_NOCHECKPOSITION)
CBLB E 0 A_PlaySound("misc/scorebounce",0,0.6,0,0.8)
CBLB A 1 A_Warp(AAPTR_TRACER,User_PosX,User_PosY,User_PosZ,0,WARPF_COPYINTERPOLATION|WARPF_NOCHECKPOSITION)

CBLB E 0 A_PlaySound("misc/scorebounce",0,0.6,0,0.8)
CBLB B 1 A_Warp(AAPTR_TRACER,User_PosX,User_PosY,User_PosZ,0,WARPF_COPYINTERPOLATION|WARPF_NOCHECKPOSITION)
CBLB E 0 A_PlaySound("misc/scorebounce",0,0.6,0,0.8)
CBLB B 1 A_Warp(AAPTR_TRACER,User_PosX,User_PosY,User_PosZ,0,WARPF_COPYINTERPOLATION|WARPF_NOCHECKPOSITION)
CBLB E 0 A_PlaySound("misc/scorebounce",0,0.6,0,0.8)
CBLB B 1 A_Warp(AAPTR_TRACER,User_PosX,User_PosY,User_PosZ,0,WARPF_COPYINTERPOLATION|WARPF_NOCHECKPOSITION)
CBLB E 0 A_PlaySound("misc/scorebounce",0,0.6,0,0.8)
CBLB B 1 A_Warp(AAPTR_TRACER,User_PosX,User_PosY,User_PosZ,0,WARPF_COPYINTERPOLATION|WARPF_NOCHECKPOSITION)

CBLB E 0 A_PlaySound("misc/scorebounce",0,0.6,0,0.8)
CBLB C 1 A_Warp(AAPTR_TRACER,User_PosX,User_PosY,User_PosZ,0,WARPF_COPYINTERPOLATION|WARPF_NOCHECKPOSITION)
CBLB E 0 A_PlaySound("misc/scorebounce",0,0.6,0,0.8)
CBLB C 1 A_Warp(AAPTR_TRACER,User_PosX,User_PosY,User_PosZ,0,WARPF_COPYINTERPOLATION|WARPF_NOCHECKPOSITION)
CBLB E 0 A_PlaySound("misc/scorebounce",0,0.6,0,0.8)
CBLB C 1 A_Warp(AAPTR_TRACER,User_PosX,User_PosY,User_PosZ,0,WARPF_COPYINTERPOLATION|WARPF_NOCHECKPOSITION)
CBLB E 0 A_PlaySound("misc/scorebounce",0,0.6,0,0.8)
CBLB C 1 A_Warp(AAPTR_TRACER,User_PosX,User_PosY,User_PosZ,0,WARPF_COPYINTERPOLATION|WARPF_NOCHECKPOSITION)

CBLB E 0 A_PlaySound("misc/scorebounce",0,0.6,0,0.8)
CBLB D 1 A_Warp(AAPTR_TRACER,User_PosX,User_PosY,User_PosZ,0,WARPF_COPYINTERPOLATION|WARPF_NOCHECKPOSITION)
CBLB E 0 A_PlaySound("misc/scorebounce",0,0.6,0,0.8)
CBLB D 1 A_Warp(AAPTR_TRACER,User_PosX,User_PosY,User_PosZ,0,WARPF_COPYINTERPOLATION|WARPF_NOCHECKPOSITION)
CBLB E 0 A_PlaySound("misc/scorebounce",0,0.6,0,0.8)
CBLB D 1 A_Warp(AAPTR_TRACER,User_PosX,User_PosY,User_PosZ,0,WARPF_COPYINTERPOLATION|WARPF_NOCHECKPOSITION)
CBLB E 0 A_PlaySound("misc/scorebounce",0,0.6,0,0.8)
CBLB D 1 A_Warp(AAPTR_TRACER,User_PosX,User_PosY,User_PosZ,0,WARPF_COPYINTERPOLATION|WARPF_NOCHECKPOSITION)

CBLB E 0 A_PlaySound("misc/scorebounce",0,0.6,0,0.8)
CBLB E 1 A_Warp(AAPTR_TRACER,User_PosX,User_PosY,User_PosZ,0,WARPF_COPYINTERPOLATION|WARPF_NOCHECKPOSITION)
CBLB E 0 A_PlaySound("misc/scorebounce",0,0.6,0,0.8)
CBLB E 1 A_Warp(AAPTR_TRACER,User_PosX,User_PosY,User_PosZ,0,WARPF_COPYINTERPOLATION|WARPF_NOCHECKPOSITION)
CBLB E 0 A_PlaySound("misc/scorebounce",0,0.6,0,0.8)
CBLB E 1 A_Warp(AAPTR_TRACER,User_PosX,User_PosY,User_PosZ,0,WARPF_COPYINTERPOLATION|WARPF_NOCHECKPOSITION)
CBLB E 0 A_PlaySound("misc/scorebounce",0,0.6,0,0.8)
CBLB E 1 A_Warp(AAPTR_TRACER,User_PosX,User_PosY,User_PosZ,0,WARPF_COPYINTERPOLATION|WARPF_NOCHECKPOSITION)
TNT1 A 0 A_GiveInventory("CutterFlag",1)
Goto Latch3
Detonate:
TNT1 A 0 A_SetUserVar(User_ChainBlastCount,ACS_NamedExecuteWithResult("ChainBlast_BombCheck",0))
RDUS A 0 A_Explode(18*User_ChainBlastCount, 80, 0, 0 , 80)
TNT1 A 0 A_TakeInventory("ChainBlastFlag",1,0,AAPTR_TRACER)
RDUS A 0 A_PlaySoundEx("weapon/drillexplode", "Weapon")
RDUS ABCDEF 1
RDUS GHIGHI 3
RDUS JKLMNO 1
stop
Exit:
TNT1 A 1
stop
}
}


actor ChainBlast
{
PROJECTILE
+NOINTERACTION
Obituary "$OB_CHAINBLAST"
damagetype "ChainBlast"
scale 4.0
states
{
Spawn:
RDUS A 0 
RDUS A 0 A_Explode(35, 185, 0)
RDUS A 0 A_PlaySoundEx("weapon/drillexplode", "Weapon")
RDUS ABCDEF 1
RDUS GHIGHI 3
RDUS JKLMNO 1
stop
}
}

actor ChainBlastFlag : Inventory
{
inventory.amount 1
inventory.maxamount 100
}

actor ChainBallFlag : Inventory
{
inventory.amount 1
inventory.maxamount 4
}