actor DocScannerWep_NormalBar : NormalBar { args 217, 174 }

actor DocScannerWep : BaseMM8BDMWep
{
Weapon.AmmoUse 28
Weapon.AmmoGive 28
Weapon.SlotNumber 6
Inventory.Pickupmessage "$PU_DOCSCANNER"
Obituary "$OB_DOCSCANNER"
Tag "$TAG_DOCSCANNER"
weapon.ammotype "DocScannerAmmo"
inventory.icon "XTR0WI_H"
States
{
SpawnLoop:
XWI0 H -1
loop

Deselect:
XH0H A 0
goto DeselectSwap
Select:
XH0H A 0
goto SelectSwap

Ready:
XH0H A 0 ACS_NamedExecuteWithResult("core_weaponcolor",DYE_DOCSCANNER)
XH0H A 1 A_WeaponReady
wait

Fire:
XH0H A 0 A_JumpIfNoAmmo("NoAmmo")
XH0H A 0 A_JumpIfInventory("DocScannerUseDelay",1,"FireNo")
XH0H A 0 A_PlaySoundEx("Wep/DocScanCheck","weapon")
XH0H A 0 A_SpawnItemEx("DocScanner",0,0,33,cos(-pitch)*1,0,sin(-pitch)*1,0,1)
XH0H C 1 A_SpawnItemEx("DocScannerLaserFX_H",0,0,43,cos(-pitch)*15,0,sin(-pitch)*15,0,1)
XH0H C 2
XH0H BA 3
XH0H A 2 A_GiveInventory("DocScannerUseDelay",1)
Goto Ready+1
FireNo:
XH0H A 1
Goto Ready+1
NoAmmo:
XH0H A 1 ACS_NamedExecuteAlways("core_noammo",0)
Goto Ready+1
}
}

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

actor DocScannerUseDelay : Powerup
{
Powerup.Duration 20
}

actor DocScanner : ProjSpawnFuncActorFast
{
var int user_translateLikePlayer;
//PROJECTILE
damagetype "DocScanner"
Obituary "$OB_DOCSCANNER"
+SKYEXPLODE
+EXPLODEONWATER
+DONTBLAST
+DONTREFLECT
+DONTSPLASH
+THRUGHOST
+HITTRACER
+FORCEALLYCOLLISION
damage (55*(CallACS("core_checkrune",RUNE_SPREAD,2)*2+1))
Radius 16
Height 16
speed 1
scale 2.5
States
{
Spawn:
TNT1 A 0
TNT1 A 0 A_ScaleVelocity(180.0)
TNT1 A 1
TNT1 A 1
stop
Crash:
XDeath:
TNT1 A 0 A_JumpIf(CallACS("cbm_istracerplayer")==1,"DeathScan")
TNT1 A 1
stop
DeathScan:
TNT1 A 0 A_SpawnItemEx("DocScannerMarkFX_H",-6,0,8,0,0,0,0,1)
TNT1 A 0 A_SpawnItemEx("DocScannerBitFX_H",-6,0,8,0,0,0,0,1+SXF_TRANSFERPOINTERS)//1024
TNT1 A 10
stop
Death:
TNT1 A 1 A_SpawnItemEx("DocScannerGetFX_H",0,0,10,0,0,0,0,1)
stop
}
}

actor DocScannerLaserFX_H : BasicExplosion
{
var int user_translateLikePlayer;
translation "192:192=217:217","198:198=174:174"
RenderStyle None
Speed 15
States
{
Spawn:
TNT1 A 0
TNT1 A 2 A_SpawnItemEx("DocScannerLaserFX",0,0,0,momx,momy,momz,0,1+8+32)
stop
}
}

actor DocScannerLaserFX
{
+MISSILE
+NOGRAVITY
+THRUACTORS
+DONTBLAST
+DONTREFLECT
+DONTSPLASH
+CLIENTSIDEONLY
+FORCEYBILLBOARD
+PAINLESS
+BRIGHT
ReactionTime 4
damage (0)
Radius 8
Height 8
speed 15
XScale 1.75
YScale 6.0
States
{
Spawn:
TNT1 A 0
TNT1 A 0 A_SetScale(ScaleX+0.05,ScaleY+2)
TNT1 A 0 A_JumpIf(ScaleY>=52,"Death")
TNT1 A 0 A_SpawnItemEx("DocScannerLaserFX",0,0,0,momx,momy,momz,0,1+8+32+SXF_TRANSFERSCALE)//16384
TNT1 A 0 A_Stop
goto Spawn1
Spawn1:
TNT1 A 0 A_CountDown
TNT1 A 0 A_Jump(256,"R_1","R_2","R_3","R_4","R_5","R_6")
R_1:
XH0H G 1
TNT1 A 1
goto Spawn1
R_2:
XH0H H 1
TNT1 A 1
goto Spawn1
R_3:
XH0H GH 1
goto Spawn1
R_4:
XH0H HG 1
goto Spawn1
R_5:
XH0H GG 1
goto Spawn1
R_6:
XH0H HH 1
goto Spawn1

Death:
TNT1 A 1
stop
}
}
//This entire marker animation is accurate to Copy...frame wise
actor DocScannerBitFX_H : BasicWatcher
{
var int user_TID;
var int user_Tracer;
var int user_ScannerMemory;
States
{
Spawn:
TNT1 A 0
TNT1 A 0 A_SetUserVar("user_TID",CallACS("core_gettarget",0))
TNT1 A 0 A_SetUserVar("user_Tracer",CallACS("core_gettracer",0))
TNT1 A 0 A_PlaySoundEx("Wep/DocScanHit","weapon")
//Record WepNum on user_ScannerMemory//ACS syncs it better
TNT1 A 0 ACS_NamedExecuteWithResult("cbm_DocScannerRecordClass",user_Tracer)
//Replace script call with "cbm_DocScannerRecord" if using for a weapon mod
TNT1 A 4 A_GiveToTarget("DocScannerUseDelay",1)
goto Spawn1
Spawn1:
TNT1 A 0 A_JumpIf(!CallACS("cbm_PointerExists",AAPTR_TARGET),"Death")
TNT1 A 0 A_GiveInventory("WeaponCharge",1)
TNT1 A 0 A_GiveToTarget("DocScannerUseDelay",1)
TNT1 A 8 A_SpawnItemEx("DocScannerBitFX",0,0,-58,0,0,0,0,1)
TNT1 A 0 A_JumpIfInventory("WeaponCharge",4,"SpawnEnd")
goto Spawn2
Spawn2:
TNT1 A 0 A_JumpIf(!CallACS("cbm_PointerExists",AAPTR_TARGET),"Death")
TNT1 A 0 A_GiveToTarget("DocScannerUseDelay",1)
TNT1 A 10 A_SpawnItemEx("DocScannerBitFX",0,0,6,0,0,0,0,1)
goto Spawn1
SpawnEnd:
TNT1 A 0 A_JumpIf(!CallACS("cbm_PointerExists",AAPTR_TARGET),"Death")
TNT1 A 10 A_GiveToTarget("DocScannerUseDelay",1)
TNT1 A 0 A_JumpIf(!CallACS("cbm_PointerExists",AAPTR_TARGET),"Death")
TNT1 A 0 //A_GiveToTarget("DocScannerUseDelay",1)
TNT1 A 12 A_JumpIf(CallACS("cbm_DocScannerGiveCopy",user_Tracer,user_TID),1)
stop
TNT1 A 12 A_TakeFromTarget("DocScannerAmmo",28,1)
stop
}
}


actor DocScannerGetSnd_P : CustomInventory
{
States
{
Pickup:
TNT1 A 0 A_PlaySoundEx("KirbyNES/GetPower","SoundSlot7")
TNT1 A 0 A_SpawnItemEx("DocScannerGetSnd_H")
stop
}
}

actor DocScannerGetSnd_H : BasicWatcher
{
States
{
Spawn:
TNT1 A 4
TNT1 AAAAAAAA 4 A_GiveToTarget("DocScannerGetFX_P",1)
stop
}
}

actor DocScannerGetNoSnd_P : CustomInventory
{
States
{
Pickup:
TNT1 A 0 A_PlaySoundEx("KirbyNES/NoPower","SoundSlot7")
TNT1 A 0 A_SpawnItemEx("DocScannerGetNoSnd_H",0,0,28,0,0,0,0,1)
stop
}
}

actor DocScannerGetNoSnd_H : BasicGraphicEffect
{
ReactionTime 7
States
{
SpawnFrame:
TNT1 A 1
TNT1 AAA 0 A_SpawnItemEx("MagicMDeath_Confetti",random(-16,16),random(-16,16),Random(8,16),random(-3,3),random(-3,3),random(1,-1),0,1)
TNT1 A 0 A_CountDown
Loop
}
}


actor DocScannerGetFX_P : CustomInventory
{
States
{
Pickup:
TNT1 A 0 A_SpawnItemEx("DocScannerGetFX",frandom(2,16)*4,0,frandom(1,18)*4,0,0,0,random(0,17)*20,1)
stop
}
}

actor DocScannerGetFX_H : BasicExplosion
{
States
{
Spawn:
TNT1 A 0
TNT1 A 0 A_SpawnItemEx("DocScannerGetFX",0,0,0,0,0,0,0,1)
stop
}
}
actor DocScannerGetFX : BasicGraphicEffect
{
+BRIGHT
States
{
SpawnFrame:
TNT1 A 0
XH0H IJ 2
stop
}
}

actor DocScannerMarkFX_H : BasicGraphicEffect
{
States
{
SpawnFrame:
TNT1 A 0
TNT1 AA 2 A_SpawnItemEx("DocScannerMarkFX1",random(-4,4),random(-4,4),random(-4,4),0,0,0,0,1)
goto Spawn1
Spawn1:
//TNT1 A 0 A_SpawnItemEx("DocScannerBitFX",0,0,-58,0,0,0,0,1)
TNT1 A 0 A_GiveInventory("WeaponCharge",1)
TNT1 A 2 A_SpawnItemEx("DocScannerMarkFX3",random(-4,4),random(-4,4),random(-4,4),0,0,0,0,1)
TNT1 A 2 A_SpawnItemEx("DocScannerMarkFX1",random(-4,4),random(-4,4),random(-4,4),0,0,0,0,1)
TNT1 A 2 A_SpawnItemEx("DocScannerMarkFX2",random(-4,4),random(-4,4),random(-4,4),0,0,0,0,1)
TNT1 A 2 A_SpawnItemEx("DocScannerMarkFX1",random(-4,4),random(-4,4),random(-4,4),0,0,0,0,1)
TNT1 A 0 A_JumpIfInventory("WeaponCharge",4,"SpawnEnd")
goto Spawn2
Spawn2:
//TNT1 A 0 A_SpawnItemEx("DocScannerBitFX",0,0,6,0,0,0,0,1)
TNT1 A 2 A_SpawnItemEx("DocScannerMarkFX1",random(-4,4),random(-4,4),random(-4,4),0,0,0,0,1)
TNT1 A 2 A_SpawnItemEx("DocScannerMarkFX3",random(-4,4),random(-4,4),random(-4,4),0,0,0,0,1)
TNT1 AAA 2 A_SpawnItemEx("DocScannerMarkFX1",random(-4,4),random(-4,4),random(-4,4),0,0,0,0,1)
goto Spawn1
SpawnEnd:
TNT1 A 2 A_SpawnItemEx("DocScannerMarkFX1",random(-4,4),random(-4,4),random(-4,4),0,0,0,0,1)
TNT1 A 2 A_SpawnItemEx("DocScannerMarkFX3",random(-4,4),random(-4,4),random(-4,4),0,0,0,0,1)
TNT1 A 2 A_SpawnItemEx("DocScannerMarkFX1",0,0,0,0,0,0,0,1)

TNT1 AAAA 1 A_SpawnItemEx("DocScannerMarkFX1",0,0,0,0,0,0,0,1)
TNT1 A 3
TNT1 AAAA 1 A_SpawnItemEx("DocScannerMarkFX1",0,0,0,0,0,0,0,1)
TNT1 A 3
TNT1 AAAA 1 A_SpawnItemEx("DocScannerMarkFX1",0,0,0,0,0,0,0,1)
stop
}
}


actor DocScannerMarkFX1 : BasicGraphicEffect
{
+BRIGHT
States
{
SpawnFrame:
TNT1 A 0
TNT1 A 0 A_Jump(256,"S_1","S_2","S_3")
S_1:
XH0H N 1
stop
S_2:
XH0H O 1
stop
S_3:
XH0H P 1
stop
}
}
actor DocScannerMarkFX2 : BasicGraphicEffect
{
+BRIGHT
States
{
SpawnFrame:
TNT1 A 0
TNT1 A 0 A_Jump(256,"S_1","S_2","S_3")
S_1:
XH0H Q 1
stop
S_2:
XH0H R 1
stop
S_3:
XH0H S 1
stop
}
}
actor DocScannerMarkFX3 : BasicGraphicEffect
{
+BRIGHT
States
{
SpawnFrame:
TNT1 A 0
TNT1 A 0 A_Jump(256,"S_1","S_2","S_3")
S_1:
XH0H T 1
stop
S_2:
XH0H U 1
stop
S_3:
XH0H V 1
stop
}
}

actor DocScannerBitFX : BasicExplosion
{
var int user_TranslateWhiteColors;
+BRIGHT
var int user_TID;
var int user_S;
ReactionTime 1
Scale 2.5
States
{
Spawn:
TNT1 A 0
TNT1 A 0 A_PlaySoundEx("Wep/DocScanCheck","weapon")//DocScanHit
XH0H K 0 A_SetUserVar("user_TID",CallACS("core_gettarget"))
XH0H K 0 //A_LogInt(user_TID)
XH0H K 0 //A_Log("TID")
goto Spawn2
//RIP clean method that caused divide by zero fakeouts due to bad lag
Spawn2:
XH0H K 0 A_SetUserVar("user_S",CallACS("cbm_DocDistSpeedReturn",24,user_TID))
XH0H K 0 A_FaceTarget(360,90)
XH0H K 1 A_ChangeVelocity(cos(pitch)*user_S,0,sin(pitch)*user_S,3)
XH0H K 0 A_SetUserVar("user_S",CallACS("cbm_DocDistSpeedReturn",23,user_TID))
XH0H K 0 A_FaceTarget(360,90)
XH0H K 1 A_ChangeVelocity(cos(pitch)*user_S,0,sin(pitch)*user_S,3)
XH0H K 0 A_SetUserVar("user_S",CallACS("cbm_DocDistSpeedReturn",22,user_TID))
XH0H K 0 A_FaceTarget(360,90)
XH0H K 1 A_ChangeVelocity(cos(pitch)*user_S,0,sin(pitch)*user_S,3)
XH0H K 0 A_SetUserVar("user_S",CallACS("cbm_DocDistSpeedReturn",21,user_TID))
XH0H K 0 A_FaceTarget(360,90)
XH0H K 1 A_ChangeVelocity(cos(pitch)*user_S,0,sin(pitch)*user_S,3)
XH0H K 0 A_SetUserVar("user_S",CallACS("cbm_DocDistSpeedReturn",20,user_TID))
XH0H K 0 A_FaceTarget(360,90)
XH0H K 1 A_ChangeVelocity(cos(pitch)*user_S,0,sin(pitch)*user_S,3)
XH0H K 0 A_SetUserVar("user_S",CallACS("cbm_DocDistSpeedReturn",19,user_TID))
XH0H K 0 A_FaceTarget(360,90)
XH0H K 1 A_ChangeVelocity(cos(pitch)*user_S,0,sin(pitch)*user_S,3)
XH0H K 0 A_SetUserVar("user_S",CallACS("cbm_DocDistSpeedReturn",18,user_TID))
XH0H K 0 A_FaceTarget(360,90)
XH0H K 1 A_ChangeVelocity(cos(pitch)*user_S,0,sin(pitch)*user_S,3)
XH0H K 0 A_SetUserVar("user_S",CallACS("cbm_DocDistSpeedReturn",17,user_TID))
XH0H K 0 A_FaceTarget(360,90)
XH0H K 1 A_ChangeVelocity(cos(pitch)*user_S,0,sin(pitch)*user_S,3)


XH0H L 0 A_SetUserVar("user_S",CallACS("cbm_DocDistSpeedReturn",16,user_TID))
XH0H L 0 A_FaceTarget(360,90)
XH0H L 1 A_ChangeVelocity(cos(pitch)*user_S,0,sin(pitch)*user_S,3)
XH0H L 0 A_SetUserVar("user_S",CallACS("cbm_DocDistSpeedReturn",15,user_TID))
XH0H L 0 A_FaceTarget(360,90)
XH0H L 1 A_ChangeVelocity(cos(pitch)*user_S,0,sin(pitch)*user_S,3)
XH0H L 0 A_SetUserVar("user_S",CallACS("cbm_DocDistSpeedReturn",14,user_TID))
XH0H L 0 A_FaceTarget(360,90)
XH0H L 1 A_ChangeVelocity(cos(pitch)*user_S,0,sin(pitch)*user_S,3)
XH0H L 0 A_SetUserVar("user_S",CallACS("cbm_DocDistSpeedReturn",13,user_TID))
XH0H L 0 A_FaceTarget(360,90)
XH0H L 1 A_ChangeVelocity(cos(pitch)*user_S,0,sin(pitch)*user_S,3)
XH0H L 0 A_SetUserVar("user_S",CallACS("cbm_DocDistSpeedReturn",12,user_TID))
XH0H L 0 A_FaceTarget(360,90)
XH0H L 1 A_ChangeVelocity(cos(pitch)*user_S,0,sin(pitch)*user_S,3)
XH0H L 0 A_SetUserVar("user_S",CallACS("cbm_DocDistSpeedReturn",11,user_TID))
XH0H L 0 A_FaceTarget(360,90)
XH0H L 1 A_ChangeVelocity(cos(pitch)*user_S,0,sin(pitch)*user_S,3)
XH0H L 0 A_SetUserVar("user_S",CallACS("cbm_DocDistSpeedReturn",10,user_TID))
XH0H L 0 A_FaceTarget(360,90)
XH0H L 1 A_ChangeVelocity(cos(pitch)*user_S,0,sin(pitch)*user_S,3)
XH0H L 0 A_SetUserVar("user_S",CallACS("cbm_DocDistSpeedReturn",9,user_TID))
XH0H L 0 A_FaceTarget(360,90)
XH0H L 1 A_ChangeVelocity(cos(pitch)*user_S,0,sin(pitch)*user_S,3)


XH0H M 0 A_SetUserVar("user_S",CallACS("cbm_DocDistSpeedReturn",8,user_TID))
XH0H M 0 A_FaceTarget(360,90)
XH0H M 1 A_ChangeVelocity(cos(pitch)*user_S,0,sin(pitch)*user_S,3)
XH0H M 0 A_SetUserVar("user_S",CallACS("cbm_DocDistSpeedReturn",7,user_TID))
XH0H M 0 A_FaceTarget(360,90)
XH0H M 1 A_ChangeVelocity(cos(pitch)*user_S,0,sin(pitch)*user_S,3)
XH0H M 0 A_SetUserVar("user_S",CallACS("cbm_DocDistSpeedReturn",6,user_TID))
XH0H M 0 A_FaceTarget(360,90)
XH0H M 1 A_ChangeVelocity(cos(pitch)*user_S,0,sin(pitch)*user_S,3)
XH0H M 0 A_SetUserVar("user_S",CallACS("cbm_DocDistSpeedReturn",5,user_TID))
XH0H M 0 A_FaceTarget(360,90)
XH0H M 1 A_ChangeVelocity(cos(pitch)*user_S,0,sin(pitch)*user_S,3)
XH0H M 0 A_SetUserVar("user_S",CallACS("cbm_DocDistSpeedReturn",4,user_TID))
XH0H M 0 A_FaceTarget(360,90)
XH0H M 1 A_ChangeVelocity(cos(pitch)*user_S,0,sin(pitch)*user_S,3)
XH0H M 0 A_SetUserVar("user_S",CallACS("cbm_DocDistSpeedReturn",3,user_TID))
XH0H M 0 A_FaceTarget(360,90)
XH0H M 1 A_ChangeVelocity(cos(pitch)*user_S,0,sin(pitch)*user_S,3)
XH0H M 0 A_SetUserVar("user_S",CallACS("cbm_DocDistSpeedReturn",2,user_TID))
XH0H M 0 A_FaceTarget(360,90)
XH0H M 1 A_ChangeVelocity(cos(pitch)*user_S,0,sin(pitch)*user_S,3)
XH0H M 0 A_SetUserVar("user_S",CallACS("cbm_DocDistSpeedReturn",1,user_TID))
XH0H M 0 A_FaceTarget(360,90)
XH0H M 1 A_ChangeVelocity(cos(pitch)*user_S,0,sin(pitch)*user_S,3)

XH0H M 1 A_CountDown
wait

Death:
TNT1 A 1
stop
}
}





