actor ProtoBusterBoss : BaseMM8BDMWep_CBM
{
tag "$TAGC_0A"
dropitem "PowerUpgradeGiverDropped"
weapon.preferredskin "Protoman-ShieldLess"

Weapon.AmmoUse 1
Weapon.AmmoGive 3
Weapon.SlotNumber 1
Inventory.Pickupmessage "$PU_PROTOBUSTER"
Obituary "$OB_PROTOBUSTER"
States
{
Spawn:
C_00 A 1
loop
Ready:
PROC J 0 A_JumpIfInventory("Once",1,"Ready2")
PROC J 0 ACS_ExecuteAlways(981,0,0)
PROC J 0 A_GiveInventory("Once",1)
Goto Ready2

Ready2:
PROC J 0 ACS_ExecuteAlways(998,0,DYE_PROTOMANC)
PROC J 0 A_TakeInventory("WeaponCharge",999)
PROC J 0 A_TakeInventory("StopShield",1)
PROC L 1 A_WeaponReady
PROC K 0 A_GunFlash
PROC KJ 1 A_WeaponReady
wait

Deselect:
PROC J 0 A_GiveInventory("StopShield",1)
PROC J 0 A_TakeInventory("SlideVivifyFlag",9)
PROC JJJJJJJJJJJJJJJJJJJJJJ 0 A_Lower
PROC J 1 A_Lower
goto Deselect+2
Select:
PROC JJJJJJJJJJJJJJJJJJJJJJ 0 A_Raise
PROC J 1 A_Raise
Loop

Fire:
PROC D 0 A_JumpIfInventory("StopShield",1,"FireX")
PROC D 0 A_GiveInventory("StopShield",1)
PROC D 0 A_PlaySoundEx("weapon/mbuster","Weapon")
PROC D 0 A_GiveInventory("ProtomanMain_CI",1)
PROC KLD 1 A_TakeInventory("WeaponCharge",999)
PROC EF 3
PROC D 2
PROC D 0 A_Refire("HoldS")
goto FireXL
FireXL:
PROC DDDDDDDDDDDDD 1 A_WeaponReady
goto Ready2+2
FireX:
PROC D 0 A_GiveInventory("StopShield",1)
PROC D 0 A_PlaySoundEx("weapon/mbuster","Weapon")
PROC D 0 A_GiveInventory("ProtomanMain_CI",1)
PROC EF 3
PROC D 2 A_TakeInventory("WeaponCharge",999)
PROC D 0 A_Refire("HoldS")
goto FireXL
Fire2X:
PROC D 0 ACS_ExecuteAlways(991,0,DYE_PROTOMANC)
PROC D 0 A_TakeInventory("WeaponCharge",999)
PROC D 0 A_GiveInventory("StopShield",1)
PROC F 0 A_PlaySoundEx("weapon/pshot","Weapon")
PROC F 3 A_GiveInventory("ProtomanMain2_CI",1)
PROC EDD 3
PROC D 0 A_Refire("HoldS")
goto Ready2+1
Fire3X:
PROC D 0 ACS_ExecuteAlways(991,0,DYE_PROTOMANC)
PROC D 0 A_TakeInventory("ProtoStrikeReady",9)
PROC D 0 A_TakeInventory("WeaponCharge",999)
PROC D 0 A_GiveInventory("StopShield",1)
PROC D 0 A_PlaySoundEx("weapon/pshot","Weapon")
PROC F 3 A_GiveInventory("ProtomanMain3_CI",1)
PROC ED 3
PROC D 8
PROC D 0 A_Refire("HoldS")
goto Ready2+1
HoldS:
PROC D 0 A_GiveInventory("StopShield",1)
PROC D 0 A_JumpIfInventory("WeaponCharge",24,"ChargeX2")
PROC D 0 A_JumpIfInventory("WeaponCharge",12,"ChargeX1")
PROC D 0 A_JumpIfInventory("WeaponCharge",10,"ChargeX")
PROC D 1 A_GiveInventory("WeaponCharge_RC",1)
PROC D 0 A_Refire("HoldS")
Goto FireX
ChargeXX:
PROC D 0 A_PlaySoundEx("weapon/pchargelong","Weapon")
goto ChargeX+2
ChargeX:
PROC D 0 A_JumpIfInventory("ProtomanUpgradeFlag",1,"ChargeXX")
PROC D 0 A_PlaySoundEx("weapon/pcharge","Weapon")
PROC D 1
PROC D 0 A_Refire("ChargeX.a")
Goto Fire2X
ChargeX.a:
PROC D 1
PROC D 0 A_Refire("ChargeX1")
Goto Fire2X
ChargeX1:
PROC D 0 A_JumpIfInventory("WeaponCharge",24,"ChargeX2")
PROC D 1 ACS_ExecuteAlways(998,0,63,5)
PROC D 0 A_Refire("ChargeX1.a")
Goto Fire2X
ChargeX1.a:
PROC R 1 ACS_ExecuteAlways(998,0,DYE_PROTOMANC,1)
PROC R 0 A_GiveInventory("WeaponCharge_RC",1)
PROC R 0 A_Refire("ChargeX1.b")
Goto Fire2X
ChargeX1.b:
PROC R 1
PROC R 0 A_Refire("ChargeX1.c")
Goto Fire2X
ChargeX1.c:
PROC R 1 A_GiveInventory("WeaponCharge",1)
PROC R 0 A_Refire("ChargeX1")
Goto Fire2X
ChargeX2:
PROC S 0 A_JumpIfInventory("ProtomanUpgradeFlag",1,"Charge2SS")
PROC S 1 ACS_ExecuteAlways(998,0,64,6)
PROC S 0 A_Refire("ChargeX2.a")
Goto Fire3X
ChargeX2.a:
PROC R 1 ACS_ExecuteAlways(998,0,DYE_PROTOMANC,7)
PROC R 0 A_JumpIfInventory("IsBot", 1, "BotFireX")
PROC R 0 A_Refire("ChargeX2")
Goto Fire3X
Charge2SS:
PROC S 0 A_GiveInventory("ProtoStrikeReady",1)
goto Charge2S
Charge2S:
PROC S 0 ACS_ExecuteAlways(998,0,64,6)
PROC S 1 A_WeaponReady(WRF_NOPRIMARY|WRF_NOSWITCH)
PROC S 0 A_Refire("Charge2S.a")
Goto Fire3X
Charge2S.a:
PROC R 0 ACS_ExecuteAlways(998,0,DYE_PROTOMANC,7)
PROC R 1 A_WeaponReady(WRF_NOPRIMARY|WRF_NOSWITCH)
PROC R 0 A_JumpIfInventory("IsBot",1,"ProtoStrike")
PROC R 0 A_Refire("Charge2S")
Goto Fire3X
BotFireX:
PROC S 0 A_Jump(16, "Fire3X")
PROC S 0 A_Refire("ChargeX2")
Goto Fire3X
BotFireX2:
PROC S 0 A_Jump(32, "ProtoStrike")
PROC S 0 A_Refire("Charge2S")
Goto Fire3X

ProtoStrike:
PROC F 0 ACS_ExecuteAlways(991,0,DYE_PROTOMANC)
PROC F 0 A_ClearReFire
PROC F 0 A_TakeInventory("ProtoStrikeReady",9)
PROC F 0 A_TakeInventory("WeaponCharge",999)
PROC F 0 A_GiveInventory("StopShield",1)
PROC F 0 A_PlaySoundEx("weapon/pshot","Weapon")
PROC F 6 A_GiveInventory("ProtomanAlt_CI",1)
PROC ED 3
PROC D 4 A_ClearRefire
PROC D 5
goto Ready2+1

User1Fire:
PROC D 0 A_JumpIfInventory("StopShield",1,"User1FireX")
PROC D 0 A_GiveInventory("StopShield",1)
PROC D 0 A_PlaySoundEx("weapon/mbuster","Weapon")
PROC D 0 A_GiveInventory("ProtomanMain_CI",1)
PROC KLD 1 A_TakeInventory("WeaponCharge",999)
PROC EF 3
PROC D 2
goto User1FireXL
User1FireXL:
PROC DDDDDDDDDDDDD 1 A_WeaponReady
goto Ready2+2
User1FireX:
PROC D 0 A_GiveInventory("StopShield",1)
PROC D 0 A_PlaySoundEx("weapon/mbuster","Weapon")
PROC D 0 A_GiveInventory("ProtomanMain_CI",1)
PROC E 3
PROC FD 3 A_TakeInventory("WeaponCharge",999)
goto User1FireXL

Altfire:
PROC I 0 A_JumpIfInventory("ProtoStrikeReady",1,"ProtoStrike")
PROC I 0 A_JumpIf(ACS_NamedExecuteWithResult("cbm_user1_check")==1, "User1Fire")
PROC J 0 A_JumpIf(z-floorz==0,"SlideSlide") //A_JumpIf(momz==0, "SlideSlide")
Goto Ready2+2
SlideSlide:
PROC D 0 A_GiveInventory("SlideVivifyFlag",1)
PROC D 0 A_Refire(1)
PROC D 0 A_PlaySoundEx("weapon/chargekick","Weapon")
PROC D 0 //SetPlayerProperty(0,1,0)
PROC D 0 ACS_ExecuteAlways(CORE_ACS_191,0,APROP_Speed,2,10)
PROC D 0 ACS_ExecuteAlways(CORE_ACS_191,0,APROP_JumpZ,0,1)
PROC D 0 A_JumpIfInventory("StopShield",1,5)
PROC D 0 A_GiveInventory("StopShield",1)
PROC L 2 A_GiveInventory("CopySlideThrust_P",1)
PROC K 2
PROC K 0 A_Jump(256,2)
PROC D 4 A_GiveInventory("CopySlideThrust_P",1)
PSLI A 8 //SetPlayerProperty(0,0,0)
PSLI B 5 //SetPlayerProperty(0,0,0)
PROC D 0 ACS_ExecuteAlways(CORE_ACS_191,0,APROP_Speed,1,1)
PROC L 10 ACS_ExecuteAlways(CORE_ACS_191,0,APROP_JumpZ,10,1)
PROC K 0 A_TakeInventory("SlideVivifyFlag",9)
PROC K 0 A_TakeInventory("WeaponCharge",999)
PROC K 0 A_TakeInventory("StopShield",1)
PROC K 0 A_GunFlash
PROC KKK 1 A_WeaponReady
Goto Ready2+6

Flash:
TNT1 A 0 A_GiveInventory("ProtoShieldHitbox_P",1)
TNT1 A 0 A_SpawnItemEx("ProtoShieldFX",23,-10,8,momx,momy,momz,0,9,0)
TNT1 A 1 A_JumpIfInventory("StopShield",1,"NoFlash")
TNT1 A 0 A_JumpIfInventory("IsDead",1,"NoFlash")
goto Flash+1

NoFlash:
TNT1 A 0
stop
}
}


