aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment
diff options
context:
space:
mode:
authorlbsa712007-07-26 14:55:42 +0000
committerlbsa712007-07-26 14:55:42 +0000
commit39b64564dca0e5cb57a2a8e1b60979ccaaf11ef6 (patch)
tree81ab89a9749577c6fa1a3a19c1ed09c1942ec201 /OpenSim/Region/Environment
parentAdded the default shape to the OpenSim library. Now need to get the new ruth ... (diff)
downloadopensim-SC-39b64564dca0e5cb57a2a8e1b60979ccaaf11ef6.zip
opensim-SC-39b64564dca0e5cb57a2a8e1b60979ccaaf11ef6.tar.gz
opensim-SC-39b64564dca0e5cb57a2a8e1b60979ccaaf11ef6.tar.bz2
opensim-SC-39b64564dca0e5cb57a2a8e1b60979ccaaf11ef6.tar.xz
* Started renaming world to Scene
* Update and UpdateMovement now first stores array to avoid collection update exceptions * Ignored some bins
Diffstat (limited to 'OpenSim/Region/Environment')
-rw-r--r--OpenSim/Region/Environment/EstateManager.cs10
-rw-r--r--OpenSim/Region/Environment/LandManagement/Land.cs33
-rw-r--r--OpenSim/Region/Environment/LandManagement/LandManager.cs14
-rw-r--r--OpenSim/Region/Environment/Scenes/Entity.cs26
-rw-r--r--OpenSim/Region/Environment/Scenes/EntityBase.cs47
-rw-r--r--OpenSim/Region/Environment/Scenes/Primitive.cs29
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.cs24
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneBase.cs2
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneObject.cs10
-rw-r--r--OpenSim/Region/Environment/Scenes/ScenePresence.cs22
10 files changed, 95 insertions, 122 deletions
diff --git a/OpenSim/Region/Environment/EstateManager.cs b/OpenSim/Region/Environment/EstateManager.cs
index 3742486..3af6fb2 100644
--- a/OpenSim/Region/Environment/EstateManager.cs
+++ b/OpenSim/Region/Environment/EstateManager.cs
@@ -45,12 +45,12 @@ namespace OpenSim.Region.Environment
45 /// </summary> 45 /// </summary>
46 public class EstateManager 46 public class EstateManager
47 { 47 {
48 private Scene m_world; 48 private Scene m_scene;
49 private RegionInfo m_regInfo; 49 private RegionInfo m_regInfo;
50 50
51 public EstateManager(Scene world,RegionInfo reginfo) 51 public EstateManager(Scene scene,RegionInfo reginfo)
52 { 52 {
53 m_world = world; //Estate settings found at world.m_regInfo.estateSettings 53 m_scene = scene;
54 m_regInfo = reginfo; 54 m_regInfo = reginfo;
55 } 55 }
56 56
@@ -243,7 +243,7 @@ namespace OpenSim.Region.Environment
243 243
244 public void sendRegionInfoPacketToAll() 244 public void sendRegionInfoPacketToAll()
245 { 245 {
246 List<Avatar> avatars = m_world.RequestAvatarList(); 246 List<Avatar> avatars = m_scene.RequestAvatarList();
247 247
248 for (int i = 0; i < avatars.Count; i++) 248 for (int i = 0; i < avatars.Count; i++)
249 { 249 {
@@ -253,7 +253,7 @@ namespace OpenSim.Region.Environment
253 253
254 public void sendRegionHandshakeToAll() 254 public void sendRegionHandshakeToAll()
255 { 255 {
256 List<Avatar> avatars = m_world.RequestAvatarList(); 256 List<Avatar> avatars = m_scene.RequestAvatarList();
257 257
258 for (int i = 0; i < avatars.Count; i++) 258 for (int i = 0; i < avatars.Count; i++)
259 { 259 {
diff --git a/OpenSim/Region/Environment/LandManagement/Land.cs b/OpenSim/Region/Environment/LandManagement/Land.cs
index bae3b0e..625b176 100644
--- a/OpenSim/Region/Environment/LandManagement/Land.cs
+++ b/OpenSim/Region/Environment/LandManagement/Land.cs
@@ -18,7 +18,7 @@ namespace OpenSim.Region.Environment.LandManagement
18 public LandData landData = new LandData(); 18 public LandData landData = new LandData();
19 public List<SceneObject> primsOverMe = new List<SceneObject>(); 19 public List<SceneObject> primsOverMe = new List<SceneObject>();
20 20
21 public Scene m_world; 21 public Scene m_scene;
22 22
23 private bool[,] landBitmap = new bool[64, 64]; 23 private bool[,] landBitmap = new bool[64, 64];
24 24
@@ -26,9 +26,9 @@ namespace OpenSim.Region.Environment.LandManagement
26 26
27 27
28 #region Constructors 28 #region Constructors
29 public Land(LLUUID owner_id, bool is_group_owned, Scene world) 29 public Land(LLUUID owner_id, bool is_group_owned, Scene scene)
30 { 30 {
31 m_world = world; 31 m_scene = scene;
32 landData.ownerID = owner_id; 32 landData.ownerID = owner_id;
33 landData.isGroupOwned = is_group_owned; 33 landData.isGroupOwned = is_group_owned;
34 34
@@ -59,7 +59,7 @@ namespace OpenSim.Region.Environment.LandManagement
59 59
60 public Land Copy() 60 public Land Copy()
61 { 61 {
62 Land newLand = new Land(this.landData.ownerID, this.landData.isGroupOwned, m_world); 62 Land newLand = new Land(this.landData.ownerID, this.landData.isGroupOwned, m_scene);
63 63
64 //Place all new variables here! 64 //Place all new variables here!
65 newLand.landBitmap = (bool[,])(this.landBitmap.Clone()); 65 newLand.landBitmap = (bool[,])(this.landBitmap.Clone());
@@ -101,7 +101,7 @@ namespace OpenSim.Region.Environment.LandManagement
101 updatePacket.ParcelData.LocalID = landData.localID; 101 updatePacket.ParcelData.LocalID = landData.localID;
102 if (landData.area > 0) 102 if (landData.area > 0)
103 { 103 {
104 updatePacket.ParcelData.MaxPrims = Convert.ToInt32(Math.Round((Convert.ToDecimal(landData.area) / Convert.ToDecimal(65536)) * 15000 * Convert.ToDecimal(m_world.RegionInfo.estateSettings.objectBonusFactor))); 104 updatePacket.ParcelData.MaxPrims = Convert.ToInt32(Math.Round((Convert.ToDecimal(landData.area) / Convert.ToDecimal(65536)) * 15000 * Convert.ToDecimal(m_scene.RegionInfo.estateSettings.objectBonusFactor)));
105 } 105 }
106 else 106 else
107 { 107 {
@@ -118,14 +118,17 @@ namespace OpenSim.Region.Environment.LandManagement
118 updatePacket.ParcelData.OwnerID = landData.ownerID; 118 updatePacket.ParcelData.OwnerID = landData.ownerID;
119 updatePacket.ParcelData.OwnerPrims = landData.ownerPrims; 119 updatePacket.ParcelData.OwnerPrims = landData.ownerPrims;
120 updatePacket.ParcelData.ParcelFlags = landData.landFlags; 120 updatePacket.ParcelData.ParcelFlags = landData.landFlags;
121 updatePacket.ParcelData.ParcelPrimBonus = m_world.RegionInfo.estateSettings.objectBonusFactor; 121 updatePacket.ParcelData.ParcelPrimBonus = m_scene.RegionInfo.estateSettings.objectBonusFactor;
122 updatePacket.ParcelData.PassHours = landData.passHours; 122 updatePacket.ParcelData.PassHours = landData.passHours;
123 updatePacket.ParcelData.PassPrice = landData.passPrice; 123 updatePacket.ParcelData.PassPrice = landData.passPrice;
124 updatePacket.ParcelData.PublicCount = 0; //unemplemented 124 updatePacket.ParcelData.PublicCount = 0; //unemplemented
125 updatePacket.ParcelData.RegionDenyAnonymous = (((uint)m_world.RegionInfo.estateSettings.regionFlags & (uint)Simulator.RegionFlags.DenyAnonymous) > 0); 125
126 updatePacket.ParcelData.RegionDenyIdentified = (((uint)m_world.RegionInfo.estateSettings.regionFlags & (uint)Simulator.RegionFlags.DenyIdentified) > 0); 126 uint regionFlags = (uint)m_scene.RegionInfo.estateSettings.regionFlags;
127 updatePacket.ParcelData.RegionDenyTransacted = (((uint)m_world.RegionInfo.estateSettings.regionFlags & (uint)Simulator.RegionFlags.DenyTransacted) > 0); 127 updatePacket.ParcelData.RegionDenyAnonymous = ((regionFlags & (uint)Simulator.RegionFlags.DenyAnonymous) > 0);
128 updatePacket.ParcelData.RegionPushOverride = (((uint)m_world.RegionInfo.estateSettings.regionFlags & (uint)Simulator.RegionFlags.RestrictPushObject) > 0); 128 updatePacket.ParcelData.RegionDenyIdentified = ((regionFlags & (uint)Simulator.RegionFlags.DenyIdentified) > 0);
129 updatePacket.ParcelData.RegionDenyTransacted = ((regionFlags & (uint)Simulator.RegionFlags.DenyTransacted) > 0);
130 updatePacket.ParcelData.RegionPushOverride = ((regionFlags & (uint)Simulator.RegionFlags.RestrictPushObject) > 0);
131
129 updatePacket.ParcelData.RentPrice = 0; 132 updatePacket.ParcelData.RentPrice = 0;
130 updatePacket.ParcelData.RequestResult = request_result; 133 updatePacket.ParcelData.RequestResult = request_result;
131 updatePacket.ParcelData.SalePrice = landData.salePrice; 134 updatePacket.ParcelData.SalePrice = landData.salePrice;
@@ -134,7 +137,7 @@ namespace OpenSim.Region.Environment.LandManagement
134 updatePacket.ParcelData.SequenceID = sequence_id; 137 updatePacket.ParcelData.SequenceID = sequence_id;
135 if (landData.simwideArea > 0) 138 if (landData.simwideArea > 0)
136 { 139 {
137 updatePacket.ParcelData.SimWideMaxPrims = Convert.ToInt32(Math.Round((Convert.ToDecimal(landData.simwideArea) / Convert.ToDecimal(65536)) * 15000 * Convert.ToDecimal(m_world.RegionInfo.estateSettings.objectBonusFactor))); 140 updatePacket.ParcelData.SimWideMaxPrims = Convert.ToInt32(Math.Round((Convert.ToDecimal(landData.simwideArea) / Convert.ToDecimal(65536)) * 15000 * Convert.ToDecimal(m_scene.RegionInfo.estateSettings.objectBonusFactor)));
138 } 141 }
139 else 142 else
140 { 143 {
@@ -180,10 +183,10 @@ namespace OpenSim.Region.Environment.LandManagement
180 183
181 public void sendLandUpdateToAvatarsOverMe() 184 public void sendLandUpdateToAvatarsOverMe()
182 { 185 {
183 List<ScenePresence> avatars = m_world.RequestAvatarList(); 186 List<ScenePresence> avatars = m_scene.RequestAvatarList();
184 for (int i = 0; i < avatars.Count; i++) 187 for (int i = 0; i < avatars.Count; i++)
185 { 188 {
186 Land over = m_world.LandManager.getLandObject((int)Math.Round(avatars[i].Pos.X), (int)Math.Round(avatars[i].Pos.Y)); 189 Land over = m_scene.LandManager.getLandObject((int)Math.Round(avatars[i].Pos.X), (int)Math.Round(avatars[i].Pos.Y));
187 if (over.landData.localID == this.landData.localID) 190 if (over.landData.localID == this.landData.localID)
188 { 191 {
189 sendLandProperties(0, false, 0, avatars[i].ControllingClient); 192 sendLandProperties(0, false, 0, avatars[i].ControllingClient);
@@ -219,8 +222,8 @@ namespace OpenSim.Region.Environment.LandManagement
219 } 222 }
220 } 223 }
221 } 224 }
222 landData.AABBMin = new LLVector3((float)(min_x * 4), (float)(min_y * 4), (float)m_world.Terrain.GetHeight((min_x * 4), (min_y * 4))); 225 landData.AABBMin = new LLVector3((float)(min_x * 4), (float)(min_y * 4), (float)m_scene.Terrain.GetHeight((min_x * 4), (min_y * 4)));
223 landData.AABBMax = new LLVector3((float)(max_x * 4), (float)(max_y * 4), (float)m_world.Terrain.GetHeight((max_x * 4), (max_y * 4))); 226 landData.AABBMax = new LLVector3((float)(max_x * 4), (float)(max_y * 4), (float)m_scene.Terrain.GetHeight((max_x * 4), (max_y * 4)));
224 landData.area = tempArea; 227 landData.area = tempArea;
225 } 228 }
226 229
diff --git a/OpenSim/Region/Environment/LandManagement/LandManager.cs b/OpenSim/Region/Environment/LandManagement/LandManager.cs
index be2913b..8c359fc 100644
--- a/OpenSim/Region/Environment/LandManagement/LandManager.cs
+++ b/OpenSim/Region/Environment/LandManagement/LandManager.cs
@@ -85,16 +85,16 @@ namespace OpenSim.Region.Environment.LandManagement
85 /// </summary> 85 /// </summary>
86 public bool landPrimCountTainted = false; 86 public bool landPrimCountTainted = false;
87 87
88 private Scene m_world; 88 private Scene m_scene;
89 private RegionInfo m_regInfo; 89 private RegionInfo m_regInfo;
90 90
91 #endregion 91 #endregion
92 92
93 #region Constructors 93 #region Constructors
94 public LandManager(Scene world, RegionInfo reginfo) 94 public LandManager(Scene scene, RegionInfo reginfo)
95 { 95 {
96 96
97 m_world = world; 97 m_scene = scene;
98 m_regInfo = reginfo; 98 m_regInfo = reginfo;
99 landIDList.Initialize(); 99 landIDList.Initialize();
100 100
@@ -106,7 +106,7 @@ namespace OpenSim.Region.Environment.LandManagement
106 #region Parcel From Storage Functions 106 #region Parcel From Storage Functions
107 public void LandFromStorage(LandData data) 107 public void LandFromStorage(LandData data)
108 { 108 {
109 Land new_land = new Land(data.ownerID, data.isGroupOwned, m_world); 109 Land new_land = new Land(data.ownerID, data.isGroupOwned, m_scene);
110 new_land.landData = data.Copy(); 110 new_land.landData = data.Copy();
111 new_land.setLandBitmapFromByteArray(); 111 new_land.setLandBitmapFromByteArray();
112 addLandObject(new_land); 112 addLandObject(new_land);
@@ -126,7 +126,7 @@ namespace OpenSim.Region.Environment.LandManagement
126 /// <returns></returns> 126 /// <returns></returns>
127 public Land createBaseLand() 127 public Land createBaseLand()
128 { 128 {
129 return new Land(new LLUUID(), false, m_world); 129 return new Land(new LLUUID(), false, m_scene);
130 } 130 }
131 131
132 /// <summary> 132 /// <summary>
@@ -517,7 +517,7 @@ namespace OpenSim.Region.Environment.LandManagement
517 lastLandLocalID = START_LAND_LOCAL_ID - 1; 517 lastLandLocalID = START_LAND_LOCAL_ID - 1;
518 landIDList.Initialize(); 518 landIDList.Initialize();
519 519
520 Land fullSimParcel = new Land(LLUUID.Zero, false, m_world); 520 Land fullSimParcel = new Land(LLUUID.Zero, false, m_scene);
521 521
522 fullSimParcel.setLandBitmap(Land.getSquareLandBitmap(0, 0, 256, 256)); 522 fullSimParcel.setLandBitmap(Land.getSquareLandBitmap(0, 0, 256, 256));
523 fullSimParcel.landData.ownerID = m_regInfo.MasterAvatarAssignedUUID; 523 fullSimParcel.landData.ownerID = m_regInfo.MasterAvatarAssignedUUID;
@@ -529,7 +529,7 @@ namespace OpenSim.Region.Environment.LandManagement
529 529
530 public void handleSignificantClientMovement(IClientAPI remote_client) 530 public void handleSignificantClientMovement(IClientAPI remote_client)
531 { 531 {
532 ScenePresence clientAvatar = m_world.RequestAvatar(remote_client.AgentId); 532 ScenePresence clientAvatar = m_scene.RequestAvatar(remote_client.AgentId);
533 if (clientAvatar != null) 533 if (clientAvatar != null)
534 { 534 {
535 Land over = getLandObject(clientAvatar.Pos.X,clientAvatar.Pos.Y); 535 Land over = getLandObject(clientAvatar.Pos.X,clientAvatar.Pos.Y);
diff --git a/OpenSim/Region/Environment/Scenes/Entity.cs b/OpenSim/Region/Environment/Scenes/Entity.cs
index 2456a4e..204b68f 100644
--- a/OpenSim/Region/Environment/Scenes/Entity.cs
+++ b/OpenSim/Region/Environment/Scenes/Entity.cs
@@ -31,8 +31,8 @@ using OpenSim.Physics.Manager;
31 31
32namespace OpenSim.Region.Environment.Scenes 32namespace OpenSim.Region.Environment.Scenes
33{ 33{
34 public abstract class Entity :EntityBase //this class (Entity) will be phased out 34 public abstract class Entity : EntityBase //this class (Entity) will be phased out
35 { 35 {
36 protected PhysicsActor _physActor; 36 protected PhysicsActor _physActor;
37 37
38 /// <summary> 38 /// <summary>
@@ -42,7 +42,7 @@ namespace OpenSim.Region.Environment.Scenes
42 { 42 {
43 get 43 get
44 { 44 {
45 if (this._physActor != null) 45 if (_physActor != null)
46 { 46 {
47 m_pos.X = _physActor.Position.X; 47 m_pos.X = _physActor.Position.X;
48 m_pos.Y = _physActor.Position.Y; 48 m_pos.Y = _physActor.Position.Y;
@@ -53,14 +53,13 @@ namespace OpenSim.Region.Environment.Scenes
53 } 53 }
54 set 54 set
55 { 55 {
56 if (this._physActor != null) 56 if (_physActor != null)
57 { 57 {
58 try 58 try
59 { 59 {
60 lock (this.m_world.SyncRoot) 60 lock (m_scene.SyncRoot)
61 { 61 {
62 62 _physActor.Position = new PhysicsVector(value.X, value.Y, value.Z);
63 this._physActor.Position = new PhysicsVector(value.X, value.Y, value.Z);
64 } 63 }
65 } 64 }
66 catch (Exception e) 65 catch (Exception e)
@@ -73,7 +72,7 @@ namespace OpenSim.Region.Environment.Scenes
73 } 72 }
74 } 73 }
75 74
76 75
77 /// <summary> 76 /// <summary>
78 /// 77 ///
79 /// </summary> 78 /// </summary>
@@ -81,7 +80,7 @@ namespace OpenSim.Region.Environment.Scenes
81 { 80 {
82 get 81 get
83 { 82 {
84 if (this._physActor != null) 83 if (_physActor != null)
85 { 84 {
86 m_velocity.X = _physActor.Velocity.X; 85 m_velocity.X = _physActor.Velocity.X;
87 m_velocity.Y = _physActor.Velocity.Y; 86 m_velocity.Y = _physActor.Velocity.Y;
@@ -92,14 +91,13 @@ namespace OpenSim.Region.Environment.Scenes
92 } 91 }
93 set 92 set
94 { 93 {
95 if (this._physActor != null) 94 if (_physActor != null)
96 { 95 {
97 try 96 try
98 { 97 {
99 lock (this.m_world.SyncRoot) 98 lock (m_scene.SyncRoot)
100 { 99 {
101 100 _physActor.Velocity = new PhysicsVector(value.X, value.Y, value.Z);
102 this._physActor.Velocity = new PhysicsVector(value.X, value.Y, value.Z);
103 } 101 }
104 } 102 }
105 catch (Exception e) 103 catch (Exception e)
@@ -112,4 +110,4 @@ namespace OpenSim.Region.Environment.Scenes
112 } 110 }
113 } 111 }
114 } 112 }
115} 113} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Scenes/EntityBase.cs b/OpenSim/Region/Environment/Scenes/EntityBase.cs
index 0d1e3fc..08f13c2 100644
--- a/OpenSim/Region/Environment/Scenes/EntityBase.cs
+++ b/OpenSim/Region/Environment/Scenes/EntityBase.cs
@@ -11,7 +11,7 @@ namespace OpenSim.Region.Environment.Scenes
11 protected List<EntityBase> m_children; 11 protected List<EntityBase> m_children;
12 12
13 13
14 protected Scene m_world; 14 protected Scene m_scene;
15 protected string m_name; 15 protected string m_name;
16 16
17 /// <summary> 17 /// <summary>
@@ -24,19 +24,14 @@ namespace OpenSim.Region.Environment.Scenes
24 } 24 }
25 25
26 protected LLVector3 m_pos; 26 protected LLVector3 m_pos;
27
27 /// <summary> 28 /// <summary>
28 /// 29 ///
29 /// </summary> 30 /// </summary>
30 public virtual LLVector3 Pos 31 public virtual LLVector3 Pos
31 { 32 {
32 get 33 get { return m_pos; }
33 { 34 set { m_pos = value; }
34 return m_pos;
35 }
36 set
37 {
38 m_pos = value;
39 }
40 } 35 }
41 36
42 public LLVector3 m_velocity; 37 public LLVector3 m_velocity;
@@ -46,28 +41,16 @@ namespace OpenSim.Region.Environment.Scenes
46 /// </summary> 41 /// </summary>
47 public virtual LLVector3 Velocity 42 public virtual LLVector3 Velocity
48 { 43 {
49 get 44 get { return m_velocity; }
50 { 45 set { m_velocity = value; }
51 return m_velocity;
52 }
53 set
54 {
55 m_velocity = value;
56 }
57 } 46 }
58 47
59 protected Quaternion m_rotation = new Quaternion(0,0,1,0); 48 protected Quaternion m_rotation = new Quaternion(0, 0, 1, 0);
60 49
61 public virtual Quaternion Rotation 50 public virtual Quaternion Rotation
62 { 51 {
63 get 52 get { return m_rotation; }
64 { 53 set { m_rotation = value; }
65 return m_rotation;
66 }
67 set
68 {
69 m_rotation = value;
70 }
71 } 54 }
72 55
73 protected uint m_localId; 56 protected uint m_localId;
@@ -91,19 +74,17 @@ namespace OpenSim.Region.Environment.Scenes
91 m_name = "(basic entity)"; 74 m_name = "(basic entity)";
92 75
93 m_children = new List<EntityBase>(); 76 m_children = new List<EntityBase>();
94
95 } 77 }
96 78
97 /// <summary> 79 /// <summary>
98 /// 80 ///
99 /// </summary> 81 /// </summary>
100 public virtual void updateMovement() 82 public virtual void UpdateMovement()
101 { 83 {
102
103 foreach (EntityBase child in m_children) 84 foreach (EntityBase child in m_children)
104 85
105 { 86 {
106 child.updateMovement(); 87 child.UpdateMovement();
107 } 88 }
108 } 89 }
109 90
@@ -125,7 +106,6 @@ namespace OpenSim.Region.Environment.Scenes
125 /// </summary> 106 /// </summary>
126 public virtual void BackUp() 107 public virtual void BackUp()
127 { 108 {
128
129 } 109 }
130 110
131 /// <summary> 111 /// <summary>
@@ -134,7 +114,7 @@ namespace OpenSim.Region.Environment.Scenes
134 /// <returns></returns> 114 /// <returns></returns>
135 public virtual EntityBase Copy() 115 public virtual EntityBase Copy()
136 { 116 {
137 return (EntityBase)this.MemberwiseClone(); 117 return (EntityBase) MemberwiseClone();
138 } 118 }
139 119
140 /// <summary> 120 /// <summary>
@@ -142,7 +122,6 @@ namespace OpenSim.Region.Environment.Scenes
142 /// </summary> 122 /// </summary>
143 public virtual void LandRenegerated() 123 public virtual void LandRenegerated()
144 { 124 {
145
146 } 125 }
147 } 126 }
148} 127} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Scenes/Primitive.cs b/OpenSim/Region/Environment/Scenes/Primitive.cs
index 93e4959..ce5c327 100644
--- a/OpenSim/Region/Environment/Scenes/Primitive.cs
+++ b/OpenSim/Region/Environment/Scenes/Primitive.cs
@@ -138,22 +138,11 @@ namespace OpenSim.Region.Environment.Scenes
138 138
139 #region Constructors 139 #region Constructors
140 140
141 /// <summary> 141 public Primitive(ulong regionHandle, Scene scene, LLUUID ownerID, uint localID, bool isRoot, EntityBase parent,
142 ///
143 /// </summary>
144 /// <param name="regionHandle"></param>
145 /// <param name="world"></param>
146 /// <param name="addPacket"></param>
147 /// <param name="ownerID"></param>
148 /// <param name="localID"></param>
149 /// <param name="isRoot"></param>
150 /// <param name="parent"></param>
151 /// <param name="rootObject"></param>
152 public Primitive(ulong regionHandle, Scene world, LLUUID ownerID, uint localID, bool isRoot, EntityBase parent,
153 SceneObject rootObject, PrimitiveBaseShape shape, LLVector3 pos) 142 SceneObject rootObject, PrimitiveBaseShape shape, LLVector3 pos)
154 { 143 {
155 m_regionHandle = regionHandle; 144 m_regionHandle = regionHandle;
156 m_world = world; 145 m_scene = scene;
157 m_inventoryItems = new Dictionary<LLUUID, InventoryItem>(); 146 m_inventoryItems = new Dictionary<LLUUID, InventoryItem>();
158 m_Parent = parent; 147 m_Parent = parent;
159 m_isRootPrim = isRoot; 148 m_isRootPrim = isRoot;
@@ -163,7 +152,7 @@ namespace OpenSim.Region.Environment.Scenes
163 152
164 Rotation = Quaternion.Identity; 153 Rotation = Quaternion.Identity;
165 154
166 m_world.AcknowledgeNewPrim(this); 155 m_scene.AcknowledgeNewPrim(this);
167 156
168 OnPrimCountTainted(); 157 OnPrimCountTainted();
169 } 158 }
@@ -202,10 +191,10 @@ namespace OpenSim.Region.Environment.Scenes
202 dupe.m_children = new List<EntityBase>(); 191 dupe.m_children = new List<EntityBase>();
203 dupe.m_Shape = m_Shape.Copy(); 192 dupe.m_Shape = m_Shape.Copy();
204 dupe.m_regionHandle = m_regionHandle; 193 dupe.m_regionHandle = m_regionHandle;
205 dupe.m_world = m_world; 194 dupe.m_scene = m_scene;
206 195
207 196
208 uint newLocalID = m_world.PrimIDAllocate(); 197 uint newLocalID = m_scene.PrimIDAllocate();
209 dupe.m_uuid = LLUUID.Random(); 198 dupe.m_uuid = LLUUID.Random();
210 dupe.LocalId = newLocalID; 199 dupe.LocalId = newLocalID;
211 200
@@ -225,7 +214,7 @@ namespace OpenSim.Region.Environment.Scenes
225 dupe.m_pos = new LLVector3(m_pos.X, m_pos.Y, m_pos.Z); 214 dupe.m_pos = new LLVector3(m_pos.X, m_pos.Y, m_pos.Z);
226 215
227 rootParent.AddChildToList(dupe); 216 rootParent.AddChildToList(dupe);
228 m_world.AcknowledgeNewPrim(dupe); 217 m_scene.AcknowledgeNewPrim(dupe);
229 dupe.TriggerOnPrimCountTainted(); 218 dupe.TriggerOnPrimCountTainted();
230 219
231 220
@@ -327,7 +316,7 @@ namespace OpenSim.Region.Environment.Scenes
327 m_children.Add(linkObject.rootPrimitive); 316 m_children.Add(linkObject.rootPrimitive);
328 linkObject.rootPrimitive.SetNewParent(this, m_RootParent); 317 linkObject.rootPrimitive.SetNewParent(this, m_RootParent);
329 318
330 m_world.DeleteEntity(linkObject.rootUUID); 319 m_scene.DeleteEntity(linkObject.rootUUID);
331 linkObject.DeleteAllChildren(); 320 linkObject.DeleteAllChildren();
332 321
333 OnPrimCountTainted(); 322 OnPrimCountTainted();
@@ -676,7 +665,7 @@ namespace OpenSim.Region.Environment.Scenes
676 /// </summary> 665 /// </summary>
677 public void SendFullUpdateToAllClients() 666 public void SendFullUpdateToAllClients()
678 { 667 {
679 List<ScenePresence> avatars = m_world.RequestAvatarList(); 668 List<ScenePresence> avatars = m_scene.RequestAvatarList();
680 for (int i = 0; i < avatars.Count; i++) 669 for (int i = 0; i < avatars.Count; i++)
681 { 670 {
682 SendFullUpdateToClient(avatars[i].ControllingClient); 671 SendFullUpdateToClient(avatars[i].ControllingClient);
@@ -721,7 +710,7 @@ namespace OpenSim.Region.Environment.Scenes
721 /// </summary> 710 /// </summary>
722 public void SendTerseUpdateToALLClients() 711 public void SendTerseUpdateToALLClients()
723 { 712 {
724 List<ScenePresence> avatars = m_world.RequestAvatarList(); 713 List<ScenePresence> avatars = m_scene.RequestAvatarList();
725 for (int i = 0; i < avatars.Count; i++) 714 for (int i = 0; i < avatars.Count; i++)
726 { 715 {
727 SendTerseUpdateToClient(avatars[i].ControllingClient); 716 SendTerseUpdateToClient(avatars[i].ControllingClient);
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs
index 0e25e54..39584ad 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.cs
@@ -140,23 +140,23 @@ namespace OpenSim.Region.Environment.Scenes
140 m_eventManager = new EventManager(); 140 m_eventManager = new EventManager();
141 141
142 m_eventManager.OnParcelPrimCountAdd += 142 m_eventManager.OnParcelPrimCountAdd +=
143 new EventManager.OnParcelPrimCountAddDelegate(m_LandManager.addPrimToLandPrimCounts); 143 m_LandManager.addPrimToLandPrimCounts;
144 144
145 MainLog.Instance.Verbose("World.cs - creating new entitities instance"); 145 MainLog.Instance.Verbose("Creating new entitities instance");
146 Entities = new Dictionary<LLUUID, EntityBase>(); 146 Entities = new Dictionary<LLUUID, EntityBase>();
147 Avatars = new Dictionary<LLUUID, ScenePresence>(); 147 Avatars = new Dictionary<LLUUID, ScenePresence>();
148 Prims = new Dictionary<LLUUID, SceneObject>(); 148 Prims = new Dictionary<LLUUID, SceneObject>();
149 149
150 MainLog.Instance.Verbose("World.cs - loading objects from datastore"); 150 MainLog.Instance.Verbose("Loading objects from datastore");
151 List<SceneObject> PrimsFromDB = storageManager.DataStore.LoadObjects(); 151 List<SceneObject> PrimsFromDB = storageManager.DataStore.LoadObjects();
152 foreach (SceneObject prim in PrimsFromDB) 152 foreach (SceneObject prim in PrimsFromDB)
153 { 153 {
154 AddEntity(prim); 154 AddEntity(prim);
155 } 155 }
156 MainLog.Instance.Verbose("World.cs - loaded " + PrimsFromDB.Count.ToString() + " object(s)"); 156 MainLog.Instance.Verbose("Loaded " + PrimsFromDB.Count.ToString() + " object(s)");
157 157
158 158
159 MainLog.Instance.Verbose("World.cs - creating LandMap"); 159 MainLog.Instance.Verbose("Creating LandMap");
160 Terrain = new TerrainEngine(); 160 Terrain = new TerrainEngine();
161 161
162 ScenePresence.LoadAnims(); 162 ScenePresence.LoadAnims();
@@ -198,7 +198,7 @@ namespace OpenSim.Region.Environment.Scenes
198 } 198 }
199 199
200 /// <summary> 200 /// <summary>
201 /// Performs per-frame updates on the world, this should be the central world loop 201 /// Performs per-frame updates on the scene, this should be the central world loop
202 /// </summary> 202 /// </summary>
203 public override void Update() 203 public override void Update()
204 { 204 {
@@ -210,9 +210,11 @@ namespace OpenSim.Region.Environment.Scenes
210 phyScene.GetResults(); 210 phyScene.GetResults();
211 } 211 }
212 212
213 foreach (LLUUID UUID in Entities.Keys) 213 List<EntityBase> moveEntities = new List<EntityBase>( Entities.Values );
214
215 foreach (EntityBase entity in moveEntities)
214 { 216 {
215 Entities[UUID].updateMovement(); 217 entity.UpdateMovement();
216 } 218 }
217 219
218 lock (m_syncRoot) 220 lock (m_syncRoot)
@@ -220,9 +222,11 @@ namespace OpenSim.Region.Environment.Scenes
220 phyScene.Simulate(timeStep); 222 phyScene.Simulate(timeStep);
221 } 223 }
222 224
223 foreach (LLUUID UUID in Entities.Keys) 225 List<EntityBase> updateEntities = new List<EntityBase>(Entities.Values);
226
227 foreach (EntityBase entity in updateEntities)
224 { 228 {
225 Entities[UUID].Update(); 229 entity.Update();
226 } 230 }
227 231
228 // General purpose event manager 232 // General purpose event manager
diff --git a/OpenSim/Region/Environment/Scenes/SceneBase.cs b/OpenSim/Region/Environment/Scenes/SceneBase.cs
index 76a8439..0038b39 100644
--- a/OpenSim/Region/Environment/Scenes/SceneBase.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneBase.cs
@@ -38,7 +38,7 @@ using OpenSim.Framework;
38 38
39namespace OpenSim.Region.Environment.Scenes 39namespace OpenSim.Region.Environment.Scenes
40{ 40{
41 public abstract class SceneBase : IWorld 41 public abstract class SceneBase : IScene
42 { 42 {
43 public Dictionary<LLUUID, EntityBase> Entities; 43 public Dictionary<LLUUID, EntityBase> Entities;
44 protected ulong m_regionHandle; 44 protected ulong m_regionHandle;
diff --git a/OpenSim/Region/Environment/Scenes/SceneObject.cs b/OpenSim/Region/Environment/Scenes/SceneObject.cs
index d513634..03a7f55 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObject.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObject.cs
@@ -86,7 +86,7 @@ namespace OpenSim.Region.Environment.Scenes
86 public SceneObject(Scene world, EventManager eventManager, LLUUID ownerID, uint localID, LLVector3 pos, PrimitiveBaseShape shape) 86 public SceneObject(Scene world, EventManager eventManager, LLUUID ownerID, uint localID, LLVector3 pos, PrimitiveBaseShape shape)
87 { 87 {
88 m_regionHandle = world.RegionInfo.RegionHandle; 88 m_regionHandle = world.RegionInfo.RegionHandle;
89 m_world = world; 89 m_scene = world;
90 m_eventManager = eventManager; 90 m_eventManager = eventManager;
91 91
92 this.Pos = pos; 92 this.Pos = pos;
@@ -102,7 +102,7 @@ namespace OpenSim.Region.Environment.Scenes
102 /// <remarks>Need a null constructor for duplication</remarks> 102 /// <remarks>Need a null constructor for duplication</remarks>
103 public SceneObject() 103 public SceneObject()
104 { 104 {
105 105
106 } 106 }
107 107
108 public void registerEvents() 108 public void registerEvents()
@@ -144,7 +144,7 @@ namespace OpenSim.Region.Environment.Scenes
144 public void CreateRootFromShape(LLUUID agentID, uint localID, PrimitiveBaseShape shape, LLVector3 pos) 144 public void CreateRootFromShape(LLUUID agentID, uint localID, PrimitiveBaseShape shape, LLVector3 pos)
145 { 145 {
146 146
147 this.rootPrimitive = new Primitive(this.m_regionHandle, this.m_world, agentID, localID, true, this, this, shape, pos); 147 this.rootPrimitive = new Primitive(this.m_regionHandle, this.m_scene, agentID, localID, true, this, this, shape, pos);
148 this.m_children.Add(rootPrimitive); 148 this.m_children.Add(rootPrimitive);
149 149
150 this.ChildPrimitives.Add(this.rootUUID, this.rootPrimitive); 150 this.ChildPrimitives.Add(this.rootUUID, this.rootPrimitive);
@@ -167,7 +167,7 @@ namespace OpenSim.Region.Environment.Scenes
167 { 167 {
168 SceneObject dupe = new SceneObject(); 168 SceneObject dupe = new SceneObject();
169 169
170 dupe.m_world = this.m_world; 170 dupe.m_scene = this.m_scene;
171 dupe.m_eventManager = this.m_eventManager; 171 dupe.m_eventManager = this.m_eventManager;
172 dupe.m_regionHandle = this.m_regionHandle; 172 dupe.m_regionHandle = this.m_regionHandle;
173 Primitive newRoot = this.rootPrimitive.Copy(dupe, dupe); 173 Primitive newRoot = this.rootPrimitive.Copy(dupe, dupe);
@@ -176,7 +176,7 @@ namespace OpenSim.Region.Environment.Scenes
176 dupe.m_children.Add(dupe.rootPrimitive); 176 dupe.m_children.Add(dupe.rootPrimitive);
177 dupe.rootPrimitive.Pos = this.Pos; 177 dupe.rootPrimitive.Pos = this.Pos;
178 dupe.Rotation = this.Rotation; 178 dupe.Rotation = this.Rotation;
179 dupe.LocalId = m_world.PrimIDAllocate(); 179 dupe.LocalId = m_scene.PrimIDAllocate();
180 180
181 dupe.registerEvents(); 181 dupe.registerEvents();
182 return dupe; 182 return dupe;
diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs
index e81ac7b..b3255c4 100644
--- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs
@@ -120,7 +120,7 @@ namespace OpenSim.Region.Environment.Scenes
120 public ScenePresence(IClientAPI theClient, Scene world, RegionInfo reginfo) 120 public ScenePresence(IClientAPI theClient, Scene world, RegionInfo reginfo)
121 { 121 {
122 122
123 m_world = world; 123 m_scene = world;
124 this.m_uuid = theClient.AgentId; 124 this.m_uuid = theClient.AgentId;
125 125
126 m_regionInfo = reginfo; 126 m_regionInfo = reginfo;
@@ -129,7 +129,7 @@ namespace OpenSim.Region.Environment.Scenes
129 ControllingClient = theClient; 129 ControllingClient = theClient;
130 this.firstname = ControllingClient.FirstName; 130 this.firstname = ControllingClient.FirstName;
131 this.lastname = ControllingClient.LastName; 131 this.lastname = ControllingClient.LastName;
132 m_localId = m_world.NextLocalId; 132 m_localId = m_scene.NextLocalId;
133 Pos = ControllingClient.StartPos; 133 Pos = ControllingClient.StartPos;
134 visualParams = new byte[218]; 134 visualParams = new byte[218];
135 for (int i = 0; i < 218; i++) 135 for (int i = 0; i < 218; i++)
@@ -394,7 +394,7 @@ namespace OpenSim.Region.Environment.Scenes
394 /// </summary> 394 /// </summary>
395 public void SendTerseUpdateToALLClients() 395 public void SendTerseUpdateToALLClients()
396 { 396 {
397 List<ScenePresence> avatars = this.m_world.RequestAvatarList(); 397 List<ScenePresence> avatars = this.m_scene.RequestAvatarList();
398 for (int i = 0; i < avatars.Count; i++) 398 for (int i = 0; i < avatars.Count; i++)
399 { 399 {
400 this.SendTerseUpdateToClient(avatars[i].ControllingClient); 400 this.SendTerseUpdateToClient(avatars[i].ControllingClient);
@@ -412,8 +412,8 @@ namespace OpenSim.Region.Environment.Scenes
412 412
413 public void SendFullUpdateToALLClients() 413 public void SendFullUpdateToALLClients()
414 { 414 {
415 List<ScenePresence> avatars = this.m_world.RequestAvatarList(); 415 List<ScenePresence> avatars = this.m_scene.RequestAvatarList();
416 foreach (ScenePresence avatar in this.m_world.RequestAvatarList()) 416 foreach (ScenePresence avatar in this.m_scene.RequestAvatarList())
417 { 417 {
418 this.SendFullUpdateToOtherClient(avatar); 418 this.SendFullUpdateToOtherClient(avatar);
419 avatar.SendFullUpdateToOtherClient(this); 419 avatar.SendFullUpdateToOtherClient(this);
@@ -428,7 +428,7 @@ namespace OpenSim.Region.Environment.Scenes
428 this.ControllingClient.SendAvatarData(m_regionInfo.RegionHandle, this.firstname, this.lastname, this.m_uuid, this.LocalId, this.Pos, DefaultTexture); 428 this.ControllingClient.SendAvatarData(m_regionInfo.RegionHandle, this.firstname, this.lastname, this.m_uuid, this.LocalId, this.Pos, DefaultTexture);
429 if (this.newAvatar) 429 if (this.newAvatar)
430 { 430 {
431 this.m_world.InformClientOfNeighbours(this.ControllingClient); 431 this.m_scene.InformClientOfNeighbours(this.ControllingClient);
432 this.newAvatar = false; 432 this.newAvatar = false;
433 } 433 }
434 } 434 }
@@ -441,7 +441,7 @@ namespace OpenSim.Region.Environment.Scenes
441 { 441 {
442 this.ControllingClient.SendWearables(this.Wearables); 442 this.ControllingClient.SendWearables(this.Wearables);
443 this.SendFullUpdateToALLClients(); 443 this.SendFullUpdateToALLClients();
444 this.m_world.SendAllSceneObjectsToClient(this.ControllingClient); 444 this.m_scene.SendAllSceneObjectsToClient(this.ControllingClient);
445 } 445 }
446 446
447 /// <summary> 447 /// <summary>
@@ -462,7 +462,7 @@ namespace OpenSim.Region.Environment.Scenes
462 { 462 {
463 this.current_anim = animID; 463 this.current_anim = animID;
464 this.anim_seq = seq; 464 this.anim_seq = seq;
465 List<ScenePresence> avatars = this.m_world.RequestAvatarList(); 465 List<ScenePresence> avatars = this.m_scene.RequestAvatarList();
466 for (int i = 0; i < avatars.Count; i++) 466 for (int i = 0; i < avatars.Count; i++)
467 { 467 {
468 avatars[i].ControllingClient.SendAnimation(animID, seq, this.ControllingClient.AgentId); 468 avatars[i].ControllingClient.SendAnimation(animID, seq, this.ControllingClient.AgentId);
@@ -550,10 +550,10 @@ namespace OpenSim.Region.Environment.Scenes
550 550
551 LLVector3 vel = this.m_velocity; 551 LLVector3 vel = this.m_velocity;
552 ulong neighbourHandle = Helpers.UIntsToLong((uint)(neighbourx * 256), (uint)(neighboury * 256)); 552 ulong neighbourHandle = Helpers.UIntsToLong((uint)(neighbourx * 256), (uint)(neighboury * 256));
553 RegionInfo neighbourRegion = this.m_world.RequestNeighbouringRegionInfo(neighbourHandle); 553 RegionInfo neighbourRegion = this.m_scene.RequestNeighbouringRegionInfo(neighbourHandle);
554 if (neighbourRegion != null) 554 if (neighbourRegion != null)
555 { 555 {
556 bool res = this.m_world.InformNeighbourOfCrossing(neighbourHandle, this.ControllingClient.AgentId, newpos, this._physActor.Flying); 556 bool res = this.m_scene.InformNeighbourOfCrossing(neighbourHandle, this.ControllingClient.AgentId, newpos, this._physActor.Flying);
557 if (res) 557 if (res)
558 { 558 {
559 this.ControllingClient.CrossRegion(neighbourHandle, newpos, vel, neighbourRegion.ExternalEndPoint); 559 this.ControllingClient.CrossRegion(neighbourHandle, newpos, vel, neighbourRegion.ExternalEndPoint);
@@ -574,7 +574,7 @@ namespace OpenSim.Region.Environment.Scenes
574 /// <summary> 574 /// <summary>
575 /// 575 ///
576 /// </summary> 576 /// </summary>
577 public override void updateMovement() 577 public override void UpdateMovement()
578 { 578 {
579 newForce = false; 579 newForce = false;
580 lock (this.forcesList) 580 lock (this.forcesList)