forked from mirror/openmw-tes3mp
Failed action
This commit is contained in:
parent
ba2fc2d6f8
commit
82ea547ce4
6 changed files with 55 additions and 9 deletions
|
@ -50,7 +50,7 @@ add_openmw_dir (mwsound
|
||||||
|
|
||||||
add_openmw_dir (mwworld
|
add_openmw_dir (mwworld
|
||||||
refdata worldimp physicssystem scene globals class action nullaction actionteleport
|
refdata worldimp physicssystem scene globals class action nullaction actionteleport
|
||||||
containerstore actiontalk actiontake manualref player cellfunctors
|
containerstore actiontalk actiontake manualref player cellfunctors failedaction
|
||||||
cells localscripts customdata weather inventorystore ptr actionopen actionread
|
cells localscripts customdata weather inventorystore ptr actionopen actionread
|
||||||
actionequip timestamp actionalchemy cellstore actionapply actioneat
|
actionequip timestamp actionalchemy cellstore actionapply actioneat
|
||||||
)
|
)
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
#include "../mwbase/windowmanager.hpp"
|
#include "../mwbase/windowmanager.hpp"
|
||||||
|
|
||||||
#include "../mwworld/ptr.hpp"
|
#include "../mwworld/ptr.hpp"
|
||||||
#include "../mwworld/nullaction.hpp"
|
#include "../mwworld/failedaction.hpp"
|
||||||
#include "../mwworld/containerstore.hpp"
|
#include "../mwworld/containerstore.hpp"
|
||||||
#include "../mwworld/customdata.hpp"
|
#include "../mwworld/customdata.hpp"
|
||||||
#include "../mwworld/cellstore.hpp"
|
#include "../mwworld/cellstore.hpp"
|
||||||
|
@ -130,7 +130,7 @@ namespace MWClass
|
||||||
{
|
{
|
||||||
// Trap activation goes here
|
// Trap activation goes here
|
||||||
std::cout << "Activated trap: " << ptr.getCellRef().mTrap << std::endl;
|
std::cout << "Activated trap: " << ptr.getCellRef().mTrap << std::endl;
|
||||||
boost::shared_ptr<MWWorld::Action> action(new MWWorld::NullAction);
|
boost::shared_ptr<MWWorld::Action> action(new MWWorld::FailedAction());
|
||||||
action->setSound(trapActivationSound);
|
action->setSound(trapActivationSound);
|
||||||
ptr.getCellRef().mTrap = "";
|
ptr.getCellRef().mTrap = "";
|
||||||
return action;
|
return action;
|
||||||
|
@ -138,7 +138,7 @@ namespace MWClass
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
boost::shared_ptr<MWWorld::Action> action(new MWWorld::NullAction);
|
boost::shared_ptr<MWWorld::Action> action(new MWWorld::FailedAction());
|
||||||
action->setSound(lockedSound);
|
action->setSound(lockedSound);
|
||||||
return action;
|
return action;
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
#include "../mwworld/player.hpp"
|
#include "../mwworld/player.hpp"
|
||||||
#include "../mwworld/ptr.hpp"
|
#include "../mwworld/ptr.hpp"
|
||||||
#include "../mwworld/nullaction.hpp"
|
#include "../mwworld/nullaction.hpp"
|
||||||
|
#include "../mwworld/failedaction.hpp"
|
||||||
#include "../mwworld/actionteleport.hpp"
|
#include "../mwworld/actionteleport.hpp"
|
||||||
#include "../mwworld/cellstore.hpp"
|
#include "../mwworld/cellstore.hpp"
|
||||||
#include "../mwworld/physicssystem.hpp"
|
#include "../mwworld/physicssystem.hpp"
|
||||||
|
@ -111,8 +112,7 @@ namespace MWClass
|
||||||
// Trap activation
|
// Trap activation
|
||||||
std::cout << "Activated trap: " << ptr.getCellRef().mTrap << std::endl;
|
std::cout << "Activated trap: " << ptr.getCellRef().mTrap << std::endl;
|
||||||
|
|
||||||
boost::shared_ptr<MWWorld::Action> action(new MWWorld::NullAction);
|
boost::shared_ptr<MWWorld::Action> action(new MWWorld::FailedAction());
|
||||||
|
|
||||||
action->setSound(trapActivationSound);
|
action->setSound(trapActivationSound);
|
||||||
ptr.getCellRef().mTrap = "";
|
ptr.getCellRef().mTrap = "";
|
||||||
|
|
||||||
|
@ -134,7 +134,7 @@ namespace MWClass
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// another NPC or a creature is using the door
|
// another NPC or a creature is using the door
|
||||||
return boost::shared_ptr<MWWorld::Action> (new MWWorld::NullAction);
|
return boost::shared_ptr<MWWorld::Action> (new MWWorld::FailedAction());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -153,7 +153,7 @@ namespace MWClass
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// locked, and we can't open.
|
// locked, and we can't open.
|
||||||
boost::shared_ptr<MWWorld::Action> action(new MWWorld::NullAction);
|
boost::shared_ptr<MWWorld::Action> action(new MWWorld::FailedAction());
|
||||||
action->setSound(lockedSound);
|
action->setSound(lockedSound);
|
||||||
return action;
|
return action;
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
#include "../mwworld/actiontake.hpp"
|
#include "../mwworld/actiontake.hpp"
|
||||||
#include "../mwworld/actionequip.hpp"
|
#include "../mwworld/actionequip.hpp"
|
||||||
#include "../mwworld/nullaction.hpp"
|
#include "../mwworld/nullaction.hpp"
|
||||||
|
#include "../mwworld/failedaction.hpp"
|
||||||
#include "../mwworld/inventorystore.hpp"
|
#include "../mwworld/inventorystore.hpp"
|
||||||
#include "../mwworld/cellstore.hpp"
|
#include "../mwworld/cellstore.hpp"
|
||||||
#include "../mwworld/physicssystem.hpp"
|
#include "../mwworld/physicssystem.hpp"
|
||||||
|
@ -92,7 +93,7 @@ namespace MWClass
|
||||||
ptr.get<ESM::Light>();
|
ptr.get<ESM::Light>();
|
||||||
|
|
||||||
if (!(ref->base->mData.mFlags & ESM::Light::Carry))
|
if (!(ref->base->mData.mFlags & ESM::Light::Carry))
|
||||||
return boost::shared_ptr<MWWorld::Action> (new MWWorld::NullAction);
|
return boost::shared_ptr<MWWorld::Action> (new MWWorld::FailedAction());
|
||||||
|
|
||||||
boost::shared_ptr<MWWorld::Action> action(new MWWorld::ActionTake (ptr));
|
boost::shared_ptr<MWWorld::Action> action(new MWWorld::ActionTake (ptr));
|
||||||
|
|
||||||
|
|
24
apps/openmw/mwworld/failedaction.cpp
Normal file
24
apps/openmw/mwworld/failedaction.cpp
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
#include "failedaction.hpp"
|
||||||
|
#include "../mwbase/world.hpp"
|
||||||
|
|
||||||
|
|
||||||
|
namespace MWWorld
|
||||||
|
{
|
||||||
|
FailedAction::FailedAction (const std::string& msg) : Action (false)
|
||||||
|
{
|
||||||
|
message = msg;
|
||||||
|
}
|
||||||
|
|
||||||
|
FailedAction::FailedAction () : Action (false)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void FailedAction::executeImp (const Ptr& actor)
|
||||||
|
{
|
||||||
|
if ( actor.getRefData().getHandle()=="player" and not(message.empty()))
|
||||||
|
{
|
||||||
|
//return a message here
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
21
apps/openmw/mwworld/failedaction.hpp
Normal file
21
apps/openmw/mwworld/failedaction.hpp
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
#ifndef GAME_MWWORLD_FAILEDACTION_H
|
||||||
|
#define GAME_MWWORLD_FAILEDACTION_H
|
||||||
|
|
||||||
|
#include "action.hpp"
|
||||||
|
#include "ptr.hpp"
|
||||||
|
|
||||||
|
namespace MWWorld
|
||||||
|
{
|
||||||
|
class FailedAction : public Action
|
||||||
|
{
|
||||||
|
std::string message;
|
||||||
|
|
||||||
|
virtual void executeImp (const Ptr& actor);
|
||||||
|
|
||||||
|
public:
|
||||||
|
FailedAction (const std::string& message);
|
||||||
|
FailedAction ();
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
Loading…
Reference in a new issue