actor ProtoStrikeReady : OnceC{}

actor ProtoShotC
{
Translation "204:204=215:215"
PROJECTILE
damagetype "ProtoM_Shot"
Obituary "$OB_PROTOBUSTER"
+THRUGHOST
+BRIGHT
Damage (100)
radius 5
height 5
Speed 27
scale 2.5
States
{
Spawn:
TNT1 A 2
W_0B B 2
W_0B B 0 A_ChangeFlag("THRUGHOST",0)
W_0B B 1
wait
Death:
TNT1 A 1
stop
}
}
actor ProtoShotCB : ProtoShotC{translation "204:204=205:205"}
actor ProtoShotCR : ProtoShotC{translation "204:204=171:171"}
actor ProtoShotCO : ProtoShotC{translation "204:204=104:104"}
actor ProtoShotCP : ProtoShotC{translation "204:204=229:229"}

actor ProtoShot2C
{
Translation "204:204=215:215"
PROJECTILE
+THRUGHOST
+BRIGHT
damagetype "ProtoM_Shot2"
Obituary "$OB_PROTOBUSTER"
Damage (200)
radius 14
height 14
Speed 26
scale 2.5
States
{
Spawn:
TNT1 A 2
PCOI W 2 
PCOI W 0 A_ChangeFlag("THRUGHOST",0)
PCOI W 1
wait
}
}

