Projectile models are now spawned (no movement or impact yet). Refactored trap activation to apply range types properly. Handle ContinuousVFX for magic effects (note they aren't stopped yet when the effect ends)
parent
0627e23d3c
commit
9b0e82a37f
@ -0,0 +1,28 @@
|
||||
#include "actiontrap.hpp"
|
||||
|
||||
#include "../mwworld/class.hpp"
|
||||
|
||||
#include "../mwmechanics/activespells.hpp"
|
||||
#include "../mwmechanics/creaturestats.hpp"
|
||||
|
||||
#include "../mwbase/world.hpp"
|
||||
#include "../mwbase/environment.hpp"
|
||||
|
||||
namespace MWWorld
|
||||
{
|
||||
|
||||
void ActionTrap::executeImp(const Ptr &actor)
|
||||
{
|
||||
// TODO: Apply RT_Self effects on the door / container that triggered the trap. Not terribly useful, but you could
|
||||
// make it lock itself when activated for example.
|
||||
|
||||
actor.getClass().getCreatureStats(actor).getActiveSpells().addSpell(mSpellId, actor, ESM::RT_Touch);
|
||||
|
||||
const ESM::Spell* spell = MWBase::Environment::get().getWorld()->getStore().get<ESM::Spell>().find(mSpellId);
|
||||
|
||||
MWBase::Environment::get().getWorld()->launchProjectile(mSpellId, spell->mEffects, mTrapSource, spell->mName);
|
||||
|
||||
mTrapSource.getCellRef().mTrap = "";
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
#ifndef GAME_MWWORLD_ACTIONTRAP_H
|
||||
#define GAME_MWWORLD_ACTIONTRAP_H
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "action.hpp"
|
||||
#include "ptr.hpp"
|
||||
|
||||
namespace MWWorld
|
||||
{
|
||||
class ActionTrap : public Action
|
||||
{
|
||||
std::string mSpellId;
|
||||
MWWorld::Ptr mTrapSource;
|
||||
|
||||
virtual void executeImp (const Ptr& actor);
|
||||
|
||||
public:
|
||||
|
||||
/// @param spellId
|
||||
/// @param actor Actor that activated the trap
|
||||
/// @param trapSource
|
||||
ActionTrap (const Ptr& actor, const std::string& spellId, const Ptr& trapSource)
|
||||
: Action(false, actor), mSpellId(spellId), mTrapSource(trapSource) {}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue