aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorMelanie2019-08-07 17:58:55 +0100
committerMelanie2019-08-07 17:58:55 +0100
commitba680ceecba3dd07fc794a7a2c2a77b2dc9471df (patch)
tree0a64eefac9de3746e78c1116b2858d577133773f /OpenSim
parentFix scope support to get friends list names across co-hosted grids (diff)
parentcap EstateAccess: don't meed with keepAlive unless needed (diff)
downloadopensim-SC-ba680ceecba3dd07fc794a7a2c2a77b2dc9471df.zip
opensim-SC-ba680ceecba3dd07fc794a7a2c2a77b2dc9471df.tar.gz
opensim-SC-ba680ceecba3dd07fc794a7a2c2a77b2dc9471df.tar.bz2
opensim-SC-ba680ceecba3dd07fc794a7a2c2a77b2dc9471df.tar.xz
Merge branch 'master' of brain.opensimulator.org:/var/git/opensim
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Capabilities/Handlers/GetAssets/GetAssetsHandler.cs2
-rw-r--r--OpenSim/Framework/AgentCircuitData.cs133
-rw-r--r--OpenSim/Framework/AvatarAppearance.cs58
-rw-r--r--OpenSim/Framework/AvatarAttachment.cs15
-rw-r--r--OpenSim/Framework/AvatarWearable.cs6
-rw-r--r--OpenSim/Framework/EntityTransferContext.cs14
-rw-r--r--OpenSim/Framework/WearableCacheItem.cs5
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/EstateAccess.cs224
-rw-r--r--OpenSim/Region/CoreModules/World/Land/LandObject.cs2
-rw-r--r--OpenSim/Region/CoreModules/World/Warp3DMap/TerrainSplat.cs5
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs7
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs48
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs5
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs2
-rw-r--r--OpenSim/Region/OptionalModules/Materials/MaterialsModule.cs233
-rw-r--r--OpenSim/Region/PhysicsModules/ubOdeMeshing/Meshmerizer.cs4
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs222
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs10
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs50
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs1
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs4
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs60
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs5
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs3
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs8
-rw-r--r--OpenSim/Server/Handlers/Simulation/AgentHandlers.cs124
-rw-r--r--OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs56
-rw-r--r--OpenSim/Services/LLLoginService/LLLoginService.cs2
-rw-r--r--OpenSim/Tests/ConfigurationLoaderTest.cs1
29 files changed, 801 insertions, 508 deletions
diff --git a/OpenSim/Capabilities/Handlers/GetAssets/GetAssetsHandler.cs b/OpenSim/Capabilities/Handlers/GetAssets/GetAssetsHandler.cs
index 099c7b4..a5f0056 100644
--- a/OpenSim/Capabilities/Handlers/GetAssets/GetAssetsHandler.cs
+++ b/OpenSim/Capabilities/Handlers/GetAssets/GetAssetsHandler.cs
@@ -138,8 +138,6 @@ namespace OpenSim.Capabilities.Handlers
138 138
139 if(type == AssetType.Mesh || type == AssetType.Texture) 139 if(type == AssetType.Mesh || type == AssetType.Texture)
140 responsedata["throttle"] = true; 140 responsedata["throttle"] = true;
141// else
142// m_log.Warn("[GETASSETS]: type: " + query);
143 141
144 responsedata["content_type"] = asset.Metadata.ContentType; 142 responsedata["content_type"] = asset.Metadata.ContentType;
145 responsedata["bin_response_data"] = asset.Data; 143 responsedata["bin_response_data"] = asset.Data;
diff --git a/OpenSim/Framework/AgentCircuitData.cs b/OpenSim/Framework/AgentCircuitData.cs
index 330a41e..ebb00d2 100644
--- a/OpenSim/Framework/AgentCircuitData.cs
+++ b/OpenSim/Framework/AgentCircuitData.cs
@@ -267,16 +267,17 @@ namespace OpenSim.Framework
267 /// <param name="args"></param> 267 /// <param name="args"></param>
268 public void UnpackAgentCircuitData(OSDMap args) 268 public void UnpackAgentCircuitData(OSDMap args)
269 { 269 {
270 if (args["agent_id"] != null) 270 OSD tmpOSD;
271 AgentID = args["agent_id"].AsUUID(); 271 if (args.TryGetValue("agent_id", out tmpOSD))
272 if (args["base_folder"] != null) 272 AgentID = tmpOSD.AsUUID();
273 BaseFolder = args["base_folder"].AsUUID(); 273 if (args.TryGetValue("base_folder", out tmpOSD))
274 if (args["caps_path"] != null) 274 BaseFolder =tmpOSD.AsUUID();
275 CapsPath = args["caps_path"].AsString(); 275 if (args.TryGetValue("caps_path", out tmpOSD))
276 276 CapsPath = tmpOSD.AsString();
277 if ((args["children_seeds"] != null) && (args["children_seeds"].Type == OSDType.Array)) 277
278 if ((args.TryGetValue("children_seeds", out tmpOSD) && tmpOSD is OSDArray))
278 { 279 {
279 OSDArray childrenSeeds = (OSDArray)(args["children_seeds"]); 280 OSDArray childrenSeeds = (OSDArray)tmpOSD;
280 ChildrenCapSeeds = new Dictionary<ulong, string>(); 281 ChildrenCapSeeds = new Dictionary<ulong, string>();
281 foreach (OSD o in childrenSeeds) 282 foreach (OSD o in childrenSeeds)
282 { 283 {
@@ -285,53 +286,59 @@ namespace OpenSim.Framework
285 ulong handle = 0; 286 ulong handle = 0;
286 string seed = ""; 287 string seed = "";
287 OSDMap pair = (OSDMap)o; 288 OSDMap pair = (OSDMap)o;
288 if (pair["handle"] != null) 289 if (pair.TryGetValue("handle", out tmpOSD))
289 if (!UInt64.TryParse(pair["handle"].AsString(), out handle)) 290 {
291 if (!UInt64.TryParse(tmpOSD.AsString(), out handle))
290 continue; 292 continue;
291 if (pair["seed"] != null) 293 }
292 seed = pair["seed"].AsString();
293 if (!ChildrenCapSeeds.ContainsKey(handle)) 294 if (!ChildrenCapSeeds.ContainsKey(handle))
294 ChildrenCapSeeds.Add(handle, seed); 295 {
296 if (pair.TryGetValue("seed", out tmpOSD))
297 {
298 seed = tmpOSD.AsString();
299 ChildrenCapSeeds.Add(handle, seed);
300 }
301 }
295 } 302 }
296 } 303 }
297 } 304 }
298 else 305 else
299 ChildrenCapSeeds = new Dictionary<ulong, string>(); 306 ChildrenCapSeeds = new Dictionary<ulong, string>();
300 307
301 if (args["child"] != null) 308 if (args.TryGetValue("child", out tmpOSD))
302 child = args["child"].AsBoolean(); 309 child = tmpOSD.AsBoolean();
303 if (args["circuit_code"] != null) 310 if (args.TryGetValue("circuit_code", out tmpOSD))
304 UInt32.TryParse(args["circuit_code"].AsString(), out circuitcode); 311 UInt32.TryParse(tmpOSD.AsString(), out circuitcode);
305 if (args["first_name"] != null) 312 if (args.TryGetValue("first_name", out tmpOSD))
306 firstname = args["first_name"].AsString(); 313 firstname = tmpOSD.AsString();
307 if (args["last_name"] != null) 314 if (args.TryGetValue("last_name", out tmpOSD))
308 lastname = args["last_name"].AsString(); 315 lastname = tmpOSD.AsString();
309 if (args["inventory_folder"] != null) 316 if (args.TryGetValue("inventory_folder", out tmpOSD))
310 InventoryFolder = args["inventory_folder"].AsUUID(); 317 InventoryFolder = tmpOSD.AsUUID();
311 if (args["secure_session_id"] != null) 318 if (args.TryGetValue("secure_session_id", out tmpOSD))
312 SecureSessionID = args["secure_session_id"].AsUUID(); 319 SecureSessionID = tmpOSD.AsUUID();
313 if (args["session_id"] != null) 320 if (args.TryGetValue("session_id", out tmpOSD))
314 SessionID = args["session_id"].AsUUID(); 321 SessionID = tmpOSD.AsUUID();
315 if (args["service_session_id"] != null) 322 if (args.TryGetValue("service_session_id", out tmpOSD))
316 ServiceSessionID = args["service_session_id"].AsString(); 323 ServiceSessionID = tmpOSD.AsString();
317 if (args["client_ip"] != null) 324 if (args.TryGetValue("client_ip", out tmpOSD))
318 IPAddress = args["client_ip"].AsString(); 325 IPAddress = tmpOSD.AsString();
319 if (args["viewer"] != null) 326 if (args.TryGetValue("viewer", out tmpOSD))
320 Viewer = args["viewer"].AsString(); 327 Viewer = tmpOSD.AsString();
321 if (args["channel"] != null) 328 if (args.TryGetValue("channel", out tmpOSD))
322 Channel = args["channel"].AsString(); 329 Channel = tmpOSD.AsString();
323 if (args["mac"] != null) 330 if (args.TryGetValue("mac", out tmpOSD))
324 Mac = args["mac"].AsString(); 331 Mac = tmpOSD.AsString();
325 if (args["id0"] != null) 332 if (args.TryGetValue("id0", out tmpOSD))
326 Id0 = args["id0"].AsString(); 333 Id0 = tmpOSD.AsString();
327 if (args["teleport_flags"] != null) 334 if (args.TryGetValue("teleport_flags", out tmpOSD))
328 teleportFlags = args["teleport_flags"].AsUInteger(); 335 teleportFlags = tmpOSD.AsUInteger();
329 336
330 if (args["start_pos"] != null) 337 if (args.TryGetValue("start_pos", out tmpOSD))
331 Vector3.TryParse(args["start_pos"].AsString(), out startpos); 338 Vector3.TryParse(tmpOSD.AsString(), out startpos);
332 339
333 if(args["far"] != null) 340 if(args.TryGetValue("far", out tmpOSD))
334 startfar = (float)args["far"].AsReal(); 341 startfar = (float)tmpOSD.AsReal();
335 342
336 //m_log.InfoFormat("[AGENTCIRCUITDATA]: agentid={0}, child={1}, startpos={2}", AgentID, child, startpos); 343 //m_log.InfoFormat("[AGENTCIRCUITDATA]: agentid={0}, child={1}, startpos={2}", AgentID, child, startpos);
337 344
@@ -342,12 +349,12 @@ namespace OpenSim.Framework
342 349
343 // Eventually this code should be deprecated, use full appearance 350 // Eventually this code should be deprecated, use full appearance
344 // packing in packed_appearance 351 // packing in packed_appearance
345 if (args["appearance_serial"] != null) 352 if (args.TryGetValue("appearance_serial", out tmpOSD))
346 Appearance.Serial = args["appearance_serial"].AsInteger(); 353 Appearance.Serial = tmpOSD.AsInteger();
347 354
348 if (args.ContainsKey("packed_appearance") && (args["packed_appearance"].Type == OSDType.Map)) 355 if (args.TryGetValue("packed_appearance", out tmpOSD) && (tmpOSD is OSDMap))
349 { 356 {
350 Appearance.Unpack((OSDMap)args["packed_appearance"]); 357 Appearance.Unpack((OSDMap)tmpOSD);
351// m_log.InfoFormat("[AGENTCIRCUITDATA] unpacked appearance"); 358// m_log.InfoFormat("[AGENTCIRCUITDATA] unpacked appearance");
352 } 359 }
353 else 360 else
@@ -362,31 +369,29 @@ namespace OpenSim.Framework
362 369
363 ServiceURLs = new Dictionary<string, object>(); 370 ServiceURLs = new Dictionary<string, object>();
364 // Try parse the new way, OSDMap 371 // Try parse the new way, OSDMap
365 if (args.ContainsKey("serviceurls") && args["serviceurls"] != null && (args["serviceurls"]).Type == OSDType.Map) 372 if (args.TryGetValue("serviceurls", out tmpOSD) && (tmpOSD is OSDMap))
366 { 373 {
367 OSDMap urls = (OSDMap)(args["serviceurls"]); 374 OSDMap urls = (OSDMap)tmpOSD;
368 foreach (KeyValuePair<String, OSD> kvp in urls) 375 foreach (KeyValuePair<String, OSD> kvp in urls)
369 { 376 {
370 ServiceURLs[kvp.Key] = kvp.Value.AsString(); 377 ServiceURLs[kvp.Key] = kvp.Value;
371 //System.Console.WriteLine("XXX " + kvp.Key + "=" + ServiceURLs[kvp.Key]); 378 //System.Console.WriteLine("XXX " + kvp.Key + "=" + ServiceURLs[kvp.Key]);
372
373 } 379 }
374 } 380 }
375 // else try the old way, OSDArray 381 // else try the old way, OSDArray
376 // OBSOLETE -- soon to be deleted 382 // OBSOLETE -- soon to be deleted
377 else if (args.ContainsKey("service_urls") && args["service_urls"] != null && (args["service_urls"]).Type == OSDType.Array) 383 else if (args.TryGetValue("service_urls", out tmpOSD) && (tmpOSD is OSDArray))
378 { 384 {
379 OSDArray urls = (OSDArray)(args["service_urls"]); 385 OSDArray urls = (OSDArray)tmpOSD;
380 for (int i = 0; i < urls.Count / 2; i++) 386 OSD tmpOSDb;
387 for (int i = 0; i < urls.Count - 1; i += 2)
381 { 388 {
382 ServiceURLs[urls[i * 2].AsString()] = urls[(i * 2) + 1].AsString(); 389 tmpOSD = urls[i];
390 tmpOSDb = urls[i + 1];
391 ServiceURLs[tmpOSD.AsString()] = tmpOSDb.AsString();
383 //System.Console.WriteLine("XXX " + urls[i * 2].AsString() + "=" + urls[(i * 2) + 1].AsString()); 392 //System.Console.WriteLine("XXX " + urls[i * 2].AsString() + "=" + urls[(i * 2) + 1].AsString());
384
385 } 393 }
386 } 394 }
387 } 395 }
388
389 } 396 }
390
391
392} 397}
diff --git a/OpenSim/Framework/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs
index 77a7621..f1713a6 100644
--- a/OpenSim/Framework/AvatarAppearance.cs
+++ b/OpenSim/Framework/AvatarAppearance.cs
@@ -796,25 +796,33 @@ namespace OpenSim.Framework
796 /// </summary> 796 /// </summary>
797 public void Unpack(OSDMap data) 797 public void Unpack(OSDMap data)
798 { 798 {
799 if ((data != null) && (data["serial"] != null)) 799 SetDefaultWearables();
800 m_serial = data["serial"].AsInteger(); 800 SetDefaultTexture();
801 if ((data != null) && (data["height"] != null)) 801 SetDefaultParams();
802 m_attachments = new Dictionary<int, List<AvatarAttachment>>();
803
804 if(data == null)
805 {
806 m_log.Warn("[AVATAR APPEARANCE]: data to unpack is null");
807 return;
808 }
809
810 OSD tmpOSD;
811 if (data.TryGetValue("serial", out tmpOSD))
812 m_serial = tmpOSD.AsInteger();
813 if (data.TryGetValue("height", out tmpOSD))
802// m_avatarHeight = (float)data["height"].AsReal(); 814// m_avatarHeight = (float)data["height"].AsReal();
803 SetSize(new Vector3(0.45f,0.6f, (float)data["height"].AsReal())); 815 SetSize(new Vector3(0.45f,0.6f, (float)tmpOSD.AsReal()));
804 816
805 try 817 try
806 { 818 {
807 // Wearables 819 // Wearables
808 SetDefaultWearables(); 820 if (data.TryGetValue("wearables", out tmpOSD) && (tmpOSD is OSDArray))
809 if ((data != null) && (data["wearables"] != null) && (data["wearables"]).Type == OSDType.Array)
810 { 821 {
811 OSDArray wears = (OSDArray)(data["wearables"]); 822 OSDArray wears = (OSDArray)tmpOSD;
812 823 m_wearables = new AvatarWearable[wears.Count];
813 int count = wears.Count;
814
815 m_wearables = new AvatarWearable[count];
816 824
817 for (int i = 0; i < count; i++) 825 for (int i = 0; i < wears.Count; i++)
818 m_wearables[i] = new AvatarWearable((OSDArray)wears[i]); 826 m_wearables[i] = new AvatarWearable((OSDArray)wears[i]);
819 } 827 }
820 else 828 else
@@ -823,15 +831,15 @@ namespace OpenSim.Framework
823 } 831 }
824 832
825 // Avatar Textures 833 // Avatar Textures
826 SetDefaultTexture(); 834 if (data.TryGetValue("textures", out tmpOSD) && (tmpOSD is OSDArray))
827 if ((data != null) && (data["textures"] != null) && (data["textures"]).Type == OSDType.Array)
828 { 835 {
829 OSDArray textures = (OSDArray)(data["textures"]); 836 OSDArray textures = (OSDArray)tmpOSD;
830 for (int i = 0; i < AvatarAppearance.TEXTURE_COUNT && i < textures.Count; i++) 837 for (int i = 0; i < AvatarAppearance.TEXTURE_COUNT && i < textures.Count; i++)
831 { 838 {
832 UUID textureID = AppearanceManager.DEFAULT_AVATAR_TEXTURE; 839 UUID textureID = AppearanceManager.DEFAULT_AVATAR_TEXTURE;
833 if (textures[i] != null) 840 tmpOSD = textures[i];
834 textureID = textures[i].AsUUID(); 841 if (tmpOSD != null)
842 textureID = tmpOSD.AsUUID();
835 m_texture.CreateFace((uint)i).TextureID = new UUID(textureID); 843 m_texture.CreateFace((uint)i).TextureID = new UUID(textureID);
836 } 844 }
837 } 845 }
@@ -840,18 +848,17 @@ namespace OpenSim.Framework
840 m_log.Warn("[AVATAR APPEARANCE]: failed to unpack textures"); 848 m_log.Warn("[AVATAR APPEARANCE]: failed to unpack textures");
841 } 849 }
842 850
843 if ((data != null) && (data["bakedcache"] != null) && (data["bakedcache"]).Type == OSDType.Array) 851 if (data.TryGetValue("bakedcache", out tmpOSD) && (tmpOSD is OSDArray))
844 { 852 {
845 OSDArray bakedOSDArray = (OSDArray)(data["bakedcache"]); 853 OSDArray bakedOSDArray = (OSDArray)tmpOSD;
846 m_cacheitems = WearableCacheItem.BakedFromOSD(bakedOSDArray); 854 m_cacheitems = WearableCacheItem.BakedFromOSD(bakedOSDArray);
847 } 855 }
848 856
849 // Visual Parameters 857 // Visual Parameters
850 SetDefaultParams(); 858 if (data.TryGetValue("visualparams", out tmpOSD))
851 if ((data != null) && (data["visualparams"] != null))
852 { 859 {
853 if ((data["visualparams"].Type == OSDType.Binary) || (data["visualparams"].Type == OSDType.Array)) 860 if (tmpOSD is OSDBinary || tmpOSD is OSDArray)
854 m_visualparams = data["visualparams"].AsBinary(); 861 m_visualparams = tmpOSD.AsBinary();
855 } 862 }
856 else 863 else
857 { 864 {
@@ -859,10 +866,9 @@ namespace OpenSim.Framework
859 } 866 }
860 867
861 // Attachments 868 // Attachments
862 m_attachments = new Dictionary<int, List<AvatarAttachment>>(); 869 if (data.TryGetValue("attachments", out tmpOSD) && tmpOSD is OSDArray)
863 if ((data != null) && (data["attachments"] != null) && (data["attachments"]).Type == OSDType.Array)
864 { 870 {
865 OSDArray attachs = (OSDArray)(data["attachments"]); 871 OSDArray attachs = (OSDArray)tmpOSD;
866 for (int i = 0; i < attachs.Count; i++) 872 for (int i = 0; i < attachs.Count; i++)
867 { 873 {
868 AvatarAttachment att = new AvatarAttachment((OSDMap)attachs[i]); 874 AvatarAttachment att = new AvatarAttachment((OSDMap)attachs[i]);
diff --git a/OpenSim/Framework/AvatarAttachment.cs b/OpenSim/Framework/AvatarAttachment.cs
index 07dd385..d8a0ffc 100644
--- a/OpenSim/Framework/AvatarAttachment.cs
+++ b/OpenSim/Framework/AvatarAttachment.cs
@@ -68,11 +68,18 @@ namespace OpenSim.Framework
68 68
69 public void Unpack(OSDMap args) 69 public void Unpack(OSDMap args)
70 { 70 {
71 if (args["point"] != null) 71 OSD tmpOSD;
72 AttachPoint = args["point"].AsInteger(); 72 if (args.TryGetValue("point", out tmpOSD))
73 AttachPoint = tmpOSD.AsInteger();
74 if (args.TryGetValue("item", out tmpOSD))
75 ItemID = tmpOSD.AsUUID();
76 else
77 ItemID = UUID.Zero;
73 78
74 ItemID = (args["item"] != null) ? args["item"].AsUUID() : UUID.Zero; 79 if (args.TryGetValue("asset", out tmpOSD))
75 AssetID = (args["asset"] != null) ? args["asset"].AsUUID() : UUID.Zero; 80 AssetID = tmpOSD.AsUUID();
81 else
82 AssetID = UUID.Zero;
76 } 83 }
77 } 84 }
78} 85}
diff --git a/OpenSim/Framework/AvatarWearable.cs b/OpenSim/Framework/AvatarWearable.cs
index fddd0f0..abf5759 100644
--- a/OpenSim/Framework/AvatarWearable.cs
+++ b/OpenSim/Framework/AvatarWearable.cs
@@ -132,10 +132,12 @@ namespace OpenSim.Framework
132 public void Unpack(OSDArray args) 132 public void Unpack(OSDArray args)
133 { 133 {
134 Clear(); 134 Clear();
135 135 OSD tmpOSDA, tmpOSDB;
136 foreach (OSDMap weardata in args) 136 foreach (OSDMap weardata in args)
137 { 137 {
138 Add(weardata["item"].AsUUID(), weardata["asset"].AsUUID()); 138 tmpOSDA = weardata["item"];
139 tmpOSDB = weardata["asset"];
140 Add(tmpOSDA.AsUUID(), tmpOSDB.AsUUID());
139 } 141 }
140 } 142 }
141 143
diff --git a/OpenSim/Framework/EntityTransferContext.cs b/OpenSim/Framework/EntityTransferContext.cs
index 860414e..257c6d1 100644
--- a/OpenSim/Framework/EntityTransferContext.cs
+++ b/OpenSim/Framework/EntityTransferContext.cs
@@ -58,13 +58,13 @@ namespace OpenSim.Framework
58 public void Unpack(OSD data) 58 public void Unpack(OSD data)
59 { 59 {
60 OSDMap map = (OSDMap)data; 60 OSDMap map = (OSDMap)data;
61 61 OSD tmpOSD;
62 if (map.ContainsKey("InboundVersion")) 62 if (map.TryGetValue("InboundVersion", out tmpOSD))
63 InboundVersion = (float)map["InboundVersion"].AsReal(); 63 InboundVersion = (float)tmpOSD.AsReal();
64 if (map.ContainsKey("OutboundVersion")) 64 if (map.TryGetValue("OutboundVersion", out tmpOSD))
65 OutboundVersion = (float)map["OutboundVersion"].AsReal(); 65 OutboundVersion = (float)tmpOSD.AsReal();
66 if (map.ContainsKey("WearablesCount")) 66 if (map.TryGetValue("WearablesCount", out tmpOSD))
67 WearablesCount = map["WearablesCount"].AsInteger(); 67 WearablesCount = tmpOSD.AsInteger();
68 } 68 }
69 } 69 }
70} 70}
diff --git a/OpenSim/Framework/WearableCacheItem.cs b/OpenSim/Framework/WearableCacheItem.cs
index 427e149..e060f22 100644
--- a/OpenSim/Framework/WearableCacheItem.cs
+++ b/OpenSim/Framework/WearableCacheItem.cs
@@ -161,13 +161,12 @@ namespace OpenSim.Framework
161 public static WearableCacheItem[] BakedFromOSD(OSD pInput) 161 public static WearableCacheItem[] BakedFromOSD(OSD pInput)
162 { 162 {
163 WearableCacheItem[] pcache = WearableCacheItem.GetDefaultCacheItem(); 163 WearableCacheItem[] pcache = WearableCacheItem.GetDefaultCacheItem();
164
165 if (pInput.Type == OSDType.Array) 164 if (pInput.Type == OSDType.Array)
166 { 165 {
167 OSDArray itemarray = (OSDArray)pInput; 166 OSDArray itemarray = (OSDArray)pInput;
168 foreach (OSDMap item in itemarray) 167 foreach (OSDMap item in itemarray)
169 { 168 {
170 int idx = (int)item["textureindex"].AsUInteger(); 169 int idx = item["textureindex"].AsInteger();
171 if (idx < 0 || idx > pcache.Length) 170 if (idx < 0 || idx > pcache.Length)
172 continue; 171 continue;
173 pcache[idx].CacheId = item["cacheid"].AsUUID(); 172 pcache[idx].CacheId = item["cacheid"].AsUUID();
@@ -217,6 +216,4 @@ namespace OpenSim.Framework
217 return null; 216 return null;
218 } 217 }
219 } 218 }
220
221
222} 219}
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/EstateAccess.cs b/OpenSim/Region/ClientStack/Linden/Caps/EstateAccess.cs
new file mode 100644
index 0000000..cd6cdef
--- /dev/null
+++ b/OpenSim/Region/ClientStack/Linden/Caps/EstateAccess.cs
@@ -0,0 +1,224 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections;
30using System.Collections.Generic;
31using System.Text;
32
33using log4net;
34using Nini.Config;
35using OpenMetaverse;
36using Mono.Addins;
37using OpenSim.Framework;
38using OpenSim.Framework.Servers.HttpServer;
39using OpenSim.Region.Framework.Interfaces;
40using OpenSim.Region.Framework.Scenes;
41using Caps=OpenSim.Framework.Capabilities.Caps;
42
43namespace OpenSim.Region.ClientStack.Linden
44{
45 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "EstateAcessCapModule")]
46 public class EstateAccessCapModule : INonSharedRegionModule
47 {
48// private static readonly ILog m_log =
49// LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
50
51 private Scene m_scene;
52 private bool m_Enabled = false;
53 private string m_capUrl;
54 //IEstateModule m_EstateModule;
55
56 #region INonSharedRegionModule Members
57
58 public void Initialise(IConfigSource pSource)
59 {
60 IConfig config = pSource.Configs["ClientStack.LindenCaps"];
61 if (config == null)
62 return;
63
64 m_capUrl = config.GetString("Cap_EstateAccess", string.Empty);
65 if (!String.IsNullOrEmpty(m_capUrl) && m_capUrl.Equals("localhost"))
66 m_Enabled = true;
67 }
68
69 public void AddRegion(Scene scene)
70 {
71 if (!m_Enabled)
72 return;
73
74 m_scene = scene;
75 }
76
77 public void RemoveRegion(Scene scene)
78 {
79 if (!m_Enabled)
80 return;
81
82 if (m_scene == scene)
83 {
84 m_scene.EventManager.OnRegisterCaps -= RegisterCaps;
85 m_scene = null;
86 }
87 }
88
89 public void RegionLoaded(Scene scene)
90 {
91 if (!m_Enabled)
92 return;
93
94 if (scene.RegionInfo == null || scene.RegionInfo.EstateSettings == null)
95 {
96 m_Enabled = false;
97 return;
98 }
99
100 IEstateModule m_EstateModule = scene.RequestModuleInterface<IEstateModule>();
101 if(m_EstateModule == null)
102 {
103 m_Enabled = false;
104 return;
105 }
106
107 scene.EventManager.OnRegisterCaps += RegisterCaps;
108 }
109
110 public void Close()
111 {
112 }
113
114 public string Name
115 {
116 get { return "EstateAccessCapModule"; }
117 }
118
119 public Type ReplaceableInterface
120 {
121 get { return null; }
122 }
123
124 #endregion
125
126 public void RegisterCaps(UUID agentID, Caps caps)
127 {
128 string capUrl = "/CAPS/" + UUID.Random() + "/";
129
130 caps.RegisterHandler(
131 "EstateAccess",
132 new RestHTTPHandler(
133 "GET",
134 capUrl,
135 httpMethod => ProcessRequest(httpMethod, agentID, caps),
136 "EstateAccess",
137 agentID.ToString())); ;
138 }
139
140 public Hashtable ProcessRequest(Hashtable request, UUID AgentId, Caps cap)
141 {
142 Hashtable responsedata = new Hashtable();
143 responsedata["int_response_code"] = 200; //501; //410; //404;
144 responsedata["content_type"] = "text/plain";
145
146 ScenePresence avatar;
147 if (!m_scene.TryGetScenePresence(AgentId, out avatar))
148 {
149 responsedata["str_response_string"] = "<llsd><array /></llsd>"; ;
150 responsedata["keepalive"] = false;
151 return responsedata;
152 }
153
154 if (m_scene.RegionInfo == null
155 || m_scene.RegionInfo.EstateSettings == null
156 ||!m_scene.Permissions.CanIssueEstateCommand(AgentId, false))
157 {
158 responsedata["str_response_string"] = "<llsd><array /></llsd>"; ;
159 return responsedata;
160 }
161
162 EstateSettings regionSettings = m_scene.RegionInfo.EstateSettings;
163 UUID[] managers = regionSettings.EstateManagers;
164 UUID[] allowed = regionSettings.EstateAccess;
165 UUID[] groups = regionSettings.EstateGroups;
166 EstateBan[] EstateBans = regionSettings.EstateBans;
167
168 StringBuilder sb = LLSDxmlEncode.Start();
169 LLSDxmlEncode.AddArray(sb);
170
171 if (allowed != null && allowed.Length > 0)
172 {
173 LLSDxmlEncode.AddMap("AllowedAgents", sb);
174 for (int i = 0; i < allowed.Length; ++i)
175 {
176 UUID id = allowed[i];
177 if (id == UUID.Zero)
178 continue;
179 LLSDxmlEncode.AddElem("id", id, sb);
180 }
181 LLSDxmlEncode.AddEndMap(sb);
182 }
183
184 if (groups != null && groups.Length > 0)
185 {
186 LLSDxmlEncode.AddMap("AllowedGroups", sb);
187 for (int i = 0; i < groups.Length; ++i)
188 {
189 UUID id = groups[i];
190 if (id == UUID.Zero)
191 continue;
192 LLSDxmlEncode.AddElem("id", id, sb);
193 }
194 LLSDxmlEncode.AddEndMap(sb);
195 }
196
197 if (EstateBans != null && EstateBans.Length > 0)
198 {
199 LLSDxmlEncode.AddMap("BannedAgents", sb);
200 for (int i = 0; i < EstateBans.Length; ++i)
201 {
202 UUID id = EstateBans[i].BannedUserID;
203 if (id == UUID.Zero)
204 continue;
205 LLSDxmlEncode.AddElem("id", id, sb);
206 }
207 LLSDxmlEncode.AddEndMap(sb);
208 }
209
210 if (managers != null && managers.Length > 0)
211 {
212 LLSDxmlEncode.AddMap("Managers", sb);
213 for (int i = 0; i < managers.Length; ++i)
214 LLSDxmlEncode.AddElem("id", managers[i], sb);
215 LLSDxmlEncode.AddEndMap(sb);
216 }
217
218 LLSDxmlEncode.AddEndArray(sb);
219 responsedata["str_response_string"] = LLSDxmlEncode.End(sb);
220
221 return responsedata;
222 }
223 }
224}
diff --git a/OpenSim/Region/CoreModules/World/Land/LandObject.cs b/OpenSim/Region/CoreModules/World/Land/LandObject.cs
index 094b0f5..9111d28 100644
--- a/OpenSim/Region/CoreModules/World/Land/LandObject.cs
+++ b/OpenSim/Region/CoreModules/World/Land/LandObject.cs
@@ -994,7 +994,7 @@ namespace OpenSim.Region.CoreModules.World.Land
994 } 994 }
995 else 995 else
996 { 996 {
997 // keeping previus odd average 997 // keeping previous odd average
998 avgx = (avgx * tempArea + x) / (tempArea + 1); 998 avgx = (avgx * tempArea + x) / (tempArea + 1);
999 avgy = (avgy * tempArea + y) / (tempArea + 1); 999 avgy = (avgy * tempArea + y) / (tempArea + 1);
1000 } 1000 }
diff --git a/OpenSim/Region/CoreModules/World/Warp3DMap/TerrainSplat.cs b/OpenSim/Region/CoreModules/World/Warp3DMap/TerrainSplat.cs
index 4b9f207..f60beaf 100644
--- a/OpenSim/Region/CoreModules/World/Warp3DMap/TerrainSplat.cs
+++ b/OpenSim/Region/CoreModules/World/Warp3DMap/TerrainSplat.cs
@@ -441,6 +441,9 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap
441 startHeights[0], startHeights[2], 441 startHeights[0], startHeights[2],
442 startHeights[1], startHeights[3], 442 startHeights[1], startHeights[3],
443 pctX, pctY); 443 pctX, pctY);
444 if (float.IsNaN(startHeight))
445 return 0;
446
444 startHeight = Utils.Clamp(startHeight, 0f, 255f); 447 startHeight = Utils.Clamp(startHeight, 0f, 255f);
445 448
446 float heightRange = ImageUtils.Bilinear( 449 float heightRange = ImageUtils.Bilinear(
@@ -448,7 +451,7 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap
448 heightRanges[1], heightRanges[3], 451 heightRanges[1], heightRanges[3],
449 pctX, pctY); 452 pctX, pctY);
450 heightRange = Utils.Clamp(heightRange, 0f, 255f); 453 heightRange = Utils.Clamp(heightRange, 0f, 255f);
451 if(heightRange == 0f) 454 if(heightRange == 0f || float.IsNaN(heightRange))
452 return 0; 455 return 0;
453 456
454 // Generate two frequencies of perlin noise based on our global position 457 // Generate two frequencies of perlin noise based on our global position
diff --git a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs
index 2995091..b0ecb80 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs
@@ -341,7 +341,7 @@ namespace OpenSim.Region.Framework.Scenes
341 if(group == null || group.IsDeleted) 341 if(group == null || group.IsDeleted)
342 return; 342 return;
343 343
344 if (Permissions.CanMoveObject(group, remoteClient))// && PermissionsMngr.) 344 if (Permissions.CanMoveObject(group, remoteClient))
345 { 345 {
346 group.GrabMovement(objectID, offset, pos, remoteClient); 346 group.GrabMovement(objectID, offset, pos, remoteClient);
347 } 347 }
@@ -359,16 +359,13 @@ namespace OpenSim.Region.Framework.Scenes
359 Vector3 grabOffset = pos - part.AbsolutePosition; 359 Vector3 grabOffset = pos - part.AbsolutePosition;
360 // If the touched prim handles touches, deliver it 360 // If the touched prim handles touches, deliver it
361 if ((part.ScriptEvents & scriptEvents.touch) != 0) 361 if ((part.ScriptEvents & scriptEvents.touch) != 0)
362// EventManager.TriggerObjectGrabbing(part.LocalId, 0, part.OffsetPosition, remoteClient, surfaceArg);
363 EventManager.TriggerObjectGrabbing(part.LocalId, 0, grabOffset, remoteClient, surfaceArg); 362 EventManager.TriggerObjectGrabbing(part.LocalId, 0, grabOffset, remoteClient, surfaceArg);
363
364 // Deliver to the root prim if the touched prim doesn't handle touches 364 // Deliver to the root prim if the touched prim doesn't handle touches
365 // or if we're meant to pass on touches anyway. 365 // or if we're meant to pass on touches anyway.
366 if (((part.ScriptEvents & scriptEvents.touch) == 0) || 366 if (((part.ScriptEvents & scriptEvents.touch) == 0) ||
367 (part.PassTouches && (part.LocalId != group.RootPart.LocalId))) 367 (part.PassTouches && (part.LocalId != group.RootPart.LocalId)))
368 {
369// EventManager.TriggerObjectGrabbing(group.RootPart.LocalId, part.LocalId, part.OffsetPosition, remoteClient, surfaceArg);
370 EventManager.TriggerObjectGrabbing(group.RootPart.LocalId, part.LocalId, grabOffset, remoteClient, surfaceArg); 368 EventManager.TriggerObjectGrabbing(group.RootPart.LocalId, part.LocalId, grabOffset, remoteClient, surfaceArg);
371 }
372 } 369 }
373 370
374 public virtual void ProcessObjectDeGrab(uint localID, IClientAPI remoteClient, List<SurfaceTouchEventArgs> surfaceArgs) 371 public virtual void ProcessObjectDeGrab(uint localID, IClientAPI remoteClient, List<SurfaceTouchEventArgs> surfaceArgs)
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index c0bafc5..dcfe79b 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -2086,13 +2086,20 @@ namespace OpenSim.Region.Framework.Scenes
2086 2086
2087 public void ObjectGrabHandler(uint localId, Vector3 offsetPos, IClientAPI remoteClient) 2087 public void ObjectGrabHandler(uint localId, Vector3 offsetPos, IClientAPI remoteClient)
2088 { 2088 {
2089
2089 if (m_rootPart.LocalId == localId) 2090 if (m_rootPart.LocalId == localId)
2090 { 2091 {
2092 if((RootPart.ScriptEvents & scriptEvents.anytouch) != 0)
2093 lastTouchTime = Util.GetTimeStampMS();
2091 OnGrabGroup(offsetPos, remoteClient); 2094 OnGrabGroup(offsetPos, remoteClient);
2092 } 2095 }
2093 else 2096 else
2094 { 2097 {
2095 SceneObjectPart part = GetPart(localId); 2098 SceneObjectPart part = GetPart(localId);
2099
2100 if (((part.ScriptEvents & scriptEvents.anytouch) != 0) ||
2101 (part.PassTouches && (RootPart.ScriptEvents & scriptEvents.anytouch) != 0))
2102 lastTouchTime = Util.GetTimeStampMS();
2096 OnGrabPart(part, offsetPos, remoteClient); 2103 OnGrabPart(part, offsetPos, remoteClient);
2097 } 2104 }
2098 } 2105 }
@@ -3615,6 +3622,10 @@ namespace OpenSim.Region.Framework.Scenes
3615// part.UpdatePrimFlags(UsesPhysics, IsTemporary, IsPhantom, IsVolumeDetect, false); 3622// part.UpdatePrimFlags(UsesPhysics, IsTemporary, IsPhantom, IsVolumeDetect, false);
3616 } 3623 }
3617 3624
3625 double lastTouchTime = 0;
3626
3627
3628
3618 /// <summary> 3629 /// <summary>
3619 /// If object is physical, apply force to move it around 3630 /// If object is physical, apply force to move it around
3620 /// If object is not physical, just put it at the resulting location 3631 /// If object is not physical, just put it at the resulting location
@@ -3623,7 +3634,7 @@ namespace OpenSim.Region.Framework.Scenes
3623 /// <param name="offset">Always seems to be 0,0,0, so ignoring</param> 3634 /// <param name="offset">Always seems to be 0,0,0, so ignoring</param>
3624 /// <param name="pos">New position. We do the math here to turn it into a force</param> 3635 /// <param name="pos">New position. We do the math here to turn it into a force</param>
3625 /// <param name="remoteClient"></param> 3636 /// <param name="remoteClient"></param>
3626 public void GrabMovement(UUID partID, Vector3 offset, Vector3 pos, IClientAPI remoteClient) 3637 public void GrabMovement(UUID partID, Vector3 offset, Vector3 pos, IClientAPI remoteClienth)
3627 { 3638 {
3628 if (m_scene.EventManager.TriggerGroupMove(UUID, pos)) 3639 if (m_scene.EventManager.TriggerGroupMove(UUID, pos))
3629 { 3640 {
@@ -3650,25 +3661,32 @@ namespace OpenSim.Region.Framework.Scenes
3650 } 3661 }
3651 else 3662 else
3652 { 3663 {
3653 NonPhysicalGrabMovement(pos); 3664 if(IsAttachment)
3665 return;
3666
3667 // block movement if there was a touch at start
3668 double now = Util.GetTimeStampMS();
3669 if (now - lastTouchTime < 250)
3670 {
3671 lastTouchTime = now;
3672 return;
3673 }
3674
3675 // a touch or pass may had become active ??
3676 if (((part.ScriptEvents & scriptEvents.anytouch) != 0) ||
3677 (part.PassTouches && (RootPart.ScriptEvents & scriptEvents.anytouch) != 0))
3678 {
3679 lastTouchTime = now;
3680 return;
3681 }
3682
3683 lastTouchTime = 0;
3684 UpdateGroupPosition(pos);
3654 } 3685 }
3655 } 3686 }
3656 } 3687 }
3657 3688
3658 /// <summary> 3689 /// <summary>
3659 /// Apply possition for grabbing non-physical linksets (Ctrl+Drag)
3660 /// This MUST be blocked for linksets that contain touch scripts because the viewer triggers grab on the touch
3661 /// event (Viewer Bug?) This would allow anyone to drag a linkset with a touch script. SL behaviour is also to
3662 /// block grab on prims with touch events.
3663 /// </summary>
3664 /// <param name="pos">New Position</param>
3665 public void NonPhysicalGrabMovement(Vector3 pos)
3666 {
3667 if(!IsAttachment && ScriptCount() == 0)
3668 UpdateGroupPosition(pos);
3669 }
3670
3671 /// <summary>
3672 /// If object is physical, prepare for spinning torques (set flag to save old orientation) 3690 /// If object is physical, prepare for spinning torques (set flag to save old orientation)
3673 /// </summary> 3691 /// </summary>
3674 /// <param name="rotation">Rotation. We do the math here to turn it into a torque</param> 3692 /// <param name="rotation">Rotation. We do the math here to turn it into a torque</param>
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index 5e2204e..ec58b97 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -3023,11 +3023,6 @@ namespace OpenSim.Region.Framework.Scenes
3023 { 3023 {
3024 if (m_scriptEvents.ContainsKey(scriptid)) 3024 if (m_scriptEvents.ContainsKey(scriptid))
3025 { 3025 {
3026 scriptEvents oldparts = scriptEvents.None;
3027 oldparts = (scriptEvents) m_scriptEvents[scriptid];
3028
3029 // remove values from aggregated script events
3030 AggregateScriptEvents &= ~oldparts;
3031 m_scriptEvents.Remove(scriptid); 3026 m_scriptEvents.Remove(scriptid);
3032 aggregateScriptEvents(); 3027 aggregateScriptEvents();
3033 } 3028 }
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
index a0f8959..8c880fc 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
@@ -1091,7 +1091,6 @@ namespace OpenSim.Region.Framework.Scenes
1091 m_part.ParentGroup.InvalidateDeepEffectivePerms(); 1091 m_part.ParentGroup.InvalidateDeepEffectivePerms();
1092 1092
1093 m_inventorySerial++; 1093 m_inventorySerial++;
1094 m_part.TriggerScriptChangedEvent(Changed.INVENTORY);
1095 1094
1096 HasInventoryChanged = true; 1095 HasInventoryChanged = true;
1097 m_part.ParentGroup.HasGroupChanged = true; 1096 m_part.ParentGroup.HasGroupChanged = true;
@@ -1115,6 +1114,7 @@ namespace OpenSim.Region.Framework.Scenes
1115 1114
1116 m_part.ScheduleFullUpdate(); 1115 m_part.ScheduleFullUpdate();
1117 1116
1117 m_part.TriggerScriptChangedEvent(Changed.INVENTORY);
1118 return type; 1118 return type;
1119 } 1119 }
1120 else 1120 else
diff --git a/OpenSim/Region/OptionalModules/Materials/MaterialsModule.cs b/OpenSim/Region/OptionalModules/Materials/MaterialsModule.cs
index 2aea7f9..331f1bd 100644
--- a/OpenSim/Region/OptionalModules/Materials/MaterialsModule.cs
+++ b/OpenSim/Region/OptionalModules/Materials/MaterialsModule.cs
@@ -272,17 +272,19 @@ namespace OpenSim.Region.OptionalModules.Materials
272 if (elemOsd != null && elemOsd is OSDMap) 272 if (elemOsd != null && elemOsd is OSDMap)
273 { 273 {
274 OSDMap matMap = elemOsd as OSDMap; 274 OSDMap matMap = elemOsd as OSDMap;
275 if (matMap.ContainsKey("ID") && matMap.ContainsKey("Material")) 275 OSD OSDID;
276 OSD OSDMaterial;
277 if (matMap.TryGetValue("ID", out OSDID) && matMap.TryGetValue("Material", out OSDMaterial) && OSDMaterial is OSDMap)
276 { 278 {
277 try 279 try
278 { 280 {
279 lock (materialslock) 281 lock (materialslock)
280 { 282 {
281 UUID id = matMap["ID"].AsUUID(); 283 UUID id = OSDID.AsUUID();
282 if(m_Materials.ContainsKey(id)) 284 if(m_Materials.ContainsKey(id))
283 continue; 285 continue;
284 286
285 OSDMap theMatMap = (OSDMap)matMap["Material"]; 287 OSDMap theMatMap = (OSDMap)OSDMaterial;
286 FaceMaterial fmat = new FaceMaterial(theMatMap); 288 FaceMaterial fmat = new FaceMaterial(theMatMap);
287 289
288 if(fmat == null || 290 if(fmat == null ||
@@ -290,7 +292,7 @@ namespace OpenSim.Region.OptionalModules.Materials
290 && fmat.NormalMapID == UUID.Zero 292 && fmat.NormalMapID == UUID.Zero
291 && fmat.SpecularMapID == UUID.Zero)) 293 && fmat.SpecularMapID == UUID.Zero))
292 continue; 294 continue;
293 295
294 fmat.ID = id; 296 fmat.ID = id;
295 m_Materials[id] = fmat; 297 m_Materials[id] = fmat;
296 m_MaterialsRefCount[id] = 0; 298 m_MaterialsRefCount[id] = 0;
@@ -459,12 +461,13 @@ namespace OpenSim.Region.OptionalModules.Materials
459 OSDMap resp = new OSDMap(); 461 OSDMap resp = new OSDMap();
460 462
461 OSDArray respArr = new OSDArray(); 463 OSDArray respArr = new OSDArray();
464 OSD tmpOSD;
462 465
463 if (req.ContainsKey("Zipped")) 466 if (req.TryGetValue("Zipped", out tmpOSD))
464 { 467 {
465 OSD osd = null; 468 OSD osd = null;
466 469
467 byte[] inBytes = req["Zipped"].AsBinary(); 470 byte[] inBytes = tmpOSD.AsBinary();
468 471
469 try 472 try
470 { 473 {
@@ -531,12 +534,13 @@ namespace OpenSim.Region.OptionalModules.Materials
531 534
532 OSDArray respArr = new OSDArray(); 535 OSDArray respArr = new OSDArray();
533 536
537 OSD tmpOSD;
534 HashSet<SceneObjectPart> parts = new HashSet<SceneObjectPart>(); 538 HashSet<SceneObjectPart> parts = new HashSet<SceneObjectPart>();
535 if (req.ContainsKey("Zipped")) 539 if (req.TryGetValue("Zipped", out tmpOSD))
536 { 540 {
537 OSD osd = null; 541 OSD osd = null;
538 542
539 byte[] inBytes = req["Zipped"].AsBinary(); 543 byte[] inBytes = tmpOSD.AsBinary();
540 544
541 try 545 try
542 { 546 {
@@ -546,145 +550,140 @@ namespace OpenSim.Region.OptionalModules.Materials
546 { 550 {
547 materialsFromViewer = osd as OSDMap; 551 materialsFromViewer = osd as OSDMap;
548 552
549 if (materialsFromViewer.ContainsKey("FullMaterialsPerFace")) 553 if (materialsFromViewer.TryGetValue("FullMaterialsPerFace", out tmpOSD) && (tmpOSD is OSDArray))
550 { 554 {
551 OSD matsOsd = materialsFromViewer["FullMaterialsPerFace"]; 555 OSDArray matsArr = tmpOSD as OSDArray;
552 if (matsOsd is OSDArray) 556 try
553 { 557 {
554 OSDArray matsArr = matsOsd as OSDArray; 558 foreach (OSDMap matsMap in matsArr)
555
556 try
557 { 559 {
558 foreach (OSDMap matsMap in matsArr) 560 uint primLocalID = 0;
561 try
559 { 562 {
560 uint primLocalID = 0; 563 primLocalID = matsMap["ID"].AsUInteger();
561 try 564 }
562 { 565 catch (Exception e)
563 primLocalID = matsMap["ID"].AsUInteger(); 566 {
564 } 567 m_log.Warn("[Materials]: cannot decode \"ID\" from matsMap: " + e.Message);
565 catch (Exception e) 568 continue;
566 { 569 }
567 m_log.Warn("[Materials]: cannot decode \"ID\" from matsMap: " + e.Message);
568 continue;
569 }
570 570
571 SceneObjectPart sop = m_scene.GetSceneObjectPart(primLocalID); 571 SceneObjectPart sop = m_scene.GetSceneObjectPart(primLocalID);
572 if (sop == null) 572 if (sop == null)
573 { 573 {
574 m_log.WarnFormat("[Materials]: SOP not found for localId: {0}", primLocalID.ToString()); 574 m_log.WarnFormat("[Materials]: SOP not found for localId: {0}", primLocalID.ToString());
575 continue; 575 continue;
576 } 576 }
577 577
578 if (!m_scene.Permissions.CanEditObject(sop.UUID, agentID)) 578 if (!m_scene.Permissions.CanEditObject(sop.UUID, agentID))
579 { 579 {
580 m_log.WarnFormat("User {0} can't edit object {1} {2}", agentID, sop.Name, sop.UUID); 580 m_log.WarnFormat("User {0} can't edit object {1} {2}", agentID, sop.Name, sop.UUID);
581 continue; 581 continue;
582 } 582 }
583 583
584 OSDMap mat = null; 584 OSDMap mat = null;
585 try 585 try
586 { 586 {
587 mat = matsMap["Material"] as OSDMap; 587 mat = matsMap["Material"] as OSDMap;
588 } 588 }
589 catch (Exception e) 589 catch (Exception e)
590 { 590 {
591 m_log.Warn("[Materials]: cannot decode \"Material\" from matsMap: " + e.Message); 591 m_log.Warn("[Materials]: cannot decode \"Material\" from matsMap: " + e.Message);
592 continue; 592 continue;
593 } 593 }
594 594
595 Primitive.TextureEntry te = new Primitive.TextureEntry(sop.Shape.TextureEntry, 0, sop.Shape.TextureEntry.Length); 595 Primitive.TextureEntry te = new Primitive.TextureEntry(sop.Shape.TextureEntry, 0, sop.Shape.TextureEntry.Length);
596 if (te == null) 596 if (te == null)
597 { 597 {
598 m_log.WarnFormat("[Materials]: Error in TextureEntry for SOP {0} {1}", sop.Name, sop.UUID); 598 m_log.WarnFormat("[Materials]: Error in TextureEntry for SOP {0} {1}", sop.Name, sop.UUID);
599 continue; 599 continue;
600 } 600 }
601 601
602 int face = -1; 602 int face = -1;
603 UUID oldid = UUID.Zero; 603 UUID oldid = UUID.Zero;
604 Primitive.TextureEntryFace faceEntry = null; 604 Primitive.TextureEntryFace faceEntry = null;
605 if (matsMap.ContainsKey("Face")) 605 if (matsMap.TryGetValue("Face", out tmpOSD))
606 { 606 {
607 face = matsMap["Face"].AsInteger(); 607 face = tmpOSD.AsInteger();
608 faceEntry = te.CreateFace((uint)face); 608 faceEntry = te.CreateFace((uint)face);
609 } 609 }
610 else 610 else
611 faceEntry = te.DefaultTexture; 611 faceEntry = te.DefaultTexture;
612 612
613 if (faceEntry == null) 613 if (faceEntry == null)
614 continue; 614 continue;
615 615
616 UUID id; 616 UUID id;
617 FaceMaterial newFaceMat = null; 617 FaceMaterial newFaceMat = null;
618 if (mat == null) 618 if (mat == null)
619 { 619 {
620 // This happens then the user removes a material from a prim 620 // This happens then the user removes a material from a prim
621 id = UUID.Zero;
622 }
623 else
624 {
625 newFaceMat = new FaceMaterial(mat);
626 if(newFaceMat.DiffuseAlphaMode == 1
627 && newFaceMat.NormalMapID == UUID.Zero
628 && newFaceMat.SpecularMapID == UUID.Zero
629 )
621 id = UUID.Zero; 630 id = UUID.Zero;
622 }
623 else 631 else
624 { 632 {
625 newFaceMat = new FaceMaterial(mat); 633 newFaceMat.genID();
626 if(newFaceMat.DiffuseAlphaMode == 1 634 id = newFaceMat.ID;
627 && newFaceMat.NormalMapID == UUID.Zero
628 && newFaceMat.SpecularMapID == UUID.Zero
629 )
630 id = UUID.Zero;
631 else
632 {
633 newFaceMat.genID();
634 id = newFaceMat.ID;
635 }
636 } 635 }
636 }
637 637
638 oldid = faceEntry.MaterialID; 638 oldid = faceEntry.MaterialID;
639 639
640 if(oldid == id) 640 if(oldid == id)
641 continue; 641 continue;
642 642
643 if (faceEntry != null) 643 if (faceEntry != null)
644 { 644 {
645 faceEntry.MaterialID = id; 645 faceEntry.MaterialID = id;
646 //m_log.DebugFormat("[Materials]: in \"{0}\" {1}, setting material ID for face {2} to {3}", sop.Name, sop.UUID, face, id); 646 //m_log.DebugFormat("[Materials]: in \"{0}\" {1}, setting material ID for face {2} to {3}", sop.Name, sop.UUID, face, id);
647 // We can't use sop.UpdateTextureEntry(te) because it filters, so do it manually 647 // We can't use sop.UpdateTextureEntry(te) because it filters, so do it manually
648 sop.Shape.TextureEntry = te.GetBytes(9); 648 sop.Shape.TextureEntry = te.GetBytes(9);
649 } 649 }
650 650
651 if(oldid != UUID.Zero) 651 if(oldid != UUID.Zero)
652 RemoveMaterial(oldid); 652 RemoveMaterial(oldid);
653 653
654 lock(materialslock) 654 lock(materialslock)
655 {
656 if(id != UUID.Zero)
655 { 657 {
656 if(id != UUID.Zero) 658 if (m_Materials.ContainsKey(id))
659 m_MaterialsRefCount[id]++;
660 else
657 { 661 {
658 if (m_Materials.ContainsKey(id)) 662 m_Materials[id] = newFaceMat;
659 m_MaterialsRefCount[id]++; 663 m_MaterialsRefCount[id] = 1;
660 else 664 m_changed[newFaceMat] = Util.GetTimeStamp();
661 {
662 m_Materials[id] = newFaceMat;
663 m_MaterialsRefCount[id] = 1;
664 m_changed[newFaceMat] = Util.GetTimeStamp();
665 }
666 } 665 }
667 } 666 }
668
669 if(!parts.Contains(sop))
670 parts.Add(sop);
671 } 667 }
672 668
673 foreach(SceneObjectPart sop in parts) 669 if(!parts.Contains(sop))
674 { 670 parts.Add(sop);
675 if (sop.ParentGroup != null && !sop.ParentGroup.IsDeleted)
676 {
677 sop.TriggerScriptChangedEvent(Changed.TEXTURE);
678 sop.ScheduleFullUpdate();
679 sop.ParentGroup.HasGroupChanged = true;
680 }
681 }
682 } 671 }
683 catch (Exception e) 672
673 foreach(SceneObjectPart sop in parts)
684 { 674 {
685 m_log.Warn("[Materials]: exception processing received material ", e); 675 if (sop.ParentGroup != null && !sop.ParentGroup.IsDeleted)
676 {
677 sop.TriggerScriptChangedEvent(Changed.TEXTURE);
678 sop.ScheduleFullUpdate();
679 sop.ParentGroup.HasGroupChanged = true;
680 }
686 } 681 }
687 } 682 }
683 catch (Exception e)
684 {
685 m_log.Warn("[Materials]: exception processing received material ", e);
686 }
688 } 687 }
689 } 688 }
690 } 689 }
diff --git a/OpenSim/Region/PhysicsModules/ubOdeMeshing/Meshmerizer.cs b/OpenSim/Region/PhysicsModules/ubOdeMeshing/Meshmerizer.cs
index 8449596..ac32f75 100644
--- a/OpenSim/Region/PhysicsModules/ubOdeMeshing/Meshmerizer.cs
+++ b/OpenSim/Region/PhysicsModules/ubOdeMeshing/Meshmerizer.cs
@@ -294,7 +294,7 @@ namespace OpenSim.Region.PhysicsModule.ubODEMeshing
294 294
295 if(numCoords < 3 || (!needsConvexProcessing && numFaces < 1)) 295 if(numCoords < 3 || (!needsConvexProcessing && numFaces < 1))
296 { 296 {
297 m_log.ErrorFormat("[MESH]: invalid degenerated mesh for prim {0} ignored", primName); 297 m_log.ErrorFormat("[ubODEMesh]: invalid degenerated mesh for prim {0} ignored", primName);
298 return null; 298 return null;
299 } 299 }
300 300
@@ -331,7 +331,7 @@ namespace OpenSim.Region.PhysicsModule.ubODEMeshing
331 331
332 if(mesh.numberVertices() < 3 || mesh.numberTriangles() < 1) 332 if(mesh.numberVertices() < 3 || mesh.numberTriangles() < 1)
333 { 333 {
334 m_log.ErrorFormat("[MESH]: invalid degenerated mesh for prim {0} ignored", primName); 334 m_log.ErrorFormat("[ubODEMesh]: invalid degenerated mesh for prim {0} ignored", primName);
335 return null; 335 return null;
336 } 336 }
337 337
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 5d72858..9a0c836 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -784,25 +784,25 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
784 public LSL_Float llCos(double f) 784 public LSL_Float llCos(double f)
785 { 785 {
786 m_host.AddScriptLPS(1); 786 m_host.AddScriptLPS(1);
787 return (double)Math.Cos(f); 787 return Math.Cos(f);
788 } 788 }
789 789
790 public LSL_Float llTan(double f) 790 public LSL_Float llTan(double f)
791 { 791 {
792 m_host.AddScriptLPS(1); 792 m_host.AddScriptLPS(1);
793 return (double)Math.Tan(f); 793 return Math.Tan(f);
794 } 794 }
795 795
796 public LSL_Float llAtan2(double x, double y) 796 public LSL_Float llAtan2(LSL_Float x, LSL_Float y)
797 { 797 {
798 m_host.AddScriptLPS(1); 798 m_host.AddScriptLPS(1);
799 return (double)Math.Atan2(x, y); 799 return Math.Atan2(x, y);
800 } 800 }
801 801
802 public LSL_Float llSqrt(double f) 802 public LSL_Float llSqrt(double f)
803 { 803 {
804 m_host.AddScriptLPS(1); 804 m_host.AddScriptLPS(1);
805 return (double)Math.Sqrt(f); 805 return Math.Sqrt(f);
806 } 806 }
807 807
808 public LSL_Float llPow(double fbase, double fexponent) 808 public LSL_Float llPow(double fbase, double fexponent)
@@ -811,7 +811,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
811 return (double)Math.Pow(fbase, fexponent); 811 return (double)Math.Pow(fbase, fexponent);
812 } 812 }
813 813
814 public LSL_Integer llAbs(int i) 814 public LSL_Integer llAbs(LSL_Integer i)
815 { 815 {
816 // changed to replicate LSL behaviour whereby minimum int value is returned untouched. 816 // changed to replicate LSL behaviour whereby minimum int value is returned untouched.
817 m_host.AddScriptLPS(1); 817 m_host.AddScriptLPS(1);
@@ -3069,7 +3069,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3069 m_host.ParentGroup.StopMoveToTarget(); 3069 m_host.ParentGroup.StopMoveToTarget();
3070 } 3070 }
3071 3071
3072 public void llApplyImpulse(LSL_Vector force, int local) 3072 public void llApplyImpulse(LSL_Vector force, LSL_Integer local)
3073 { 3073 {
3074 m_host.AddScriptLPS(1); 3074 m_host.AddScriptLPS(1);
3075 //No energy force yet 3075 //No energy force yet
@@ -3526,7 +3526,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3526 return src.ToLower(); 3526 return src.ToLower();
3527 } 3527 }
3528 3528
3529 public LSL_Integer llGiveMoney(string destination, int amount) 3529 public LSL_Integer llGiveMoney(LSL_Key destination, LSL_Integer amount)
3530 { 3530 {
3531 Util.FireAndForget(x => 3531 Util.FireAndForget(x =>
3532 { 3532 {
@@ -3785,7 +3785,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3785 return 100f * llGetMass(); 3785 return 100f * llGetMass();
3786 } 3786 }
3787 3787
3788 public void llCollisionFilter(string name, string id, int accept) 3788 public void llCollisionFilter(LSL_String name, LSL_Key id, LSL_Integer accept)
3789 { 3789 {
3790 m_host.AddScriptLPS(1); 3790 m_host.AddScriptLPS(1);
3791 m_host.CollisionFilter.Clear(); 3791 m_host.CollisionFilter.Clear();
@@ -4513,7 +4513,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4513 } 4513 }
4514 } 4514 }
4515 4515
4516 public void llCreateLink(LSL_String target, LSL_Integer parent) 4516 public void llCreateLink(LSL_Key target, LSL_Integer parent)
4517 { 4517 {
4518 m_host.AddScriptLPS(1); 4518 m_host.AddScriptLPS(1);
4519 4519
@@ -4847,7 +4847,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4847 return 1.0f; 4847 return 1.0f;
4848 } 4848 }
4849 4849
4850 public void llGiveInventory(string destination, string inventory) 4850 public void llGiveInventory(LSL_Key destination, LSL_String inventory)
4851 { 4851 {
4852 m_host.AddScriptLPS(1); 4852 m_host.AddScriptLPS(1);
4853 4853
@@ -5317,7 +5317,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
5317 } 5317 }
5318 } 5318 }
5319 5319
5320 public void llCollisionSound(string impact_sound, double impact_volume) 5320 public void llCollisionSound(LSL_String impact_sound, LSL_Float impact_volume)
5321 { 5321 {
5322 m_host.AddScriptLPS(1); 5322 m_host.AddScriptLPS(1);
5323 5323
@@ -5344,11 +5344,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
5344 m_host.aggregateScriptEvents(); 5344 m_host.aggregateScriptEvents();
5345 } 5345 }
5346 5346
5347 public LSL_String llGetAnimation(string id) 5347 public LSL_String llGetAnimation(LSL_Key id)
5348 { 5348 {
5349 // This should only return a value if the avatar is in the same region 5349 // This should only return a value if the avatar is in the same region
5350 m_host.AddScriptLPS(1); 5350 m_host.AddScriptLPS(1);
5351 UUID avatar = (UUID)id; 5351 UUID avatar;
5352 if(!UUID.TryParse(id, out avatar))
5353 return "";
5352 ScenePresence presence = World.GetScenePresence(avatar); 5354 ScenePresence presence = World.GetScenePresence(avatar);
5353 if (presence == null) 5355 if (presence == null)
5354 return ""; 5356 return "";
@@ -5698,13 +5700,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
5698 return angle; 5700 return angle;
5699 } 5701 }
5700 5702
5701 public LSL_Float llAcos(double val) 5703 public LSL_Float llAcos(LSL_Float val)
5702 { 5704 {
5703 m_host.AddScriptLPS(1); 5705 m_host.AddScriptLPS(1);
5704 return (double)Math.Acos(val); 5706 return (double)Math.Acos(val);
5705 } 5707 }
5706 5708
5707 public LSL_Float llAsin(double val) 5709 public LSL_Float llAsin(LSL_Float val)
5708 { 5710 {
5709 m_host.AddScriptLPS(1); 5711 m_host.AddScriptLPS(1);
5710 return (double)Math.Asin(val); 5712 return (double)Math.Asin(val);
@@ -5744,7 +5746,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
5744 return UUID.Zero.ToString(); 5746 return UUID.Zero.ToString();
5745 } 5747 }
5746 5748
5747 public void llAllowInventoryDrop(int add) 5749 public void llAllowInventoryDrop(LSL_Integer add)
5748 { 5750 {
5749 m_host.AddScriptLPS(1); 5751 m_host.AddScriptLPS(1);
5750 5752
@@ -6387,75 +6389,64 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6387 public LSL_String llGetEnv(LSL_String name) 6389 public LSL_String llGetEnv(LSL_String name)
6388 { 6390 {
6389 m_host.AddScriptLPS(1); 6391 m_host.AddScriptLPS(1);
6390 if (name == "agent_limit") 6392 switch(name)
6391 {
6392 return World.RegionInfo.RegionSettings.AgentLimit.ToString();
6393 }
6394 else if (name == "dynamic_pathfinding")
6395 {
6396 return "0";
6397 }
6398 else if (name == "estate_id")
6399 {
6400 return World.RegionInfo.EstateSettings.EstateID.ToString();
6401 }
6402 else if (name == "estate_name")
6403 {
6404 return World.RegionInfo.EstateSettings.EstateName;
6405 }
6406 else if (name == "frame_number")
6407 { 6393 {
6408 return World.Frame.ToString(); 6394 case "agent_limit":
6409 } 6395 return World.RegionInfo.RegionSettings.AgentLimit.ToString();
6410 else if (name == "region_cpu_ratio") 6396
6411 { 6397 case "dynamic_pathfinding":
6412 return "1"; 6398 return "0";
6413 } 6399
6414 else if (name == "region_idle") 6400 case "estate_id":
6415 { 6401 return World.RegionInfo.EstateSettings.EstateID.ToString();
6416 return "0"; 6402
6417 } 6403 case "estate_name":
6418 else if (name == "region_product_name") 6404 return World.RegionInfo.EstateSettings.EstateName;
6419 { 6405
6420 if (World.RegionInfo.RegionType != String.Empty) 6406 case "frame_number":
6421 return World.RegionInfo.RegionType; 6407 return World.Frame.ToString();
6422 else 6408
6409 case "region_cpu_ratio":
6410 return "1";
6411
6412 case "region_idle":
6413 return "0";
6414
6415 case "region_product_name":
6416 if (World.RegionInfo.RegionType != String.Empty)
6417 return World.RegionInfo.RegionType;
6418 else
6419 return "";
6420
6421 case "region_product_sku":
6422 return "OpenSim";
6423
6424 case "region_start_time":
6425 return World.UnixStartTime.ToString();
6426
6427 case "region_up_time":
6428 int time = Util.UnixTimeSinceEpoch() - World.UnixStartTime;
6429 return time.ToString();
6430
6431 case "sim_channel":
6432 return "OpenSim";
6433
6434 case "sim_version":
6435 return World.GetSimulatorVersion();
6436
6437 case "simulator_hostname":
6438 IUrlModule UrlModule = World.RequestModuleInterface<IUrlModule>();
6439 return UrlModule.ExternalHostNameForLSL;
6440
6441 case "region_max_prims":
6442 return World.RegionInfo.ObjectCapacity.ToString();
6443
6444 case "region_object_bonus":
6445 return World.RegionInfo.RegionSettings.ObjectBonus.ToString();
6446
6447 default:
6423 return ""; 6448 return "";
6424 } 6449 }
6425 else if (name == "region_product_sku")
6426 {
6427 return "OpenSim";
6428 }
6429 else if (name == "region_start_time")
6430 {
6431 return World.UnixStartTime.ToString();
6432 }
6433 else if (name == "sim_channel")
6434 {
6435 return "OpenSim";
6436 }
6437 else if (name == "sim_version")
6438 {
6439 return World.GetSimulatorVersion();
6440 }
6441 else if (name == "simulator_hostname")
6442 {
6443 IUrlModule UrlModule = World.RequestModuleInterface<IUrlModule>();
6444 return UrlModule.ExternalHostNameForLSL;
6445 }
6446 else if (name == "region_max_prims")
6447 {
6448 return World.RegionInfo.ObjectCapacity.ToString();
6449 }
6450 else if (name == "region_object_bonus")
6451 {
6452 return World.RegionInfo.RegionSettings.ObjectBonus.ToString();
6453 }
6454 else
6455 {
6456 return "";
6457 }
6458
6459 } 6450 }
6460 6451
6461 /// <summary> 6452 /// <summary>
@@ -6650,7 +6641,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6650 /// AGENT_BUSY 6641 /// AGENT_BUSY
6651 /// Remove as they are done 6642 /// Remove as they are done
6652 /// </summary> 6643 /// </summary>
6653 public LSL_Integer llGetAgentInfo(string id) 6644 public LSL_Integer llGetAgentInfo(LSL_Key id)
6654 { 6645 {
6655 m_host.AddScriptLPS(1); 6646 m_host.AddScriptLPS(1);
6656 6647
@@ -6757,7 +6748,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6757 return flags; 6748 return flags;
6758 } 6749 }
6759 6750
6760 public LSL_String llGetAgentLanguage(string id) 6751 public LSL_String llGetAgentLanguage(LSL_Key id)
6761 { 6752 {
6762 // This should only return a value if the avatar is in the same region, but eh. idc. 6753 // This should only return a value if the avatar is in the same region, but eh. idc.
6763 m_host.AddScriptLPS(1); 6754 m_host.AddScriptLPS(1);
@@ -6868,7 +6859,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6868 return result; 6859 return result;
6869 } 6860 }
6870 6861
6871 public void llAdjustSoundVolume(double volume) 6862 public void llAdjustSoundVolume(LSL_Float volume)
6872 { 6863 {
6873 m_host.AddScriptLPS(1); 6864 m_host.AddScriptLPS(1);
6874 m_host.AdjustSoundGain(volume); 6865 m_host.AdjustSoundGain(volume);
@@ -6881,7 +6872,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6881 m_host.SoundRadius = radius; 6872 m_host.SoundRadius = radius;
6882 } 6873 }
6883 6874
6884 public LSL_String llKey2Name(string id) 6875 public LSL_String llKey2Name(LSL_Key id)
6885 { 6876 {
6886 m_host.AddScriptLPS(1); 6877 m_host.AddScriptLPS(1);
6887 UUID key = new UUID(); 6878 UUID key = new UUID();
@@ -7055,22 +7046,20 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7055 /// only the height of avatars vary and that says: 7046 /// only the height of avatars vary and that says:
7056 /// Width (x) and depth (y) are constant. (0.45m and 0.6m respectively). 7047 /// Width (x) and depth (y) are constant. (0.45m and 0.6m respectively).
7057 /// </summary> 7048 /// </summary>
7058 public LSL_Vector llGetAgentSize(string id) 7049 public LSL_Vector llGetAgentSize(LSL_Key id)
7059 { 7050 {
7060 m_host.AddScriptLPS(1); 7051 m_host.AddScriptLPS(1);
7061 ScenePresence avatar = World.GetScenePresence((UUID)id); 7052 UUID avID;
7062 LSL_Vector agentSize; 7053 if(!UUID.TryParse(id, out avID))
7054 return ScriptBaseClass.ZERO_VECTOR;
7055
7056 ScenePresence avatar = World.GetScenePresence(avID);
7063 if (avatar == null || avatar.IsChildAgent) // Fail if not in the same region 7057 if (avatar == null || avatar.IsChildAgent) // Fail if not in the same region
7064 { 7058 return ScriptBaseClass.ZERO_VECTOR;
7065 agentSize = ScriptBaseClass.ZERO_VECTOR; 7059
7066 }
7067 else
7068 {
7069// agentSize = new LSL_Vector(0.45f, 0.6f, avatar.Appearance.AvatarHeight); 7060// agentSize = new LSL_Vector(0.45f, 0.6f, avatar.Appearance.AvatarHeight);
7070 Vector3 s = avatar.Appearance.AvatarSize; 7061 Vector3 s = avatar.Appearance.AvatarSize;
7071 agentSize = new LSL_Vector(s.X, s.Y, s.Z); 7062 return new LSL_Vector(s.X, s.Y, s.Z);
7072 }
7073 return agentSize;
7074 } 7063 }
7075 7064
7076 public LSL_Integer llSameGroup(string id) 7065 public LSL_Integer llSameGroup(string id)
@@ -7246,12 +7235,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7246 return m_host.ParentGroup.AttachmentPoint; 7235 return m_host.ParentGroup.AttachmentPoint;
7247 } 7236 }
7248 7237
7249 public LSL_List llGetAttachedList(string id) 7238 public LSL_List llGetAttachedList(LSL_Key id)
7250 { 7239 {
7251 m_host.AddScriptLPS(1); 7240 m_host.AddScriptLPS(1);
7252 7241
7253 ScenePresence av = World.GetScenePresence((UUID)id); 7242 UUID avID;
7243 if(!UUID.TryParse(id, out avID))
7244 return new LSL_List("NOT_FOUND");
7254 7245
7246 ScenePresence av = World.GetScenePresence(avID);
7255 if (av == null || av.IsDeleted) 7247 if (av == null || av.IsDeleted)
7256 return new LSL_List("NOT_FOUND"); 7248 return new LSL_List("NOT_FOUND");
7257 7249
@@ -7836,7 +7828,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7836 } 7828 }
7837 } 7829 }
7838 7830
7839 public void llGiveInventoryList(string destination, string category, LSL_List inventory) 7831 public void llGiveInventoryList(LSL_Key destination, LSL_String category, LSL_List inventory)
7840 { 7832 {
7841 m_host.AddScriptLPS(1); 7833 m_host.AddScriptLPS(1);
7842 7834
@@ -8014,7 +8006,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
8014 } 8006 }
8015 8007
8016 8008
8017 public void llAddToLandPassList(LSL_Key avatar, double hours) 8009 public void llAddToLandPassList(LSL_Key avatar, LSL_Float hours)
8018 { 8010 {
8019 m_host.AddScriptLPS(1); 8011 m_host.AddScriptLPS(1);
8020 UUID key; 8012 UUID key;
@@ -11086,16 +11078,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
11086 return (double)Math.Log(val); 11078 return (double)Math.Log(val);
11087 } 11079 }
11088 11080
11089 public LSL_List llGetAnimationList(string id) 11081 public LSL_List llGetAnimationList(LSL_Key id)
11090 { 11082 {
11091 m_host.AddScriptLPS(1); 11083 m_host.AddScriptLPS(1);
11092 11084
11093 LSL_List l = new LSL_List(); 11085 UUID avID;
11094 ScenePresence av = World.GetScenePresence((UUID)id); 11086 if(!UUID.TryParse(id, out avID))
11087 return new LSL_List();
11088
11089 ScenePresence av = World.GetScenePresence(avID);
11095 if (av == null || av.IsChildAgent) // only if in the region 11090 if (av == null || av.IsChildAgent) // only if in the region
11096 return l; 11091 return new LSL_List();
11092
11097 UUID[] anims; 11093 UUID[] anims;
11098 anims = av.Animator.GetAnimationArray(); 11094 anims = av.Animator.GetAnimationArray();
11095 LSL_List l = new LSL_List();
11099 foreach (UUID foo in anims) 11096 foreach (UUID foo in anims)
11100 l.Add(new LSL_Key(foo.ToString())); 11097 l.Add(new LSL_Key(foo.ToString()));
11101 return l; 11098 return l;
@@ -13619,7 +13616,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
13619 ScriptSleep(m_sleepMsOnMapDestination); 13616 ScriptSleep(m_sleepMsOnMapDestination);
13620 } 13617 }
13621 13618
13622 public void llAddToLandBanList(LSL_Key avatar, double hours) 13619 public void llAddToLandBanList(LSL_Key avatar, LSL_Float hours)
13623 { 13620 {
13624 m_host.AddScriptLPS(1); 13621 m_host.AddScriptLPS(1);
13625 UUID key; 13622 UUID key;
@@ -14343,6 +14340,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
14343 case "5": 14340 case "5":
14344 ret.Add(new LSL_Key(land.GlobalID.ToString())); 14341 ret.Add(new LSL_Key(land.GlobalID.ToString()));
14345 break; 14342 break;
14343 case "64":
14344 ret.Add(new LSL_Integer(land.Dwell));
14345 break;
14346 default: 14346 default:
14347 ret.Add(new LSL_Integer(0)); 14347 ret.Add(new LSL_Integer(0));
14348 break; 14348 break;
@@ -15056,7 +15056,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
15056 return name.Replace(" ", ".").ToLower(); 15056 return name.Replace(" ", ".").ToLower();
15057 } 15057 }
15058 15058
15059 public LSL_String llGetUsername(string id) 15059 public LSL_String llGetUsername(LSL_Key id)
15060 { 15060 {
15061 return Name2Username(llKey2Name(id)); 15061 return Name2Username(llKey2Name(id));
15062 } 15062 }
@@ -16599,7 +16599,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
16599 m_SoundModule.SetSoundQueueing(m_host.UUID, queue == ScriptBaseClass.TRUE.value); 16599 m_SoundModule.SetSoundQueueing(m_host.UUID, queue == ScriptBaseClass.TRUE.value);
16600 } 16600 }
16601 16601
16602 public void llCollisionSprite(string impact_sprite) 16602 public void llCollisionSprite(LSL_String impact_sprite)
16603 { 16603 {
16604 m_host.AddScriptLPS(1); 16604 m_host.AddScriptLPS(1);
16605 // Viewer 2.0 broke this and it's likely LL has no intention 16605 // Viewer 2.0 broke this and it's likely LL has no intention
@@ -16660,7 +16660,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
16660 new DetectParams[0])); 16660 new DetectParams[0]));
16661 } 16661 }
16662 16662
16663 public LSL_Key llTransferLindenDollars(string destination, int amount) 16663 public LSL_Key llTransferLindenDollars(LSL_Key destination, LSL_Integer amount)
16664 { 16664 {
16665 UUID txn = UUID.Random(); 16665 UUID txn = UUID.Random();
16666 16666
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
index 7d3c832..62da221 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -1600,6 +1600,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1600 return 0.0f; 1600 return 0.0f;
1601 } 1601 }
1602 1602
1603 public LSL_Integer osGetParcelDwell(LSL_Vector pos)
1604 {
1605 LandData land = World.GetLandData(pos);
1606 if (land != null)
1607 {
1608 return (int)land.Dwell;
1609 }
1610 return 0;
1611 }
1612
1603 // Routines for creating and managing parcels programmatically 1613 // Routines for creating and managing parcels programmatically
1604 public void osParcelJoin(LSL_Vector pos1, LSL_Vector pos2) 1614 public void osParcelJoin(LSL_Vector pos1, LSL_Vector pos2)
1605 { 1615 {
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs
index 8e1192c..6599c22 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs
@@ -41,20 +41,20 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
41 { 41 {
42 void state(string newState); 42 void state(string newState);
43 43
44 LSL_Integer llAbs(int val); 44 LSL_Integer llAbs(LSL_Integer val);
45 LSL_Float llAcos(double val); 45 LSL_Float llAcos(LSL_Float val);
46 //ApiDesc Sleep 0.1 46 //ApiDesc Sleep 0.1
47 void llAddToLandBanList(LSL_Key avatarId, double hours); 47 void llAddToLandBanList(LSL_Key avatarId, LSL_Float hours);
48 //ApiDesc Sleep 0.1 48 //ApiDesc Sleep 0.1
49 void llAddToLandPassList(LSL_Key avatarId, double hours); 49 void llAddToLandPassList(LSL_Key avatarId, LSL_Float hours);
50 //ApiDesc Sleep 0.1 50 //ApiDesc Sleep 0.1
51 void llAdjustSoundVolume(double volume); 51 void llAdjustSoundVolume(LSL_Float volume);
52 void llAllowInventoryDrop(int add); 52 void llAllowInventoryDrop(LSL_Integer add);
53 LSL_Float llAngleBetween(LSL_Rotation a, LSL_Rotation b); 53 LSL_Float llAngleBetween(LSL_Rotation a, LSL_Rotation b);
54 void llApplyImpulse(LSL_Vector force, int local); 54 void llApplyImpulse(LSL_Vector force, LSL_Integer local);
55 void llApplyRotationalImpulse(LSL_Vector force, int local); 55 void llApplyRotationalImpulse(LSL_Vector force, int local);
56 LSL_Float llAsin(double val); 56 LSL_Float llAsin(LSL_Float val);
57 LSL_Float llAtan2(double x, double y); 57 LSL_Float llAtan2(LSL_Float x, LSL_Float y);
58 void llAttachToAvatar(LSL_Integer attachment); 58 void llAttachToAvatar(LSL_Integer attachment);
59 void llAttachToAvatarTemp(LSL_Integer attachmentPoint); 59 void llAttachToAvatarTemp(LSL_Integer attachmentPoint);
60 LSL_Key llAvatarOnSitTarget(); 60 LSL_Key llAvatarOnSitTarget();
@@ -74,13 +74,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
74 //ApiDesc Sleep 1.0 74 //ApiDesc Sleep 1.0
75 void llCloseRemoteDataChannel(string channel); 75 void llCloseRemoteDataChannel(string channel);
76 LSL_Float llCloud(LSL_Vector offset); 76 LSL_Float llCloud(LSL_Vector offset);
77 void llCollisionFilter(string name, string id, int accept); 77 void llCollisionFilter(LSL_String name, LSL_Key id, LSL_Integer accept);
78 void llCollisionSound(string impact_sound, double impact_volume); 78 void llCollisionSound(LSL_String impact_sound, LSL_Float impact_volume);
79 //ApiDesc Not Supported - does nothing 79 //ApiDesc Not Supported - does nothing
80 void llCollisionSprite(string impact_sprite); 80 void llCollisionSprite(LSL_String impact_sprite);
81 LSL_Float llCos(double f); 81 LSL_Float llCos(double f);
82 //ApiDesc Sleep 1.0 82 //ApiDesc Sleep 1.0
83 void llCreateLink(LSL_String targetId, LSL_Integer parent); 83 void llCreateLink(LSL_Key targetId, LSL_Integer parent);
84 LSL_List llCSV2List(string src); 84 LSL_List llCSV2List(string src);
85 LSL_List llDeleteSubList(LSL_List src, int start, int end); 85 LSL_List llDeleteSubList(LSL_List src, int start, int end);
86 LSL_String llDeleteSubString(string src, int start, int end); 86 LSL_String llDeleteSubString(string src, int start, int end);
@@ -116,16 +116,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
116 LSL_Float llFrand(double mag); 116 LSL_Float llFrand(double mag);
117 LSL_Key llGenerateKey(); 117 LSL_Key llGenerateKey();
118 LSL_Vector llGetAccel(); 118 LSL_Vector llGetAccel();
119 LSL_Integer llGetAgentInfo(string id); 119 LSL_Integer llGetAgentInfo(LSL_Key id);
120 LSL_String llGetAgentLanguage(string id); 120 LSL_String llGetAgentLanguage(LSL_Key id);
121 LSL_List llGetAgentList(LSL_Integer scope, LSL_List options); 121 LSL_List llGetAgentList(LSL_Integer scope, LSL_List options);
122 LSL_Vector llGetAgentSize(string id); 122 LSL_Vector llGetAgentSize(LSL_Key id);
123 LSL_Float llGetAlpha(int face); 123 LSL_Float llGetAlpha(int face);
124 LSL_Float llGetAndResetTime(); 124 LSL_Float llGetAndResetTime();
125 LSL_String llGetAnimation(string id); 125 LSL_String llGetAnimation(LSL_Key id);
126 LSL_List llGetAnimationList(string id); 126 LSL_List llGetAnimationList(LSL_Key id);
127 LSL_Integer llGetAttached(); 127 LSL_Integer llGetAttached();
128 LSL_List llGetAttachedList(string id); 128 LSL_List llGetAttachedList(LSL_Key id);
129 LSL_List llGetBoundingBox(string obj); 129 LSL_List llGetBoundingBox(string obj);
130 LSL_Vector llGetCameraPos(); 130 LSL_Vector llGetCameraPos();
131 LSL_Rotation llGetCameraRot(); 131 LSL_Rotation llGetCameraRot();
@@ -217,10 +217,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
217 LSL_Integer llGetUnixTime(); 217 LSL_Integer llGetUnixTime();
218 LSL_Vector llGetVel(); 218 LSL_Vector llGetVel();
219 LSL_Float llGetWallclock(); 219 LSL_Float llGetWallclock();
220 void llGiveInventory(string destination, string inventory); 220 void llGiveInventory(LSL_Key destination, LSL_String inventory);
221 void llGiveInventoryList(string destination, string category, LSL_List inventory); 221 void llGiveInventoryList(LSL_Key destination, LSL_String category, LSL_List inventory);
222 LSL_Integer llGiveMoney(string destination, int amount); 222 LSL_Integer llGiveMoney(LSL_Key destination, LSL_Integer amount);
223 LSL_Key llTransferLindenDollars(string destination, int amount); 223 LSL_Key llTransferLindenDollars(LSL_Key destination, LSL_Integer amount);
224 void llGodLikeRezObject(string inventory, LSL_Vector pos); 224 void llGodLikeRezObject(string inventory, LSL_Vector pos);
225 LSL_Float llGround(LSL_Vector offset); 225 LSL_Float llGround(LSL_Vector offset);
226 LSL_Vector llGroundContour(LSL_Vector offset); 226 LSL_Vector llGroundContour(LSL_Vector offset);
@@ -232,8 +232,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
232 LSL_String llInsertString(string dst, int position, string src); 232 LSL_String llInsertString(string dst, int position, string src);
233 void llInstantMessage(string user, string message); 233 void llInstantMessage(string user, string message);
234 LSL_String llIntegerToBase64(int number); 234 LSL_String llIntegerToBase64(int number);
235 LSL_String llKey2Name(string id); 235 LSL_String llKey2Name(LSL_Key id);
236 LSL_String llGetUsername(string id); 236 LSL_String llGetUsername(LSL_Key id);
237 LSL_Key llRequestUsername(string id); 237 LSL_Key llRequestUsername(string id);
238 LSL_String llGetDisplayName(string id); 238 LSL_String llGetDisplayName(string id);
239 LSL_Key llRequestDisplayName(string id); 239 LSL_Key llRequestDisplayName(string id);
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
index 194df36..7c5ced8 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
@@ -260,6 +260,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
260 LSL_Float osGetWindParam(string plugin, string param); 260 LSL_Float osGetWindParam(string plugin, string param);
261 261
262 // Parcel commands 262 // Parcel commands
263 LSL_Integer osGetParcelDwell(vector pos);
263 void osParcelJoin(vector pos1, vector pos2); 264 void osParcelJoin(vector pos1, vector pos2);
264 void osParcelSubdivide(vector pos1, vector pos2); 265 void osParcelSubdivide(vector pos1, vector pos2);
265 void osSetParcelDetails(vector pos, LSL_List rules); 266 void osSetParcelDetails(vector pos, LSL_List rules);
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs
index fa0e25c..f93cea8 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs
@@ -35,7 +35,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
35 public partial class ScriptBaseClass 35 public partial class ScriptBaseClass
36 { 36 {
37 // SCRIPTS CONSTANTS 37 // SCRIPTS CONSTANTS
38 public static readonly LSLInteger OS_APIVERSION = 4; 38 public static readonly LSLInteger OS_APIVERSION = 5;
39 39
40 public static readonly LSLInteger TRUE = 1; 40 public static readonly LSLInteger TRUE = 1;
41 public static readonly LSLInteger FALSE = 0; 41 public static readonly LSLInteger FALSE = 0;
@@ -728,6 +728,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
728 public const int PARCEL_DETAILS_SEE_AVATARS = 6; 728 public const int PARCEL_DETAILS_SEE_AVATARS = 6;
729 public const int PARCEL_DETAILS_ANY_AVATAR_SOUNDS = 7; 729 public const int PARCEL_DETAILS_ANY_AVATAR_SOUNDS = 7;
730 public const int PARCEL_DETAILS_GROUP_SOUNDS = 8; 730 public const int PARCEL_DETAILS_GROUP_SOUNDS = 8;
731 // constants for llGetParcelDetails os specific
732 public const int PARCEL_DETAILS_DWELL = 64;
731 733
732 //osSetParcelDetails 734 //osSetParcelDetails
733 public const int PARCEL_DETAILS_CLAIMDATE = 10; 735 public const int PARCEL_DETAILS_CLAIMDATE = 10;
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs
index 0f10d8d..ff5b4c3 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs
@@ -65,32 +65,32 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
65 // 65 //
66 // Script functions 66 // Script functions
67 // 67 //
68 public LSL_Integer llAbs(int i) 68 public LSL_Integer llAbs(LSL_Integer i)
69 { 69 {
70 return m_LSL_Functions.llAbs(i); 70 return m_LSL_Functions.llAbs(i);
71 } 71 }
72 72
73 public LSL_Float llAcos(double val) 73 public LSL_Float llAcos(LSL_Float val)
74 { 74 {
75 return m_LSL_Functions.llAcos(val); 75 return m_LSL_Functions.llAcos(val);
76 } 76 }
77 77
78 public void llAddToLandBanList(string avatar, double hours) 78 public void llAddToLandBanList(LSL_Key avatar, LSL_Float hours)
79 { 79 {
80 m_LSL_Functions.llAddToLandBanList(avatar, hours); 80 m_LSL_Functions.llAddToLandBanList(avatar, hours);
81 } 81 }
82 82
83 public void llAddToLandPassList(string avatar, double hours) 83 public void llAddToLandPassList(LSL_Key avatar, LSL_Float hours)
84 { 84 {
85 m_LSL_Functions.llAddToLandPassList(avatar, hours); 85 m_LSL_Functions.llAddToLandPassList(avatar, hours);
86 } 86 }
87 87
88 public void llAdjustSoundVolume(double volume) 88 public void llAdjustSoundVolume(LSL_Float volume)
89 { 89 {
90 m_LSL_Functions.llAdjustSoundVolume(volume); 90 m_LSL_Functions.llAdjustSoundVolume(volume);
91 } 91 }
92 92
93 public void llAllowInventoryDrop(int add) 93 public void llAllowInventoryDrop(LSL_Integer add)
94 { 94 {
95 m_LSL_Functions.llAllowInventoryDrop(add); 95 m_LSL_Functions.llAllowInventoryDrop(add);
96 } 96 }
@@ -100,7 +100,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
100 return m_LSL_Functions.llAngleBetween(a, b); 100 return m_LSL_Functions.llAngleBetween(a, b);
101 } 101 }
102 102
103 public void llApplyImpulse(LSL_Vector force, int local) 103 public void llApplyImpulse(LSL_Vector force, LSL_Integer local)
104 { 104 {
105 m_LSL_Functions.llApplyImpulse(force, local); 105 m_LSL_Functions.llApplyImpulse(force, local);
106 } 106 }
@@ -110,12 +110,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
110 m_LSL_Functions.llApplyRotationalImpulse(force, local); 110 m_LSL_Functions.llApplyRotationalImpulse(force, local);
111 } 111 }
112 112
113 public LSL_Float llAsin(double val) 113 public LSL_Float llAsin(LSL_Float val)
114 { 114 {
115 return m_LSL_Functions.llAsin(val); 115 return m_LSL_Functions.llAsin(val);
116 } 116 }
117 117
118 public LSL_Float llAtan2(double x, double y) 118 public LSL_Float llAtan2(LSL_Float x, LSL_Float y)
119 { 119 {
120 return m_LSL_Functions.llAtan2(x, y); 120 return m_LSL_Functions.llAtan2(x, y);
121 } 121 }
@@ -190,17 +190,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
190 return m_LSL_Functions.llCloud(offset); 190 return m_LSL_Functions.llCloud(offset);
191 } 191 }
192 192
193 public void llCollisionFilter(string name, string id, int accept) 193 public void llCollisionFilter(LSL_String name, LSL_Key id, LSL_Integer accept)
194 { 194 {
195 m_LSL_Functions.llCollisionFilter(name, id, accept); 195 m_LSL_Functions.llCollisionFilter(name, id, accept);
196 } 196 }
197 197
198 public void llCollisionSound(string impact_sound, double impact_volume) 198 public void llCollisionSound(LSL_String impact_sound, LSL_Float impact_volume)
199 { 199 {
200 m_LSL_Functions.llCollisionSound(impact_sound, impact_volume); 200 m_LSL_Functions.llCollisionSound(impact_sound, impact_volume);
201 } 201 }
202 202
203 public void llCollisionSprite(string impact_sprite) 203 public void llCollisionSprite(LSL_String impact_sprite)
204 { 204 {
205 m_LSL_Functions.llCollisionSprite(impact_sprite); 205 m_LSL_Functions.llCollisionSprite(impact_sprite);
206 } 206 }
@@ -210,7 +210,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
210 return m_LSL_Functions.llCos(f); 210 return m_LSL_Functions.llCos(f);
211 } 211 }
212 212
213 public void llCreateLink(LSL_String target, LSL_Integer parent) 213 public void llCreateLink(LSL_Key target, LSL_Integer parent)
214 { 214 {
215 m_LSL_Functions.llCreateLink(target, parent); 215 m_LSL_Functions.llCreateLink(target, parent);
216 } 216 }
@@ -386,12 +386,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
386 return m_LSL_Functions.llGetAccel(); 386 return m_LSL_Functions.llGetAccel();
387 } 387 }
388 388
389 public LSL_Integer llGetAgentInfo(string id) 389 public LSL_Integer llGetAgentInfo(LSL_Key id)
390 { 390 {
391 return m_LSL_Functions.llGetAgentInfo(id); 391 return m_LSL_Functions.llGetAgentInfo(id);
392 } 392 }
393 393
394 public LSL_String llGetAgentLanguage(string id) 394 public LSL_String llGetAgentLanguage(LSL_Key id)
395 { 395 {
396 return m_LSL_Functions.llGetAgentLanguage(id); 396 return m_LSL_Functions.llGetAgentLanguage(id);
397 } 397 }
@@ -401,7 +401,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
401 return m_LSL_Functions.llGetAgentList(scope, options); 401 return m_LSL_Functions.llGetAgentList(scope, options);
402 } 402 }
403 403
404 public LSL_Vector llGetAgentSize(string id) 404 public LSL_Vector llGetAgentSize(LSL_Key id)
405 { 405 {
406 return m_LSL_Functions.llGetAgentSize(id); 406 return m_LSL_Functions.llGetAgentSize(id);
407 } 407 }
@@ -416,12 +416,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
416 return m_LSL_Functions.llGetAndResetTime(); 416 return m_LSL_Functions.llGetAndResetTime();
417 } 417 }
418 418
419 public LSL_String llGetAnimation(string id) 419 public LSL_String llGetAnimation(LSL_Key id)
420 { 420 {
421 return m_LSL_Functions.llGetAnimation(id); 421 return m_LSL_Functions.llGetAnimation(id);
422 } 422 }
423 423
424 public LSL_List llGetAnimationList(string id) 424 public LSL_List llGetAnimationList(LSL_Key id)
425 { 425 {
426 return m_LSL_Functions.llGetAnimationList(id); 426 return m_LSL_Functions.llGetAnimationList(id);
427 } 427 }
@@ -431,7 +431,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
431 return m_LSL_Functions.llGetAttached(); 431 return m_LSL_Functions.llGetAttached();
432 } 432 }
433 433
434 public LSL_List llGetAttachedList(string id) 434 public LSL_List llGetAttachedList(LSL_Key id)
435 { 435 {
436 return m_LSL_Functions.llGetAttachedList(id); 436 return m_LSL_Functions.llGetAttachedList(id);
437 } 437 }
@@ -881,27 +881,27 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
881 return m_LSL_Functions.llGetWallclock(); 881 return m_LSL_Functions.llGetWallclock();
882 } 882 }
883 883
884 public void llGiveInventory(string destination, string inventory) 884 public void llGiveInventory(LSL_Key destination, LSL_String inventory)
885 { 885 {
886 m_LSL_Functions.llGiveInventory(destination, inventory); 886 m_LSL_Functions.llGiveInventory(destination, inventory);
887 } 887 }
888 888
889 public void llGiveInventoryList(string destination, string category, LSL_List inventory) 889 public void llGiveInventoryList(LSL_Key destination, LSL_String category, LSL_List inventory)
890 { 890 {
891 m_LSL_Functions.llGiveInventoryList(destination, category, inventory); 891 m_LSL_Functions.llGiveInventoryList(destination, category, inventory);
892 } 892 }
893 893
894 public LSL_Integer llGiveMoney(string destination, int amount) 894 public LSL_Integer llGiveMoney(LSL_Key destination, LSL_Integer amount)
895 { 895 {
896 return m_LSL_Functions.llGiveMoney(destination, amount); 896 return m_LSL_Functions.llGiveMoney(destination, amount);
897 } 897 }
898 898
899 public LSL_Key llTransferLindenDollars(string destination, int amount) 899 public LSL_Key llTransferLindenDollars(LSL_Key destination, LSL_Integer amount)
900 { 900 {
901 return m_LSL_Functions.llTransferLindenDollars(destination, amount); 901 return m_LSL_Functions.llTransferLindenDollars(destination, amount);
902 } 902 }
903 903
904 public void llGodLikeRezObject(string inventory, LSL_Vector pos) 904 public void llGodLikeRezObject(LSL_String inventory, LSL_Vector pos)
905 { 905 {
906 m_LSL_Functions.llGodLikeRezObject(inventory, pos); 906 m_LSL_Functions.llGodLikeRezObject(inventory, pos);
907 } 907 }
@@ -931,22 +931,22 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
931 return m_LSL_Functions.llGroundSlope(offset); 931 return m_LSL_Functions.llGroundSlope(offset);
932 } 932 }
933 933
934 public LSL_Key llHTTPRequest(string url, LSL_List parameters, string body) 934 public LSL_Key llHTTPRequest(LSL_String url, LSL_List parameters, LSL_String body)
935 { 935 {
936 return m_LSL_Functions.llHTTPRequest(url, parameters, body); 936 return m_LSL_Functions.llHTTPRequest(url, parameters, body);
937 } 937 }
938 938
939 public void llHTTPResponse(LSL_Key id, int status, string body) 939 public void llHTTPResponse(LSL_Key id, int status, LSL_String body)
940 { 940 {
941 m_LSL_Functions.llHTTPResponse(id, status, body); 941 m_LSL_Functions.llHTTPResponse(id, status, body);
942 } 942 }
943 943
944 public LSL_String llInsertString(string dst, int position, string src) 944 public LSL_String llInsertString(LSL_String dst, int position, LSL_String src)
945 { 945 {
946 return m_LSL_Functions.llInsertString(dst, position, src); 946 return m_LSL_Functions.llInsertString(dst, position, src);
947 } 947 }
948 948
949 public void llInstantMessage(string user, string message) 949 public void llInstantMessage(LSL_String user, LSL_String message)
950 { 950 {
951 m_LSL_Functions.llInstantMessage(user, message); 951 m_LSL_Functions.llInstantMessage(user, message);
952 } 952 }
@@ -956,12 +956,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
956 return m_LSL_Functions.llIntegerToBase64(number); 956 return m_LSL_Functions.llIntegerToBase64(number);
957 } 957 }
958 958
959 public LSL_String llKey2Name(string id) 959 public LSL_String llKey2Name(LSL_Key id)
960 { 960 {
961 return m_LSL_Functions.llKey2Name(id); 961 return m_LSL_Functions.llKey2Name(id);
962 } 962 }
963 963
964 public LSL_String llGetUsername(string id) 964 public LSL_String llGetUsername(LSL_Key id)
965 { 965 {
966 return m_LSL_Functions.llGetUsername(id); 966 return m_LSL_Functions.llGetUsername(id);
967 } 967 }
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
index 88ea9d5..6a70305 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
@@ -116,6 +116,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
116 return m_OSSL_Functions.osGetWindParam(plugin, param); 116 return m_OSSL_Functions.osGetWindParam(plugin, param);
117 } 117 }
118 118
119 public LSL_Integer osGetParcelDwell(vector pos)
120 {
121 return m_OSSL_Functions.osGetParcelDwell(pos);
122 }
123
119 public void osParcelJoin(vector pos1, vector pos2) 124 public void osParcelJoin(vector pos1, vector pos2)
120 { 125 {
121 m_OSSL_Functions.osParcelJoin(pos1,pos2); 126 m_OSSL_Functions.osParcelJoin(pos1,pos2);
diff --git a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
index 351fca9..ec2a24e 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
@@ -490,6 +490,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
490 { 490 {
491 ReleaseControls(); 491 ReleaseControls();
492 AsyncCommandManager.RemoveScript(Engine, LocalID, ItemID); 492 AsyncCommandManager.RemoveScript(Engine, LocalID, ItemID);
493 SceneObjectPart part = Engine.World.GetSceneObjectPart(LocalID);
494 if (part != null)
495 part.RemoveScriptEvents(ItemID);
493 } 496 }
494 497
495 public void RemoveState() 498 public void RemoveState()
diff --git a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs
index 5a38501..b52f767 100644
--- a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs
@@ -533,8 +533,12 @@ namespace OpenSim.Region.ScriptEngine.Shared
533 533
534 public static Quaternion operator /(Quaternion a, Quaternion b) 534 public static Quaternion operator /(Quaternion a, Quaternion b)
535 { 535 {
536 // assuming normalized 536 // assume normalized
537 b.s = -b.s; 537 // if not, sl seems to not normalize either
538 b.x = -b.x;
539 b.y = -b.y;
540 b.z = -b.z;
541
538 return a * b; 542 return a * b;
539 } 543 }
540 544
diff --git a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs
index 1c1930a..788bd3d 100644
--- a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs
+++ b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs
@@ -115,15 +115,10 @@ namespace OpenSim.Server.Handlers.Simulation
115 115
116 return responsedata; 116 return responsedata;
117 } 117 }
118
119 } 118 }
120 119
121 protected virtual void DoQueryAccess(Hashtable request, Hashtable responsedata, UUID agentID, UUID regionID) 120 protected virtual void DoQueryAccess(Hashtable request, Hashtable responsedata, UUID agentID, UUID regionID)
122 { 121 {
123 Culture.SetCurrentCulture();
124
125 EntityTransferContext ctx = new EntityTransferContext();
126
127 if (m_SimulationService == null) 122 if (m_SimulationService == null)
128 { 123 {
129 m_log.Debug("[AGENT HANDLER]: Agent QUERY called. Harmless but useless."); 124 m_log.Debug("[AGENT HANDLER]: Agent QUERY called. Harmless but useless.");
@@ -134,33 +129,37 @@ namespace OpenSim.Server.Handlers.Simulation
134 return; 129 return;
135 } 130 }
136 131
132 Culture.SetCurrentCulture();
133
137 // m_log.DebugFormat("[AGENT HANDLER]: Received QUERYACCESS with {0}", (string)request["body"]); 134 // m_log.DebugFormat("[AGENT HANDLER]: Received QUERYACCESS with {0}", (string)request["body"]);
138 OSDMap args = Utils.GetOSDMap((string)request["body"]); 135 OSDMap args = Utils.GetOSDMap((string)request["body"]);
139 136
140 bool viaTeleport = true; 137 bool viaTeleport = true;
141 if (args.ContainsKey("viaTeleport")) 138 OSD tmpOSD;
142 viaTeleport = args["viaTeleport"].AsBoolean(); 139 if (args.TryGetValue("viaTeleport",out tmpOSD))
140 viaTeleport = tmpOSD.AsBoolean();
143 141
144 Vector3 position = Vector3.Zero; 142 Vector3 position = Vector3.Zero;
145 if (args.ContainsKey("position")) 143 if (args.TryGetValue("position", out tmpOSD))
146 position = Vector3.Parse(args["position"].AsString()); 144 position = Vector3.Parse(tmpOSD.AsString());
147 145
148 string agentHomeURI = null; 146 string agentHomeURI = null;
149 if (args.ContainsKey("agent_home_uri")) 147 if (args.TryGetValue("agent_home_uri", out tmpOSD))
150 agentHomeURI = args["agent_home_uri"].AsString(); 148 agentHomeURI = tmpOSD.AsString();
151 149
152 // Decode the legacy (string) version and extract the number 150 // Decode the legacy (string) version and extract the number
153 float theirVersion = 0f; 151 float theirVersion = 0f;
154 if (args.ContainsKey("my_version")) 152 if (args.TryGetValue("my_version", out tmpOSD))
155 { 153 {
156 string theirVersionStr = args["my_version"].AsString(); 154 string theirVersionStr = tmpOSD.AsString();
157 string[] parts = theirVersionStr.Split(new char[] {'/'}); 155 string[] parts = theirVersionStr.Split(new char[] {'/'});
158 if (parts.Length > 1) 156 if (parts.Length > 1)
159 theirVersion = float.Parse(parts[1], Culture.FormatProvider); 157 theirVersion = float.Parse(parts[1], Culture.FormatProvider);
160 } 158 }
161 159
162 if (args.ContainsKey("context")) 160 EntityTransferContext ctx = new EntityTransferContext();
163 ctx.Unpack((OSDMap)args["context"]); 161 if (args.TryGetValue("context", out tmpOSD) && tmpOSD is OSDMap)
162 ctx.Unpack((OSDMap)tmpOSD);
164 163
165 // Decode the new versioning data 164 // Decode the new versioning data
166 float minVersionRequired = 0f; 165 float minVersionRequired = 0f;
@@ -168,15 +167,15 @@ namespace OpenSim.Server.Handlers.Simulation
168 float minVersionProvided = 0f; 167 float minVersionProvided = 0f;
169 float maxVersionProvided = 0f; 168 float maxVersionProvided = 0f;
170 169
171 if (args.ContainsKey("simulation_service_supported_min")) 170 if (args.TryGetValue("simulation_service_supported_min", out tmpOSD))
172 minVersionProvided = (float)args["simulation_service_supported_min"].AsReal(); 171 minVersionProvided = (float)tmpOSD.AsReal();
173 if (args.ContainsKey("simulation_service_supported_max")) 172 if (args.TryGetValue("simulation_service_supported_max", out tmpOSD))
174 maxVersionProvided = (float)args["simulation_service_supported_max"].AsReal(); 173 maxVersionProvided = (float)tmpOSD.AsReal();
175 174
176 if (args.ContainsKey("simulation_service_accepted_min")) 175 if (args.TryGetValue("simulation_service_accepted_min", out tmpOSD))
177 minVersionRequired = (float)args["simulation_service_accepted_min"].AsReal(); 176 minVersionRequired = (float)tmpOSD.AsReal();
178 if (args.ContainsKey("simulation_service_accepted_max")) 177 if (args.TryGetValue("simulation_service_accepted_max", out tmpOSD))
179 maxVersionRequired = (float)args["simulation_service_accepted_max"].AsReal(); 178 maxVersionRequired = (float)tmpOSD.AsReal();
180 179
181 responsedata["int_response_code"] = HttpStatusCode.OK; 180 responsedata["int_response_code"] = HttpStatusCode.OK;
182 OSDMap resp = new OSDMap(3); 181 OSDMap resp = new OSDMap(3);
@@ -239,9 +238,9 @@ namespace OpenSim.Server.Handlers.Simulation
239 238
240 List<UUID> features = new List<UUID>(); 239 List<UUID> features = new List<UUID>();
241 240
242 if (args.ContainsKey("features")) 241 if (args.TryGetValue("features", out tmpOSD) && tmpOSD is OSDArray)
243 { 242 {
244 OSDArray array = (OSDArray)args["features"]; 243 OSDArray array = (OSDArray)tmpOSD;
245 244
246 foreach (OSD o in array) 245 foreach (OSD o in array)
247 features.Add(new UUID(o.AsString())); 246 features.Add(new UUID(o.AsString()));
@@ -414,8 +413,6 @@ namespace OpenSim.Server.Handlers.Simulation
414 413
415 protected void DoAgentPost(Hashtable request, Hashtable responsedata, UUID id) 414 protected void DoAgentPost(Hashtable request, Hashtable responsedata, UUID id)
416 { 415 {
417 EntityTransferContext ctx = new EntityTransferContext();
418
419 OSDMap args = Utils.GetOSDMap((string)request["body"]); 416 OSDMap args = Utils.GetOSDMap((string)request["body"]);
420 if (args == null) 417 if (args == null)
421 { 418 {
@@ -424,8 +421,10 @@ namespace OpenSim.Server.Handlers.Simulation
424 return; 421 return;
425 } 422 }
426 423
427 if (args.ContainsKey("context")) 424 OSD tmpOSD;
428 ctx.Unpack((OSDMap)args["context"]); 425 EntityTransferContext ctx = new EntityTransferContext();
426 if (args.TryGetValue("context", out tmpOSD) && tmpOSD is OSDMap)
427 ctx.Unpack((OSDMap)tmpOSD);
429 428
430 AgentDestinationData data = CreateAgentDestinationData(); 429 AgentDestinationData data = CreateAgentDestinationData();
431 UnpackData(args, data, request); 430 UnpackData(args, data, request);
@@ -453,16 +452,19 @@ namespace OpenSim.Server.Handlers.Simulation
453 452
454 GridRegion source = null; 453 GridRegion source = null;
455 454
456 if (args.ContainsKey("source_uuid")) 455 if (args.TryGetValue("source_uuid", out tmpOSD))
457 { 456 {
458 source = new GridRegion(); 457 source = new GridRegion();
459 source.RegionLocX = Int32.Parse(args["source_x"].AsString()); 458 source.RegionID = UUID.Parse(tmpOSD.AsString());
460 source.RegionLocY = Int32.Parse(args["source_y"].AsString()); 459 tmpOSD = args["source_x"];
461 source.RegionName = args["source_name"].AsString(); 460 source.RegionLocX = Int32.Parse(tmpOSD.AsString());
462 source.RegionID = UUID.Parse(args["source_uuid"].AsString()); 461 tmpOSD = args["source_y"];
463 462 source.RegionLocY = Int32.Parse(tmpOSD.AsString());
464 if (args.ContainsKey("source_server_uri")) 463 tmpOSD = args["source_name"];
465 source.RawServerURI = args["source_server_uri"].AsString(); 464 source.RegionName = tmpOSD.AsString();
465
466 if (args.TryGetValue("source_server_uri", out tmpOSD))
467 source.RawServerURI = tmpOSD.AsString();
466 else 468 else
467 source.RawServerURI = null; 469 source.RawServerURI = null;
468 } 470 }
@@ -493,21 +495,26 @@ namespace OpenSim.Server.Handlers.Simulation
493 495
494 protected virtual void UnpackData(OSDMap args, AgentDestinationData data, Hashtable request) 496 protected virtual void UnpackData(OSDMap args, AgentDestinationData data, Hashtable request)
495 { 497 {
498 OSD tmpOSD;
496 // retrieve the input arguments 499 // retrieve the input arguments
497 if (args.ContainsKey("destination_x") && args["destination_x"] != null) 500 if (args.TryGetValue("destination_x", out tmpOSD) && tmpOSD != null)
498 Int32.TryParse(args["destination_x"].AsString(), out data.x); 501 Int32.TryParse(tmpOSD.AsString(), out data.x);
499 else 502 else
500 m_log.WarnFormat(" -- request didn't have destination_x"); 503 m_log.WarnFormat(" -- request didn't have destination_x");
501 if (args.ContainsKey("destination_y") && args["destination_y"] != null) 504
502 Int32.TryParse(args["destination_y"].AsString(), out data.y); 505 if (args.TryGetValue("destination_y", out tmpOSD) && tmpOSD != null)
506 Int32.TryParse(tmpOSD.AsString(), out data.y);
503 else 507 else
504 m_log.WarnFormat(" -- request didn't have destination_y"); 508 m_log.WarnFormat(" -- request didn't have destination_y");
505 if (args.ContainsKey("destination_uuid") && args["destination_uuid"] != null) 509
506 UUID.TryParse(args["destination_uuid"].AsString(), out data.uuid); 510 if (args.TryGetValue("destination_uuid", out tmpOSD) && tmpOSD != null)
507 if (args.ContainsKey("destination_name") && args["destination_name"] != null) 511 UUID.TryParse(tmpOSD.AsString(), out data.uuid);
508 data.name = args["destination_name"].ToString(); 512
509 if (args.ContainsKey("teleport_flags") && args["teleport_flags"] != null) 513 if (args.TryGetValue("destination_name", out tmpOSD) && tmpOSD != null)
510 data.flags = args["teleport_flags"].AsUInteger(); 514 data.name = tmpOSD.ToString();
515
516 if (args.TryGetValue("teleport_flags", out tmpOSD) && tmpOSD != null)
517 data.flags = tmpOSD.AsUInteger();
511 } 518 }
512 519
513 protected virtual GridRegion ExtractGatekeeper(AgentDestinationData data) 520 protected virtual GridRegion ExtractGatekeeper(AgentDestinationData data)
@@ -674,7 +681,6 @@ namespace OpenSim.Server.Handlers.Simulation
674 protected void DoAgentPut(Hashtable request, Hashtable responsedata) 681 protected void DoAgentPut(Hashtable request, Hashtable responsedata)
675 { 682 {
676 // TODO: Encode the ENtityTransferContext 683 // TODO: Encode the ENtityTransferContext
677 EntityTransferContext ctx = new EntityTransferContext();
678 684
679 OSDMap args = Utils.GetOSDMap((string)request["body"]); 685 OSDMap args = Utils.GetOSDMap((string)request["body"]);
680 if (args == null) 686 if (args == null)
@@ -685,19 +691,21 @@ namespace OpenSim.Server.Handlers.Simulation
685 } 691 }
686 692
687 // retrieve the input arguments 693 // retrieve the input arguments
694 OSD tmpOSD;
695 EntityTransferContext ctx = new EntityTransferContext();
688 int x = 0, y = 0; 696 int x = 0, y = 0;
689 UUID uuid = UUID.Zero; 697 UUID uuid = UUID.Zero;
690 string regionname = string.Empty; 698 string regionname = string.Empty;
691 if (args.ContainsKey("destination_x") && args["destination_x"] != null) 699 if (args.TryGetValue("destination_x", out tmpOSD) && tmpOSD != null)
692 Int32.TryParse(args["destination_x"].AsString(), out x); 700 Int32.TryParse(tmpOSD.AsString(), out x);
693 if (args.ContainsKey("destination_y") && args["destination_y"] != null) 701 if (args.TryGetValue("destination_y", out tmpOSD) && tmpOSD != null)
694 Int32.TryParse(args["destination_y"].AsString(), out y); 702 Int32.TryParse(tmpOSD.AsString(), out y);
695 if (args.ContainsKey("destination_uuid") && args["destination_uuid"] != null) 703 if (args.TryGetValue("destination_uuid", out tmpOSD) && tmpOSD != null)
696 UUID.TryParse(args["destination_uuid"].AsString(), out uuid); 704 UUID.TryParse(tmpOSD.AsString(), out uuid);
697 if (args.ContainsKey("destination_name") && args["destination_name"] != null) 705 if (args.TryGetValue("destination_name", out tmpOSD) && tmpOSD != null)
698 regionname = args["destination_name"].ToString(); 706 regionname = tmpOSD.ToString();
699 if (args.ContainsKey("context")) 707 if (args.TryGetValue("context", out tmpOSD) && tmpOSD is OSDMap)
700 ctx.Unpack((OSDMap)args["context"]); 708 ctx.Unpack((OSDMap)tmpOSD);
701 709
702 GridRegion destination = new GridRegion(); 710 GridRegion destination = new GridRegion();
703 destination.RegionID = uuid; 711 destination.RegionID = uuid;
diff --git a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs
index e15ac8c..f5e7771 100644
--- a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs
+++ b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs
@@ -112,7 +112,7 @@ namespace OpenSim.Services.Connectors.Simulation
112 m_log.DebugFormat("[REMOTE SIMULATION CONNECTOR]: Creating agent at {0}", destination.ServerURI); 112 m_log.DebugFormat("[REMOTE SIMULATION CONNECTOR]: Creating agent at {0}", destination.ServerURI);
113 113
114 string uri = destination.ServerURI + AgentPath() + aCircuit.AgentID + "/"; 114 string uri = destination.ServerURI + AgentPath() + aCircuit.AgentID + "/";
115 115 OSD tmpOSD;
116 try 116 try
117 { 117 {
118 OSDMap args = aCircuit.PackAgentCircuitData(ctx); 118 OSDMap args = aCircuit.PackAgentCircuitData(ctx);
@@ -121,10 +121,9 @@ namespace OpenSim.Services.Connectors.Simulation
121 121
122 OSDMap result = WebUtil.PostToServiceCompressed(uri, args, 30000); 122 OSDMap result = WebUtil.PostToServiceCompressed(uri, args, 30000);
123 bool success = result["success"].AsBoolean(); 123 bool success = result["success"].AsBoolean();
124 if (success && result.ContainsKey("_Result")) 124 if (success && result.TryGetValue("_Result", out tmpOSD) && tmpOSD is OSDMap)
125 { 125 {
126 OSDMap data = (OSDMap)result["_Result"]; 126 OSDMap data = (OSDMap)tmpOSD;
127
128 reason = data["reason"].AsString(); 127 reason = data["reason"].AsString();
129 success = data["success"].AsBoolean(); 128 success = data["success"].AsBoolean();
130 return success; 129 return success;
@@ -133,14 +132,15 @@ namespace OpenSim.Services.Connectors.Simulation
133 // Try the old version, uncompressed 132 // Try the old version, uncompressed
134 result = WebUtil.PostToService(uri, args, 30000, false); 133 result = WebUtil.PostToService(uri, args, 30000, false);
135 134
136 if (result["Success"].AsBoolean()) 135 success = result["success"].AsBoolean();
136 if (success)
137 { 137 {
138 if (result.ContainsKey("_Result")) 138 if (result.TryGetValue("_Result", out tmpOSD) && tmpOSD is OSDMap)
139 { 139 {
140 OSDMap data = (OSDMap)result["_Result"]; 140 OSDMap data = (OSDMap)tmpOSD;
141
142 reason = data["reason"].AsString(); 141 reason = data["reason"].AsString();
143 success = data["success"].AsBoolean(); 142 success = data["success"].AsBoolean();
143
144 m_log.WarnFormat( 144 m_log.WarnFormat(
145 "[REMOTE SIMULATION CONNECTOR]: Remote simulator {0} did not accept compressed transfer, suggest updating it.", destination.RegionName); 145 "[REMOTE SIMULATION CONNECTOR]: Remote simulator {0} did not accept compressed transfer, suggest updating it.", destination.RegionName);
146 return success; 146 return success;
@@ -312,34 +312,42 @@ namespace OpenSim.Services.Connectors.Simulation
312 if (agentHomeURI != null) 312 if (agentHomeURI != null)
313 request.Add("agent_home_uri", OSD.FromString(agentHomeURI)); 313 request.Add("agent_home_uri", OSD.FromString(agentHomeURI));
314 314
315 OSD tmpOSD;
315 try 316 try
316 { 317 {
317 OSDMap result = WebUtil.ServiceOSDRequest(uri, request, "QUERYACCESS", 30000, false, false, true); 318 OSDMap result = WebUtil.ServiceOSDRequest(uri, request, "QUERYACCESS", 30000, false, false, true);
319
318 bool success = result["success"].AsBoolean(); 320 bool success = result["success"].AsBoolean();
319 if (result.ContainsKey("_Result")) 321
322 bool has_Result = false;
323 if (result.TryGetValue("_Result", out tmpOSD))
320 { 324 {
321 OSDMap data = (OSDMap)result["_Result"]; 325 has_Result = true;
326 OSDMap data = (OSDMap)tmpOSD;
322 327
323 // FIXME: If there is a _Result map then it's the success key here that indicates the true success 328 // FIXME: If there is a _Result map then it's the success key here that indicates the true success
324 // or failure, not the sibling result node. 329 // or failure, not the sibling result node.
330 //nte4.8 crap
325 success = data["success"].AsBoolean(); 331 success = data["success"].AsBoolean();
326
327 reason = data["reason"].AsString(); 332 reason = data["reason"].AsString();
328 // We will need to plumb this and start sing the outbound version as well 333 // We will need to plumb this and start sing the outbound version as well
329 // TODO: lay the pipe for version plumbing 334 // TODO: lay the pipe for version plumbing
330 if (data.ContainsKey("negotiated_inbound_version") && data["negotiated_inbound_version"] != null) 335 if (data.TryGetValue("negotiated_inbound_version", out tmpOSD) && tmpOSD != null)
331 { 336 {
332 ctx.InboundVersion = (float)data["negotiated_inbound_version"].AsReal(); 337 ctx.InboundVersion = (float)tmpOSD.AsReal();
333 ctx.OutboundVersion = (float)data["negotiated_outbound_version"].AsReal(); 338 ctx.OutboundVersion = (float)data["negotiated_outbound_version"].AsReal();
334 } 339 }
335 else if (data["version"] != null && data["version"].AsString() != string.Empty) 340 else if (data.TryGetValue("version", out tmpOSD) && tmpOSD != null)
336 { 341 {
337 string versionString = data["version"].AsString(); 342 string versionString = tmpOSD.AsString();
338 String[] parts = versionString.Split(new char[] {'/'}); 343 if(versionString != string.Empty)
339 if (parts.Length > 1)
340 { 344 {
341 ctx.InboundVersion = float.Parse(parts[1], Culture.FormatProvider); 345 String[] parts = versionString.Split(new char[] {'/'});
342 ctx.OutboundVersion = float.Parse(parts[1], Culture.FormatProvider); 346 if (parts.Length > 1)
347 {
348 ctx.InboundVersion = float.Parse(parts[1], Culture.FormatProvider);
349 ctx.OutboundVersion = float.Parse(parts[1], Culture.FormatProvider);
350 }
343 } 351 }
344 } 352 }
345 353
@@ -352,11 +360,11 @@ namespace OpenSim.Services.Connectors.Simulation
352 { 360 {
353 // If we don't check this then OpenSimulator 0.7.3.1 and some period before will never see the 361 // If we don't check this then OpenSimulator 0.7.3.1 and some period before will never see the
354 // actual failure message 362 // actual failure message
355 if (!result.ContainsKey("_Result")) 363 if (!has_Result)
356 { 364 {
357 if (result.ContainsKey("Message")) 365 if (result.TryGetValue("Message", out tmpOSD))
358 { 366 {
359 string message = result["Message"].AsString(); 367 string message = tmpOSD.AsString();
360 if (message == "Service request failed: [MethodNotAllowed] MethodNotAllowed") // Old style region 368 if (message == "Service request failed: [MethodNotAllowed] MethodNotAllowed") // Old style region
361 { 369 {
362 m_log.Info("[REMOTE SIMULATION CONNECTOR]: The above web util error was caused by a TP to a sim that doesn't support QUERYACCESS and can be ignored"); 370 m_log.Info("[REMOTE SIMULATION CONNECTOR]: The above web util error was caused by a TP to a sim that doesn't support QUERYACCESS and can be ignored");
@@ -376,9 +384,9 @@ namespace OpenSim.Services.Connectors.Simulation
376 384
377 featuresAvailable.Clear(); 385 featuresAvailable.Clear();
378 386
379 if (result.ContainsKey("features")) 387 if (result.TryGetValue("features", out tmpOSD) && tmpOSD is OSDArray)
380 { 388 {
381 OSDArray array = (OSDArray)result["features"]; 389 OSDArray array = (OSDArray)tmpOSD;
382 390
383 foreach (OSD o in array) 391 foreach (OSD o in array)
384 featuresAvailable.Add(new UUID(o.AsString())); 392 featuresAvailable.Add(new UUID(o.AsString()));
diff --git a/OpenSim/Services/LLLoginService/LLLoginService.cs b/OpenSim/Services/LLLoginService/LLLoginService.cs
index 22748cc..b923761 100644
--- a/OpenSim/Services/LLLoginService/LLLoginService.cs
+++ b/OpenSim/Services/LLLoginService/LLLoginService.cs
@@ -1051,7 +1051,7 @@ namespace OpenSim.Services.LLLoginService
1051 } 1051 }
1052 aCircuit.ServiceURLs[keyName] = keyValue; 1052 aCircuit.ServiceURLs[keyName] = keyValue;
1053 1053
1054 m_log.DebugFormat("[LLLOGIN SERVICE]: found new key {0} {1}", keyName, aCircuit.ServiceURLs[keyName]); 1054// m_log.DebugFormat("[LLLOGIN SERVICE]: found new key {0} {1}", keyName, aCircuit.ServiceURLs[keyName]);
1055 } 1055 }
1056 1056
1057 if (!account.ServiceURLs.ContainsKey("GatekeeperURI") && !string.IsNullOrEmpty(m_GatekeeperURL)) 1057 if (!account.ServiceURLs.ContainsKey("GatekeeperURI") && !string.IsNullOrEmpty(m_GatekeeperURL))
diff --git a/OpenSim/Tests/ConfigurationLoaderTest.cs b/OpenSim/Tests/ConfigurationLoaderTest.cs
index a409a13..2a67b84 100644
--- a/OpenSim/Tests/ConfigurationLoaderTest.cs
+++ b/OpenSim/Tests/ConfigurationLoaderTest.cs
@@ -114,6 +114,7 @@ namespace OpenSim.Tests
114 IConfigSource argvSource = new IniConfigSource(); 114 IConfigSource argvSource = new IniConfigSource();
115 EnvConfigSource envConfigSource = new EnvConfigSource(); 115 EnvConfigSource envConfigSource = new EnvConfigSource();
116 argvSource.AddConfig("Startup").Set("inifile", mainIniFile); 116 argvSource.AddConfig("Startup").Set("inifile", mainIniFile);
117 argvSource.AddConfig("Network");
117 ConfigSettings configSettings; 118 ConfigSettings configSettings;
118 NetworkServersInfo networkInfo; 119 NetworkServersInfo networkInfo;
119 120