mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-04-28 12:58:00 +03:00
Merge branch 'maluu-apa-bosku' into 'master'
Some checks are pending
Build and test / Ubuntu (push) Waiting to run
Build and test / MacOS (push) Waiting to run
Build and test / Read .env file and expose it as output (push) Waiting to run
Build and test / Windows (2019) (push) Blocked by required conditions
Build and test / Windows (2022) (push) Blocked by required conditions
Some checks are pending
Build and test / Ubuntu (push) Waiting to run
Build and test / MacOS (push) Waiting to run
Build and test / Read .env file and expose it as output (push) Waiting to run
Build and test / Windows (2019) (push) Blocked by required conditions
Build and test / Windows (2022) (push) Blocked by required conditions
Play down sound when equip fails Closes #7371 See merge request OpenMW/openmw!4248
This commit is contained in:
commit
42ad4b55e7
3 changed files with 47 additions and 49 deletions
|
@ -107,6 +107,7 @@
|
|||
Bug #7353: Normal Map Crashes with Starwind Assets in TES3MP and OpenMW
|
||||
Bug #7354: Disabling post processing in-game causes a crash
|
||||
Bug #7364: Post processing is not reflected in savegame previews
|
||||
Bug #7371: Equipping item from inventory does not play a Down sound when equipping fails
|
||||
Bug #7380: NiZBufferProperty issue
|
||||
Bug #7413: Generated wilderness cells don't spawn fish
|
||||
Bug #7415: Unbreakable lock discrepancies
|
||||
|
|
|
@ -520,33 +520,15 @@ namespace MWGui
|
|||
}
|
||||
|
||||
MWWorld::Ptr player = MWMechanics::getPlayer();
|
||||
bool canUse = true;
|
||||
|
||||
// early-out for items that need to be equipped, but can't be equipped: we don't want to set OnPcEquip in that
|
||||
// case
|
||||
if (!ptr.getClass().getEquipmentSlots(ptr).first.empty())
|
||||
{
|
||||
if (ptr.getClass().hasItemHealth(ptr) && ptr.getCellRef().getCharge() == 0)
|
||||
{
|
||||
MWBase::Environment::get().getWindowManager()->messageBox("#{sInventoryMessage1}");
|
||||
updateItemView();
|
||||
return;
|
||||
}
|
||||
|
||||
if (!force)
|
||||
{
|
||||
auto canEquip = ptr.getClass().canBeEquipped(ptr, player);
|
||||
|
||||
if (canEquip.first == 0)
|
||||
{
|
||||
MWBase::Environment::get().getWindowManager()->messageBox(canEquip.second);
|
||||
updateItemView();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
// We don't want to set OnPcEquip for items that need to be equipped; but cannot be equipped;
|
||||
if (!ptr.getClass().getEquipmentSlots(ptr).first.empty()
|
||||
&& ptr.getClass().canBeEquipped(ptr, player).first == 0)
|
||||
canUse = force && ptr.getClass().hasItemHealth(ptr) && ptr.getCellRef().getCharge() != 0;
|
||||
|
||||
// If the item has a script, set OnPCEquip or PCSkipEquip to 1
|
||||
if (!script.empty())
|
||||
if (!script.empty() && canUse)
|
||||
{
|
||||
// Ingredients, books and repair hammers must not have OnPCEquip set to 1 here
|
||||
auto type = ptr.getType();
|
||||
|
@ -559,7 +541,25 @@ namespace MWGui
|
|||
}
|
||||
|
||||
std::unique_ptr<MWWorld::Action> action = ptr.getClass().use(ptr, force);
|
||||
action->execute(player);
|
||||
|
||||
action->execute(player, !canUse);
|
||||
|
||||
if (mDragAndDrop->mIsOnDragAndDrop && mDragAndDrop->mItem.mBase == ptr)
|
||||
{
|
||||
if (canUse)
|
||||
{
|
||||
mDragAndDrop->finish();
|
||||
// If item is ingredient or potion don't stop drag and drop
|
||||
if ((ptr.getType() == ESM::Potion::sRecordId || ptr.getType() == ESM::Ingredient::sRecordId)
|
||||
&& mDragAndDrop->mDraggedCount > 1)
|
||||
{
|
||||
mSelectedItem = getModel()->getIndex(mDragAndDrop->mItem);
|
||||
dragItem(nullptr, mDragAndDrop->mDraggedCount - 1);
|
||||
}
|
||||
}
|
||||
else
|
||||
mDragAndDrop->drop(mTradeModel, mItemView);
|
||||
}
|
||||
|
||||
// Handles partial equipping (final part)
|
||||
if (mEquippedStackableCount.has_value())
|
||||
|
@ -590,8 +590,6 @@ namespace MWGui
|
|||
{
|
||||
MWWorld::Ptr ptr = mDragAndDrop->mItem.mBase;
|
||||
|
||||
mDragAndDrop->finish();
|
||||
|
||||
if (mDragAndDrop->mSourceModel != mTradeModel)
|
||||
{
|
||||
// Move item to the player's inventory
|
||||
|
@ -615,17 +613,6 @@ namespace MWGui
|
|||
}
|
||||
|
||||
MWBase::Environment::get().getLuaManager()->useItem(ptr, MWMechanics::getPlayer(), false);
|
||||
|
||||
// If item is ingredient or potion don't stop drag and drop to simplify action of taking more than one 1
|
||||
// item
|
||||
if ((ptr.getType() == ESM::Potion::sRecordId || ptr.getType() == ESM::Ingredient::sRecordId)
|
||||
&& mDragAndDrop->mDraggedCount > 1)
|
||||
{
|
||||
// Item can be provided from other window for example container.
|
||||
// But after DragAndDrop::startDrag item automaticly always gets to player inventory.
|
||||
mSelectedItem = getModel()->getIndex(mDragAndDrop->mItem);
|
||||
dragItem(nullptr, mDragAndDrop->mDraggedCount - 1);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -84,9 +84,8 @@ namespace MWGui
|
|||
case ESM::QuickKeys::Type::MagicItem:
|
||||
{
|
||||
MWWorld::Ptr item = *mKey[index].button->getUserData<MWWorld::Ptr>();
|
||||
// Make sure the item is available and is not broken
|
||||
if (item.isEmpty() || item.getCellRef().getCount() < 1
|
||||
|| (item.getClass().hasItemHealth(item) && item.getClass().getItemHealth(item) <= 0))
|
||||
// Make sure the item is available
|
||||
if (item.isEmpty() || item.getCellRef().getCount() < 1)
|
||||
{
|
||||
// Try searching for a compatible replacement
|
||||
item = store.findReplacement(mKey[index].id);
|
||||
|
@ -382,18 +381,29 @@ namespace MWGui
|
|||
if (it == store.end())
|
||||
item = nullptr;
|
||||
|
||||
// check the item is available and not broken
|
||||
if (item.isEmpty() || item.getCellRef().getCount() < 1
|
||||
|| (item.getClass().hasItemHealth(item) && item.getClass().getItemHealth(item) <= 0))
|
||||
// check the quickkey item is available
|
||||
if (item.isEmpty() || item.getCellRef().getCount() < 1)
|
||||
{
|
||||
item = store.findReplacement(key->id);
|
||||
MWBase::Environment::get().getWindowManager()->messageBox("#{sQuickMenu5} " + key->name);
|
||||
return;
|
||||
}
|
||||
|
||||
if (item.isEmpty() || item.getCellRef().getCount() < 1)
|
||||
// check the quickkey item is not broken
|
||||
if (item.getClass().hasItemHealth(item) && item.getClass().getItemHealth(item) <= 0)
|
||||
{
|
||||
const std::vector<int>& equipmentSlots = item.getClass().getEquipmentSlots(item).first;
|
||||
if (!equipmentSlots.empty())
|
||||
{
|
||||
MWBase::Environment::get().getWindowManager()->messageBox("#{sQuickMenu5} " + key->name);
|
||||
|
||||
return;
|
||||
const auto& itSlot = store.getSlot(equipmentSlots.front());
|
||||
// Morrowind.exe behaviour:
|
||||
// Only display item broken message if;
|
||||
// no item in the to-be-equipped slot
|
||||
// or broken quickkey item and currently equipped item id is different
|
||||
// It doesn't find a replacement
|
||||
if (itSlot == store.end() || (item.getCellRef().getRefId() != itSlot->getCellRef().getRefId()))
|
||||
MWBase::Environment::get().getWindowManager()->messageBox("#{sInventoryMessage1}");
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (key->type == ESM::QuickKeys::Type::Item)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue