Skip to content

Commit c9c5d79

Browse files
committed
1 parent 48ec7eb commit c9c5d79

File tree

2 files changed

+73
-0
lines changed

2 files changed

+73
-0
lines changed

src/game/server/tf/bot/behavior/tf_bot_behavior.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -497,6 +497,11 @@ EventDesiredResult< CTFBot > CTFBotMainAction::OnStuck( CTFBot *me )
497497
}
498498
*/
499499

500+
#ifdef BDSBASE
501+
if (me->m_Shared.InCond(TF_COND_HALLOWEEN_KART) || me->m_Shared.InCond(TF_COND_TAUNTING) || me->IsInAVehicle())
502+
return TryContinue();
503+
#endif
504+
500505
if ( TFGameRules()->IsMannVsMachineMode() )
501506
{
502507
if ( me->m_Shared.InCond( TF_COND_MVM_BOT_STUN_RADIOWAVE ) )
@@ -1593,6 +1598,11 @@ void CTFBotMainAction::Dodge( CTFBot *me )
15931598
if ( me->m_Shared.InCond( TF_COND_TAUNTING ) )
15941599
return;
15951600

1601+
#ifdef BDSBASE
1602+
if ( me->m_Shared.InCond(TF_COND_HALLOWEEN_KART) || me->IsInAVehicle())
1603+
return;
1604+
#endif
1605+
15961606
// don't dodge if that ability is "turned off"
15971607
if ( me->HasAttribute( CTFBot::DISABLE_DODGE ) )
15981608
return;

src/game/server/tf/bot/tf_bot_locomotion.cpp

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,69 @@ void CTFBotLocomotion::Approach( const Vector &pos, float goalWeight )
6868
}
6969
}
7070

71+
#ifdef BDSBASE
72+
CTFBot* me = ToTFBot(GetBot()->GetEntity());
73+
if (!me)
74+
{
75+
return;
76+
}
77+
78+
if (me->m_Shared.InCond(TF_COND_HALLOWEEN_KART) && me->IsInAVehicle())
79+
{
80+
me->ReleaseForwardButton();
81+
me->ReleaseBackwardButton();
82+
me->ReleaseLeftButton();
83+
me->ReleaseRightButton();
84+
85+
Vector dir = (pos - me->GetAbsOrigin());
86+
dir.z = 0.0f;
87+
dir.NormalizeInPlace();
88+
89+
Vector eye; me->EyeVectors(&eye);
90+
eye.z = 0.0f;
91+
eye.NormalizeInPlace();
92+
93+
Vector eye_90 = Vector(eye.y, -eye.x, 0.0f);
94+
95+
float fwd = dir.Dot(eye);
96+
float side = dir.Dot(eye_90);
97+
98+
if (fwd > 0.50f)
99+
{
100+
me->PressForwardButton();
101+
}
102+
/* else if (fwd < -0.50f)
103+
{
104+
me->PressBackwardButton();
105+
}*/
106+
107+
const float cos_3deg = cos(DEG2RAD(3.0f));
108+
109+
if (fwd > 0.0f && fwd < cos_3deg)
110+
{
111+
if (side > 0.0f)
112+
{
113+
me->PressRightButton();
114+
}
115+
else
116+
{
117+
me->PressLeftButton();
118+
}
119+
}
120+
else if (fwd > -cos_3deg)
121+
{
122+
if (side > 0.0f)
123+
{
124+
me->PressLeftButton();
125+
}
126+
else
127+
{
128+
me->PressRightButton();
129+
}
130+
}
131+
}
132+
#endif
133+
71134
BaseClass::Approach( pos, goalWeight );
72135
}
73136

0 commit comments

Comments
 (0)