aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim.RegionServer/world/World.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim.RegionServer/world/World.cs (renamed from src/world/World.cs)47
1 files changed, 26 insertions, 21 deletions
diff --git a/src/world/World.cs b/OpenSim.RegionServer/world/World.cs
index e1c84bc..ba99233 100644
--- a/src/world/World.cs
+++ b/OpenSim.RegionServer/world/World.cs
@@ -5,8 +5,10 @@ using System.Collections.Generic;
5using System.Text; 5using System.Text;
6using System.Reflection; 6using System.Reflection;
7using System.IO; 7using System.IO;
8using PhysicsSystem; 8using OpenSim.Physics.Manager;
9using GridInterfaces; 9using OpenSim.Framework.Interfaces;
10using OpenSim.Framework.Assets;
11using OpenSim.Framework.Terrain;
10 12
11namespace OpenSim.world 13namespace OpenSim.world
12{ 14{
@@ -26,10 +28,10 @@ namespace OpenSim.world
26 28
27 public World() 29 public World()
28 { 30 {
29 ServerConsole.MainConsole.Instance.WriteLine("World.cs - creating new entitities instance"); 31 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs - creating new entitities instance");
30 Entities = new Dictionary<libsecondlife.LLUUID, Entity>(); 32 Entities = new Dictionary<libsecondlife.LLUUID, Entity>();
31 33
32 ServerConsole.MainConsole.Instance.WriteLine("World.cs - creating LandMap"); 34 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs - creating LandMap");
33 TerrainManager = new TerrainManager(new SecondLife()); 35 TerrainManager = new TerrainManager(new SecondLife());
34 Avatar.SetupTemplate("avatar-template.dat"); 36 Avatar.SetupTemplate("avatar-template.dat");
35 // ServerConsole.MainConsole.Instance.WriteLine("World.cs - Creating script engine instance"); 37 // ServerConsole.MainConsole.Instance.WriteLine("World.cs - Creating script engine instance");
@@ -71,7 +73,7 @@ namespace OpenSim.world
71 73
72 //backup world data 74 //backup world data
73 this.storageCount++; 75 this.storageCount++;
74 if(storageCount> 300) //set to how often you want to backup 76 if(storageCount> 1200) //set to how often you want to backup
75 { 77 {
76 this.Backup(); 78 this.Backup();
77 storageCount =0; 79 storageCount =0;
@@ -112,15 +114,15 @@ namespace OpenSim.world
112 HeightmapGenHills hills = new HeightmapGenHills(); 114 HeightmapGenHills hills = new HeightmapGenHills();
113 this.LandMap = hills.GenerateHeightmap(200, 4.0f, 80.0f, false); 115 this.LandMap = hills.GenerateHeightmap(200, 4.0f, 80.0f, false);
114 this.phyScene.SetTerrain(this.LandMap); 116 this.phyScene.SetTerrain(this.LandMap);
115 OpenSim_Main.cfg.SaveMap(); 117 OpenSimRoot.Instance.Cfg.SaveMap(this.LandMap);
116 118
117 foreach(OpenSimClient client in OpenSim_Main.sim.ClientThreads.Values) { 119 foreach(SimClient client in OpenSimRoot.Instance.ClientThreads.Values) {
118 this.SendLayerData(client); 120 this.SendLayerData(client);
119 } 121 }
120 } 122 }
121 public void LoadPrimsFromStorage() 123 public void LoadPrimsFromStorage()
122 { 124 {
123 ServerConsole.MainConsole.Instance.WriteLine("World.cs: LoadPrimsFromStorage() - Loading primitives"); 125 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs: LoadPrimsFromStorage() - Loading primitives");
124 this.localStorage.LoadPrimitives(this); 126 this.localStorage.LoadPrimitives(this);
125 } 127 }
126 128
@@ -130,7 +132,7 @@ namespace OpenSim.world
130 { 132 {
131 _primCount = prim.LocalID + 1; 133 _primCount = prim.LocalID + 1;
132 } 134 }
133 ServerConsole.MainConsole.Instance.WriteLine("World.cs: PrimFromStorage() - Reloading prim (localId "+ prim.LocalID+ " ) from storage"); 135 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs: PrimFromStorage() - Reloading prim (localId "+ prim.LocalID+ " ) from storage");
134 Primitive nPrim = new Primitive(); 136 Primitive nPrim = new Primitive();
135 nPrim.CreateFromStorage(prim); 137 nPrim.CreateFromStorage(prim);
136 this.Entities.Add(nPrim.uuid, nPrim); 138 this.Entities.Add(nPrim.uuid, nPrim);
@@ -141,7 +143,7 @@ namespace OpenSim.world
141 this.localStorage.ShutDown(); 143 this.localStorage.ShutDown();
142 } 144 }
143 145
144 public void SendLayerData(OpenSimClient RemoteClient) { 146 public void SendLayerData(SimClient RemoteClient) {
145 int[] patches = new int[4]; 147 int[] patches = new int[4];
146 148
147 for (int y = 0; y < 16; y++) 149 for (int y = 0; y < 16; y++)
@@ -159,7 +161,7 @@ namespace OpenSim.world
159 } 161 }
160 } 162 }
161 163
162 public void GetInitialPrims(OpenSimClient RemoteClient) 164 public void GetInitialPrims(SimClient RemoteClient)
163 { 165 {
164 foreach (libsecondlife.LLUUID UUID in Entities.Keys) 166 foreach (libsecondlife.LLUUID UUID in Entities.Keys)
165 { 167 {
@@ -170,33 +172,36 @@ namespace OpenSim.world
170 } 172 }
171 } 173 }
172 174
173 public void AddViewerAgent(OpenSimClient AgentClient) { 175 public void AddViewerAgent(SimClient AgentClient) {
174 ServerConsole.MainConsole.Instance.WriteLine("World.cs:AddViewerAgent() - Creating new avatar for remote viewer agent"); 176 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs:AddViewerAgent() - Creating new avatar for remote viewer agent");
175 Avatar NewAvatar = new Avatar(AgentClient); 177 Avatar NewAvatar = new Avatar(AgentClient);
176 ServerConsole.MainConsole.Instance.WriteLine("World.cs:AddViewerAgent() - Adding new avatar to world"); 178 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs:AddViewerAgent() - Adding new avatar to world");
177 ServerConsole.MainConsole.Instance.WriteLine("World.cs:AddViewerAgent() - Starting RegionHandshake "); 179 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs:AddViewerAgent() - Starting RegionHandshake ");
178 NewAvatar.SendRegionHandshake(this); 180 NewAvatar.SendRegionHandshake(this);
179 PhysicsVector pVec = new PhysicsVector(NewAvatar.position.X, NewAvatar.position.Y, NewAvatar.position.Z); 181 PhysicsVector pVec = new PhysicsVector(NewAvatar.position.X, NewAvatar.position.Y, NewAvatar.position.Z);
180 NewAvatar.PhysActor = this.phyScene.AddAvatar(pVec); 182 NewAvatar.PhysActor = this.phyScene.AddAvatar(pVec);
181 this.Entities.Add(AgentClient.AgentID, NewAvatar); 183 this.Entities.Add(AgentClient.AgentID, NewAvatar);
182 } 184 }
183 185
184 public void AddNewPrim(ObjectAddPacket addPacket, OpenSimClient AgentClient) 186 public void AddNewPrim(ObjectAddPacket addPacket, SimClient AgentClient)
185 { 187 {
186 ServerConsole.MainConsole.Instance.WriteLine("World.cs: AddNewPrim() - Creating new prim"); 188 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs: AddNewPrim() - Creating new prim");
187 Primitive prim = new Primitive(); 189 Primitive prim = new Primitive();
188 prim.CreateFromPacket(addPacket, AgentClient.AgentID, this._primCount); 190 prim.CreateFromPacket(addPacket, AgentClient.AgentID, this._primCount);
189 PhysicsVector pVec = new PhysicsVector(prim.position.X, prim.position.Y, prim.position.Z); 191 PhysicsVector pVec = new PhysicsVector(prim.position.X, prim.position.Y, prim.position.Z);
190 PhysicsVector pSize = new PhysicsVector( 0.25f, 0.25f, 0.25f); 192 PhysicsVector pSize = new PhysicsVector( 0.255f, 0.255f, 0.255f);
191 //prim.PhysActor = this.phyScene.AddPrim(pVec, pSize ); 193 if(OpenSim.world.Avatar.PhysicsEngineFlying)
194 {
195 prim.PhysActor = this.phyScene.AddPrim(pVec, pSize );
196 }
192 //prim.PhysicsEnabled = true; 197 //prim.PhysicsEnabled = true;
193 this.Entities.Add(prim.uuid, prim); 198 this.Entities.Add(prim.uuid, prim);
194 this._primCount++; 199 this._primCount++;
195 } 200 }
196 201
197 public bool Backup() { 202 public bool Backup() {
198 /* TODO: Save the current world entities state. */ 203
199 ServerConsole.MainConsole.Instance.WriteLine("World.cs: Backup() - Backing up Primitives"); 204 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs: Backup() - Backing up Primitives");
200 foreach (libsecondlife.LLUUID UUID in Entities.Keys) 205 foreach (libsecondlife.LLUUID UUID in Entities.Keys)
201 { 206 {
202 Entities[UUID].BackUp(); 207 Entities[UUID].BackUp();