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:
parent
0ce953ff7d
commit
1928bebe98
5 changed files with 20 additions and 10 deletions
|
@ -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
|
||||||
|
|
|
@ -1267,21 +1267,25 @@ 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);
|
||||||
|
|
||||||
// -1 is infinite light source. Other negative values are treated as 0.
|
// -1 is infinite light source. Other negative values are treated as 0.
|
||||||
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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) {}
|
||||||
|
|
|
@ -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();
|
||||||
|
|
|
@ -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();
|
||||||
|
|
Loading…
Reference in a new issue