Skip to content

Commit

Permalink
Merge branch 'invisibilityagain' into 'master'
Browse files Browse the repository at this point in the history
Improve invisibility breaking consistency (bug #7660)

Closes #7660

See merge request OpenMW/openmw!3539
  • Loading branch information
Assumeru committed Nov 2, 2023
2 parents 4445a55 + 2d38ca4 commit 3baefdf
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@
Bug #7639: NPCs don't use hand-to-hand if their other melee skills were damaged during combat
Bug #7642: Items in repair and recharge menus aren't sorted alphabetically
Bug #7647: NPC walk cycle bugs after greeting player
Bug #7660: Some inconsistencies regarding Invisibility breaking
Feature #3537: Shader-based water ripples
Feature #5492: Let rain and snow collide with statics
Feature #6149: Dehardcode Lua API_REVISION
Expand Down
8 changes: 6 additions & 2 deletions apps/openmw/mwclass/actor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,12 +95,16 @@ namespace MWClass

bool Actor::consume(const MWWorld::Ptr& consumable, const MWWorld::Ptr& actor) const
{
MWBase::Environment::get().getWorld()->breakInvisibility(actor);
MWMechanics::CastSpell cast(actor, actor);
const ESM::RefId& recordId = consumable.getCellRef().getRefId();
MWBase::Environment::get().getWorldModel()->registerPtr(consumable);
MWBase::Environment::get().getLuaManager()->itemConsumed(consumable, actor);
actor.getClass().getContainerStore(actor).remove(consumable, 1);
return cast.cast(recordId);
if (cast.cast(recordId))
{
MWBase::Environment::get().getWorld()->breakInvisibility(actor);
return true;
}
return false;
}
}
2 changes: 2 additions & 0 deletions apps/openmw/mwmechanics/alchemy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -510,6 +510,8 @@ MWMechanics::Alchemy::Result MWMechanics::Alchemy::create(const std::string& nam
if (readyStatus != Result_Success)
return readyStatus;

MWBase::Environment::get().getWorld()->breakInvisibility(mAlchemist);

Result result = Result_RandomFailure;
int brewedCount = 0;
for (int i = 0; i < count; ++i)
Expand Down
2 changes: 2 additions & 0 deletions apps/openmw/mwmechanics/recharge.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ namespace MWMechanics
MWWorld::Ptr player = MWMechanics::getPlayer();
MWMechanics::CreatureStats& stats = player.getClass().getCreatureStats(player);

MWBase::Environment::get().getWorld()->breakInvisibility(player);

float luckTerm = 0.1f * stats.getAttribute(ESM::Attribute::Luck).getModified();
if (luckTerm < 1 || luckTerm > 10)
luckTerm = 1;
Expand Down
2 changes: 2 additions & 0 deletions apps/openmw/mwmechanics/repair.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ namespace MWMechanics
MWWorld::Ptr player = getPlayer();
MWWorld::LiveCellRef<ESM::Repair>* ref = mTool.get<ESM::Repair>();

MWBase::Environment::get().getWorld()->breakInvisibility(player);

// unstack tool if required
player.getClass().getContainerStore(player).unstack(mTool);

Expand Down

0 comments on commit 3baefdf

Please sign in to comment.