From be0a957363f3fda72fab94b427afd30b8af46785 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 5 Nov 2016 15:42:37 +0000 Subject: add a few lsl constants and move some around --- .../Shared/Api/Runtime/LSL_Constants.cs | 27 ++++++++++++++++------ 1 file changed, 20 insertions(+), 7 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs index 4a8e885..1a3de1e 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs @@ -336,11 +336,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase public const int ROTATE = 32; public const int SCALE = 64; public const int ALL_SIDES = -1; + + // LINK flags public const int LINK_SET = -1; + public const int LINK_TRUEROOT = 0; // possible this should had been ROOT all the time public const int LINK_ROOT = 1; public const int LINK_ALL_OTHERS = -2; public const int LINK_ALL_CHILDREN = -3; public const int LINK_THIS = -4; + public const int CHANGED_INVENTORY = 1; public const int CHANGED_COLOR = 2; public const int CHANGED_SHAPE = 4; @@ -356,6 +360,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase public const int CHANGED_MEDIA = 2048; public const int CHANGED_ANIMATION = 16384; public const int CHANGED_POSITION = 32768; + public const int TYPE_INVALID = 0; public const int TYPE_INTEGER = 1; public const int TYPE_FLOAT = 2; @@ -389,6 +394,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase public const int CONTENT_TYPE_FORM = 7; //application/x-www-form-urlencoded public const int CONTENT_TYPE_RSS = 8; //application/rss+xml + //parameters comand flags public const int PRIM_MATERIAL = 2; public const int PRIM_PHYSICS = 3; public const int PRIM_TEMP_ON_REZ = 4; @@ -397,19 +403,22 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase public const int PRIM_SIZE = 7; public const int PRIM_ROTATION = 8; public const int PRIM_TYPE = 9; + // gap 10-16 public const int PRIM_TEXTURE = 17; public const int PRIM_COLOR = 18; public const int PRIM_BUMP_SHINY = 19; public const int PRIM_FULLBRIGHT = 20; public const int PRIM_FLEXIBLE = 21; public const int PRIM_TEXGEN = 22; - public const int PRIM_CAST_SHADOWS = 24; // Not implemented, here for completeness sake public const int PRIM_POINT_LIGHT = 23; // Huh? + public const int PRIM_CAST_SHADOWS = 24; // Not implemented, here for completeness sake public const int PRIM_GLOW = 25; public const int PRIM_TEXT = 26; public const int PRIM_NAME = 27; public const int PRIM_DESC = 28; public const int PRIM_ROT_LOCAL = 29; + public const int PRIM_PHYSICS_SHAPE_TYPE = 30; + public const int PRIM_PHYSICS_MATERIAL = 31; // aparently not SL public const int PRIM_OMEGA = 32; public const int PRIM_POS_LOCAL = 33; public const int PRIM_LINK_TARGET = 34; @@ -417,6 +426,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase public const int PRIM_SPECULAR = 36; public const int PRIM_NORMAL = 37; public const int PRIM_ALPHA_MODE = 38; + public const int PRIM_ALLOW_UNSIT = 39; // experiences related. Unsuport + public const int PRIM_SCRIPTED_SIT_ONLY = 40; // experiences related. Unsuport + public const int PRIM_SIT_TARGET = 40; + + + // parameters public const int PRIM_TEXGEN_DEFAULT = 0; public const int PRIM_TEXGEN_PLANAR = 1; @@ -473,6 +488,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase public const int PRIM_SCULPT_FLAG_INVERT = 64; public const int PRIM_SCULPT_FLAG_MIRROR = 128; + public const int PRIM_PHYSICS_SHAPE_PRIM = 0; + public const int PRIM_PHYSICS_SHAPE_NONE = 1; + public const int PRIM_PHYSICS_SHAPE_CONVEX = 2; + public const int PROFILE_NONE = 0; public const int PROFILE_SCRIPT_MEMORY = 1; @@ -701,12 +720,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase public const int PRIM_MEDIA_PERM_GROUP = 2; public const int PRIM_MEDIA_PERM_ANYONE = 4; - public const int PRIM_PHYSICS_SHAPE_TYPE = 30; - public const int PRIM_PHYSICS_SHAPE_PRIM = 0; - public const int PRIM_PHYSICS_SHAPE_CONVEX = 2; - public const int PRIM_PHYSICS_SHAPE_NONE = 1; - - public const int PRIM_PHYSICS_MATERIAL = 31; public const int DENSITY = 1; public const int FRICTION = 2; public const int RESTITUTION = 4; -- cgit v1.1 From 060350832ae0be015182a3516a718dfdf030b56c Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 5 Nov 2016 16:50:41 +0000 Subject: add suport for PRIM_SIT_TARGET on get(link)PrimitveParameters and fix typos --- .../Shared/Api/Implementation/LSL_Api.cs | 27 ++++++++++++++++------ .../Shared/Api/Runtime/LSL_Constants.cs | 9 ++++---- 2 files changed, 24 insertions(+), 12 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index ced81ad..91b49cd 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -662,15 +662,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api List ret = new List(); if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted) return ret; - ret.Add(part); switch (linkType) { case ScriptBaseClass.LINK_SET: return new List(part.ParentGroup.Parts); - case ScriptBaseClass.LINK_ROOT: - ret = new List(); + case ScriptBaseClass.LINK_ROOT: ret.Add(part.ParentGroup.RootPart); return ret; @@ -690,16 +688,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return ret; case ScriptBaseClass.LINK_THIS: + ret.Add(part); return ret; default: if (linkType < 0) - return new List(); + return ret; SceneObjectPart target = part.ParentGroup.GetLinkNumPart(linkType); if (target == null) - return new List(); - ret = new List(); + return ret; ret.Add(target); return ret; } @@ -11182,7 +11180,22 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api res.Add(new LSL_Float(spin)); res.Add(new LSL_Float(gain)); break; - + + case (int)ScriptBaseClass.PRIM_SIT_TARGET: + if(part.IsSitTargetSet) + { + res.Add(new LSL_Integer(1)); + res.Add(new LSL_Vector(part.SitTargetPosition)); + res.Add(new LSL_Rotation(part.SitTargetOrientation)); + } + else + { + res.Add(new LSL_Integer(0)); + res.Add(new LSL_Vector(Vector3.Zero)); + res.Add(new LSL_Rotation(Quaternion.Identity)); + } + break; + case (int)ScriptBaseClass.PRIM_LINK_TARGET: // TODO: Should be issuing a runtime script warning in this case. diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs index 1a3de1e..bc4d20c 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs @@ -339,7 +339,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase // LINK flags public const int LINK_SET = -1; - public const int LINK_TRUEROOT = 0; // possible this should had been ROOT all the time public const int LINK_ROOT = 1; public const int LINK_ALL_OTHERS = -2; public const int LINK_ALL_CHILDREN = -3; @@ -418,7 +417,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase public const int PRIM_DESC = 28; public const int PRIM_ROT_LOCAL = 29; public const int PRIM_PHYSICS_SHAPE_TYPE = 30; - public const int PRIM_PHYSICS_MATERIAL = 31; // aparently not SL + public const int PRIM_PHYSICS_MATERIAL = 31; // apparently not on SL wiki public const int PRIM_OMEGA = 32; public const int PRIM_POS_LOCAL = 33; public const int PRIM_LINK_TARGET = 34; @@ -426,9 +425,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase public const int PRIM_SPECULAR = 36; public const int PRIM_NORMAL = 37; public const int PRIM_ALPHA_MODE = 38; - public const int PRIM_ALLOW_UNSIT = 39; // experiences related. Unsuport - public const int PRIM_SCRIPTED_SIT_ONLY = 40; // experiences related. Unsuport - public const int PRIM_SIT_TARGET = 40; + public const int PRIM_ALLOW_UNSIT = 39; // experiences related. unsupported + public const int PRIM_SCRIPTED_SIT_ONLY = 40; // experiences related. unsupported + public const int PRIM_SIT_TARGET = 41; // parameters -- cgit v1.1 From 1c7b688db4e78c24058a2f7e24afca2eb751bec4 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 5 Nov 2016 18:28:30 +0000 Subject: add suport for PRIM_SIT_TARGET on Set(link)PrimitveParameters. This may not be SL compatible. hack: to let active work with zero offset and rotation add a little Z value to offset --- .../Shared/Api/Implementation/LSL_Api.cs | 48 ++++++++++++++++++++++ OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs | 8 +++- 2 files changed, 54 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 91b49cd..ba22201 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -10084,6 +10084,53 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api part.UpdateSlice((float)slice.x, (float)slice.y); break; + case ScriptBaseClass.PRIM_SIT_TARGET: + if (remain < 3) + return new LSL_List(); + + int active; + try + { + active = rules.GetLSLIntegerItem(idx++); + } + catch(InvalidCastException) + { + Error(originFunc, string.Format("Error running rule #{0} -> PRIM_SIT_TARGET: arg #{1} - parameter 1 must be integer", rulesParsed, idx - idxStart - 1)); + return new LSL_List(); + } + LSL_Vector offset; + try + { + offset = rules.GetVector3Item(idx++); + } + catch(InvalidCastException) + { + Error(originFunc, string.Format("Error running rule #{0} -> PRIM_SIT_TARGET: arg #{1} - parameter 2 must be vector", rulesParsed, idx - idxStart - 1)); + return new LSL_List(); + } + LSL_Rotation sitrot; + try + { + sitrot = rules.GetQuaternionItem(idx++); + } + catch(InvalidCastException) + { + Error(originFunc, string.Format("Error running rule #{0} -> PRIM_SIT_TARGET: arg #{1} - parameter 3 must be rotation", rulesParsed, idx - idxStart - 1)); + return new LSL_List(); + } + + // not SL compatible since we don't have a independent flag to control active target but use the values of offset and rotation + if(active == 1) + { + if(offset.x == 0 && offset.y == 0 && offset.z == 0 && sitrot.s == 1.0) + offset.z = 1e-5f; // hack + SitTarget(part,offset,sitrot); + } + else if(active == 0) + SitTarget(part, Vector3.Zero , Quaternion.Identity); + + break; + case ScriptBaseClass.PRIM_LINK_TARGET: if (remain < 3) // setting to 3 on the basis that parsing any usage of PRIM_LINK_TARGET that has nothing following it is pointless. return new LSL_List(); @@ -15932,6 +15979,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api case (int)ScriptBaseClass.PRIM_TEXT: case (int)ScriptBaseClass.PRIM_BUMP_SHINY: case (int)ScriptBaseClass.PRIM_OMEGA: + case (int)ScriptBaseClass.PRIM_SIT_TARGET: if (remain < 3) return new LSL_List(); idx += 3; diff --git a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs index 9fb1e2c..c36e7c6 100644 --- a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs +++ b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs @@ -704,12 +704,16 @@ namespace OpenSim.Region.ScriptEngine.Shared { if (Data[itemIndex] is LSL_Types.Quaternion) { - return (LSL_Types.Quaternion)Data[itemIndex]; + LSL_Types.Quaternion q = (LSL_Types.Quaternion)Data[itemIndex]; + q.Normalize(); + return q; } else if(Data[itemIndex] is OpenMetaverse.Quaternion) { - return new LSL_Types.Quaternion( + LSL_Types.Quaternion q = new LSL_Types.Quaternion( (OpenMetaverse.Quaternion)Data[itemIndex]); + q.Normalize(); + return q; } else { -- cgit v1.1 From 4b0457b2d30282643d9402e1fcf751a4bb9303fe Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 5 Nov 2016 18:44:45 +0000 Subject: Regression, really ??? --- OpenSim/Region/ScriptEngine/Shared/Tests/LSL_TypesTestList.cs | 2 ++ 1 file changed, 2 insertions(+) (limited to 'OpenSim/Region/ScriptEngine/Shared') diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_TypesTestList.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_TypesTestList.cs index 71b88bc..20bbd72 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_TypesTestList.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_TypesTestList.cs @@ -270,6 +270,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests TestHelpers.InMethod(); LSL_Types.Quaternion testValue = new LSL_Types.Quaternion(12.64, 59.43723, 765.3421, 4.00987); + // make that nonesense a quartenion + testValue.Normalize(); LSL_Types.list testList = new LSL_Types.list(testValue); Assert.AreEqual(testValue, testList.GetQuaternionItem(0)); -- cgit v1.1 From 8cc8d15f950657d4d021fc81d14a8715007e7bb4 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 5 Nov 2016 20:14:11 +0000 Subject: some types may already be native in MOD_Api ConvertFromLSL --- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs | 6 +++++- OpenSim/Region/ScriptEngine/Shared/Tests/LSL_TypesTestList.cs | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs index 7bd4fa7..1e26036 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs @@ -365,8 +365,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api /// protected object ConvertFromLSL(object lslparm, Type type, string fname) { + + if(lslparm.GetType() == type) + return lslparm; + // ---------- String ---------- - if (lslparm is LSL_String) + else if (lslparm is LSL_String) { if (type == typeof(string)) return (string)(LSL_String)lslparm; diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_TypesTestList.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_TypesTestList.cs index 20bbd72..fe2113b 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_TypesTestList.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_TypesTestList.cs @@ -270,7 +270,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests TestHelpers.InMethod(); LSL_Types.Quaternion testValue = new LSL_Types.Quaternion(12.64, 59.43723, 765.3421, 4.00987); - // make that nonesense a quartenion + // make that nonsense a quaternion testValue.Normalize(); LSL_Types.list testList = new LSL_Types.list(testValue); -- cgit v1.1 From d07f48605f90a0f0485d0ac11ec5641bbb88a28a Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 6 Nov 2016 02:43:33 +0000 Subject: change llGetTime() source clock --- .../ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index ba22201..02a9ebc 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -113,7 +113,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api protected float m_MinTimerInterval = 0.5f; protected float m_recoilScaleFactor = 0.0f; - protected DateTime m_timer = DateTime.Now; + protected double m_timer = Util.GetTimeStampMS(); protected bool m_waitingForScriptAnswer = false; protected bool m_automaticLinkPermission = false; protected IMessageTransferModule m_TransferModule = null; @@ -3048,22 +3048,23 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public LSL_Float llGetTime() { m_host.AddScriptLPS(1); - TimeSpan ScriptTime = DateTime.Now - m_timer; - return (double)(ScriptTime.TotalMilliseconds / 1000); + double ScriptTime = Util.GetTimeStampMS() - m_timer; + return (ScriptTime / 1000.0); } public void llResetTime() { m_host.AddScriptLPS(1); - m_timer = DateTime.Now; + m_timer = Util.GetTimeStampMS(); } public LSL_Float llGetAndResetTime() { m_host.AddScriptLPS(1); - TimeSpan ScriptTime = DateTime.Now - m_timer; - m_timer = DateTime.Now; - return (double)(ScriptTime.TotalMilliseconds / 1000); + double now = Util.GetTimeStampMS(); + double ScriptTime = now - m_timer; + m_timer = now; + return (ScriptTime / 1000.0); } public void llSound(string sound, double volume, int queue, int loop) @@ -14544,7 +14545,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api bool checkNonPhysical = !((rejectTypes & ScriptBaseClass.RC_REJECT_NONPHYSICAL) == ScriptBaseClass.RC_REJECT_NONPHYSICAL); bool checkPhysical = !((rejectTypes & ScriptBaseClass.RC_REJECT_PHYSICAL) == ScriptBaseClass.RC_REJECT_PHYSICAL); - if (World.SupportsRayCastFiltered()) { if (dist == 0) @@ -14650,7 +14650,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { return a.Depth.CompareTo(b.Depth); }); - + int values = 0; SceneObjectGroup thisgrp = m_host.ParentGroup; @@ -14704,7 +14704,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } list.Add(new LSL_Integer(values)); - return list; } -- cgit v1.1 From 014cd1ab428feff96484c666694c33822344269e Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 6 Nov 2016 03:53:12 +0000 Subject: restrict ubOde castray with terrain range only on horizontal plane, let it find physical avatars. --- .../Shared/Api/Implementation/LSL_Api.cs | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 02a9ebc..33d5757 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -14216,18 +14216,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return false; } - private ContactResult[] AvatarIntersection(Vector3 rayStart, Vector3 rayEnd) + private ContactResult[] AvatarIntersection(Vector3 rayStart, Vector3 rayEnd, bool skipPhys) { List contacts = new List(); Vector3 ab = rayEnd - rayStart; + float ablen = ab.Length(); World.ForEachScenePresence(delegate(ScenePresence sp) { + if(skipPhys && sp.PhysicsActor != null) + return; + Vector3 ac = sp.AbsolutePosition - rayStart; -// Vector3 bc = sp.AbsolutePosition - rayEnd; - double d = Math.Abs(Vector3.Mag(Vector3.Cross(ab, ac)) / Vector3.Distance(rayStart, rayEnd)); + double d = Math.Abs(Vector3.Mag(Vector3.Cross(ab, ac)) / ablen); if (d > 1.5) return; @@ -14553,8 +14556,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api RayFilterFlags rayfilter = RayFilterFlags.BackFaceCull; if (checkTerrain) rayfilter |= RayFilterFlags.land; -// if (checkAgents) -// rayfilter |= RayFilterFlags.agent; + if (checkAgents) + rayfilter |= RayFilterFlags.agent; if (checkPhysical) rayfilter |= RayFilterFlags.physical; if (checkNonPhysical) @@ -14578,18 +14581,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api object physresults; physresults = World.RayCastFiltered(rayStart, direction, dist, physcount, rayfilter); +/* if (physresults == null) { list.Add(new LSL_Integer(-3)); // timeout error return list; } - +*/ results = (List)physresults; // for now physics doesn't detect sitted avatars so do it outside physics if (checkAgents) { - ContactResult[] agentHits = AvatarIntersection(rayStart, rayEnd); + ContactResult[] agentHits = AvatarIntersection(rayStart, rayEnd, true); foreach (ContactResult r in agentHits) results.Add(r); } @@ -14610,7 +14614,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { if (checkAgents) { - ContactResult[] agentHits = AvatarIntersection(rayStart, rayEnd); + ContactResult[] agentHits = AvatarIntersection(rayStart, rayEnd, false); foreach (ContactResult r in agentHits) results.Add(r); } -- cgit v1.1 From 6956ada5e83d1d1ebcedef6c6154925e8efd501d Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 6 Nov 2016 04:29:01 +0000 Subject: oops bug fix --- .../Shared/Api/Implementation/LSL_Api.cs | 48 +++++++++++++--------- 1 file changed, 29 insertions(+), 19 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 33d5757..1a73c3e 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -14519,7 +14519,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api Vector3 rayEnd = end; Vector3 dir = rayEnd - rayStart; - float dist = Vector3.Mag(dir); + float dist = dir.Length(); int count = 1; bool detectPhantom = false; @@ -14581,14 +14581,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api object physresults; physresults = World.RayCastFiltered(rayStart, direction, dist, physcount, rayfilter); -/* if (physresults == null) { - list.Add(new LSL_Integer(-3)); // timeout error - return list; +// list.Add(new LSL_Integer(-3)); // timeout error +// return list; + results = new List(); } -*/ - results = (List)physresults; + else + results = (List)physresults; // for now physics doesn't detect sitted avatars so do it outside physics if (checkAgents) @@ -14609,6 +14609,28 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api foreach (ContactResult r in objectHits) results.Add(r); } + // Double check this because of current ODE distance problems + if (checkTerrain && dist > 60) + { + bool skipGroundCheck = false; + + foreach (ContactResult c in results) + { + if (c.ConsumerID == 0) // Physics gave us a ground collision + skipGroundCheck = true; + } + + if (!skipGroundCheck) + { + float tmp = dir.X * dir.X + dir.Y * dir.Y; + if(tmp > 2500) + { + ContactResult? groundContact = GroundIntersection(rayStart, rayEnd); + if (groundContact != null) + results.Add((ContactResult)groundContact); + } + } + } } else { @@ -14629,20 +14651,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api results.Add(objectHits[iter]); } } - } - - // Double check this - if (checkTerrain) - { - bool skipGroundCheck = false; - - foreach (ContactResult c in results) - { - if (c.ConsumerID == 0) // Physics gave us a ground collision - skipGroundCheck = true; - } - if (!skipGroundCheck) + if (checkTerrain) { ContactResult? groundContact = GroundIntersection(rayStart, rayEnd); if (groundContact != null) -- cgit v1.1 From d5a428c669c43d4780677556bad5b00e2d40797f Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 7 Nov 2016 11:35:32 +0000 Subject: add a few more lsl constants for attachments --- .../ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'OpenSim/Region/ScriptEngine/Shared') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs index bc4d20c..cee66b2 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs @@ -254,6 +254,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase public const int ATTACH_HUD_BOTTOM_RIGHT = 38; public const int ATTACH_NECK = 39; public const int ATTACH_AVATAR_CENTER = 40; + public const int ATTACH_LHAND_RING1 = 41; + public const int ATTACH_RHAND_RING1 = 42; + public const int ATTACH_TAIL_BASE = 43; + public const int ATTACH_TAIL_TIP = 44; + public const int ATTACH_LWING = 45; + public const int ATTACH_RWING = 46; + public const int ATTACH_FACE_JAW = 47; + public const int ATTACH_FACE_LEAR = 48; + public const int ATTACH_FACE_REAR = 49; + public const int ATTACH_FACE_LEYE = 50; + public const int ATTACH_FACE_REYE = 51; + public const int ATTACH_FACE_TONGUE = 52; + public const int ATTACH_GROIN = 53; + public const int ATTACH_HIND_LFOOT = 54; + public const int ATTACH_HIND_RFOOT = 55; #region osMessageAttachments constants -- cgit v1.1