aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim.RegionServer/world/World.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim.RegionServer/world/World.cs')
-rw-r--r--OpenSim.RegionServer/world/World.cs31
1 files changed, 20 insertions, 11 deletions
diff --git a/OpenSim.RegionServer/world/World.cs b/OpenSim.RegionServer/world/World.cs
index e6d8921..0d126e6 100644
--- a/OpenSim.RegionServer/world/World.cs
+++ b/OpenSim.RegionServer/world/World.cs
@@ -25,10 +25,19 @@ namespace OpenSim.world
25 private Random Rand = new Random(); 25 private Random Rand = new Random();
26 private uint _primCount = 702000; 26 private uint _primCount = 702000;
27 private int storageCount; 27 private int storageCount;
28 private Dictionary<uint, SimClient> m_clientThreads;
29 private ulong m_regionHandle;
30 private string m_regionName;
31 private SimConfig m_cfg;
28 32
29 public World() 33 public World(Dictionary<uint, SimClient> clientThreads, ulong regionHandle, string regionName, SimConfig cfg)
30 { 34 {
31 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs - creating new entitities instance"); 35 m_clientThreads = clientThreads;
36 m_regionHandle = regionHandle;
37 m_regionName = regionName;
38 m_cfg = cfg;
39
40 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs - creating new entitities instance");
32 Entities = new Dictionary<libsecondlife.LLUUID, Entity>(); 41 Entities = new Dictionary<libsecondlife.LLUUID, Entity>();
33 42
34 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs - creating LandMap"); 43 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs - creating LandMap");
@@ -115,9 +124,9 @@ namespace OpenSim.world
115 HeightmapGenHills hills = new HeightmapGenHills(); 124 HeightmapGenHills hills = new HeightmapGenHills();
116 this.LandMap = hills.GenerateHeightmap(200, 4.0f, 80.0f, false); 125 this.LandMap = hills.GenerateHeightmap(200, 4.0f, 80.0f, false);
117 this.phyScene.SetTerrain(this.LandMap); 126 this.phyScene.SetTerrain(this.LandMap);
118 OpenSimRoot.Instance.Cfg.SaveMap(this.LandMap); 127 m_cfg.SaveMap(this.LandMap);
119 128
120 foreach(SimClient client in OpenSimRoot.Instance.ClientThreads.Values) { 129 foreach(SimClient client in m_clientThreads.Values) {
121 this.SendLayerData(client); 130 this.SendLayerData(client);
122 } 131 }
123 } 132 }
@@ -134,7 +143,7 @@ namespace OpenSim.world
134 _primCount = prim.LocalID + 1; 143 _primCount = prim.LocalID + 1;
135 } 144 }
136 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs: PrimFromStorage() - Reloading prim (localId "+ prim.LocalID+ " ) from storage"); 145 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs: PrimFromStorage() - Reloading prim (localId "+ prim.LocalID+ " ) from storage");
137 Primitive nPrim = new Primitive(); 146 Primitive nPrim = new Primitive(m_clientThreads, m_regionHandle, this);
138 nPrim.CreateFromStorage(prim); 147 nPrim.CreateFromStorage(prim);
139 this.Entities.Add(nPrim.uuid, nPrim); 148 this.Entities.Add(nPrim.uuid, nPrim);
140 } 149 }
@@ -175,7 +184,7 @@ namespace OpenSim.world
175 184
176 public void AddViewerAgent(SimClient AgentClient) { 185 public void AddViewerAgent(SimClient AgentClient) {
177 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs:AddViewerAgent() - Creating new avatar for remote viewer agent"); 186 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs:AddViewerAgent() - Creating new avatar for remote viewer agent");
178 Avatar NewAvatar = new Avatar(AgentClient); 187 Avatar NewAvatar = new Avatar(AgentClient, this, m_regionName, m_clientThreads, m_regionHandle );
179 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs:AddViewerAgent() - Adding new avatar to world"); 188 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs:AddViewerAgent() - Adding new avatar to world");
180 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs:AddViewerAgent() - Starting RegionHandshake "); 189 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs:AddViewerAgent() - Starting RegionHandshake ");
181 NewAvatar.SendRegionHandshake(this); 190 NewAvatar.SendRegionHandshake(this);
@@ -187,7 +196,7 @@ namespace OpenSim.world
187 public void AddNewPrim(ObjectAddPacket addPacket, SimClient AgentClient) 196 public void AddNewPrim(ObjectAddPacket addPacket, SimClient AgentClient)
188 { 197 {
189 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs: AddNewPrim() - Creating new prim"); 198 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs: AddNewPrim() - Creating new prim");
190 Primitive prim = new Primitive(); 199 Primitive prim = new Primitive(m_clientThreads, m_regionHandle, this );
191 prim.CreateFromPacket(addPacket, AgentClient.AgentID, this._primCount); 200 prim.CreateFromPacket(addPacket, AgentClient.AgentID, this._primCount);
192 PhysicsVector pVec = new PhysicsVector(prim.position.X, prim.position.Y, prim.position.Z); 201 PhysicsVector pVec = new PhysicsVector(prim.position.X, prim.position.Y, prim.position.Z);
193 PhysicsVector pSize = new PhysicsVector( 0.255f, 0.255f, 0.255f); 202 PhysicsVector pSize = new PhysicsVector( 0.255f, 0.255f, 0.255f);
@@ -210,7 +219,7 @@ namespace OpenSim.world
210 foreach( DeRezObjectPacket.ObjectDataBlock Data in DeRezPacket.ObjectData ) 219 foreach( DeRezObjectPacket.ObjectDataBlock Data in DeRezPacket.ObjectData )
211 { 220 {
212 //OpenSim.Framework.Console.MainConsole.Instance.WriteLine("LocalID:" + Data.ObjectLocalID.ToString()); 221 //OpenSim.Framework.Console.MainConsole.Instance.WriteLine("LocalID:" + Data.ObjectLocalID.ToString());
213 foreach (Entity ent in OpenSimRoot.Instance.LocalWorld.Entities.Values) 222 foreach (Entity ent in this.Entities.Values)
214 { 223 {
215 if (ent.localid == Data.ObjectLocalID) 224 if (ent.localid == Data.ObjectLocalID)
216 { 225 {
@@ -220,7 +229,7 @@ namespace OpenSim.world
220 kill.ObjectData = new KillObjectPacket.ObjectDataBlock[1]; 229 kill.ObjectData = new KillObjectPacket.ObjectDataBlock[1];
221 kill.ObjectData[0] = new KillObjectPacket.ObjectDataBlock(); 230 kill.ObjectData[0] = new KillObjectPacket.ObjectDataBlock();
222 kill.ObjectData[0].ID = ent.localid; 231 kill.ObjectData[0].ID = ent.localid;
223 foreach (SimClient client in OpenSimRoot.Instance.ClientThreads.Values) 232 foreach (SimClient client in m_clientThreads.Values)
224 { 233 {
225 client.OutPacket(kill); 234 client.OutPacket(kill);
226 } 235 }
@@ -234,9 +243,9 @@ namespace OpenSim.world
234 } 243 }
235 foreach( libsecondlife.LLUUID uuid in DeRezEnts ) 244 foreach( libsecondlife.LLUUID uuid in DeRezEnts )
236 { 245 {
237 lock (OpenSimRoot.Instance.LocalWorld.Entities) 246 lock (this.Entities)
238 { 247 {
239 OpenSimRoot.Instance.LocalWorld.Entities.Remove(uuid); 248 this.Entities.Remove(uuid);
240 } 249 }
241 } 250 }
242 251