actor BlockDropperWep : Weapon {}

actor BlockDropperWepSH : BaseMM8BDMWep
{
+INVENTORY.RESTRICTABSOLUTELY Inventory.RestrictedTo megamans
Weapon.AmmoUse 4
Weapon.AmmoGive 28
Weapon.SlotNumber 2
Inventory.Pickupmessage "$PU_BLOCKDROPPER"
Obituary "$OB_BLOCKDROPPER"
Tag "$TAG_BLOCKDROPPER"
weapon.ammotype "BlockDropperAmmo"
inventory.icon "BLDRICON"
States
{
SpawnLoop:
11WP A 1
loop
Ready:
BDRH A 0 ACS_ExecuteAlways(998,0,240)
BDRH A 0 A_JumpIfNoAmmo("ReadyNoAmmo")
BRDH A 0 A_Gunflash
BDRH A 1 A_WeaponReady
Goto Ready+2
ReadyNoAmmo:
BDRH A 1 A_WeaponReady
BDRH A 0 A_JumpIfNoAmmo("ReadyNoAmmo")
Goto Ready+1
Deselect:
TNT1 AAAAAAAAAAAAAAAAAAAAAA 0 A_Lower
BDRH A 1 A_Lower
Loop
Select:
TNT1 AAAAAAAAAAAAAAAAAAAAAA 0 A_Raise
BDRH A 1 A_Raise
Loop
Fire:
BDRH D 0 A_JumpIfNoAmmo("NoAmmo")
BDRH B 2
BDRH C 4
BDRH D 0 A_PlaySoundEx("weapon/blockdropper", "Weapon")
BDRH D 0 A_FireCustomMissile("BlockDropperSpawner",0,1,0,0)
BDRH E 15 
BDRH E 0 A_TakeInventory("WeaponCharge", 9999)
BDRH CBA 2
BDRH A 9
Goto Ready+1
NoAmmo:
BDRH A 1 ACS_Execute(979,0)
Goto ReadyNoAmmo
Flash:
TNT1 AAAA 1 A_SpawnItemEx("BlockDropperAimFXMaker",0,0,32,cos(pitch)*720,0,sin(-pitch)*720,0,1)
loop
}
}

actor BlockDropperAmmo : Ammo
{
inventory.amount 4
inventory.maxamount 28
+INVENTORY.IGNORESKILL
}

actor BlockDropperSpawner : FastProjectile
{
PROJECTILE
//+RIPPER
radius 3
height 3
speed 180
+DONTSPLASH
+SKYEXPLODE
damage (0)
states
{
Spawn:
TNT1 A 4
goto NaturalDeath
NaturalDeath:
TNT1 A 0 A_SpawnItemEx("BlockDropperSpawner2")
stop
Death:
TNT1 A 0 A_SpawnItemEx("BlockDropperSpawner2", -32, 0, 0, 0, 0, 0)
stop
Wall:
TNT1 A 0 A_SpawnItemEx("BlockDropperSpawner2", -48, 0, 0, 0, 0, 0)
stop
}
}

actor BlockDropperSpawner2
{
+FLOORHUGGER
+RIPPER
+sKYEXPLODE
damage (0)
PROJECTILE
states
{
Spawn:
TNT1 A 1
TNT1 A 0 A_Changeflag("FLOORHUGGER",0)
TNT1 A 0
TNT1 A 2 ThrustThingZ(0,600,0,0) //A_ChangeFlag("CEILINGHUGGER",1)
Death:
TNT1 A 0 A_SpawnItemEx("BlockDropper", 32, 32, -18, 0, 0, 0)
TNT1 A 0 A_SpawnItemEx("BlockDropper", -32, 32, -18, 0, 0, 0)
TNT1 A 0 A_SpawnItemEx("BlockDropper", 32, -32, -18, 0, 0, 0)
TNT1 A 0 A_SpawnItemEx("BlockDropper", -32, -32, -18, 0, 0, 0)
stop
}
}

actor BlockDropper
{
Obituary "$OB_BLOCKDROPPER"
PROJECTILE
+DONTBLAST
+NOINTERACTION
damagetype "BlockDropper"
radius 16
height 16
scale 2.5
damage (22)
+SKYEXPLODE
states
{
Spawn:
BDRO M 0
BDRO M 0 A_JumpIf(z-ceilingz >= -9, 2)
BDRO A 0 A_ChangeFlag("NOINTERACTION", 0)
BDRO A 2 
BDRO M 0 A_JumpIf(z-ceilingz >= -9, 2)
TNT1 A 0 A_ChangeFlag("NOINTERACTION", 0)
BDRO B 1
BDRO M 0 A_JumpIf(z-ceilingz >= -9, 2)
TNT1 A 0 A_ChangeFlag("NOINTERACTION", 0)
BDRO C 1
StormyNight:
BDRO C 0 A_JumpIf(z-ceilingz >= -9, 2)
TNT1 C 0 A_ChangeFlag("NOINTERACTION", 0)
BDRO C 1 ThrustThingZ(0,10,1,1)
loop
Death:
BDRO O 0 A_Explode(16, 80, 0,0,80)
TNT1 A 1 A_PlaySoundEx("weapon/blockdropper2", "Weapon")
TNT1 AAAA 0 A_SpawnItemEx("BlockDropperFX", 0, 0, 0, random(-5,5), random(-5,5),random(8,12))
stop
XDeath:
BDRO O 0 A_Explode(16, 80, 0,0,80)
TNT1 A 1 A_PlaySoundEx("weapon/blockdropper2", "Weapon")
TNT1 AAAA 0 A_SpawnItemEx("BlockDropperFX", 0, 0, 0, random(-5,5), random(-5,5),random(8,12))
stop
}
}