actor ProtoShot2CB : ProtoShot2C{translation "204:204=205:205"}
actor ProtoShot2CR : ProtoShot2C{translation "204:204=171:171"}
actor ProtoShot2CO : ProtoShot2C{translation "204:204=104:104"}
actor ProtoShot2CP : ProtoShot2C{translation "204:204=229:229"}

actor ProtoShot3C
{
Translation "192:192=87:87", "198:198=42:42", "202:202=210:210"
PROJECTILE
damagetype "ProtoM_Shot3"
Obituary "$OB_PROTOBUSTER"
+THRUGHOST
+BRIGHT
Damage (350)
radius 18
height 18
Speed 60
scale 2.5
States
{
Spawn:
PCOI X 2
PCOI Y 2 A_ChangeFlag("THRUGHOST",0)
PCOI Z 2
PCOI XYZ 2
Goto Spawn+3
}
}
actor ProtoShot3CB : ProtoShot3C{translation "192:192=205:205","198:198=74:74","202:202=205:205"}
actor ProtoShot3CR : ProtoShot3C{translation "192:192=171:171","198:198=41:41","202:202=171:171"}
actor ProtoShot3CO : ProtoShot3C{translation "192:192=104:104","198:198=128:128","202:202=104:104"}
actor ProtoShot3CP : ProtoShot3C{translation "192:192=229:229","198:198=232:232","202:202=229:229"}

actor ProtoStrikeShot : BasicExplosion
{
Translation "192:192=87:87", "198:198=42:42"
damagetype "ProtoM_Strike"
Obituary "$OB_PROTOSTRIKE"
+BRIGHT
Speed 60
scale 3.0
States
{
Spawn:
CHBU A 0
CHBU A 0 A_Explode(70,44,0,0,44)
CHBU A 2 A_Explode(70,44,0,0,44)
CHBU B 1 A_Explode(70,44,0,0,44)
CHBU B 1 A_Stop
CHBU CDABCD 2 A_Explode(70,44,0,0,44)
stop
}
}

actor ProtoStrikeShotB : ProtoStrikeShot{translation "192:192=205:205","198:198=74:74"}
actor ProtoStrikeShotR : ProtoStrikeShot{translation "192:192=171:171","198:198=41:41"}
actor ProtoStrikeShotO : ProtoStrikeShot{translation "192:192=104:104","198:198=128:128"}
actor ProtoStrikeShotP : ProtoStrikeShot{translation "192:192=229:229","198:198=232:232"}

actor ProtoStrikeShot2 : ProtoStrikeShot
{
scale 2.75
States
{
Spawn:
CHBU E 0
CHBU E 0 A_Explode(20,44,0,0,44)
CHBU E 2 A_Explode(20,32,0,0,32)
CHBU F 0 A_Stop
CHBU FGEFGEF 2 A_Explode(20,32,0,0,32)
stop
}
}
actor ProtoStrikeShot2B : ProtoStrikeShot2{translation "192:192=205:205","198:198=74:74"}
actor ProtoStrikeShot2R : ProtoStrikeShot2{translation "192:192=171:171","198:198=41:41"}
actor ProtoStrikeShot2O : ProtoStrikeShot2{translation "192:192=104:104","198:198=128:128"}
actor ProtoStrikeShot2P : ProtoStrikeShot2{translation "192:192=229:229","198:198=232:232"}

actor ProtoStrikeShot3 : ProtoStrikeShot2
{
scale 2.5
States
{
Spawn:
CHBU E 0
CHBU E 0 A_Explode(20,44,0,0,44)
CHBU E 1 A_Explode(20,32,0,0,32)
CHBU F 1 A_Stop
CHBU FGEFGEF 2 A_Explode(20,32,0,0,32)
stop
}
}

actor ProtoStrikeShot3B : ProtoStrikeShot3{translation "192:192=205:205","198:198=74:74"}
actor ProtoStrikeShot3R : ProtoStrikeShot3{translation "192:192=171:171","198:198=41:41"}
actor ProtoStrikeShot3O : ProtoStrikeShot3{translation "192:192=104:104","198:198=128:128"}
actor ProtoStrikeShot3P : ProtoStrikeShot3{translation "192:192=229:229","198:198=232:232"}

actor ProtoStrikeShot4 : ProtoStrikeShot2
{
scale 2.25
States
{
Spawn:
CHBU E 0
CHBU E 0 A_Explode(20,44,0,0,44)
CHBU E 0 A_Stop
CHBU FGEFGEF 2 A_Explode(20,32,0,0,32)
stop
}
}

actor ProtoStrikeShot4B : ProtoStrikeShot4{translation "192:192=205:205","198:198=74:74"}
actor ProtoStrikeShot4R : ProtoStrikeShot4{translation "192:192=171:171","198:198=41:41"}
actor ProtoStrikeShot4O : ProtoStrikeShot4{translation "192:192=104:104","198:198=128:128"}
actor ProtoStrikeShot4P : ProtoStrikeShot4{translation "192:192=229:229","198:198=232:232"}

actor ProtoShieldHitbox_P : CustomInventory
{
states
{
Pickup:
TNT1 A 0 A_SpawnItemEx("Protoman_ShieldHitbox1",28,-16,8,0,0,0,0,1)
TNT1 A 0 A_SpawnItemEx("Protoman_ShieldHitbox2",28,-8,8,0,0,0,0,1)
TNT1 A 0 A_SpawnItemEx("Protoman_ShieldHitbox3",28,0,8,0,0,0,0,1)
TNT1 A 0 A_SpawnItemEx("Protoman_ShieldHitbox4",28,8,8,0,0,0,0,1)
TNT1 A 0 A_SpawnItemEx("Protoman_ShieldHitbox5",28,16,8,0,0,0,0,1)
stop
}
}

actor Protoman_ShieldHitbox1 : BasicShieldHitbox
{
Meleerange 28
Accuracy -16
Mass 8
}
actor Protoman_ShieldHitbox2 : Protoman_ShieldHitbox1
{
Accuracy -8
}
actor Protoman_ShieldHitbox3 : Protoman_ShieldHitbox1
{
Accuracy 0
}
actor Protoman_ShieldHitbox4 : Protoman_ShieldHitbox1
{
Accuracy 8
}
actor Protoman_ShieldHitbox5 : Protoman_ShieldHitbox1
{
Accuracy 16
}



actor ProtomanMain_CI : TeamColor_CI
{
states
{
FireX:
TNT1 A 0 A_FireCustomMissile("ProtoShotC",0,0,8,0)
goto Done
FireB:
TNT1 A 0 A_FireCustomMissile("ProtoShotCB",0,0,8,0)
goto Done
FireR:
TNT1 A 0 A_FireCustomMissile("ProtoShotCR",0,0,8,0)
goto Done
FireO:
TNT1 A 0 A_FireCustomMissile("ProtoShotCO",0,0,8,0)
goto Done
FireP:
TNT1 A 0 A_FireCustomMissile("ProtoShotCP",0,0,8,0)
goto Done
}
}

actor ProtomanMain2_CI : TeamColor_CI
{
states
{
FireX:
TNT1 A 0 A_FireCustomMissile("ProtoShot2C",0,0,8,0)
goto Done
FireB:
TNT1 A 0 A_FireCustomMissile("ProtoShot2CB",0,0,8,0)
goto Done
FireR:
TNT1 A 0 A_FireCustomMissile("ProtoShot2CR",0,0,8,0)
goto Done
FireO:
TNT1 A 0 A_FireCustomMissile("ProtoShot2CO",0,0,8,0)
goto Done
FireP:
TNT1 A 0 A_FireCustomMissile("ProtoShot2CP",0,0,8,0)
goto Done
}
}

actor ProtomanMain3_CI : TeamColor_CI
{
states
{
FireX:
TNT1 A 0 A_FireCustomMissile("ProtoShot3C",0,0,8,0)
goto Done
FireB:
TNT1 A 0 A_FireCustomMissile("ProtoShot3CB",0,0,8,0)
goto Done
FireR:
TNT1 A 0 A_FireCustomMissile("ProtoShot3CR",0,0,8,0)
goto Done
FireO:
TNT1 A 0 A_FireCustomMissile("ProtoShot3CO",0,0,8,0)
goto Done
FireP:
TNT1 A 0 A_FireCustomMissile("ProtoShot3CP",0,0,8,0)
goto Done
}
}

actor ProtomanAlt_CI : TeamColor_CI
{
states
{
FireX:
TNT1 A 0 A_FireCustomMissile("ProtoStrikeShot",0,0,8,0)
TNT1 A 0 A_FireCustomMissile("ProtoStrikeShot2",0,0,8,0)
TNT1 A 0 A_FireCustomMissile("ProtoStrikeShot3",0,0,8,0)
TNT1 A 0 A_FireCustomMissile("ProtoStrikeShot4",0,0,8,0)
goto Done
FireB:
TNT1 A 0 A_FireCustomMissile("ProtoStrikeShotB",0,0,8,0)
TNT1 A 0 A_FireCustomMissile("ProtoStrikeShot2B",0,0,8,0)
TNT1 A 0 A_FireCustomMissile("ProtoStrikeShot3B",0,0,8,0)
TNT1 A 0 A_FireCustomMissile("ProtoStrikeShot4B",0,0,8,0)
goto Done
FireR:
TNT1 A 0 A_FireCustomMissile("ProtoStrikeShotR",0,0,8,0)
TNT1 A 0 A_FireCustomMissile("ProtoStrikeShot2R",0,0,8,0)
TNT1 A 0 A_FireCustomMissile("ProtoStrikeShot3R",0,0,8,0)
TNT1 A 0 A_FireCustomMissile("ProtoStrikeShot4R",0,0,8,0)
goto Done
FireO:
TNT1 A 0 A_FireCustomMissile("ProtoStrikeShotO",0,0,8,0)
TNT1 A 0 A_FireCustomMissile("ProtoStrikeShot2O",0,0,8,0)
TNT1 A 0 A_FireCustomMissile("ProtoStrikeShot3O",0,0,8,0)
TNT1 A 0 A_FireCustomMissile("ProtoStrikeShot4O",0,0,8,0)
goto Done
FireP:
TNT1 A 0 A_FireCustomMissile("ProtoStrikeShotP",0,0,8,0)
TNT1 A 0 A_FireCustomMissile("ProtoStrikeShot2P",0,0,8,0)
TNT1 A 0 A_FireCustomMissile("ProtoStrikeShot3P",0,0,8,0)
TNT1 A 0 A_FireCustomMissile("ProtoStrikeShot4P",0,0,8,0)
goto Done
}
}


//ItemZone//ItemZone//ItemZone//ItemZone
//ItemZone//ItemZone//ItemZone//ItemZone
//ItemZone//ItemZone//ItemZone//ItemZone
//ItemZone//ItemZone//ItemZone//ItemZone


actor ProtoCoil : BasicItemPickup
{
inventory.pickupmessage "$PU_PROTOCOIL"
Tag "$TAG_PROTOCOIL"
inventory.icon "PCUP"
states
{
Spawn:
PCOI C 1
loop
Use:
TNT1 A 0 A_PlaySoundEx("item/refill","Voice")
TNT1 A 0 A_SpawnItemEx("PCoilTeleport",40,0,256,0,0,-32,0,32)
stop
}
}

actor PCoilTeleport
{
Translation "192:192=4:4","198:198=42:42"
PROJECTILE
+NOINTERACTION
+DONTBLAST
+SKYEXPLODE
Radius 12
Height 32
scale 2.5
states
{
Spawn:
TFOG P 0
TFOG P 6
TFOG P 0 A_ChangeFlag("NOINTERACTION", 0)
TFOG PPPPPPPPPP 1 A_CheckFloor("Next")
Goto Next
Next:
TFOG P 0 //A_ChangeFlag("NOGRAVITY", 0)
Goto Death
Death:
TFOG P 0 A_SpawnItemEx("PCoil",0,0,0,0,0,momz,0,33)
stop
}
}

actor PCoil
{
-SOLID
+MISSILE
+DONTBLAST
+NOCLIP
+SKYEXPLODE
reactiontime 250
meleerange 80
Radius 12
Height 32
speed 0
scale 2.5
states
{
Spawn:
TFOG P 0 A_Jump(256,"Death")
TFOG P 0 A_ChangeFlag("MISSILE",0)
TFOG P 0 A_ChangeVelocity(0,0,-32,CVF_REPLACE)
TFOG P 1 A_JumpIf(z-floorz<=0,"Look")
Goto Spawn+2
Look:
TFOG Q 0 A_ChangeFlag("NOCLIP",0)
TFOG QR 2
PCOI AAAAAA 1 A_Chase
PCOI A 0 A_CountDown
Goto Look+3
Melee:
PCOI B 1 A_JumpIfInTargetInventory("StrongSpring",1,"Melee2")
PCOI B 18 A_GiveToTarget("SpringActivate",1)//31
PCOI A 0 A_Die
Goto Death
Melee2:
PCOI B 18 A_GiveToTarget("SpringActivate2",1)
PCOI B 0 A_Die
Goto Death
Death:
PCOI A 0 A_SpawnItemEx("ProtoM_CoilDeathFX",0,0,16,0,0,0,0,32)
stop
}
}

actor ProtoM_CoilDeathFX : BasicClientSide
{
Translation "202:202=215:215"
+BRIGHT
States
{
Spawn:
XMFX S 0
XMFX S 2
UMFX JKD 2
stop
}
}

actor ProtoItemDeath
{
PROJECTILE
+RIPPER
+BLOODLESSIMPACT
+CLIENTSIDEONLY
+DONTBLAST
reactiontime 35
Damage 0
Radius 4
Height 60
Speed 30
scale 2.5
States
{
Spawn:
TFOG RP 2
TFOG Q 0 ThrustThingZ(0,40,0,1)
TFOG Q 1 A_CountDown
wait
Death:
TFOG Q 0
stop
}
}

actor ProtoJet : BasicItemPickup
{
inventory.pickupmessage "$PU_PROTOJET"
Tag "$TAG_PROTOJET"
inventory.icon "PJUP"
states
{
Spawn:
PJET D 1
loop
Use:
TNT1 A 0 A_PlaySoundEx("item/refill","Voice")
TNT1 A 0 A_JumpIfInventory("ProtoJetCounter",1,2)
TNT1 A 0 A_SpawnItemEx("PCoilTeleport2",40,0,256,0,0,-32,0,32)
stop
TNT1 A 0 A_GiveInventory("ProtoJetCounter",8)//20
stop
}
}

