aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Scenes
diff options
context:
space:
mode:
authorMW2007-11-18 11:11:44 +0000
committerMW2007-11-18 11:11:44 +0000
commit7f996448647e2703b82ea750bd38196fe5cea838 (patch)
tree2a44306e80f955d3381562b49d121413b53b8512 /OpenSim/Region/Environment/Scenes
parentFor every problem there's a solution that is simple, neat and wrong. (diff)
downloadopensim-SC_OLD-7f996448647e2703b82ea750bd38196fe5cea838.zip
opensim-SC_OLD-7f996448647e2703b82ea750bd38196fe5cea838.tar.gz
opensim-SC_OLD-7f996448647e2703b82ea750bd38196fe5cea838.tar.bz2
opensim-SC_OLD-7f996448647e2703b82ea750bd38196fe5cea838.tar.xz
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.
Diffstat (limited to 'OpenSim/Region/Environment/Scenes')
-rw-r--r--OpenSim/Region/Environment/Scenes/InnerScene.cs30
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.cs19
-rw-r--r--OpenSim/Region/Environment/Scenes/ScenePresence.cs88
3 files changed, 78 insertions, 59 deletions
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
119 { 119 {
120 if (((SceneObjectGroup)obj).LocalId == localID) 120 if (((SceneObjectGroup)obj).LocalId == localID)
121 { 121 {
122 m_parentScene.RemoveEntity((SceneObjectGroup)obj); 122 m_parentScene.RemoveEntity((SceneObjectGroup)obj);
123 return; 123 return;
124 } 124 }
125 } 125 }
@@ -553,7 +553,7 @@ namespace OpenSim.Region.Environment.Scenes
553 parenPrim.LinkToGroup(sceneObj); 553 parenPrim.LinkToGroup(sceneObj);
554 } 554 }
555 } 555 }
556 556
557 /// <summary> 557 /// <summary>
558 /// Delink a linkset 558 /// Delink a linkset
559 /// </summary> 559 /// </summary>
@@ -568,7 +568,7 @@ namespace OpenSim.Region.Environment.Scenes
568 // XXX I'm anticipating that building this dictionary once is more efficient than 568 // XXX I'm anticipating that building this dictionary once is more efficient than
569 // repeated scanning of the Entity.Values for a large number of primIds. However, it might 569 // repeated scanning of the Entity.Values for a large number of primIds. However, it might
570 // be more efficient yet to keep this dictionary permanently on hand. 570 // be more efficient yet to keep this dictionary permanently on hand.
571 Dictionary<uint, SceneObjectGroup> sceneObjects = new Dictionary<uint, SceneObjectGroup>(); 571 Dictionary<uint, SceneObjectGroup> sceneObjects = new Dictionary<uint, SceneObjectGroup>();
572 foreach (EntityBase ent in Entities.Values) 572 foreach (EntityBase ent in Entities.Values)
573 { 573 {
574 if (ent is SceneObjectGroup) 574 if (ent is SceneObjectGroup)
@@ -576,17 +576,17 @@ namespace OpenSim.Region.Environment.Scenes
576 SceneObjectGroup obj = (SceneObjectGroup)ent; 576 SceneObjectGroup obj = (SceneObjectGroup)ent;
577 sceneObjects.Add(obj.LocalId, obj); 577 sceneObjects.Add(obj.LocalId, obj);
578 } 578 }
579 } 579 }
580 580
581 // Find the root prim among the prim ids we've been given 581 // Find the root prim among the prim ids we've been given
582 for (int i = 0; i < primIds.Count; i++) 582 for (int i = 0; i < primIds.Count; i++)
583 { 583 {
584 if (sceneObjects.ContainsKey(primIds[i])) 584 if (sceneObjects.ContainsKey(primIds[i]))
585 { 585 {
586 parenPrim = sceneObjects[primIds[i]]; 586 parenPrim = sceneObjects[primIds[i]];
587 primIds.RemoveAt(i); 587 primIds.RemoveAt(i);
588 break; 588 break;
589 } 589 }
590 } 590 }
591 591
592 if (parenPrim != null) 592 if (parenPrim != null)
@@ -594,7 +594,7 @@ namespace OpenSim.Region.Environment.Scenes
594 foreach (uint childPrimId in primIds) 594 foreach (uint childPrimId in primIds)
595 { 595 {
596 parenPrim.DelinkFromGroup(childPrimId); 596 parenPrim.DelinkFromGroup(childPrimId);
597 } 597 }
598 } 598 }
599 else 599 else
600 { 600 {
@@ -627,19 +627,21 @@ namespace OpenSim.Region.Environment.Scenes
627 627
628 if (originPrim != null) 628 if (originPrim != null)
629 { 629 {
630 SceneObjectGroup copy = originPrim.Copy(AgentID, GroupID); 630 if (PermissionsMngr.CanCopyObject(AgentID, originPrim.UUID))
631 copy.AbsolutePosition = copy.AbsolutePosition + offset; 631 {
632 Entities.Add(copy.UUID, copy); 632 SceneObjectGroup copy = originPrim.Copy(AgentID, GroupID);
633 633 copy.AbsolutePosition = copy.AbsolutePosition + offset;
634 copy.ScheduleGroupForFullUpdate(); 634 Entities.Add(copy.UUID, copy);
635 635
636 copy.ScheduleGroupForFullUpdate();
637 }
636 } 638 }
637 else 639 else
638 { 640 {
639 MainLog.Instance.Warn("client", "Attempted to duplicate nonexistant prim"); 641 MainLog.Instance.Warn("client", "Attempted to duplicate nonexistant prim");
640 } 642 }
641 }
642 643
644 }
643 645
644 #endregion 646 #endregion
645 } 647 }
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
195 195
196 #region Constructors 196 #region Constructors
197 197
198 public Scene(RegionInfo regInfo, AgentCircuitManager authen, CommunicationsManager commsMan, SceneCommunicationService sceneGridService, 198 public Scene(RegionInfo regInfo, AgentCircuitManager authen, PermissionManager permissionManager, CommunicationsManager commsMan, SceneCommunicationService sceneGridService,
199 AssetCache assetCach, StorageManager storeManager, BaseHttpServer httpServer, 199 AssetCache assetCach, StorageManager storeManager, BaseHttpServer httpServer,
200 ModuleLoader moduleLoader, bool dumpAssetsToFile, bool physicalPrim) 200 ModuleLoader moduleLoader, bool dumpAssetsToFile, bool physicalPrim)
201 { 201 {
@@ -217,15 +217,14 @@ namespace OpenSim.Region.Environment.Scenes
217 m_LandManager = new LandManager(this, m_regInfo); 217 m_LandManager = new LandManager(this, m_regInfo);
218 m_estateManager = new EstateManager(this, m_regInfo); 218 m_estateManager = new EstateManager(this, m_regInfo);
219 m_eventManager = new EventManager(); 219 m_eventManager = new EventManager();
220 m_permissionManager = new PermissionManager(this); 220
221 m_permissionManager = permissionManager;
222 m_permissionManager.Initialise(this);
221 223
222 m_innerScene = new InnerScene(this, m_regInfo, m_permissionManager); 224 m_innerScene = new InnerScene(this, m_regInfo, m_permissionManager);
223 m_sceneXmlLoader = new SceneXmlLoader(this, m_innerScene, m_regInfo); 225 m_sceneXmlLoader = new SceneXmlLoader(this, m_innerScene, m_regInfo);
224 226
225 m_eventManager.OnParcelPrimCountAdd += 227 RegisterDefaultSceneEvents();
226 m_LandManager.addPrimToLandPrimCounts;
227
228 m_eventManager.OnPermissionError += SendPermissionAlert;
229 228
230 MainLog.Instance.Verbose("Creating new entitities instance"); 229 MainLog.Instance.Verbose("Creating new entitities instance");
231 Entities = new Dictionary<LLUUID, EntityBase>(); 230 Entities = new Dictionary<LLUUID, EntityBase>();
@@ -244,6 +243,13 @@ namespace OpenSim.Region.Environment.Scenes
244 #endregion 243 #endregion
245 244
246 #region Startup / Close Methods 245 #region Startup / Close Methods
246
247 protected virtual void RegisterDefaultSceneEvents()
248 {
249 m_eventManager.OnParcelPrimCountAdd += m_LandManager.addPrimToLandPrimCounts;
250 m_eventManager.OnPermissionError += SendPermissionAlert;
251 }
252
247 public override void Close() 253 public override void Close()
248 { 254 {
249 ForEachScenePresence(delegate(ScenePresence avatar) 255 ForEachScenePresence(delegate(ScenePresence avatar)
@@ -504,6 +510,7 @@ namespace OpenSim.Region.Environment.Scenes
504 } 510 }
505 511
506 CreateTerrainTexture(); 512 CreateTerrainTexture();
513 CommsManager.GridService.RegisterRegion(RegionInfo); //hack to update the terrain texture in grid mode so it shows on world map
507 } 514 }
508 catch (Exception e) 515 catch (Exception e)
509 { 516 {
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
147 get { return m_lastname; } 147 get { return m_lastname; }
148 } 148 }
149 149
150 protected bool m_allowMovement = true;
151 public bool AllowMovement
152 {
153 get { return m_allowMovement; }
154 set { m_allowMovement = value; }
155 }
156
150 private readonly IClientAPI m_controllingClient; 157 private readonly IClientAPI m_controllingClient;
151 protected PhysicsActor m_physicsActor; 158 protected PhysicsActor m_physicsActor;
152 159
@@ -528,58 +535,61 @@ namespace OpenSim.Region.Environment.Scenes
528 // Console.WriteLine("DEBUG: HandleAgentUpdate: null PhysicsActor!"); 535 // Console.WriteLine("DEBUG: HandleAgentUpdate: null PhysicsActor!");
529 return; 536 return;
530 } 537 }
531
532 int i = 0;
533 bool update_movementflag = false;
534 bool update_rotation = false;
535 bool DCFlagKeyPressed = false;
536 Vector3 agent_control_v3 = new Vector3(0, 0, 0);
537 Quaternion q = new Quaternion(bodyRotation.W, bodyRotation.X, bodyRotation.Y, bodyRotation.Z);
538 bool oldflying = PhysicsActor.Flying;
539
540 538
541 PhysicsActor.Flying = ((flags & (uint) MainAvatar.ControlFlags.AGENT_CONTROL_FLY) != 0); 539 if (m_allowMovement)
542 if (PhysicsActor.Flying != oldflying)
543 { 540 {
544 update_movementflag = true; 541 int i = 0;
545 } 542 bool update_movementflag = false;
543 bool update_rotation = false;
544 bool DCFlagKeyPressed = false;
545 Vector3 agent_control_v3 = new Vector3(0, 0, 0);
546 Quaternion q = new Quaternion(bodyRotation.W, bodyRotation.X, bodyRotation.Y, bodyRotation.Z);
547 bool oldflying = PhysicsActor.Flying;
546 548
547 if (q != m_bodyRot)
548 {
549 m_bodyRot = q;
550 update_rotation = true;
551 }
552 549
553 if (m_parentID == 0) 550 PhysicsActor.Flying = ((flags & (uint)MainAvatar.ControlFlags.AGENT_CONTROL_FLY) != 0);
554 { 551 if (PhysicsActor.Flying != oldflying)
555 foreach (Dir_ControlFlags DCF in Enum.GetValues(typeof (Dir_ControlFlags)))
556 { 552 {
557 if ((flags & (uint) DCF) != 0) 553 update_movementflag = true;
554 }
555
556 if (q != m_bodyRot)
557 {
558 m_bodyRot = q;
559 update_rotation = true;
560 }
561
562 if (m_parentID == 0)
563 {
564 foreach (Dir_ControlFlags DCF in Enum.GetValues(typeof(Dir_ControlFlags)))
558 { 565 {
559 DCFlagKeyPressed = true; 566 if ((flags & (uint)DCF) != 0)
560 agent_control_v3 += Dir_Vectors[i];
561 if ((m_movementflag & (uint) DCF) == 0)
562 { 567 {
563 m_movementflag += (byte) (uint) DCF; 568 DCFlagKeyPressed = true;
564 update_movementflag = true; 569 agent_control_v3 += Dir_Vectors[i];
570 if ((m_movementflag & (uint)DCF) == 0)
571 {
572 m_movementflag += (byte)(uint)DCF;
573 update_movementflag = true;
574 }
565 } 575 }
566 } 576 else
567 else
568 {
569 if ((m_movementflag & (uint) DCF) != 0)
570 { 577 {
571 m_movementflag -= (byte) (uint) DCF; 578 if ((m_movementflag & (uint)DCF) != 0)
572 update_movementflag = true; 579 {
580 m_movementflag -= (byte)(uint)DCF;
581 update_movementflag = true;
582 }
573 } 583 }
584 i++;
574 } 585 }
575 i++;
576 } 586 }
577 }
578 587
579 if ((update_movementflag) || (update_rotation && DCFlagKeyPressed)) 588 if ((update_movementflag) || (update_rotation && DCFlagKeyPressed))
580 { 589 {
581 AddNewMovement(agent_control_v3, q); 590 AddNewMovement(agent_control_v3, q);
582 UpdateMovementAnimations(update_movementflag); 591 UpdateMovementAnimations(update_movementflag);
592 }
583 } 593 }
584 594
585 } 595 }