From 8caa87f5dc7a8a8df0f7f1b82f47573db3d83cc6 Mon Sep 17 00:00:00 2001 From: "Gustavo Rehermann (Gustavo6046)" Date: Tue, 30 Apr 2019 19:09:08 +0000 Subject: [PATCH] v0.4.0: Critical fix for latest GZDoom, shoot nodes, and other general improvements --- KeyConf.txt | 1 + SNDINFO.txt | 164 +- ZScript.zsc | 2500 +++++++++-------- ZetaCode/Pathing.zsc | 19 +- ZetaCode/PawnClasses/ZetaBotPawn.zsc | 21 +- ZetaCode/PawnClasses/ZetaDoom.zsc | 5 - ZetaCode/Standard.zsc | 537 ++-- ZetaCode/WeaponSupport/Doom/ZetaBFG.zsc | 2 +- ZetaCode/WeaponSupport/Doom/ZetaPR.zsc | 2 +- ZetaCode/WeaponSupport/Doom/ZetaRL.zsc | 2 +- .../SentientMushes/ZetaFireBallista.zsc | 4 +- .../SentientMushes/ZetaRocketeer.zsc | 4 +- .../SentientMushes/ZetaRockox.zsc | 2 +- ZetaCode/WeaponSupport/ZetaBullet.zsc | 16 +- ZetaCode/WeaponSupport/ZetaWeapon.zsc | 12 + build | 13 +- config | 2 +- sounds/{DV1ACTV1 => ZV1ACTV1.ogg} | Bin sounds/{DV1ACTV2 => ZV1ACTV2.ogg} | Bin sounds/{DV1ACTV3 => ZV1ACTV3.ogg} | Bin sounds/{DV1ACTV4 => ZV1ACTV4.ogg} | Bin sounds/{DV1ELIM1 => ZV1ELIM1.ogg} | Bin sounds/{DV1ELIM2 => ZV1ELIM2.ogg} | Bin sounds/{DV1ELIM3 => ZV1ELIM3.ogg} | Bin sounds/{DV1HIDE1 => ZV1HIDE1.ogg} | Bin sounds/{DV1HIDE2 => ZV1HIDE2.ogg} | Bin sounds/{DV1HURT1 => ZV1HURT1.ogg} | Bin sounds/{DV1HURT2 => ZV1HURT2.ogg} | Bin sounds/{DV1HURT3 => ZV1HURT3.ogg} | Bin sounds/{DV1IDLE1 => ZV1IDLE1.ogg} | Bin sounds/{DV1IDLE2 => ZV1IDLE2.ogg} | Bin sounds/{DV1IDLE3 => ZV1IDLE3.ogg} | Bin sounds/{DV1IDLE4 => ZV1IDLE4.ogg} | Bin sounds/{DV1IDLE5 => ZV1IDLE5.ogg} | Bin sounds/{DV1IDLE6 => ZV1IDLE6.ogg} | Bin sounds/{DV1TARG1 => ZV1TARG1.ogg} | Bin sounds/{DV1TARG2 => ZV1TARG2.ogg} | Bin sounds/{DV1TARG3 => ZV1TARG3.ogg} | Bin sounds/{DV2ACTV1 => ZV2ACTV1.ogg} | Bin sounds/{DV2ACTV2 => ZV2ACTV2.ogg} | Bin sounds/{DV2ACTV3 => ZV2ACTV3.ogg} | Bin sounds/{DV2ACTV4 => ZV2ACTV4.ogg} | Bin sounds/{DV2ELIM1 => ZV2ELIM1.ogg} | Bin sounds/{DV2ELIM2 => ZV2ELIM2.ogg} | Bin sounds/{DV2ELIM3 => ZV2ELIM3.ogg} | Bin sounds/{DV2HIDE1 => ZV2HIDE1.ogg} | Bin sounds/{DV2HIDE3 => ZV2HIDE3.ogg} | Bin sounds/{DV2HURT1 => ZV2HURT1.ogg} | Bin sounds/{DV2HURT2 => ZV2HURT2.ogg} | Bin sounds/{DV2IDLE1 => ZV2IDLE1.ogg} | Bin sounds/{DV2IDLE2 => ZV2IDLE2.ogg} | Bin sounds/{DV2IDLE3 => ZV2IDLE3.ogg} | Bin sounds/{DV2IDLE4 => ZV2IDLE4.ogg} | Bin sounds/{DV2IDLE5 => ZV2IDLE5.ogg} | Bin sounds/{DV2TARG1 => ZV2TARG1.ogg} | Bin sounds/{DV2TARG2 => ZV2TARG2.ogg} | Bin sounds/{DV2TARG3 => ZV2TARG3.ogg} | Bin sounds/{DV3ACTV1 => ZV3ACTV1.ogg} | Bin sounds/{DV3ACTV2 => ZV3ACTV2.ogg} | Bin sounds/{DV3ELIM1 => ZV3ELIM1.ogg} | Bin sounds/{DV3ELIM2 => ZV3ELIM2.ogg} | Bin sounds/{DV3ELIM3 => ZV3ELIM3.ogg} | Bin sounds/{DV3HIDE1 => ZV3HIDE1.ogg} | Bin sounds/{DV3HIDE2 => ZV3HIDE2.ogg} | Bin sounds/{DV3HIDE3 => ZV3HIDE3.ogg} | Bin sounds/{DV3HURT1 => ZV3HURT1.ogg} | Bin sounds/{DV3HURT2 => ZV3HURT2.ogg} | Bin sounds/{DV3HURT3 => ZV3HURT3.ogg} | Bin sounds/{DV3IDLE1 => ZV3IDLE1.ogg} | Bin sounds/{DV3IDLE2 => ZV3IDLE2.ogg} | Bin sounds/{DV3IDLE3 => ZV3IDLE3.ogg} | Bin sounds/{DV3IDLE4 => ZV3IDLE4.ogg} | Bin sounds/{DV3IDLE5 => ZV3IDLE5.ogg} | Bin sounds/{DV3IDLE6 => ZV3IDLE6.ogg} | Bin sounds/{DV3IDLE7 => ZV3IDLE7.ogg} | Bin sounds/{DV3TARG1 => ZV3TARG1.ogg} | Bin sounds/{DV3TARG2 => ZV3TARG2.ogg} | Bin sounds/{DV3TARG3 => ZV3TARG3.ogg} | Bin 78 files changed, 1705 insertions(+), 1601 deletions(-) rename sounds/{DV1ACTV1 => ZV1ACTV1.ogg} (100%) rename sounds/{DV1ACTV2 => ZV1ACTV2.ogg} (100%) rename sounds/{DV1ACTV3 => ZV1ACTV3.ogg} (100%) rename sounds/{DV1ACTV4 => ZV1ACTV4.ogg} (100%) rename sounds/{DV1ELIM1 => ZV1ELIM1.ogg} (100%) rename sounds/{DV1ELIM2 => ZV1ELIM2.ogg} (100%) rename sounds/{DV1ELIM3 => ZV1ELIM3.ogg} (100%) rename sounds/{DV1HIDE1 => ZV1HIDE1.ogg} (100%) rename sounds/{DV1HIDE2 => ZV1HIDE2.ogg} (100%) rename sounds/{DV1HURT1 => ZV1HURT1.ogg} (100%) rename sounds/{DV1HURT2 => ZV1HURT2.ogg} (100%) rename sounds/{DV1HURT3 => ZV1HURT3.ogg} (100%) rename sounds/{DV1IDLE1 => ZV1IDLE1.ogg} (100%) rename sounds/{DV1IDLE2 => ZV1IDLE2.ogg} (100%) rename sounds/{DV1IDLE3 => ZV1IDLE3.ogg} (100%) rename sounds/{DV1IDLE4 => ZV1IDLE4.ogg} (100%) rename sounds/{DV1IDLE5 => ZV1IDLE5.ogg} (100%) rename sounds/{DV1IDLE6 => ZV1IDLE6.ogg} (100%) rename sounds/{DV1TARG1 => ZV1TARG1.ogg} (100%) rename sounds/{DV1TARG2 => ZV1TARG2.ogg} (100%) rename sounds/{DV1TARG3 => ZV1TARG3.ogg} (100%) rename sounds/{DV2ACTV1 => ZV2ACTV1.ogg} (100%) rename sounds/{DV2ACTV2 => ZV2ACTV2.ogg} (100%) rename sounds/{DV2ACTV3 => ZV2ACTV3.ogg} (100%) rename sounds/{DV2ACTV4 => ZV2ACTV4.ogg} (100%) rename sounds/{DV2ELIM1 => ZV2ELIM1.ogg} (100%) rename sounds/{DV2ELIM2 => ZV2ELIM2.ogg} (100%) rename sounds/{DV2ELIM3 => ZV2ELIM3.ogg} (100%) rename sounds/{DV2HIDE1 => ZV2HIDE1.ogg} (100%) rename sounds/{DV2HIDE3 => ZV2HIDE3.ogg} (100%) rename sounds/{DV2HURT1 => ZV2HURT1.ogg} (100%) rename sounds/{DV2HURT2 => ZV2HURT2.ogg} (100%) rename sounds/{DV2IDLE1 => ZV2IDLE1.ogg} (100%) rename sounds/{DV2IDLE2 => ZV2IDLE2.ogg} (100%) rename sounds/{DV2IDLE3 => ZV2IDLE3.ogg} (100%) rename sounds/{DV2IDLE4 => ZV2IDLE4.ogg} (100%) rename sounds/{DV2IDLE5 => ZV2IDLE5.ogg} (100%) rename sounds/{DV2TARG1 => ZV2TARG1.ogg} (100%) rename sounds/{DV2TARG2 => ZV2TARG2.ogg} (100%) rename sounds/{DV2TARG3 => ZV2TARG3.ogg} (100%) rename sounds/{DV3ACTV1 => ZV3ACTV1.ogg} (100%) rename sounds/{DV3ACTV2 => ZV3ACTV2.ogg} (100%) rename sounds/{DV3ELIM1 => ZV3ELIM1.ogg} (100%) rename sounds/{DV3ELIM2 => ZV3ELIM2.ogg} (100%) rename sounds/{DV3ELIM3 => ZV3ELIM3.ogg} (100%) rename sounds/{DV3HIDE1 => ZV3HIDE1.ogg} (100%) rename sounds/{DV3HIDE2 => ZV3HIDE2.ogg} (100%) rename sounds/{DV3HIDE3 => ZV3HIDE3.ogg} (100%) rename sounds/{DV3HURT1 => ZV3HURT1.ogg} (100%) rename sounds/{DV3HURT2 => ZV3HURT2.ogg} (100%) rename sounds/{DV3HURT3 => ZV3HURT3.ogg} (100%) rename sounds/{DV3IDLE1 => ZV3IDLE1.ogg} (100%) rename sounds/{DV3IDLE2 => ZV3IDLE2.ogg} (100%) rename sounds/{DV3IDLE3 => ZV3IDLE3.ogg} (100%) rename sounds/{DV3IDLE4 => ZV3IDLE4.ogg} (100%) rename sounds/{DV3IDLE5 => ZV3IDLE5.ogg} (100%) rename sounds/{DV3IDLE6 => ZV3IDLE6.ogg} (100%) rename sounds/{DV3IDLE7 => ZV3IDLE7.ogg} (100%) rename sounds/{DV3TARG1 => ZV3TARG1.ogg} (100%) rename sounds/{DV3TARG2 => ZV3TARG2.ogg} (100%) rename sounds/{DV3TARG3 => ZV3TARG3.ogg} (100%) diff --git a/KeyConf.txt b/KeyConf.txt index 205341d..125b1b9 100644 --- a/KeyConf.txt +++ b/KeyConf.txt @@ -2,6 +2,7 @@ defaultbind kp1 "summonfriend zetabot 0" defaultbind kp2 "summon ztpathnode 0" defaultbind kp3 "summon ztusenode 0" defaultbind kp4 "summon ztjumpnode 0" +defaultbind kp5 "summon ztshootnode 0" defaultbind kp7 "kill zetadoom; kill zetastrife; kill zetasmushes" defaultbind kp8 "summon ZTUploadNodes" defaultbind kp9 "summon ZTPromptNodes" diff --git a/SNDINFO.txt b/SNDINFO.txt index ae4d695..5c529cf 100644 --- a/SNDINFO.txt +++ b/SNDINFO.txt @@ -3,9 +3,9 @@ $random zetabot/1/actv { zetabot/1/actv/1 zetabot/1/actv/2 zetabot/1/actv/3 zeta $random zetabot/2/actv { zetabot/2/actv/1 zetabot/2/actv/2 zetabot/2/actv/3 zetabot/2/actv/4 } $random zetabot/3/actv { zetabot/3/actv/1 zetabot/3/actv/2 zetabot/3/actv/3 } -$random zetabot/1/target { zetabot/1/target/1 zetabot/1/target/2 zetabot/1/target/3 } -$random zetabot/2/target { zetabot/2/target/1 zetabot/2/target/2 zetabot/2/target/3 } -$random zetabot/3/target { zetabot/3/target/1 zetabot/3/target/2 zetabot/3/target/3 } +$random zetabot/1/targ { zetabot/1/target/1 zetabot/1/target/2 zetabot/1/target/3 } +$random zetabot/2/targ { zetabot/2/target/1 zetabot/2/target/2 zetabot/2/target/3 } +$random zetabot/3/targ { zetabot/3/target/1 zetabot/3/target/2 zetabot/3/target/3 } $random zetabot/1/elim { zetabot/1/elim/1 zetabot/1/elim/2 zetabot/1/elim/3 } $random zetabot/2/elim { zetabot/2/elim/1 zetabot/2/elim/2 zetabot/2/elim/3 } @@ -23,85 +23,83 @@ $random zetabot/1/idle { zetabot/1/idle/1 zetabot/1/idle/2 zetabot/1/idle/3 zeta $random zetabot/2/idle { zetabot/2/idle/1 zetabot/2/idle/2 zetabot/2/idle/3 zetabot/2/idle/4 zetabot/2/idle/5 } $random zetabot/3/idle { zetabot/3/idle/1 zetabot/3/idle/2 zetabot/3/idle/3 zetabot/3/idle/4 zetabot/3/idle/5 zetabot/3/idle/6 zetabot/3/idle/7 } -zetabot/1/target/1 "DV1TARG1" -zetabot/1/target/2 "DV1TARG2" -zetabot/1/target/3 "DV1TARG3" - -zetabot/2/target/1 "DV2TARG1" -zetabot/2/target/2 "DV2TARG2" -zetabot/2/target/3 "DV2TARG3" - -zetabot/3/target/1 "DV3TARG1" -zetabot/3/target/2 "DV3TARG2" -zetabot/3/target/3 "DV3TARG3" - -zetabot/1/elim/1 "DV1ELIM1" -zetabot/1/elim/2 "DV1ELIM2" -zetabot/1/elim/3 "DV1ELIM3" - -zetabot/2/elim/1 "DV2ELIM1" -zetabot/2/elim/2 "DV2ELIM2" -zetabot/2/elim/3 "DV2ELIM3" - -zetabot/3/elim/1 "DV3ELIM1" -zetabot/3/elim/2 "DV3ELIM2" - -zetabot/1/hide/1 "DV1HIDE1" -zetabot/1/hide/2 "DV1HIDE2" - -zetabot/2/hide/1 "DV2HIDE1" -zetabot/2/hide/2 "DV2HIDE2" - -zetabot/3/hide/1 "DV3HIDE1" -zetabot/3/hide/2 "DV3HIDE2" -zetabot/3/hide/3 "DV3HIDE2" - -zetabot/1/hurt/1 "DV1HURT1" -zetabot/1/hurt/2 "DV1HURT2" -zetabot/1/hurt/3 "DV1HURT3" - -zetabot/2/hurt/1 "DV2HURT1" -zetabot/2/hurt/2 "DV2HURT2" -zetabot/2/hurt/3 "DV2HURT3" - -zetabot/3/hurt/1 "DV3HURT1" -zetabot/3/hurt/2 "DV3HURT2" -zetabot/3/hurt/3 "DV3HURT3" - -zetabot/1/idle/1 "DV1IDLE1" -zetabot/1/idle/2 "DV1IDLE2" -zetabot/1/idle/3 "DV1IDLE3" -zetabot/1/idle/4 "DV1IDLE4" -zetabot/1/idle/5 "DV1IDLE5" -zetabot/1/idle/6 "DV1IDLE6" - -zetabot/2/idle/1 "DV2IDLE1" -zetabot/2/idle/2 "DV2IDLE2" -zetabot/2/idle/3 "DV2IDLE3" -zetabot/2/idle/4 "DV2IDLE4" -zetabot/2/idle/5 "DV2IDLE5" - -zetabot/3/idle/1 "DV3IDLE1" -zetabot/3/idle/2 "DV3IDLE2" -zetabot/3/idle/3 "DV3IDLE3" -zetabot/3/idle/4 "DV3IDLE4" -zetabot/3/idle/5 "DV3IDLE5" -zetabot/3/idle/6 "DV3IDLE6" -zetabot/3/idle/7 "DV3IDLE7" - -zetabot/1/actv/1 "DV1ACTV1" -zetabot/1/actv/2 "DV1ACTV2" -zetabot/1/actv/3 "DV1ACTV3" -zetabot/1/actv/4 "DV1ACTV4" - -zetabot/2/actv/1 "DV2ACTV1" -zetabot/2/actv/2 "DV2ACTV2" -zetabot/2/actv/3 "DV2ACTV3" -zetabot/2/actv/4 "DV2ACTV4" - -zetabot/3/actv/1 "DV3ACTV1" -zetabot/3/actv/2 "DV3ACTV2" -zetabot/3/actv/3 "DV3ACTV2" +zetabot/1/target/1 "ZV1TARG1" +zetabot/1/target/2 "ZV1TARG2" +zetabot/1/target/3 "ZV1TARG3" + +zetabot/2/target/1 "ZV2TARG1" +zetabot/2/target/2 "ZV2TARG2" +zetabot/2/target/3 "ZV2TARG3" + +zetabot/3/target/1 "ZV3TARG1" +zetabot/3/target/2 "ZV3TARG2" +zetabot/3/target/3 "ZV3TARG3" + +zetabot/1/elim/1 "ZV1ELIM1" +zetabot/1/elim/2 "ZV1ELIM2" +zetabot/1/elim/3 "ZV1ELIM3" + +zetabot/2/elim/1 "ZV2ELIM1" +zetabot/2/elim/2 "ZV2ELIM2" +zetabot/2/elim/3 "ZV2ELIM3" + +zetabot/3/elim/1 "ZV3ELIM1" +zetabot/3/elim/2 "ZV3ELIM2" + +zetabot/1/hide/1 "ZV1HIDE1" +zetabot/1/hide/2 "ZV1HIDE2" + +zetabot/2/hide/1 "ZV2HIDE1" +zetabot/2/hide/2 "ZV2HIDE2" + +zetabot/3/hide/1 "ZV3HIDE1" +zetabot/3/hide/2 "ZV3HIDE2" +zetabot/3/hide/3 "ZV3HIDE2" + +zetabot/1/hurt/1 "ZV1HURT1" +zetabot/1/hurt/2 "ZV1HURT2" +zetabot/1/hurt/3 "ZV1HURT3" + +zetabot/2/hurt/1 "ZV2HURT1" +zetabot/2/hurt/2 "ZV2HURT2" +zetabot/2/hurt/3 "ZV2HURT3" + +zetabot/3/hurt/1 "ZV3HURT1" +zetabot/3/hurt/2 "ZV3HURT2" +zetabot/3/hurt/3 "ZV3HURT3" + +zetabot/1/idle/1 "ZV1IDLE1" +zetabot/1/idle/2 "ZV1IDLE2" +zetabot/1/idle/3 "ZV1IDLE3" +zetabot/1/idle/4 "ZV1IDLE4" +zetabot/1/idle/5 "ZV1IDLE5" +zetabot/1/idle/6 "ZV1IDLE6" + +zetabot/2/idle/1 "ZV2IDLE1" +zetabot/2/idle/2 "ZV2IDLE2" +zetabot/2/idle/3 "ZV2IDLE3" +zetabot/2/idle/4 "ZV2IDLE4" +zetabot/2/idle/5 "ZV2IDLE5" + +zetabot/3/idle/1 "ZV3IDLE1" +zetabot/3/idle/2 "ZV3IDLE2" +zetabot/3/idle/3 "ZV3IDLE3" +zetabot/3/idle/4 "ZV3IDLE4" +zetabot/3/idle/5 "ZV3IDLE5" + +zetabot/1/actv/1 "ZV1ACTV1" +zetabot/1/actv/2 "ZV1ACTV2" +zetabot/1/actv/3 "ZV1ACTV3" +zetabot/1/actv/4 "ZV1ACTV4" + +zetabot/2/actv/1 "ZV2ACTV1" +zetabot/2/actv/2 "ZV2ACTV2" +zetabot/2/actv/3 "ZV2ACTV3" +zetabot/2/actv/4 "ZV2ACTV4" + +zetabot/3/actv/1 "ZV3ACTV1" +zetabot/3/actv/2 "ZV3ACTV2" +zetabot/3/actv/3 "ZV3ACTV2" // NEW ZETABOT VOICES $random zetabot/4/actv { zetabot/4/actv/1 zetabot/4/actv/2 zetabot/4/actv/3 } @@ -139,3 +137,5 @@ ztmisc/rico4 "ZSRICO4" ztmisc/jump "ZSJUMP" ztmisc/die "DSPLDETH" ztmisc/xdie "DSPDIEHI" + +ztmisc/grunt dsoof \ No newline at end of file diff --git a/ZScript.zsc b/ZScript.zsc index 30c781a..731ce94 100644 --- a/ZScript.zsc +++ b/ZScript.zsc @@ -31,20 +31,20 @@ class DestBall : PlasmaBall void A_BallTick() { - Vector2 offs = Vec2To(targetNode); - offs.x /= Distance2D(targetNode); - offs.y /= Distance2D(targetNode); - - Vector2 vel = AngleToVector(angle); + Vector2 offs = Vec2To(targetNode); + offs.x /= Distance2D(targetNode); + offs.y /= Distance2D(targetNode); + + Vector2 vel = AngleToVector(angle); if ( Distance3D(targetNode) < 72 || (offs.x * vel.x) + (offs.y * vel.y) < 0 ) - SetStateLabel("Death"); + SetStateLabel("Death"); } - Default - { - Damage 0; - } + Default + { + Damage 0; + } States { @@ -56,162 +56,184 @@ class DestBall : PlasmaBall class WeaponRating : Thinker { - double rating; - bool bAlt; - - void BeginPlay() - { - rating = 0; - bAlt = false; - } + double rating; + bool bAlt; + + void BeginPlay() + { + rating = 0; + bAlt = false; + } } class NumBots : Thinker { - uint value; - - NumBots Init() - { - ChangeStatNum(STAT_INFO); - value = 0; - return self; - } - - static NumBots Get() - { - ThinkerIterator it = ThinkerIterator.Create("NumBots", STAT_INFO); - let p = NumBots(it.Next()); - - if (p == null) - p = new("NumBots").Init(); - - return p; - } + uint value; + + NumBots Init() + { + ChangeStatNum(STAT_INFO); + value = 0; + return self; + } + + static NumBots Get() + { + ThinkerIterator it = ThinkerIterator.Create("NumBots", STAT_INFO); + let p = NumBots(it.Next()); + + if (p == null) + p = new("NumBots").Init(); + + return p; + } } class ZTBotController : Actor { ObstacleCheckWaiter leftObs, frontObs, rightObs; + + static uint MaxID() { + ThinkerIterator it = ThinkerIterator.Create("ZTBotController", STAT_DEFAULT); + uint resMax = 0; + ZTBotController p; + + while (p = ZTBotController(it.Next())) + if (p.BotID > resMax) + resMax = p.BotID; + + return resMax; + } + + enum BotState + { + BS_WANDERING = 0, + BS_HUNTING, + BS_ATTACKING, + BS_FOLLOWING, + BS_FLEEING + }; + + enum LogType + { + LT_ERROR = 0, + LT_WARNING, + LT_INFO, + LT_VERBOSE + }; - enum BotState - { - BS_WANDERING = 0, - BS_HUNTING, - BS_ATTACKING, - BS_FOLLOWING, - BS_FLEEING - }; - - enum LogType - { - LT_ERROR = 0, - LT_WARNING, - LT_INFO, - LT_VERBOSE - }; - - void DebugLog(LogType kind, string msg) - { - if ( CVar.FindCVar("zb_debug").GetInt() > 0 ) - { - string logHeader = ""; - - if ( kind == LT_ERROR ) - logHeader = "\cr[ERROR]"; - - else if ( kind == LT_WARNING ) - logHeader = "\cf[WARNING]"; - - else if ( kind == LT_INFO ) - logHeader = "\ch[INFO]"; - - else if ( kind == LT_VERBOSE ) - { - if ( CVar.FindCVar("zb_debug").GetInt() > 1 ) - logHeader = "\cd[VERBOSE]"; - - else - return; - } - - A_Log("\cq[ZetaBot] "..logHeader.." "..msg); - } - } + void DebugLog(LogType kind, string msg) + { + if ( CVar.FindCVar("zb_debug").GetInt() > 0 ) + { + string logHeader = ""; + + if ( kind == LT_ERROR ) + logHeader = "\cr[ERROR]"; + + else if ( kind == LT_WARNING ) + logHeader = "\cf[WARNING]"; + + else if ( kind == LT_INFO ) + logHeader = "\ch[INFO]"; + + else if ( kind == LT_VERBOSE ) + { + if ( CVar.FindCVar("zb_debug").GetInt() > 1 ) + logHeader = "\cd[VERBOSE]"; + + else + return; + } + + A_Log("\cq[ZetaBot] "..logHeader.." "..msg); + } + } bool bReachedGoal; ZTPathNode goalNode; - ZetaBotPawn possessed; - ZetaWeapon lastWeap; - BotState bstate; - ZTPathNode navDest; - Actor goingAfter; - Actor enemy; - Actor commander; - ZTPathNode currNode; - double strafeMomentum; - double angleMomentum; + ZetaBotPawn possessed; + ZetaWeapon lastWeap; + BotState bstate; + ZTPathNode navDest; + Actor goingAfter; + Actor enemy; + Actor commander; + ZTPathNode currNode; + double strafeMomentum; + double angleMomentum; Vector3 lastEnemyPos; - double age; - uint logRate; - bool initialized; - double blocked; - double averageSpeed; - uint speedRemaining; - Vector3 lastPos; - ZTPathNode pastNode; - int myVoice; - uint index; - double lastShot; - ZetaWeaponModule loader; - uint botID; - string myName; - uint numShoots; - uint pathCountdown; - uint retargetCount; - Array UseHistory; - - bool AutoUseAtAngle(double angle) - { - FLineTraceData td; - - possessed.LineTrace( - possessed.angle + angle, - possessed.radius + 64, - 0, - flags: TRF_THRUBLOCK | TRF_THRUHITSCAN | TRF_THRUACTORS, - offsetz: possessed.height - 24, - data: td - ); - - if ( td.HitType != TRACE_HitWall || td.HitLine.Special == 0 ) - return false; - - for ( let i = 0; i < UseHistory.Size(); i++ ) - { - if ( UseHistory[i].Used == td.HitLine && age - UseHistory[i].When < CVar.GetCVar('zb_autouseinterval').GetFloat() ) - return false; - - else if ( age - UseHistory[i].When >= CVar.GetCVar('zb_autouseinterval').GetFloat() ) - UseHistory.Delete(i--); - } - - td.HitLine.Activate(possessed, 0, SPAC_Use); - - ZTLineUseHistoryEntry entry = new("ZTLineUseHistoryEntry"); - - entry.Used = td.HitLine; - entry.When = age; - - UseHistory.Push(entry); - - return true; - } - - ZTPathNode RandomGoalNode() - { + double age; + uint GruntInterval; + uint logRate; + uint BotID; + bool initialized; + double blocked; + double averageSpeed; + uint speedRemaining; + Vector3 lastPos; + ZTPathNode pastNode; + int myVoice; + uint index; + double lastShot; + ZetaWeaponModule loader; + string myName; + uint numShoots; + uint pathCountdown; + uint retargetCount; + Array UseHistory; + + bool AutoUseAtAngle(double angle) + { + FLineTraceData td; + + possessed.LineTrace( + possessed.angle + angle, + possessed.radius + 64, + 0, + flags: TRF_THRUBLOCK | TRF_THRUHITSCAN | TRF_THRUACTORS, + offsetz: possessed.height - 24, + data: td + ); + + if ( td.HitType != TRACE_HitWall ) + return false; + + if ( td.HitLine.Special == 0 ) { + if ( GruntInterval == 0 || GruntInterval-- == 0 ) { + A_PlaySound("ztmisc/grunt", CHAN_VOICE, attenuation: 1.1); + GruntInterval = 20; + Log(GruntInterval); + } + + return false; + } + + for ( let i = 0; i < UseHistory.Size(); i++ ) { + if ( UseHistory[i].Used == td.HitLine && age - UseHistory[i].When < CVar.GetCVar('zb_autouseinterval').GetFloat() ) + return false; + + else if ( age - UseHistory[i].When >= CVar.GetCVar('zb_autouseinterval').GetFloat() ) + UseHistory.Delete(i--); + } + + td.HitLine.Activate(possessed, 0, SPAC_Use); + + ZTLineUseHistoryEntry entry = new("ZTLineUseHistoryEntry"); + + entry.Used = td.HitLine; + entry.When = age; + + UseHistory.Push(entry); + + return true; + } + + ZTPathNode RandomGoalNode() + { if ( bReachedGoal ) return null; - + Array goals; let iter = ThinkerIterator.Create("ZTPathNode"); ZTPathNode cur; @@ -224,182 +246,185 @@ class ZTBotController : Actor return null; return goals[Random(0, goals.Size() - 1)]; - } - - override void BeginPlay() - { - super.BeginPlay(); - - if ( CVar.GetCVar('deathmatch').GetInt() == 1 ) - bFRIENDLY = false; - - debugCount = 0; - retargetCount = 8; - botID = NumBots.Get().value++; - age = 0; - lastShot = -9999; - numShoots = 0; - - loader = ZetaWeaponModule(Spawn("ZetaWeaponModule")); - - Array wmodules; - let tp = CVar.GetCVar("zb_wtypes").GetString(); - tp.Split(wmodules, ";"); - - for ( int i = 0; i < wmodules.Size(); i++ ) - { - ZetaWeaponModule zwm = ZetaWeaponModule(Spawn(wmodules[i])); - loader.LoadModule(zwm); - } - - navDest = null; - bstate = BS_WANDERING; - let ptype = ZetaBotPawn.GetSomeType(self); - - if ( ptype == "" ) - { + } + + override void BeginPlay() + { + super.BeginPlay(); + + GruntInterval = 0; + + if ( CVar.GetCVar('deathmatch').GetInt() == 1 ) + bFRIENDLY = false; + + debugCount = 0; + retargetCount = 8; + NumBots.Get().value++; + BotID = MaxID(); + age = 0; + lastShot = -9999; + numShoots = 0; + + loader = ZetaWeaponModule(Spawn("ZetaWeaponModule")); + + Array wmodules; + let tp = CVar.GetCVar("zb_wtypes").GetString(); + tp.Split(wmodules, ";"); + + for ( int i = 0; i < wmodules.Size(); i++ ) + { + ZetaWeaponModule zwm = ZetaWeaponModule(Spawn(wmodules[i])); + loader.LoadModule(zwm); + } + + navDest = null; + bstate = BS_WANDERING; + let ptype = ZetaBotPawn.GetSomeType(self); + + if ( ptype == "" ) + { DebugLog(LT_ERROR, "No plausible pawn type found!"); Destroy(); return; - } - + } + else SetPossessed(ZetaBotPawn(Spawn(ptype, pos))); - goingAfter = null; - currNode = null; - enemy = null; - commander = null; - strafeMomentum = 0; - angleMomentum = 0; - blocked = 0; - averageSpeed = 0; - speedRemaining = 87; - pastNode = null; - initialized = true; - myVoice = Random(1, 4); - logRate = 150; - - leftObs = ObstacleChecker.MakeFor(self, -45, 8 * Speed); + goingAfter = null; + currNode = null; + enemy = null; + commander = null; + strafeMomentum = 0; + angleMomentum = 0; + blocked = 0; + averageSpeed = 0; + speedRemaining = 87; + pastNode = null; + initialized = true; + myVoice = Random(1, 4); + logRate = 150; + + leftObs = ObstacleChecker.MakeFor(self, -45, 8 * Speed); frontObs = ObstacleChecker.MakeFor(self, -45, 8 * Speed); rightObs = ObstacleChecker.MakeFor(self, -45, 8 * Speed); - - Array botNames; - CVar.GetCVar('zb_bnames').GetString().Split(botNames, ':'); - - myName = botNames[Random(0, botNames.Size() - 1)]; - } - - void PlayPain() - { - BotChat("PAIN", 0.6); - } - - void aimToward(Actor other, double speed, double threshold = 15) - { - aimAtAngle(possessed.AngleTo(other), speed, threshold); - } - - void aimAtAngle(double angle, double speed, double threshold = 15) - { - possessed.angle += DeltaAngle(possessed.angle, angle) * speed; - - if ( absangle(angle, possessed.angle) <= threshold ) - possessed.angle = angle; - } - - void AimAwayFrom(Actor other, double speed, double threshold = 15) - { - AimAtAngle(-possessed.AngleTo(other), speed, threshold); - } - - void SetPossessed(ZetaBotPawn other) - { - if ( other != null ) - { - DebugLog(LT_INFO, myName.." has possessed a "..other.GetClassName().."!"); - - possessed = other; - possessed.cont = self; - - if ( CVar.GetCVar("deathmatch").GetInt() == 1 ) + + Array botNames; + CVar.GetCVar('zb_bnames').GetString().Split(botNames, ':'); + + myName = botNames[Random(0, botNames.Size() - 1)]; + } + + void PlayPain() + { + BotChat("HURT", 0.7); + } + + void aimToward(Actor other, double speed, double threshold = 15) + { + aimAtAngle(possessed.AngleTo(other), speed, threshold); + } + + void aimAtAngle(double angle, double speed, double threshold = 15) + { + possessed.angle += DeltaAngle(possessed.angle, angle) * speed; + + if ( absangle(angle, possessed.angle) <= threshold ) + possessed.angle = angle; + } + + void AimAwayFrom(Actor other, double speed, double threshold = 15) + { + AimAtAngle(-possessed.AngleTo(other), speed, threshold); + } + + void SetPossessed(ZetaBotPawn other) + { + if ( other != null ) + { + DebugLog(LT_INFO, myName.." has possessed a "..other.GetClassName().."!"); + + possessed = other; + possessed.cont = self; + + if ( CVar.GetCVar("deathmatch").GetInt() == 1 ) other.bFRIENDLY == false; - - averageSpeed = 0; - speedRemaining = 87; - angleMomentum = 0; - strafeMomentum = 0; - enemy = null; - commander = null; - goingAfter = null; - bstate = BS_WANDERING; - navDest = null; - blocked = 0; - lastPos = other.pos; - } - } - - void MoveToward(Actor other, double aimSpeed) - { - AimToward(other, aimSpeed); - MoveForward(); - - if ( possessed.AngleTo(other) > possessed.Angle - 20 ) - MoveRight(); - - else if ( possessed.Angle + 20 < possessed.AngleTo(other) ) - MoveLeft(); + + averageSpeed = 0; + speedRemaining = 87; + angleMomentum = 0; + strafeMomentum = 0; + enemy = null; + commander = null; + goingAfter = null; + bstate = BS_WANDERING; + navDest = null; + blocked = 0; + lastPos = other.pos; + } + } + + void MoveToward(Actor other, double aimSpeed) + { + AimToward(other, aimSpeed); + MoveForward(); + + if ( possessed.AngleTo(other) > possessed.Angle - 20 ) + MoveRight(); + + else if ( possessed.Angle + 20 < possessed.AngleTo(other) ) + MoveLeft(); else MoveForward(); - } - - void MoveTowardPos(Vector3 other, double aimSpeed) - { + } + + void MoveTowardPos(Vector3 other, double aimSpeed) + { double ang = atan2(possessed.pos.y - other.y, possessed.pos.x - other.x); - AimAtAngle(ang, aimSpeed); - MoveForward(); - - if ( ang > possessed.Angle - 20 ) - MoveRight(); - - else if ( possessed.Angle + 20 < ang ) - MoveLeft(); + AimAtAngle(ang, aimSpeed); + MoveForward(); + + if ( ang > possessed.Angle - 20 ) + MoveRight(); + + else if ( possessed.Angle + 20 < ang ) + MoveLeft(); else MoveForward(); - } - - void MoveRight() - { - possessed.MoveRight(); - } - - void MoveLeft() - { - possessed.MoveLeft(); - } - - void MoveAwayFrom(Actor other) - { - possessed.MoveForward(); - AimAwayFrom(other, 0.07); - } - - void StepBackFrom(Actor other) - { - possessed.MoveBackward(); - AimToward(other, 0.085); - } - - void StepBack() - { - possessed.StepBackward(); - } - - void CheckObstructions() - { + } + + void MoveRight() + { + possessed.MoveRight(); + } + + void MoveLeft() + { + possessed.MoveLeft(); + } + + void MoveAwayFrom(Actor other) + { + possessed.MoveForward(); + AimAwayFrom(other, 0.07); + } + + void StepBackFrom(Actor other) + { + possessed.MoveBackward(); + AimToward(other, 0.085); + } + + void StepBack() + { + possessed.StepBackward(); + } + + void CheckObstructions() + { if ( leftObs.st == frontObs.st && frontObs.st == rightObs.st && leftObs.st != ObstacleCheckWaiter.CS_PENDING ) { if ( frontObs != null && frontObs.st == ObstacleCheckWaiter.CS_WALL ) @@ -418,173 +443,181 @@ class ZTBotController : Actor frontObs = ObstacleChecker.MakeFor(self, 0, 5 * Speed); rightObs = ObstacleChecker.MakeFor(self, 45, 5 * Speed); } - } - - ActorList VisibleEnemies(Actor from) - { - ActorList res = new("ActorList"); - ThinkerIterator iter = ThinkerIterator.Create("Actor"); - Actor cur = null; - - while ( cur = Actor(iter.Next()) ) - { - Vector2 off = possessed.Vec2To(cur); - - double pdot = 1; - - if ( possessed.Distance2D(cur) > 0 ) - { - off.x /= possessed.Distance2D(cur); - off.y /= possessed.Distance2D(cur); // slightly inneficient but works - - Vector2 avec = AngleToVector(possessed.angle); - - double pdot = off.x * avec.x + off.y * avec.y; - } - - if ( cur != null && cur != from && ( cur.bISMONSTER || cur.CheckClass("PlayerPawn", AAPTR_DEFAULT, true) ) && LineOfSight(cur, from) && isEnemy(from, cur) && cur.Health > 0 && pdot > 0.3 ) - res.Push(cur); - } - - return res; - } - - ActorList VisibleFriends(Actor from) - { - ActorList res = new("ActorList"); - ThinkerIterator iter = ThinkerIterator.Create("Actor"); - Actor cur = null; - - while ( cur = Actor(iter.Next()) ) - { - Vector2 off = possessed.Vec2To(cur); - - double pdot = 1; - - if ( possessed.Distance2D(cur) > 0 ) - { - off.x /= possessed.Distance2D(cur); - off.y /= possessed.Distance2D(cur); - - Vector2 avec = AngleToVector(possessed.angle); - - double pdot = off.x * avec.x + off.y * avec.y; - } - - if ( cur != null && cur != from && cur.Health > 0 && from.CheckSight(cur) && ( ( cur.bISMONSTER && !isEnemy(from, cur) ) || ( cur.CheckClass("PlayerPawn", AAPTR_DEFAULT, true) == from.bFRIENDLY ) ) && pdot > 0.3 ) - res.Push(cur); - } - - return res; - } - - uint debugCount; - - bool MoveTowardDest() - { - Actor dest = navDest; - - if ( !dest ) - dest = goingAfter; - - if ( !dest ) - dest = enemy; - - if ( !dest ) - return false; - - // MakeDestBall(dest); - MoveToward(dest, 0.2); - return true; - } - - void MakeDestBall(Actor Other) - { - if ( CVar.FindCVar("zb_debug").GetInt() > 0 && debugCount < 1 ) - { - debugCount = 20; - DestBall db = DestBall(possessed.SpawnMissile(Other, "DestBall")); - - if ( db != null ) - db.targetNode = Other; - } - } - - void SmartMove() - { - if ( possessed != null ) - { - if ( currNode != null && currNode.nodeType == ZTPathNode.NT_USE ) + } + + ActorList VisibleEnemies(Actor from) + { + ActorList res = new("ActorList"); + ThinkerIterator iter = ThinkerIterator.Create("Actor"); + Actor cur = null; + + while ( cur = Actor(iter.Next()) ) + { + Vector2 off = possessed.Vec2To(cur); + + double pdot = 1; + + if ( possessed.Distance2D(cur) > 0 ) + { + off.x /= possessed.Distance2D(cur); + off.y /= possessed.Distance2D(cur); // slightly inneficient but works + + Vector2 avec = AngleToVector(possessed.angle); + + double pdot = off.x * avec.x + off.y * avec.y; + } + + if ( cur != null && cur != from && ( cur.bISMONSTER || cur.CheckClass("PlayerPawn", AAPTR_DEFAULT, true) ) && LineOfSight(cur, from) && isEnemy(from, cur) && cur.Health > 0 && pdot > 0.3 ) + res.Push(cur); + } + + return res; + } + + ActorList VisibleFriends(Actor from) + { + ActorList res = new("ActorList"); + ThinkerIterator iter = ThinkerIterator.Create("Actor"); + Actor cur = null; + + while ( cur = Actor(iter.Next()) ) + { + Vector2 off = possessed.Vec2To(cur); + + double pdot = 1; + + if ( possessed.Distance2D(cur) > 0 ) + { + off.x /= possessed.Distance2D(cur); + off.y /= possessed.Distance2D(cur); + + Vector2 avec = AngleToVector(possessed.angle); + + double pdot = off.x * avec.x + off.y * avec.y; + } + + if ( cur != null && cur != from && cur.Health > 0 && from.CheckSight(cur) && ( ( cur.bISMONSTER && !isEnemy(from, cur) ) || ( cur.CheckClass("PlayerPawn", AAPTR_DEFAULT, true) == from.bFRIENDLY ) ) && pdot > 0.3 ) + res.Push(cur); + } + + return res; + } + + uint debugCount; + + bool MoveTowardDest() + { + Actor dest = navDest; + + if ( !dest ) + dest = goingAfter; + + if ( !dest ) + dest = enemy; + + if ( !dest ) + return false; + + // MakeDestBall(dest); + MoveToward(dest, 0.2); + return true; + } + + void MakeDestBall(Actor Other) + { + if ( CVar.FindCVar("zb_debug").GetInt() > 0 && debugCount < 1 ) + { + debugCount = 20; + DestBall db = DestBall(possessed.SpawnMissile(Other, "DestBall")); + + if ( db != null ) + db.targetNode = Other; + } + } + + void SmartMove() + { + if ( possessed != null ) + { + if ( currNode != null && currNode.nodeType == ZTPathNode.NT_USE ) DodgeAndUse(); - if ( navDest != null ) - { - if ( currNode != null ) - { - if ( navDest.nodeType == ZTPathNode.NT_JUMP ) - { - aimToward(navDest, 0.1, 0.1); - - if ( possessed.pos.z - possessed.floorz < 1 ) - possessed.Jump(); - } - - else if ( navDest.nodeType == navDest.NT_CROUCH ) - possessed.moveType = ZetaBotPawn.MM_Crouch; - - else if ( navDest.nodeType == navDest.NT_SLOW ) - possessed.moveType = ZetaBotPawn.MM_None; - - else - possessed.moveType = ZetaBotPawn.MM_Run; - - if ( navDest.pos.z - possessed.pos.z > 28 && possessed.pos.z - possessed.floorz < 1 ) - possessed.Jump(); - - if ( currNode.nodeType == ZTPathNode.NT_USE ) + if ( navDest != null ) + { + if ( currNode != null ) + { + if ( navDest.nodeType == ZTPathNode.NT_JUMP ) + { + aimToward(navDest, 0.1, 0.1); + + if ( possessed.pos.z - possessed.floorz < 1 ) + possessed.Jump(); + } + + else if ( navDest.nodeType == navDest.NT_CROUCH ) + possessed.moveType = ZetaBotPawn.MM_Crouch; + + else if ( navDest.nodeType == navDest.NT_SLOW ) + possessed.moveType = ZetaBotPawn.MM_None; + + else + possessed.moveType = ZetaBotPawn.MM_Run; + + if ( navDest.pos.z - possessed.pos.z > 28 && possessed.pos.z - possessed.floorz < 1 ) + possessed.Jump(); + + if ( currNode.nodeType == ZTPathNode.NT_USE ) DodgeAndUse(); + + else if ( currNode.nodeType == ZTPathNode.NT_SHOOT ) { + if ( FRandom(0, 1) < 0.7 && FireBestWeapon() ) + possessed.BeginShoot(); + + else + possessed.EndShoot(); + } - MoveTowardDest(); - } - - else - MoveTowardDest(); - } - - else - angleMomentum += FRandom(-0.01, 0.01); - - if ( FRandom(0, 99.9) < 10 ) - RandomStrafe(); - - else - MoveForward(); - } - } - - void MoveForward() - { - possessed.MoveForward(); - } - - static const string BStateNames[] = { - "wandering", - "hunting", - "attacking", - "following", - "fleeing" - }; - - void SetBotState(uint s) - { - if ( s != bstate ) + MoveTowardDest(); + } + + else + MoveTowardDest(); + } + + else + angleMomentum += FRandom(-0.01, 0.01); + + if ( FRandom(0, 99.9) < 10 ) + RandomStrafe(); + + else + MoveForward(); + } + } + + void MoveForward() + { + possessed.MoveForward(); + } + + static const string BStateNames[] = { + "wandering", + "hunting", + "attacking", + "following", + "fleeing" + }; + + void SetBotState(uint s) + { + if ( s != bstate ) DebugLog(LT_INFO, myName.." is now \ck"..BStateNames[s].."!"); - bstate = s; - } - - void SetCurrentNode(ZTPathNode pn) - { + bstate = s; + } + + void SetCurrentNode(ZTPathNode pn) + { if ( pn != null ) { bool use = pn.nodeType == ZTPathNode.NT_USE; @@ -593,26 +626,26 @@ class ZTBotController : Actor DebugLog(LT_VERBOSE, myName.." is now at the node: \ck"..pn.serialize()..(use ? " | It's an USE node!" : "")); } - currNode = pn; - } - - bool isEnemy(Actor from, Actor other) - { - return from.bFRIENDLY != other.bFRIENDLY || ( !from.bFRIENDLY && other.CheckClass("PlayerPawn", AAPTR_DEFAULT, true) ) || CVar.GetCVar("deathmatch").GetInt() == 1; - } - - ZTPathNode ClosestNode(Actor other) - { - ThinkerIterator iter = ThinkerIterator.Create("ZTPathNode"); - ZTPathNode best = null; - ZTPathNode cur = null; - - while ( cur = ZTPathNode(iter.Next()) ) - if ( best == null || other.Distance3D(cur) < other.Distance3D(best) ) - best = cur; - - return best; - } + currNode = pn; + } + + bool isEnemy(Actor from, Actor other) + { + return from.bFRIENDLY != other.bFRIENDLY || ( !from.bFRIENDLY && other.CheckClass("PlayerPawn", AAPTR_DEFAULT, true) ) || CVar.GetCVar("deathmatch").GetInt() == 1; + } + + ZTPathNode ClosestNode(Actor other) + { + ThinkerIterator iter = ThinkerIterator.Create("ZTPathNode"); + ZTPathNode best = null; + ZTPathNode cur = null; + + while ( cur = ZTPathNode(iter.Next()) ) + if ( best == null || other.Distance3D(cur) < other.Distance3D(best) ) + best = cur; + + return best; + } bool LineOfSight(Actor other, Actor from = null) { @@ -623,56 +656,56 @@ class ZTBotController : Actor // That didn't work, though :( return from.CheckSight(other); } - - ZTPathNode ClosestVisibleNode(Actor other) - { - ThinkerIterator iter = ThinkerIterator.Create("ZTPathNode"); - ZTPathNode best = null; - ZTPathNode cur = null; - - while ( cur = ZTPathNode(iter.Next()) ) - if ( ( best == null || other.Distance3D(cur) < other.Distance3D(best) ) && LineOfSight(cur) ) - best = cur; - - return best; - } - - void RandomStrafe() - { - strafeMomentum += FRandom(-0.1, 0.1); - - if ( strafeMomentum < -1 ) - strafeMomentum = -1; - - if ( strafeMomentum > 1 ) - strafeMomentum = 1; - - if ( strafeMomentum > 0 ) - possessed.MoveRight(); - - else - possessed.MoveLeft(); - } - - BotState assessBotAttitude(Actor other) // mimicks UT99's TournamentGameInfo(?).AssessBotAttitude(Pawn Other) - { - if ( isEnemy(possessed, other) ) - return BS_ATTACKING; - - else - return BS_WANDERING; - } - - ZetaWeapon, bool, double BestWeaponAllTic() - { - double bestRate = 0; - bool bAltFire = false; - ZetaWeapon zweap = null; - ZetaWeapon bestWeap = null; - Weapon weap = null; - let iter = ThinkerIterator.create("Weapon"); - - while ( weap = Weapon(iter.Next()) ) + + ZTPathNode ClosestVisibleNode(Actor other) + { + ThinkerIterator iter = ThinkerIterator.Create("ZTPathNode"); + ZTPathNode best = null; + ZTPathNode cur = null; + + while ( cur = ZTPathNode(iter.Next()) ) + if ( ( best == null || other.Distance3D(cur) < other.Distance3D(best) ) && LineOfSight(cur) ) + best = cur; + + return best; + } + + void RandomStrafe() + { + strafeMomentum += FRandom(-0.1, 0.1); + + if ( strafeMomentum < -1 ) + strafeMomentum = -1; + + if ( strafeMomentum > 1 ) + strafeMomentum = 1; + + if ( strafeMomentum > 0 ) + possessed.MoveRight(); + + else + possessed.MoveLeft(); + } + + BotState assessBotAttitude(Actor other) // mimicks UT99's TournamentGameInfo(?).AssessBotAttitude(Pawn Other) + { + if ( isEnemy(possessed, other) ) + return BS_ATTACKING; + + else + return BS_WANDERING; + } + + ZetaWeapon, bool, double BestWeaponAllTic() + { + double bestRate = 0; + bool bAltFire = false; + ZetaWeapon zweap = null; + ZetaWeapon bestWeap = null; + Weapon weap = null; + let iter = ThinkerIterator.create("Weapon"); + + while ( weap = Weapon(iter.Next()) ) if ( weap.Owner == possessed ) { ZetaWeapon zweap = loader.CheckType(weap); @@ -680,8 +713,8 @@ class ZTBotController : Actor if ( zweap != null ) { - let assessed1 = zweap.RateSelf(self, enemy); - let assessed2 = zweap.AltRateSelf(self, enemy); + let assessed1 = zweap.GetRating(self, enemy); + let assessed2 = zweap.GetAltRating(self, enemy); let alt = zweap.CanAltFire(possessed) && ( assessed2 > assessed1 || !zweap.CanFire(possessed) ); if ( !(alt || zweap.CanFire(possessed)) ) @@ -702,203 +735,205 @@ class ZTBotController : Actor } } } - - return bestWeap, bAltFire, bestRate; - } + + return bestWeap, bAltFire, bestRate; + } - bool FireBestWeapon() - { + bool FireBestWeapon() + { // if ( absangle(possessed.angle, possessed.AngleTo(enemy)) > 80 ) // return false; - // if ( lastWeap != null && BestWeaponAllTic() == lastWeap ) - /* - { - if ( lastWeap.CanAltFire(possessed) && lastWeap.AltRateSelf(self, enemy) > lastWeap.RateSelf(self, enemy) ) - { - if ( age - lastShot > 0 ) - { - DebugLog(LT_VERBOSE, myName.." fired a "..lastWeap.GetClassName().."!"); - lastWeap.AltFire(possessed, enemy); - lastShot = age + lastWeap.IntervalSeconds(); - DebugLog(LT_VERBOSE, myName.." can shoot again after "..lastWeap.IntervalSeconds().." seconds, or alt-fire after "..lastWeap.AltIntervalSeconds().." seconds!"); - - return true; - } - - return false; - } - - if ( lastWeap.CanFire(possessed) ) - { - if ( age - lastShot > 0 ) - { - DebugLog(LT_VERBOSE, myName.." alt-fired a "..lastWeap.GetClassName().."!"); - lastWeap.Fire(possessed, enemy); - lastShot = age + lastWeap.IntervalSeconds(); - DebugLog(LT_VERBOSE, myName.." can shoot again after "..lastWeap.IntervalSeconds().." seconds, or alt-fire after "..lastWeap.AltIntervalSeconds().." seconds!"); - - return true; - } - - return false; - } - } - */ + // if ( lastWeap != null && BestWeaponAllTic() == lastWeap ) + /* + { + if ( lastWeap.CanAltFire(possessed) && lastWeap.GetAltRating(self, enemy) > lastWeap.GetRating(self, enemy) ) + { + if ( age - lastShot > 0 ) + { + DebugLog(LT_VERBOSE, myName.." fired a "..lastWeap.GetClassName().."!"); + lastWeap.AltFire(possessed, enemy); + lastShot = age + lastWeap.IntervalSeconds(); + DebugLog(LT_VERBOSE, myName.." can shoot again after "..lastWeap.IntervalSeconds().." seconds, or alt-fire after "..lastWeap.AltIntervalSeconds().." seconds!"); + + return true; + } + + return false; + } + + if ( lastWeap.CanFire(possessed) ) + { + if ( age - lastShot > 0 ) + { + DebugLog(LT_VERBOSE, myName.." alt-fired a "..lastWeap.GetClassName().."!"); + lastWeap.Fire(possessed, enemy); + lastShot = age + lastWeap.IntervalSeconds(); + DebugLog(LT_VERBOSE, myName.." can shoot again after "..lastWeap.IntervalSeconds().." seconds, or alt-fire after "..lastWeap.AltIntervalSeconds().." seconds!"); + + return true; + } + + return false; + } + } + */ + + if ( age < lastShot ) + return false; + + ZetaWeapon bestWeap; + bool bAltFire; + + [ bestWeap, bAltFire ] = BestWeaponAllTic(); + + if ( bestWeap == null ) + return false; + + if ( bAltFire && bestWeap.CanAltFire(possessed, true) ) + { + lastShot = age + bestWeap.AltIntervalSeconds(); + bestWeap.AltFire(possessed, enemy); + } + + else if ( bestWeap.CanFire(possessed, true) ) + { + lastShot = age + bestWeap.IntervalSeconds(); + bestWeap.Fire(possessed, enemy); + } + + else + return false; + + DebugLog(LT_VERBOSE, myName.." "..(bAltFire ? "alt-" : "").."fired a "..bestWeap.GetClassName().."!"); + DebugLog(LT_VERBOSE, myName.." can only shoot again in "..lastShot - age.." seconds!"); + + numShoots++; + lastWeap = bestWeap; + + return true; + } + + /* -- unused + virtual WeaponRating rateWeapon(Weapon weap) + { + WeaponRating res = new("WeaponRating"); + + if ( target == null ) + { + res.rating = 0; + res.bAlt = false; + return res; + } + + double rprimary = 0; + double raltern = 0; + double rboth = 0; + + if ( possessed.Distance3D(enemy) < target.radius + radius + 256 ) + rboth += weap.Kickback * 4; + + if ( weap.ProjectileType != null ) + { + let proj = Spawn(weap.ProjectileType); + rprimary += proj.speed * possessed.Distance3D(enemy) + proj.damage; + proj.Destroy(); + } + + else + { + double rangeRate = 1024; + rangeRate -= possessed.Distance3D(enemy) / 2; + + if ( rangeRate > 0 ) + rprimary += rangeRate; + } + + if ( weap.AltProjectileType != null ) + { + let proj = Spawn(weap.AltProjectileType); + raltern += proj.speed * possessed.Distance3D(enemy) + proj.damage; + proj.Destroy(); + } + + else + { + double rangeRate = 1024; + rangeRate -= possessed.Distance3D(enemy) / 2; + + if ( rangeRate > 0 ) + raltern += rangeRate; + } + + Inventory ammo1 = FindInventory(weap.AmmoType1); + Inventory ammo2 = FindInventory(weap.AmmoType2); + + if ( ammo1 != null ) + rboth += ammo1.Amount * 2; + + if ( ammo2 != null ) + rboth += ammo2.Amount * 2; + + if ( raltern > rprimary ) + { + res.rating = raltern + rboth; + res.bAlt = true; + } + + else + { + res.rating = rprimary + rboth; + res.bAlt = false; + } + + return res; + } + */ + + void BotChat(String kind, double importance) + { + if ( importance < FRandom(0, 2.25) ) + return; + + A_PlaySound("zetabot/"..myVoice.."/"..kind, CHAN_VOICE, attenuation: 0.7); + A_PlaySound("misc/chat", CHAN_UI, 1.0, false, ATTN_NONE); + + DebugLog(LT_VERBOSE, myName.." called a "..kind.." voice"); + } + + double targetPriority(Actor other) + { + // The smalest the number, the highest the priority :) + double res = possessed.Distance3D(other) / other.Health; + + if ( other.CheckClass('PlayerPawn') ) + res /= 1.5; + + return res; + } - if ( age < lastShot ) - return false; - - ZetaWeapon bestWeap; - bool bAltFire; - - [ bestWeap, bAltFire ] = BestWeaponAllTic(); - - if ( bestWeap == null ) - return false; - - if ( bAltFire && bestWeap.CanAltFire(possessed, true) ) - { - lastShot = age + bestWeap.AltIntervalSeconds(); - bestWeap.AltFire(possessed, enemy); - } - - else if ( bestWeap.CanFire(possessed, true) ) - { - lastShot = age + bestWeap.IntervalSeconds(); - bestWeap.Fire(possessed, enemy); - } + void LogStats() + { + if ( possessed == null ) + return; - else - return false; - - DebugLog(LT_VERBOSE, myName.." "..(bAltFire ? "alt-" : "").."fired a "..bestWeap.GetClassName().."!"); - DebugLog(LT_VERBOSE, myName.." can only shoot again in "..lastShot - age.." seconds!"); + String enemyType = "NONE"; + String goingAfterType = "NONE"; + String currNodeS = "NONE"; + String navDestS = "NONE"; + + if ( enemy != null ) + enemyType = enemy.GetClassName(); - numShoots++; - lastWeap = bestWeap; - - return true; - } - - /* -- unused - virtual WeaponRating rateWeapon(Weapon weap) - { - WeaponRating res = new("WeaponRating"); - - if ( target == null ) - { - res.rating = 0; - res.bAlt = false; - return res; - } - - double rprimary = 0; - double raltern = 0; - double rboth = 0; - - if ( possessed.Distance3D(enemy) < target.radius + radius + 256 ) - rboth += weap.Kickback * 4; - - if ( weap.ProjectileType != null ) - { - let proj = Spawn(weap.ProjectileType); - rprimary += proj.speed * possessed.Distance3D(enemy) + proj.damage; - proj.Destroy(); - } - - else - { - double rangeRate = 1024; - rangeRate -= possessed.Distance3D(enemy) / 2; - - if ( rangeRate > 0 ) - rprimary += rangeRate; - } - - if ( weap.AltProjectileType != null ) - { - let proj = Spawn(weap.AltProjectileType); - raltern += proj.speed * possessed.Distance3D(enemy) + proj.damage; - proj.Destroy(); - } - - else - { - double rangeRate = 1024; - rangeRate -= possessed.Distance3D(enemy) / 2; - - if ( rangeRate > 0 ) - raltern += rangeRate; - } - - Inventory ammo1 = FindInventory(weap.AmmoType1); - Inventory ammo2 = FindInventory(weap.AmmoType2); - - if ( ammo1 != null ) - rboth += ammo1.Amount * 2; - - if ( ammo2 != null ) - rboth += ammo2.Amount * 2; - - if ( raltern > rprimary ) - { - res.rating = raltern + rboth; - res.bAlt = true; - } - - else - { - res.rating = rprimary + rboth; - res.bAlt = false; - } - - return res; - } - */ - - void BotChat(String kind, double importance) - { - if ( importance < FRandom(0, 2.25) ) - return; - - A_PlaySound("zetabot/"..myVoice.."/"..kind, CHAN_VOICE, attenuation: 0.7); - A_PlaySound("misc/chat", CHAN_UI, 1.0, false, ATTN_NONE); - } - - double targetPriority(Actor other) - { - // The smalest the number, the highest the priority :) - double res = possessed.Distance3D(other) / other.Health; - - if ( other.CheckClass('PlayerPawn') ) - res /= 1.5; - - return res; - } - - void LogStats() - { - if ( possessed == null ) - return; - - String enemyType = "NONE"; - String goingAfterType = "NONE"; - String currNodeS = "NONE"; - String navDestS = "NONE"; - - if ( enemy != null ) - enemyType = enemy.GetClassName(); - - if ( goingAfter != null ) - goingAfterType = goingAfter.GetClassName(); - - if ( currNode != null ) - currNodeS = currNode.serialize(); - - if ( navDest != null ) - navDestS = navDest.serialize(); - + if ( goingAfter != null ) + goingAfterType = goingAfter.GetClassName(); + + if ( currNode != null ) + currNodeS = currNode.serialize(); + + if ( navDest != null ) + navDestS = navDest.serialize(); + string lastWeapS = "none."; bool useNode = ( currNode != null && currNode.nodeType == ZTPathNode.NT_USE ); @@ -918,25 +953,25 @@ class ZTBotController : Actor [ wp, _, rt ] = BestWeaponAllTic(); DebugLog(LT_VERBOSE, "["..myName.."'s STATS] Health: "..possessed.health.." | Current State: "..BStateNames[bstate].." | Enemy Type: "..enemyType..enemyH.." | Going After Type: "..goingAfterType.." | Current Pathnode: "..currNodeS..(useNode ? " (use)" : "").." | Destination Pathnode: "..navDestS.." | Age: "..age.."s | Best Weapon: "..wp.GetClassName().." ("..rt.." dopamine molecules"..(_ ? ", alt" : "")..") | Last Weapon: "..lastWeapS); } - } - - // bot death listener - void OnDeath() - { - A_PrintBold("\cg"..myName.." has just died!"); - - let friends = VisibleFriends(possessed); - Object a = null; - ZetaBotPawn zb = null; - - /* - while ( a = friends.iNext() ) + } + + // bot death listener + void OnDeath() + { + A_PrintBold("\cg"..myName.." has just died!"); + + let friends = VisibleFriends(possessed); + Object a = null; + ZetaBotPawn zb = null; + + /* + while ( a = friends.iNext() ) if ( (zb = ZetaBotPawn(a)) && possessed.Distance3D(zb) < 2048 / friends.Length() && zb.cont.bState == BS_ATTACKING && zb.cont != null ) zb.cont.SetBotState(BS_FLEEING); - */ + */ NumBots.Get().value--; - } + } bool DodgeAndUse() @@ -951,41 +986,56 @@ class ZTBotController : Actor { FLineTraceData useData; MoveTowardPos(currNode.pos + currNode.Vec3Angle(64 + possessed.radius, currNode.useDirection, 0, false), 0.45); - AimAtAngle(currNode.useDirection, 35); + AimAtAngle(currNode.useDirection, 35); possessed.LineTrace( - possessed.angle, - possessed.radius + 64, - 0, // possessed.pitch, - flags: TRF_THRUBLOCK | TRF_THRUHITSCAN | TRF_THRUACTORS, - offsetz: possessed.height - 24, // offsetz: possessed.height - 12, - data: useData - ); + possessed.angle, + possessed.radius + 64, + 0, // possessed.pitch, + flags: TRF_THRUBLOCK | TRF_THRUHITSCAN | TRF_THRUACTORS, + offsetz: possessed.height - 24, // offsetz: possessed.height - 12, + data: useData + ); if ( useData.HitType == TRACE_HitWall && useData.HitLine.Special > 0 ) - { - Line l = useData.HitLine; - DebugLog(LT_VERBOSE, "["..myName.." USE NODE LOGS] Activating wall! Line special: "..l.Special); - - Level.ExecuteSpecial( - l.Special, - possessed, - l, 0, - - l.Args[0], - l.Args[1], - l.Args[2], - l.Args[3], - l.Args[4] - ); + { + Line l = useData.HitLine; + DebugLog(LT_VERBOSE, "["..myName.." USE NODE LOGS] Activating wall! Line special: "..l.Special); + + Level.ExecuteSpecial( + l.Special, + possessed, + l, 0, + + l.Args[0], + l.Args[1], + l.Args[2], + l.Args[3], + l.Args[4] + ); useData.HitLine.Activate(possessed, 0, SPAC_Use); - } + } + + else if ( useData.hitType == TRACE_HitWall /* td.HitLine.Special == 0 */ ) { + if ( GruntInterval == 0 || GruntInterval-- == 0 ) { + A_PlaySound("ztmisc/grunt", CHAN_VOICE, attenuation: 1.1); + GruntInterval = 20; + Log(GruntInterval); + } + + return false; + } } - else if ( currNode.nodeType == ZTPathNode.NT_JUMP && FRandom(0, 1) < 0.4 ) - possessed.Jump(); + else if ( currNode.nodeType == ZTPathNode.NT_JUMP && FRandom(0, 1) < 0.8 ) { + possessed.Jump(); + AimAtAngle(currNode.Angle, 70, 20); + } + if ( FRandom(0, 1) < 0.03 ) + possessed.Jump(); + possessed.LineTrace(possessed.angle - 45, 200, possessed.pitch, data: leftfront); possessed.LineTrace(possessed.angle + 45, 200, possessed.pitch, data: rightfront); @@ -1008,94 +1058,94 @@ class ZTBotController : Actor return currNode.nodeType == ZTPathNode.NT_USE; } - - void A_BotTick() - { + + void A_BotTick() + { if ( possessed == null ) { Destroy(); return; } - if ( currNode != null && currNode.nodeType == ZTPathNode.NT_AVOID ) - MoveAwayFrom(currNode); + if ( currNode != null && currNode.nodeType == ZTPathNode.NT_AVOID ) + MoveAwayFrom(currNode); - possessed.angle += angleMomentum; - angleMomentum *= 0.92; - - if ( possessed.health <= 0 ) - return; - - age += 1. / 35; + possessed.angle += angleMomentum; + angleMomentum *= 0.92; + + if ( possessed.health <= 0 ) + return; + + age += 1. / 35; debugCount -= 1; - - if ( age - lastShot > 0.7 && possessed.bShooting ) - possessed.EndShoot(); - - SetCurrentNode(ClosestVisibleNode(possessed)); - - if ( enemy != null && enemy.Health <= 0 ) - { - enemy = null; - - if ( bstate == BS_ATTACKING ) - { - bstate = BS_WANDERING; - - enemy = null; - goingAfter = null; - - possessed.EndShoot(); - SetBotState(BS_WANDERING); - } - } - - if ( --logRate <= 0 ) - { - logRate = 50; - LogStats(); - } - - if ( possessed.blockingMobj != null || possessed.blockingLine != null ) - blocked += sqrt(possessed.vel.x * possessed.vel.x + possessed.vel.y * possessed.vel.y) / 2; - - if ( blocked > 0 ) - { - blocked--; - RandomStrafe(); - possessed.angle += 3; - - return; - } - - let pickupIter = ThinkerIterator.Create("Weapon"); - Weapon inv; - - while ( (inv = Weapon(pickupIter.Next())) != null ) - if ( inv.owner == null && possessed.Distance2D(inv) < possessed.Radius + inv.Radius && abs(possessed.pos.z - inv.pos.z) < possessed.Height + inv.Height ) - { - ZetaWeapon zw = loader.CheckType(inv); - - if ( zw != null ) - inv.CallTryPickup(possessed); // weapon items are checked by fireBestWeap - - else - if ( inv.CheckClass("HealthPickup") || inv.CheckClass("Ammo") ) - inv.CallTryPickup(possessed); - } - - if ( currNode != null && currNode.nodeType == ZTPathNode.NT_USE ) - DodgeAndUse(); - - else if ( CVar.FindCVar('zb_autouse').GetBool() ) - AutoUseAtAngle(0); - - if ( bstate != BS_ATTACKING ) - { + + if ( age - lastShot > 0.7 && possessed.bShooting ) + possessed.EndShoot(); + + SetCurrentNode(ClosestVisibleNode(possessed)); + + if ( enemy != null && enemy.Health <= 0 ) + { + enemy = null; + + if ( bstate == BS_ATTACKING ) + { + bstate = BS_WANDERING; + + enemy = null; + goingAfter = null; + + possessed.EndShoot(); + SetBotState(BS_WANDERING); + } + } + + if ( --logRate <= 0 ) + { + logRate = 50; + LogStats(); + } + + if ( possessed.blockingMobj != null || possessed.blockingLine != null ) + blocked += sqrt(possessed.vel.x * possessed.vel.x + possessed.vel.y * possessed.vel.y) / 2; + + if ( blocked > 0 ) + { + blocked--; + RandomStrafe(); + possessed.angle += 3; + + return; + } + + let pickupIter = ThinkerIterator.Create("Weapon"); + Weapon inv; + + while ( (inv = Weapon(pickupIter.Next())) != null ) + if ( inv.owner == null && possessed.Distance2D(inv) < possessed.Radius + inv.Radius && abs(possessed.pos.z - inv.pos.z) < possessed.Height + inv.Height ) + { + ZetaWeapon zw = loader.CheckType(inv); + + if ( zw != null ) + inv.CallTryPickup(possessed); // weapon items are checked by fireBestWeap + + else + if ( inv.CheckClass("HealthPickup") || inv.CheckClass("Ammo") ) + inv.CallTryPickup(possessed); + } + + if ( currNode != null && currNode.nodeType == ZTPathNode.NT_USE ) + DodgeAndUse(); + + else if ( CVar.FindCVar('zb_autouse').GetBool() ) + AutoUseAtAngle(0); + + if ( bstate != BS_ATTACKING ) + { if ( bstate != BS_HUNTING && bstate != BS_FLEEING && bstate != BS_ATTACKING ) { ActorList mon = VisibleEnemies(possessed); - + if ( mon.length() > 0 ) { PriorityQueue targets = new("PriorityQueue"); @@ -1107,7 +1157,7 @@ class ZTBotController : Actor if ( enemy == null ) enemy = Actor(targets.poll()); - /* + /* else { if ( retargetCount < 1 ) @@ -1119,11 +1169,11 @@ class ZTBotController : Actor else retargetCount--; } - */ + */ DebugLog(LT_INFO, "Attacking a "..enemy.GetClassName()); - BotChat("TARG", 0.5); + BotChat("TARG", 0.8); if ( !LineOfSight(enemy) && possessed.Distance2D(enemy) > 768 ) { @@ -1139,21 +1189,24 @@ class ZTBotController : Actor } } - if ( navDest != null ) - { - if ( possessed.Distance3D(navDest) > 64 ) - SmartMove(); - - else if ( bstate == BS_WANDERING ) - navDest = navDest.randomNeighbor(); - - else - navDest = null; - } - - else - { - if ( currNode != null ) navDest = currNode.RandomNeighbor(); + if ( navDest != null ) + { + if ( bstate == BS_WANDERING || bstate == BS_FOLLOWING ) + BotChat("IDLE", 2.25 / 90); + + if ( possessed.Distance3D(navDest) > 64 ) + SmartMove(); + + else if ( bstate == BS_WANDERING ) + navDest = navDest.randomNeighbor(); + + else + navDest = null; + } + + else + { + if ( currNode != null ) navDest = currNode.RandomNeighbor(); if ( bstate == BS_HUNTING ) { @@ -1176,19 +1229,21 @@ class ZTBotController : Actor MoveTowardPos(lastEnemyPos, 0.27); } - else if ( bstate == BS_FOLLOWING ) - { + else if ( bstate == BS_FOLLOWING ) + { + BotChat("IDLE", 2.25 / 90); + if ( DodgeAndUse() ) SetBotState(BS_WANDERING); - if ( goingAfter != null ) - { - if ( possessed.Distance3D(goingAfter) < 1024 && possessed.CheckSight(goingAfter) ) - SetBotState(AssessBotAttitude(goingAfter)); - - else if ( currNode != null && ( navDest == null || Distance3D(navDest) < 512 || navDest == currNode ) ) - { - if ( ClosestNode(goingAfter) == currNode ) + if ( goingAfter != null ) + { + if ( possessed.Distance3D(goingAfter) < 1024 && possessed.CheckSight(goingAfter) ) + SetBotState(AssessBotAttitude(goingAfter)); + + else if ( currNode != null && ( navDest == null || Distance3D(navDest) < 512 || navDest == currNode ) ) + { + if ( ClosestNode(goingAfter) == currNode ) { if ( possessed.Distance3D(goingAfter) < 256 ) SetBotState(BS_ATTACKING); @@ -1196,71 +1251,72 @@ class ZTBotController : Actor else if ( possessed.Distance3D(goingAfter) > 5192 && !possessed.CheckSight(goingAfter) ) SetBotState(BS_WANDERING); } - - else if ( pathCountdown <= 0 ) - { - ActorList path = navDest.findPathTo(ClosestNode(goingAfter), possessed); - - if ( path != null && path.Length() > 1 ) - { - navDest = ZTPathNode(path.get(1)); - - DebugLog(LT_INFO, "Next navigation point found at: "..navDest.pos); - MoveToward(navDest, 0.27); - } - - else if ( possessed.Distance3D(goingAfter) < 256 && possessed.CheckSight(goingAfter) ) - SetBotState(BS_WANDERING); - - else - MoveToward(goingAfter, 0.27); - - pathCountdown += 15; - } - - else - pathCountdown--; - } - - else if ( navDest != null ) - SmartMove(); - - else if ( possessed.Distance3D(goingAfter) < 256 ) - SetBotState(BS_ATTACKING); - - else if ( possessed.Distance3D(goingAfter) > 1500 && !possessed.CheckSight(goingAfter) ) - SetBotState(BS_WANDERING); - - else - MoveToward(goingAfter, 0.27); - } - - else - SetBotState(BS_WANDERING); - } - - else if ( bstate == BS_FLEEING ) - { + + else if ( pathCountdown <= 0 ) + { + ActorList path = navDest.findPathTo(ClosestNode(goingAfter), possessed); + + if ( path != null && path.Length() > 1 ) + { + navDest = ZTPathNode(path.get(1)); + + DebugLog(LT_INFO, "Next navigation point found at: "..navDest.pos); + MoveToward(navDest, 0.27); + } + + else if ( possessed.Distance3D(goingAfter) < 256 && possessed.CheckSight(goingAfter) ) + SetBotState(BS_WANDERING); + + else + MoveToward(goingAfter, 0.27); + + pathCountdown += 15; + } + + else + pathCountdown--; + } + + else if ( navDest != null ) + SmartMove(); + + else if ( possessed.Distance3D(goingAfter) < 256 ) + SetBotState(BS_ATTACKING); + + else if ( possessed.Distance3D(goingAfter) > 1500 && !possessed.CheckSight(goingAfter) ) + SetBotState(BS_WANDERING); + + else + MoveToward(goingAfter, 0.27); + } + + else + SetBotState(BS_WANDERING); + } + + else if ( bstate == BS_FLEEING ) + { if ( DodgeAndUse() ) { navDest = currNode.RandomNeighbor(); SetBotState(BS_WANDERING); } - if ( enemy != null && possessed.Distance3D(enemy) < 1024 && possessed.CheckSight(enemy) && possessed.Health < possessed.default.Health / 7 ) - MoveAwayFrom(enemy); - - else - SetBotState(BS_WANDERING); - } - - else if ( bstate == BS_WANDERING ) - { + if ( enemy != null && possessed.Distance3D(enemy) < 1024 && possessed.CheckSight(enemy) && possessed.Health < possessed.default.Health / 7 ) + MoveAwayFrom(enemy); + + else + SetBotState(BS_WANDERING); + } + + else if ( bstate == BS_WANDERING ) + { enemy = null; + BotChat("IDLE", 2.25 / 90); if ( currNode == goalNode ) bReachedGoal == true; - + else if ( !bReachedGoal ) { if ( goalNode == null ) @@ -1281,22 +1337,22 @@ class ZTBotController : Actor MoveToward(goalNode, 0.6); } - MoveForward(); - - if ( commander != null && ( possessed.Distance3D(commander) > 1024 && !possessed.CheckSight(commander) ) && ClosestNode(commander) != currNode ) - { + MoveForward(); + + if ( commander != null && ( possessed.Distance3D(commander) > 1024 && !possessed.CheckSight(commander) ) && ClosestNode(commander) != currNode ) + { DodgeAndUse(); - SetBotState(BS_FOLLOWING); - goingAfter = commander; - } - - else if ( commander == null ) - { // get a commander - ActorList friends = VisibleFriends(possessed); - - if ( friends.length() > 0 ) - { + SetBotState(BS_FOLLOWING); + goingAfter = commander; + } + + else if ( commander == null ) + { // get a commander + ActorList friends = VisibleFriends(possessed); + + if ( friends.length() > 0 ) + { commander = friends.get(Random(0, friends.length() - 1)); if ( !commander.CheckClass("ZetaBotPawn", AAPTR_DEFAULT, true) ) @@ -1308,294 +1364,292 @@ class ZTBotController : Actor else DebugLog(LT_INFO, myName.." is now following "..ztcom.cont.myName); - } - - BotChat("COMM", 0.8); - } - } - - if ( commander == null ) - { // wander around - if ( currNode == null ) - SetCurrentNode(ClosestVisibleNode(possessed)); + } + + BotChat("COMM", 0.8); + } + } + + if ( commander == null ) + { // wander around + if ( currNode == null ) + SetCurrentNode(ClosestVisibleNode(possessed)); if ( DodgeAndUse() ) navDest = currNode.RandomNeighbor(); - - ZTPathNode ng = null; - - if ( currNode != null && (ng = currNode.RandomNeighbor()) != currNode && ng != null ) - MoveToward(ng, 0.12); // wander to a random 'neighboring' node - - else - { // just wander around :P - - angleMomentum += FRandom(-0.04, 0.04); - - if ( FRandom(0, 1) < 0.7 ) - MoveForward(); - - else if ( FRandom(0, 1) < 0.5 ) - RandomStrafe(); - - else - StepBack(); - - BotChat("IDLE", 0.1); - } - } - - /* - if ( currNode == null || possessed.Distance3D(currNode) > 768 ) - currNode = ZTPathNode.plopNode(pos, ZTPathNode.NT_NORMAL); - */ - } - } - } - - else - { - if ( enemy != null && enemy.Health >= 1 ) // health is integer - { - if ( !possessed.CheckSight(enemy) && possessed.Distance2D(enemy) > 768 ) - { - possessed.EndShoot(); + + ZTPathNode ng = null; + + if ( currNode != null && (ng = currNode.RandomNeighbor()) != currNode && ng != null ) { + MoveToward(ng, 0.12); // wander to a random 'neighboring' node + } + + else + { // just wander around :P + + angleMomentum += FRandom(-0.04, 0.04); + + if ( FRandom(0, 1) < 0.7 ) + MoveForward(); + + else if ( FRandom(0, 1) < 0.5 ) + RandomStrafe(); + + else + StepBack(); + } + } + + /* + if ( currNode == null || possessed.Distance3D(currNode) > 768 ) + currNode = ZTPathNode.plopNode(pos, ZTPathNode.NT_NORMAL); + */ + } + } + } + + else + { + if ( enemy != null && enemy.Health >= 1 ) // health is integer + { + if ( !possessed.CheckSight(enemy) && possessed.Distance2D(enemy) > 768 ) + { + possessed.EndShoot(); lastEnemyPos = enemy.pos; - SetBotState(BS_HUNTING); - } - - else - { - if ( FRandom(0, 1) < 0.3 ) - possessed.Jump(); - - BotChat("ACTV", 0.2); - - ZetaWeapon w = BestWeaponAllTic(); - - if ( w == null ) - { - enemy = null; - goingAfter = null; - - SetBotState(BS_WANDERING); - } - - else - { - if ( possessed.Distance3D(enemy) > 256 + enemy.radius || w.IsMelee() ) - MoveToward(enemy, 0.282); - - else if ( possessed.Distance3D(enemy) < 128 + enemy.radius ) - StepBackFrom(enemy); - - RandomStrafe(); - AimToward(enemy, 0.27, 30); - - if ( FireBestWeapon() ) - possessed.BeginShoot(); - - else - possessed.EndShoot(); - } - } - } - } - - if ( currNode == null || possessed.Distance2D(currNode) > 512 ) - { - pastNode = currNode; - SetCurrentNode(ZTPathNode.plopNode(possessed.pos, ZTPathNode.NT_NORMAL)); - } - - if ( angleMomentum > 1.28 ) - angleMomentum = 1.28; - - if ( angleMomentum < -1.28 ) - angleMomentum = -1.28; - } - - States - { - Spawn: - TNT1 A 1; - Goto TickLoop; - - TickLoop: - TNT1 A 1 A_BotTick; - Loop; - } + SetBotState(BS_HUNTING); + } + + else + { + if ( FRandom(0, 1) < 0.3 ) + possessed.Jump(); + + BotChat("ACTV", 0.2); + + ZetaWeapon w = BestWeaponAllTic(); + + if ( w == null ) + { + enemy = null; + goingAfter = null; + + SetBotState(BS_WANDERING); + } + + else + { + if ( possessed.Distance3D(enemy) > 256 + enemy.radius || w.IsMelee() ) + MoveToward(enemy, 0.282); + + else if ( possessed.Distance3D(enemy) < 128 + enemy.radius ) + StepBackFrom(enemy); + + RandomStrafe(); + AimToward(enemy, 0.27, 30); + + if ( FireBestWeapon() ) + possessed.BeginShoot(); + + else + possessed.EndShoot(); + } + } + } + } + + if ( currNode == null || possessed.Distance2D(currNode) > 512 ) + { + pastNode = currNode; + SetCurrentNode(ZTPathNode.plopNode(possessed.pos, ZTPathNode.NT_NORMAL)); + } + + if ( angleMomentum > 1.28 ) + angleMomentum = 1.28; + + if ( angleMomentum < -1.28 ) + angleMomentum = -1.28; + } + + States + { + Spawn: + TNT1 A 1; + Goto TickLoop; + + TickLoop: + TNT1 A 1 A_BotTick; + Loop; + } } class ZetaBot : Actor { - enum LogType - { - LT_ERROR = 0, - LT_WARNING, - LT_INFO, - LT_VERBOSE - }; - - void DebugLog(LogType kind, string msg) - { - if ( CVar.FindCVar("zb_debug").GetInt() > 0 ) - { - string logHeader = ""; - - if ( kind == LT_ERROR ) - logHeader = "\cr[ERROR]"; - - else if ( kind == LT_WARNING ) - logHeader = "\cf[WARNING]"; - - else if ( kind == LT_INFO ) - logHeader = "\ch[INFO]"; - - else if ( kind == LT_VERBOSE ) - { - if ( CVar.FindCVar("zb_debug").GetInt() > 1 ) - logHeader = "\cd[VERBOSE]"; - - else - return; - } - - A_Log("\cq[ZetaBot] "..logHeader.." "..msg); - } - } - - uint botID; - - override void PostBeginPlay() - { - Super.PostBeginPlay(); - - bool bHasNode; - let ni = ThinkerIterator.create("ZTPathNode"); - - if ( ni.Next() ) - bHasNode = true; - - if ( !bHasNode && CVar.FindCVar("nodelist").GetString() != "::NONE" ) - ZTPathNode.plopNodes(CVar.FindCVar("nodelist").GetString()); - - DebugLog(LT_VERBOSE, "Serialized Nodes: "..ZTPathNode.serializeLevel()); - - ZTBotController cont = ZTBotController(Spawn("ZTBotController", pos)); - - if ( cont == null ) + enum LogType + { + LT_ERROR = 0, + LT_WARNING, + LT_INFO, + LT_VERBOSE + }; + + void DebugLog(LogType kind, string msg) + { + if ( CVar.FindCVar("zb_debug").GetInt() > 0 ) + { + string logHeader = ""; + + if ( kind == LT_ERROR ) + logHeader = "\cr[ERROR]"; + + else if ( kind == LT_WARNING ) + logHeader = "\cf[WARNING]"; + + else if ( kind == LT_INFO ) + logHeader = "\ch[INFO]"; + + else if ( kind == LT_VERBOSE ) + { + if ( CVar.FindCVar("zb_debug").GetInt() > 1 ) + logHeader = "\cd[VERBOSE]"; + + else + return; + } + + A_Log("\cq[ZetaBot] "..logHeader.." "..msg); + } + } + + override void PostBeginPlay() + { + Super.PostBeginPlay(); + + bool bHasNode; + let ni = ThinkerIterator.create("ZTPathNode"); + + if ( ni.Next() ) + bHasNode = true; + + if ( !bHasNode && CVar.FindCVar("nodelist").GetString() != "::NONE" ) + ZTPathNode.plopNodes(CVar.FindCVar("nodelist").GetString()); + + DebugLog(LT_VERBOSE, "Serialized Nodes: "..ZTPathNode.serializeLevel()); + + ZTBotController cont = ZTBotController(Spawn("ZTBotController", pos)); + + if ( cont == null ) return; - - ZetaCape.MakeFor(cont.possessed); - cont.possessed.angle = angle; - - DebugLog(LT_INFO, "ZetaBot spawned with success! Class: "..cont.possessed.GetClassName()); - Destroy(); - } + + ZetaCape.MakeFor(cont.possessed); + cont.possessed.angle = angle; + + DebugLog(LT_INFO, "ZetaBot spawned with success! Class: "..cont.possessed.GetClassName()); + Destroy(); + } } class ZetaSpirit : Actor { - enum LogType - { - LT_ERROR = 0, - LT_WARNING, - LT_INFO, - LT_VERBOSE - }; - - void DebugLog(LogType kind, string msg) - { - if ( CVar.FindCVar("zb_debug").GetInt() > 0 ) - { - string logHeader = ""; - - if ( kind == LT_ERROR ) - logHeader = "\cr[ERROR]"; - - else if ( kind == LT_WARNING ) - logHeader = "\cf[WARNING]"; - - else if ( kind == LT_INFO ) - logHeader = "\ch[INFO]"; - - else if ( kind == LT_VERBOSE ) - { - if ( CVar.FindCVar("zb_debug").GetInt() > 1 ) - logHeader = "\cd[VERBOSE]"; - - else - return; - } - - A_Log("\cq[ZetaBot] "..logHeader.." "..msg); - } - } - - override void PostBeginPlay() - { - Super.PostBeginPlay(); - - bool bHasNode; - let ni = ThinkerIterator.create("ZTPathNode"); - - if ( ni.Next() ) - bHasNode = true; - - if ( !bHasNode && CVar.FindCVar("nodelist").GetString() != "::NONE" ) - ZTPathNode.plopNodes(CVar.FindCVar("nodelist").GetString()); - - DebugLog(LT_VERBOSE, "Serialized Nodes: "..ZTPathNode.serializeLevel()); - - ZTBotController cont = ZTBotController(Spawn("ZTBotController", pos)); - - if ( cont == null ) + enum LogType + { + LT_ERROR = 0, + LT_WARNING, + LT_INFO, + LT_VERBOSE + }; + + void DebugLog(LogType kind, string msg) + { + if ( CVar.FindCVar("zb_debug").GetInt() > 0 ) + { + string logHeader = ""; + + if ( kind == LT_ERROR ) + logHeader = "\cr[ERROR]"; + + else if ( kind == LT_WARNING ) + logHeader = "\cf[WARNING]"; + + else if ( kind == LT_INFO ) + logHeader = "\ch[INFO]"; + + else if ( kind == LT_VERBOSE ) + { + if ( CVar.FindCVar("zb_debug").GetInt() > 1 ) + logHeader = "\cd[VERBOSE]"; + + else + return; + } + + A_Log("\cq[ZetaBot] "..logHeader.." "..msg); + } + } + + override void PostBeginPlay() + { + Super.PostBeginPlay(); + + bool bHasNode; + let ni = ThinkerIterator.create("ZTPathNode"); + + if ( ni.Next() ) + bHasNode = true; + + if ( !bHasNode && CVar.FindCVar("nodelist").GetString() != "::NONE" ) + ZTPathNode.plopNodes(CVar.FindCVar("nodelist").GetString()); + + DebugLog(LT_VERBOSE, "Serialized Nodes: "..ZTPathNode.serializeLevel()); + + ZTBotController cont = ZTBotController(Spawn("ZTBotController", pos)); + + if ( cont == null ) return; - - ZetaCape.MakeFor(cont.possessed); - cont.possessed.angle = angle; - - DebugLog(LT_INFO, "ZetaBot spawned with success! Class: "..cont.possessed.GetClassName()); - Destroy(); - - let piter = ThinkerIterator.create("PlayerPawn"); - PlayerPawn pn; - - while ( (pn = PlayerPawn(piter.Next())) ) if ( ZetaBotPawn(pn) != null ) - { - ZetaSpiritEyes zse = ZetaSpiritEyes(Spawn("ZetaSpiritEyes")); - zse.SetPlayer(pn); - zse.possessed = cont.possessed; - } - } + + ZetaCape.MakeFor(cont.possessed); + cont.possessed.angle = angle; + + DebugLog(LT_INFO, "ZetaBot spawned with success! Class: "..cont.possessed.GetClassName()); + Destroy(); + + let piter = ThinkerIterator.create("PlayerPawn"); + PlayerPawn pn; + + while ( (pn = PlayerPawn(piter.Next())) ) if ( ZetaBotPawn(pn) != null ) + { + ZetaSpiritEyes zse = ZetaSpiritEyes(Spawn("ZetaSpiritEyes")); + zse.SetPlayer(pn); + zse.possessed = cont.possessed; + } + } } class ZetaSpiritEyes : Actor { - ZetaBotPawn possessed; - PlayerPawn playa; - - void SetPlayer(PlayerPawn pn) - { - playa = pn; - playa.bInvisible = true; - } - - override void Tick() - { - if ( playa != null ) - { - playa.SetXYZ(possessed.pos); - playa.angle = possessed.angle; - playa.health = possessed.health; - } - } + ZetaBotPawn possessed; + PlayerPawn playa; + + void SetPlayer(PlayerPawn pn) + { + playa = pn; + playa.bInvisible = true; + } + + override void Tick() + { + if ( playa != null ) + { + playa.SetXYZ(possessed.pos); + playa.angle = possessed.angle; + playa.health = possessed.health; + } + } } class BotName : Inventory { int countDown; + bool printing; override void BeginPlay() { @@ -1619,14 +1673,6 @@ class BotName : Inventory double vdot = (v1.x * v2.x + v1.y * v2.y); - /* - if ( zb.cont == null ) - Log(zb.GetClassName()..": "..vdot..", "..Owner.Distance2D(zb)); - - else - Log(zb.cont.myName..": "..vdot..", "..Owner.Distance2D(zb)); - */ - if ( vdot > 1 - 1 / (Owner.Distance2D(zb) / (zb.Radius + 4)) && Owner.CheckSight(zb) && zb.cont != null && zb.Health > 0 && ( closest == null || Owner.Distance2D(zb) < cdist ) ) { cdist = Owner.Distance2D(zb); @@ -1637,16 +1683,20 @@ class BotName : Inventory if ( closest != null && closest.cont != null ) { Owner.A_Print("\ci"..closest.cont.myName.."\n\cg"..closest.Health.." HP"..( - ( closest.cont.bstate != ZTBotController.BS_ATTACKING || closest.cont.enemy == null ) ? "\n\cc"..ZTBotController.BStateNames[closest.cont.bstate] - : "\n\n\crAttacking a "..closest.cont.enemy.GetClassName().." with "..closest.cont.enemy.health.." HP!" - )); + ( closest.cont.bstate != ZTBotController.BS_ATTACKING || closest.cont.enemy == null ) ? "\n\cc"..ZTBotController.BStateNames[closest.cont.bstate] + : "\n\n\crAttacking a "..closest.cont.enemy.GetClassName().." with "..closest.cont.enemy.health.." HP!" + )); + printing = true; countDown = 3; } else { - Owner.A_Print(""); + if ( printing ) + Owner.A_Print(""); + + printing = false; countDown = 2; - } + } } else diff --git a/ZetaCode/Pathing.zsc b/ZetaCode/Pathing.zsc index 0274a14..9c59eef 100644 --- a/ZetaCode/Pathing.zsc +++ b/ZetaCode/Pathing.zsc @@ -45,7 +45,8 @@ class ZTPathNode : Actor NT_SLOW, NT_CROUCH, NT_JUMP, - NT_AVOID + NT_AVOID, + NT_SHOOT }; enum LogType @@ -256,7 +257,6 @@ class ZTPathNode : Actor static PlopResult plopNodes(string code) { uint i = 0; - uint total = 0; string c, ncode; let res = new("PlopResult"); @@ -294,7 +294,7 @@ class ZTPathNode : Actor node.useDirection = ud; - total++; + res.totalNodes++; } return res; @@ -556,6 +556,19 @@ class ZTJumpNode : Actor } } +class ZTShootNode : Actor +{ + override void PostBeginPlay() + { + let node = ZTPathNode(Spawn("ZTPathNode", pos)); + node.nodeType = ZTPathNode.NT_SHOOT; + node.angle = angle; + + Destroy(); + } +} + + class ZTAvoidNode : Actor { override void PostBeginPlay() diff --git a/ZetaCode/PawnClasses/ZetaBotPawn.zsc b/ZetaCode/PawnClasses/ZetaBotPawn.zsc index fd6d5e8..d00ebbf 100644 --- a/ZetaCode/PawnClasses/ZetaBotPawn.zsc +++ b/ZetaCode/PawnClasses/ZetaBotPawn.zsc @@ -11,13 +11,20 @@ class ZetaBotPawn : Actor Obituary "%o wound up smarted out by %NAME%!"; Species "ZetaBot"; ZetaBotPawn.DefaultInv ""; + Health 100; + Radius 16; + Height 56; + Mass 100; + PainChance 255; + +PICKUP +SOLID +SHOOTABLE +DROPOFF +FRIENDLY +SLIDESONWALLS +CANPASS + +ACTLIKEBRIDGE +CANPUSHWALLS +FLOORCLIP +WINDTHRUST @@ -25,10 +32,11 @@ class ZetaBotPawn : Actor +NOBLOCKMONST +FRIENDLY +ISMONSTER - +THRUSPECIES - +BLOCKASPLAYER +CANUSEWALLS +ACTIVATEMCROSS + +PUSHABLE + +THRUSPECIES + +BLOCKASPLAYER -NOTDMATCH -NOBLOCKMAP @@ -77,7 +85,7 @@ class ZetaBotPawn : Actor MovementModifier moveType; bool bShooting; // for visual purposes ZTBotController cont; - const speedMod = 6; + const speedMod = 4; override String GetObituary(Actor victim, Actor inflictor, Name mod, bool playerattack) { @@ -195,10 +203,13 @@ class ZetaBotPawn : Actor void Jump() { - if ( pos.z - floorZ > 1 ) + if ( pos.z - floorZ > 1 || vel.z > 0 ) return; - RaiseMobj(8); + vel.z += 10; + vel.x /= 1.1; + vel.y /= 1.1; + A_PlaySound("ztmisc/jump", CHAN_BODY); } diff --git a/ZetaCode/PawnClasses/ZetaDoom.zsc b/ZetaCode/PawnClasses/ZetaDoom.zsc index 108c8c6..68c0c18 100644 --- a/ZetaCode/PawnClasses/ZetaDoom.zsc +++ b/ZetaCode/PawnClasses/ZetaDoom.zsc @@ -2,11 +2,6 @@ class ZetaDoom : ZetaBotPawn { Default { - Health 100; - Radius 16; - Height 56; - Mass 100; - PainChance 255; ZetaBotPawn.DefaultInv "Fist,Pistol,Clip"; } diff --git a/ZetaCode/Standard.zsc b/ZetaCode/Standard.zsc index efaf47b..a32118f 100644 --- a/ZetaCode/Standard.zsc +++ b/ZetaCode/Standard.zsc @@ -1,279 +1,286 @@ -class Dict : Thinker +class Dict { - Array keys; - Array values; - - Object get(Object _key) - { - uint index = -1; - - for ( uint i = 0; i < keys.Size(); i++ ) - if ( keys[i] == _key ) - { - index = i; - break; - } - - if ( index == -1 ) - return null; - - return values[index]; - } - - int set(Object _key, Object _val) - { - uint index = -1; - uint i = 0; - - for ( i = 0; i < keys.Size(); i++ ) - { - if ( keys[i] == _key ) - break; - - if ( Object(keys[i]) == null ) - { - index = i; - break; - } - } - - if ( index == -1 ) - { - keys.Push(_key); - values.Push(_val); - } - - else - { - keys[i] = _key; - values[i] = _val; - } - - return i; - } + Array keys; + Array values; + + Object get(Object _key) + { + int index = -1; + uint i; + + for ( i = 0; i < keys.Size(); i++ ) + if ( keys[i] == _key ) + { + index = i; + break; + } + + if ( index == -1 ) + return null; + + return values[index]; + } + + int set(Object _key, Object _val) + { + int index = -1; + int i = 0; + + for ( i = 0; i < keys.Size(); i++ ) + { + if ( keys[i] == _key ) + break; + + if ( Object(keys[i]) == null ) + { + index = i; + break; + } + } + + if ( index == -1 ) + { + keys.Push(_key); + values.Push(_val); + } + + else + { + keys[i] = _key; + values[i] = _val; + } + + return i; + } } -class NumberDict : Thinker +class NumberDict { - Array keys; - Array values; - Array taken; - - double get(Object _key, double default) - { - uint index = -1; - - for ( uint i = 0; i < keys.Size(); i++ ) - if ( keys[i] == _key ) - { - index = i; - break; - } - - if ( index == -1 ) - return default; - - return values[index]; - } - - int set(Object _key, double _val) - { - uint index = -1; - uint i = 0; - - for ( i = 0; i < keys.Size(); i++ ) - if ( keys[i] == _key || !taken[i] ) - { - index = i; - break; - } - - if ( index == -1 ) - { - keys.Push(_key); - values.Push(_val); - taken.Push(true); - } - - else - { - keys[i] = _key; - values[i] = _val; - taken[i] = true; - } - - return i; - } + Array keys; + Array values; + Array taken; + + double get(Object _key, double default) + { + int index = -1; + uint i; + + for ( i = 0; i < keys.Size(); i++ ) + if ( keys[i] == _key ) + { + index = i; + break; + } + + if ( index == -1 ) + return default; + + return values[index]; + } + + int set(Object _key, double _val) + { + int index = -1; + int i; + + for ( i = 0; i < keys.Size(); i++ ) + if ( keys[i] == _key || !taken[i] ) + { + index = i; + break; + } + + if ( index == -1 ) + { + keys.Push(_key); + values.Push(_val); + taken.Push(true); + } + + else + { + keys[i] = _key; + values[i] = _val; + taken[i] = true; + } + + return i; + } } -class QueueItem : Thinker +class QueueItem { - double cost; - Object item; - - static QueueItem of(Object item, double cost) - { - QueueItem r = new("QueueItem"); - r.item = item; - r.cost = cost; - - return r; - } + double cost; + Object item; + + static QueueItem of(Object item, double cost) + { + QueueItem r = new("QueueItem"); + r.item = item; + r.cost = cost; + + return r; + } } -class PriorityQueue : Thinker +class PriorityQueue { - Array queue; - - void add(Object item, double cost) - { - uint i = 0; - - for ( i = 0; i < queue.Size() && queue[i].cost < cost; i++ ) - continue; - - if ( i == queue.Size() ) - queue.push(QueueItem.of(item, cost)); - - queue.Insert(i, QueueItem.of(item, cost)); - } - - bool has(Object other) - { - for ( uint i = 0; i < length(); i++ ) - if ( queue[i].item == other ) - return true; - - return false; - } - - uint length() - { - return queue.Size(); - } - - Object poll() - { - if ( queue.Size() == 0 ) - return null; - - Object res = queue[0].item; - queue.Delete(0); - - return res; - } - - Object peek() - { - if ( queue.Size() == 0 ) - return null; - - return queue[0].item; - } + Array queue; + + void add(Object item, double cost) + { + uint i = 0; + + for ( i = 0; i < queue.Size() && queue[i].cost < cost; i++ ) + continue; + + if ( i == queue.Size() ) + queue.push(QueueItem.of(item, cost)); + + queue.Insert(i, QueueItem.of(item, cost)); + } + + bool has(Object other) + { + uint i = 0; + + for ( i = 0; i < length(); i++ ) + if ( queue[i].item == other ) + return true; + + return false; + } + + uint length() + { + return queue.Size(); + } + + Object poll() + { + if ( queue.Size() == 0 ) + return null; + + Object res = queue[0].item; + queue.Delete(0); + + return res; + } + + Object peek() + { + if ( queue.Size() == 0 ) + return null; + + return queue[0].item; + } +} + +class ActorList +{ + Array all; + bool bHas; + int iterIndex; + + void BeginPlay() + { + iReset(); + } + + void iReset() + { + iterIndex = 0; + } + + Object iNext() + { + if ( iterIndex >= all.Size() ) + return null; + + iterIndex += 1; + return all[iterIndex - 1]; + } + + void iSeek(int i) + { + iterIndex = i; + } + + Actor get(int i) + { + if ( i < 0 ) + i += all.Size(); + + if ( i < 0 ) // still + i = 0; + + if ( all.Size() <= i ) + return null; + + return all[i]; + } + + bool remove(int i) + { + if ( i < 0 ) + i += all.Size(); + + if ( i < 0 ) // still + i = 0; + + if ( all.Size() < i ) + return false; + + all.Delete(i); + return true; + } + + bool isEmpty() + { + return !bHas; + } + + static ActorList empty() + { + ActorList res = new("ActorList"); + res.bHas = false; + return res; + } + + void push(Actor node) + { + all.push(node); + bHas = true; + } + + void insert(int ind, Actor node) + { + all.Insert(ind, node); + } + + bool has(Object other) + { + uint i; + + for ( i = 0; i < length(); i++ ) + if ( get(i) == other ) + return true; + + return false; + } + + uint length() + { + return all.Size(); + } } -class ActorList : Thinker +class DummyInvHolder : Actor { - Array all; - bool bHas; - uint iterIndex; - - void BeginPlay() - { - iterIndex = 0; - } - - void iReset() - { - iterIndex = 0; - } - - Object iNext() - { - if ( iterIndex >= all.Size() ) - return null; - - return all[iterIndex++]; - } - - void iSeek(uint i) - { - iterIndex = i; - } - - Actor get(uint i) - { - if ( i < 0 ) - i += all.Size(); - - if ( i < 0 ) // still - i = 0; - - if ( all.Size() <= i ) - return null; - - return all[i]; - } - - bool remove(uint i) - { - if ( i < 0 ) - i += all.Size(); - - if ( i < 0 ) // still - i = 0; - - if ( all.Size() < i ) - return false; - - all.Delete(i); - return true; - } - - bool isEmpty() - { - return !bHas; - } - - static ActorList empty() - { - ActorList res = new("ActorList"); - res.bHas = false; - return res; - } - - void push(Actor node) - { - all.push(node); - bHas = true; - } - - void insert(uint ind, Actor node) - { - all.Insert(ind, node); - } - - bool has(Object other) - { - for ( uint i = 0; i < length(); i++ ) - if ( get(i) == other ) - return true; - - return false; - } - - uint length() - { - return all.Size(); - } -} - -class DummyInvHolder : Actor -{ - States - { - Spawn: - TNT1 A 1; - Stop; - } + States + { + Spawn: + TNT1 A 1; + Stop; + } } \ No newline at end of file diff --git a/ZetaCode/WeaponSupport/Doom/ZetaBFG.zsc b/ZetaCode/WeaponSupport/Doom/ZetaBFG.zsc index 87230b5..e048644 100644 --- a/ZetaCode/WeaponSupport/Doom/ZetaBFG.zsc +++ b/ZetaCode/WeaponSupport/Doom/ZetaBFG.zsc @@ -24,6 +24,6 @@ class ZetaBFG : ZetaWeapon override void Fire(Actor shooter, Actor target) { - shooter.SpawnMissileAngle("BFGBall", shooter.angle, (target.pos.z - shooter.pos.z) * 25 / target.Distance2D(shooter)); + shooter.SpawnMissileAngle("BFGBall", shooter.angle, target == null ? 0 : ((target.pos.z - shooter.pos.z) * 25 / target.Distance2D(shooter))); } } \ No newline at end of file diff --git a/ZetaCode/WeaponSupport/Doom/ZetaPR.zsc b/ZetaCode/WeaponSupport/Doom/ZetaPR.zsc index b0d5347..a096f4c 100644 --- a/ZetaCode/WeaponSupport/Doom/ZetaPR.zsc +++ b/ZetaCode/WeaponSupport/Doom/ZetaPR.zsc @@ -24,6 +24,6 @@ class ZetaPR : ZetaWeapon override void Fire(Actor shooter, Actor target) { - shooter.SpawnMissileAngle("PlasmaBall", shooter.angle, (target.pos.z - shooter.pos.z) * 25 / target.Distance2D(shooter)); + shooter.SpawnMissileAngle("PlasmaBall", shooter.angle, target == null ? 0 : ((target.pos.z - shooter.pos.z) * 25 / target.Distance2D(shooter))); } } \ No newline at end of file diff --git a/ZetaCode/WeaponSupport/Doom/ZetaRL.zsc b/ZetaCode/WeaponSupport/Doom/ZetaRL.zsc index 00d5873..96c9346 100644 --- a/ZetaCode/WeaponSupport/Doom/ZetaRL.zsc +++ b/ZetaCode/WeaponSupport/Doom/ZetaRL.zsc @@ -27,6 +27,6 @@ class ZetaRL : ZetaWeapon override void Fire(Actor shooter, Actor target) { - shooter.SpawnMissileAngle("Rocket", shooter.angle, (target.pos.z - shooter.pos.z) * 20 / target.Distance2D(shooter)); + shooter.SpawnMissileAngle("Rocket", shooter.angle, target == null ? 0 : ((target.pos.z - shooter.pos.z) * 20 / target.Distance2D(shooter))); } } \ No newline at end of file diff --git a/ZetaCode/WeaponSupport/SentientMushes/ZetaFireBallista.zsc b/ZetaCode/WeaponSupport/SentientMushes/ZetaFireBallista.zsc index d9d0a24..7b959ce 100644 --- a/ZetaCode/WeaponSupport/SentientMushes/ZetaFireBallista.zsc +++ b/ZetaCode/WeaponSupport/SentientMushes/ZetaFireBallista.zsc @@ -32,14 +32,14 @@ class Minigun : ZetaWeapon override void Fire(Actor shooter, Actor target) { - shooter.SpawnMissileAngle("BallistaMissile", shooter.angle, (target.pos.z - shooter.pos.z) * 15 / target.Distance2D(shooter)); + shooter.SpawnMissileAngle("BallistaMissile", shooter.angle, target == null ? 0 : ((target.pos.z - shooter.pos.z) * 15 / target.Distance2D(shooter))); shooter.A_PlaySound("fireballista/shoot"); } override void AltFire(Actor shooter, Actor target) { for ( int _ = 0; _ < 11; _++ ) - shooter.SpawnMissileAngle("DrunkBallistaMissile", shooter.angle + frandom(-3, 3), (target.pos.z - shooter.pos.z) * 15 / target.Distance2D(shooter)); + shooter.SpawnMissileAngle("DrunkBallistaMissile", shooter.angle + frandom(-3, 3), target == null ? 0 : ((target.pos.z - shooter.pos.z) * 15 / target.Distance2D(shooter))); shooter.A_PlaySound("fireballista/shoot"); } diff --git a/ZetaCode/WeaponSupport/SentientMushes/ZetaRocketeer.zsc b/ZetaCode/WeaponSupport/SentientMushes/ZetaRocketeer.zsc index 1bc48eb..f3ee075 100644 --- a/ZetaCode/WeaponSupport/SentientMushes/ZetaRocketeer.zsc +++ b/ZetaCode/WeaponSupport/SentientMushes/ZetaRocketeer.zsc @@ -39,7 +39,7 @@ class ZetaRocketeer : ZetaWeapon Class gg = ggs; if ( gg ) - shooter.SpawnMissileAngle(gg, shooter.angle, (target.pos.z - shooter.pos.z) * 25 / target.Distance2D(shooter)); + shooter.SpawnMissileAngle(gg, shooter.angle, target == null ? 0 : ((target.pos.z - shooter.pos.z) * 25 / target.Distance2D(shooter))); } override void AltFire(Actor shooter, Actor target) @@ -52,7 +52,7 @@ class ZetaRocketeer : ZetaWeapon if ( cb && rf ) { - shooter.SpawnMissileAngle(cb, shooter.angle, (target.pos.z - shooter.pos.z) * 19 / target.Distance2D(shooter)); + shooter.SpawnMissileAngle(cb, shooter.angle, target == null ? 0 : ((target.pos.z - shooter.pos.z) * 19 / target.Distance2D(shooter))); shooter.SpawnMissileAngle(rf, shooter.angle, shooter.pitch); } } diff --git a/ZetaCode/WeaponSupport/SentientMushes/ZetaRockox.zsc b/ZetaCode/WeaponSupport/SentientMushes/ZetaRockox.zsc index cfc188f..1ebed26 100644 --- a/ZetaCode/WeaponSupport/SentientMushes/ZetaRockox.zsc +++ b/ZetaCode/WeaponSupport/SentientMushes/ZetaRockox.zsc @@ -32,7 +32,7 @@ class ZetaRockox : ZetaWeapon if ( rr ) { - shooter.SpawnMissileAngle(rr, shooter.angle, (target.pos.z - shooter.pos.z) * 20 / target.Distance2D(shooter)); + shooter.SpawnMissileAngle(rr, shooter.angle, target == null ? 0 : ((target.pos.z - shooter.pos.z) * 20 / target.Distance2D(shooter))); shooter.A_PlaySound("rockox/fire", CHAN_WEAPON); } } diff --git a/ZetaCode/WeaponSupport/ZetaBullet.zsc b/ZetaCode/WeaponSupport/ZetaBullet.zsc index b847c94..2e95328 100644 --- a/ZetaCode/WeaponSupport/ZetaBullet.zsc +++ b/ZetaCode/WeaponSupport/ZetaBullet.zsc @@ -25,14 +25,24 @@ class ZetaBullet : Actor static ZetaBullet FireABullet(Actor shooter, String bulletColor, Actor target, double damage, double spreadX, double spreadY, name damageType = "bullet", string puff = "BulletPuff") { - let bullet = ZetaBullet(shooter.SpawnMissile(target, "ZetaBullet", shooter)); + ZetaBullet bullet; + + if (target == null) + bullet = ZetaBullet(shooter.SpawnMissileAngle("ZetaBullet", shooter.angle, 0)); + + else + bullet = ZetaBullet(shooter.SpawnMissile(target, "ZetaBullet", shooter)); if ( bullet != null ) { bullet.currDmg = Floor(damage + 0.5); bullet.angle += FRandom(-spreadX, spreadX); - bullet.pitch = (target.pos.z - shooter.pos.z) / target.Distance2D(shooter); - bullet.pitch += FRandom(-spreadY, spreadY); + + if (target != null) { + bullet.pitch = (target.pos.z - shooter.pos.z) / target.Distance2D(shooter); + bullet.pitch += FRandom(-spreadY, spreadY); + } + bullet.shooter = shooter; bullet.damageType = damageType; ZetaBullet(bullet).SetColor(bulletColor ? bulletColor : "Gold"); diff --git a/ZetaCode/WeaponSupport/ZetaWeapon.zsc b/ZetaCode/WeaponSupport/ZetaWeapon.zsc index 91cf191..7d35af1 100644 --- a/ZetaCode/WeaponSupport/ZetaWeapon.zsc +++ b/ZetaCode/WeaponSupport/ZetaWeapon.zsc @@ -48,6 +48,18 @@ class ZetaWeapon : Actor { return -1; } + + double GetRating(Actor shooter, Actor target) + { + if (target == null) return FRandom(0, 20); + return RateSelf(shooter, target); + } + + double GetAltRating(Actor shooter, Actor target) + { + if (target == null) return FRandom(0, 20); + return AltRateSelf(shooter, target); + } virtual bool CanFireAmmo(Actor shooter) { diff --git a/build b/build index 2f5d447..0c71612 100644 --- a/build +++ b/build @@ -260,9 +260,14 @@ echo "cd ${FOLDER}; ./${NAME}; cd ${owd}" >run chmod +x run if [ "$RUN" == "1" ]; then - ./run >/dev/null 2>error.log & - disown + echo "Running..." + ./run && ( + echo "PK${PKEXT} built succesfully: $out" + ) || ( + echo "Error while running '$out' through $SCPORT!" + ) -fi +else + echo "PK${PKEXT} built succesfully: $out" -echo "PK${PKEXT} built succesfully: $out" +fi diff --git a/config b/config index 8e62783..a4740cf 100644 --- a/config +++ b/config @@ -1,6 +1,6 @@ #!/bin/bash NAME=ZetaBot -VERSION=0.3.1 +VERSION=0.4.0 ADDFOLDER ZetaCode ADDFOLDER sprites diff --git a/sounds/DV1ACTV1 b/sounds/ZV1ACTV1.ogg similarity index 100% rename from sounds/DV1ACTV1 rename to sounds/ZV1ACTV1.ogg diff --git a/sounds/DV1ACTV2 b/sounds/ZV1ACTV2.ogg similarity index 100% rename from sounds/DV1ACTV2 rename to sounds/ZV1ACTV2.ogg diff --git a/sounds/DV1ACTV3 b/sounds/ZV1ACTV3.ogg similarity index 100% rename from sounds/DV1ACTV3 rename to sounds/ZV1ACTV3.ogg diff --git a/sounds/DV1ACTV4 b/sounds/ZV1ACTV4.ogg similarity index 100% rename from sounds/DV1ACTV4 rename to sounds/ZV1ACTV4.ogg diff --git a/sounds/DV1ELIM1 b/sounds/ZV1ELIM1.ogg similarity index 100% rename from sounds/DV1ELIM1 rename to sounds/ZV1ELIM1.ogg diff --git a/sounds/DV1ELIM2 b/sounds/ZV1ELIM2.ogg similarity index 100% rename from sounds/DV1ELIM2 rename to sounds/ZV1ELIM2.ogg diff --git a/sounds/DV1ELIM3 b/sounds/ZV1ELIM3.ogg similarity index 100% rename from sounds/DV1ELIM3 rename to sounds/ZV1ELIM3.ogg diff --git a/sounds/DV1HIDE1 b/sounds/ZV1HIDE1.ogg similarity index 100% rename from sounds/DV1HIDE1 rename to sounds/ZV1HIDE1.ogg diff --git a/sounds/DV1HIDE2 b/sounds/ZV1HIDE2.ogg similarity index 100% rename from sounds/DV1HIDE2 rename to sounds/ZV1HIDE2.ogg diff --git a/sounds/DV1HURT1 b/sounds/ZV1HURT1.ogg similarity index 100% rename from sounds/DV1HURT1 rename to sounds/ZV1HURT1.ogg diff --git a/sounds/DV1HURT2 b/sounds/ZV1HURT2.ogg similarity index 100% rename from sounds/DV1HURT2 rename to sounds/ZV1HURT2.ogg diff --git a/sounds/DV1HURT3 b/sounds/ZV1HURT3.ogg similarity index 100% rename from sounds/DV1HURT3 rename to sounds/ZV1HURT3.ogg diff --git a/sounds/DV1IDLE1 b/sounds/ZV1IDLE1.ogg similarity index 100% rename from sounds/DV1IDLE1 rename to sounds/ZV1IDLE1.ogg diff --git a/sounds/DV1IDLE2 b/sounds/ZV1IDLE2.ogg similarity index 100% rename from sounds/DV1IDLE2 rename to sounds/ZV1IDLE2.ogg diff --git a/sounds/DV1IDLE3 b/sounds/ZV1IDLE3.ogg similarity index 100% rename from sounds/DV1IDLE3 rename to sounds/ZV1IDLE3.ogg diff --git a/sounds/DV1IDLE4 b/sounds/ZV1IDLE4.ogg similarity index 100% rename from sounds/DV1IDLE4 rename to sounds/ZV1IDLE4.ogg diff --git a/sounds/DV1IDLE5 b/sounds/ZV1IDLE5.ogg similarity index 100% rename from sounds/DV1IDLE5 rename to sounds/ZV1IDLE5.ogg diff --git a/sounds/DV1IDLE6 b/sounds/ZV1IDLE6.ogg similarity index 100% rename from sounds/DV1IDLE6 rename to sounds/ZV1IDLE6.ogg diff --git a/sounds/DV1TARG1 b/sounds/ZV1TARG1.ogg similarity index 100% rename from sounds/DV1TARG1 rename to sounds/ZV1TARG1.ogg diff --git a/sounds/DV1TARG2 b/sounds/ZV1TARG2.ogg similarity index 100% rename from sounds/DV1TARG2 rename to sounds/ZV1TARG2.ogg diff --git a/sounds/DV1TARG3 b/sounds/ZV1TARG3.ogg similarity index 100% rename from sounds/DV1TARG3 rename to sounds/ZV1TARG3.ogg diff --git a/sounds/DV2ACTV1 b/sounds/ZV2ACTV1.ogg similarity index 100% rename from sounds/DV2ACTV1 rename to sounds/ZV2ACTV1.ogg diff --git a/sounds/DV2ACTV2 b/sounds/ZV2ACTV2.ogg similarity index 100% rename from sounds/DV2ACTV2 rename to sounds/ZV2ACTV2.ogg diff --git a/sounds/DV2ACTV3 b/sounds/ZV2ACTV3.ogg similarity index 100% rename from sounds/DV2ACTV3 rename to sounds/ZV2ACTV3.ogg diff --git a/sounds/DV2ACTV4 b/sounds/ZV2ACTV4.ogg similarity index 100% rename from sounds/DV2ACTV4 rename to sounds/ZV2ACTV4.ogg diff --git a/sounds/DV2ELIM1 b/sounds/ZV2ELIM1.ogg similarity index 100% rename from sounds/DV2ELIM1 rename to sounds/ZV2ELIM1.ogg diff --git a/sounds/DV2ELIM2 b/sounds/ZV2ELIM2.ogg similarity index 100% rename from sounds/DV2ELIM2 rename to sounds/ZV2ELIM2.ogg diff --git a/sounds/DV2ELIM3 b/sounds/ZV2ELIM3.ogg similarity index 100% rename from sounds/DV2ELIM3 rename to sounds/ZV2ELIM3.ogg diff --git a/sounds/DV2HIDE1 b/sounds/ZV2HIDE1.ogg similarity index 100% rename from sounds/DV2HIDE1 rename to sounds/ZV2HIDE1.ogg diff --git a/sounds/DV2HIDE3 b/sounds/ZV2HIDE3.ogg similarity index 100% rename from sounds/DV2HIDE3 rename to sounds/ZV2HIDE3.ogg diff --git a/sounds/DV2HURT1 b/sounds/ZV2HURT1.ogg similarity index 100% rename from sounds/DV2HURT1 rename to sounds/ZV2HURT1.ogg diff --git a/sounds/DV2HURT2 b/sounds/ZV2HURT2.ogg similarity index 100% rename from sounds/DV2HURT2 rename to sounds/ZV2HURT2.ogg diff --git a/sounds/DV2IDLE1 b/sounds/ZV2IDLE1.ogg similarity index 100% rename from sounds/DV2IDLE1 rename to sounds/ZV2IDLE1.ogg diff --git a/sounds/DV2IDLE2 b/sounds/ZV2IDLE2.ogg similarity index 100% rename from sounds/DV2IDLE2 rename to sounds/ZV2IDLE2.ogg diff --git a/sounds/DV2IDLE3 b/sounds/ZV2IDLE3.ogg similarity index 100% rename from sounds/DV2IDLE3 rename to sounds/ZV2IDLE3.ogg diff --git a/sounds/DV2IDLE4 b/sounds/ZV2IDLE4.ogg similarity index 100% rename from sounds/DV2IDLE4 rename to sounds/ZV2IDLE4.ogg diff --git a/sounds/DV2IDLE5 b/sounds/ZV2IDLE5.ogg similarity index 100% rename from sounds/DV2IDLE5 rename to sounds/ZV2IDLE5.ogg diff --git a/sounds/DV2TARG1 b/sounds/ZV2TARG1.ogg similarity index 100% rename from sounds/DV2TARG1 rename to sounds/ZV2TARG1.ogg diff --git a/sounds/DV2TARG2 b/sounds/ZV2TARG2.ogg similarity index 100% rename from sounds/DV2TARG2 rename to sounds/ZV2TARG2.ogg diff --git a/sounds/DV2TARG3 b/sounds/ZV2TARG3.ogg similarity index 100% rename from sounds/DV2TARG3 rename to sounds/ZV2TARG3.ogg diff --git a/sounds/DV3ACTV1 b/sounds/ZV3ACTV1.ogg similarity index 100% rename from sounds/DV3ACTV1 rename to sounds/ZV3ACTV1.ogg diff --git a/sounds/DV3ACTV2 b/sounds/ZV3ACTV2.ogg similarity index 100% rename from sounds/DV3ACTV2 rename to sounds/ZV3ACTV2.ogg diff --git a/sounds/DV3ELIM1 b/sounds/ZV3ELIM1.ogg similarity index 100% rename from sounds/DV3ELIM1 rename to sounds/ZV3ELIM1.ogg diff --git a/sounds/DV3ELIM2 b/sounds/ZV3ELIM2.ogg similarity index 100% rename from sounds/DV3ELIM2 rename to sounds/ZV3ELIM2.ogg diff --git a/sounds/DV3ELIM3 b/sounds/ZV3ELIM3.ogg similarity index 100% rename from sounds/DV3ELIM3 rename to sounds/ZV3ELIM3.ogg diff --git a/sounds/DV3HIDE1 b/sounds/ZV3HIDE1.ogg similarity index 100% rename from sounds/DV3HIDE1 rename to sounds/ZV3HIDE1.ogg diff --git a/sounds/DV3HIDE2 b/sounds/ZV3HIDE2.ogg similarity index 100% rename from sounds/DV3HIDE2 rename to sounds/ZV3HIDE2.ogg diff --git a/sounds/DV3HIDE3 b/sounds/ZV3HIDE3.ogg similarity index 100% rename from sounds/DV3HIDE3 rename to sounds/ZV3HIDE3.ogg diff --git a/sounds/DV3HURT1 b/sounds/ZV3HURT1.ogg similarity index 100% rename from sounds/DV3HURT1 rename to sounds/ZV3HURT1.ogg diff --git a/sounds/DV3HURT2 b/sounds/ZV3HURT2.ogg similarity index 100% rename from sounds/DV3HURT2 rename to sounds/ZV3HURT2.ogg diff --git a/sounds/DV3HURT3 b/sounds/ZV3HURT3.ogg similarity index 100% rename from sounds/DV3HURT3 rename to sounds/ZV3HURT3.ogg diff --git a/sounds/DV3IDLE1 b/sounds/ZV3IDLE1.ogg similarity index 100% rename from sounds/DV3IDLE1 rename to sounds/ZV3IDLE1.ogg diff --git a/sounds/DV3IDLE2 b/sounds/ZV3IDLE2.ogg similarity index 100% rename from sounds/DV3IDLE2 rename to sounds/ZV3IDLE2.ogg diff --git a/sounds/DV3IDLE3 b/sounds/ZV3IDLE3.ogg similarity index 100% rename from sounds/DV3IDLE3 rename to sounds/ZV3IDLE3.ogg diff --git a/sounds/DV3IDLE4 b/sounds/ZV3IDLE4.ogg similarity index 100% rename from sounds/DV3IDLE4 rename to sounds/ZV3IDLE4.ogg diff --git a/sounds/DV3IDLE5 b/sounds/ZV3IDLE5.ogg similarity index 100% rename from sounds/DV3IDLE5 rename to sounds/ZV3IDLE5.ogg diff --git a/sounds/DV3IDLE6 b/sounds/ZV3IDLE6.ogg similarity index 100% rename from sounds/DV3IDLE6 rename to sounds/ZV3IDLE6.ogg diff --git a/sounds/DV3IDLE7 b/sounds/ZV3IDLE7.ogg similarity index 100% rename from sounds/DV3IDLE7 rename to sounds/ZV3IDLE7.ogg diff --git a/sounds/DV3TARG1 b/sounds/ZV3TARG1.ogg similarity index 100% rename from sounds/DV3TARG1 rename to sounds/ZV3TARG1.ogg diff --git a/sounds/DV3TARG2 b/sounds/ZV3TARG2.ogg similarity index 100% rename from sounds/DV3TARG2 rename to sounds/ZV3TARG2.ogg diff --git a/sounds/DV3TARG3 b/sounds/ZV3TARG3.ogg similarity index 100% rename from sounds/DV3TARG3 rename to sounds/ZV3TARG3.ogg