tweak: aiming code a little tweaked to reduce headshot ratio

fix: fix crash with metamod since last commits
add: mark last selected goals within round as used, so bots will take cover all the map
This commit is contained in:
dmitry 2021-09-17 12:30:55 +03:00
commit e5ae2ac3f8
No known key found for this signature in database
GPG key ID: 8297CE728B7A7E37
3 changed files with 18 additions and 14 deletions

View file

@ -3227,12 +3227,16 @@ void Bot::normal_ () {
// did we already decide about a goal before?
auto currIndex = getTask ()->data;
auto destIndex = graph.exists (currIndex) && !isBannedNode (currIndex) ? currIndex : findBestGoal ();
auto destIndex = graph.exists (currIndex) && !isBannedNode (currIndex) && m_prevGoalIndex != currIndex ? currIndex : findBestGoal ();
// check for existance (this is failover, for i.e. csdm, this should be not true with normal gameplay, only when spawned outside of waypointed area)
if (!graph.exists (destIndex)) {
destIndex = graph.getFarest (pev->origin, 512.0f);
}
if (m_prevGoalIndex == currIndex && !(graph[currIndex].flags & NodeFlag::Goal)) {
m_goalHistory.push (currIndex);
}
m_prevGoalIndex = destIndex;
// remember index
@ -5520,7 +5524,7 @@ bool Bot::canSkipNextTrace (TraceChannel channel) {
// for optmization purposes skip every second traceline fired, this doesn't affect ai
// behaviour too much, but saves alot of cpu cycles.
constexpr auto kSkipTrace = 4;
constexpr auto kSkipTrace = 3;
// check if we're have to skip
if ((++m_traceSkip[channel] % kSkipTrace) == 0) {