mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-30 22:15:32 +00:00
Reset lastHitObject when it is retrieved rather than every frame
This seems to be how vanilla MW does it.
This commit is contained in:
parent
a355550cab
commit
5f00a3d5c3
2 changed files with 2 additions and 9 deletions
|
@ -1122,15 +1122,6 @@ namespace MWMechanics
|
||||||
// target lists get updated once every 1.0 sec
|
// target lists get updated once every 1.0 sec
|
||||||
if (timerUpdateAITargets >= 1.0f) timerUpdateAITargets = 0;
|
if (timerUpdateAITargets >= 1.0f) timerUpdateAITargets = 0;
|
||||||
|
|
||||||
// Reset data from previous frame
|
|
||||||
for (PtrControllerMap::iterator iter(mActors.begin()); iter != mActors.end(); ++iter)
|
|
||||||
{
|
|
||||||
// Reset last hit object, which is only valid for one frame
|
|
||||||
// Note, the new hit object for this frame may be set by CharacterController::update -> Animation::runAnimation
|
|
||||||
// (below)
|
|
||||||
iter->first.getClass().getCreatureStats(iter->first).setLastHitObject(std::string());
|
|
||||||
}
|
|
||||||
|
|
||||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||||
|
|
||||||
int hostilesCount = 0; // need to know this to play Battle music
|
int hostilesCount = 0; // need to know this to play Battle music
|
||||||
|
|
|
@ -732,6 +732,8 @@ namespace MWScript
|
||||||
|
|
||||||
MWMechanics::CreatureStats &stats = ptr.getClass().getCreatureStats(ptr);
|
MWMechanics::CreatureStats &stats = ptr.getClass().getCreatureStats(ptr);
|
||||||
runtime.push(::Misc::StringUtils::ciEqual(objectID, stats.getLastHitObject()));
|
runtime.push(::Misc::StringUtils::ciEqual(objectID, stats.getLastHitObject()));
|
||||||
|
|
||||||
|
stats.setLastHitObject(std::string());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue