actor Turboman_W : BaseMM8BDMWep_CBM
{
tag "$TAGC_7H"
dropitem "ScorchWheelWep"
Weapon.AmmoUse 0
Weapon.AmmoGive 0
Obituary "$OB_SCORCHWHEEL"
weapon.ammotype "DieselJuiceAmmo"
weapon.ammotype2 "CrashDriveAmmo"
States
{
Spawn:
C_07 H 1
loop

Deselect:
TUCA A 0
goto DeselectSwap
Select:
TUCA A 0 A_TakeInventory("TurboWheelCount")
TUCA A 0 A_TakeInventory("TurboAltDelay")
goto SelectSwap

Ready:
TUCA A 0 ACS_NamedExecuteWithResult("core_weaponcolor",DYE_TURBOMAN)
goto Ready0


Ready0:
TUCA A 4 A_GiveInventory("Turboman_Ready_P")
TUCA A 0 A_GiveInventory("DieselJuiceAmmo",3)
loop

Ready00:
TUCA A 0 A_JumpIfInventory("TurboAltDelay",1,"Ready1")
goto Ready1a
Ready1:
TUCA A 0 A_JumpIfInventory("DieselJuiceAmmo",28,"Ready2")
TUCA A 4 A_WeaponReady(12)
TUCA A 0 A_GiveInventory("DieselJuiceAmmo",3)
TUCA A 0 A_JumpIfInventory("TurboAltDelay",1,"Ready1")
Goto Ready1a
Ready1a:
TUCA A 0 A_JumpIfInventory("DieselJuiceAmmo",28,"ReadyX")
TUCA A 4 A_WeaponReady(4)
TUCA A 0 A_GiveInventory("DieselJuiceAmmo",3)
loop
Ready2:
TUCA A 4 A_WeaponReady(8)
TUCA A 0 A_GiveInventory("DieselJuiceAmmo",3)
TUCA A 0 A_JumpIfInventory("TurboAltDelay",1,"Ready2")
goto ReadyX
ReadyX:
TUCA A 4 A_WeaponReady
TUCA A 0 A_GiveInventory("DieselJuiceAmmo",3)
loop

Fire:
TUCA BCDEF 2
TUCA A 0 A_PlaySoundEx("weapon/WheelGoGoGo","Weapon")
TUCA A 0 A_GiveInventory("ShieldCheck",1)
TUCA A 0 A_SpawnItemEx("TurbomanWheelWarper_H")
TUCA A 0 A_GiveInventory("CBM_140_SpeedPowerGiver",1)
TUCA A 0 A_JumpIfInventory("IsBot",1,"BotFireH")
Goto FireH
FireH2:
TNT1 A 0 A_TakeInventory("CBM_140_SpeedPower")
TNT1 A 0
goto FireH3
FireH:
TNT1 A 0 A_JumpIfInventory("TurboWheelCount",45,"FireH2")
TNT1 A 0 A_GiveInventory("TurboWheelCount",1)
TNT1 A 1
TNT1 A 0 A_Refire(1)
Goto FireT
TNT1 A 1 A_JumpIfInventory("PlayerPropertyRage",1,"FireH")
TNT1 A 0 A_Refire("FireH")
Goto FireT
FireH3:
TNT1 A 1 A_RailWait
TNT1 A 0 A_Refire("FireH3")
Goto FireT

FireT:
TNT1 A 0 A_TakeInventory("CBM_140_SpeedPower")
TNT1 A 0 A_GiveInventory("Turboman_Fire_P")
TNT1 A 0 A_TakeInventory("ShieldCheck")
TNT1 A 0 A_TakeInventory("TurboWheelCount")
TUCA A 2 Offset(0,54)
TUCA A 2 Offset(0,41)
Goto Ready0

Altfire:
TUCA G 0 ACS_NamedExecuteWithResult("core_stopplayer",0,1)
TUCA G 0 A_GiveInventory("TurboCarFlag",1)
TUCA G 0 A_GiveInventory("CBM_DisableJumpPowerGiver",1)
TUCA G 0 A_TakeInventory("VivifyDelay8")
TUCA G 0 A_Refire(1)
Altfire3:
TUCA G 1 Offset(0,32)A_GiveInventory("Turboman_AltCharge_P")
TUCA G 0 A_Refire(1)
goto AltfireGo
TUCA G 0 A_GiveInventory("Turboman_AltCharge_P2")
TUCA G 1 A_JumpIfInventory("PlayerPropertyRage",1,2)
TUCA G 0 A_Refire(1)
goto AltfireGo
TUCA G 0 A_GiveInventory("DieselJuiceAmmo",1)
TUCA G 1 Offset(0,27)A_GiveInventory("Turboman_AltCharge_P")
TUCA G 0 A_Refire(1)
goto AltfireGo
TUCA G 0 A_GiveInventory("Turboman_AltCharge_P2")
TUCA G 1 A_JumpIfInventory("PlayerPropertyRage",1,"Altfire3")
TUCA G 0 A_Refire("Altfire3")
goto AltfireGo

Flash.Start:
TNT1 A 0 A_JumpIfInventory("CrashDriveAmmo",14,"Flash")
TNT1 AAAAAAAAA 1 A_GiveInventory("TurboCarRadius_P2")
Flash:
TNT1 A 1 A_GiveInventory("TurboCarRadius_P")
loop
Flash.AltDelay:
TNT1 A 2 A_TakeInventory("TurboAltDelay",1)
loop


AltfireGo:
TUCA G 0 A_TakeInventory("CBM_DisableJumpPower")
TUCA G 0 A_GiveInventory("CBM_Ratio7JumpPowerGiver",1)
TUCA G 0 A_PlaySoundEx("classes/CarGoGo","Body")
TUCA G 0 A_ChangeVelocity(23,0,momz,3)
TUCA G 0 A_GunFlash("Flash.Start",1)
goto AltfireCar

AltfireCar:
TUCA G 1 Offset(0,32)A_GiveInventory("TurbomanBoost_P",1)
TUCA G 1 Offset(0,27)
TUCA G 0 A_JumpIfInventory("CrashDriveAmmo",1,1)
goto AltfireStop
TUCA G 1 Offset(0,32)A_GiveInventory("TurbomanBoost_P",1)
TUCA G 1 Offset(0,27)
TUCA G 0 A_JumpIfInventory("CrashDriveAmmo",1,1)
goto AltfireStop
TUCA G 1 Offset(0,32)A_GiveInventory("TurbomanBoost_P",1)
TUCA G 1 Offset(0,27)
TUCA G 0 A_JumpIfInventory("CrashDriveAmmo",1,1)
goto AltfireStop
TUCA G 1 Offset(0,32)A_GiveInventory("TurbomanBoost_P",1)
TUCA G 1 Offset(0,27)
TUCA G 0 A_JumpIfInventory("CrashDriveAmmo",1,1)
goto AltfireStop
TUCA G 1 Offset(0,32)A_GiveInventory("TurbomanBoost_P",1)
TUCA G 1 Offset(0,27)
TUCA G 0 A_JumpIfInventory("CrashDriveAmmo",1,"AltfireDrive")
goto AltfireStop

AltfireDrive:
TUCA G 0 A_GiveInventory("TurbomanBoost_P2",1)
TUCA G 1 Offset(0,32)A_ReFire("AltfireStop")
TUCA G 1 Offset(0,27)A_ReFire("AltfireStop")
TUCA G 0 A_JumpIfInventory("CrashDriveAmmo",1,1)
goto AltfireStop
TUCA G 0 A_GiveInventory("TurbomanBoost_P",1)
TUCA G 1 Offset(0,32)A_ReFire("AltfireStop")
TUCA G 1 Offset(0,27)A_ReFire("AltfireStop")
TUCA G 0 A_JumpIfInventory("CrashDriveAmmo",1,"AltfireDrive")
goto AltfireStop

AltfireStop:
TNT1 A 0 A_GiveInventory("TurboCarEnd_P",1)
TNT1 A 0 A_TakeInventory("CBM_Ratio7JumpPower")
TNT1 A 0 ACS_NamedExecuteWithResult("core_stopplayer",0,0)
TNT1 A 4 A_GunFlash("Flash.AltDelay",1)
TUCA A 2 Offset(0,76)
TUCA A 2 Offset(0,59)
TUCA A 2 Offset(0,46)
TUCA A 2 Offset(0,37)A_GiveInventory("VivifyDelay8",1)
TUCA A 0 A_GiveInventory("TurboAltDelay",28)
Goto Ready0

BotFireH:
TNT1 A 0 A_JumpIfInventory("TurboWheelCount",45,"FireT")
TNT1 A 0 A_GiveInventory("TurboWheelCount",2)
TNT1 A 1 A_Jump(10,"FireT")
TNT1 A 0 A_Refire(1)
Goto FireT
TNT1 A 1 A_GiveInventory("DieselJuiceAmmo",random(1,2))
TNT1 A 0 A_Refire("BotFireH")
Goto FireT

NoAmmo:
TUCA A 0
Goto Ready0
}
}

actor DieselJuiceAmmo : Ammo
{
inventory.amount 1
inventory.maxamount 84
+INVENTORY.IGNORESKILL
}

actor CrashDriveAmmo : Ammo
{
inventory.amount 1
inventory.maxamount 56
+INVENTORY.IGNORESKILL
}


actor TurboWheelCount : Inventory
{
inventory.amount 1
inventory.maxamount 45
}

actor TurboCarFlag : Inventory
{
inventory.amount 1
inventory.maxamount 6
}

actor TurboCarCount : Inventory
{
inventory.amount 1
inventory.maxamount 56
}

actor TurboHonkDelay : Inventory
{
inventory.amount 1
inventory.maxamount 34
}

actor TurboAltDelay : Inventory
{
inventory.maxamount 28
}

actor TurboCarRadiusDelay : Powerup
{
+INVENTORY.ADDITIVETIME
Powerup.Duration 2
}



actor Turboman_Ready_P : CustomInventory
{
States
{
Pickup:
TNT1 A 0 A_JumpIfInventory("Turboman_W",1,"Sync")//2
TNT1 A 0 A_WeaponReady//This is to sync online?
stop
Sync:
TNT1 A 0 A_JumpIfInventory("TurboAltDelay",1,4)
TNT1 A 0 A_JumpIfInventory("DieselJuiceAmmo",28,2)
TNT1 A 0 A_WeaponReady(WRF_NOPRIMARY)
stop
TNT1 A 0 A_WeaponReady
stop
NoAlt:
TNT1 A 0 A_JumpIfInventory("DieselJuiceAmmo",28,2)
TNT1 A 0 A_WeaponReady(WRF_NOFIRE)
stop
TNT1 A 0 A_WeaponReady(WRF_NOSECONDARY)
stop
}
}


actor Turboman_Fire_P : CustomInventory
{
States
{
Pickup:
TNT1 A 0 A_TakeInventory("DieselJuiceAmmo",14)
TNT1 A 0 A_TakeInventory("DieselJuiceAmmo",14,1)
TNT1 A 0 A_PlaySoundEx("TurboM/WheelToss","Weapon")
TNT1 A 0 A_JumpIfInventory("TurboWheelCount",45,2)
TNT1 A 0 A_FireCustomMissile("TurboScorchW",0,1,0,0)
stop
TNT1 A 0 A_FireCustomMissile("TurboScorchW1",0,1,0,0)
stop
}
}



actor Turboman_AltCharge_P : CustomInventory
{
States
{
Pickup:
TNT1 A 0 A_SpawnItemEx("TurboCarDustFX",-2, 24,0,-2,0,0,0,1)
TNT1 A 0 A_SpawnItemEx("TurboCarDustFX",-2,-24,0,-2,0,0,0,1)
TNT1 A 0 A_GiveInventory("CrashDriveAmmo",1)
TNT1 A 0 A_PlaySoundEx("classes/CarCharge","Body")
stop
}
}
actor Turboman_AltCharge_P2 : CustomInventory
{
States
{
Pickup:
TNT1 A 0 A_JumpIf(z-floorz==0,1)
stop
TNT1 A 0 A_GiveInventory("CrashDriveAmmo",1)
stop
}
}

