mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-30 21:32:42 +00:00
Consider taking items from unconscious NPC as a theft
This commit is contained in:
parent
04452b0949
commit
34895157f9
@ -238,7 +238,7 @@ namespace MWBase
|
|||||||
/// Has the player stolen this item from the given owner?
|
/// Has the player stolen this item from the given owner?
|
||||||
virtual bool isItemStolenFrom(const std::string& itemid, const std::string& ownerid) = 0;
|
virtual bool isItemStolenFrom(const std::string& itemid, const std::string& ownerid) = 0;
|
||||||
|
|
||||||
virtual bool isAllowedToUse (const MWWorld::Ptr& ptr, const MWWorld::ConstPtr& item, MWWorld::Ptr& victim) = 0;
|
virtual bool isAllowedToUse (const MWWorld::Ptr& ptr, const MWWorld::Ptr& target, MWWorld::Ptr& victim) = 0;
|
||||||
|
|
||||||
/// Turn actor into werewolf or normal form.
|
/// Turn actor into werewolf or normal form.
|
||||||
virtual void setWerewolf(const MWWorld::Ptr& actor, bool werewolf) = 0;
|
virtual void setWerewolf(const MWWorld::Ptr& actor, bool werewolf) = 0;
|
||||||
|
@ -325,7 +325,7 @@ namespace MWGui
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ToolTips::setFocusObject(const MWWorld::ConstPtr& focus)
|
void ToolTips::setFocusObject(const MWWorld::Ptr& focus)
|
||||||
{
|
{
|
||||||
mFocusObject = focus;
|
mFocusObject = focus;
|
||||||
|
|
||||||
|
@ -59,7 +59,7 @@ namespace MWGui
|
|||||||
|
|
||||||
void setDelay(float delay);
|
void setDelay(float delay);
|
||||||
|
|
||||||
void setFocusObject(const MWWorld::ConstPtr& focus);
|
void setFocusObject(const MWWorld::Ptr& focus);
|
||||||
void setFocusObjectScreenCoords(float min_x, float min_y, float max_x, float max_y);
|
void setFocusObjectScreenCoords(float min_x, float min_y, float max_x, float max_y);
|
||||||
///< set the screen-space position of the tooltip for focused object
|
///< set the screen-space position of the tooltip for focused object
|
||||||
|
|
||||||
@ -96,7 +96,7 @@ namespace MWGui
|
|||||||
private:
|
private:
|
||||||
MyGUI::Widget* mDynamicToolTipBox;
|
MyGUI::Widget* mDynamicToolTipBox;
|
||||||
|
|
||||||
MWWorld::ConstPtr mFocusObject;
|
MWWorld::Ptr mFocusObject;
|
||||||
|
|
||||||
MyGUI::IntSize getToolTipViaPtr (int count, bool image=true);
|
MyGUI::IntSize getToolTipViaPtr (int count, bool image=true);
|
||||||
///< @return requested tooltip size
|
///< @return requested tooltip size
|
||||||
|
@ -1573,7 +1573,7 @@ namespace MWGui
|
|||||||
|
|
||||||
mMessageBoxManager->clear();
|
mMessageBoxManager->clear();
|
||||||
|
|
||||||
mToolTips->setFocusObject(MWWorld::ConstPtr());
|
mToolTips->setFocusObject(MWWorld::Ptr());
|
||||||
|
|
||||||
mSelectedSpell.clear();
|
mSelectedSpell.clear();
|
||||||
mCustomMarkers.clear();
|
mCustomMarkers.clear();
|
||||||
|
@ -840,17 +840,30 @@ namespace MWMechanics
|
|||||||
mAI = true;
|
mAI = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MechanicsManager::isAllowedToUse (const MWWorld::Ptr& ptr, const MWWorld::ConstPtr& item, MWWorld::Ptr& victim)
|
bool MechanicsManager::isAllowedToUse (const MWWorld::Ptr& ptr, const MWWorld::Ptr& target, MWWorld::Ptr& victim)
|
||||||
{
|
{
|
||||||
const MWWorld::CellRef& cellref = item.getCellRef();
|
const MWWorld::CellRef& cellref = target.getCellRef();
|
||||||
// there is no harm to use unlocked doors
|
// there is no harm to use unlocked doors
|
||||||
if (item.getClass().isDoor() && cellref.getLockLevel() <= 0 && ptr.getCellRef().getTrap().empty())
|
if (target.getClass().isDoor() && cellref.getLockLevel() <= 0 && ptr.getCellRef().getTrap().empty())
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
// TODO: implement a better check to check if item is owned bed
|
// TODO: implement a better check to check if target is owned bed
|
||||||
if (item.getClass().isActivator() && item.getClass().getScript(item).compare(0, 3, "Bed") != 0)
|
if (target.getClass().isActivator() && target.getClass().getScript(target).compare(0, 3, "Bed") != 0)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
if (target.getClass().isNpc())
|
||||||
|
{
|
||||||
|
if (target.getClass().getCreatureStats(target).isDead())
|
||||||
|
return true;
|
||||||
|
|
||||||
|
// check if a player tries to pickpocket a target NPC
|
||||||
|
if(ptr.getClass().getCreatureStats(ptr).getStance(MWMechanics::CreatureStats::Stance_Sneak)
|
||||||
|
|| target.getClass().getCreatureStats(target).getKnockedDown())
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
const std::string& owner = cellref.getOwner();
|
const std::string& owner = cellref.getOwner();
|
||||||
bool isOwned = !owner.empty() && owner != "player";
|
bool isOwned = !owner.empty() && owner != "player";
|
||||||
|
|
||||||
|
@ -204,8 +204,8 @@ namespace MWMechanics
|
|||||||
/// Has the player stolen this item from the given owner?
|
/// Has the player stolen this item from the given owner?
|
||||||
virtual bool isItemStolenFrom(const std::string& itemid, const std::string& ownerid);
|
virtual bool isItemStolenFrom(const std::string& itemid, const std::string& ownerid);
|
||||||
|
|
||||||
/// @return is \a ptr allowed to take/use \a cellref or is it a crime?
|
/// @return is \a ptr allowed to take/use \a target or is it a crime?
|
||||||
virtual bool isAllowedToUse (const MWWorld::Ptr& ptr, const MWWorld::ConstPtr& item, MWWorld::Ptr& victim);
|
virtual bool isAllowedToUse (const MWWorld::Ptr& ptr, const MWWorld::Ptr& target, MWWorld::Ptr& victim);
|
||||||
|
|
||||||
virtual void setWerewolf(const MWWorld::Ptr& actor, bool werewolf);
|
virtual void setWerewolf(const MWWorld::Ptr& actor, bool werewolf);
|
||||||
virtual void applyWerewolfAcrobatics(const MWWorld::Ptr& actor);
|
virtual void applyWerewolfAcrobatics(const MWWorld::Ptr& actor);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user