actor PCoilTeleport2 : PCoilTeleport
{
states
{
Spawn:
TFOG P 0
TFOG P 6
TFOG P 0 A_ChangeFlag("NOINTERACTION",0)
TFOG PPPPPPPPPP 1 A_CheckFloor("Next")
Goto Next
Next:
TFOG P 0 //A_ChangeFlag("NOGRAVITY",0)
Goto Death
Death:
TFOG P 0 A_SpawnItemEx("ProtoJetter",0,0,3,0,0,momz,0,33)
stop
}
}

actor ProtoJetter : PCoil
{
meleerange 20//80
states
{
Look:
TFOG P 0
goto Melee
OldLook:
TFOG Q 0 A_ChangeFlag("NOCLIP",0)
TFOG QR 2
PJET A 3 A_Chase
PJET A 0 A_CountDown
Goto OldLook+3
Melee:
TNT1 A 0 A_JumpIfInTargetInventory("ProtoJetCounter",1,"Refill")
TNT1 A 0 A_GiveToTarget("ProtoJetterActivate_P")
TNT1 A 1
stop
Refill:
TNT1 A 0 A_GiveToTarget("ProtoJetCounter",8)//20
stop
Death:
TNT1 A 0 A_SpawnItemEx("ProtoM_CoilDeathFX",0,0,0,0,0,0,0,32)
stop
}
}

actor ProtoJetCounter : Inventory
{
inventory.amount 1
inventory.maxamount 8//20
}

actor ProtoJetterActivate_P : CustomInventory
{
states
{
Pickup:
TNT1 A 0 A_GiveInventory("ProtoJetCounter",8)
TNT1 A 0 A_SpawnItemEx("ProtoJetterWatcher_H",0,0,0,0,0,0,0,32)
TNT1 A 0 A_SpawnItemEx("ProtoJetterWarper")
TNT1 A 0 ACS_NamedExecuteAlways("core_flyplayer",0,0,2)
stop
}
}
actor ProtoJetterDeactivate_P : CustomInventory
{
states
{
Pickup:
TNT1 A 0 ACS_NamedExecuteAlways("core_flyplayer",0,0,0)
stop
}
}

actor ProtoJetterWatcher_H : BasicHelper
{
+SERVERSIDEONLY
+NOTIMEFREEZE
States
{
Spawn:
TNT1 A 0
TNT1 A 35
TNT1 A 0 A_TakeFromTarget("ProtoJetCounter",1)
TNT1 A 0 A_JumpIfInTargetInventory("SpinTime",1,"Death2")
TNT1 A 0 A_JumpIfInTargetInventory("InBoat",1,"Death2")
TNT1 A 0 A_JumpIfInTargetInventory("ProtoJetCounter",1,"Spawn")
TNT1 A 0 A_GiveToTarget("ProtoJetterDeactivate_P")
stop
Death2:
TNT1 A 0 A_TakeFromTarget("ProtoJetCounter",8)
TNT1 A 0 A_GiveToTarget("ProtoJetterDeactivate_P")
stop
}
}

actor ProtoJetterWarper
{
Translation "192:192=4:4","198:198=42:42"
-SOLID
+CLIENTSIDEONLY
+NOGRAVITY
+NOINTERACTION
+MISSILE
Scale 2.5
States
{
Spawn:
PJET BBBBCCCC 1 A_Warp(AAPTR_TARGET, 0,0,0,0,WARPF_NOCHECKPOSITION|WARPF_INTERPOLATE)
PJET C 1 A_JumpIFInTargetInventory("ProtoJetCounter", 1, "Spawn")
PJET C 0 A_SpawnItemEx("ProtoM_CoilDeathFX",0,0,0,0,0,0,0,32)
stop
}
}

actor ProtoMarine : BasicItemPickup
{
inventory.pickupmessage "$PU_PROTOMARINE"
Tag "$TAG_PROTOMARINE"
inventory.icon "PMUP"
states
{
Spawn:
PJET O 1
loop
Use:
TNT1 A 0 A_PlaySoundEx("item/refill","Voice")
TNT1 A 0 A_JumpIfInventory("ProtoMarineCounter",1,2)
TNT1 A 0 A_SpawnItemEx("ProtoMarine3Teleport",40,0,256,0,0,-32,0,32)
stop
TNT1 A 0 A_GiveInventory("ProtoMarineCounter",20)
stop
}
}

actor ProtoMarine3Teleport
{
Translation "192:192=4:4","198:198=42:42"
PROJECTILE
+NOINTERACTION
+DONTBLAST
Radius 8
Height 8
scale 2.5
states
{
Spawn:
TFOG Q 0
TFOG Q 7
TFOG Q 0 A_SpawnItemEx("ProtoMarine3",0,0,0,0,0,0,0,33)
stop
}
}

