diff options
author | gareth | 2007-03-07 18:48:38 +0000 |
---|---|---|
committer | gareth | 2007-03-07 18:48:38 +0000 |
commit | b3844c1f7348b4296b5ab1df258935d7f971e412 (patch) | |
tree | 4b825dc642cb6eb9a060e54bf8d69288fbee4904 /src/world/World.cs | |
parent | * Updating libsecondlife.dll to the latest version with a working LayerData f... (diff) | |
download | opensim-SC_OLD-b3844c1f7348b4296b5ab1df258935d7f971e412.zip opensim-SC_OLD-b3844c1f7348b4296b5ab1df258935d7f971e412.tar.gz opensim-SC_OLD-b3844c1f7348b4296b5ab1df258935d7f971e412.tar.bz2 opensim-SC_OLD-b3844c1f7348b4296b5ab1df258935d7f971e412.tar.xz |
Deleted old trunk code
Diffstat (limited to 'src/world/World.cs')
-rw-r--r-- | src/world/World.cs | 112 |
1 files changed, 0 insertions, 112 deletions
diff --git a/src/world/World.cs b/src/world/World.cs deleted file mode 100644 index 158ddc2..0000000 --- a/src/world/World.cs +++ /dev/null | |||
@@ -1,112 +0,0 @@ | |||
1 | using System; | ||
2 | using System.Threading; | ||
3 | using System.Collections.Generic; | ||
4 | using System.Text; | ||
5 | using libsecondlife; | ||
6 | using libsecondlife.Packets; | ||
7 | |||
8 | namespace OpenSim.world | ||
9 | { | ||
10 | public class World | ||
11 | { | ||
12 | public Dictionary<libsecondlife.LLUUID, Entity> Entities; | ||
13 | public float[] LandMap; | ||
14 | public ScriptEngine Scripts; | ||
15 | public uint _localNumber = 0; | ||
16 | public PhysicsEngine physics; | ||
17 | |||
18 | private libsecondlife.TerrainManager TerrainManager; | ||
19 | private Random Rand = new Random(); | ||
20 | |||
21 | public World() | ||
22 | { | ||
23 | OpenSim_Main.localcons.WriteLine("World.cs - creating new entitities instance"); | ||
24 | Entities = new Dictionary<libsecondlife.LLUUID, Entity>(); | ||
25 | |||
26 | OpenSim_Main.localcons.WriteLine("World.cs - creating LandMap"); | ||
27 | TerrainManager = new TerrainManager(new SecondLife()); | ||
28 | } | ||
29 | |||
30 | public void InitLoop() | ||
31 | { | ||
32 | OpenSim_Main.localcons.WriteLine("World.cs:StartLoop() - Initialising physics"); | ||
33 | this.physics = new PhysicsEngine(); | ||
34 | physics.Startup(); | ||
35 | } | ||
36 | |||
37 | public void DoStuff() | ||
38 | { | ||
39 | lock (this) | ||
40 | { | ||
41 | physics.DoStuff(this); | ||
42 | this.Update(); | ||
43 | } | ||
44 | } | ||
45 | |||
46 | public void Update() | ||
47 | { | ||
48 | foreach (libsecondlife.LLUUID UUID in Entities.Keys) | ||
49 | { | ||
50 | if (Entities[UUID].needupdate) | ||
51 | { | ||
52 | Entities[UUID].update(); | ||
53 | |||
54 | if (Entities[UUID] is Avatar) | ||
55 | { | ||
56 | Avatar avatar = (Avatar)Entities[UUID]; | ||
57 | if ((avatar.oldpos != avatar.position) || (avatar.oldvel != avatar.velocity) || avatar.walking) | ||
58 | { | ||
59 | ImprovedTerseObjectUpdatePacket.ObjectDataBlock terseBlock = Entities[UUID].CreateTerseBlock(); | ||
60 | foreach (OpenSimClient client in OpenSim_Main.sim.ClientThreads.Values) | ||
61 | { | ||
62 | ImprovedTerseObjectUpdatePacket terse = new ImprovedTerseObjectUpdatePacket(); | ||
63 | terse.RegionData.RegionHandle = OpenSim_Main.cfg.RegionHandle; // FIXME | ||
64 | terse.RegionData.TimeDilation = 0; | ||
65 | terse.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1]; | ||
66 | terse.ObjectData[0] = terseBlock; | ||
67 | client.OutPacket(terse); | ||
68 | } | ||
69 | } | ||
70 | } | ||
71 | } | ||
72 | } | ||
73 | } | ||
74 | |||
75 | public void SendLayerData(OpenSimClient RemoteClient) | ||
76 | { | ||
77 | int[] patches = new int[4]; | ||
78 | |||
79 | for (int y = 0; y < 16; y++) | ||
80 | { | ||
81 | for (int x = 0; x < 16; x = x + 4) | ||
82 | { | ||
83 | patches[0] = x + 0 + y * 16; | ||
84 | patches[1] = x + 1 + y * 16; | ||
85 | patches[2] = x + 2 + y * 16; | ||
86 | patches[3] = x + 3 + y * 16; | ||
87 | |||
88 | Packet layerpack = TerrainManager.CreateLandPacket(LandMap, patches); | ||
89 | RemoteClient.OutPacket(layerpack); | ||
90 | } | ||
91 | } | ||
92 | } | ||
93 | |||
94 | public void AddViewerAgent(OpenSimClient AgentClient) | ||
95 | { | ||
96 | OpenSim_Main.localcons.WriteLine("World.cs:AddViewerAgent() - Creating new avatar for remote viewer agent"); | ||
97 | Avatar NewAvatar = new Avatar(AgentClient); | ||
98 | OpenSim_Main.localcons.WriteLine("World.cs:AddViewerAgent() - Adding new avatar to world"); | ||
99 | this.Entities.Add(AgentClient.AgentID, NewAvatar); | ||
100 | OpenSim_Main.localcons.WriteLine("World.cs:AddViewerAgent() - Starting RegionHandshake "); | ||
101 | NewAvatar.SendRegionHandshake(this); | ||
102 | this.Update(); // will work for now, but needs to be optimised so we don't update everything in the sim for each new user | ||
103 | } | ||
104 | |||
105 | public bool Backup() | ||
106 | { | ||
107 | /* TODO: Save the current world entities state. */ | ||
108 | |||
109 | return false; | ||
110 | } | ||
111 | } | ||
112 | } | ||