aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/world/World.cs
diff options
context:
space:
mode:
authorgareth2007-02-27 23:00:49 +0000
committergareth2007-02-27 23:00:49 +0000
commit09dd4bd6834861791008e66652826a66724efa0e (patch)
treeae2b10c3b6ce3fab4c516c6710d4fa0adafedb77 /src/world/World.cs
parentRemoved old trunk code (diff)
downloadopensim-SC_OLD-09dd4bd6834861791008e66652826a66724efa0e.zip
opensim-SC_OLD-09dd4bd6834861791008e66652826a66724efa0e.tar.gz
opensim-SC_OLD-09dd4bd6834861791008e66652826a66724efa0e.tar.bz2
opensim-SC_OLD-09dd4bd6834861791008e66652826a66724efa0e.tar.xz
Brought in code from branches/gareth
Diffstat (limited to 'src/world/World.cs')
-rw-r--r--src/world/World.cs57
1 files changed, 57 insertions, 0 deletions
diff --git a/src/world/World.cs b/src/world/World.cs
new file mode 100644
index 0000000..cf337a8
--- /dev/null
+++ b/src/world/World.cs
@@ -0,0 +1,57 @@
1using System;
2using libsecondlife;
3using System.Collections.Generic;
4using System.Text;
5
6namespace OpenSim.world
7{
8 public class World
9 {
10 public Dictionary<libsecondlife.LLUUID, Entity> Entities;
11 public SurfacePatch[] LandMap;
12 public ScriptEngine Scripts;
13
14 public World()
15 {
16 Console.WriteLine("World.cs - creating new entitities instance");
17 Entities = new Dictionary<libsecondlife.LLUUID, Entity>();
18
19 // We need a 16x16 array of 16m2 surface patches for a 256m2 sim
20 Console.WriteLine("World.cs - creating LandMap");
21 LandMap = new SurfacePatch[16*16];
22 int xinc;
23 int yinc;
24 for(xinc=0; xinc<16; xinc++) for(yinc=0; yinc<16; yinc++) {
25 LandMap[xinc+(yinc*16)]=new SurfacePatch();
26 }
27
28 Console.WriteLine("World.cs - Creating script engine instance");
29 // Initialise this only after the world has loaded
30 Scripts = new ScriptEngine(this);
31 }
32
33 public void Update()
34 {
35 foreach (libsecondlife.LLUUID UUID in Entities.Keys)
36 {
37 Entities[UUID].update();
38 }
39 }
40
41 public void AddViewerAgent(OpenSimClient AgentClient) {
42 Console.WriteLine("World.cs:AddViewerAgent() - Creating new avatar for remote viewer agent");
43 Avatar NewAvatar = new Avatar(AgentClient);
44 Console.WriteLine("World.cs:AddViewerAgent() - Adding new avatar to world");
45 this.Entities.Add(AgentClient.AgentID, NewAvatar);
46 Console.WriteLine("World.cs:AddViewerAgent() - Starting RegionHandshake ");
47 NewAvatar.SendRegionHandshake(this);
48 this.Update(); // will work for now, but needs to be optimised so we don't update everything in the sim for each new user
49 }
50
51 public bool Backup() {
52 /* TODO: Save the current world entities state. */
53
54 return false;
55 }
56 }
57}