actor ProtoMarine3 : ProtoJetter
{
states
{
Spawn:
TNT1 A 0
TNT1 A 0 A_JumpIfInTargetInventory("ProtoMarineCounter",1,"Refill")
TNT1 A 0 A_GiveToTarget("ProtoMarineActivate_P")
TNT1 A 1
Goto FlyCheck
Refill:
TNT1 A 0 A_GiveToTarget("ProtoMarineCounter",20)
stop
Death:
TNT1 A 0 A_SpawnItemEx("ProtoM_CoilDeathFX",0,0,0,0,0,0,0,32)
stop
}
}

actor ProtoMarineCounter : Inventory
{
inventory.amount 1
inventory.maxamount 20//80
}

actor ProtoMarineActivate_P : CustomInventory
{
states
{
Pickup:
TNT1 A 0 A_GiveInventory("ProtoMarineCounter",20) 
TNT1 A 0 A_SpawnItemEx("ProtoMarineWatcher_H",0,0,0,0,0,0,0,32)
TNT1 A 0 A_SpawnItemEx("ProtoMarineWarper")
stop
}
}
actor ProtoMarineExitWater_P : CustomInventory
{
states
{
Pickup:
TNT1 A 0 A_JumpIf(momz>=1.0,1)
stop
TNT1 A 0 ThrustThingZ(0,45,0,0)
stop
}
}

actor ProtoMarineWatcher_H : BasicHelper
{
+SERVERSIDEONLY
+NOTIMEFREEZE
States
{
Spawn:
TNT1 A 0
TNT1 A 0 A_SetArg(2,35)
TNT1 A 0 A_SetArg(1,ACS_ExecuteWithResult(257)-999)//TID
SpawnWait:
TNT1 A 0 A_JumpIfInTargetInventory("SpinTime",1,"Death2")
TNT1 A 0 A_JumpIfInTargetInventory("InBoat",1,"Death2")
TNT1 A 0 A_JumpIfInTargetInventory("IsUnderwater",1,"BeginMarine")
TNT1 A 1
TNT1 A 0 A_JumpIfInTargetInventory("ProtoMarineCounter",1,"SpawnWait")
stop
BeginMarine:
TNT1 A 0 ACS_NamedExecuteAlways("core_flyplayer",0,Args[1],2)
MarineWait:
TNT1 A 0 A_JumpIfInTargetInventory("SpinTime",1,"Death3")
TNT1 A 0 A_JumpIfInTargetInventory("InBoat",1,"Death3")
TNT1 A 1 A_SetArg(2,Args[2]-1)
TNT1 A 0 A_JumpIf(Args[2]<=0,"MarineTake")
TNT1 A 0 A_JumpIfInTargetInventory("ProtoMarineCounter",1,"MarineCheck")
goto Death3
MarineTake:
TNT1 A 0 A_TakeFromTarget("ProtoMarineCounter",1)
TNT1 A 0 A_SetArg(2,35)
goto MarineWait+4
MarineCheck:
TNT1 A 0 A_JumpIfInTargetInventory("IsUnderwater",1,"MarineWait")
TNT1 A 1 ACS_NamedExecuteAlways("core_flyplayer",0,Args[1],0)
TNT1 A 1 A_GiveToTarget("ProtoMarineExitWater_P")
goto SpawnWait

Death3:
TNT1 A 0 ACS_NamedExecuteAlways("core_flyplayer",0,Args[1],0)
Death2:
TNT1 A 0 A_TakeFromTarget("ProtoMarineCounter",9999)
stop
}
}

actor ProtoMarineWarper : ProtoJetterWarper
{
States
{
Spawn:
PJET N 1 A_JumpIFInTargetInventory("IsUnderwater",1,"Marine")
NotUnderwater:
TNT1 A 1 A_JumpIFInTargetInventory("IsUnderwater",1,"MarineStart")
TNT1 A 1 A_JumpIFInTargetInventory("ProtoMarineCounter",1,"NotUnderwater")
stop
MarineStart:
TNT1 A 1 A_Warp(AAPTR_TARGET,0,0,0,0,WARPF_NOCHECKPOSITION|WARPF_INTERPOLATE)
Marine:
PJET MMMNNN 1 A_Warp(AAPTR_TARGET,0,0,0,0,WARPF_NOCHECKPOSITION|WARPF_INTERPOLATE)
PJET N 1 A_JumpIFInTargetInventory("ProtoMarineCounter",1,"Spawn")
PJET N 0 A_SpawnItemEx("ProtoM_CoilDeathFX",0,0,0,0,0,0,0,32)
stop
}
}
