Skip to content

An OpenMW mod that lets you play the whole Elder Scrolls III: Morrowind as a top-down isometric game — with full online co-op or MMO modes.

C++

Multiplayer: the cell authority's actors walk however far from it they are, so no one sees them step in place

Alan Saunders8bca942809aa
diff --git a/apps/openmw/mwmechanics/actors.cpp b/apps/openmw/mwmechanics/actors.cpp
index 2d1d8e9..fdafba3 100644
--- a/apps/openmw/mwmechanics/actors.cpp
+++ b/apps/openmw/mwmechanics/actors.cpp
@@ -1699,7 +1699,12 @@ namespace MWMechanics
MWMechanics::AiSequence& seq = stats.getAiSequence();
alwaysActive = !seq.isEmpty() && seq.getActivePackage().alwaysActive();
}
- const bool inRange = isPlayer || dist <= actorsProcessingRange || alwaysActive;
+ // Isowind multiplayer: the actors this client has authority over (LocalActors) move however far from
+ // the player they are, as their AI runs above. Left inactive, their AI would keep asking for a walk
+ // that physics never makes, and the other players next to them would see them step in place.
+ const bool isLocalActor = mwmp::Main::isInitialized()
+ && mwmp::Main::get().getCellController()->isLocalActor(actor.getPtr());
+ const bool inRange = isPlayer || dist <= actorsProcessingRange || alwaysActive || isLocalActor;
const int activeFlag = isPlayer ? 2 : 1; // Can be changed back to '2' to keep updating bounding boxes
// off screen (more accurate, but slower)
const int active = inRange ? activeFlag : 0;