actor TurbomanBoost_P : CustomInventory
{
States
{
Pickup:
TNT1 A 0 A_TakeInventory("CrashDriveAmmo",1)
TNT1 A 0 A_JumpIf(z-floorz==0,"Ground")
TNT1 A 0 A_Recoil(-3.15)
stop
Ground:
TNT1 A 0 A_Recoil(-7.5)
stop
}
}
actor TurbomanBoost_P2 : TurbomanBoost_P
{
States
{
Pickup:
TNT1 A 0 A_TakeInventory("CrashDriveAmmo",1,1)
goto TurbomanBoost_P::Pickup+1
}
}

actor TurboCarRadius_P : CustomInventory
{
States
{
Pickup:
TNT1 A 0 A_JumpIfInventory("TurboCarRadiusDelay",1,"No")
TNT1 A 0 A_JumpIfInventory("TurboHonkDelay",1,"Pickup2")
TNT1 A 0 A_SpawnItemEx("TurboCarRadius",0,0,28,momx,momy,momz,0,8)
TNT1 A 0 A_JumpIf(CallACS("cbm_GetPointerButtonInput",0,true) & BT_ATTACK,1)
goto End

TNT1 A 0 A_GiveInventory("TurboHonkDelay",34)
TNT1 A 0 A_FireCustomMissile("TurboHonkBlast",0,0,0,8)
TNT1 A 1 A_PlaySound("classes/CarHonk",7,0.5)//SoundSlot7

Pickup2:
TNT1 A 0 A_SpawnItemEx("TurboCarRadiusW",0,0,28,momx,momy,momz,0,8)
goto End
End:
TNT1 A 0 A_JumpIfInventory("PlayerPropertyRage",1,2)
TNT1 AA 0 A_GiveInventory("TurboCarRadiusDelay",1)
goto End2
End2:
TNT1 A 0 A_JumpIf(z-floorz==0,"EndX")
goto No
EndX:
TNT1 A 0 A_SpawnItemEx("TurboScorchW2_BitX",-8,-16,0)
TNT1 A 0 A_SpawnItemEx("TurboScorchW2_BitX",-8,16,0)
TNT1 A 0 A_JumpIfInventory("PlayerPropertySpread",1,"EndX_S")
goto No
EndX_S:
TNT1 A 0 A_SpawnItemEx("TurboScorchW2_BitX",0,0,0)
TNT1 A 0 A_SpawnItemEx("TurboScorchW2_BitX",-16,-32,0)
TNT1 A 0 A_SpawnItemEx("TurboScorchW2_BitX",-16,32,0)
goto No

No:
TNT1 A 0 A_TakeInventory("TurboHonkDelay",1+CallACS("core_checkrune",RUNE_RAGE,0))
stop
}
}
actor TurboCarRadius_P2 : TurboCarRadius_P
{
States
{
Pickup:
TNT1 A 0 A_JumpIfInventory("TurboCarRadiusDelay",1,"No")
TNT1 A 0 A_JumpIfInventory("TurboHonkDelay",1,"Pickup2")
TNT1 A 0 A_SpawnItemEx("TurboCarRadius",0,0,28,momx,momy,momz,0,8)
goto End
}
}

actor TurboCarEnd_P : CustomInventory
{
States
{
Pickup:
TNT1 A 0 A_TakeInventory("CrashDriveAmmo")
TNT1 A 0 A_TakeInventory("TurboHonkDelay")
TNT1 A 0 A_TakeInventory("TurboCarFlag")
TNT1 A 0 A_TakeInventory("TurboCarCount")
TNT1 A 0 A_GiveInventory("VivifyDelay8",1)
stop
}
}


actor TurbomanWheelWarper_H : BasicWatcher
{
+NOTIMEFREEZE
States
{
Spawn:
TNT1 A 0
TNT1 A 0 A_GiveToTarget("TurbomanWheelWarper_P",1)
stop
}
}//Sync online
actor TurbomanWheelWarper_P : CustomInventory
{
States
{
Pickup:
TNT1 A 0 A_SpawnItemEx("TurbomanWheelWarper",0,0,0,0,0,0,0,1)
stop
}
}

actor TurbomanWheelWarper : ShieldWarper_CBM
{
+NOTIMEFREEZE
Speed 60
States
{
Shield:
TUCA O 0 A_JumpIfInventory("Once",1,2)
TUCA O 0 A_JumpIfInTargetInventory("TurboWheelCount",45,"ShieldScale")

TUCA O 0 A_JumpIfInTargetInventory("PlayerPropertyRage",1,"ShieldR1")
TUCA OOOPPPQQQ 1 A_Warp(2,0,0,0,0,24)

TUCA R 0 A_JumpIfInventory("Once",1,2)
TUCA R 0 A_JumpIfInTargetInventory("TurboWheelCount",45,"ShieldScale2")

TUCA R 0 A_JumpIfInTargetInventory("PlayerPropertyRage",1,"ShieldR2")
TUCA RRRSSSTTT 1 A_Warp(2,0,0,0,0,24)
loop
ShieldR1:
TUCA OOPPQQ 1 A_Warp(2,0,0,0,0,24)
goto Shield+12
ShieldR2:
TUCA RRSSTT 1 A_Warp(2,0,0,0,0,24)
goto Shield
ShieldScale:
TUCA O 0 A_GiveInventory("Once",1)
TUCA O 0 A_SetScale(3.0,3.0)
goto Shield+2
ShieldScale2:
TUCA O 0 A_GiveInventory("Once",1)
TUCA O 0 A_SetScale(3.0,3.0)
goto Shield+14
}
}

actor TurboScorchW : ProjSpawnFuncActor
{
damagetype "TurboM_Wheel"
Obituary "$OB_SCORCHWHEEL"
-SOLID
+MISSILE
+RIPPER
+BRIGHT
-NOGRAVITY
+DONTREFLECT
maxstepheight 24
Damage 0
Radius 18
Height 40
speed 16
scale 2.5
States
{
Spawn:
TUCA O 0
TUCA OPQRST 2 A_SpawnItemEx("TurboScorchW_Explo",0,0,18)
loop
Death:
TNT1 A 0 A_SpawnItemEx("TurboScorchW3",0,0,0,16)
TNT1 A 1 A_SpawnItemEx("OilPitIgnite",0,0,8)
stop
}
}

actor TurboScorchW_Explo : BasicImplosion
{
damagetype "TurboM_Wheel"
Obituary "$OB_SCORCHWHEEL"
+EXPLODEONDEATH
Mass 80
States
{
Spawn:
TNT1 A 0
TNT1 A 2 A_Explode(Mass,56,0,0,18)
stop
}
}
actor TurboScorchW_Explo2 : TurboScorchW_Explo
{
Mass 90
}
actor TurboScorchW_Explo3 : TurboScorchW_Explo
{
Mass 100
}

actor TurboScorchW1 : TurboScorchW
{
Speed 22
States
{
Death:
TNT1 A 0 A_SpawnItemEx("TurboScorchW2",0,0,0,22)
TNT1 A 1 A_SpawnItemEx("OilPitIgnite",0,0,8)
stop
}
}

actor TurboScorchW2 : TurboScorchW
{
damagetype "TurboM_Wheel"
Obituary "$OB_SCORCHWHEEL"
+EXPLODEONWATER
+DONTSPLASH
+NOEXPLODEFLOOR
+STEPMISSILE
States
{
Spawn:
TUCA O 0
TUCA OPQRST 2 A_GiveInventory("TurboScorchW2_P",1)
TUCA O 0 A_SpawnItemEx("OilPitIgnite",0,0,0)
loop

Death:
TNT1 AAAA 0 A_SpawnItemEx("TurboM_ScorchBitFX",0,0,0,random(-10,10),random(-10,10),random(10,15),random(0,360),1)
TNT1 A 1 A_SpawnItemEx("OilPitIgnite",0,0,8)
stop
}
}

actor TurboScorchW3 : TurboScorchW2
{
States
{
Spawn:
TUCA O 0
TUCA OPQRST 2 A_SpawnItemEx("TurboScorchW_Explo3",0,0,18)//A_Explode(110,96,0)
TUCA O 0 A_SpawnItemEx("OilPitIgnite",0,0,0)
loop
}
}


actor TurboScorchW2_P : CustomInventory
{
States
{
Pickup:
TNT1 A 0 A_SpawnItemEx("TurboScorchW_Explo2",0,0,18)
TNT1 A 0 A_JumpIf(z-floorz==0,"Pickup2")
stop
Pickup2:
TNT1 A 0 A_SpawnItemEx("TurboScorchW2_Bit")
stop
}
}

actor TurboScorchW2_Bit : ProjSpawnFuncActor
{
PROJECTILE
damagetype "TurboM_WheelBit"
Obituary "$OB_TURBOSKID"
+DONTBLAST
+FLOORHUGGER
+BRIGHT
+DONTREFLECT
reactiontime 10
Damage (50)
Height 16
Radius 18
Speed 0
Scale 2.0
States
{
Spawn:
TNT1 A 0
SpawnL:
TNT1 W 0 A_SpawnItemEx("OilPitIgnite",0,0,8)
TUCA WXYZ 3
TUCA W 0 A_CountDown
TUCA WXYZ 3
TUCA W 0 A_CountDown
loop
}
}

actor TurboScorchW2_BitX : TurboScorchW2_Bit
{
-FLOORHUGGER
reactiontime 6
Height 12
Radius 12
Scale 1.5
}

actor TurboM_ScorchBitFX : BasicGraphicEffectM
{
+RIPPER
-NOGRAVITY
+BRIGHT
ReactionTime 11
States
{
SpawnFrame:
TNT1 A 0
TNT1 A 0 A_Jump(256,1,3)
S1:
TNT1 A 1 A_CountDown
TUCA U 1
loop
S2:
TNT1 A 1 A_CountDown
TUCA V 1
loop
}
}


actor TurboCarDustFX : BasicGraphicEffect
{
Scale 1.0
States
{
SpawnFrame:
TNT1 A 0 A_JumpIfInTargetInventory("TurboAltDelay",1,2)
TNT1 A 0 A_CheckFloor("Dust")
TNT1 A 1
stop
Dust:
HSHH PQR 5
stop
}
}

actor TurboCarRadius : BasicImplosion
{
Obituary "$OB_TURBORAM"
Damagetype "TurboM_Ram"
States
{
Spawn:
TNT1 A 0
TNT1 A 1 A_Explode(40+CallACS("core_checkrune",RUNE_SPREAD,2)*80,128,0,0,24)//80 160
stop
}
}

actor TurboCarRadiusW : TurboCarRadius
{
States
{
Spawn:
TNT1 A 0
TNT1 A 1 A_Explode(20+CallACS("core_checkrune",RUNE_SPREAD,2)*40,128,0,0,24)
stop
}
}

actor PainTurboM_HonkHit : Basic_PainFling_H{Args 31,0,2}
actor DeathTurboM_HonkHit : Basic_DeathFling_H{Args 35,56,0}

actor TurboHonkBlast : BasicExplosion
{
var int user_translateLikePlayer;
Translation "192:192=4:4","198:198=73:73"
damagetype "TurboM_Honk"
Obituary "$OB_TURBOHONK"
+BRIGHT
scale 2.5
States
{
Spawn:
TNT1 A 0
TNT1 A 0 A_SpawnItemEx("TurboHonkBlastFX1",0,0,0,0,0,0,0,1)
TNT1 A 0 A_SpawnItemEx("TurboHonkBlastFX2",0,0,0,0,0,0,0,1)
TNT1 A 0 A_Explode(120,256,0,0,256)
X_1G EFGHI 1
TNT1 A 0 A_Explode(120,256,0,0,256)
X_1G JKLMN 1
stop
}
}

actor TurboM_HonkProtect : PowerProtection
{
Powerup.Duration 8
DamageFactor "TurboM_Honk", 0.0
}

actor TurboHonkBlastFX1 : BasicGraphicEffect
{
+BRIGHT
Scale 2.0
States
{
SpawnFrame:
Q_7H EFGHIJKLMN 1
stop
}
}

actor TurboHonkBlastFX2 : BasicGraphicEffect
{
+BRIGHT
Scale 1.5
States
{
SpawnFrame:
Q_7H EFGHIJKLMN 1
stop
}
}


actor Turboman_W_NormalBar : NormalBar {Args 93,42}
actor Turboman_W_SecondBar : SecondBar {Args 4,73}
actor Turboman_W_ScriptBar : ScriptBar {}