diff options
author | gareth | 2007-02-27 23:00:49 +0000 |
---|---|---|
committer | gareth | 2007-02-27 23:00:49 +0000 |
commit | 09dd4bd6834861791008e66652826a66724efa0e (patch) | |
tree | ae2b10c3b6ce3fab4c516c6710d4fa0adafedb77 /src/world/World.cs | |
parent | Removed old trunk code (diff) | |
download | opensim-SC-09dd4bd6834861791008e66652826a66724efa0e.zip opensim-SC-09dd4bd6834861791008e66652826a66724efa0e.tar.gz opensim-SC-09dd4bd6834861791008e66652826a66724efa0e.tar.bz2 opensim-SC-09dd4bd6834861791008e66652826a66724efa0e.tar.xz |
Brought in code from branches/gareth
Diffstat (limited to 'src/world/World.cs')
-rw-r--r-- | src/world/World.cs | 57 |
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 @@ | |||
1 | using System; | ||
2 | using libsecondlife; | ||
3 | using System.Collections.Generic; | ||
4 | using System.Text; | ||
5 | |||
6 | namespace 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 | } | ||