diff options
Diffstat (limited to 'OpenSim.RegionServer/world/World.cs')
-rw-r--r-- | OpenSim.RegionServer/world/World.cs | 37 |
1 files changed, 27 insertions, 10 deletions
diff --git a/OpenSim.RegionServer/world/World.cs b/OpenSim.RegionServer/world/World.cs index e848cad..6bc485f 100644 --- a/OpenSim.RegionServer/world/World.cs +++ b/OpenSim.RegionServer/world/World.cs | |||
@@ -11,6 +11,8 @@ using OpenSim.Framework.Assets; | |||
11 | using OpenSim.Framework.Terrain; | 11 | using OpenSim.Framework.Terrain; |
12 | using OpenSim.Framework.Inventory; | 12 | using OpenSim.Framework.Inventory; |
13 | using OpenSim.Assets; | 13 | using OpenSim.Assets; |
14 | using OpenSim.world.scripting; | ||
15 | using OpenSim.RegionServer.world.scripting; | ||
14 | 16 | ||
15 | namespace OpenSim.world | 17 | namespace OpenSim.world |
16 | { | 18 | { |
@@ -29,6 +31,7 @@ namespace OpenSim.world | |||
29 | private uint _primCount = 702000; | 31 | private uint _primCount = 702000; |
30 | private int storageCount; | 32 | private int storageCount; |
31 | private Dictionary<uint, SimClient> m_clientThreads; | 33 | private Dictionary<uint, SimClient> m_clientThreads; |
34 | private Dictionary<LLUUID, ScriptHandler> m_scriptHandlers; | ||
32 | private ulong m_regionHandle; | 35 | private ulong m_regionHandle; |
33 | private string m_regionName; | 36 | private string m_regionName; |
34 | private InventoryCache _inventoryCache; | 37 | private InventoryCache _inventoryCache; |
@@ -40,6 +43,8 @@ namespace OpenSim.world | |||
40 | m_regionHandle = regionHandle; | 43 | m_regionHandle = regionHandle; |
41 | m_regionName = regionName; | 44 | m_regionName = regionName; |
42 | 45 | ||
46 | m_scriptHandlers = new Dictionary<LLUUID, ScriptHandler>(); | ||
47 | |||
43 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs - creating new entitities instance"); | 48 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs - creating new entitities instance"); |
44 | Entities = new Dictionary<libsecondlife.LLUUID, Entity>(); | 49 | Entities = new Dictionary<libsecondlife.LLUUID, Entity>(); |
45 | 50 | ||
@@ -52,6 +57,12 @@ namespace OpenSim.world | |||
52 | Avatar.LoadAnims(); | 57 | Avatar.LoadAnims(); |
53 | } | 58 | } |
54 | 59 | ||
60 | public void AddScript(Entity entity, Script script) | ||
61 | { | ||
62 | ScriptHandler scriptHandler = new ScriptHandler(script, entity, this); | ||
63 | m_scriptHandlers.Add(scriptHandler.ScriptId, scriptHandler); | ||
64 | } | ||
65 | |||
55 | public InventoryCache InventoryCache | 66 | public InventoryCache InventoryCache |
56 | { | 67 | { |
57 | set | 68 | set |
@@ -102,6 +113,11 @@ namespace OpenSim.world | |||
102 | Entities[UUID].update(); | 113 | Entities[UUID].update(); |
103 | } | 114 | } |
104 | 115 | ||
116 | foreach (ScriptHandler scriptHandler in m_scriptHandlers.Values) | ||
117 | { | ||
118 | scriptHandler.OnFrame(); | ||
119 | } | ||
120 | |||
105 | //backup world data | 121 | //backup world data |
106 | this.storageCount++; | 122 | this.storageCount++; |
107 | if (storageCount > 1200) //set to how often you want to backup | 123 | if (storageCount > 1200) //set to how often you want to backup |
@@ -194,7 +210,7 @@ namespace OpenSim.world | |||
194 | 210 | ||
195 | foreach (SimClient client in m_clientThreads.Values) | 211 | foreach (SimClient client in m_clientThreads.Values) |
196 | { | 212 | { |
197 | this.SendLayerData(pointx , pointy , client); | 213 | this.SendLayerData(pointx, pointy, client); |
198 | } | 214 | } |
199 | } | 215 | } |
200 | } | 216 | } |
@@ -251,10 +267,10 @@ namespace OpenSim.world | |||
251 | int[] patches = new int[1]; | 267 | int[] patches = new int[1]; |
252 | int patchx, patchy; | 268 | int patchx, patchy; |
253 | patchx = px / 16; | 269 | patchx = px / 16; |
254 | /* if (patchx > 12) | 270 | /* if (patchx > 12) |
255 | { | 271 | { |
256 | patchx = 12; | 272 | patchx = 12; |
257 | }*/ | 273 | }*/ |
258 | patchy = py / 16; | 274 | patchy = py / 16; |
259 | 275 | ||
260 | patches[0] = patchx + 0 + patchy * 16; | 276 | patches[0] = patchx + 0 + patchy * 16; |
@@ -270,9 +286,10 @@ namespace OpenSim.world | |||
270 | { | 286 | { |
271 | foreach (libsecondlife.LLUUID UUID in Entities.Keys) | 287 | foreach (libsecondlife.LLUUID UUID in Entities.Keys) |
272 | { | 288 | { |
273 | if (Entities[UUID].ToString() == "OpenSim.world.Primitive") | 289 | if (Entities[UUID] is Primitive) |
274 | { | 290 | { |
275 | ((OpenSim.world.Primitive)Entities[UUID]).UpdateClient(RemoteClient); | 291 | Primitive primitive = Entities[UUID] as Primitive; |
292 | primitive.UpdateClient(RemoteClient); | ||
276 | } | 293 | } |
277 | } | 294 | } |
278 | } | 295 | } |
@@ -306,7 +323,7 @@ namespace OpenSim.world | |||
306 | prim.PhysActor = this.phyScene.AddPrim(pVec, pSize); | 323 | prim.PhysActor = this.phyScene.AddPrim(pVec, pSize); |
307 | } | 324 | } |
308 | } | 325 | } |
309 | //prim.PhysicsEnabled = true; | 326 | |
310 | this.Entities.Add(prim.uuid, prim); | 327 | this.Entities.Add(prim.uuid, prim); |
311 | this._primCount++; | 328 | this._primCount++; |
312 | } | 329 | } |
@@ -314,7 +331,7 @@ namespace OpenSim.world | |||
314 | public bool DeRezObject(SimClient simClient, Packet packet) | 331 | public bool DeRezObject(SimClient simClient, Packet packet) |
315 | { | 332 | { |
316 | DeRezObjectPacket DeRezPacket = (DeRezObjectPacket)packet; | 333 | DeRezObjectPacket DeRezPacket = (DeRezObjectPacket)packet; |
317 | // Console.WriteLine(DeRezPacket); | 334 | // Console.WriteLine(DeRezPacket); |
318 | //Needs to delete object from physics at a later date | 335 | //Needs to delete object from physics at a later date |
319 | if (DeRezPacket.AgentBlock.DestinationID == LLUUID.Zero) | 336 | if (DeRezPacket.AgentBlock.DestinationID == LLUUID.Zero) |
320 | { | 337 | { |
@@ -414,7 +431,7 @@ namespace OpenSim.world | |||
414 | public bool ModifyTerrain(SimClient simClient, Packet packet) | 431 | public bool ModifyTerrain(SimClient simClient, Packet packet) |
415 | { | 432 | { |
416 | ModifyLandPacket modify = (ModifyLandPacket)packet; | 433 | ModifyLandPacket modify = (ModifyLandPacket)packet; |
417 | 434 | ||
418 | switch (modify.ModifyBlock.Action) | 435 | switch (modify.ModifyBlock.Action) |
419 | { | 436 | { |
420 | case 1: | 437 | case 1: |