1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-03-01 01:39:41 +00:00

Make StayOutside only block teleportation from exteriors to interiors

This commit is contained in:
Evil Eye 2021-10-06 18:25:28 +02:00
parent cd4d76f8c5
commit dfc72e9b7e
4 changed files with 7 additions and 5 deletions

View file

@ -52,6 +52,7 @@
Bug #6289: Keyword search in dialogues expected the text to be all ASCII characters Bug #6289: Keyword search in dialogues expected the text to be all ASCII characters
Bug #6302: Teleporting disabled actor breaks its disabled state Bug #6302: Teleporting disabled actor breaks its disabled state
Bug #6307: Pathfinding in Infidelities quest from Tribunal addon is broken Bug #6307: Pathfinding in Infidelities quest from Tribunal addon is broken
Bug #6323: Wyrmhaven: Alboin doesn't follower the player character out of his house
Feature #890: OpenMW-CS: Column filtering Feature #890: OpenMW-CS: Column filtering
Feature #2554: Modifying an object triggers the instances table to scroll to the corresponding record Feature #2554: Modifying an object triggers the instances table to scroll to the corresponding record
Feature #2780: A way to see current OpenMW version in the console Feature #2780: A way to see current OpenMW version in the console

View file

@ -74,7 +74,7 @@ namespace MWGui
// Add price for the travelling followers // Add price for the travelling followers
std::set<MWWorld::Ptr> followers; std::set<MWWorld::Ptr> followers;
MWWorld::ActionTeleport::getFollowers(player, followers); MWWorld::ActionTeleport::getFollowers(player, followers, !interior);
// Apply followers cost, unlike vanilla the first follower doesn't travel for free // Apply followers cost, unlike vanilla the first follower doesn't travel for free
price *= 1 + static_cast<int>(followers.size()); price *= 1 + static_cast<int>(followers.size());

View file

@ -6,6 +6,7 @@
#include "../mwmechanics/creaturestats.hpp" #include "../mwmechanics/creaturestats.hpp"
#include "../mwworld/cellstore.hpp"
#include "../mwworld/class.hpp" #include "../mwworld/class.hpp"
#include "player.hpp" #include "player.hpp"
@ -24,7 +25,7 @@ namespace MWWorld
{ {
// Find any NPCs that are following the actor and teleport them with him // Find any NPCs that are following the actor and teleport them with him
std::set<MWWorld::Ptr> followers; std::set<MWWorld::Ptr> followers;
getFollowers(actor, followers, true); getFollowers(actor, followers, mCellName.empty(), true);
for (std::set<MWWorld::Ptr>::iterator it = followers.begin(); it != followers.end(); ++it) for (std::set<MWWorld::Ptr>::iterator it = followers.begin(); it != followers.end(); ++it)
teleport(*it); teleport(*it);
@ -62,7 +63,7 @@ namespace MWWorld
} }
} }
void ActionTeleport::getFollowers(const MWWorld::Ptr& actor, std::set<MWWorld::Ptr>& out, bool includeHostiles) { void ActionTeleport::getFollowers(const MWWorld::Ptr& actor, std::set<MWWorld::Ptr>& out, bool toExterior, bool includeHostiles) {
std::set<MWWorld::Ptr> followers; std::set<MWWorld::Ptr> followers;
MWBase::Environment::get().getMechanicsManager()->getActorsFollowing(actor, followers); MWBase::Environment::get().getMechanicsManager()->getActorsFollowing(actor, followers);
@ -75,7 +76,7 @@ namespace MWWorld
if (!includeHostiles && follower.getClass().getCreatureStats(follower).getAiSequence().isInCombat(actor)) if (!includeHostiles && follower.getClass().getCreatureStats(follower).getAiSequence().isInCombat(actor))
continue; continue;
if (!script.empty() && follower.getRefData().getLocals().getIntVar(script, "stayoutside") == 1) if (!toExterior && !script.empty() && follower.getRefData().getLocals().getIntVar(script, "stayoutside") == 1 && follower.getCell()->getCell()->isExterior())
continue; continue;
if ((follower.getRefData().getPosition().asVec3() - actor.getRefData().getPosition().asVec3()).length2() > 800 * 800) if ((follower.getRefData().getPosition().asVec3() - actor.getRefData().getPosition().asVec3()).length2() > 800 * 800)

View file

@ -30,7 +30,7 @@ namespace MWWorld
/// @param includeHostiles If true, include hostile followers (which won't actually be teleported) in the output, /// @param includeHostiles If true, include hostile followers (which won't actually be teleported) in the output,
/// e.g. so that the teleport action can calm them. /// e.g. so that the teleport action can calm them.
static void getFollowers(const MWWorld::Ptr& actor, std::set<MWWorld::Ptr>& out, bool includeHostiles = false); static void getFollowers(const MWWorld::Ptr& actor, std::set<MWWorld::Ptr>& out, bool toExterior, bool includeHostiles = false);
}; };
} }