|
|
@ -4,6 +4,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
#include "../mwbase/environment.hpp"
|
|
|
|
#include "../mwbase/environment.hpp"
|
|
|
|
#include "../mwbase/world.hpp"
|
|
|
|
#include "../mwbase/world.hpp"
|
|
|
|
|
|
|
|
#include "../mwbase/mechanicsmanager.hpp"
|
|
|
|
|
|
|
|
|
|
|
|
#include "../mwmechanics/spellcasting.hpp"
|
|
|
|
#include "../mwmechanics/spellcasting.hpp"
|
|
|
|
|
|
|
|
|
|
|
@ -21,28 +22,6 @@
|
|
|
|
namespace MWMechanics
|
|
|
|
namespace MWMechanics
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
void cleanupSummonedCreature (MWMechanics::CreatureStats& casterStats, int creatureActorId)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
MWWorld::Ptr ptr = MWBase::Environment::get().getWorld()->searchPtrViaActorId(creatureActorId);
|
|
|
|
|
|
|
|
if (!ptr.isEmpty())
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
MWBase::Environment::get().getWorld()->deleteObject(ptr);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const ESM::Static* fx = MWBase::Environment::get().getWorld()->getStore().get<ESM::Static>()
|
|
|
|
|
|
|
|
.search("VFX_Summon_End");
|
|
|
|
|
|
|
|
if (fx)
|
|
|
|
|
|
|
|
MWBase::Environment::get().getWorld()->spawnEffect("meshes\\" + fx->mModel,
|
|
|
|
|
|
|
|
"", ptr.getRefData().getPosition().asVec3());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else if (creatureActorId != -1)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
// We didn't find the creature. It's probably in an inactive cell.
|
|
|
|
|
|
|
|
// Add to graveyard so we can delete it when the cell becomes active.
|
|
|
|
|
|
|
|
std::vector<int>& graveyard = casterStats.getSummonedCreatureGraveyard();
|
|
|
|
|
|
|
|
graveyard.push_back(creatureActorId);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UpdateSummonedCreatures::UpdateSummonedCreatures(const MWWorld::Ptr &actor)
|
|
|
|
UpdateSummonedCreatures::UpdateSummonedCreatures(const MWWorld::Ptr &actor)
|
|
|
|
: mActor(actor)
|
|
|
|
: mActor(actor)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -61,10 +40,8 @@ namespace MWMechanics
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
std::set<int> UpdateSummonedCreatures::process()
|
|
|
|
void UpdateSummonedCreatures::process()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
std::set<int> deletedCreatures;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static std::map<int, std::string> summonMap;
|
|
|
|
static std::map<int, std::string> summonMap;
|
|
|
|
if (summonMap.empty())
|
|
|
|
if (summonMap.empty())
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -102,8 +79,7 @@ namespace MWMechanics
|
|
|
|
if (!found)
|
|
|
|
if (!found)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// Effect has ended
|
|
|
|
// Effect has ended
|
|
|
|
cleanupSummonedCreature(creatureStats, it->second);
|
|
|
|
MWBase::Environment::get().getMechanicsManager()->cleanupSummonedCreature(mActor, it->second);
|
|
|
|
deletedCreatures.insert(it->second);
|
|
|
|
|
|
|
|
creatureMap.erase(it++);
|
|
|
|
creatureMap.erase(it++);
|
|
|
|
continue;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -165,7 +141,7 @@ namespace MWMechanics
|
|
|
|
if (mActor.getClass().hasInventoryStore(ptr))
|
|
|
|
if (mActor.getClass().hasInventoryStore(ptr))
|
|
|
|
mActor.getClass().getInventoryStore(mActor).purgeEffect(it->first.first, it->first.second);
|
|
|
|
mActor.getClass().getInventoryStore(mActor).purgeEffect(it->first.first, it->first.second);
|
|
|
|
|
|
|
|
|
|
|
|
cleanupSummonedCreature(creatureStats, it->second);
|
|
|
|
MWBase::Environment::get().getMechanicsManager()->cleanupSummonedCreature(mActor, it->second);
|
|
|
|
creatureMap.erase(it++);
|
|
|
|
creatureMap.erase(it++);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
@ -191,8 +167,6 @@ namespace MWMechanics
|
|
|
|
else
|
|
|
|
else
|
|
|
|
++it;
|
|
|
|
++it;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return deletedCreatures;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|