1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-20 07:23:51 +00:00

Don't use up light duration if the held light is hidden (bug #5352)

This commit is contained in:
Capostrophic 2020-04-04 19:20:52 +03:00
parent 0ce953ff7d
commit 1928bebe98
5 changed files with 20 additions and 10 deletions

View file

@ -211,6 +211,7 @@
Bug #5326: Formatting issues in the settings.cfg Bug #5326: Formatting issues in the settings.cfg
Bug #5328: Skills aren't properly reset for dead actors Bug #5328: Skills aren't properly reset for dead actors
Bug #5345: Dopey Necromancy does not work due to a missing quote Bug #5345: Dopey Necromancy does not work due to a missing quote
Bug #5352: Light source items' duration is decremented while they aren't visible
Feature #1774: Handle AvoidNode Feature #1774: Handle AvoidNode
Feature #2229: Improve pathfinding AI Feature #2229: Improve pathfinding AI
Feature #3025: Analogue gamepad movement controls Feature #3025: Analogue gamepad movement controls

View file

@ -1267,6 +1267,10 @@ namespace MWMechanics
{ {
// Use time from the player's light // Use time from the player's light
if(isPlayer) if(isPlayer)
{
// But avoid using it up if the light source is hidden
MWRender::Animation *anim = MWBase::Environment::get().getWorld()->getAnimation(ptr);
if (anim && anim->getCarriedLeftShown())
{ {
float timeRemaining = heldIter->getClass().getRemainingUsageTime(*heldIter); float timeRemaining = heldIter->getClass().getRemainingUsageTime(*heldIter);
@ -1274,14 +1278,14 @@ namespace MWMechanics
if (timeRemaining != -1.0f) if (timeRemaining != -1.0f)
{ {
timeRemaining -= duration; timeRemaining -= duration;
if (timeRemaining <= 0.f)
if(timeRemaining > 0.0f)
heldIter->getClass().setRemainingUsageTime(*heldIter, timeRemaining);
else
{ {
inventoryStore.remove(*heldIter, 1, ptr); // remove it inventoryStore.remove(*heldIter, 1, ptr); // remove it
return; return;
} }
heldIter->getClass().setRemainingUsageTime(*heldIter, timeRemaining);
}
} }
} }

View file

@ -459,6 +459,7 @@ public:
virtual bool useShieldAnimations() const { return false; } virtual bool useShieldAnimations() const { return false; }
virtual void showWeapons(bool showWeapon) {} virtual void showWeapons(bool showWeapon) {}
virtual bool getCarriedLeftShown() const { return false; }
virtual void showCarriedLeft(bool show) {} virtual void showCarriedLeft(bool show) {}
virtual void setWeaponGroup(const std::string& group, bool relativeDuration) {} virtual void setWeaponGroup(const std::string& group, bool relativeDuration) {}
virtual void setVampire(bool vampire) {} virtual void setVampire(bool vampire) {}

View file

@ -31,6 +31,8 @@ namespace MWRender
virtual void equipmentChanged() { updateParts(); } virtual void equipmentChanged() { updateParts(); }
virtual void showWeapons(bool showWeapon); virtual void showWeapons(bool showWeapon);
virtual bool getCarriedLeftShown() const { return mShowCarriedLeft; }
virtual void showCarriedLeft(bool show); virtual void showCarriedLeft(bool show);
void updateParts(); void updateParts();

View file

@ -129,6 +129,8 @@ public:
virtual void setPitchFactor(float factor) { mPitchFactor = factor; } virtual void setPitchFactor(float factor) { mPitchFactor = factor; }
virtual void showWeapons(bool showWeapon); virtual void showWeapons(bool showWeapon);
virtual bool getCarriedLeftShown() const { return mShowCarriedLeft; }
virtual void showCarriedLeft(bool show); virtual void showCarriedLeft(bool show);
virtual void attachArrow(); virtual void attachArrow();