Remove World::activate since all activation now goes trough LuaManager

revert-6246b479
Petr Mikheev 1 year ago
parent c5871a5a7a
commit 2c212b18e4

@ -540,8 +540,6 @@ namespace MWBase
const osg::Vec3f& worldPos, float scale = 1.f, bool isMagicVFX = true) const osg::Vec3f& worldPos, float scale = 1.f, bool isMagicVFX = true)
= 0; = 0;
virtual void activate(const MWWorld::Ptr& object, const MWWorld::Ptr& actor) = 0;
/// @see MWWorld::WeatherManager::isInStorm /// @see MWWorld::WeatherManager::isInStorm
virtual bool isInStorm() const = 0; virtual bool isInStorm() const = 0;

@ -3,6 +3,7 @@
#include <components/esm3/aisequence.hpp> #include <components/esm3/aisequence.hpp>
#include "../mwbase/environment.hpp" #include "../mwbase/environment.hpp"
#include "../mwbase/luamanager.hpp"
#include "../mwbase/world.hpp" #include "../mwbase/world.hpp"
#include "../mwworld/class.hpp" #include "../mwworld/class.hpp"
@ -44,7 +45,7 @@ namespace MWMechanics
{ {
// Note: we intentionally do not cancel package after activation here for backward compatibility with // Note: we intentionally do not cancel package after activation here for backward compatibility with
// original engine. // original engine.
MWBase::Environment::get().getWorld()->activate(target, actor); MWBase::Environment::get().getLuaManager()->objectActivated(target, actor);
} }
return false; return false;
} }

@ -8,6 +8,7 @@
#include <components/settings/values.hpp> #include <components/settings/values.hpp>
#include "../mwbase/environment.hpp" #include "../mwbase/environment.hpp"
#include "../mwbase/luamanager.hpp"
#include "../mwbase/world.hpp" #include "../mwbase/world.hpp"
#include "../mwworld/cellstore.hpp" #include "../mwworld/cellstore.hpp"
@ -265,8 +266,7 @@ void MWMechanics::AiPackage::evadeObstacles(const MWWorld::Ptr& actor)
return; return;
// first check if obstacle is a door // first check if obstacle is a door
static float distance = MWBase::Environment::get().getWorld()->getMaxActivationDistance(); float distance = MWBase::Environment::get().getWorld()->getMaxActivationDistance();
const MWWorld::Ptr door = getNearbyDoor(actor, distance); const MWWorld::Ptr door = getNearbyDoor(actor, distance);
if (!door.isEmpty() && canOpenDoors(actor)) if (!door.isEmpty() && canOpenDoors(actor))
{ {
@ -300,9 +300,7 @@ void MWMechanics::AiPackage::openDoors(const MWWorld::Ptr& actor)
if (mPathFinder.getPathSize() == 0) if (mPathFinder.getPathSize() == 0)
return; return;
MWBase::World* world = MWBase::Environment::get().getWorld(); float distance = MWBase::Environment::get().getWorld()->getMaxActivationDistance();
static float distance = world->getMaxActivationDistance();
const MWWorld::Ptr door = getNearbyDoor(actor, distance); const MWWorld::Ptr door = getNearbyDoor(actor, distance);
if (door == MWWorld::Ptr()) if (door == MWWorld::Ptr())
return; return;
@ -314,7 +312,7 @@ void MWMechanics::AiPackage::openDoors(const MWWorld::Ptr& actor)
if (door.getCellRef().getTrap().empty() && !door.getCellRef().isLocked()) if (door.getCellRef().getTrap().empty() && !door.getCellRef().isLocked())
{ {
world->activate(door, actor); MWBase::Environment::get().getLuaManager()->objectActivated(door, actor);
return; return;
} }
@ -326,7 +324,7 @@ void MWMechanics::AiPackage::openDoors(const MWWorld::Ptr& actor)
MWWorld::Ptr keyPtr = invStore.search(keyId); MWWorld::Ptr keyPtr = invStore.search(keyId);
if (!keyPtr.isEmpty()) if (!keyPtr.isEmpty())
world->activate(door, actor); MWBase::Environment::get().getLuaManager()->objectActivated(door, actor);
} }
} }

@ -18,6 +18,7 @@
#include "../mwworld/worldmodel.hpp" #include "../mwworld/worldmodel.hpp"
#include "../mwbase/environment.hpp" #include "../mwbase/environment.hpp"
#include "../mwbase/luamanager.hpp"
#include "../mwbase/mechanicsmanager.hpp" #include "../mwbase/mechanicsmanager.hpp"
#include "../mwbase/windowmanager.hpp" #include "../mwbase/windowmanager.hpp"
#include "../mwbase/world.hpp" #include "../mwbase/world.hpp"
@ -194,7 +195,7 @@ namespace MWWorld
if (!toActivate.getClass().hasToolTip(toActivate)) if (!toActivate.getClass().hasToolTip(toActivate))
return; return;
MWBase::Environment::get().getWorld()->activate(toActivate, player); MWBase::Environment::get().getLuaManager()->objectActivated(toActivate, player);
} }
bool Player::wasTeleported() const bool Player::wasTeleported() const

@ -3704,12 +3704,6 @@ namespace MWWorld
mRendering->spawnEffect(model, textureOverride, worldPos, scale, isMagicVFX); mRendering->spawnEffect(model, textureOverride, worldPos, scale, isMagicVFX);
} }
void World::activate(const Ptr& object, const Ptr& actor)
{
breakInvisibility(actor);
MWBase::Environment::get().getLuaManager()->objectActivated(object, actor);
}
struct ResetActorsVisitor struct ResetActorsVisitor
{ {
World& mWorld; World& mWorld;

@ -620,8 +620,6 @@ namespace MWWorld
void spawnEffect(const std::string& model, const std::string& textureOverride, const osg::Vec3f& worldPos, void spawnEffect(const std::string& model, const std::string& textureOverride, const osg::Vec3f& worldPos,
float scale = 1.f, bool isMagicVFX = true) override; float scale = 1.f, bool isMagicVFX = true) override;
void activate(const MWWorld::Ptr& object, const MWWorld::Ptr& actor) override;
/// @see MWWorld::WeatherManager::isInStorm /// @see MWWorld::WeatherManager::isInStorm
bool isInStorm() const override; bool isInStorm() const override;

@ -23,6 +23,7 @@ local handlersPerType = {}
handlersPerType[types.ESM4Door] = { ESM4DoorActivation } handlersPerType[types.ESM4Door] = { ESM4DoorActivation }
local function onActivate(obj, actor) local function onActivate(obj, actor)
types.Actor.activeEffects(actor):remove('invisibility')
local handlers = handlersPerObject[obj.id] local handlers = handlersPerObject[obj.id]
if handlers then if handlers then
for i = #handlers, 1, -1 do for i = #handlers, 1, -1 do

Loading…
Cancel
Save