1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-02-06 16:15:33 +00:00

extracted function reactionTimeActions().

This commit is contained in:
dteviot 2015-07-26 17:28:32 +12:00
parent 9c0e3d6c28
commit ad0d807103
2 changed files with 10 additions and 5 deletions

View file

@ -199,15 +199,18 @@ namespace MWMechanics
float& lastReaction = storage.mReaction;
lastReaction += duration;
if(lastReaction < REACTION_INTERVAL)
if (REACTION_INTERVAL <= lastReaction)
{
return false;
lastReaction = 0;
return reactionTimeActions(actor, storage, currentCell, cellChange, pos);
}
else
lastReaction = 0;
// NOTE: everything below get updated every REACTION_INTERVAL seconds
return false;
}
bool AiWander::reactionTimeActions(const MWWorld::Ptr& actor, AiWanderStorage& storage,
const MWWorld::CellStore*& currentCell, bool cellChange, ESM::Position& pos)
{
if(mDuration)
{
// End package if duration is complete or mid-night hits:

View file

@ -87,6 +87,8 @@ namespace MWMechanics
void onIdleStatePerFrameActions(const MWWorld::Ptr& actor, float duration, AiWanderStorage& storage);
void onWalkingStatePerFrameActions(const MWWorld::Ptr& actor, float duration, AiWanderStorage& storage, ESM::Position& pos);
void onChooseActionStatePerFrameActions(const MWWorld::Ptr& actor, AiWanderStorage& storage);
bool reactionTimeActions(const MWWorld::Ptr& actor, AiWanderStorage& storage,
const MWWorld::CellStore*& currentCell, bool cellChange, ESM::Position& pos);
int mDistance; // how far the actor can wander from the spawn point
int mDuration;