//Copy of v6b 'botfix.txt'
//CBM comments show changes
//Extra bot stuff at the bottom of this file

actor CreateBotBuddy : CustomInventory
{
inventory.amount 1
inventory.maxamount 1
+AUTOACTIVATE
States
{
Spawn:
TNT1 A 1
loop
Pickup:
TNT1 A 0 A_GiveInventory("CreateBotBuddyCBM",1)//CBM
TNT1 A 0 A_SpawnItemEx("BotBuddy",32,0,32,0,0,0)
TNT1 A 0 A_SpawnItemEx("BotBuddy",32,0,64,0,0,0)
TNT1 A 0 A_JumpIfTargetInLOS("See")
stop
See:
TNT1 A 0 A_JumpIfInventory("BotDifficulty", 1, "Hard")
stop
Hard:
TNT1 A 0 A_JumpIfInventory("NoBotFix", 1, "Death")
TNT1 A 0 A_Jump(183, "HopCheck")
stop
HopCheck:
TNT1 A 0 A_JumpIf(floorz==z, "Hop")
stop
Hop:
TNT1 A 0 A_GiveInventory("BotJump",1)
stop
Death:
TNT1 A 0
stop
}
}

actor BotSightCounter : Inventory
{
inventory.maxamount 9999
}

actor BotDifficulty : Inventory
{
inventory.maxamount 10
}

actor BotBuddy
{
-SOLID
+NOINTERACTION
+NOGRAVITY
+MISSILE
-FLOORCLIP
+DONTBLAST//CBM
+SERVERSIDEONLY//CBM
height 1
radius 1
damagetype "BotSight"
States
{
Spawn:
TNT1 A 0
TNT1 A 1 A_JumpIf(z-floorz<=0 && z-floorz >= -16,"GiveJump")
stop
GiveJump:
TNT1 A 0 A_GiveToTarget("BotJump",1)
stop
Death:
TNT1 A 0
stop
}
}


actor PlayerBotKicker
{
Damage (1)
height 3
radius 3
+HITTRACER
+MISSILE
+DONTREFLECT
+DONTBLAST
+EXPLODEONDEATH // disabled medals
renderstyle none
damagetype "NoPain"
states
{
Spawn:
TNT1 A 0
PLAY A 2 ACS_NamedExecuteAlways("core_setpointer", 0, AAPTR_TARGET, 1000)
stop
Death:
PLAY A 1
PLAY A 1 A_GiveInventory("BotKickerRecover", 1, AAPTR_TRACER) 
stop
}
}

actor BotKickerRecover : Health
{
inventory.amount 1
inventory.maxamount 100
}

/*
// This is officially insane. Give bots NoBotFix to avoid the hacky stuff. Automatically given onlone.
actor BotBuddy
{
-SOLID
+NOINTERACTION
+NOGRAVITY
+MISSILE
+EXPLODEONDEATH
-FLOORCLIP
height 1
radius 1
damagetype "BotSight"
States
{
Spawn:
TNT1 A 0
TNT1 A 0 A_JumpIfInTargetInventory("BotSightCounter", 10, "Reset")
TNT1 A 1 A_JumpIf(z-floorz<=0 && z-floorz >= -16,"GiveJump")
TNT1 A 0 A_JumpIfInTargetInventory("NoBotFix",1,"Death")
TNT1 A 0 A_GiveToTarget("BotSightCounter",1)
TNT1 A 0 A_JumpIfInTargetInventory("BotSightCounter", 10, "Look")
stop
GiveJump:
TNT1 A 0 A_GiveToTarget("BotJump",1)
stop
Look:
TNT1 A 0 A_LookEx(LOF_NOSOUNDCHECK, 42, 0, 0, 90, "Death") 
TNT1 A 0 A_GiveToTarget("BotBuddha")
TNT1 A 1 A_LookEx(LOF_NOSOUNDCHECK, 42, 0, 0, 360, "See") 
stop
See:
TNT1 A 0 A_JumpIfInTargetInventory("NoBotFix",1,"Death")
TNT1 A 1 A_Explode(1,32,0,0,32)
TNT1 A 0 A_GiveToTarget("BotDenyMedals")
TNT1 A 0 //A_Log("Goddem")
stop
Reset2:
TNT1 A 0 HealThing(2)
Reset:
TNT1 A 0 A_TakeFromTarget("BotSightCounter",999)
TNT1 A 0 A_GiveToTarget("BotBuddhaOff")
TNT1 A 0 A_LookEx(LOF_NOSOUNDCHECK, 42, 0, 0, 360, "Death") 
stop
Death:
TNT1 A 0// A_Explode(0,0,0,0,0)
stop
}
}
actor BotDenyMedals : CustomInventory
{
inventory.amount 1
inventory.maxamount 1
+AUTOACTIVATE
States
{
Spawn:
TNT1 A 1
loop
Pickup:
TNT1 A 0 A_FireBullets(0,0,0,0,"BulletPuff",0,1)//A_FireCustomMissile("BotDenyMedalProjectile", 0, 0, 0, 0, 2, 0)
stop
}
}

actor BotDenyMedalProjectile
{
PROJECTILE
height 1
Radius 1
speed 10
-NOGRAVITY
gravity 100.0
damage 0
States
{
Spawn:
PLAY A 8
stop
Death:
PLAY A 1
stop
}
}
*/

actor BotBuddha : CustomInventory
{
inventory.amount 1
inventory.maxamount 1
+AUTOACTIVATE
States
{
Spawn:
TNT1 A 1
loop
Pickup:
TNT1 A 0 SetPlayerProperty(0, 1, 16)
TNT1 A 0 //A_SpawnItemEx("DrillExplode")
stop
}
}

actor BotBuddhaOff : CustomInventory
{
inventory.amount 1
inventory.maxamount 1
+AUTOACTIVATE
States
{
Spawn:
TNT1 A 1
loop
Pickup:
TNT1 A 0 //A_LogInt(health)
TNT1 A 0 SetPlayerProperty(0, 0, 16)
TNT1 A 0 //A_SpawnItemEx("DrillExplode")
stop
}
}


actor BotJump : CustomInventory
{
inventory.amount 1
inventory.maxamount 1
+AUTOACTIVATE
States
{
Spawn:
TNT1 A 1
loop
Pickup:
TNT1 A 0 A_ChangeVelocity(momx, momy, CallACS("core_getactorproperty", 0, APROP_JumpZ, DATATYPE_INT), CVF_REPLACE)
stop
}
}

actor NoBotFix : Once {}

actor BotEasyPower : PowerDamage
{
damagefactor "normal", 0.5
powerup.duration 0x7FFFFFFD
}

actor BotEasySpeed : PowerSpeed
{
+POWERSPEED.NOTRAIL
speed 0.65
powerup.duration 0x7FFFFFFD
}

actor BotMediumPower : PowerDamage
{
damagefactor "normal", 0.65
powerup.duration 0x7FFFFFFD
}


//CBM//CBM//CBM//CBM//CBM//CBM//CBM//CBM//CBM//CBM//CBM//CBM//CBM//CBM//CBM
//CBM//CBM//CBM//CBM//CBM//CBM//CBM//CBM//CBM//CBM//CBM//CBM//CBM//CBM//CBM
//CBM//CBM//CBM//CBM//CBM//CBM//CBM//CBM//CBM//CBM//CBM//CBM//CBM//CBM//CBM


actor CreateBotBuddyCBM : CustomInventory
{
States
{
Pickup:
TNT1 A 0 A_JumpIfInventory("BotRetreatFlag",1,"Retreat")
TNT1 A 0 A_JumpIfInventory("BotHugFlag",1,"Hug")
TNT1 A 0 A_GiveInventory("BotRevert",1)
stop
Retreat:
TNT1 A 0 A_GiveInventory("BotRetreat",1)
stop
Hug:
TNT1 A 0 A_GiveInventory("BotHug",1)
stop
}
}

actor BotRetreatFlag : Once {}

actor BotHugFlag : Once {}

actor BotRetreat : CustomInventory
{
States
{
Pickup:
TNT1 A 0 A_JumpIfCloser(150,"Reverse")
TNT1 A 0 A_GiveInventory("CBM_BotFlipSpeedPowerGiver")//-1 Speed
TNT1 A 0 A_GiveInventory("CreateBackBotBuddy",1)
stop
Reverse:
TNT1 A 0 A_TakeInventory("CBM_BotFlipSpeedPower")
stop
}
}

actor CreateBackBotBuddy : CreateBotBuddy
{
States
{
Pickup:
TNT1 A 0 A_SpawnItemEx("BotBuddy",-32,0,32,0,0,0)
TNT1 A 0 A_SpawnItemEx("BotBuddy",-32,0,64,0,0,0)
stop
}
}

actor BotHug : CustomInventory
{
States
{
Pickup:
TNT1 A 0 A_JumpIfCloser(150,"Reverse")
TNT1 A 0 A_TakeInventory("CBM_BotFlipSpeedPower")
stop
Reverse:
TNT1 A 0 A_GiveInventory("CBM_BotFlipSpeedPowerGiver")
stop
}
}

actor BotRevert : CustomInventory
{
States
{
Pickup:
TNT1 A 0 A_TakeInventory("CBM_BotFlipSpeedPower")
stop
}
}

actor BotFloorJump : CustomInventory
{
States
{
Pickup:
TNT1 A 0 A_JumpIf(floorz-z==0,1)
stop
TNT1 A 0 A_ChangeVelocity(momx, momy, CallACS("core_getactorproperty", 0, APROP_JumpZ, DATATYPE_INT), CVF_REPLACE)
stop
}
}