aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorUbitUmarov2016-12-18 05:03:27 +0000
committerUbitUmarov2016-12-18 05:03:27 +0000
commit82fc8e1a36778a59d4d9c329ea71a60c3f4e8729 (patch)
tree65b5fbfe80c9db6547b2693b04544de18647f7bd /OpenSim/Region
parentMerge branch 'master' into httptests (diff)
parentleave stupid broken permissions alone (diff)
downloadopensim-SC-82fc8e1a36778a59d4d9c329ea71a60c3f4e8729.zip
opensim-SC-82fc8e1a36778a59d4d9c329ea71a60c3f4e8729.tar.gz
opensim-SC-82fc8e1a36778a59d4d9c329ea71a60c3f4e8729.tar.bz2
opensim-SC-82fc8e1a36778a59d4d9c329ea71a60c3f4e8729.tar.xz
Merge branch 'master' into httptests
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs44
-rw-r--r--OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs201
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsIn/Land/LandServiceInConnectorModule.cs5
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RemoteGridServiceConnector.cs49
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs252
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs49
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs7
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs1
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs5
9 files changed, 389 insertions, 224 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs
index 6873325..14a4873 100644
--- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs
+++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs
@@ -994,7 +994,6 @@ namespace OpenSim.Region.ClientStack.Linden
994 994
995 pbs.TextureEntry = textureEntry.GetBytes(); 995 pbs.TextureEntry = textureEntry.GetBytes();
996 996
997 bool hasmesh = false;
998 if (inner_instance_list.ContainsKey("mesh")) // seems to happen always but ... 997 if (inner_instance_list.ContainsKey("mesh")) // seems to happen always but ...
999 { 998 {
1000 int meshindx = inner_instance_list["mesh"].AsInteger(); 999 int meshindx = inner_instance_list["mesh"].AsInteger();
@@ -1004,10 +1003,34 @@ namespace OpenSim.Region.ClientStack.Linden
1004 pbs.SculptType = (byte)SculptType.Mesh; 1003 pbs.SculptType = (byte)SculptType.Mesh;
1005 pbs.SculptTexture = meshAssets[meshindx]; // actual asset UUID after meshs suport introduction 1004 pbs.SculptTexture = meshAssets[meshindx]; // actual asset UUID after meshs suport introduction
1006 // data will be requested from asset on rez (i hope) 1005 // data will be requested from asset on rez (i hope)
1007 hasmesh = true;
1008 } 1006 }
1009 } 1007 }
1010 1008
1009 // faces number to pbs shape
1010 switch(face_list.Count)
1011 {
1012 case 1:
1013 case 2:
1014 pbs.ProfileCurve = (byte)ProfileCurve.Circle;
1015 pbs.PathCurve = (byte)PathCurve.Circle;
1016 break;
1017
1018 case 3:
1019 case 4:
1020 pbs.ProfileCurve = (byte)ProfileCurve.Circle;
1021 pbs.PathCurve = (byte)PathCurve.Line;
1022 break;
1023 case 5:
1024 pbs.ProfileCurve = (byte)ProfileCurve.EqualTriangle;
1025 pbs.PathCurve = (byte)PathCurve.Line;
1026 break;
1027
1028 default:
1029 pbs.ProfileCurve = (byte)ProfileCurve.Square;
1030 pbs.PathCurve = (byte)PathCurve.Line;
1031 break;
1032 }
1033
1011 Vector3 position = inner_instance_list["position"].AsVector3(); 1034 Vector3 position = inner_instance_list["position"].AsVector3();
1012 Quaternion rotation = inner_instance_list["rotation"].AsQuaternion(); 1035 Quaternion rotation = inner_instance_list["rotation"].AsQuaternion();
1013 1036
@@ -1018,23 +1041,6 @@ namespace OpenSim.Region.ClientStack.Linden
1018// int material = inner_instance_list["material"].AsInteger(); 1041// int material = inner_instance_list["material"].AsInteger();
1019 byte material = (byte)Material.Wood; 1042 byte material = (byte)Material.Wood;
1020 1043
1021// no longer used - begin ------------------------
1022// int mesh = inner_instance_list["mesh"].AsInteger();
1023
1024// OSDMap permissions = (OSDMap)inner_instance_list["permissions"];
1025// int base_mask = permissions["base_mask"].AsInteger();
1026// int everyone_mask = permissions["everyone_mask"].AsInteger();
1027// UUID creator_id = permissions["creator_id"].AsUUID();
1028// UUID group_id = permissions["group_id"].AsUUID();
1029// int group_mask = permissions["group_mask"].AsInteger();
1030// bool is_owner_group = permissions["is_owner_group"].AsBoolean();
1031// UUID last_owner_id = permissions["last_owner_id"].AsUUID();
1032// int next_owner_mask = permissions["next_owner_mask"].AsInteger();
1033// UUID owner_id = permissions["owner_id"].AsUUID();
1034// int owner_mask = permissions["owner_mask"].AsInteger();
1035// no longer used - end ------------------------
1036
1037
1038 SceneObjectPart prim 1044 SceneObjectPart prim
1039 = new SceneObjectPart(owner_id, pbs, position, Quaternion.Identity, Vector3.Zero); 1045 = new SceneObjectPart(owner_id, pbs, position, Quaternion.Identity, Vector3.Zero);
1040 1046
diff --git a/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs b/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs
index 5314927..57025bf 100644
--- a/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs
@@ -69,6 +69,7 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles
69 Dictionary<UUID, int> m_classifiedInterest = new Dictionary<UUID, int>(); 69 Dictionary<UUID, int> m_classifiedInterest = new Dictionary<UUID, int>();
70 70
71 private JsonRpcRequestManager rpc = new JsonRpcRequestManager(); 71 private JsonRpcRequestManager rpc = new JsonRpcRequestManager();
72 private bool m_allowUserProfileWebURLs = true;
72 73
73 public Scene Scene 74 public Scene Scene
74 { 75 {
@@ -159,7 +160,9 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles
159 Enabled = false; 160 Enabled = false;
160 return; 161 return;
161 } 162 }
162 163
164 m_allowUserProfileWebURLs = profileConfig.GetBoolean("AllowUserProfileWebURLs", m_allowUserProfileWebURLs);
165
163 m_log.Debug("[PROFILES]: Full Profiles Enabled"); 166 m_log.Debug("[PROFILES]: Full Profiles Enabled");
164 ReplaceableInterface = null; 167 ReplaceableInterface = null;
165 Enabled = true; 168 Enabled = true;
@@ -316,37 +319,46 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles
316 return; 319 return;
317 320
318 IClientAPI remoteClient = (IClientAPI)sender; 321 IClientAPI remoteClient = (IClientAPI)sender;
322 Dictionary<UUID, string> classifieds = new Dictionary<UUID, string>();
319 323
320 UUID targetID; 324 UUID targetID;
321 UUID.TryParse(args[0], out targetID); 325 if(!UUID.TryParse(args[0], out targetID) || targetID == UUID.Zero)
322 326 return;
323 327
324 ScenePresence p = FindPresence(targetID); 328 ScenePresence p = FindPresence(targetID);
325 if (p != null && p.isNPC) 329 if (p != null && p.isNPC)
326 { 330 {
327 remoteClient.SendAvatarClassifiedReply(new UUID(args[0]), new Dictionary<UUID, string>()); 331 remoteClient.SendAvatarClassifiedReply(targetID, classifieds);
328 return; 332 return;
329 } 333 }
330 334
331 string serverURI = string.Empty; 335 string serverURI = string.Empty;
332 GetUserProfileServerURI(targetID, out serverURI); 336 GetUserProfileServerURI(targetID, out serverURI);
333 UUID creatorId = UUID.Zero; 337 if(string.IsNullOrWhiteSpace(serverURI))
334 Dictionary<UUID, string> classifieds = new Dictionary<UUID, string>(); 338 {
339 remoteClient.SendAvatarClassifiedReply(targetID, classifieds);
340 return;
341 }
335 342
336 OSDMap parameters= new OSDMap(); 343 OSDMap parameters= new OSDMap();
337 UUID.TryParse(args[0], out creatorId); 344
338 parameters.Add("creatorId", OSD.FromUUID(creatorId)); 345 parameters.Add("creatorId", OSD.FromUUID(targetID));
339 OSD Params = (OSD)parameters; 346 OSD Params = (OSD)parameters;
340 if(!rpc.JsonRpcRequest(ref Params, "avatarclassifiedsrequest", serverURI, UUID.Random().ToString())) 347 if(!rpc.JsonRpcRequest(ref Params, "avatarclassifiedsrequest", serverURI, UUID.Random().ToString()))
341 { 348 {
342 remoteClient.SendAvatarClassifiedReply(new UUID(args[0]), classifieds); 349 remoteClient.SendAvatarClassifiedReply(targetID, classifieds);
343 return; 350 return;
344 } 351 }
345 352
346 parameters = (OSDMap)Params; 353 parameters = (OSDMap)Params;
347 354
348 OSDArray list = (OSDArray)parameters["result"]; 355 if(!parameters.ContainsKey("result") || parameters["result"] == null)
356 {
357 remoteClient.SendAvatarClassifiedReply(targetID, classifieds);
358 return;
359 }
349 360
361 OSDArray list = (OSDArray)parameters["result"];
350 362
351 foreach(OSD map in list) 363 foreach(OSD map in list)
352 { 364 {
@@ -360,7 +372,7 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles
360 { 372 {
361 if (!m_classifiedCache.ContainsKey(cid)) 373 if (!m_classifiedCache.ContainsKey(cid))
362 { 374 {
363 m_classifiedCache.Add(cid,creatorId); 375 m_classifiedCache.Add(cid,targetID);
364 m_classifiedInterest.Add(cid, 0); 376 m_classifiedInterest.Add(cid, 0);
365 } 377 }
366 378
@@ -368,7 +380,7 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles
368 } 380 }
369 } 381 }
370 382
371 remoteClient.SendAvatarClassifiedReply(new UUID(args[0]), classifieds); 383 remoteClient.SendAvatarClassifiedReply(targetID, classifieds);
372 } 384 }
373 385
374 public void ClassifiedInfoRequest(UUID queryClassifiedID, IClientAPI remoteClient) 386 public void ClassifiedInfoRequest(UUID queryClassifiedID, IClientAPI remoteClient)
@@ -395,6 +407,10 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles
395 407
396 string serverURI = string.Empty; 408 string serverURI = string.Empty;
397 GetUserProfileServerURI(target, out serverURI); 409 GetUserProfileServerURI(target, out serverURI);
410 if(string.IsNullOrWhiteSpace(serverURI))
411 {
412 return;
413 }
398 414
399 object Ad = (object)ad; 415 object Ad = (object)ad;
400 if(!rpc.JsonRpcRequest(ref Ad, "classifieds_info_query", serverURI, UUID.Random().ToString())) 416 if(!rpc.JsonRpcRequest(ref Ad, "classifieds_info_query", serverURI, UUID.Random().ToString()))
@@ -465,6 +481,10 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles
465 481
466 string serverURI = string.Empty; 482 string serverURI = string.Empty;
467 GetUserProfileServerURI(remoteClient.AgentId, out serverURI); 483 GetUserProfileServerURI(remoteClient.AgentId, out serverURI);
484 if(string.IsNullOrWhiteSpace(serverURI))
485 {
486 return;
487 }
468 488
469 OSDMap parameters = new OSDMap {{"creatorId", OSD.FromUUID(creatorId)}}; 489 OSDMap parameters = new OSDMap {{"creatorId", OSD.FromUUID(creatorId)}};
470 OSD Params = (OSD)parameters; 490 OSD Params = (OSD)parameters;
@@ -531,10 +551,14 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles
531 { 551 {
532 string serverURI = string.Empty; 552 string serverURI = string.Empty;
533 GetUserProfileServerURI(remoteClient.AgentId, out serverURI); 553 GetUserProfileServerURI(remoteClient.AgentId, out serverURI);
554 if(string.IsNullOrWhiteSpace(serverURI))
555 return;
534 556
535 UUID classifiedId; 557 UUID classifiedId;
558 if(!UUID.TryParse(queryClassifiedID.ToString(), out classifiedId))
559 return;
560
536 OSDMap parameters= new OSDMap(); 561 OSDMap parameters= new OSDMap();
537 UUID.TryParse(queryClassifiedID.ToString(), out classifiedId);
538 parameters.Add("classifiedId", OSD.FromUUID(classifiedId)); 562 parameters.Add("classifiedId", OSD.FromUUID(classifiedId));
539 OSD Params = (OSD)parameters; 563 OSD Params = (OSD)parameters;
540 if(!rpc.JsonRpcRequest(ref Params, "classified_delete", serverURI, UUID.Random().ToString())) 564 if(!rpc.JsonRpcRequest(ref Params, "classified_delete", serverURI, UUID.Random().ToString()))
@@ -569,33 +593,41 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles
569 IClientAPI remoteClient = (IClientAPI)sender; 593 IClientAPI remoteClient = (IClientAPI)sender;
570 594
571 UUID targetId; 595 UUID targetId;
572 UUID.TryParse(args[0], out targetId); 596 if(!UUID.TryParse(args[0], out targetId))
597 return;
573 598
574 // Can't handle NPC yet... 599 Dictionary<UUID, string> picks = new Dictionary<UUID, string>();
575 ScenePresence p = FindPresence(targetId);
576 600
601 ScenePresence p = FindPresence(targetId);
577 if (p != null && p.isNPC) 602 if (p != null && p.isNPC)
578 { 603 {
579 remoteClient.SendAvatarPicksReply(new UUID(args[0]), new Dictionary<UUID, string>()); 604 remoteClient.SendAvatarPicksReply(targetId, picks);
580 return; 605 return;
581 } 606 }
582 607
583 string serverURI = string.Empty; 608 string serverURI = string.Empty;
584 GetUserProfileServerURI(targetId, out serverURI); 609 GetUserProfileServerURI(targetId, out serverURI);
585 610 if(string.IsNullOrWhiteSpace(serverURI))
586 Dictionary<UUID, string> picks = new Dictionary<UUID, string>(); 611 {
612 remoteClient.SendAvatarPicksReply(targetId, picks);
613 return;
614 }
587 615
588 OSDMap parameters= new OSDMap(); 616 OSDMap parameters= new OSDMap();
589 parameters.Add("creatorId", OSD.FromUUID(targetId)); 617 parameters.Add("creatorId", OSD.FromUUID(targetId));
590 OSD Params = (OSD)parameters; 618 OSD Params = (OSD)parameters;
591 if(!rpc.JsonRpcRequest(ref Params, "avatarpicksrequest", serverURI, UUID.Random().ToString())) 619 if(!rpc.JsonRpcRequest(ref Params, "avatarpicksrequest", serverURI, UUID.Random().ToString()))
592 { 620 {
593 remoteClient.SendAvatarPicksReply(new UUID(args[0]), picks); 621 remoteClient.SendAvatarPicksReply(targetId, picks);
594 return; 622 return;
595 } 623 }
596 624
597 parameters = (OSDMap)Params; 625 parameters = (OSDMap)Params;
598 626 if(!parameters.ContainsKey("result") || parameters["result"] == null)
627 {
628 remoteClient.SendAvatarPicksReply(targetId, picks);
629 return;
630 }
599 OSDArray list = (OSDArray)parameters["result"]; 631 OSDArray list = (OSDArray)parameters["result"];
600 632
601 foreach(OSD map in list) 633 foreach(OSD map in list)
@@ -603,12 +635,9 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles
603 OSDMap m = (OSDMap)map; 635 OSDMap m = (OSDMap)map;
604 UUID cid = m["pickuuid"].AsUUID(); 636 UUID cid = m["pickuuid"].AsUUID();
605 string name = m["name"].AsString(); 637 string name = m["name"].AsString();
606
607 m_log.DebugFormat("[PROFILES]: PicksRequest {0}", name);
608
609 picks[cid] = name; 638 picks[cid] = name;
610 } 639 }
611 remoteClient.SendAvatarPicksReply(new UUID(args[0]), picks); 640 remoteClient.SendAvatarPicksReply(targetId, picks);
612 } 641 }
613 642
614 /// <summary> 643 /// <summary>
@@ -628,20 +657,27 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles
628 if (!(sender is IClientAPI)) 657 if (!(sender is IClientAPI))
629 return; 658 return;
630 659
660 UserProfilePick pick = new UserProfilePick ();
631 UUID targetID; 661 UUID targetID;
632 UUID.TryParse (args [0], out targetID); 662 if(!UUID.TryParse(args [0], out targetID))
663 return;
664
665 pick.CreatorId = targetID;
666
667 if(!UUID.TryParse (args [1], out pick.PickId))
668 return;
669
633 string serverURI = string.Empty; 670 string serverURI = string.Empty;
634 GetUserProfileServerURI (targetID, out serverURI); 671 GetUserProfileServerURI (targetID, out serverURI);
672 if(string.IsNullOrWhiteSpace(serverURI))
673 {
674 return;
675 }
635 676
636 string theirGatekeeperURI; 677 string theirGatekeeperURI;
637 GetUserGatekeeperURI (targetID, out theirGatekeeperURI); 678 GetUserGatekeeperURI(targetID, out theirGatekeeperURI);
638 679
639 IClientAPI remoteClient = (IClientAPI)sender; 680 IClientAPI remoteClient = (IClientAPI)sender;
640
641 UserProfilePick pick = new UserProfilePick ();
642 UUID.TryParse (args [0], out pick.CreatorId);
643 UUID.TryParse (args [1], out pick.PickId);
644
645 681
646 object Pick = (object)pick; 682 object Pick = (object)pick;
647 if (!rpc.JsonRpcRequest (ref Pick, "pickinforequest", serverURI, UUID.Random ().ToString ())) { 683 if (!rpc.JsonRpcRequest (ref Pick, "pickinforequest", serverURI, UUID.Random ().ToString ())) {
@@ -652,13 +688,9 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles
652 pick = (UserProfilePick)Pick; 688 pick = (UserProfilePick)Pick;
653 689
654 Vector3 globalPos = new Vector3(Vector3.Zero); 690 Vector3 globalPos = new Vector3(Vector3.Zero);
691 Vector3.TryParse(pick.GlobalPos, out globalPos);
655 692
656 // Smoke and mirrors 693 if (!string.IsNullOrWhiteSpace(MyGatekeeper) && pick.Gatekeeper != MyGatekeeper)
657 if (pick.Gatekeeper == MyGatekeeper)
658 {
659 Vector3.TryParse(pick.GlobalPos,out globalPos);
660 }
661 else
662 { 694 {
663 // Setup the illusion 695 // Setup the illusion
664 string region = string.Format("{0} {1}",pick.Gatekeeper,pick.SimName); 696 string region = string.Format("{0} {1}",pick.Gatekeeper,pick.SimName);
@@ -666,21 +698,19 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles
666 698
667 if(target == null) 699 if(target == null)
668 { 700 {
669 // This is a dead or unreachable region 701 // This is a unreachable region
670 } 702 }
671 else 703 else
672 { 704 {
673 // Work our slight of hand 705 // we have a proxy on map
674 int x = target.RegionLocX; 706 // this is a fail on large regions
675 int y = target.RegionLocY; 707 uint gtmp = (uint)globalPos.X >> 8;
676 708 globalPos.X -= (gtmp << 8);
677 dynamic synthX = globalPos.X - (globalPos.X/Constants.RegionSize) * Constants.RegionSize; 709 globalPos.X += target.RegionLocX;
678 synthX += x; 710
679 globalPos.X = synthX; 711 gtmp = (uint)globalPos.Y >> 8;
680 712 globalPos.Y -= (gtmp << 8);
681 dynamic synthY = globalPos.Y - (globalPos.Y/Constants.RegionSize) * Constants.RegionSize; 713 globalPos.Y += target.RegionLocY;
682 synthY += y;
683 globalPos.Y = synthY;
684 } 714 }
685 } 715 }
686 716
@@ -730,6 +760,11 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles
730 UserProfilePick pick = new UserProfilePick(); 760 UserProfilePick pick = new UserProfilePick();
731 string serverURI = string.Empty; 761 string serverURI = string.Empty;
732 GetUserProfileServerURI(remoteClient.AgentId, out serverURI); 762 GetUserProfileServerURI(remoteClient.AgentId, out serverURI);
763 if(string.IsNullOrWhiteSpace(serverURI))
764 {
765 return;
766 }
767
733 ScenePresence p = FindPresence(remoteClient.AgentId); 768 ScenePresence p = FindPresence(remoteClient.AgentId);
734 769
735 Vector3 avaPos = p.AbsolutePosition; 770 Vector3 avaPos = p.AbsolutePosition;
@@ -795,6 +830,10 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles
795 { 830 {
796 string serverURI = string.Empty; 831 string serverURI = string.Empty;
797 GetUserProfileServerURI(remoteClient.AgentId, out serverURI); 832 GetUserProfileServerURI(remoteClient.AgentId, out serverURI);
833 if(string.IsNullOrWhiteSpace(serverURI))
834 {
835 return;
836 }
798 837
799 OSDMap parameters= new OSDMap(); 838 OSDMap parameters= new OSDMap();
800 parameters.Add("pickId", OSD.FromUUID(queryPickID)); 839 parameters.Add("pickId", OSD.FromUUID(queryPickID));
@@ -828,11 +867,19 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles
828 if (!(sender is IClientAPI)) 867 if (!(sender is IClientAPI))
829 return; 868 return;
830 869
870 if(!UUID.TryParse(args[0], out note.TargetId))
871 return;
872
831 IClientAPI remoteClient = (IClientAPI)sender; 873 IClientAPI remoteClient = (IClientAPI)sender;
874 note.UserId = remoteClient.AgentId;
875
832 string serverURI = string.Empty; 876 string serverURI = string.Empty;
833 GetUserProfileServerURI(remoteClient.AgentId, out serverURI); 877 GetUserProfileServerURI(remoteClient.AgentId, out serverURI);
834 note.UserId = remoteClient.AgentId; 878 if(string.IsNullOrWhiteSpace(serverURI))
835 UUID.TryParse(args[0], out note.TargetId); 879 {
880 remoteClient.SendAvatarNotesReply(note.TargetId, note.Notes);
881 return;
882 }
836 883
837 object Note = (object)note; 884 object Note = (object)note;
838 if(!rpc.JsonRpcRequest(ref Note, "avatarnotesrequest", serverURI, UUID.Random().ToString())) 885 if(!rpc.JsonRpcRequest(ref Note, "avatarnotesrequest", serverURI, UUID.Random().ToString()))
@@ -840,8 +887,7 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles
840 remoteClient.SendAvatarNotesReply(note.TargetId, note.Notes); 887 remoteClient.SendAvatarNotesReply(note.TargetId, note.Notes);
841 return; 888 return;
842 } 889 }
843 note = (UserProfileNotes) Note; 890 note = (UserProfileNotes) Note;
844
845 remoteClient.SendAvatarNotesReply(note.TargetId, note.Notes); 891 remoteClient.SendAvatarNotesReply(note.TargetId, note.Notes);
846 } 892 }
847 893
@@ -875,6 +921,8 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles
875 921
876 string serverURI = string.Empty; 922 string serverURI = string.Empty;
877 GetUserProfileServerURI(remoteClient.AgentId, out serverURI); 923 GetUserProfileServerURI(remoteClient.AgentId, out serverURI);
924 if(string.IsNullOrWhiteSpace(serverURI))
925 return;
878 926
879 object Note = note; 927 object Note = note;
880 if(!rpc.JsonRpcRequest(ref Note, "avatar_notes_update", serverURI, UUID.Random().ToString())) 928 if(!rpc.JsonRpcRequest(ref Note, "avatar_notes_update", serverURI, UUID.Random().ToString()))
@@ -910,6 +958,8 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles
910 958
911 string serverURI = string.Empty; 959 string serverURI = string.Empty;
912 bool foreign = GetUserProfileServerURI(remoteClient.AgentId, out serverURI); 960 bool foreign = GetUserProfileServerURI(remoteClient.AgentId, out serverURI);
961 if(string.IsNullOrWhiteSpace(serverURI))
962 return;
913 963
914 object Pref = pref; 964 object Pref = pref;
915 if(!rpc.JsonRpcRequest(ref Pref, "user_preferences_update", serverURI, UUID.Random().ToString())) 965 if(!rpc.JsonRpcRequest(ref Pref, "user_preferences_update", serverURI, UUID.Random().ToString()))
@@ -934,7 +984,8 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles
934 984
935 string serverURI = string.Empty; 985 string serverURI = string.Empty;
936 bool foreign = GetUserProfileServerURI(remoteClient.AgentId, out serverURI); 986 bool foreign = GetUserProfileServerURI(remoteClient.AgentId, out serverURI);
937 987 if(string.IsNullOrWhiteSpace(serverURI))
988 return;
938 989
939 object Pref = (object)pref; 990 object Pref = (object)pref;
940 if(!rpc.JsonRpcRequest(ref Pref, "user_preferences_request", serverURI, UUID.Random().ToString())) 991 if(!rpc.JsonRpcRequest(ref Pref, "user_preferences_request", serverURI, UUID.Random().ToString()))
@@ -985,6 +1036,8 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles
985 1036
986 string serverURI = string.Empty; 1037 string serverURI = string.Empty;
987 GetUserProfileServerURI(remoteClient.AgentId, out serverURI); 1038 GetUserProfileServerURI(remoteClient.AgentId, out serverURI);
1039 if(string.IsNullOrWhiteSpace(serverURI))
1040 return;
988 1041
989 object Param = prop; 1042 object Param = prop;
990 if(!rpc.JsonRpcRequest(ref Param, "avatar_interests_update", serverURI, UUID.Random().ToString())) 1043 if(!rpc.JsonRpcRequest(ref Param, "avatar_interests_update", serverURI, UUID.Random().ToString()))
@@ -1004,13 +1057,11 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles
1004 return; 1057 return;
1005 } 1058 }
1006 1059
1007 // Can't handle NPC yet...
1008 ScenePresence p = FindPresence(avatarID); 1060 ScenePresence p = FindPresence(avatarID);
1009
1010 if (p != null && p.isNPC) 1061 if (p != null && p.isNPC)
1011 { 1062 {
1012 remoteClient.SendAvatarProperties(avatarID, ((INPC)(p.ControllingClient)).profileAbout, ((INPC)(p.ControllingClient)).Born, 1063 remoteClient.SendAvatarProperties(avatarID, ((INPC)(p.ControllingClient)).profileAbout, ((INPC)(p.ControllingClient)).Born,
1013 Utils.StringToBytes("Non Player Character (NPC)"), "NPCs have no life", 16, 1064 Utils.StringToBytes("Non Player Character (NPC)"), "NPCs have no life", 0x10,
1014 UUID.Zero, ((INPC)(p.ControllingClient)).profileImage, "", UUID.Zero); 1065 UUID.Zero, ((INPC)(p.ControllingClient)).profileImage, "", UUID.Zero);
1015 remoteClient.SendAvatarInterestsReply(avatarID, 0, "", 1066 remoteClient.SendAvatarInterestsReply(avatarID, 0, "",
1016 0, "Getting into trouble", "Droidspeak"); 1067 0, "Getting into trouble", "Droidspeak");
@@ -1033,19 +1084,15 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles
1033 } 1084 }
1034 1085
1035 Byte[] membershipType = new Byte[1]; 1086 Byte[] membershipType = new Byte[1];
1036 string born = String.Empty; 1087 string born = string.Empty;
1037 uint flags = 0x00; 1088 uint flags = 0x00;
1038 1089
1039 if (null != account) 1090 if (null != account)
1040 { 1091 {
1041 if (account.UserTitle == "") 1092 if (account.UserTitle == "")
1042 {
1043 membershipType[0] = (Byte)((account.UserFlags & 0xf00) >> 8); 1093 membershipType[0] = (Byte)((account.UserFlags & 0xf00) >> 8);
1044 }
1045 else 1094 else
1046 {
1047 membershipType = Utils.StringToBytes(account.UserTitle); 1095 membershipType = Utils.StringToBytes(account.UserTitle);
1048 }
1049 1096
1050 born = Util.ToDateTime(account.Created).ToString( 1097 born = Util.ToDateTime(account.Created).ToString(
1051 "M/d/yyyy", CultureInfo.InvariantCulture); 1098 "M/d/yyyy", CultureInfo.InvariantCulture);
@@ -1056,16 +1103,13 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles
1056 if (GetUserAccountData(avatarID, out userInfo) == true) 1103 if (GetUserAccountData(avatarID, out userInfo) == true)
1057 { 1104 {
1058 if ((string)userInfo["user_title"] == "") 1105 if ((string)userInfo["user_title"] == "")
1059 {
1060 membershipType[0] = (Byte)(((Byte)userInfo["user_flags"] & 0xf00) >> 8); 1106 membershipType[0] = (Byte)(((Byte)userInfo["user_flags"] & 0xf00) >> 8);
1061 }
1062 else 1107 else
1063 {
1064 membershipType = Utils.StringToBytes((string)userInfo["user_title"]); 1108 membershipType = Utils.StringToBytes((string)userInfo["user_title"]);
1065 }
1066 1109
1067 int val_born = (int)userInfo["user_created"]; 1110 int val_born = (int)userInfo["user_created"];
1068 born = Util.ToDateTime(val_born).ToString( 1111 if(val_born != 0)
1112 born = Util.ToDateTime(val_born).ToString(
1069 "M/d/yyyy", CultureInfo.InvariantCulture); 1113 "M/d/yyyy", CultureInfo.InvariantCulture);
1070 1114
1071 // picky, picky 1115 // picky, picky
@@ -1075,16 +1119,21 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles
1075 } 1119 }
1076 1120
1077 UserProfileProperties props = new UserProfileProperties(); 1121 UserProfileProperties props = new UserProfileProperties();
1078 string result = string.Empty;
1079
1080 props.UserId = avatarID; 1122 props.UserId = avatarID;
1081 1123
1082 if (!GetProfileData(ref props, foreign, out result)) 1124 string result = string.Empty;
1125 if(!GetProfileData(ref props, foreign, out result))
1083 { 1126 {
1084// m_log.DebugFormat("Error getting profile for {0}: {1}", avatarID, result); 1127 props.AboutText ="Profile not avaible at this time. User may still be unknown to this grid";
1085 return;
1086 } 1128 }
1087 1129
1130 // if on same region force online
1131 if(p != null && !p.IsDeleted)
1132 flags |= 0x10;
1133
1134 if(!m_allowUserProfileWebURLs)
1135 props.WebUrl ="";
1136
1088 remoteClient.SendAvatarProperties(props.UserId, props.AboutText, born, membershipType , props.FirstLifeText, flags, 1137 remoteClient.SendAvatarProperties(props.UserId, props.AboutText, born, membershipType , props.FirstLifeText, flags,
1089 props.FirstLifeImageId, props.ImageId, props.WebUrl, props.PartnerId); 1138 props.FirstLifeImageId, props.ImageId, props.WebUrl, props.PartnerId);
1090 1139
@@ -1115,6 +1164,9 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles
1115 prop.FirstLifeImageId = newProfile.FirstLifeImage; 1164 prop.FirstLifeImageId = newProfile.FirstLifeImage;
1116 prop.FirstLifeText = newProfile.FirstLifeAboutText; 1165 prop.FirstLifeText = newProfile.FirstLifeAboutText;
1117 1166
1167 if(!m_allowUserProfileWebURLs)
1168 prop.WebUrl ="";
1169
1118 string serverURI = string.Empty; 1170 string serverURI = string.Empty;
1119 GetUserProfileServerURI(remoteClient.AgentId, out serverURI); 1171 GetUserProfileServerURI(remoteClient.AgentId, out serverURI);
1120 1172
@@ -1153,12 +1205,11 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles
1153 1205
1154 string serverURI = string.Empty; 1206 string serverURI = string.Empty;
1155 GetUserProfileServerURI(properties.UserId, out serverURI); 1207 GetUserProfileServerURI(properties.UserId, out serverURI);
1156
1157 // This is checking a friend on the home grid 1208 // This is checking a friend on the home grid
1158 // Not HG friend 1209 // Not HG friend
1159 if (String.IsNullOrEmpty(serverURI)) 1210 if (String.IsNullOrEmpty(serverURI))
1160 { 1211 {
1161 message = "No Presence - foreign friend"; 1212 message = "User profile service unknown at this time";
1162 return false; 1213 return false;
1163 } 1214 }
1164 1215
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Land/LandServiceInConnectorModule.cs b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Land/LandServiceInConnectorModule.cs
index b632146..1273f0d 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Land/LandServiceInConnectorModule.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Land/LandServiceInConnectorModule.cs
@@ -131,7 +131,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Land
131 131
132 uint rx = 0, ry = 0; 132 uint rx = 0, ry = 0;
133 Util.RegionHandleToWorldLoc(regionHandle, out rx, out ry); 133 Util.RegionHandleToWorldLoc(regionHandle, out rx, out ry);
134 134 rx += x;
135 ry += y;
135 foreach (Scene s in m_Scenes) 136 foreach (Scene s in m_Scenes)
136 { 137 {
137 uint t = s.RegionInfo.WorldLocX; 138 uint t = s.RegionInfo.WorldLocX;
@@ -147,6 +148,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Land
147 if( ry < t) 148 if( ry < t)
148 { 149 {
149// m_log.Debug("[LAND IN CONNECTOR]: Found region to GetLandData from"); 150// m_log.Debug("[LAND IN CONNECTOR]: Found region to GetLandData from");
151 x = rx - s.RegionInfo.WorldLocX;
152 y = ry - s.RegionInfo.WorldLocY;
150 regionAccess = s.RegionInfo.AccessLevel; 153 regionAccess = s.RegionInfo.AccessLevel;
151 return s.GetLandData(x, y); 154 return s.GetLandData(x, y);
152 } 155 }
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RemoteGridServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RemoteGridServiceConnector.cs
index e6e3abb..50e4c8a 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RemoteGridServiceConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RemoteGridServiceConnector.cs
@@ -52,6 +52,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
52 MethodBase.GetCurrentMethod().DeclaringType); 52 MethodBase.GetCurrentMethod().DeclaringType);
53 53
54 private bool m_Enabled = false; 54 private bool m_Enabled = false;
55 private string m_ThisGatekeeper = string.Empty;
55 56
56 private IGridService m_LocalGridService; 57 private IGridService m_LocalGridService;
57 private IGridService m_RemoteGridService; 58 private IGridService m_RemoteGridService;
@@ -118,13 +119,20 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
118 m_LocalGridService = new LocalGridServicesConnector(source, m_RegionInfoCache); 119 m_LocalGridService = new LocalGridServicesConnector(source, m_RegionInfoCache);
119 if (m_LocalGridService == null) 120 if (m_LocalGridService == null)
120 { 121 {
121 m_log.Error("[REMOTE GRID CONNECTOR]: failed to loar local connector"); 122 m_log.Error("[REMOTE GRID CONNECTOR]: failed to load local connector");
122 return false; 123 return false;
123 } 124 }
124 125
125 if(m_RegionInfoCache == null) 126 if(m_RegionInfoCache == null)
126 m_RegionInfoCache = new RegionInfoCache(); 127 m_RegionInfoCache = new RegionInfoCache();
127 128
129 m_ThisGatekeeper = Util.GetConfigVarFromSections<string>(source, "GatekeeperURI",
130 new string[] { "Startup", "Hypergrid", "GridService" }, String.Empty);
131 // Legacy. Remove soon!
132 m_ThisGatekeeper = gridConfig.GetString("Gatekeeper", m_ThisGatekeeper);
133
134 Util.checkServiceURI(m_ThisGatekeeper, out m_ThisGatekeeper);
135
128 return true; 136 return true;
129 } 137 }
130 138
@@ -227,11 +235,27 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
227 return rinfo; 235 return rinfo;
228 } 236 }
229 237
230 public GridRegion GetRegionByName(UUID scopeID, string regionName) 238 public GridRegion GetRegionByName(UUID scopeID, string name)
231 { 239 {
232 GridRegion rinfo = m_LocalGridService.GetRegionByName(scopeID, regionName); 240 GridRegion rinfo = m_LocalGridService.GetRegionByName(scopeID, name);
233 if (rinfo != null) 241 if (rinfo != null)
234 return rinfo; 242 return rinfo;
243
244 // HG urls should not get here, strip them
245 // side effect is that local regions with same name as HG may also be found
246 // this mb good or bad
247 string regionName = name;
248 if(name.Contains("."))
249 {
250 if(string.IsNullOrWhiteSpace(m_ThisGatekeeper))
251 return rinfo; // no HG
252
253 string regionURI = "";
254 if(!Util.buildHGRegionURI(name, out regionURI, out regionName) || string.IsNullOrWhiteSpace(regionName))
255 return rinfo; // invalid
256 if(m_ThisGatekeeper != regionURI)
257 return rinfo; // not local grid
258 }
235 259
236 rinfo = m_RemoteGridService.GetRegionByName(scopeID, regionName); 260 rinfo = m_RemoteGridService.GetRegionByName(scopeID, regionName);
237 m_RegionInfoCache.Cache(scopeID, rinfo); 261 m_RegionInfoCache.Cache(scopeID, rinfo);
@@ -242,7 +266,24 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
242 { 266 {
243 List<GridRegion> rinfo = m_LocalGridService.GetRegionsByName(scopeID, name, maxNumber); 267 List<GridRegion> rinfo = m_LocalGridService.GetRegionsByName(scopeID, name, maxNumber);
244 //m_log.DebugFormat("[REMOTE GRID CONNECTOR]: Local GetRegionsByName {0} found {1} regions", name, rinfo.Count); 268 //m_log.DebugFormat("[REMOTE GRID CONNECTOR]: Local GetRegionsByName {0} found {1} regions", name, rinfo.Count);
245 List<GridRegion> grinfo = m_RemoteGridService.GetRegionsByName(scopeID, name, maxNumber); 269
270 // HG urls should not get here, strip them
271 // side effect is that local regions with same name as HG may also be found
272 // this mb good or bad
273 string regionName = name;
274 if(name.Contains("."))
275 {
276 if(string.IsNullOrWhiteSpace(m_ThisGatekeeper))
277 return rinfo; // no HG
278
279 string regionURI = "";
280 if(!Util.buildHGRegionURI(name, out regionURI, out regionName) || string.IsNullOrWhiteSpace(regionName))
281 return rinfo; // invalid
282 if(m_ThisGatekeeper != regionURI)
283 return rinfo; // not local grid
284 }
285
286 List<GridRegion> grinfo = m_RemoteGridService.GetRegionsByName(scopeID, regionName, maxNumber);
246 287
247 if (grinfo != null) 288 if (grinfo != null)
248 { 289 {
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 7efdc62..eeaec42 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -15010,7 +15010,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
15010 int rejectTypes = 0; 15010 int rejectTypes = 0;
15011 int dataFlags = 0; 15011 int dataFlags = 0;
15012 int maxHits = 1; 15012 int maxHits = 1;
15013 bool detectPhantom = false; 15013 bool notdetectPhantom = true;
15014 for (int i = 0; i < options.Length; i += 2) 15014 for (int i = 0; i < options.Length; i += 2)
15015 { 15015 {
15016 if (options.GetLSLIntegerItem(i) == ScriptBaseClass.RC_REJECT_TYPES) 15016 if (options.GetLSLIntegerItem(i) == ScriptBaseClass.RC_REJECT_TYPES)
@@ -15020,7 +15020,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
15020 else if (options.GetLSLIntegerItem(i) == ScriptBaseClass.RC_MAX_HITS) 15020 else if (options.GetLSLIntegerItem(i) == ScriptBaseClass.RC_MAX_HITS)
15021 maxHits = options.GetLSLIntegerItem(i + 1); 15021 maxHits = options.GetLSLIntegerItem(i + 1);
15022 else if (options.GetLSLIntegerItem(i) == ScriptBaseClass.RC_DETECT_PHANTOM) 15022 else if (options.GetLSLIntegerItem(i) == ScriptBaseClass.RC_DETECT_PHANTOM)
15023 detectPhantom = (options.GetLSLIntegerItem(i + 1) != 0); 15023 notdetectPhantom = (options.GetLSLIntegerItem(i + 1) == 0);
15024 } 15024 }
15025 if (maxHits > m_maxHitsInCastRay) 15025 if (maxHits > m_maxHitsInCastRay)
15026 maxHits = m_maxHitsInCastRay; 15026 maxHits = m_maxHitsInCastRay;
@@ -15050,157 +15050,159 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
15050 World.ForEachSOG( 15050 World.ForEachSOG(
15051 delegate(SceneObjectGroup group) 15051 delegate(SceneObjectGroup group)
15052 { 15052 {
15053 if(group.IsDeleted || group.RootPart == null)
15054 return;
15053 // Check group filters unless part filters are configured 15055 // Check group filters unless part filters are configured
15054 bool isPhysical = (group.RootPart != null && group.RootPart.PhysActor != null && group.RootPart.PhysActor.IsPhysical); 15056 bool isPhysical = (group.RootPart.PhysActor != null && group.RootPart.PhysActor.IsPhysical);
15055 bool isNonphysical = !isPhysical; 15057 bool isNonphysical = !isPhysical;
15056 bool isPhantom = group.IsPhantom || group.IsVolumeDetect; 15058 bool isPhantom = group.IsPhantom || group.IsVolumeDetect;
15057 bool isAttachment = group.IsAttachment; 15059 bool isAttachment = group.IsAttachment;
15058 bool doGroup = true;
15059 if (isPhysical && rejectPhysical) 15060 if (isPhysical && rejectPhysical)
15060 doGroup = false; 15061 return;
15061 if (isNonphysical && rejectNonphysical) 15062 if (isNonphysical && rejectNonphysical)
15062 doGroup = false; 15063 return;
15063 if (isPhantom && detectPhantom) 15064 if (isPhantom && notdetectPhantom)
15064 doGroup = true; 15065 return;
15065 if (m_filterPartsInCastRay) 15066 if (m_filterPartsInCastRay)
15066 doGroup = true; 15067 return;
15067 if (isAttachment && !m_doAttachmentsInCastRay) 15068 if (isAttachment && !m_doAttachmentsInCastRay)
15068 doGroup = false; 15069 return;
15070
15069 // Parse object/group if passed filters 15071 // Parse object/group if passed filters
15070 if (doGroup) 15072 // Iterate over all prims/parts in object/group
15073 foreach(SceneObjectPart part in group.Parts)
15071 { 15074 {
15072 // Iterate over all prims/parts in object/group 15075 // Check part filters if configured
15073 foreach(SceneObjectPart part in group.Parts) 15076 if (m_filterPartsInCastRay)
15074 { 15077 {
15075 // Check part filters if configured 15078 // ignore PhysicsShapeType.None as physics engines do
15076 if (m_filterPartsInCastRay) 15079 // or we will get into trouble in future
15080 if(part.PhysicsShapeType == (byte)PhysicsShapeType.None)
15081 continue;
15082 isPhysical = (part.PhysActor != null && part.PhysActor.IsPhysical);
15083 isNonphysical = !isPhysical;
15084 isPhantom = ((part.Flags & PrimFlags.Phantom) != 0) ||
15085 (part.VolumeDetectActive);
15086
15087 if (isPhysical && rejectPhysical)
15088 continue;
15089 if (isNonphysical && rejectNonphysical)
15090 continue;
15091 if (isPhantom && notdetectPhantom)
15092 continue;
15093 }
15094
15095 // Parse prim/part and project ray if passed filters
15096 Vector3 scalePart = part.Scale;
15097 Vector3 posPart = part.GetWorldPosition();
15098 Quaternion rotPart = part.GetWorldRotation();
15099 Quaternion rotPartInv = Quaternion.Inverse(rotPart);
15100 Vector3 pos1RayProj = ((pos1Ray - posPart) * rotPartInv) / scalePart;
15101 Vector3 pos2RayProj = ((pos2Ray - posPart) * rotPartInv) / scalePart;
15102
15103 // Filter parts by shape bounding boxes
15104 Vector3 shapeBoxMax = new Vector3(0.5f, 0.5f, 0.5f);
15105 if (!part.Shape.SculptEntry)
15106 shapeBoxMax = shapeBoxMax * (new Vector3(m_primSafetyCoeffX, m_primSafetyCoeffY, m_primSafetyCoeffZ));
15107 shapeBoxMax = shapeBoxMax + (new Vector3(tol, tol, tol));
15108 if (RayIntersectsShapeBox(pos1RayProj, pos2RayProj, shapeBoxMax))
15109 {
15110 // Prepare data needed to check for ray hits
15111 RayTrans rayTrans = new RayTrans();
15112 rayTrans.PartId = part.UUID;
15113 rayTrans.GroupId = part.ParentGroup.UUID;
15114 rayTrans.Link = group.PrimCount > 1 ? part.LinkNum : 0;
15115 rayTrans.ScalePart = scalePart;
15116 rayTrans.PositionPart = posPart;
15117 rayTrans.RotationPart = rotPart;
15118 rayTrans.ShapeNeedsEnds = true;
15119 rayTrans.Position1Ray = pos1Ray;
15120 rayTrans.Position1RayProj = pos1RayProj;
15121 rayTrans.VectorRayProj = pos2RayProj - pos1RayProj;
15122
15123 // Get detail level depending on type
15124 int lod = 0;
15125 // Mesh detail level
15126 if (part.Shape.SculptEntry && part.Shape.SculptType == (byte)SculptType.Mesh)
15127 lod = (int)m_meshLodInCastRay;
15128 // Sculpt detail level
15129 else if (part.Shape.SculptEntry && part.Shape.SculptType == (byte)SculptType.Mesh)
15130 lod = (int)m_sculptLodInCastRay;
15131 // Shape detail level
15132 else if (!part.Shape.SculptEntry)
15133 lod = (int)m_primLodInCastRay;
15134
15135 // Try to get cached mesh if configured
15136 ulong meshKey = 0;
15137 FacetedMesh mesh = null;
15138 if (m_useMeshCacheInCastRay)
15077 { 15139 {
15078 isPhysical = (part.PhysActor != null && part.PhysActor.IsPhysical); 15140 meshKey = part.Shape.GetMeshKey(Vector3.One, (float)(4 << lod));
15079 isNonphysical = !isPhysical; 15141 lock (m_cachedMeshes)
15080 isPhantom = ((part.Flags & PrimFlags.Phantom) != 0) || (part.VolumeDetectActive); 15142 {
15081 bool doPart = true; 15143 m_cachedMeshes.TryGetValue(meshKey, out mesh);
15082 if (isPhysical && rejectPhysical) 15144 }
15083 doPart = false;
15084 if (isNonphysical && rejectNonphysical)
15085 doPart = false;
15086 if (isPhantom && detectPhantom)
15087 doPart = true;
15088 if (!doPart)
15089 continue;
15090 } 15145 }
15091 15146
15092 // Parse prim/part and project ray if passed filters 15147 // Create mesh if no cached mesh
15093 Vector3 scalePart = part.Scale; 15148 if (mesh == null)
15094 Vector3 posPart = part.GetWorldPosition();
15095 Quaternion rotPart = part.GetWorldRotation();
15096 Quaternion rotPartInv = Quaternion.Inverse(rotPart);
15097 Vector3 pos1RayProj = ((pos1Ray - posPart) * rotPartInv) / scalePart;
15098 Vector3 pos2RayProj = ((pos2Ray - posPart) * rotPartInv) / scalePart;
15099
15100 // Filter parts by shape bounding boxes
15101 Vector3 shapeBoxMax = new Vector3(0.5f, 0.5f, 0.5f);
15102 if (!part.Shape.SculptEntry)
15103 shapeBoxMax = shapeBoxMax * (new Vector3(m_primSafetyCoeffX, m_primSafetyCoeffY, m_primSafetyCoeffZ));
15104 shapeBoxMax = shapeBoxMax + (new Vector3(tol, tol, tol));
15105 if (RayIntersectsShapeBox(pos1RayProj, pos2RayProj, shapeBoxMax))
15106 { 15149 {
15107 // Prepare data needed to check for ray hits 15150 // Make an OMV prim to be able to mesh part
15108 RayTrans rayTrans = new RayTrans(); 15151 Primitive omvPrim = part.Shape.ToOmvPrimitive(posPart, rotPart);
15109 rayTrans.PartId = part.UUID; 15152 byte[] sculptAsset = null;
15110 rayTrans.GroupId = part.ParentGroup.UUID; 15153 if (omvPrim.Sculpt != null)
15111 rayTrans.Link = group.PrimCount > 1 ? part.LinkNum : 0; 15154 sculptAsset = World.AssetService.GetData(omvPrim.Sculpt.SculptTexture.ToString());
15112 rayTrans.ScalePart = scalePart; 15155
15113 rayTrans.PositionPart = posPart; 15156 // When part is mesh, get mesh
15114 rayTrans.RotationPart = rotPart; 15157 if (omvPrim.Sculpt != null && omvPrim.Sculpt.Type == SculptType.Mesh && sculptAsset != null)
15115 rayTrans.ShapeNeedsEnds = true;
15116 rayTrans.Position1Ray = pos1Ray;
15117 rayTrans.Position1RayProj = pos1RayProj;
15118 rayTrans.VectorRayProj = pos2RayProj - pos1RayProj;
15119
15120 // Get detail level depending on type
15121 int lod = 0;
15122 // Mesh detail level
15123 if (part.Shape.SculptEntry && part.Shape.SculptType == (byte)SculptType.Mesh)
15124 lod = (int)m_meshLodInCastRay;
15125 // Sculpt detail level
15126 else if (part.Shape.SculptEntry && part.Shape.SculptType == (byte)SculptType.Mesh)
15127 lod = (int)m_sculptLodInCastRay;
15128 // Shape detail level
15129 else if (!part.Shape.SculptEntry)
15130 lod = (int)m_primLodInCastRay;
15131
15132 // Try to get cached mesh if configured
15133 ulong meshKey = 0;
15134 FacetedMesh mesh = null;
15135 if (m_useMeshCacheInCastRay)
15136 { 15158 {
15137 meshKey = part.Shape.GetMeshKey(Vector3.One, (float)(4 << lod)); 15159 AssetMesh meshAsset = new AssetMesh(omvPrim.Sculpt.SculptTexture, sculptAsset);
15138 lock (m_cachedMeshes) 15160 FacetedMesh.TryDecodeFromAsset(omvPrim, meshAsset, m_meshLodInCastRay, out mesh);
15139 { 15161 meshAsset = null;
15140 m_cachedMeshes.TryGetValue(meshKey, out mesh);
15141 }
15142 } 15162 }
15143 15163
15144 // Create mesh if no cached mesh 15164 // When part is sculpt, create mesh
15145 if (mesh == null) 15165 // Quirk: Generated sculpt mesh is about 2.8% smaller in X and Y than visual sculpt.
15166 else if (omvPrim.Sculpt != null && omvPrim.Sculpt.Type != SculptType.Mesh && sculptAsset != null)
15146 { 15167 {
15147 // Make an OMV prim to be able to mesh part 15168 IJ2KDecoder imgDecoder = World.RequestModuleInterface<IJ2KDecoder>();
15148 Primitive omvPrim = part.Shape.ToOmvPrimitive(posPart, rotPart); 15169 if (imgDecoder != null)
15149 byte[] sculptAsset = null;
15150 if (omvPrim.Sculpt != null)
15151 sculptAsset = World.AssetService.GetData(omvPrim.Sculpt.SculptTexture.ToString());
15152
15153 // When part is mesh, get mesh
15154 if (omvPrim.Sculpt != null && omvPrim.Sculpt.Type == SculptType.Mesh && sculptAsset != null)
15155 {
15156 AssetMesh meshAsset = new AssetMesh(omvPrim.Sculpt.SculptTexture, sculptAsset);
15157 FacetedMesh.TryDecodeFromAsset(omvPrim, meshAsset, m_meshLodInCastRay, out mesh);
15158 meshAsset = null;
15159 }
15160
15161 // When part is sculpt, create mesh
15162 // Quirk: Generated sculpt mesh is about 2.8% smaller in X and Y than visual sculpt.
15163 else if (omvPrim.Sculpt != null && omvPrim.Sculpt.Type != SculptType.Mesh && sculptAsset != null)
15164 { 15170 {
15165 IJ2KDecoder imgDecoder = World.RequestModuleInterface<IJ2KDecoder>(); 15171 Image sculpt = imgDecoder.DecodeToImage(sculptAsset);
15166 if (imgDecoder != null) 15172 if (sculpt != null)
15167 { 15173 {
15168 Image sculpt = imgDecoder.DecodeToImage(sculptAsset); 15174 mesh = primMesher.GenerateFacetedSculptMesh(omvPrim, (Bitmap)sculpt, m_sculptLodInCastRay);
15169 if (sculpt != null) 15175 sculpt.Dispose();
15170 {
15171 mesh = primMesher.GenerateFacetedSculptMesh(omvPrim, (Bitmap)sculpt, m_sculptLodInCastRay);
15172 sculpt.Dispose();
15173 }
15174 } 15176 }
15175 }
15176
15177 // When part is shape, create mesh
15178 else if (omvPrim.Sculpt == null)
15179 {
15180 if (
15181 omvPrim.PrimData.PathBegin == 0.0 && omvPrim.PrimData.PathEnd == 1.0 &&
15182 omvPrim.PrimData.PathTaperX == 0.0 && omvPrim.PrimData.PathTaperY == 0.0 &&
15183 omvPrim.PrimData.PathSkew == 0.0 &&
15184 omvPrim.PrimData.PathTwist - omvPrim.PrimData.PathTwistBegin == 0.0
15185 )
15186 rayTrans.ShapeNeedsEnds = false;
15187 mesh = primMesher.GenerateFacetedMesh(omvPrim, m_primLodInCastRay);
15188 } 15177 }
15178 }
15189 15179
15190 // Cache mesh if configured 15180 // When part is shape, create mesh
15191 if (m_useMeshCacheInCastRay && mesh != null) 15181 else if (omvPrim.Sculpt == null)
15182 {
15183 if (
15184 omvPrim.PrimData.PathBegin == 0.0 && omvPrim.PrimData.PathEnd == 1.0 &&
15185 omvPrim.PrimData.PathTaperX == 0.0 && omvPrim.PrimData.PathTaperY == 0.0 &&
15186 omvPrim.PrimData.PathSkew == 0.0 &&
15187 omvPrim.PrimData.PathTwist - omvPrim.PrimData.PathTwistBegin == 0.0
15188 )
15189 rayTrans.ShapeNeedsEnds = false;
15190 mesh = primMesher.GenerateFacetedMesh(omvPrim, m_primLodInCastRay);
15191 }
15192
15193 // Cache mesh if configured
15194 if (m_useMeshCacheInCastRay && mesh != null)
15195 {
15196 lock(m_cachedMeshes)
15192 { 15197 {
15193 lock(m_cachedMeshes) 15198 if (!m_cachedMeshes.ContainsKey(meshKey))
15194 { 15199 m_cachedMeshes.Add(meshKey, mesh);
15195 if (!m_cachedMeshes.ContainsKey(meshKey))
15196 m_cachedMeshes.Add(meshKey, mesh);
15197 }
15198 } 15200 }
15199 } 15201 }
15200 // Check mesh for ray hits
15201 AddRayInFacetedMesh(mesh, rayTrans, ref rayHits);
15202 mesh = null;
15203 } 15202 }
15203 // Check mesh for ray hits
15204 AddRayInFacetedMesh(mesh, rayTrans, ref rayHits);
15205 mesh = null;
15204 } 15206 }
15205 } 15207 }
15206 } 15208 }
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
index 9742119..c83682e 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -1874,6 +1874,55 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1874 "dataserver", resobj, new DetectParams[0])); 1874 "dataserver", resobj, new DetectParams[0]));
1875 } 1875 }
1876 1876
1877
1878 /// <summary>
1879 /// Similar to llDie but given an object UUID
1880 /// </summary>
1881 /// <param name="objectUUID"></param>
1882
1883 public void osDie(LSL_Key objectUUID)
1884 {
1885// CheckThreatLevel(ThreatLevel.VeryHigh, "osDie");
1886 // if this is restricted to objects rezzed by this host level can be reduced
1887
1888 CheckThreatLevel(ThreatLevel.Low, "osDie");
1889 m_host.AddScriptLPS(1);
1890
1891 UUID objUUID;
1892 if (!UUID.TryParse(objectUUID, out objUUID))
1893 {
1894 OSSLShoutError("osDie() cannot delete objects with invalid UUIDs");
1895 return;
1896 }
1897
1898 // harakiri check
1899 if(objUUID == UUID.Zero)
1900 {
1901 if (!m_host.ParentGroup.IsAttachment)
1902 throw new SelfDeleteException();
1903 return;
1904 }
1905
1906 SceneObjectGroup sceneOG = World.GetSceneObjectGroup(objUUID);
1907
1908 if (sceneOG == null || sceneOG.IsDeleted)
1909 return;
1910
1911 if(sceneOG.IsAttachment)
1912 return;
1913
1914 if (sceneOG.OwnerID != m_host.OwnerID)
1915 return;
1916
1917 // harakiri check
1918 if(sceneOG.UUID == m_host.ParentGroup.UUID)
1919 throw new SelfDeleteException();
1920
1921 // restrict to objects rezzed by host
1922 if(sceneOG.RezzerID == m_host.ParentGroup.UUID)
1923 World.DeleteSceneObject(sceneOG, false);
1924 }
1925
1877 /// <summary> 1926 /// <summary>
1878 /// Write a notecard directly to the prim's inventory. 1927 /// Write a notecard directly to the prim's inventory.
1879 /// </summary> 1928 /// </summary>
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
index cf3e6df..7415fea 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
@@ -317,6 +317,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
317 void osForceBreakAllLinks(); 317 void osForceBreakAllLinks();
318 318
319 /// <summary> 319 /// <summary>
320 /// Similar to llDie but given an object UUID
321 /// </summary>
322 /// <param name="objectUUID"></param>
323
324 void osDie(LSL_Key objectUUID);
325
326 /// <summary>
320 /// Check if the given key is an npc 327 /// Check if the given key is an npc
321 /// </summary> 328 /// </summary>
322 /// <param name="npc"></param> 329 /// <param name="npc"></param>
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs
index 734d878..903b362 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs
@@ -643,6 +643,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
643 public const int OBJECT_REZZER_KEY = 32; 643 public const int OBJECT_REZZER_KEY = 32;
644 public const int OBJECT_GROUP_TAG = 33; 644 public const int OBJECT_GROUP_TAG = 33;
645 public const int OBJECT_TEMP_ATTACHED = 34; 645 public const int OBJECT_TEMP_ATTACHED = 34;
646 public const int OBJECT_ATTACHED_SLOTS_AVAILABLE = 35;
646 647
647 // Pathfinding types 648 // Pathfinding types
648 public const int OPT_OTHER = -1; 649 public const int OPT_OTHER = -1;
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
index 2e8a76c..c34ccd0 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
@@ -577,6 +577,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
577 m_OSSL_Functions.osForceBreakAllLinks(); 577 m_OSSL_Functions.osForceBreakAllLinks();
578 } 578 }
579 579
580 public void osDie(LSL_Key objectUUID)
581 {
582 m_OSSL_Functions.osDie(objectUUID);
583 }
584
580 public LSL_Integer osIsNpc(LSL_Key npc) 585 public LSL_Integer osIsNpc(LSL_Key npc)
581 { 586 {
582 return m_OSSL_Functions.osIsNpc(npc); 587 return m_OSSL_Functions.osIsNpc(npc);