actor BlockDropperFX
{
PROJECTILE
+DONTSPLASH
+CLIENTSIDEONLY
+THRUACTORS
-NOGRAVITY
Damage (0)
Height 3
Radius 3
Speed 5
scale 2.5
states
{
Spawn:
TNT1 A 2 ThrustThingZ(0,28,0,0)
TNT1 A 0 A_Jump(256,"Debris1","Debris2","Debris3","Debris4")
Debris1:
BDRO H 2
wait
Debris2:
BDRO I 2
wait
Debris3:
BDRO J 2
wait
Debris4:
BDRO K 2
wait
}
}

actor BlockDropperAimFX1
{
PROJECTILE
+DONTBLAST
+DONTREFLECT
+CLIENTSIDEONLY
+FORCEYBILLBOARD
+PAINLESS
-NOGRAVITY
RenderStyle "Translucent"
Alpha 0.0
Radius 16
Height 16
speed 20
scale 1.5
states
{
Spawn:
BASB U 0
TNT1 A 1 
BASB U 0 ThrustThingZ(0,9000,0,1)
BASB U 0 A_SpawnItemEx("StarAimerFX2",0,0,0,momx,momy,momz,0,SXF_NOCHECKPOSITION | SXF_TRANSFERPITCH | SXF_ABSOLUTEVELOCITY | SXF_SETMASTER,0,6900)
DUOR T 1 Bright A_Stop
stop
Death:
TNT1 A 0
TNT1 A 0 //A_SetScale(2.5)
TNT1 A 0 //A_FadeIn(0.4)
TNT1 A 1 //Bright
stop
}
}


actor BlockDropperAimFX2 : BlockDropperAimFX1
{
+FLOORHUGGER
yscale 1.0
states
{
Spawn:
BASB U 0
TNT1 A 1
DUOR T 1 A_JumpIf(CallACS("sh_IsPointerClient",2)==1,"Spawn2")//A_Stop
stop
Spawn2:
TNT1 A 0 //A_SetScale(1.5)
DUOR T 1 A_SetTranslucent(0.6)
stop
Death:
TNT1 A 0
TNT1 A 0 //A_SetScale(2.5)
TNT1 A 0 //A_FadeIn(0.4)
TNT1 A 1 //Bright
stop
}
}

actor BlockDropperAimFX3 : BlockDropperAimFX2
{
yscale 1.5
states
{
Spawn:
BASB U 0
TNT1 A 1
PSIM Z 1 A_JumpIf(CallACS("sh_IsPointerClient",2)==1,"Spawn2")//A_Stop
stop
Spawn2:
TNT1 A 0 //A_SetScale(1.5)
PSIM Z 1 A_SetTranslucent(0.6)
stop
Death:
TNT1 A 0
TNT1 A 0 //A_SetScale(2.5)
TNT1 A 0 //A_FadeIn(0.4)
TNT1 A 1 //Bright
stop
}
}

actor BlockDropperAimFXMaker : FastProjectile
{
//+RIPPER
PROJECTILE
+CLIENTSIDEONLY
radius 3
height 3
speed 720
+DONTSPLASH
damage (0)
states
{
Spawn:
TNT1 A 1
goto NaturalDeath
NaturalDeath:
TNT1 A 0 A_SpawnItemEx("BlockDropperAimFX2",0,0,0,0,0,0,0,SXF_TRANSFERTRANSLATION | SXF_NOCHECKPOSITION | SXF_TRANSFERPITCH | SXF_ABSOLUTEVELOCITY | SXF_SETMASTER,0,6900)
TNT1 A 0 A_SpawnItemEx("BlockDropperAimFX2",0,0,-(z-floorz),0,0,0,0,SXF_TRANSFERTRANSLATION | SXF_NOCHECKPOSITION | SXF_TRANSFERPITCH | SXF_ABSOLUTEVELOCITY | SXF_SETMASTER,0,6900)
TNT1 A 0 A_SpawnItemEx("BlockDropperAimFX3",0,0,-(z-floorz),0,0,0,0,SXF_TRANSFERTRANSLATION | SXF_NOCHECKPOSITION | SXF_TRANSFERPITCH | SXF_ABSOLUTEVELOCITY | SXF_SETMASTER,0,6900)
stop
Death:
TNT1 A 0 A_SpawnItemEx("BlockDropperAimFX2", -32, 0, 0, 0, 0, 0, 0,SXF_TRANSFERTRANSLATION | SXF_NOCHECKPOSITION | SXF_TRANSFERPITCH | SXF_ABSOLUTEVELOCITY | SXF_SETMASTER,0,6900)
TNT1 A 0 A_SpawnItemEx("BlockDropperAimFX2", -32, 0, -(z-floorz), 0, 0, 0, 0,SXF_TRANSFERTRANSLATION | SXF_NOCHECKPOSITION | SXF_TRANSFERPITCH | SXF_ABSOLUTEVELOCITY | SXF_SETMASTER,0,6900)
TNT1 A 0 A_SpawnItemEx("BlockDropperAimFX3", -32, 0, -(z-floorz), 0, 0, 0, 0,SXF_TRANSFERTRANSLATION | SXF_NOCHECKPOSITION | SXF_TRANSFERPITCH | SXF_ABSOLUTEVELOCITY | SXF_SETMASTER,0,6900)
stop
}
}