actor ProtoBuster : BaseMM8BDMWep
{
Weapon.AmmoUse 1
Weapon.AmmoGive 3
Weapon.SlotNumber 1
Inventory.Pickupmessage "$PU_PROTOBUSTER"
Obituary "$OB_PROTOBUSTER"
Tag "$TAG_PROTOBUSTER"
weapon.ammotype "BusterAmmo"
inventory.icon "NULLICON"
Dropitem ""
States
{
SpawnLoop:
WEA2 Q 1
stop
Ready:
PROC J 0 A_TakeInventory("StopShield",1)
PROC B 0 A_JumpIfInventory("BusterGiven",1,"TakeBusters")
Goto Ready2
TakeBusters:
TNT1 Q 0 A_GiveInventory("TakeBuster", 1)
Goto Ready2
Ready2:
PROC J 0 ACS_ExecuteAlways(998,0,36)
PROC J 0 A_TakeInventory("WeaponCharge",999)
PROC J 0 A_TakeInventory("StopShield",1)
PROC J 0 A_GunFlash
PROC LKJ 1 A_WeaponReady
Goto Ready2+6
Deselect:
PROC J 0 A_GiveInventory("StopShield",1)
PROC JJKL 1
TNT1 AAAAAAAAAAAAAAAAAAAAAA 0 A_Lower
PROC J 1 A_Lower
Loop
Select:
TNT1 AAAAAAAAAAAAAAAAAAAAAA 0 A_Raise
PROC J 1 A_Raise
loop
Altfire:
PROC D 0 A_JumpIfNoAmmo("Hold")
PROC D 0 A_GiveInventory("StopShield",1)
PROC KLD 1 A_TakeInventory("WeaponCharge",999)
Altfire.a:
PROC D 0 A_PlaySoundEx("weapon/mbuster","Weapon")
PROC D 0 A_FireCustomMissile("ProtoShot",0,0,8,0)
PROC EFD 3
PROC D 3 A_Refire("Altfire.a")
goto Ready2+2
Fire:
PROC D 0 A_JumpIfNoAmmo("Hold")
PROC D 0 A_GiveInventory("StopShield",1)
PROC KLD 1 A_TakeInventory("WeaponCharge",999)
PROC D 0 A_PlaySoundEx("weapon/mbuster","Weapon")
PROC D 0 A_FireCustomMissile("ProtoShot",0,0,8,0)
PROC EF 3
PROC D 3 A_Refire
goto Ready2+2
Fire2:
PROC J 0 ACS_ExecuteAlways(991,0,36)
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_FireCustomMissile("ProtoShot2",0,0,8,0)
PROC EDD 3
PROC D 0 A_Refire
goto Ready2+2
Fire3:
PROC J 0 ACS_ExecuteAlways(991,0,36)
PROC D 0 A_TakeInventory("WeaponCharge",999)
PROC D 0 A_GiveInventory("StopShield",1)
PROC D 0 A_PlaySoundEx("weapon/pshot","Weapon")
//PROC F 0 A_FireCustomMissile("ProtoShotFX",0,0,8,0)
PROC F 6 A_FireCustomMissile("ProtoShot3",0,0,8,0)
PROC ED 3
PROC D 9
PROC D 0 A_Refire
goto Ready2+1
Hold:
PROC J 0 A_TakeInventory("StopShield",1)
PROC D 0 A_JumpIfInventory("WeaponCharge",36,"Charge2")
PROC D 0 A_JumpIfInventory("WeaponCharge",10,"Charge")
PROC D 1 A_GiveInventory("WeaponCharge",1)
PROC D 0 A_Refire
Goto Ready2+1
Charge:
PROC D 0 A_JumpIfInventory("WeaponCharge",36,"Charge2")
PROC D 0 A_JumpIfInventory("WeaponCharge",11,"Charge1")
PROC D 0 A_PlaySoundEx("weapon/pchargelong","Weapon")
Goto Charge1
Charge1:
PROC J 0 A_JumpIfInventory("WeaponCharge",36,"Charge2")
PROC D 1 ACS_ExecuteAlways(991,0,63)
PROC H 0 A_Refire("Charge1.a")
Goto Fire2
Charge1.a:
PROC H 1 ACS_ExecuteAlways(991,0,36)
PROC H 0 A_Refire("Charge1.b")
Goto Fire2
Charge1.b:
PROC H 1 ACS_ExecuteAlways(991,0,36)
PROC H 0 A_Refire("Charge1.c")
Goto Fire2
Charge1.c:
PROC H 1 ACS_ExecuteAlways(991,0,36)
PROC H 0 A_GiveInventory("WeaponCharge",2)
PROC H 0 A_Refire("Charge1")
Goto Fire2
Charge2:
PROC I 1 ACS_ExecuteAlways(991,0,64)
PROC H 0 A_Refire("Charge2.a")
Goto Fire3
Charge2.a:
PROC H 1 ACS_ExecuteAlways(991,0,36)
PROC J 0 A_JumpIfInventory("IsBot", 1, "BotFire")
PROC H 0 A_Refire("Charge2")
Goto Fire3
BotFire:
PROC J 0 A_Jump(16, "Fire3")
PROC H 0 A_Refire
Goto Fire3
Flash:
TNT1 A 0 A_SpawnItemEx("ProtoShieldHitbox1",28,-16,8,0,0,0,0,1)
TNT1 A 0 A_SpawnItemEx("ProtoShieldHitbox2",28,-8,8,0,0,0,0,1)
TNT1 A 0 A_SpawnItemEx("ProtoShieldHitbox3",28,0,8,0,0,0,0,1)
TNT1 A 0 A_SpawnItemEx("ProtoShieldHitbox4",28,8,8,0,0,0,0,1)
TNT1 A 0 A_SpawnItemEx("ProtoShieldHitbox5",28,16,8,0,0,0,0,1)
FlashLoop:
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")
loop
NoFlash:
TNT1 A 0 
Stop
}
}

actor StopShield : Once {}

actor ProtoShot : MegaShot
{
PROJECTILE
+LOOKALLAROUND
+SKYEXPLODE
+THRUGHOST
//translation "215:215=248:248"
damagetype "ProtoBuster"
Obituary "$OB_PROTOBUSTER"
//seesound "weapon/mbuster"
//Speed 26
//Damage (20)
//radius 5
//height 5
scale 2.5
States
{
Spawn:
TNT1 A 2
BUST A 2 
BUST A 0 A_ChangeFlag("THRUGHOST", 0)
BUST A 1
goto spawn+3
Death:
BUST A 1
stop
}
}

actor ProtoShot2
{
PROJECTILE
+THRUGHOST
+BRIGHT
damagetype "ProtoBuster2"
Obituary "$OB_PROTOBUSTER"
Speed 26
Damage (25)
radius 20
height 20
scale 2.5
States
{
Spawn:
TNT1 A 2
MMFX D 2 
MMFX D 0 A_ChangeFlag("THRUGHOST", 0)
MMFX D 4
wait
}
}


actor ProtoShot3
{
PROJECTILE
+LOOKALLAROUND
+SKYEXPLODE
+DONTBLAST
+THRUGHOST
+BRIGHT
//seesound "weapon/mbuster"
Speed 60
Damage (50)
radius 20
height 20
scale 2.5
damagetype "ProtoBuster3"
Obituary "$OB_PROTOBUSTER"
States
{
Spawn:
PROC A 2
PROC B 2 A_ChangeFlag("THRUGHOST", 0)
PROC C 2
PROC ABC 2
Goto Spawn+3
}
}


actor ProtoShotFX
{
+CLIENTSIDEONLY
-SOLID
+NOGRAVITY
+BRIGHT
scale 2.5
States
{
Spawn:
MXP1 ABCD 2
stop
}
}

actor BasicShieldHitbox
{
-SOLID
+MISSILE
+DONTSPLASH
+DONTBLAST
+DONTDRAIN
+DONTREFLECT
+DONTRIP
+NOBLOOD
+NOCLIP
+NORADIUSDMG
+GHOST
+SHOOTABLE
+NOTIMEFREEZE
+NOGRAVITY
+NOTARGETSWITCH
+NOTAUTOAIMED
+NODAMAGE
//PainSound "item/protoreflect"
RenderStyle "None"
bloodtype ""
damagefactor "Telefrag",0.0
painchance 256
health 99999

Meleerange 28 // Warp X
Accuracy 0 // Warp Y 
Mass 8 // Warp Z

Damage 0
Height 42
Radius 5
Speed 0
scale 2.5

States
{
Spawn:
TNT1 A 0
TNT1 A 0 A_JumpIf(ACS_NamedExecuteWithResult("core_targetexists")==0,"Death2")
TNT1 A 0 A_JumpIfInTargetInventory("StopShield",1,"SpawnStop")
PLAY A 1 A_Warp(2,Meleerange,Accuracy,Mass,0,24)
loop
SpawnStop:
TNT1 A 0 //A_Log("SpawnStop")
PLAY H 1
stop
Pain:
TNT1 A 0 A_PlaySound("item/protoreflect")//A_Pain
TNT1 A 0 A_SpawnItemEx("ProtoShieldDeathFX")
goto Spawn
Death:
TNT1 A 0 //A_PlaySound("item/protoreflect")
PLAY H 1
stop
Death2:
TNT1 A 0 //A_Log("Death2")
PLAY H 1
stop
}
}

actor ProtoShieldHitbox1 : BasicShieldHitbox
{
Meleerange 28
Accuracy -16
Mass 8
}
actor ProtoShieldHitbox2 : ProtoShieldHitbox1
{
Accuracy -8
}
actor ProtoShieldHitbox3 : ProtoShieldHitbox1
{
Accuracy 0
}
actor ProtoShieldHitbox4 : ProtoShieldHitbox1
{
Accuracy 8
}
actor ProtoShieldHitbox5 : ProtoShieldHitbox1
{
Accuracy 16
}

actor ProtoShieldDeathFX
{
scale 2.5
+NOINTERACTION
+CLIENTSIDEONLY
alpha 0.9
renderstyle add
+BRIGHT
states
{
Spawn:
PROC M 0 A_SetScale(scaleX + 0.1, 2.5) 
PROC M 1 A_FadeOut(0.05)
loop
}
}

actor ProtoShieldFX
{
-SOLID
+NOGRAVITY
+NOBLOCKMAP
+FIXMAPTHINGPOS
+NOTIMEFREEZE
Height 0
Radius 0
scale 2.5
+CLIENTSIDEONLY
+NOINTERACTION
States
{
Spawn:
TNT1 A 0
PROS A 2
stop
}
}

// Legacy

actor ProtoShieldHitbox
{
+MISSILE
Speed 0
+DONTSPLASH
Damage 0
Height 42
Radius 5
health 9999
scale 2.5
damagefactor "ProtoBuster", 0.0
+SHOOTABLE
+NOTAUTOAIMED
+NOBLOOD
-SOLID
+NOTIMEFREEZE
+NOGRAVITY
+HEXENBOUNCE
+BOUNCEONACTORS
painchance 256
bloodtype ""
+DONTRIP
+GHOST
+NORADIUSDMG
States
{
Spawn:
TNT1 A 0
TNT1 A 2
stop
Death:
TNT1 A 0 //A_PlaySound("item/protoreflect")
TNT1 A 1
stop
Pain:
TNT1 A 0 
TNT1 A 0 A_SpawnItemEx("ProtoShieldDeathFX")
TNT1 A 1 A_PlaySound("item/protoreflect")
stop
}
}

actor ProtoShieldX
{
+MISSILE
+THRUACTORS
+DONTBLAST
+DONTREFLECT
-SOLID
//+NOINTERACTION
height 1
radius 1
states
{
Spawn:
TNT1 A 0
TNT1 A 0 A_SpawnItemEx("ProtoShieldHitbox", 0, -16, 0, velx, vely, velz, 0, 8)
TNT1 A 0 A_SpawnItemEx("ProtoShieldHitbox", 0, -8, 0, velx, vely, velz, 0, 8)
TNT1 A 0 A_SpawnItemEx("ProtoShieldHitbox", 0, 16, 0, velx, vely, velz, 0, 8)
TNT1 A 0 A_SpawnItemEx("ProtoShieldHitbox", 0, 8, 0, velx, vely, velz, 0, 8)
TNT1 A 0 A_SpawnItemEx("ProtoShieldHitbox", 0, 0, 0, velx, vely, velz, 0, 8)
TNT1 A 1 
stop
}
}


// Scars
actor ProtoShieldDeahthFX : ProtoShieldDeathFX {}
