From 7f996448647e2703b82ea750bd38196fe5cea838 Mon Sep 17 00:00:00 2001 From: MW Date: Sun, 18 Nov 2007 11:11:44 +0000 Subject: Attempt to get World Map working in Grid mode, will need to be using the grid asset server for it to work correctly and has only been quickly tested in a three region grid. Moved PermissionManager creation out of the Scene constructor and instead a PermissionManager is passed to the constructor as a param. So that we could create and use custom permissionsManagers. Added AllowMovement property to ScenePresence which can be used to stop movement of avatars (for example in a custom region that wanted avatars always in one place). Added PermissionManager call when copying objects, although currently the call will always return true so that it allows copying in places like Wright Plaza. A few other changes/fixes. --- OpenSim/Region/Environment/Scenes/InnerScene.cs | 30 ++++---- OpenSim/Region/Environment/Scenes/Scene.cs | 19 +++-- OpenSim/Region/Environment/Scenes/ScenePresence.cs | 88 ++++++++++++---------- 3 files changed, 78 insertions(+), 59 deletions(-) (limited to 'OpenSim/Region/Environment/Scenes') diff --git a/OpenSim/Region/Environment/Scenes/InnerScene.cs b/OpenSim/Region/Environment/Scenes/InnerScene.cs index 1625e80..1f3bc95 100644 --- a/OpenSim/Region/Environment/Scenes/InnerScene.cs +++ b/OpenSim/Region/Environment/Scenes/InnerScene.cs @@ -119,7 +119,7 @@ namespace OpenSim.Region.Environment.Scenes { if (((SceneObjectGroup)obj).LocalId == localID) { - m_parentScene.RemoveEntity((SceneObjectGroup)obj); + m_parentScene.RemoveEntity((SceneObjectGroup)obj); return; } } @@ -553,7 +553,7 @@ namespace OpenSim.Region.Environment.Scenes parenPrim.LinkToGroup(sceneObj); } } - + /// /// Delink a linkset /// @@ -568,7 +568,7 @@ namespace OpenSim.Region.Environment.Scenes // XXX I'm anticipating that building this dictionary once is more efficient than // repeated scanning of the Entity.Values for a large number of primIds. However, it might // be more efficient yet to keep this dictionary permanently on hand. - Dictionary sceneObjects = new Dictionary(); + Dictionary sceneObjects = new Dictionary(); foreach (EntityBase ent in Entities.Values) { if (ent is SceneObjectGroup) @@ -576,17 +576,17 @@ namespace OpenSim.Region.Environment.Scenes SceneObjectGroup obj = (SceneObjectGroup)ent; sceneObjects.Add(obj.LocalId, obj); } - } - + } + // Find the root prim among the prim ids we've been given for (int i = 0; i < primIds.Count; i++) - { + { if (sceneObjects.ContainsKey(primIds[i])) { parenPrim = sceneObjects[primIds[i]]; primIds.RemoveAt(i); break; - } + } } if (parenPrim != null) @@ -594,7 +594,7 @@ namespace OpenSim.Region.Environment.Scenes foreach (uint childPrimId in primIds) { parenPrim.DelinkFromGroup(childPrimId); - } + } } else { @@ -627,19 +627,21 @@ namespace OpenSim.Region.Environment.Scenes if (originPrim != null) { - SceneObjectGroup copy = originPrim.Copy(AgentID, GroupID); - copy.AbsolutePosition = copy.AbsolutePosition + offset; - Entities.Add(copy.UUID, copy); - - copy.ScheduleGroupForFullUpdate(); + if (PermissionsMngr.CanCopyObject(AgentID, originPrim.UUID)) + { + SceneObjectGroup copy = originPrim.Copy(AgentID, GroupID); + copy.AbsolutePosition = copy.AbsolutePosition + offset; + Entities.Add(copy.UUID, copy); + copy.ScheduleGroupForFullUpdate(); + } } else { MainLog.Instance.Warn("client", "Attempted to duplicate nonexistant prim"); } - } + } #endregion } diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index 2c765a3..1400e60 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs @@ -195,7 +195,7 @@ namespace OpenSim.Region.Environment.Scenes #region Constructors - public Scene(RegionInfo regInfo, AgentCircuitManager authen, CommunicationsManager commsMan, SceneCommunicationService sceneGridService, + public Scene(RegionInfo regInfo, AgentCircuitManager authen, PermissionManager permissionManager, CommunicationsManager commsMan, SceneCommunicationService sceneGridService, AssetCache assetCach, StorageManager storeManager, BaseHttpServer httpServer, ModuleLoader moduleLoader, bool dumpAssetsToFile, bool physicalPrim) { @@ -217,15 +217,14 @@ namespace OpenSim.Region.Environment.Scenes m_LandManager = new LandManager(this, m_regInfo); m_estateManager = new EstateManager(this, m_regInfo); m_eventManager = new EventManager(); - m_permissionManager = new PermissionManager(this); + + m_permissionManager = permissionManager; + m_permissionManager.Initialise(this); m_innerScene = new InnerScene(this, m_regInfo, m_permissionManager); m_sceneXmlLoader = new SceneXmlLoader(this, m_innerScene, m_regInfo); - m_eventManager.OnParcelPrimCountAdd += - m_LandManager.addPrimToLandPrimCounts; - - m_eventManager.OnPermissionError += SendPermissionAlert; + RegisterDefaultSceneEvents(); MainLog.Instance.Verbose("Creating new entitities instance"); Entities = new Dictionary(); @@ -244,6 +243,13 @@ namespace OpenSim.Region.Environment.Scenes #endregion #region Startup / Close Methods + + protected virtual void RegisterDefaultSceneEvents() + { + m_eventManager.OnParcelPrimCountAdd += m_LandManager.addPrimToLandPrimCounts; + m_eventManager.OnPermissionError += SendPermissionAlert; + } + public override void Close() { ForEachScenePresence(delegate(ScenePresence avatar) @@ -504,6 +510,7 @@ namespace OpenSim.Region.Environment.Scenes } CreateTerrainTexture(); + CommsManager.GridService.RegisterRegion(RegionInfo); //hack to update the terrain texture in grid mode so it shows on world map } catch (Exception e) { diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs index 67b375a..b6daad6 100644 --- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs @@ -147,6 +147,13 @@ namespace OpenSim.Region.Environment.Scenes get { return m_lastname; } } + protected bool m_allowMovement = true; + public bool AllowMovement + { + get { return m_allowMovement; } + set { m_allowMovement = value; } + } + private readonly IClientAPI m_controllingClient; protected PhysicsActor m_physicsActor; @@ -528,58 +535,61 @@ namespace OpenSim.Region.Environment.Scenes // Console.WriteLine("DEBUG: HandleAgentUpdate: null PhysicsActor!"); return; } - - int i = 0; - bool update_movementflag = false; - bool update_rotation = false; - bool DCFlagKeyPressed = false; - Vector3 agent_control_v3 = new Vector3(0, 0, 0); - Quaternion q = new Quaternion(bodyRotation.W, bodyRotation.X, bodyRotation.Y, bodyRotation.Z); - bool oldflying = PhysicsActor.Flying; - - PhysicsActor.Flying = ((flags & (uint) MainAvatar.ControlFlags.AGENT_CONTROL_FLY) != 0); - if (PhysicsActor.Flying != oldflying) + if (m_allowMovement) { - update_movementflag = true; - } + int i = 0; + bool update_movementflag = false; + bool update_rotation = false; + bool DCFlagKeyPressed = false; + Vector3 agent_control_v3 = new Vector3(0, 0, 0); + Quaternion q = new Quaternion(bodyRotation.W, bodyRotation.X, bodyRotation.Y, bodyRotation.Z); + bool oldflying = PhysicsActor.Flying; - if (q != m_bodyRot) - { - m_bodyRot = q; - update_rotation = true; - } - if (m_parentID == 0) - { - foreach (Dir_ControlFlags DCF in Enum.GetValues(typeof (Dir_ControlFlags))) + PhysicsActor.Flying = ((flags & (uint)MainAvatar.ControlFlags.AGENT_CONTROL_FLY) != 0); + if (PhysicsActor.Flying != oldflying) { - if ((flags & (uint) DCF) != 0) + update_movementflag = true; + } + + if (q != m_bodyRot) + { + m_bodyRot = q; + update_rotation = true; + } + + if (m_parentID == 0) + { + foreach (Dir_ControlFlags DCF in Enum.GetValues(typeof(Dir_ControlFlags))) { - DCFlagKeyPressed = true; - agent_control_v3 += Dir_Vectors[i]; - if ((m_movementflag & (uint) DCF) == 0) + if ((flags & (uint)DCF) != 0) { - m_movementflag += (byte) (uint) DCF; - update_movementflag = true; + DCFlagKeyPressed = true; + agent_control_v3 += Dir_Vectors[i]; + if ((m_movementflag & (uint)DCF) == 0) + { + m_movementflag += (byte)(uint)DCF; + update_movementflag = true; + } } - } - else - { - if ((m_movementflag & (uint) DCF) != 0) + else { - m_movementflag -= (byte) (uint) DCF; - update_movementflag = true; + if ((m_movementflag & (uint)DCF) != 0) + { + m_movementflag -= (byte)(uint)DCF; + update_movementflag = true; + } } + i++; } - i++; } - } - if ((update_movementflag) || (update_rotation && DCFlagKeyPressed)) - { - AddNewMovement(agent_control_v3, q); - UpdateMovementAnimations(update_movementflag); + if ((update_movementflag) || (update_rotation && DCFlagKeyPressed)) + { + AddNewMovement(agent_control_v3, q); + UpdateMovementAnimations(update_movementflag); + } } } -- cgit v1.1