Possible fix for armoury_entity pickups on some maps.
This commit is contained in:
parent
7a9479bdd0
commit
e2dbd6d91e
2 changed files with 18 additions and 12 deletions
|
|
@ -88,7 +88,7 @@ public:
|
||||||
// singleton for objects
|
// singleton for objects
|
||||||
template <typename T> struct Singleton : private DenyCopying {
|
template <typename T> struct Singleton : private DenyCopying {
|
||||||
public:
|
public:
|
||||||
static inline T &get () {
|
static T &get () {
|
||||||
static T ref_;
|
static T ref_;
|
||||||
return ref_;
|
return ref_;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -491,6 +491,11 @@ void Bot::updatePickups () {
|
||||||
auto pickupItem = m_pickupItem;
|
auto pickupItem = m_pickupItem;
|
||||||
|
|
||||||
for (auto &ent : intresting) {
|
for (auto &ent : intresting) {
|
||||||
|
|
||||||
|
// in the periods of updating intresting entities we can get fake ones, that already were picked up, so double check if drawn
|
||||||
|
if (ent->v.effects & EF_NODRAW) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
const Vector &origin = game.getEntityWorldOrigin (ent);
|
const Vector &origin = game.getEntityWorldOrigin (ent);
|
||||||
|
|
||||||
// too far from us ?
|
// too far from us ?
|
||||||
|
|
@ -502,7 +507,6 @@ void Bot::updatePickups () {
|
||||||
if (seesItem (origin, ent->v.classname.chars ())) {
|
if (seesItem (origin, ent->v.classname.chars ())) {
|
||||||
itemExists = true;
|
itemExists = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -511,13 +515,12 @@ void Bot::updatePickups () {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
m_pickupItem = nullptr;
|
m_pickupItem = nullptr;
|
||||||
m_pickupType = Pickup::None;
|
m_pickupType = Pickup::None;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
edict_t *pickupItem = nullptr;
|
edict_t *pickupItem = nullptr;
|
||||||
|
|
||||||
Pickup pickupType = Pickup::None;
|
Pickup pickupType = Pickup::None;
|
||||||
Vector pickupPos = nullptr;
|
Vector pickupPos = nullptr;
|
||||||
|
|
||||||
|
|
@ -527,7 +530,7 @@ void Bot::updatePickups () {
|
||||||
for (const auto &ent : intresting) {
|
for (const auto &ent : intresting) {
|
||||||
bool allowPickup = false; // assume can't use it until known otherwise
|
bool allowPickup = false; // assume can't use it until known otherwise
|
||||||
|
|
||||||
if (ent == m_itemIgnore) {
|
if ((ent->v.effects & EF_NODRAW) || ent == m_itemIgnore || cr::abs (ent->v.origin.z - pev->origin.z) > 96.0f) {
|
||||||
continue; // someone owns this weapon or it hasn't respawned yet
|
continue; // someone owns this weapon or it hasn't respawned yet
|
||||||
}
|
}
|
||||||
const Vector &origin = game.getEntityWorldOrigin (ent);
|
const Vector &origin = game.getEntityWorldOrigin (ent);
|
||||||
|
|
@ -537,6 +540,7 @@ void Bot::updatePickups () {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
auto classname = ent->v.classname.chars ();
|
auto classname = ent->v.classname.chars ();
|
||||||
auto model = ent->v.model.chars (9);
|
auto model = ent->v.model.chars (9);
|
||||||
|
|
||||||
|
|
@ -4230,6 +4234,7 @@ void Bot::doublejump_ () {
|
||||||
else if (inJump && !(m_oldButtons & IN_JUMP)) {
|
else if (inJump && !(m_oldButtons & IN_JUMP)) {
|
||||||
pev->button |= IN_JUMP;
|
pev->button |= IN_JUMP;
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto &src = pev->origin + Vector (0.0f, 0.0f, 45.0f);
|
const auto &src = pev->origin + Vector (0.0f, 0.0f, 45.0f);
|
||||||
const auto &dest = src + Vector (0.0f, pev->angles.y, 0.0f).upward () * 256.0f;
|
const auto &dest = src + Vector (0.0f, pev->angles.y, 0.0f).upward () * 256.0f;
|
||||||
|
|
||||||
|
|
@ -4260,9 +4265,10 @@ void Bot::doublejump_ () {
|
||||||
|
|
||||||
if (graph.exists (destIndex)) {
|
if (graph.exists (destIndex)) {
|
||||||
m_prevGoalIndex = destIndex;
|
m_prevGoalIndex = destIndex;
|
||||||
getTask ()->data = destIndex;
|
|
||||||
m_travelStartIndex = m_currentNodeIndex;
|
m_travelStartIndex = m_currentNodeIndex;
|
||||||
|
|
||||||
|
getTask ()->data = destIndex;
|
||||||
|
|
||||||
// always take the shortest path
|
// always take the shortest path
|
||||||
findPath (m_currentNodeIndex, destIndex, FindPath::Fast);
|
findPath (m_currentNodeIndex, destIndex, FindPath::Fast);
|
||||||
|
|
||||||
|
|
@ -4932,7 +4938,7 @@ void Bot::showDebugOverlay () {
|
||||||
String pickup = "(none)";
|
String pickup = "(none)";
|
||||||
|
|
||||||
if (!game.isNullEntity (m_pickupItem)) {
|
if (!game.isNullEntity (m_pickupItem)) {
|
||||||
pickup = m_pickupItem->v.netname.chars ();
|
pickup = m_pickupItem->v.classname.chars ();
|
||||||
}
|
}
|
||||||
String aimFlags;
|
String aimFlags;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue