Mark enemy sensing / hearing stuff as heavyweight.
This commit is contained in:
parent
dfef288b47
commit
bee9653a71
4 changed files with 18 additions and 2 deletions
|
|
@ -582,6 +582,7 @@ private:
|
||||||
|
|
||||||
float m_headedTime;
|
float m_headedTime;
|
||||||
float m_prevTime; // time previously checked movement speed
|
float m_prevTime; // time previously checked movement speed
|
||||||
|
float m_heavyTimestamp; // is it time to execute heavy-weight functions
|
||||||
float m_prevSpeed; // speed some frames before
|
float m_prevSpeed; // speed some frames before
|
||||||
float m_timeDoorOpen; // time to next door open check
|
float m_timeDoorOpen; // time to next door open check
|
||||||
float m_lastChatTime; // time bot last chatted
|
float m_lastChatTime; // time bot last chatted
|
||||||
|
|
@ -758,6 +759,7 @@ private:
|
||||||
bool isReachableNode (int index);
|
bool isReachableNode (int index);
|
||||||
bool updateLiftHandling ();
|
bool updateLiftHandling ();
|
||||||
bool updateLiftStates ();
|
bool updateLiftStates ();
|
||||||
|
bool canRunHeavyWeight ();
|
||||||
|
|
||||||
void instantChatter (int type);
|
void instantChatter (int type);
|
||||||
void update ();
|
void update ();
|
||||||
|
|
|
||||||
|
|
@ -1834,7 +1834,6 @@ void Bot::setConditions () {
|
||||||
|
|
||||||
// check if there are items needing to be used/collected
|
// check if there are items needing to be used/collected
|
||||||
if (m_itemCheckTime < game.time () || !game.isNullEntity (m_pickupItem)) {
|
if (m_itemCheckTime < game.time () || !game.isNullEntity (m_pickupItem)) {
|
||||||
|
|
||||||
updatePickups ();
|
updatePickups ();
|
||||||
m_itemCheckTime = game.time () + 0.5f;
|
m_itemCheckTime = game.time () + 0.5f;
|
||||||
}
|
}
|
||||||
|
|
@ -4735,7 +4734,9 @@ void Bot::logic () {
|
||||||
}
|
}
|
||||||
|
|
||||||
// do all sensing, calculate/filter all actions here
|
// do all sensing, calculate/filter all actions here
|
||||||
setConditions ();
|
if (canRunHeavyWeight ()) {
|
||||||
|
setConditions ();
|
||||||
|
}
|
||||||
|
|
||||||
// some stuff required by by chatter engine
|
// some stuff required by by chatter engine
|
||||||
if (yb_radio_mode.int_ () == 2) {
|
if (yb_radio_mode.int_ () == 2) {
|
||||||
|
|
@ -5504,6 +5505,17 @@ uint8 Bot::computeMsec () {
|
||||||
return static_cast <uint8> ((game.time () - m_lastCommandTime) * 1000.0f);
|
return static_cast <uint8> ((game.time () - m_lastCommandTime) * 1000.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Bot::canRunHeavyWeight () {
|
||||||
|
constexpr auto interval = 1.0f / 10.0f;
|
||||||
|
|
||||||
|
if (m_heavyTimestamp + interval < game.time ()) {
|
||||||
|
m_heavyTimestamp = game.time ();
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
void Bot::runMovement () {
|
void Bot::runMovement () {
|
||||||
// the purpose of this function is to compute, according to the specified computation
|
// the purpose of this function is to compute, according to the specified computation
|
||||||
// method, the msec value which will be passed as an argument of pfnRunPlayerMove. This
|
// method, the msec value which will be passed as an argument of pfnRunPlayerMove. This
|
||||||
|
|
|
||||||
|
|
@ -96,6 +96,7 @@ bool Bot::checkBodyParts (edict_t *target) {
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
TraceResult result;
|
TraceResult result;
|
||||||
auto eyes = getEyesPos ();
|
auto eyes = getEyesPos ();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -854,6 +854,7 @@ Bot::Bot (edict_t *bot, int difficulty, int personality, int team, int member) {
|
||||||
|
|
||||||
m_lastCommandTime = game.time () - 0.1f;
|
m_lastCommandTime = game.time () - 0.1f;
|
||||||
m_frameInterval = game.time ();
|
m_frameInterval = game.time ();
|
||||||
|
m_heavyTimestamp = game.time ();
|
||||||
m_slowFrameTimestamp = 0.0f;
|
m_slowFrameTimestamp = 0.0f;
|
||||||
|
|
||||||
// stuff from jk_botti
|
// stuff from jk_botti
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue