mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-30 13:15:32 +00:00
Disable Ready Magic and Cycle Weapon/Spell hotkeys for werewolves (Fixes #3100)
This commit is contained in:
parent
a7c886721c
commit
53334d08a2
2 changed files with 27 additions and 16 deletions
|
@ -302,16 +302,20 @@ namespace MWInput
|
||||||
quickLoad();
|
quickLoad();
|
||||||
break;
|
break;
|
||||||
case A_CycleSpellLeft:
|
case A_CycleSpellLeft:
|
||||||
MWBase::Environment::get().getWindowManager()->cycleSpell(false);
|
if (checkAllowedToUseItems())
|
||||||
|
MWBase::Environment::get().getWindowManager()->cycleSpell(false);
|
||||||
break;
|
break;
|
||||||
case A_CycleSpellRight:
|
case A_CycleSpellRight:
|
||||||
MWBase::Environment::get().getWindowManager()->cycleSpell(true);
|
if (checkAllowedToUseItems())
|
||||||
|
MWBase::Environment::get().getWindowManager()->cycleSpell(true);
|
||||||
break;
|
break;
|
||||||
case A_CycleWeaponLeft:
|
case A_CycleWeaponLeft:
|
||||||
MWBase::Environment::get().getWindowManager()->cycleWeapon(false);
|
if (checkAllowedToUseItems())
|
||||||
|
MWBase::Environment::get().getWindowManager()->cycleWeapon(false);
|
||||||
break;
|
break;
|
||||||
case A_CycleWeaponRight:
|
case A_CycleWeaponRight:
|
||||||
MWBase::Environment::get().getWindowManager()->cycleWeapon(true);
|
if (checkAllowedToUseItems())
|
||||||
|
MWBase::Environment::get().getWindowManager()->cycleWeapon(true);
|
||||||
break;
|
break;
|
||||||
case A_Sneak:
|
case A_Sneak:
|
||||||
if (mSneakToggles)
|
if (mSneakToggles)
|
||||||
|
@ -346,6 +350,18 @@ namespace MWInput
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool InputManager::checkAllowedToUseItems() const
|
||||||
|
{
|
||||||
|
MWWorld::Ptr player = MWMechanics::getPlayer();
|
||||||
|
if (player.getClass().getNpcStats(player).isWerewolf())
|
||||||
|
{
|
||||||
|
// Cannot use items or spells while in werewolf form
|
||||||
|
MWBase::Environment::get().getWindowManager()->messageBox("#{sWerewolfRefusal}");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
void InputManager::update(float dt, bool disableControls, bool disableEvents)
|
void InputManager::update(float dt, bool disableControls, bool disableEvents)
|
||||||
{
|
{
|
||||||
mControlsDisabled = disableControls;
|
mControlsDisabled = disableControls;
|
||||||
|
@ -902,6 +918,9 @@ namespace MWInput
|
||||||
if (!mControlSwitch["playermagic"] || !mControlSwitch["playercontrols"])
|
if (!mControlSwitch["playermagic"] || !mControlSwitch["playercontrols"])
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (!checkAllowedToUseItems())
|
||||||
|
return;
|
||||||
|
|
||||||
// Not allowed if no spell selected
|
// Not allowed if no spell selected
|
||||||
MWWorld::InventoryStore& inventory = mPlayer->getPlayer().getClass().getInventoryStore(mPlayer->getPlayer());
|
MWWorld::InventoryStore& inventory = mPlayer->getPlayer().getClass().getInventoryStore(mPlayer->getPlayer());
|
||||||
if (MWBase::Environment::get().getWindowManager()->getSelectedSpell().empty() &&
|
if (MWBase::Environment::get().getWindowManager()->getSelectedSpell().empty() &&
|
||||||
|
@ -1016,13 +1035,8 @@ namespace MWInput
|
||||||
{
|
{
|
||||||
if (!mControlSwitch["playercontrols"])
|
if (!mControlSwitch["playercontrols"])
|
||||||
return;
|
return;
|
||||||
MWWorld::Ptr player = MWMechanics::getPlayer();
|
if (!checkAllowedToUseItems())
|
||||||
if (player.getClass().getNpcStats(player).isWerewolf())
|
|
||||||
{
|
|
||||||
// Cannot use items or spells while in werewolf form
|
|
||||||
MWBase::Environment::get().getWindowManager()->messageBox("#{sWerewolfRefusal}");
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
if (!MWBase::Environment::get().getWindowManager()->isGuiMode())
|
if (!MWBase::Environment::get().getWindowManager()->isGuiMode())
|
||||||
MWBase::Environment::get().getWindowManager()->activateQuickKey (index);
|
MWBase::Environment::get().getWindowManager()->activateQuickKey (index);
|
||||||
|
@ -1033,13 +1047,8 @@ namespace MWInput
|
||||||
if (!MWBase::Environment::get().getWindowManager()->isGuiMode ()
|
if (!MWBase::Environment::get().getWindowManager()->isGuiMode ()
|
||||||
&& MWBase::Environment::get().getWorld()->getGlobalFloat ("chargenstate")==-1)
|
&& MWBase::Environment::get().getWorld()->getGlobalFloat ("chargenstate")==-1)
|
||||||
{
|
{
|
||||||
MWWorld::Ptr player = MWMechanics::getPlayer();
|
if (!checkAllowedToUseItems())
|
||||||
if (player.getClass().getNpcStats(player).isWerewolf())
|
|
||||||
{
|
|
||||||
// Cannot use items or spells while in werewolf form
|
|
||||||
MWBase::Environment::get().getWindowManager()->messageBox("#{sWerewolfRefusal}");
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
MWBase::Environment::get().getWindowManager()->pushGuiMode (MWGui::GM_QuickKeysMenu);
|
MWBase::Environment::get().getWindowManager()->pushGuiMode (MWGui::GM_QuickKeysMenu);
|
||||||
|
|
||||||
|
|
|
@ -213,6 +213,8 @@ namespace MWInput
|
||||||
|
|
||||||
void updateCursorMode();
|
void updateCursorMode();
|
||||||
|
|
||||||
|
bool checkAllowedToUseItems() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void toggleMainMenu();
|
void toggleMainMenu();
|
||||||
void toggleSpell();
|
void toggleSpell();
|
||||||
|
|
Loading…
Reference in a new issue