From ef4122213c440c55d32c097c08e52170f4b4346a Mon Sep 17 00:00:00 2001 From: SignpostMarv Date: Mon, 6 Aug 2012 15:35:40 +0100 Subject: enables configurable minimum sizes for physical & non-physical prims --- .../Shared/Api/Implementation/LSL_Api.cs | 28 +++++++--------------- 1 file changed, 8 insertions(+), 20 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 55567d1..a7852ec 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -1343,31 +1343,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (part == null || part.ParentGroup.IsDeleted) return; - if (scale.x < 0.01) - scale.x = 0.01; - if (scale.y < 0.01) - scale.y = 0.01; - if (scale.z < 0.01) - scale.z = 0.01; - + // First we need to check whether or not we need to clamp the size of a physics-enabled prim PhysicsActor pa = part.ParentGroup.RootPart.PhysActor; - if (pa != null && pa.IsPhysical) { - if (scale.x > World.m_maxPhys) - scale.x = World.m_maxPhys; - if (scale.y > World.m_maxPhys) - scale.y = World.m_maxPhys; - if (scale.z > World.m_maxPhys) - scale.z = World.m_maxPhys; + scale.x = Math.Max(World.m_minPhys, Math.Min(World.m_maxPhys, scale.x)); + scale.y = Math.Max(World.m_minPhys, Math.Min(World.m_maxPhys, scale.y)); + scale.z = Math.Max(World.m_minPhys, Math.Min(World.m_maxPhys, scale.z)); } - if (scale.x > World.m_maxNonphys) - scale.x = World.m_maxNonphys; - if (scale.y > World.m_maxNonphys) - scale.y = World.m_maxNonphys; - if (scale.z > World.m_maxNonphys) - scale.z = World.m_maxNonphys; + // Next we clamp the scale to the non-physical min/max + scale.x = Math.Max(World.m_minNonphys, Math.Min(World.m_maxNonphys, scale.x)); + scale.y = Math.Max(World.m_minNonphys, Math.Min(World.m_maxNonphys, scale.y)); + scale.z = Math.Max(World.m_minNonphys, Math.Min(World.m_maxNonphys, scale.z)); Vector3 tmp = part.Scale; tmp.X = (float)scale.x; -- cgit v1.1 From e9ea911563362c4766d34cd948a2915beac06124 Mon Sep 17 00:00:00 2001 From: SignpostMarv Date: Fri, 17 Aug 2012 16:53:36 +0100 Subject: adding a clip method to handle Vector3 objects to enable a minor amount of refactoring --- .../Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index a7852ec..b7b5e8e 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -4019,9 +4019,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public void llSetText(string text, LSL_Vector color, double alpha) { m_host.AddScriptLPS(1); - Vector3 av3 = new Vector3(Util.Clip((float)color.x, 0.0f, 1.0f), - Util.Clip((float)color.y, 0.0f, 1.0f), - Util.Clip((float)color.z, 0.0f, 1.0f)); + Vector3 av3 = Util.Clip(new Vector3((float)color.x, (float)color.y, + (float)color.z), 0.0f, 1.0f); m_host.SetText(text.Length > 254 ? text.Remove(254) : text, av3, Util.Clip((float)alpha, 0.0f, 1.0f)); //m_host.ParentGroup.HasGroupChanged = true; //m_host.ParentGroup.ScheduleGroupForFullUpdate(); @@ -7635,9 +7634,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api string primText = rules.GetLSLStringItem(idx++); LSL_Vector primTextColor = rules.GetVector3Item(idx++); LSL_Float primTextAlpha = rules.GetLSLFloatItem(idx++); - Vector3 av3 = new Vector3(Util.Clip((float)primTextColor.x, 0.0f, 1.0f), - Util.Clip((float)primTextColor.y, 0.0f, 1.0f), - Util.Clip((float)primTextColor.z, 0.0f, 1.0f)); + Vector3 av3 = Util.Clip(new Vector3((float)primTextColor.x, + (float)primTextColor.y, + (float)primTextColor.z), 0.0f, 1.0f); part.SetText(primText, av3, Util.Clip((float)primTextAlpha, 0.0f, 1.0f)); break; -- cgit v1.1 From 74f5253a366cefa5222a813f4ed349db93c08acc Mon Sep 17 00:00:00 2001 From: SignpostMarv Date: Thu, 16 Aug 2012 15:32:20 +0100 Subject: attempt to handle InvalidCastException in a manner similar to Second Life --- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index b7b5e8e..255fc8e 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -7674,6 +7674,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } } } + catch (InvalidCastException e) + { + ShoutError(e.Message); + } finally { if (positionChanged) -- cgit v1.1 From 466d684fbe26b4ea24a0003120d7a875fbbca037 Mon Sep 17 00:00:00 2001 From: SignpostMarv Date: Wed, 1 Aug 2012 15:18:02 +0100 Subject: implemented --- .../ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 255fc8e..75491da 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -7666,6 +7666,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api LSL_Float gain = rules.GetLSLFloatItem(idx++); TargetOmega(part, axis, (double)spinrate, (double)gain); break; + case (int)ScriptBaseClass.PRIM_SLICE: + if (remain < 1) + return; + LSL_Vector slice = rules.GetVector3Item(idx++); + part.UpdateSlice((float)slice.x, (float)slice.y); + break; case (int)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 null; @@ -8340,6 +8346,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api case (int)ScriptBaseClass.PRIM_POS_LOCAL: res.Add(new LSL_Vector(GetPartLocalPos(part))); break; + case (int)ScriptBaseClass.PRIM_SLICE: + res.Add(new LSL_Vector( + (part.GetPrimType() == PrimType.SPHERE ? part.Shape.ProfileBegin : part.Shape.PathBegin) / 50000.0, + 1 - (part.GetPrimType() == PrimType.SPHERE ? part.Shape.ProfileEnd : part.Shape.PathEnd) / 50000.0, + 0 + )); + break; } } return res; -- cgit v1.1 From 7068fddd2fffe356869171ed67be473f7a701470 Mon Sep 17 00:00:00 2001 From: SignpostMarv Date: Thu, 2 Aug 2012 09:28:32 +0100 Subject: fixing bug that get/set the wrong property for prim types other than sphere & box --- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 75491da..31d1660 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -8347,9 +8347,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api res.Add(new LSL_Vector(GetPartLocalPos(part))); break; case (int)ScriptBaseClass.PRIM_SLICE: + PrimType prim_type = part.GetPrimType(); + bool useProfileBeginEnd = (prim_type == PrimType.SPHERE || prim_type == PrimType.TORUS || prim_type == PrimType.TUBE || prim_type == PrimType.RING); res.Add(new LSL_Vector( - (part.GetPrimType() == PrimType.SPHERE ? part.Shape.ProfileBegin : part.Shape.PathBegin) / 50000.0, - 1 - (part.GetPrimType() == PrimType.SPHERE ? part.Shape.ProfileEnd : part.Shape.PathEnd) / 50000.0, + (useProfileBeginEnd ? part.Shape.ProfileBegin : part.Shape.PathBegin) / 50000.0, + 1 - (useProfileBeginEnd ? part.Shape.ProfileEnd : part.Shape.PathEnd) / 50000.0, 0 )); break; -- cgit v1.1 From 28d0aff2e395ae3ef85586cf65bd90395eb5c895 Mon Sep 17 00:00:00 2001 From: SignpostMarv Date: Thu, 16 Aug 2012 09:35:27 +0100 Subject: adding null return to fix building --- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 31d1660..6a2b829 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -7668,7 +7668,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api break; case (int)ScriptBaseClass.PRIM_SLICE: if (remain < 1) - return; + return null; LSL_Vector slice = rules.GetVector3Item(idx++); part.UpdateSlice((float)slice.x, (float)slice.y); break; -- cgit v1.1 From 5d7751da891360c665622562f06a15e02fea4922 Mon Sep 17 00:00:00 2001 From: SignpostMarv Date: Sat, 18 Aug 2012 01:17:01 +0100 Subject: refactoring for Vector3 operator & constructor tweaks --- .../Shared/Api/Implementation/LSL_Api.cs | 107 +++++++++------------ .../Shared/Api/Implementation/LS_Api.cs | 8 +- .../Shared/Api/Implementation/MOD_Api.cs | 7 +- .../Shared/Api/Implementation/OSSL_Api.cs | 22 ++--- .../Api/Implementation/Plugins/SensorRepeat.cs | 9 +- 5 files changed, 63 insertions(+), 90 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index fceae02..bca9a75 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -1097,9 +1097,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public LSL_Float llGround(LSL_Vector offset) { m_host.AddScriptLPS(1); - Vector3 pos = m_host.GetWorldPosition() + new Vector3((float)offset.x, - (float)offset.y, - (float)offset.z); + Vector3 pos = m_host.GetWorldPosition() + (Vector3)offset; //Get the slope normal. This gives us the equation of the plane tangent to the slope. LSL_Vector vsn = llGroundNormal(offset); @@ -1387,7 +1385,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (face == ScriptBaseClass.ALL_SIDES) face = SceneObjectPart.ALL_SIDES; - m_host.SetFaceColor(new Vector3((float)color.x, (float)color.y, (float)color.z), face); + m_host.SetFaceColor(color, face); } public void SetTexGen(SceneObjectPart part, int face,int style) @@ -1974,7 +1972,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api bool sameParcel = here.GlobalID == there.GlobalID; - if (!sameParcel && !World.Permissions.CanRezObject(m_host.ParentGroup.PrimCount, m_host.ParentGroup.OwnerID, new Vector3((float)pos.x, (float)pos.y, (float)pos.z))) + if (!sameParcel && !World.Permissions.CanRezObject( + m_host.ParentGroup.PrimCount, m_host.ParentGroup.OwnerID, pos)) { return 0; } @@ -2034,13 +2033,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if ((targetPos.z < ground) && disable_underground_movement && m_host.ParentGroup.AttachmentPoint == 0) targetPos.z = ground; SceneObjectGroup parent = part.ParentGroup; - LSL_Vector real_vec = !adjust ? targetPos : SetPosAdjust(currentPos, targetPos); - parent.UpdateGroupPosition(new Vector3((float)real_vec.x, (float)real_vec.y, (float)real_vec.z)); + parent.UpdateGroupPosition(!adjust ? targetPos : + SetPosAdjust(currentPos, targetPos)); } else { - LSL_Vector rel_vec = !adjust ? targetPos : SetPosAdjust(currentPos, targetPos); - part.OffsetPosition = new Vector3((float)rel_vec.x, (float)rel_vec.y, (float)rel_vec.z); + part.OffsetPosition = !adjust ? targetPos : SetPosAdjust( + currentPos, targetPos); SceneObjectGroup parent = part.ParentGroup; parent.HasGroupChanged = true; parent.ScheduleGroupForTerseUpdate(); @@ -2084,7 +2083,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api // m_log.DebugFormat("[LSL API]: Returning {0} in GetPartLocalPos()", pos); - return new LSL_Vector(pos.X, pos.Y, pos.Z); + return new LSL_Vector(pos); } public void llSetRot(LSL_Rotation rot) @@ -2198,7 +2197,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (local != 0) force *= llGetRot(); - m_host.ParentGroup.RootPart.SetForce(new Vector3((float)force.x, (float)force.y, (float)force.z)); + m_host.ParentGroup.RootPart.SetForce(force); } } @@ -2210,10 +2209,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (!m_host.ParentGroup.IsDeleted) { - Vector3 tmpForce = m_host.ParentGroup.RootPart.GetForce(); - force.x = tmpForce.X; - force.y = tmpForce.Y; - force.z = tmpForce.Z; + force = m_host.ParentGroup.RootPart.GetForce(); } return force; @@ -2222,8 +2218,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public LSL_Integer llTarget(LSL_Vector position, double range) { m_host.AddScriptLPS(1); - return m_host.ParentGroup.registerTargetWaypoint( - new Vector3((float)position.x, (float)position.y, (float)position.z), (float)range); + return m_host.ParentGroup.registerTargetWaypoint(position, + (float)range); } public void llTargetRemove(int number) @@ -2248,7 +2244,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public void llMoveToTarget(LSL_Vector target, double tau) { m_host.AddScriptLPS(1); - m_host.MoveToTarget(new Vector3((float)target.x, (float)target.y, (float)target.z), (float)tau); + m_host.MoveToTarget(target, (float)tau); } public void llStopMoveToTarget() @@ -2261,7 +2257,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { m_host.AddScriptLPS(1); //No energy force yet - Vector3 v = new Vector3((float)force.x, (float)force.y, (float)force.z); + Vector3 v = force; if (v.Length() > 20000.0f) { v.Normalize(); @@ -2273,13 +2269,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public void llApplyRotationalImpulse(LSL_Vector force, int local) { m_host.AddScriptLPS(1); - m_host.ApplyAngularImpulse(new Vector3((float)force.x, (float)force.y, (float)force.z), local != 0); + m_host.ApplyAngularImpulse(force, local != 0); } public void llSetTorque(LSL_Vector torque, int local) { m_host.AddScriptLPS(1); - m_host.SetAngularImpulse(new Vector3((float)torque.x, (float)torque.y, (float)torque.z), local != 0); + m_host.SetAngularImpulse(torque, local != 0); } public LSL_Vector llGetTorque() @@ -2830,13 +2826,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return; } - Vector3 llpos = new Vector3((float)pos.x, (float)pos.y, (float)pos.z); - Vector3 llvel = new Vector3((float)vel.x, (float)vel.y, (float)vel.z); - // need the magnitude later // float velmag = (float)Util.GetMagnitude(llvel); - SceneObjectGroup new_group = World.RezObject(m_host, item, llpos, Rot2Quaternion(rot), llvel, param); + SceneObjectGroup new_group = World.RezObject(m_host, item, pos, Rot2Quaternion(rot), vel, param); // If either of these are null, then there was an unknown error. if (new_group == null) @@ -2857,10 +2850,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api PhysicsActor pa = new_group.RootPart.PhysActor; - if (pa != null && pa.IsPhysical && llvel != Vector3.Zero) + if (pa != null && pa.IsPhysical && (Vector3)vel != Vector3.Zero) { //Recoil. - llApplyImpulse(new LSL_Vector(llvel.X * groupmass, llvel.Y * groupmass, llvel.Z * groupmass), 0); + llApplyImpulse(vel * groupmass, 0); } // Variable script delay? (see (http://wiki.secondlife.com/wiki/LSL_Delay) }); @@ -3381,7 +3374,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api protected void TargetOmega(SceneObjectPart part, LSL_Vector axis, double spinrate, double gain) { - part.UpdateAngularVelocity(new Vector3((float)(axis.x * spinrate), (float)(axis.y * spinrate), (float)(axis.z * spinrate))); + part.UpdateAngularVelocity(axis * spinrate); } public LSL_Integer llGetStartParameter() @@ -3588,7 +3581,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api List parts = GetLinkParts(linknumber); foreach (SceneObjectPart part in parts) - part.SetFaceColor(new Vector3((float)color.x, (float)color.y, (float)color.z), face); + part.SetFaceColor(color, face); } public void llCreateLink(string target, int parent) @@ -4019,8 +4012,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public void llSetText(string text, LSL_Vector color, double alpha) { m_host.AddScriptLPS(1); - Vector3 av3 = Util.Clip(new Vector3((float)color.x, (float)color.y, - (float)color.z), 0.0f, 1.0f); + Vector3 av3 = Util.Clip(color, 0.0f, 1.0f); m_host.SetText(text.Length > 254 ? text.Remove(254) : text, av3, Util.Clip((float)alpha, 0.0f, 1.0f)); //m_host.ParentGroup.HasGroupChanged = true; //m_host.ParentGroup.ScheduleGroupForFullUpdate(); @@ -4217,14 +4209,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api ScriptSleep(5000); } - public void llTeleportAgent(string agent, string destination, LSL_Vector pos, LSL_Vector lookAt) + public void llTeleportAgent(string agent, string destination, LSL_Vector targetPos, LSL_Vector targetLookAt) { m_host.AddScriptLPS(1); UUID agentId = new UUID(); - Vector3 targetPos = new Vector3((float)pos.x, (float)pos.y, (float)pos.z); - Vector3 targetLookAt = new Vector3((float)lookAt.x, (float)lookAt.y, (float)lookAt.z); - if (UUID.TryParse(agent, out agentId)) { ScenePresence presence = World.GetScenePresence(agentId); @@ -4253,15 +4242,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } } - public void llTeleportAgentGlobalCoords(string agent, LSL_Vector global_coords, LSL_Vector pos, LSL_Vector lookAt) + public void llTeleportAgentGlobalCoords(string agent, LSL_Vector global_coords, LSL_Vector targetPos, LSL_Vector targetLookAt) { m_host.AddScriptLPS(1); UUID agentId = new UUID(); ulong regionHandle = Utils.UIntsToLong((uint)global_coords.x, (uint)global_coords.y); - Vector3 targetPos = new Vector3((float)pos.x, (float)pos.y, (float)pos.z); - Vector3 targetLookAt = new Vector3((float)lookAt.x, (float)lookAt.y, (float)lookAt.z); if (UUID.TryParse(agent, out agentId)) { ScenePresence presence = World.GetScenePresence(agentId); @@ -4545,7 +4532,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api distance_attenuation = 1f / normalized_units; } - Vector3 applied_linear_impulse = new Vector3((float)impulse.x, (float)impulse.y, (float)impulse.z); + Vector3 applied_linear_impulse = impulse; { float impulse_length = applied_linear_impulse.Length(); @@ -6044,9 +6031,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api //Plug the x,y coordinates of the slope normal into the equation of the plane to get //the height of that point on the plane. The resulting vector gives the slope. - Vector3 vsl = new Vector3(); - vsl.X = (float)vsn.x; - vsl.Y = (float)vsn.y; + Vector3 vsl = vsn; vsl.Z = (float)(((vsn.x * vsn.x) + (vsn.y * vsn.y)) / (-1 * vsn.z)); vsl.Normalize(); //Normalization might be overkill here @@ -6057,9 +6042,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public LSL_Vector llGroundNormal(LSL_Vector offset) { m_host.AddScriptLPS(1); - Vector3 pos = m_host.GetWorldPosition() + new Vector3((float)offset.x, - (float)offset.y, - (float)offset.z); + Vector3 pos = m_host.GetWorldPosition() + (Vector3)offset; // Clamp to valid position if (pos.X < 0) pos.X = 0; @@ -6512,8 +6495,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (!m_host.ParentGroup.IsDeleted) { - m_host.ParentGroup.RootPart.SetVehicleVectorParam(param, - new Vector3((float)vec.x, (float)vec.y, (float)vec.z)); + m_host.ParentGroup.RootPart.SetVehicleVectorParam(param, vec); } } @@ -6555,7 +6537,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (rot.s == 0 && rot.x == 0 && rot.y == 0 && rot.z == 0) rot.z = 1; // ZERO_ROTATION = 0,0,0,1 - part.SitTargetPosition = new Vector3((float)offset.x, (float)offset.y, (float)offset.z); + part.SitTargetPosition = offset; part.SitTargetOrientation = Rot2Quaternion(rot); part.ParentGroup.HasGroupChanged = true; } @@ -6659,13 +6641,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public void llSetCameraEyeOffset(LSL_Vector offset) { m_host.AddScriptLPS(1); - m_host.SetCameraEyeOffset(new Vector3((float)offset.x, (float)offset.y, (float)offset.z)); + m_host.SetCameraEyeOffset(offset); } public void llSetCameraAtOffset(LSL_Vector offset) { m_host.AddScriptLPS(1); - m_host.SetCameraAtOffset(new Vector3((float)offset.x, (float)offset.y, (float)offset.z)); + m_host.SetCameraAtOffset(offset); } public LSL_String llDumpList2String(LSL_List src, string seperator) @@ -6687,7 +6669,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public LSL_Integer llScriptDanger(LSL_Vector pos) { m_host.AddScriptLPS(1); - bool result = World.ScriptDanger(m_host.LocalId, new Vector3((float)pos.x, (float)pos.y, (float)pos.z)); + bool result = World.ScriptDanger(m_host.LocalId, pos); if (result) { return 1; @@ -7515,7 +7497,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api LSL_Vector color=rules.GetVector3Item(idx++); double alpha=(double)rules.GetLSLFloatItem(idx++); - part.SetFaceColor(new Vector3((float)color.x, (float)color.y, (float)color.z), face); + part.SetFaceColor(color, face); SetAlpha(part, alpha, face); break; @@ -7634,9 +7616,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api string primText = rules.GetLSLStringItem(idx++); LSL_Vector primTextColor = rules.GetVector3Item(idx++); LSL_Float primTextAlpha = rules.GetLSLFloatItem(idx++); - Vector3 av3 = Util.Clip(new Vector3((float)primTextColor.x, - (float)primTextColor.y, - (float)primTextColor.z), 0.0f, 1.0f); + Vector3 av3 = Util.Clip(primTextColor, 0.0f, 1.0f); part.SetText(primText, av3, Util.Clip((float)primTextAlpha, 0.0f, 1.0f)); break; @@ -7691,11 +7671,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (part.ParentGroup.RootPart == part) { SceneObjectGroup parent = part.ParentGroup; - parent.UpdateGroupPosition(new Vector3((float)currentPosition.x, (float)currentPosition.y, (float)currentPosition.z)); + parent.UpdateGroupPosition(currentPosition); } else { - part.OffsetPosition = new Vector3((float)currentPosition.x, (float)currentPosition.y, (float)currentPosition.z); + part.OffsetPosition = currentPosition; SceneObjectGroup parent = part.ParentGroup; parent.HasGroupChanged = true; parent.ScheduleGroupForTerseUpdate(); @@ -7932,8 +7912,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (part != null) { Vector3 halfSize = part.Scale / 2.0f; - LSL_Vector lower = new LSL_Vector(halfSize.X * -1.0f, halfSize.Y * -1.0f, halfSize.Z * -1.0f); - LSL_Vector upper = new LSL_Vector(halfSize.X, halfSize.Y, halfSize.Z); + LSL_Vector lower = (new LSL_Vector(halfSize)) * -1.0f; + LSL_Vector upper = new LSL_Vector(halfSize); result.Add(lower); result.Add(upper); return result; @@ -9943,9 +9923,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api ScenePresence avatar = World.GetScenePresence(detectedParams.Key); if (avatar != null) { - avatar.ControllingClient.SendScriptTeleportRequest(m_host.Name, simname, - new Vector3((float)pos.x, (float)pos.y, (float)pos.z), - new Vector3((float)lookAt.x, (float)lookAt.y, (float)lookAt.z)); + avatar.ControllingClient.SendScriptTeleportRequest(m_host.Name, + simname, pos, lookAt); } ScriptSleep(1000); } @@ -11143,8 +11122,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api m_host.AddScriptLPS(1); - Vector3 rayStart = new Vector3((float)start.x, (float)start.y, (float)start.z); - Vector3 rayEnd = new Vector3((float)end.x, (float)end.y, (float)end.z); + Vector3 rayStart = start; + Vector3 rayEnd = end; Vector3 dir = rayEnd - rayStart; float dist = Vector3.Mag(dir); diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs index 795de80..ceb4660 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs @@ -304,7 +304,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api case (int)ScriptBaseClass.WL_CLOUD_DETAIL_XY_DENSITY: idx++; iV = rules.GetVector3Item(idx); - wl.cloudDetailXYDensity = new Vector3((float)iV.x, (float)iV.y, (float)iV.z); + wl.cloudDetailXYDensity = iV; break; case (int)ScriptBaseClass.WL_CLOUD_SCALE: idx++; @@ -329,7 +329,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api case (int)ScriptBaseClass.WL_CLOUD_XY_DENSITY: idx++; iV = rules.GetVector3Item(idx); - wl.cloudXYDensity = new Vector3((float)iV.x, (float)iV.y, (float)iV.z); + wl.cloudXYDensity = iV; break; case (int)ScriptBaseClass.WL_DENSITY_MULTIPLIER: idx++; @@ -384,7 +384,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api case (int)ScriptBaseClass.WL_REFLECTION_WAVELET_SCALE: idx++; iV = rules.GetVector3Item(idx); - wl.reflectionWaveletScale = new Vector3((float)iV.x, (float)iV.y, (float)iV.z); + wl.reflectionWaveletScale = iV; break; case (int)ScriptBaseClass.WL_REFRACT_SCALE_ABOVE: idx++; @@ -422,7 +422,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api case (int)ScriptBaseClass.WL_WATER_COLOR: idx++; iV = rules.GetVector3Item(idx); - wl.waterColor = new Vector3((float)iV.x, (float)iV.y, (float)iV.z); + wl.waterColor = iV; break; case (int)ScriptBaseClass.WL_WATER_FOG_DENSITY_EXPONENT: idx++; diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs index 7844c75..929948b 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs @@ -343,8 +343,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { if (type == typeof(OpenMetaverse.Vector3)) { - LSL_Vector vect = (LSL_Vector)lslparm; - return new OpenMetaverse.Vector3((float)vect.x,(float)vect.y,(float)vect.z); + return (OpenMetaverse.Vector3)((LSL_Vector)lslparm); } } @@ -372,8 +371,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } else if (plist[i] is LSL_Vector) { - LSL_Vector vect = (LSL_Vector)plist[i]; - result[i] = new OpenMetaverse.Vector3((float)vect.x,(float)vect.y,(float)vect.z); + result[i] = (OpenMetaverse.Vector3)( + (LSL_Vector)plist[i]); } else MODError("unknown LSL list element type"); diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 859ee93..eff1598 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -773,10 +773,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api // We will launch the teleport on a new thread so that when the script threads are terminated // before teleport in ScriptInstance.GetXMLState(), we don't end up aborting the one doing the teleporting. - Util.FireAndForget( - o => World.RequestTeleportLocation(presence.ControllingClient, regionName, - new Vector3((float)position.x, (float)position.y, (float)position.z), - new Vector3((float)lookat.x, (float)lookat.y, (float)lookat.z), (uint)TPFlags.ViaLocation)); + Util.FireAndForget(o => World.RequestTeleportLocation( + presence.ControllingClient, regionName, position, + lookat, (uint)TPFlags.ViaLocation)); ScriptSleep(5000); @@ -819,10 +818,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api // We will launch the teleport on a new thread so that when the script threads are terminated // before teleport in ScriptInstance.GetXMLState(), we don't end up aborting the one doing the teleporting. - Util.FireAndForget( - o => World.RequestTeleportLocation(presence.ControllingClient, regionHandle, - new Vector3((float)position.x, (float)position.y, (float)position.z), - new Vector3((float)lookat.x, (float)lookat.y, (float)lookat.z), (uint)TPFlags.ViaLocation)); + Util.FireAndForget(o => World.RequestTeleportLocation( + presence.ControllingClient, regionHandle, + position, lookat, (uint)TPFlags.ViaLocation)); ScriptSleep(5000); @@ -2329,7 +2327,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api ownerID = m_host.OwnerID; UUID x = module.CreateNPC(firstname, lastname, - new Vector3((float) position.x, (float) position.y, (float) position.z), + position, ownerID, senseAsAgent, World, @@ -2446,7 +2444,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return new LSL_Vector(0, 0, 0); } - public void osNpcMoveTo(LSL_Key npc, LSL_Vector position) + public void osNpcMoveTo(LSL_Key npc, LSL_Vector pos) { CheckThreatLevel(ThreatLevel.High, "osNpcMoveTo"); m_host.AddScriptLPS(1); @@ -2461,7 +2459,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (!module.CheckPermissions(npcId, m_host.OwnerID)) return; - Vector3 pos = new Vector3((float) position.x, (float) position.y, (float) position.z); module.MoveToTarget(npcId, World, pos, false, true, false); } } @@ -2481,11 +2478,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (!module.CheckPermissions(npcId, m_host.OwnerID)) return; - Vector3 pos = new Vector3((float)target.x, (float)target.y, (float)target.z); module.MoveToTarget( new UUID(npc.m_string), World, - pos, + target, (options & ScriptBaseClass.OS_NPC_NO_FLY) != 0, (options & ScriptBaseClass.OS_NPC_LAND_AT_TARGET) != 0, (options & ScriptBaseClass.OS_NPC_RUNNING) != 0); diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs index a626be8..7162226 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs @@ -428,9 +428,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins try { Vector3 diff = toRegionPos - fromRegionPos; - LSL_Types.Vector3 obj_dir = new LSL_Types.Vector3(diff.X, diff.Y, diff.Z); - double dot = LSL_Types.Vector3.Dot(forward_dir, obj_dir); - double mag_obj = LSL_Types.Vector3.Mag(obj_dir); + double dot = LSL_Types.Vector3.Dot(forward_dir, diff); + double mag_obj = LSL_Types.Vector3.Mag(diff); ang_obj = Math.Acos(dot / (mag_fwd * mag_obj)); } catch @@ -560,8 +559,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins double ang_obj = 0; try { - Vector3 diff = toRegionPos - fromRegionPos; - LSL_Types.Vector3 obj_dir = new LSL_Types.Vector3(diff.X, diff.Y, diff.Z); + LSL_Types.Vector3 obj_dir = new LSL_Types.Vector3( + toRegionPos - fromRegionPos); double dot = LSL_Types.Vector3.Dot(forward_dir, obj_dir); double mag_obj = LSL_Types.Vector3.Mag(obj_dir); ang_obj = Math.Acos(dot / (mag_fwd * mag_obj)); -- cgit v1.1 From 2a70afeca2a1ba452660ee2669aa4033a91143bb Mon Sep 17 00:00:00 2001 From: Melanie Date: Sat, 18 Aug 2012 14:00:10 +0100 Subject: Fix the whitespace formatting error introduced by the last patch --- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index bca9a75..7671e54 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -2038,8 +2038,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } else { - part.OffsetPosition = !adjust ? targetPos : SetPosAdjust( - currentPos, targetPos); + part.OffsetPosition = !adjust ? targetPos : + SetPosAdjust(currentPos, targetPos); SceneObjectGroup parent = part.ParentGroup; parent.HasGroupChanged = true; parent.ScheduleGroupForTerseUpdate(); -- cgit v1.1 From 52d7af05bcc5141eef42115e0ac5bca53163717f Mon Sep 17 00:00:00 2001 From: SignpostMarv Date: Sat, 18 Aug 2012 14:54:13 +0100 Subject: adding missing refactor for LSL_Vector --- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 7671e54..4d542d50 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -10536,7 +10536,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } break; case ScriptBaseClass.OBJECT_VELOCITY: - ret.Add(new LSL_Vector(obj.Velocity.X, obj.Velocity.Y, obj.Velocity.Z)); + ret.Add(new LSL_Vector(obj.Velocity)); break; case ScriptBaseClass.OBJECT_OWNER: ret.Add(new LSL_String(obj.OwnerID.ToString())); -- cgit v1.1 From fb84ff96a9ac7df564fb8f8242e0ff0d2638b438 Mon Sep 17 00:00:00 2001 From: SignpostMarv Date: Sat, 18 Aug 2012 15:04:07 +0100 Subject: implicit operators mean one does not need to instantiate new objects manually --- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 5 ++--- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs | 7 +++---- 2 files changed, 5 insertions(+), 7 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 4d542d50..87298e3 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -2231,8 +2231,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public LSL_Integer llRotTarget(LSL_Rotation rot, double error) { m_host.AddScriptLPS(1); - return m_host.ParentGroup.registerRotTargetWaypoint( - new Quaternion((float)rot.x, (float)rot.y, (float)rot.z, (float)rot.s), (float)error); + return m_host.ParentGroup.registerRotTargetWaypoint(rot, (float)error); } public void llRotTargetRemove(int number) @@ -10531,7 +10530,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api else rot = obj.GetWorldRotation(); - LSL_Rotation objrot = new LSL_Rotation(rot.X, rot.Y, rot.Z, rot.W); + LSL_Rotation objrot = new LSL_Rotation(rot); ret.Add(objrot); } break; diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs index 929948b..84cf6ca 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs @@ -333,8 +333,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { if (type == typeof(OpenMetaverse.Quaternion)) { - LSL_Rotation rot = (LSL_Rotation)lslparm; - return new OpenMetaverse.Quaternion((float)rot.x,(float)rot.y,(float)rot.z,(float)rot.s); + return (OpenMetaverse.Quaternion)((LSL_Rotation)lslparm); } } @@ -366,8 +365,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api result[i] = new UUID((LSL_Key)plist[i]); else if (plist[i] is LSL_Rotation) { - LSL_Rotation rot = (LSL_Rotation)plist[i]; - result[i] = new OpenMetaverse.Quaternion((float)rot.x,(float)rot.y,(float)rot.z,(float)rot.s); + result[i] = (OpenMetaverse.Quaternion)( + (LSL_Rotation)plist[i]); } else if (plist[i] is LSL_Vector) { -- cgit v1.1 From ffdde05bb7d3d2ca71807c3197411bf66c29aa45 Mon Sep 17 00:00:00 2001 From: SignpostMarv Date: Sat, 18 Aug 2012 15:10:44 +0100 Subject: constructor means not having to manually refer to individual properties --- .../ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs index 7162226..24cceea 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs @@ -351,7 +351,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins q = avatar.Rotation * q; } - LSL_Types.Quaternion r = new LSL_Types.Quaternion(q.X, q.Y, q.Z, q.W); + LSL_Types.Quaternion r = new LSL_Types.Quaternion(q); LSL_Types.Vector3 forward_dir = (new LSL_Types.Vector3(1, 0, 0) * r); double mag_fwd = LSL_Types.Vector3.Mag(forward_dir); @@ -478,7 +478,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins q = avatar.Rotation * q; } - LSL_Types.Quaternion r = new LSL_Types.Quaternion(q.X, q.Y, q.Z, q.W); + LSL_Types.Quaternion r = new LSL_Types.Quaternion(q); LSL_Types.Vector3 forward_dir = (new LSL_Types.Vector3(1, 0, 0) * r); double mag_fwd = LSL_Types.Vector3.Mag(forward_dir); bool attached = (SensePoint.ParentGroup.AttachmentPoint != 0); -- cgit v1.1 From ca33619e11d6b370793ffd70dd8a0baefa88f5d1 Mon Sep 17 00:00:00 2001 From: SignpostMarv Date: Sat, 18 Aug 2012 15:18:31 +0100 Subject: Rot2Quaternion is now redundant --- .../Shared/Api/Implementation/LSL_Api.cs | 21 ++++++++++----------- .../Shared/Api/Implementation/OSSL_Api.cs | 2 +- 2 files changed, 11 insertions(+), 12 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 87298e3..7009548 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -2094,7 +2094,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (m_host.ParentID == 0) { // special case: If we are root, rotate complete SOG to new rotation - SetRot(m_host, Rot2Quaternion(rot)); + SetRot(m_host, rot); } else { @@ -2102,7 +2102,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api SceneObjectPart rootPart = m_host.ParentGroup.RootPart; if (rootPart != null) // better safe than sorry { - SetRot(m_host, rootPart.RotationOffset * Rot2Quaternion(rot)); + SetRot(m_host, rootPart.RotationOffset * (Quaternion)rot); } } @@ -2112,7 +2112,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public void llSetLocalRot(LSL_Rotation rot) { m_host.AddScriptLPS(1); - SetRot(m_host, Rot2Quaternion(rot)); + SetRot(m_host, rot); ScriptSleep(200); } @@ -2828,7 +2828,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api // need the magnitude later // float velmag = (float)Util.GetMagnitude(llvel); - SceneObjectGroup new_group = World.RezObject(m_host, item, pos, Rot2Quaternion(rot), vel, param); + SceneObjectGroup new_group = World.RezObject(m_host, item, pos, rot, vel, param); // If either of these are null, then there was an unknown error. if (new_group == null) @@ -2897,7 +2897,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } else { - m_host.StartLookAt(Rot2Quaternion(rot), (float)strength, (float)damping); + m_host.StartLookAt(rot, (float)strength, (float)damping); } } @@ -3292,7 +3292,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } else { - m_host.RotLookAt(Rot2Quaternion(target), (float)strength, (float)damping); + m_host.RotLookAt(target, (float)strength, (float)damping); } } @@ -6506,7 +6506,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (!m_host.ParentGroup.IsDeleted) { - m_host.ParentGroup.RootPart.SetVehicleRotationParam(param, Rot2Quaternion(rot)); + m_host.ParentGroup.RootPart.SetVehicleRotationParam(param, rot); } } @@ -7316,13 +7316,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (part.ParentID == 0) { // special case: If we are root, rotate complete SOG to new rotation - SetRot(part, Rot2Quaternion(q)); + SetRot(part, q); } else { // we are a child. The rotation values will be set to the one of root modified by rot, as in SL. Don't ask. SceneObjectPart rootPart = part.ParentGroup.RootPart; - SetRot(part, rootPart.RotationOffset * Rot2Quaternion(q)); + SetRot(part, rootPart.RotationOffset * (Quaternion)q); } break; @@ -7634,8 +7634,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api case (int)ScriptBaseClass.PRIM_ROT_LOCAL: if (remain < 1) return null; - LSL_Rotation lr = rules.GetQuaternionItem(idx++); - SetRot(part, Rot2Quaternion(lr)); + SetRot(part, rules.GetQuaternionItem(idx++)); break; case (int)ScriptBaseClass.PRIM_OMEGA: if (remain < 3) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index eff1598..8936cb2 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -2533,7 +2533,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api ScenePresence sp = World.GetScenePresence(npcId); if (sp != null) - sp.Rotation = LSL_Api.Rot2Quaternion(rotation); + sp.Rotation = rotation; } } -- cgit v1.1 From d72d59905668d881c98f35c7f0c9783d6744084d Mon Sep 17 00:00:00 2001 From: SignpostMarv Date: Sat, 18 Aug 2012 15:19:15 +0100 Subject: integrating redundant code into operator --- .../ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 7009548..4645e7a 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -330,14 +330,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return key; } - // convert a LSL_Rotation to a Quaternion - public static Quaternion Rot2Quaternion(LSL_Rotation r) - { - Quaternion q = new Quaternion((float)r.x, (float)r.y, (float)r.z, (float)r.s); - q.Normalize(); - return q; - } - //These are the implementations of the various ll-functions used by the LSL scripts. public LSL_Float llSin(double f) { @@ -6532,12 +6524,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api protected void SitTarget(SceneObjectPart part, LSL_Vector offset, LSL_Rotation rot) { - // LSL quaternions can normalize to 0, normal Quaternions can't. - if (rot.s == 0 && rot.x == 0 && rot.y == 0 && rot.z == 0) - rot.z = 1; // ZERO_ROTATION = 0,0,0,1 - part.SitTargetPosition = offset; - part.SitTargetOrientation = Rot2Quaternion(rot); + part.SitTargetOrientation = rot; part.ParentGroup.HasGroupChanged = true; } -- cgit v1.1 From bcbd450fe441e94d6c0f547055b4e95f75a5b0d0 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Mon, 20 Aug 2012 20:24:54 +0100 Subject: Add --force flag to "kick user" console command to allow bypassing of recent race condition checks. This is to allow a second attempt to remove an avatar even if "show connections" shows them as already inactive (i.e. close has already been attempted once). You should only attempt --force if a normal kick fails. This is partly for diagnostics as we have seen some connections occasionally remain on lbsa plaza even if they are registered as inactive. This is not a permanent solution and may not work anyway - the ultimate solution is to stop this problem from happening in the first place. --- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 8936cb2..1e8b51b 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -2877,7 +2877,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api avatar.SpeedModifier = (float)SpeedModifier; } - public void osKickAvatar(string FirstName,string SurName,string alert) + public void osKickAvatar(string FirstName, string SurName, string alert) { CheckThreatLevel(ThreatLevel.Severe, "osKickAvatar"); m_host.AddScriptLPS(1); @@ -2891,7 +2891,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api sp.ControllingClient.Kick(alert); // ...and close on our side - sp.Scene.IncomingCloseAgent(sp.UUID); + sp.Scene.IncomingCloseAgent(sp.UUID, false); } }); } -- cgit v1.1 From b863a15a820be7c3b86b27ef24944d6a85fa5360 Mon Sep 17 00:00:00 2001 From: SignpostMarv Date: Fri, 17 Aug 2012 15:09:52 +0100 Subject: single operation for PRIM_COLOR --- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 4645e7a..dbbfbd3 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -7484,8 +7484,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api LSL_Vector color=rules.GetVector3Item(idx++); double alpha=(double)rules.GetLSLFloatItem(idx++); - part.SetFaceColor(color, face); - SetAlpha(part, alpha, face); + part.SetFaceColorAlpha(face, new Vector3((float)color.x, (float)color.y, (float)color.z), alpha); break; -- cgit v1.1 From ede3b9ab07dc1ed4a51684b7257cbb4d76e9bdfd Mon Sep 17 00:00:00 2001 From: SignpostMarv Date: Mon, 20 Aug 2012 09:26:26 +0100 Subject: making use of implicit operators and Util.Clip handling of Vector3 --- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index dbbfbd3..0cbb317 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -7484,7 +7484,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api LSL_Vector color=rules.GetVector3Item(idx++); double alpha=(double)rules.GetLSLFloatItem(idx++); - part.SetFaceColorAlpha(face, new Vector3((float)color.x, (float)color.y, (float)color.z), alpha); + part.SetFaceColorAlpha(face, color, alpha); break; -- cgit v1.1 From 481c00f50a1961ac77e800d64a68e9c30a4b69de Mon Sep 17 00:00:00 2001 From: SignpostMarv Date: Mon, 20 Aug 2012 09:31:29 +0100 Subject: refactoring out SetFaceColor --- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 0cbb317..8140416 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -1377,7 +1377,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (face == ScriptBaseClass.ALL_SIDES) face = SceneObjectPart.ALL_SIDES; - m_host.SetFaceColor(color, face); + m_host.SetFaceColorAlpha(face, color, null); } public void SetTexGen(SceneObjectPart part, int face,int style) @@ -3572,7 +3572,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api List parts = GetLinkParts(linknumber); foreach (SceneObjectPart part in parts) - part.SetFaceColor(color, face); + part.SetFaceColorAlpha(face, color, null); } public void llCreateLink(string target, int parent) -- cgit v1.1 From 4820dfd733a5b6dae54e120cfb1486643765bb3e Mon Sep 17 00:00:00 2001 From: SignpostMarv Date: Tue, 21 Aug 2012 12:30:47 +0100 Subject: this should be an if-else block in case the non-phys min/max are smaller than the physical min/max --- .../Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 8140416..0d275f7 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -1341,11 +1341,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api scale.y = Math.Max(World.m_minPhys, Math.Min(World.m_maxPhys, scale.y)); scale.z = Math.Max(World.m_minPhys, Math.Min(World.m_maxPhys, scale.z)); } - - // Next we clamp the scale to the non-physical min/max - scale.x = Math.Max(World.m_minNonphys, Math.Min(World.m_maxNonphys, scale.x)); - scale.y = Math.Max(World.m_minNonphys, Math.Min(World.m_maxNonphys, scale.y)); - scale.z = Math.Max(World.m_minNonphys, Math.Min(World.m_maxNonphys, scale.z)); + else + { + // If not physical, then we clamp the scale to the non-physical min/max + scale.x = Math.Max(World.m_minNonphys, Math.Min(World.m_maxNonphys, scale.x)); + scale.y = Math.Max(World.m_minNonphys, Math.Min(World.m_maxNonphys, scale.y)); + scale.z = Math.Max(World.m_minNonphys, Math.Min(World.m_maxNonphys, scale.z)); + } Vector3 tmp = part.Scale; tmp.X = (float)scale.x; -- cgit v1.1 From 4f3fabae5bec8a71f9953ef9f4c247e086e4757f Mon Sep 17 00:00:00 2001 From: TBG Renfold Date: Thu, 9 Aug 2012 18:03:26 +0100 Subject: Adds osGetHealth. Returns the amount of health (in an integer) that an avatar has left in the scene. If an avatar is not found or safe is enabled on a region, -1 is returned. Example usage: default { touch_end(integer _t) { key agentID = llDetectedKey(0); osCauseDamage(agentID, 50); llSay(0, llKey2Name(agentID) + " has " + (string)osGetHealth(agentID) + "% health left."); } } --- .../Shared/Api/Implementation/OSSL_Api.cs | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 1e8b51b..3d233d7 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -2895,6 +2895,27 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } }); } + + public LSL_Float osGetHealth(string avatar) + { + CheckThreatLevel(ThreatLevel.None, "osGetHealth"); + m_host.AddScriptLPS(1); + + UUID avatarId = new UUID(avatar); + Vector3 pos = m_host.GetWorldPosition(); + + LSL_Float health = new LSL_Float(-1); + ScenePresence presence = World.GetScenePresence(avatarId); + if (presence != null) + { + LandData land = World.GetLandData((float)pos.X, (float)pos.Y); + if ((land.Flags & (uint)ParcelFlags.AllowDamage) == (uint)ParcelFlags.AllowDamage) + { + health = presence.Health; + } + } + return health; + } public void osCauseDamage(string avatar, double damage) { -- cgit v1.1 From a3cbda0d74a14c05acf04adaaa5b9ff30c6d9fa5 Mon Sep 17 00:00:00 2001 From: TBG Renfold Date: Fri, 10 Aug 2012 01:29:41 +0100 Subject: Removed land checking as suggested by SignpostMarv. Now whatever remaining health the avatar has is displayed (float). This will be 100% (100.000000) if no damage has occurred (as what the viewer should really be seeing anyway). Returns -1.000000 if the avatar is not found. --- .../ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 3d233d7..5e7c2d9 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -2901,19 +2901,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api CheckThreatLevel(ThreatLevel.None, "osGetHealth"); m_host.AddScriptLPS(1); - UUID avatarId = new UUID(avatar); - Vector3 pos = m_host.GetWorldPosition(); - LSL_Float health = new LSL_Float(-1); - ScenePresence presence = World.GetScenePresence(avatarId); - if (presence != null) - { - LandData land = World.GetLandData((float)pos.X, (float)pos.Y); - if ((land.Flags & (uint)ParcelFlags.AllowDamage) == (uint)ParcelFlags.AllowDamage) - { - health = presence.Health; - } - } + ScenePresence presence = World.GetScenePresence(new UUID(avatar)); + if (presence != null) health = presence.Health; return health; } -- cgit v1.1 From 2ad9d656b3a1a0c519c9599d7680f98eba7e82b8 Mon Sep 17 00:00:00 2001 From: SignpostMarv Date: Fri, 10 Aug 2012 15:58:29 +0100 Subject: implementing function to allow scripts to self-replicate as if the owner duplicated them, using the same script delay as llRezObject() --- .../Shared/Api/Implementation/OSSL_Api.cs | 50 ++++++++++++++++++++++ 1 file changed, 50 insertions(+) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 5e7c2d9..119c2ac 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -3344,5 +3344,55 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return new LSL_Key(m_host.ParentGroup.FromPartID.ToString()); } + + public void osRezDuplicate(LSL_Vector offset, LSL_Rotation rot) + { + CheckThreatLevel(ThreatLevel.High, "osRezDuplicate"); + m_host.AddScriptLPS(1); + + Vector3 v = new Vector3((float)offset.x, (float)offset.y, (float)offset.z); + Quaternion r = new Quaternion( + (float)rot.x, + (float)rot.y, + (float)rot.z, + (float)rot.s + ); + + Vector3 destination = m_host.ParentGroup.AbsolutePosition + v; + + if (!World.Permissions.CanRezObject( + m_host.ParentGroup.PrimCount, + m_host.OwnerID, + destination + )) + { + OSSLShoutError("Cannot duplicate object to destination, owner cannot rez objects at destination parcel."); + + ScriptSleep(100); + } + else + { + SceneObjectGroup duplicate = World.SceneGraph.DuplicateObject( + m_host.ParentGroup.LocalId, + v, + m_host.ParentGroup.RootPart.GetEffectiveObjectFlags(), + m_host.OwnerID, + m_host.GroupID, + r + ); + + m_ScriptEngine.PostObjectEvent(m_host.LocalId, new EventParams( + "object_rez", new Object[] { + new LSL_String( + duplicate.RootPart.UUID.ToString()) }, + new DetectParams[0])); + + ScriptSleep(100); + m_ScriptEngine.PostObjectEvent(duplicate.LocalId, new EventParams( + "on_rez", new Object[]{ + new LSL_Integer(0)}, + new DetectParams[0])); + } + } } } \ No newline at end of file -- cgit v1.1 From a08687aef35079f6c2884d3ae6fd8307ca8a6b0d Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 24 Aug 2012 01:18:35 +0100 Subject: Revert "implementing function to allow scripts to self-replicate as if the owner duplicated them, using the same script delay as llRezObject()" This reverts commit 2ad9d656b3a1a0c519c9599d7680f98eba7e82b8. Reverted pending consideration of associated issues. --- .../Shared/Api/Implementation/OSSL_Api.cs | 50 ---------------------- 1 file changed, 50 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 119c2ac..5e7c2d9 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -3344,55 +3344,5 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return new LSL_Key(m_host.ParentGroup.FromPartID.ToString()); } - - public void osRezDuplicate(LSL_Vector offset, LSL_Rotation rot) - { - CheckThreatLevel(ThreatLevel.High, "osRezDuplicate"); - m_host.AddScriptLPS(1); - - Vector3 v = new Vector3((float)offset.x, (float)offset.y, (float)offset.z); - Quaternion r = new Quaternion( - (float)rot.x, - (float)rot.y, - (float)rot.z, - (float)rot.s - ); - - Vector3 destination = m_host.ParentGroup.AbsolutePosition + v; - - if (!World.Permissions.CanRezObject( - m_host.ParentGroup.PrimCount, - m_host.OwnerID, - destination - )) - { - OSSLShoutError("Cannot duplicate object to destination, owner cannot rez objects at destination parcel."); - - ScriptSleep(100); - } - else - { - SceneObjectGroup duplicate = World.SceneGraph.DuplicateObject( - m_host.ParentGroup.LocalId, - v, - m_host.ParentGroup.RootPart.GetEffectiveObjectFlags(), - m_host.OwnerID, - m_host.GroupID, - r - ); - - m_ScriptEngine.PostObjectEvent(m_host.LocalId, new EventParams( - "object_rez", new Object[] { - new LSL_String( - duplicate.RootPart.UUID.ToString()) }, - new DetectParams[0])); - - ScriptSleep(100); - m_ScriptEngine.PostObjectEvent(duplicate.LocalId, new EventParams( - "on_rez", new Object[]{ - new LSL_Integer(0)}, - new DetectParams[0])); - } - } } } \ No newline at end of file -- cgit v1.1 From d188272462f2c8d3e67aead26bb5b15ab243cdab Mon Sep 17 00:00:00 2001 From: SignpostMarv Date: Fri, 24 Aug 2012 13:52:30 +0100 Subject: refactoring using List.ConvertAll --- .../Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 0d275f7..a98fb04 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -5170,17 +5170,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { string ret = String.Empty; - int x = 0; m_host.AddScriptLPS(1); if (src.Data.Length > 0) { - ret = src.Data[x++].ToString(); - for (; x < src.Data.Length; x++) - { - ret += ", "+src.Data[x].ToString(); - } + ret = string.Join(", ", + (new List(src.Data)).ConvertAll(o => + { + return o.ToString(); + }).ToArray()); } return ret; -- cgit v1.1 From 582a256646d1093b2c8889d89dbaa88f1c5fc81d Mon Sep 17 00:00:00 2001 From: SignpostMarv Date: Fri, 24 Aug 2012 13:53:53 +0100 Subject: immediately returning the string.Join operation instead of checking if the list has members --- .../ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index a98fb04..bbbc6cc 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -5169,20 +5169,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public LSL_String llList2CSV(LSL_List src) { - string ret = String.Empty; m_host.AddScriptLPS(1); - if (src.Data.Length > 0) - { - ret = string.Join(", ", - (new List(src.Data)).ConvertAll(o => - { - return o.ToString(); - }).ToArray()); - } - - return ret; + return string.Join(", ", + (new List(src.Data)).ConvertAll(o => + { + return o.ToString(); + }).ToArray()); } /// -- cgit v1.1 From 67477290ad34f7350495c2787022eed5d1d535d8 Mon Sep 17 00:00:00 2001 From: SignpostMarv Date: Fri, 24 Aug 2012 13:56:42 +0100 Subject: stripping superfluous whitespace Signed-off-by: Melanie --- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 3 --- 1 file changed, 3 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index bbbc6cc..2bfb9b3 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -5165,11 +5165,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api /// separated list. There is a space after /// each comma. /// - public LSL_String llList2CSV(LSL_List src) { - - m_host.AddScriptLPS(1); return string.Join(", ", -- cgit v1.1 From 3d504261b0e189f8111912a3fff9d45579c04eed Mon Sep 17 00:00:00 2001 From: SignpostMarv Date: Fri, 24 Aug 2012 16:35:59 +0100 Subject: renaming to be similar to equivalent Set command --- .../Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 10 +++++----- .../Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 2bfb9b3..c706f48 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -7910,7 +7910,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public LSL_List llGetPrimitiveParams(LSL_List rules) { m_host.AddScriptLPS(1); - return GetLinkPrimitiveParams(m_host, rules); + return GetPrimParams(m_host, rules); } public LSL_List llGetLinkPrimitiveParams(int linknumber, LSL_List rules) @@ -7923,14 +7923,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api foreach (var part in parts) { - LSL_List partRes = GetLinkPrimitiveParams(part, rules); + LSL_List partRes = GetPrimParams(part, rules); res += partRes; } return res; } - public LSL_List GetLinkPrimitiveParams(SceneObjectPart part, LSL_List rules) + public LSL_List GetPrimParams(SceneObjectPart part, LSL_List rules) { LSL_List res = new LSL_List(); int idx=0; @@ -10752,7 +10752,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } } - public LSL_List GetLinkPrimitiveParamsEx(LSL_Key prim, LSL_List rules) + public LSL_List GetPrimitiveParamsEx(LSL_Key prim, LSL_List rules) { SceneObjectPart obj = World.GetSceneObjectPart(new UUID(prim)); if (obj == null) @@ -10761,7 +10761,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (obj.OwnerID != m_host.OwnerID) return new LSL_List(); - return GetLinkPrimitiveParams(obj, rules); + return GetPrimParams(obj, rules); } public void print(string str) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 5e7c2d9..c277708 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -2250,7 +2250,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api List parts = ((LSL_Api)m_LSL_Api).GetLinkParts(linknumber); foreach (SceneObjectPart part in parts) { - retVal += ((LSL_Api)m_LSL_Api).GetLinkPrimitiveParams(part, rules); + retVal += ((LSL_Api)m_LSL_Api).GetPrimParams(part, rules); } return retVal; } @@ -2965,7 +2965,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api m_host.AddScriptLPS(1); InitLSL(); - return m_LSL_Api.GetLinkPrimitiveParamsEx(prim, rules); + return m_LSL_Api.GetPrimitiveParamsEx(prim, rules); } public void osSetPrimitiveParams(LSL_Key prim, LSL_List rules) -- cgit v1.1 From a8044999fb056de0a815093953f82b33d540dd6f Mon Sep 17 00:00:00 2001 From: SignpostMarv Date: Fri, 24 Aug 2012 16:41:43 +0100 Subject: use SceneObjectPart instead of var --- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index c706f48..03b5982 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -5828,7 +5828,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api List parts = GetLinkParts(linknumber); - foreach (var part in parts) + foreach (SceneObjectPart part in parts) { SetTextureAnim(part, mode, face, sizex, sizey, start, length, rate); } @@ -6190,7 +6190,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api List parts = GetLinkParts(linknumber); - foreach (var part in parts) + foreach (SceneObjectPart part in parts) { SetParticleSystem(part, rules); } @@ -7921,7 +7921,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api LSL_List res = new LSL_List(); - foreach (var part in parts) + foreach (SceneObjectPart part in parts) { LSL_List partRes = GetPrimParams(part, rules); res += partRes; -- cgit v1.1 From 2a2e120470ea530ea0a6f035c5cf28247f94532c Mon Sep 17 00:00:00 2001 From: SignpostMarv Date: Fri, 24 Aug 2012 17:02:13 +0100 Subject: since we will be making the Get return type the remaining ruleset as with the Set return type, we need to move the original return type to a ref param --- .../Shared/Api/Implementation/LSL_Api.cs | 38 ++++++++++++---------- .../Shared/Api/Implementation/OSSL_Api.cs | 2 +- 2 files changed, 22 insertions(+), 18 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 03b5982..6e46992 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -7910,7 +7910,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public LSL_List llGetPrimitiveParams(LSL_List rules) { m_host.AddScriptLPS(1); - return GetPrimParams(m_host, rules); + + LSL_List result = new LSL_List(); + + GetPrimParams(m_host, rules, ref result); + + return result; } public LSL_List llGetLinkPrimitiveParams(int linknumber, LSL_List rules) @@ -7923,16 +7928,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api foreach (SceneObjectPart part in parts) { - LSL_List partRes = GetPrimParams(part, rules); - res += partRes; + GetPrimParams(part, rules, ref res); } return res; } - public LSL_List GetPrimParams(SceneObjectPart part, LSL_List rules) + public void GetPrimParams(SceneObjectPart part, LSL_List rules, ref LSL_List res) { - LSL_List res = new LSL_List(); int idx=0; while (idx < rules.Length) { @@ -8077,7 +8080,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api case (int)ScriptBaseClass.PRIM_TEXTURE: if (remain < 1) - return res; + return; int face = (int)rules.GetLSLIntegerItem(idx++); Primitive.TextureEntry tex = part.Shape.Textures; @@ -8117,7 +8120,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api case (int)ScriptBaseClass.PRIM_COLOR: if (remain < 1) - return res; + return; face=(int)rules.GetLSLIntegerItem(idx++); @@ -8146,7 +8149,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api case (int)ScriptBaseClass.PRIM_BUMP_SHINY: if (remain < 1) - return res; + return; face=(int)rules.GetLSLIntegerItem(idx++); @@ -8177,7 +8180,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api case (int)ScriptBaseClass.PRIM_FULLBRIGHT: if (remain < 1) - return res; + return; face=(int)rules.GetLSLIntegerItem(idx++); @@ -8219,7 +8222,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api case (int)ScriptBaseClass.PRIM_TEXGEN: if (remain < 1) - return res; + return; face=(int)rules.GetLSLIntegerItem(idx++); @@ -8260,7 +8263,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api case (int)ScriptBaseClass.PRIM_GLOW: if (remain < 1) - return res; + return; face=(int)rules.GetLSLIntegerItem(idx++); @@ -8314,7 +8317,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api break; } } - return res; } public LSL_List llGetPrimMediaParams(int face, LSL_List rules) @@ -10755,13 +10757,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public LSL_List GetPrimitiveParamsEx(LSL_Key prim, LSL_List rules) { SceneObjectPart obj = World.GetSceneObjectPart(new UUID(prim)); - if (obj == null) - return new LSL_List(); - if (obj.OwnerID != m_host.OwnerID) - return new LSL_List(); + LSL_List result = new LSL_List(); - return GetPrimParams(obj, rules); + if (obj != null && obj.OwnerID != m_host.OwnerID) + { + GetPrimParams(obj, rules, ref result); + } + + return result; } public void print(string str) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index c277708..a391b73 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -2250,7 +2250,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api List parts = ((LSL_Api)m_LSL_Api).GetLinkParts(linknumber); foreach (SceneObjectPart part in parts) { - retVal += ((LSL_Api)m_LSL_Api).GetPrimParams(part, rules); + ((LSL_Api)m_LSL_Api).GetPrimParams(part, rules, ref retVal); } return retVal; } -- cgit v1.1 From 5203665bb2d68c6a4e0ea3180334b607db6ab1ce Mon Sep 17 00:00:00 2001 From: SignpostMarv Date: Fri, 24 Aug 2012 17:25:37 +0100 Subject: refactoring to local variable for cleaner code --- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index a391b73..927f37c 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -2246,11 +2246,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api CheckThreatLevel(ThreatLevel.High, "osGetLinkPrimitiveParams"); m_host.AddScriptLPS(1); InitLSL(); + // One needs to cast m_LSL_Api because we're using functions not + // on the ILSL_Api interface. + LSL_Api LSL_Api = (LSL_Api)m_LSL_Api; LSL_List retVal = new LSL_List(); - List parts = ((LSL_Api)m_LSL_Api).GetLinkParts(linknumber); + List parts = LSL_Api.GetLinkParts(linknumber); foreach (SceneObjectPart part in parts) { - ((LSL_Api)m_LSL_Api).GetPrimParams(part, rules, ref retVal); + LSL_Api.GetPrimParams(part, rules, ref retVal); } return retVal; } -- cgit v1.1 From 58714b0aca71ce026226c6f76753905877792caf Mon Sep 17 00:00:00 2001 From: SignpostMarv Date: Fri, 24 Aug 2012 17:44:28 +0100 Subject: minor formatting --- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 6e46992..0f0eac6 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -7238,10 +7238,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api foreach (SceneObjectPart part in parts) remaining = SetPrimParams(part, rules); - while(remaining != null && remaining.Length > 2) + while (remaining != null && remaining.Length > 2) { linknumber = remaining.GetLSLIntegerItem(0); - rules = remaining.GetSublist(1,-1); + rules = remaining.GetSublist(1, -1); parts = GetLinkParts(linknumber); foreach (SceneObjectPart part in parts) -- cgit v1.1 From 6e86b230120776a7da4727dd1aedeca6b91e3169 Mon Sep 17 00:00:00 2001 From: SignpostMarv Date: Fri, 24 Aug 2012 17:44:39 +0100 Subject: implementing PRIM_LINK_TARGET on GetPrimParams ala SetPrimParams --- .../Shared/Api/Implementation/LSL_Api.cs | 58 ++++++++++++++++++---- .../Shared/Api/Implementation/OSSL_Api.cs | 13 ++++- 2 files changed, 60 insertions(+), 11 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 0f0eac6..b001c51 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -7913,7 +7913,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api LSL_List result = new LSL_List(); - GetPrimParams(m_host, rules, ref result); + LSL_List remaining = GetPrimParams(m_host, rules, ref result); + + while (remaining != null && remaining.Length > 2) + { + int linknumber = remaining.GetLSLIntegerItem(0); + rules = remaining.GetSublist(1, -1); + List parts = GetLinkParts(linknumber); + + foreach (SceneObjectPart part in parts) + remaining = GetPrimParams(part, rules, ref result); + } return result; } @@ -7925,16 +7935,27 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api List parts = GetLinkParts(linknumber); LSL_List res = new LSL_List(); + LSL_List remaining = null; foreach (SceneObjectPart part in parts) { - GetPrimParams(part, rules, ref res); + remaining = GetPrimParams(part, rules, ref res); + } + + while (remaining != null && remaining.Length > 2) + { + linknumber = remaining.GetLSLIntegerItem(0); + rules = remaining.GetSublist(1, -1); + parts = GetLinkParts(linknumber); + + foreach (SceneObjectPart part in parts) + remaining = GetPrimParams(part, rules, ref res); } return res; } - public void GetPrimParams(SceneObjectPart part, LSL_List rules, ref LSL_List res) + public LSL_List GetPrimParams(SceneObjectPart part, LSL_List rules, ref LSL_List res) { int idx=0; while (idx < rules.Length) @@ -8080,7 +8101,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api case (int)ScriptBaseClass.PRIM_TEXTURE: if (remain < 1) - return; + return null; int face = (int)rules.GetLSLIntegerItem(idx++); Primitive.TextureEntry tex = part.Shape.Textures; @@ -8120,7 +8141,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api case (int)ScriptBaseClass.PRIM_COLOR: if (remain < 1) - return; + return null; face=(int)rules.GetLSLIntegerItem(idx++); @@ -8149,7 +8170,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api case (int)ScriptBaseClass.PRIM_BUMP_SHINY: if (remain < 1) - return; + return null; face=(int)rules.GetLSLIntegerItem(idx++); @@ -8180,7 +8201,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api case (int)ScriptBaseClass.PRIM_FULLBRIGHT: if (remain < 1) - return; + return null; face=(int)rules.GetLSLIntegerItem(idx++); @@ -8222,7 +8243,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api case (int)ScriptBaseClass.PRIM_TEXGEN: if (remain < 1) - return; + return null; face=(int)rules.GetLSLIntegerItem(idx++); @@ -8263,7 +8284,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api case (int)ScriptBaseClass.PRIM_GLOW: if (remain < 1) - return; + return null; face=(int)rules.GetLSLIntegerItem(idx++); @@ -8315,8 +8336,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api 0 )); break; + case (int)ScriptBaseClass.PRIM_LINK_TARGET: + if(remain < 3) + return null; + + return rules.GetSublist(idx, -1); } } + + return null; } public LSL_List llGetPrimMediaParams(int face, LSL_List rules) @@ -10762,7 +10790,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (obj != null && obj.OwnerID != m_host.OwnerID) { - GetPrimParams(obj, rules, ref result); + LSL_List remaining = GetPrimParams(obj, rules, ref result); + + while (remaining != null && remaining.Length > 2) + { + int linknumber = remaining.GetLSLIntegerItem(0); + rules = remaining.GetSublist(1, -1); + List parts = GetLinkParts(linknumber); + + foreach (SceneObjectPart part in parts) + remaining = GetPrimParams(part, rules, ref result); + } } return result; diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 927f37c..1afa4fb 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -2250,10 +2250,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api // on the ILSL_Api interface. LSL_Api LSL_Api = (LSL_Api)m_LSL_Api; LSL_List retVal = new LSL_List(); + LSL_List remaining = null; List parts = LSL_Api.GetLinkParts(linknumber); foreach (SceneObjectPart part in parts) { - LSL_Api.GetPrimParams(part, rules, ref retVal); + remaining = LSL_Api.GetPrimParams(part, rules, ref retVal); + } + + while (remaining != null && remaining.Length > 2) + { + linknumber = remaining.GetLSLIntegerItem(0); + rules = remaining.GetSublist(1, -1); + parts = LSL_Api.GetLinkParts(linknumber); + + foreach (SceneObjectPart part in parts) + remaining = LSL_Api.GetPrimParams(part, rules, ref retVal); } return retVal; } -- cgit v1.1 From 1eb1c1bd4bc972e2df301b9dafb40fbb2f37b40c Mon Sep 17 00:00:00 2001 From: Melanie Date: Sat, 25 Aug 2012 18:19:51 +0100 Subject: renaming to be similar to equivalent Set command Conflicts: OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs --- .../ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 14 +++++++------- .../ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 4 ++-- 2 files changed, 9 insertions(+), 9 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 5386a28..c8b6a7e 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -8821,7 +8821,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public LSL_List llGetPrimitiveParams(LSL_List rules) { m_host.AddScriptLPS(1); - return GetLinkPrimitiveParams(m_host, rules); + return GetPrimParams(m_host, rules); } public LSL_List llGetLinkPrimitiveParams(int linknumber, LSL_List rules) @@ -8840,7 +8840,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { foreach (var part in parts) { - LSL_List partRes = GetLinkPrimitiveParams(part, rules); + LSL_List partRes = GetPrimParams(part, rules); res += partRes; } } @@ -8848,14 +8848,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { foreach (ScenePresence avatar in avatars) { - LSL_List avaRes = GetLinkPrimitiveParams(avatar, rules); + LSL_List avaRes = GetPrimParams(avatar, rules); res += avaRes; } } return res; } - public LSL_List GetLinkPrimitiveParams(ScenePresence avatar, LSL_List rules) + public LSL_List GetPrimParams(ScenePresence avatar, LSL_List rules) { // avatars case // replies as SL wiki @@ -9116,7 +9116,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return res; } - public LSL_List GetLinkPrimitiveParams(SceneObjectPart part, LSL_List rules) + public LSL_List GetPrimParams(SceneObjectPart part, LSL_List rules) { LSL_List res = new LSL_List(); int idx=0; @@ -12104,7 +12104,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } } - public LSL_List GetLinkPrimitiveParamsEx(LSL_Key prim, LSL_List rules) + public LSL_List GetPrimitiveParamsEx(LSL_Key prim, LSL_List rules) { SceneObjectPart obj = World.GetSceneObjectPart(new UUID(prim)); if (obj == null) @@ -12113,7 +12113,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (obj.OwnerID != m_host.OwnerID) return new LSL_List(); - return GetLinkPrimitiveParams(obj, rules); + return GetPrimParams(obj, rules); } public LSL_Integer llGetLinkNumberOfSides(LSL_Integer link) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index a81c39c..7b71a24 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -2261,7 +2261,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api List parts = ((LSL_Api)m_LSL_Api).GetLinkParts(linknumber); foreach (SceneObjectPart part in parts) { - retVal += ((LSL_Api)m_LSL_Api).GetLinkPrimitiveParams(part, rules); + retVal += ((LSL_Api)m_LSL_Api).GetPrimParams(part, rules); } return retVal; } @@ -3013,7 +3013,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api m_host.AddScriptLPS(1); InitLSL(); - return m_LSL_Api.GetLinkPrimitiveParamsEx(prim, rules); + return m_LSL_Api.GetPrimitiveParamsEx(prim, rules); } public void osSetPrimitiveParams(LSL_Key prim, LSL_List rules) -- cgit v1.1 From af6b2420718447a534e1ceedea366fc1dbf29dd7 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sat, 25 Aug 2012 18:24:52 +0100 Subject: use SceneObjectPart instead of var Conflicts: OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs --- .../ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index c8b6a7e..7b52ea3 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -6252,19 +6252,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api m_host.AddScriptLPS(1); List parts = GetLinkParts(linknumber); - if (parts.Count > 0) + + try { - try - { - foreach (var part in parts) - { - SetTextureAnim(part, mode, face, sizex, sizey, start, length, rate); - } - } - finally + foreach (SceneObjectPart part in parts) { + SetTextureAnim(part, mode, face, sizex, sizey, start, length, rate); } } + finally + { + } } private void SetTextureAnim(SceneObjectPart part, int mode, int face, int sizex, int sizey, double start, double length, double rate) @@ -6658,7 +6656,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api List parts = GetLinkParts(linknumber); - foreach (var part in parts) + foreach (SceneObjectPart part in parts) { SetParticleSystem(part, rules); } -- cgit v1.1 From 5f1021faa6b8196878604ea2f8af57bceeb41ba6 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sat, 25 Aug 2012 18:28:05 +0100 Subject: Temprary restructure to avoid conflicts --- .../Shared/Api/Implementation/LSL_Api.cs | 366 ++++++++++----------- 1 file changed, 183 insertions(+), 183 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 7b52ea3..2bdb485 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -7817,189 +7817,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return new Vector3((float)x, (float)y, (float)z); } - protected LSL_List SetPrimParams(ScenePresence av, LSL_List rules) - { - //This is a special version of SetPrimParams to deal with avatars which are sat on the linkset. - - int idx = 0; - - bool positionChanged = false; - Vector3 finalPos = Vector3.Zero; - - try - { - while (idx < rules.Length) - { - int code = rules.GetLSLIntegerItem(idx++); - - int remain = rules.Length - idx; - - switch (code) - { - case (int)ScriptBaseClass.PRIM_POSITION: - case (int)ScriptBaseClass.PRIM_POS_LOCAL: - { - if (remain < 1) - return null; - - LSL_Vector v; - v = rules.GetVector3Item(idx++); - - SceneObjectPart part = World.GetSceneObjectPart(av.ParentID); - if (part == null) - break; - - LSL_Rotation localRot = ScriptBaseClass.ZERO_ROTATION; - LSL_Vector localPos = ScriptBaseClass.ZERO_VECTOR; - if (part.LinkNum > 1) - { - localRot = GetPartLocalRot(part); - localPos = GetPartLocalPos(part); - } - - v -= localPos; - v /= localRot; - - LSL_Vector sitOffset = (llRot2Up(new LSL_Rotation(av.Rotation.X, av.Rotation.Y, av.Rotation.Z, av.Rotation.W)) * av.Appearance.AvatarHeight * 0.02638f); - - v = v + 2 * sitOffset; - - av.OffsetPosition = new Vector3((float)v.x, (float)v.y, (float)v.z); - av.SendAvatarDataToAllAgents(); - - } - break; - - case (int)ScriptBaseClass.PRIM_ROT_LOCAL: - case (int)ScriptBaseClass.PRIM_ROTATION: - { - if (remain < 1) - return null; - - LSL_Rotation r; - r = rules.GetQuaternionItem(idx++); - - SceneObjectPart part = World.GetSceneObjectPart(av.ParentID); - if (part == null) - break; - - LSL_Rotation localRot = ScriptBaseClass.ZERO_ROTATION; - LSL_Vector localPos = ScriptBaseClass.ZERO_VECTOR; - - if (part.LinkNum > 1) - localRot = GetPartLocalRot(part); - - r = r * llGetRootRotation() / localRot; - av.Rotation = new Quaternion((float)r.x, (float)r.y, (float)r.z, (float)r.s); - av.SendAvatarDataToAllAgents(); - } - break; - - // parse rest doing nothing but number of parameters error check - case (int)ScriptBaseClass.PRIM_SIZE: - case (int)ScriptBaseClass.PRIM_MATERIAL: - case (int)ScriptBaseClass.PRIM_PHANTOM: - case (int)ScriptBaseClass.PRIM_PHYSICS: - case (int)ScriptBaseClass.PRIM_PHYSICS_SHAPE_TYPE: - case (int)ScriptBaseClass.PRIM_TEMP_ON_REZ: - case (int)ScriptBaseClass.PRIM_NAME: - case (int)ScriptBaseClass.PRIM_DESC: - if (remain < 1) - return null; - idx++; - break; - - case (int)ScriptBaseClass.PRIM_GLOW: - case (int)ScriptBaseClass.PRIM_FULLBRIGHT: - case (int)ScriptBaseClass.PRIM_TEXGEN: - if (remain < 2) - return null; - idx += 2; - break; - - case (int)ScriptBaseClass.PRIM_TYPE: - if (remain < 3) - return null; - code = (int)rules.GetLSLIntegerItem(idx++); - remain = rules.Length - idx; - switch (code) - { - case (int)ScriptBaseClass.PRIM_TYPE_BOX: - case (int)ScriptBaseClass.PRIM_TYPE_CYLINDER: - case (int)ScriptBaseClass.PRIM_TYPE_PRISM: - if (remain < 6) - return null; - idx += 6; - break; - - case (int)ScriptBaseClass.PRIM_TYPE_SPHERE: - if (remain < 5) - return null; - idx += 5; - break; - - case (int)ScriptBaseClass.PRIM_TYPE_TORUS: - case (int)ScriptBaseClass.PRIM_TYPE_TUBE: - case (int)ScriptBaseClass.PRIM_TYPE_RING: - if (remain < 11) - return null; - idx += 11; - break; - - case (int)ScriptBaseClass.PRIM_TYPE_SCULPT: - if (remain < 2) - return null; - idx += 2; - break; - } - break; - - case (int)ScriptBaseClass.PRIM_COLOR: - case (int)ScriptBaseClass.PRIM_TEXT: - case (int)ScriptBaseClass.PRIM_BUMP_SHINY: - case (int)ScriptBaseClass.PRIM_OMEGA: - if (remain < 3) - return null; - idx += 3; - break; - - case (int)ScriptBaseClass.PRIM_TEXTURE: - case (int)ScriptBaseClass.PRIM_POINT_LIGHT: - case (int)ScriptBaseClass.PRIM_PHYSICS_MATERIAL: - if (remain < 5) - return null; - idx += 5; - break; - - case (int)ScriptBaseClass.PRIM_FLEXIBLE: - if (remain < 7) - return null; - - idx += 7; - break; - - case (int)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 null; - - return rules.GetSublist(idx, -1); - } - } - } - - finally - { - if (positionChanged) - { - av.OffsetPosition = finalPos; -// av.SendAvatarDataToAllAgents(); - av.SendTerseUpdateToAllClients(); - positionChanged = false; - } - } - return null; - } - protected LSL_List SetPrimParams(SceneObjectPart part, LSL_List rules) { if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted) @@ -13152,5 +12969,188 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api m_Notecards.Remove(key); } } + + protected LSL_List SetPrimParams(ScenePresence av, LSL_List rules) + { + //This is a special version of SetPrimParams to deal with avatars which are sat on the linkset. + + int idx = 0; + + bool positionChanged = false; + Vector3 finalPos = Vector3.Zero; + + try + { + while (idx < rules.Length) + { + int code = rules.GetLSLIntegerItem(idx++); + + int remain = rules.Length - idx; + + switch (code) + { + case (int)ScriptBaseClass.PRIM_POSITION: + case (int)ScriptBaseClass.PRIM_POS_LOCAL: + { + if (remain < 1) + return null; + + LSL_Vector v; + v = rules.GetVector3Item(idx++); + + SceneObjectPart part = World.GetSceneObjectPart(av.ParentID); + if (part == null) + break; + + LSL_Rotation localRot = ScriptBaseClass.ZERO_ROTATION; + LSL_Vector localPos = ScriptBaseClass.ZERO_VECTOR; + if (part.LinkNum > 1) + { + localRot = GetPartLocalRot(part); + localPos = GetPartLocalPos(part); + } + + v -= localPos; + v /= localRot; + + LSL_Vector sitOffset = (llRot2Up(new LSL_Rotation(av.Rotation.X, av.Rotation.Y, av.Rotation.Z, av.Rotation.W)) * av.Appearance.AvatarHeight * 0.02638f); + + v = v + 2 * sitOffset; + + av.OffsetPosition = new Vector3((float)v.x, (float)v.y, (float)v.z); + av.SendAvatarDataToAllAgents(); + + } + break; + + case (int)ScriptBaseClass.PRIM_ROT_LOCAL: + case (int)ScriptBaseClass.PRIM_ROTATION: + { + if (remain < 1) + return null; + + LSL_Rotation r; + r = rules.GetQuaternionItem(idx++); + + SceneObjectPart part = World.GetSceneObjectPart(av.ParentID); + if (part == null) + break; + + LSL_Rotation localRot = ScriptBaseClass.ZERO_ROTATION; + LSL_Vector localPos = ScriptBaseClass.ZERO_VECTOR; + + if (part.LinkNum > 1) + localRot = GetPartLocalRot(part); + + r = r * llGetRootRotation() / localRot; + av.Rotation = new Quaternion((float)r.x, (float)r.y, (float)r.z, (float)r.s); + av.SendAvatarDataToAllAgents(); + } + break; + + // parse rest doing nothing but number of parameters error check + case (int)ScriptBaseClass.PRIM_SIZE: + case (int)ScriptBaseClass.PRIM_MATERIAL: + case (int)ScriptBaseClass.PRIM_PHANTOM: + case (int)ScriptBaseClass.PRIM_PHYSICS: + case (int)ScriptBaseClass.PRIM_PHYSICS_SHAPE_TYPE: + case (int)ScriptBaseClass.PRIM_TEMP_ON_REZ: + case (int)ScriptBaseClass.PRIM_NAME: + case (int)ScriptBaseClass.PRIM_DESC: + if (remain < 1) + return null; + idx++; + break; + + case (int)ScriptBaseClass.PRIM_GLOW: + case (int)ScriptBaseClass.PRIM_FULLBRIGHT: + case (int)ScriptBaseClass.PRIM_TEXGEN: + if (remain < 2) + return null; + idx += 2; + break; + + case (int)ScriptBaseClass.PRIM_TYPE: + if (remain < 3) + return null; + code = (int)rules.GetLSLIntegerItem(idx++); + remain = rules.Length - idx; + switch (code) + { + case (int)ScriptBaseClass.PRIM_TYPE_BOX: + case (int)ScriptBaseClass.PRIM_TYPE_CYLINDER: + case (int)ScriptBaseClass.PRIM_TYPE_PRISM: + if (remain < 6) + return null; + idx += 6; + break; + + case (int)ScriptBaseClass.PRIM_TYPE_SPHERE: + if (remain < 5) + return null; + idx += 5; + break; + + case (int)ScriptBaseClass.PRIM_TYPE_TORUS: + case (int)ScriptBaseClass.PRIM_TYPE_TUBE: + case (int)ScriptBaseClass.PRIM_TYPE_RING: + if (remain < 11) + return null; + idx += 11; + break; + + case (int)ScriptBaseClass.PRIM_TYPE_SCULPT: + if (remain < 2) + return null; + idx += 2; + break; + } + break; + + case (int)ScriptBaseClass.PRIM_COLOR: + case (int)ScriptBaseClass.PRIM_TEXT: + case (int)ScriptBaseClass.PRIM_BUMP_SHINY: + case (int)ScriptBaseClass.PRIM_OMEGA: + if (remain < 3) + return null; + idx += 3; + break; + + case (int)ScriptBaseClass.PRIM_TEXTURE: + case (int)ScriptBaseClass.PRIM_POINT_LIGHT: + case (int)ScriptBaseClass.PRIM_PHYSICS_MATERIAL: + if (remain < 5) + return null; + idx += 5; + break; + + case (int)ScriptBaseClass.PRIM_FLEXIBLE: + if (remain < 7) + return null; + + idx += 7; + break; + + case (int)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 null; + + return rules.GetSublist(idx, -1); + } + } + } + + finally + { + if (positionChanged) + { + av.OffsetPosition = finalPos; +// av.SendAvatarDataToAllAgents(); + av.SendTerseUpdateToAllClients(); + positionChanged = false; + } + } + return null; + } } } -- cgit v1.1 From 681066050c2f7019d1b425c86f7985d7650d8226 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sat, 25 Aug 2012 18:32:59 +0100 Subject: Also move the other avatar based overload out of harms way --- .../Shared/Api/Implementation/LSL_Api.cs | 1430 ++++++++++---------- 1 file changed, 715 insertions(+), 715 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 2bdb485..64f145b 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -8670,75 +8670,142 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return res; } - public LSL_List GetPrimParams(ScenePresence avatar, LSL_List rules) + public LSL_List GetPrimParams(SceneObjectPart part, LSL_List rules) { - // avatars case - // replies as SL wiki - LSL_List res = new LSL_List(); -// SceneObjectPart sitPart = avatar.ParentPart; // most likelly it will be needed - SceneObjectPart sitPart = World.GetSceneObjectPart(avatar.ParentID); // maybe better do this expensive search for it in case it's gone?? - - int idx = 0; + int idx=0; while (idx < rules.Length) { - int code = (int)rules.GetLSLIntegerItem(idx++); - int remain = rules.Length - idx; + int code=(int)rules.GetLSLIntegerItem(idx++); + int remain=rules.Length-idx; switch (code) { case (int)ScriptBaseClass.PRIM_MATERIAL: - res.Add(new LSL_Integer((int)SOPMaterialData.SopMaterial.Flesh)); + res.Add(new LSL_Integer(part.Material)); break; case (int)ScriptBaseClass.PRIM_PHYSICS: + if ((part.GetEffectiveObjectFlags() & (uint)PrimFlags.Physics) != 0) + res.Add(new LSL_Integer(1)); + else res.Add(new LSL_Integer(0)); break; case (int)ScriptBaseClass.PRIM_TEMP_ON_REZ: + if ((part.GetEffectiveObjectFlags() & (uint)PrimFlags.TemporaryOnRez) != 0) + res.Add(new LSL_Integer(1)); + else res.Add(new LSL_Integer(0)); break; case (int)ScriptBaseClass.PRIM_PHANTOM: + if ((part.GetEffectiveObjectFlags() & (uint)PrimFlags.Phantom) != 0) + res.Add(new LSL_Integer(1)); + else res.Add(new LSL_Integer(0)); break; case (int)ScriptBaseClass.PRIM_POSITION: - - Vector3 pos = avatar.OffsetPosition; - - Vector3 sitOffset = (Zrot(avatar.Rotation)) * (avatar.Appearance.AvatarHeight * 0.02638f *2.0f); - pos -= sitOffset; - - if( sitPart != null) - pos = sitPart.GetWorldPosition() + pos * sitPart.GetWorldRotation(); - - res.Add(new LSL_Vector(pos.X,pos.Y,pos.Z)); + LSL_Vector v = new LSL_Vector(part.AbsolutePosition.X, + part.AbsolutePosition.Y, + part.AbsolutePosition.Z); + res.Add(v); break; case (int)ScriptBaseClass.PRIM_SIZE: - // as in llGetAgentSize above - res.Add(new LSL_Vector(0.45f, 0.6f, avatar.Appearance.AvatarHeight)); + res.Add(new LSL_Vector(part.Scale.X, + part.Scale.Y, + part.Scale.Z)); break; case (int)ScriptBaseClass.PRIM_ROTATION: - Quaternion rot = avatar.Rotation; - if (sitPart != null) - { - rot = sitPart.GetWorldRotation() * rot; // apply sit part world rotation - } - - res.Add(new LSL_Rotation (rot.X, rot.Y, rot.Z, rot.W)); + res.Add(GetPartRot(part)); break; case (int)ScriptBaseClass.PRIM_TYPE: - res.Add(new LSL_Integer(ScriptBaseClass.PRIM_TYPE_BOX)); - res.Add(new LSL_Integer(ScriptBaseClass.PRIM_HOLE_DEFAULT)); - res.Add(new LSL_Vector(0f,1.0f,0f)); - res.Add(new LSL_Float(0.0f)); - res.Add(new LSL_Vector(0, 0, 0)); - res.Add(new LSL_Vector(1.0f,1.0f,0f)); - res.Add(new LSL_Vector(0, 0, 0)); + // implementing box + PrimitiveBaseShape Shape = part.Shape; + int primType = (int)part.GetPrimType(); + res.Add(new LSL_Integer(primType)); + double topshearx = (double)(sbyte)Shape.PathShearX / 100.0; // Fix negative values for PathShearX + double topsheary = (double)(sbyte)Shape.PathShearY / 100.0; // and PathShearY. + switch (primType) + { + case ScriptBaseClass.PRIM_TYPE_BOX: + case ScriptBaseClass.PRIM_TYPE_CYLINDER: + case ScriptBaseClass.PRIM_TYPE_PRISM: + res.Add(new LSL_Integer(Shape.ProfileCurve) & 0xf0); // Isolate hole shape nibble. + res.Add(new LSL_Vector(Shape.ProfileBegin / 50000.0, 1 - Shape.ProfileEnd / 50000.0, 0)); + res.Add(new LSL_Float(Shape.ProfileHollow / 50000.0)); + res.Add(new LSL_Vector(Shape.PathTwistBegin / 100.0, Shape.PathTwist / 100.0, 0)); + res.Add(new LSL_Vector(1 - (Shape.PathScaleX / 100.0 - 1), 1 - (Shape.PathScaleY / 100.0 - 1), 0)); + res.Add(new LSL_Vector(topshearx, topsheary, 0)); + break; + + case ScriptBaseClass.PRIM_TYPE_SPHERE: + res.Add(new LSL_Integer(Shape.ProfileCurve) & 0xf0); // Isolate hole shape nibble. + res.Add(new LSL_Vector(Shape.PathBegin / 50000.0, 1 - Shape.PathEnd / 50000.0, 0)); + res.Add(new LSL_Float(Shape.ProfileHollow / 50000.0)); + res.Add(new LSL_Vector(Shape.PathTwistBegin / 100.0, Shape.PathTwist / 100.0, 0)); + res.Add(new LSL_Vector(Shape.ProfileBegin / 50000.0, 1 - Shape.ProfileEnd / 50000.0, 0)); + break; + + case ScriptBaseClass.PRIM_TYPE_SCULPT: + res.Add(Shape.SculptTexture.ToString()); + res.Add(new LSL_Integer(Shape.SculptType)); + break; + + case ScriptBaseClass.PRIM_TYPE_RING: + case ScriptBaseClass.PRIM_TYPE_TUBE: + case ScriptBaseClass.PRIM_TYPE_TORUS: + // holeshape + res.Add(new LSL_Integer(Shape.ProfileCurve) & 0xf0); // Isolate hole shape nibble. + + // cut + res.Add(new LSL_Vector(Shape.PathBegin / 50000.0, 1 - Shape.PathEnd / 50000.0, 0)); + + // hollow + res.Add(new LSL_Float(Shape.ProfileHollow / 50000.0)); + + // twist + res.Add(new LSL_Vector(Shape.PathTwistBegin / 100.0, Shape.PathTwist / 100.0, 0)); + + // vector holesize + res.Add(new LSL_Vector(1 - (Shape.PathScaleX / 100.0 - 1), 1 - (Shape.PathScaleY / 100.0 - 1), 0)); + + // vector topshear + res.Add(new LSL_Vector(topshearx, topsheary, 0)); + + // vector profilecut + res.Add(new LSL_Vector(Shape.ProfileBegin / 50000.0, 1 - Shape.ProfileEnd / 50000.0, 0)); + + // vector tapera + res.Add(new LSL_Vector(Shape.PathTaperX / 100.0, Shape.PathTaperY / 100.0, 0)); + + // float revolutions + res.Add(new LSL_Float(Math.Round(Shape.PathRevolutions * 0.015d, 2, MidpointRounding.AwayFromZero)) + 1.0d); + // Slightly inaccurate, because an unsigned byte is being used to represent + // the entire range of floating-point values from 1.0 through 4.0 (which is how + // SL does it). + // + // Using these formulas to store and retrieve PathRevolutions, it is not + // possible to use all values between 1.00 and 4.00. For instance, you can't + // represent 1.10. You can represent 1.09 and 1.11, but not 1.10. So, if you + // use llSetPrimitiveParams to set revolutions to 1.10 and then retreive them + // with llGetPrimitiveParams, you'll retrieve 1.09. You can also see a similar + // behavior in the viewer as you cannot set 1.10. The viewer jumps to 1.11. + // In SL, llSetPrimitveParams and llGetPrimitiveParams can set and get a value + // such as 1.10. So, SL must store and retreive the actual user input rather + // than only storing the encoded value. + + // float radiusoffset + res.Add(new LSL_Float(Shape.PathRadiusOffset / 100.0)); + + // float skew + res.Add(new LSL_Float(Shape.PathSkew / 100.0)); + break; + } break; case (int)ScriptBaseClass.PRIM_TEXTURE: @@ -8746,24 +8813,37 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return res; int face = (int)rules.GetLSLIntegerItem(idx++); + Primitive.TextureEntry tex = part.Shape.Textures; if (face == ScriptBaseClass.ALL_SIDES) { - for (face = 0; face < 21; face++) + for (face = 0 ; face < GetNumberOfSides(part); face++) { - res.Add(new LSL_String("")); - res.Add(new LSL_Vector(0,0,0)); - res.Add(new LSL_Vector(0,0,0)); - res.Add(new LSL_Float(0.0)); + Primitive.TextureEntryFace texface = tex.GetFace((uint)face); + + res.Add(new LSL_String(texface.TextureID.ToString())); + res.Add(new LSL_Vector(texface.RepeatU, + texface.RepeatV, + 0)); + res.Add(new LSL_Vector(texface.OffsetU, + texface.OffsetV, + 0)); + res.Add(new LSL_Float(texface.Rotation)); } } else { - if (face >= 0 && face < 21) + if (face >= 0 && face < GetNumberOfSides(part)) { - res.Add(new LSL_String("")); - res.Add(new LSL_Vector(0,0,0)); - res.Add(new LSL_Vector(0,0,0)); - res.Add(new LSL_Float(0.0)); + Primitive.TextureEntryFace texface = tex.GetFace((uint)face); + + res.Add(new LSL_String(texface.TextureID.ToString())); + res.Add(new LSL_Vector(texface.RepeatU, + texface.RepeatV, + 0)); + res.Add(new LSL_Vector(texface.OffsetU, + texface.OffsetV, + 0)); + res.Add(new LSL_Float(texface.Rotation)); } } break; @@ -8772,20 +8852,28 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (remain < 1) return res; - face = (int)rules.GetLSLIntegerItem(idx++); + face=(int)rules.GetLSLIntegerItem(idx++); + tex = part.Shape.Textures; + Color4 texcolor; if (face == ScriptBaseClass.ALL_SIDES) { - for (face = 0; face < 21; face++) + for (face = 0 ; face < GetNumberOfSides(part); face++) { - res.Add(new LSL_Vector(0,0,0)); - res.Add(new LSL_Float(0)); + texcolor = tex.GetFace((uint)face).RGBA; + res.Add(new LSL_Vector(texcolor.R, + texcolor.G, + texcolor.B)); + res.Add(new LSL_Float(texcolor.A)); } } else { - res.Add(new LSL_Vector(0,0,0)); - res.Add(new LSL_Float(0)); + texcolor = tex.GetFace((uint)face).RGBA; + res.Add(new LSL_Vector(texcolor.R, + texcolor.G, + texcolor.B)); + res.Add(new LSL_Float(texcolor.A)); } break; @@ -8794,18 +8882,54 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return res; face = (int)rules.GetLSLIntegerItem(idx++); + tex = part.Shape.Textures; + int shiny; if (face == ScriptBaseClass.ALL_SIDES) { - for (face = 0; face < 21; face++) + for (face = 0; face < GetNumberOfSides(part); face++) { - res.Add(new LSL_Integer(ScriptBaseClass.PRIM_SHINY_NONE)); - res.Add(new LSL_Integer(ScriptBaseClass.PRIM_BUMP_NONE)); + Shininess shinyness = tex.GetFace((uint)face).Shiny; + if (shinyness == Shininess.High) + { + shiny = ScriptBaseClass.PRIM_SHINY_HIGH; + } + else if (shinyness == Shininess.Medium) + { + shiny = ScriptBaseClass.PRIM_SHINY_MEDIUM; + } + else if (shinyness == Shininess.Low) + { + shiny = ScriptBaseClass.PRIM_SHINY_LOW; + } + else + { + shiny = ScriptBaseClass.PRIM_SHINY_NONE; + } + res.Add(new LSL_Integer(shiny)); + res.Add(new LSL_Integer((int)tex.GetFace((uint)face).Bump)); } } else { - res.Add(new LSL_Integer(ScriptBaseClass.PRIM_SHINY_NONE)); - res.Add(new LSL_Integer(ScriptBaseClass.PRIM_BUMP_NONE)); + Shininess shinyness = tex.GetFace((uint)face).Shiny; + if (shinyness == Shininess.High) + { + shiny = ScriptBaseClass.PRIM_SHINY_HIGH; + } + else if (shinyness == Shininess.Medium) + { + shiny = ScriptBaseClass.PRIM_SHINY_MEDIUM; + } + else if (shinyness == Shininess.Low) + { + shiny = ScriptBaseClass.PRIM_SHINY_LOW; + } + else + { + shiny = ScriptBaseClass.PRIM_SHINY_NONE; + } + res.Add(new LSL_Integer(shiny)); + res.Add(new LSL_Integer((int)tex.GetFace((uint)face).Bump)); } break; @@ -8814,27 +8938,52 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return res; face = (int)rules.GetLSLIntegerItem(idx++); + tex = part.Shape.Textures; + int fullbright; if (face == ScriptBaseClass.ALL_SIDES) { - for (face = 0; face < 21; face++) + for (face = 0; face < GetNumberOfSides(part); face++) { - res.Add(new LSL_Integer(ScriptBaseClass.FALSE)); + if (tex.GetFace((uint)face).Fullbright == true) + { + fullbright = ScriptBaseClass.TRUE; + } + else + { + fullbright = ScriptBaseClass.FALSE; + } + res.Add(new LSL_Integer(fullbright)); } } else { - res.Add(new LSL_Integer(ScriptBaseClass.FALSE)); - } + if (tex.GetFace((uint)face).Fullbright == true) + { + fullbright = ScriptBaseClass.TRUE; + } + else + { + fullbright = ScriptBaseClass.FALSE; + } + res.Add(new LSL_Integer(fullbright)); + } break; case (int)ScriptBaseClass.PRIM_FLEXIBLE: - res.Add(new LSL_Integer(0)); - res.Add(new LSL_Integer(0));// softness - res.Add(new LSL_Float(0.0f)); // gravity - res.Add(new LSL_Float(0.0f)); // friction - res.Add(new LSL_Float(0.0f)); // wind - res.Add(new LSL_Float(0.0f)); // tension - res.Add(new LSL_Vector(0f,0f,0f)); + PrimitiveBaseShape shape = part.Shape; + + if (shape.FlexiEntry) + res.Add(new LSL_Integer(1)); // active + else + res.Add(new LSL_Integer(0)); + res.Add(new LSL_Integer(shape.FlexiSoftness));// softness + res.Add(new LSL_Float(shape.FlexiGravity)); // gravity + res.Add(new LSL_Float(shape.FlexiDrag)); // friction + res.Add(new LSL_Float(shape.FlexiWind)); // wind + res.Add(new LSL_Float(shape.FlexiTension)); // tension + res.Add(new LSL_Vector(shape.FlexiForceX, // force + shape.FlexiForceY, + shape.FlexiForceZ)); break; case (int)ScriptBaseClass.PRIM_TEXGEN: @@ -8843,25 +8992,47 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return res; face = (int)rules.GetLSLIntegerItem(idx++); + tex = part.Shape.Textures; if (face == ScriptBaseClass.ALL_SIDES) { - for (face = 0; face < 21; face++) + for (face = 0; face < GetNumberOfSides(part); face++) { + if (tex.GetFace((uint)face).TexMapType == MappingType.Planar) + { + res.Add(new LSL_Integer(ScriptBaseClass.PRIM_TEXGEN_PLANAR)); + } + else + { res.Add(new LSL_Integer(ScriptBaseClass.PRIM_TEXGEN_DEFAULT)); + } } } else { + if (tex.GetFace((uint)face).TexMapType == MappingType.Planar) + { + res.Add(new LSL_Integer(ScriptBaseClass.PRIM_TEXGEN_PLANAR)); + } + else + { res.Add(new LSL_Integer(ScriptBaseClass.PRIM_TEXGEN_DEFAULT)); + } } break; case (int)ScriptBaseClass.PRIM_POINT_LIGHT: - res.Add(new LSL_Integer(0)); - res.Add(new LSL_Vector(0f,0f,0f)); - res.Add(new LSL_Float(0f)); // intensity - res.Add(new LSL_Float(0f)); // radius - res.Add(new LSL_Float(0f)); // falloff + shape = part.Shape; + + if (shape.LightEntry) + res.Add(new LSL_Integer(1)); // active + else + res.Add(new LSL_Integer(0)); + res.Add(new LSL_Vector(shape.LightColorR, // color + shape.LightColorG, + shape.LightColorB)); + res.Add(new LSL_Float(shape.LightIntensity)); // intensity + res.Add(new LSL_Float(shape.LightRadius)); // radius + res.Add(new LSL_Float(shape.LightFalloff)); // falloff break; case (int)ScriptBaseClass.PRIM_GLOW: @@ -8869,591 +9040,159 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return res; face = (int)rules.GetLSLIntegerItem(idx++); + tex = part.Shape.Textures; + float primglow; if (face == ScriptBaseClass.ALL_SIDES) { - for (face = 0; face < 21; face++) + for (face = 0; face < GetNumberOfSides(part); face++) { - res.Add(new LSL_Float(0f)); + primglow = tex.GetFace((uint)face).Glow; + res.Add(new LSL_Float(primglow)); } } else { - res.Add(new LSL_Float(0f)); + primglow = tex.GetFace((uint)face).Glow; + res.Add(new LSL_Float(primglow)); } break; case (int)ScriptBaseClass.PRIM_TEXT: - res.Add(new LSL_String("")); - res.Add(new LSL_Vector(0f,0f,0f)); - res.Add(new LSL_Float(1.0f)); + Color4 textColor = part.GetTextColor(); + res.Add(new LSL_String(part.Text)); + res.Add(new LSL_Vector(textColor.R, + textColor.G, + textColor.B)); + res.Add(new LSL_Float(textColor.A)); break; case (int)ScriptBaseClass.PRIM_NAME: - res.Add(new LSL_String(avatar.Name)); + res.Add(new LSL_String(part.Name)); break; case (int)ScriptBaseClass.PRIM_DESC: - res.Add(new LSL_String("")); + res.Add(new LSL_String(part.Description)); break; - case (int)ScriptBaseClass.PRIM_ROT_LOCAL: - Quaternion lrot = avatar.Rotation; - - if (sitPart != null && sitPart != sitPart.ParentGroup.RootPart) - { - lrot = sitPart.RotationOffset * lrot; // apply sit part rotation offset - } - res.Add(new LSL_Rotation(lrot.X, lrot.Y, lrot.Z, lrot.W)); + case (int)ScriptBaseClass.PRIM_ROT_LOCAL: + res.Add(new LSL_Rotation(part.RotationOffset.X, part.RotationOffset.Y, part.RotationOffset.Z, part.RotationOffset.W)); break; case (int)ScriptBaseClass.PRIM_POS_LOCAL: - Vector3 lpos = avatar.OffsetPosition; // pos relative to sit part - Vector3 lsitOffset = (Zrot(avatar.Rotation)) * (avatar.Appearance.AvatarHeight * 0.02638f * 2.0f); - lpos -= lsitOffset; - - if (sitPart != null && sitPart != sitPart.ParentGroup.RootPart) - { - lpos = sitPart.OffsetPosition + (lpos * sitPart.RotationOffset); // make it relative to root prim - } - res.Add(new LSL_Vector(lpos.X,lpos.Y,lpos.Z)); + res.Add(new LSL_Vector(GetPartLocalPos(part))); break; - case (int)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 res; LSL_Integer new_linknumber = rules.GetLSLIntegerItem(idx++); LSL_List new_rules = rules.GetSublist(idx, -1); - - res += llGetLinkPrimitiveParams((int)new_linknumber, new_rules); - return res; + LSL_List tres = llGetLinkPrimitiveParams((int)new_linknumber, new_rules); + res += tres; + return res; + case (int)ScriptBaseClass.PRIM_SLICE: + PrimType prim_type = part.GetPrimType(); + bool useProfileBeginEnd = (prim_type == PrimType.SPHERE || prim_type == PrimType.TORUS || prim_type == PrimType.TUBE || prim_type == PrimType.RING); + res.Add(new LSL_Vector( + (useProfileBeginEnd ? part.Shape.ProfileBegin : part.Shape.PathBegin) / 50000.0, + 1 - (useProfileBeginEnd ? part.Shape.ProfileEnd : part.Shape.PathEnd) / 50000.0, + 0 + )); + break; } } return res; } - public LSL_List GetPrimParams(SceneObjectPart part, LSL_List rules) + public LSL_List llGetPrimMediaParams(int face, LSL_List rules) + { + m_host.AddScriptLPS(1); + ScriptSleep(1000); + return GetPrimMediaParams(m_host, face, rules); + } + + public LSL_List llGetLinkMedia(LSL_Integer link, LSL_Integer face, LSL_List rules) + { + m_host.AddScriptLPS(1); + ScriptSleep(1000); + if (link == ScriptBaseClass.LINK_ROOT) + return GetPrimMediaParams(m_host.ParentGroup.RootPart, face, rules); + else if (link == ScriptBaseClass.LINK_THIS) + return GetPrimMediaParams(m_host, face, rules); + else + { + SceneObjectPart part = m_host.ParentGroup.GetLinkNumPart(link); + if (null != part) + return GetPrimMediaParams(part, face, rules); + } + + return new LSL_List(); + } + + private LSL_List GetPrimMediaParams(SceneObjectPart part, int face, LSL_List rules) { + // LSL Spec http://wiki.secondlife.com/wiki/LlGetPrimMediaParams says to fail silently if face is invalid + // TODO: Need to correctly handle case where a face has no media (which gives back an empty list). + // Assuming silently fail means give back an empty list. Ideally, need to check this. + if (face < 0 || face > part.GetNumberOfSides() - 1) + return new LSL_List(); + + IMoapModule module = m_ScriptEngine.World.RequestModuleInterface(); + if (null == module) + return new LSL_List(); + + MediaEntry me = module.GetMediaEntry(part, face); + + // As per http://wiki.secondlife.com/wiki/LlGetPrimMediaParams + if (null == me) + return new LSL_List(); + LSL_List res = new LSL_List(); - int idx=0; - while (idx < rules.Length) + + for (int i = 0; i < rules.Length; i++) { - int code=(int)rules.GetLSLIntegerItem(idx++); - int remain=rules.Length-idx; + int code = (int)rules.GetLSLIntegerItem(i); switch (code) { - case (int)ScriptBaseClass.PRIM_MATERIAL: - res.Add(new LSL_Integer(part.Material)); + case ScriptBaseClass.PRIM_MEDIA_ALT_IMAGE_ENABLE: + // Not implemented + res.Add(new LSL_Integer(0)); break; - case (int)ScriptBaseClass.PRIM_PHYSICS: - if ((part.GetEffectiveObjectFlags() & (uint)PrimFlags.Physics) != 0) - res.Add(new LSL_Integer(1)); + case ScriptBaseClass.PRIM_MEDIA_CONTROLS: + if (me.Controls == MediaControls.Standard) + res.Add(new LSL_Integer(ScriptBaseClass.PRIM_MEDIA_CONTROLS_STANDARD)); else - res.Add(new LSL_Integer(0)); + res.Add(new LSL_Integer(ScriptBaseClass.PRIM_MEDIA_CONTROLS_MINI)); break; - case (int)ScriptBaseClass.PRIM_TEMP_ON_REZ: - if ((part.GetEffectiveObjectFlags() & (uint)PrimFlags.TemporaryOnRez) != 0) - res.Add(new LSL_Integer(1)); - else - res.Add(new LSL_Integer(0)); + case ScriptBaseClass.PRIM_MEDIA_CURRENT_URL: + res.Add(new LSL_String(me.CurrentURL)); break; - case (int)ScriptBaseClass.PRIM_PHANTOM: - if ((part.GetEffectiveObjectFlags() & (uint)PrimFlags.Phantom) != 0) - res.Add(new LSL_Integer(1)); - else - res.Add(new LSL_Integer(0)); + case ScriptBaseClass.PRIM_MEDIA_HOME_URL: + res.Add(new LSL_String(me.HomeURL)); break; - case (int)ScriptBaseClass.PRIM_POSITION: - LSL_Vector v = new LSL_Vector(part.AbsolutePosition.X, - part.AbsolutePosition.Y, - part.AbsolutePosition.Z); - res.Add(v); + case ScriptBaseClass.PRIM_MEDIA_AUTO_LOOP: + res.Add(me.AutoLoop ? ScriptBaseClass.TRUE : ScriptBaseClass.FALSE); break; - case (int)ScriptBaseClass.PRIM_SIZE: - res.Add(new LSL_Vector(part.Scale.X, - part.Scale.Y, - part.Scale.Z)); + case ScriptBaseClass.PRIM_MEDIA_AUTO_PLAY: + res.Add(me.AutoPlay ? ScriptBaseClass.TRUE : ScriptBaseClass.FALSE); break; - case (int)ScriptBaseClass.PRIM_ROTATION: - res.Add(GetPartRot(part)); + case ScriptBaseClass.PRIM_MEDIA_AUTO_SCALE: + res.Add(me.AutoScale ? ScriptBaseClass.TRUE : ScriptBaseClass.FALSE); break; - case (int)ScriptBaseClass.PRIM_TYPE: - // implementing box - PrimitiveBaseShape Shape = part.Shape; - int primType = (int)part.GetPrimType(); - res.Add(new LSL_Integer(primType)); - double topshearx = (double)(sbyte)Shape.PathShearX / 100.0; // Fix negative values for PathShearX - double topsheary = (double)(sbyte)Shape.PathShearY / 100.0; // and PathShearY. - switch (primType) - { - case ScriptBaseClass.PRIM_TYPE_BOX: - case ScriptBaseClass.PRIM_TYPE_CYLINDER: - case ScriptBaseClass.PRIM_TYPE_PRISM: - res.Add(new LSL_Integer(Shape.ProfileCurve) & 0xf0); // Isolate hole shape nibble. - res.Add(new LSL_Vector(Shape.ProfileBegin / 50000.0, 1 - Shape.ProfileEnd / 50000.0, 0)); - res.Add(new LSL_Float(Shape.ProfileHollow / 50000.0)); - res.Add(new LSL_Vector(Shape.PathTwistBegin / 100.0, Shape.PathTwist / 100.0, 0)); - res.Add(new LSL_Vector(1 - (Shape.PathScaleX / 100.0 - 1), 1 - (Shape.PathScaleY / 100.0 - 1), 0)); - res.Add(new LSL_Vector(topshearx, topsheary, 0)); - break; - - case ScriptBaseClass.PRIM_TYPE_SPHERE: - res.Add(new LSL_Integer(Shape.ProfileCurve) & 0xf0); // Isolate hole shape nibble. - res.Add(new LSL_Vector(Shape.PathBegin / 50000.0, 1 - Shape.PathEnd / 50000.0, 0)); - res.Add(new LSL_Float(Shape.ProfileHollow / 50000.0)); - res.Add(new LSL_Vector(Shape.PathTwistBegin / 100.0, Shape.PathTwist / 100.0, 0)); - res.Add(new LSL_Vector(Shape.ProfileBegin / 50000.0, 1 - Shape.ProfileEnd / 50000.0, 0)); - break; + case ScriptBaseClass.PRIM_MEDIA_AUTO_ZOOM: + res.Add(me.AutoZoom ? ScriptBaseClass.TRUE : ScriptBaseClass.FALSE); + break; - case ScriptBaseClass.PRIM_TYPE_SCULPT: - res.Add(Shape.SculptTexture.ToString()); - res.Add(new LSL_Integer(Shape.SculptType)); - break; - - case ScriptBaseClass.PRIM_TYPE_RING: - case ScriptBaseClass.PRIM_TYPE_TUBE: - case ScriptBaseClass.PRIM_TYPE_TORUS: - // holeshape - res.Add(new LSL_Integer(Shape.ProfileCurve) & 0xf0); // Isolate hole shape nibble. - - // cut - res.Add(new LSL_Vector(Shape.PathBegin / 50000.0, 1 - Shape.PathEnd / 50000.0, 0)); - - // hollow - res.Add(new LSL_Float(Shape.ProfileHollow / 50000.0)); - - // twist - res.Add(new LSL_Vector(Shape.PathTwistBegin / 100.0, Shape.PathTwist / 100.0, 0)); - - // vector holesize - res.Add(new LSL_Vector(1 - (Shape.PathScaleX / 100.0 - 1), 1 - (Shape.PathScaleY / 100.0 - 1), 0)); - - // vector topshear - res.Add(new LSL_Vector(topshearx, topsheary, 0)); - - // vector profilecut - res.Add(new LSL_Vector(Shape.ProfileBegin / 50000.0, 1 - Shape.ProfileEnd / 50000.0, 0)); - - // vector tapera - res.Add(new LSL_Vector(Shape.PathTaperX / 100.0, Shape.PathTaperY / 100.0, 0)); - - // float revolutions - res.Add(new LSL_Float(Math.Round(Shape.PathRevolutions * 0.015d, 2, MidpointRounding.AwayFromZero)) + 1.0d); - // Slightly inaccurate, because an unsigned byte is being used to represent - // the entire range of floating-point values from 1.0 through 4.0 (which is how - // SL does it). - // - // Using these formulas to store and retrieve PathRevolutions, it is not - // possible to use all values between 1.00 and 4.00. For instance, you can't - // represent 1.10. You can represent 1.09 and 1.11, but not 1.10. So, if you - // use llSetPrimitiveParams to set revolutions to 1.10 and then retreive them - // with llGetPrimitiveParams, you'll retrieve 1.09. You can also see a similar - // behavior in the viewer as you cannot set 1.10. The viewer jumps to 1.11. - // In SL, llSetPrimitveParams and llGetPrimitiveParams can set and get a value - // such as 1.10. So, SL must store and retreive the actual user input rather - // than only storing the encoded value. - - // float radiusoffset - res.Add(new LSL_Float(Shape.PathRadiusOffset / 100.0)); - - // float skew - res.Add(new LSL_Float(Shape.PathSkew / 100.0)); - break; - } - break; - - case (int)ScriptBaseClass.PRIM_TEXTURE: - if (remain < 1) - return res; - - int face = (int)rules.GetLSLIntegerItem(idx++); - Primitive.TextureEntry tex = part.Shape.Textures; - if (face == ScriptBaseClass.ALL_SIDES) - { - for (face = 0 ; face < GetNumberOfSides(part); face++) - { - Primitive.TextureEntryFace texface = tex.GetFace((uint)face); - - res.Add(new LSL_String(texface.TextureID.ToString())); - res.Add(new LSL_Vector(texface.RepeatU, - texface.RepeatV, - 0)); - res.Add(new LSL_Vector(texface.OffsetU, - texface.OffsetV, - 0)); - res.Add(new LSL_Float(texface.Rotation)); - } - } - else - { - if (face >= 0 && face < GetNumberOfSides(part)) - { - Primitive.TextureEntryFace texface = tex.GetFace((uint)face); - - res.Add(new LSL_String(texface.TextureID.ToString())); - res.Add(new LSL_Vector(texface.RepeatU, - texface.RepeatV, - 0)); - res.Add(new LSL_Vector(texface.OffsetU, - texface.OffsetV, - 0)); - res.Add(new LSL_Float(texface.Rotation)); - } - } - break; - - case (int)ScriptBaseClass.PRIM_COLOR: - if (remain < 1) - return res; - - face=(int)rules.GetLSLIntegerItem(idx++); - - tex = part.Shape.Textures; - Color4 texcolor; - if (face == ScriptBaseClass.ALL_SIDES) - { - for (face = 0 ; face < GetNumberOfSides(part); face++) - { - texcolor = tex.GetFace((uint)face).RGBA; - res.Add(new LSL_Vector(texcolor.R, - texcolor.G, - texcolor.B)); - res.Add(new LSL_Float(texcolor.A)); - } - } - else - { - texcolor = tex.GetFace((uint)face).RGBA; - res.Add(new LSL_Vector(texcolor.R, - texcolor.G, - texcolor.B)); - res.Add(new LSL_Float(texcolor.A)); - } - break; - - case (int)ScriptBaseClass.PRIM_BUMP_SHINY: - if (remain < 1) - return res; - face = (int)rules.GetLSLIntegerItem(idx++); - - tex = part.Shape.Textures; - int shiny; - if (face == ScriptBaseClass.ALL_SIDES) - { - for (face = 0; face < GetNumberOfSides(part); face++) - { - Shininess shinyness = tex.GetFace((uint)face).Shiny; - if (shinyness == Shininess.High) - { - shiny = ScriptBaseClass.PRIM_SHINY_HIGH; - } - else if (shinyness == Shininess.Medium) - { - shiny = ScriptBaseClass.PRIM_SHINY_MEDIUM; - } - else if (shinyness == Shininess.Low) - { - shiny = ScriptBaseClass.PRIM_SHINY_LOW; - } - else - { - shiny = ScriptBaseClass.PRIM_SHINY_NONE; - } - res.Add(new LSL_Integer(shiny)); - res.Add(new LSL_Integer((int)tex.GetFace((uint)face).Bump)); - } - } - else - { - Shininess shinyness = tex.GetFace((uint)face).Shiny; - if (shinyness == Shininess.High) - { - shiny = ScriptBaseClass.PRIM_SHINY_HIGH; - } - else if (shinyness == Shininess.Medium) - { - shiny = ScriptBaseClass.PRIM_SHINY_MEDIUM; - } - else if (shinyness == Shininess.Low) - { - shiny = ScriptBaseClass.PRIM_SHINY_LOW; - } - else - { - shiny = ScriptBaseClass.PRIM_SHINY_NONE; - } - res.Add(new LSL_Integer(shiny)); - res.Add(new LSL_Integer((int)tex.GetFace((uint)face).Bump)); - } - break; - - case (int)ScriptBaseClass.PRIM_FULLBRIGHT: - if (remain < 1) - return res; - face = (int)rules.GetLSLIntegerItem(idx++); - - tex = part.Shape.Textures; - int fullbright; - if (face == ScriptBaseClass.ALL_SIDES) - { - for (face = 0; face < GetNumberOfSides(part); face++) - { - if (tex.GetFace((uint)face).Fullbright == true) - { - fullbright = ScriptBaseClass.TRUE; - } - else - { - fullbright = ScriptBaseClass.FALSE; - } - res.Add(new LSL_Integer(fullbright)); - } - } - else - { - if (tex.GetFace((uint)face).Fullbright == true) - { - fullbright = ScriptBaseClass.TRUE; - } - else - { - fullbright = ScriptBaseClass.FALSE; - } - res.Add(new LSL_Integer(fullbright)); - } - break; - - case (int)ScriptBaseClass.PRIM_FLEXIBLE: - PrimitiveBaseShape shape = part.Shape; - - if (shape.FlexiEntry) - res.Add(new LSL_Integer(1)); // active - else - res.Add(new LSL_Integer(0)); - res.Add(new LSL_Integer(shape.FlexiSoftness));// softness - res.Add(new LSL_Float(shape.FlexiGravity)); // gravity - res.Add(new LSL_Float(shape.FlexiDrag)); // friction - res.Add(new LSL_Float(shape.FlexiWind)); // wind - res.Add(new LSL_Float(shape.FlexiTension)); // tension - res.Add(new LSL_Vector(shape.FlexiForceX, // force - shape.FlexiForceY, - shape.FlexiForceZ)); - break; - - case (int)ScriptBaseClass.PRIM_TEXGEN: - // (PRIM_TEXGEN_DEFAULT, PRIM_TEXGEN_PLANAR) - if (remain < 1) - return res; - face = (int)rules.GetLSLIntegerItem(idx++); - - tex = part.Shape.Textures; - if (face == ScriptBaseClass.ALL_SIDES) - { - for (face = 0; face < GetNumberOfSides(part); face++) - { - if (tex.GetFace((uint)face).TexMapType == MappingType.Planar) - { - res.Add(new LSL_Integer(ScriptBaseClass.PRIM_TEXGEN_PLANAR)); - } - else - { - res.Add(new LSL_Integer(ScriptBaseClass.PRIM_TEXGEN_DEFAULT)); - } - } - } - else - { - if (tex.GetFace((uint)face).TexMapType == MappingType.Planar) - { - res.Add(new LSL_Integer(ScriptBaseClass.PRIM_TEXGEN_PLANAR)); - } - else - { - res.Add(new LSL_Integer(ScriptBaseClass.PRIM_TEXGEN_DEFAULT)); - } - } - break; - - case (int)ScriptBaseClass.PRIM_POINT_LIGHT: - shape = part.Shape; - - if (shape.LightEntry) - res.Add(new LSL_Integer(1)); // active - else - res.Add(new LSL_Integer(0)); - res.Add(new LSL_Vector(shape.LightColorR, // color - shape.LightColorG, - shape.LightColorB)); - res.Add(new LSL_Float(shape.LightIntensity)); // intensity - res.Add(new LSL_Float(shape.LightRadius)); // radius - res.Add(new LSL_Float(shape.LightFalloff)); // falloff - break; - - case (int)ScriptBaseClass.PRIM_GLOW: - if (remain < 1) - return res; - face = (int)rules.GetLSLIntegerItem(idx++); - - tex = part.Shape.Textures; - float primglow; - if (face == ScriptBaseClass.ALL_SIDES) - { - for (face = 0; face < GetNumberOfSides(part); face++) - { - primglow = tex.GetFace((uint)face).Glow; - res.Add(new LSL_Float(primglow)); - } - } - else - { - primglow = tex.GetFace((uint)face).Glow; - res.Add(new LSL_Float(primglow)); - } - break; - - case (int)ScriptBaseClass.PRIM_TEXT: - Color4 textColor = part.GetTextColor(); - res.Add(new LSL_String(part.Text)); - res.Add(new LSL_Vector(textColor.R, - textColor.G, - textColor.B)); - res.Add(new LSL_Float(textColor.A)); - break; - - case (int)ScriptBaseClass.PRIM_NAME: - res.Add(new LSL_String(part.Name)); - break; - - case (int)ScriptBaseClass.PRIM_DESC: - res.Add(new LSL_String(part.Description)); - break; - - case (int)ScriptBaseClass.PRIM_ROT_LOCAL: - res.Add(new LSL_Rotation(part.RotationOffset.X, part.RotationOffset.Y, part.RotationOffset.Z, part.RotationOffset.W)); - break; - - case (int)ScriptBaseClass.PRIM_POS_LOCAL: - res.Add(new LSL_Vector(GetPartLocalPos(part))); - break; - case (int)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 res; - LSL_Integer new_linknumber = rules.GetLSLIntegerItem(idx++); - LSL_List new_rules = rules.GetSublist(idx, -1); - LSL_List tres = llGetLinkPrimitiveParams((int)new_linknumber, new_rules); - res += tres; - return res; - case (int)ScriptBaseClass.PRIM_SLICE: - PrimType prim_type = part.GetPrimType(); - bool useProfileBeginEnd = (prim_type == PrimType.SPHERE || prim_type == PrimType.TORUS || prim_type == PrimType.TUBE || prim_type == PrimType.RING); - res.Add(new LSL_Vector( - (useProfileBeginEnd ? part.Shape.ProfileBegin : part.Shape.PathBegin) / 50000.0, - 1 - (useProfileBeginEnd ? part.Shape.ProfileEnd : part.Shape.PathEnd) / 50000.0, - 0 - )); - break; - } - } - return res; - } - - public LSL_List llGetPrimMediaParams(int face, LSL_List rules) - { - m_host.AddScriptLPS(1); - ScriptSleep(1000); - return GetPrimMediaParams(m_host, face, rules); - } - - public LSL_List llGetLinkMedia(LSL_Integer link, LSL_Integer face, LSL_List rules) - { - m_host.AddScriptLPS(1); - ScriptSleep(1000); - if (link == ScriptBaseClass.LINK_ROOT) - return GetPrimMediaParams(m_host.ParentGroup.RootPart, face, rules); - else if (link == ScriptBaseClass.LINK_THIS) - return GetPrimMediaParams(m_host, face, rules); - else - { - SceneObjectPart part = m_host.ParentGroup.GetLinkNumPart(link); - if (null != part) - return GetPrimMediaParams(part, face, rules); - } - - return new LSL_List(); - } - - private LSL_List GetPrimMediaParams(SceneObjectPart part, int face, LSL_List rules) - { - // LSL Spec http://wiki.secondlife.com/wiki/LlGetPrimMediaParams says to fail silently if face is invalid - // TODO: Need to correctly handle case where a face has no media (which gives back an empty list). - // Assuming silently fail means give back an empty list. Ideally, need to check this. - if (face < 0 || face > part.GetNumberOfSides() - 1) - return new LSL_List(); - - IMoapModule module = m_ScriptEngine.World.RequestModuleInterface(); - if (null == module) - return new LSL_List(); - - MediaEntry me = module.GetMediaEntry(part, face); - - // As per http://wiki.secondlife.com/wiki/LlGetPrimMediaParams - if (null == me) - return new LSL_List(); - - LSL_List res = new LSL_List(); - - for (int i = 0; i < rules.Length; i++) - { - int code = (int)rules.GetLSLIntegerItem(i); - - switch (code) - { - case ScriptBaseClass.PRIM_MEDIA_ALT_IMAGE_ENABLE: - // Not implemented - res.Add(new LSL_Integer(0)); - break; - - case ScriptBaseClass.PRIM_MEDIA_CONTROLS: - if (me.Controls == MediaControls.Standard) - res.Add(new LSL_Integer(ScriptBaseClass.PRIM_MEDIA_CONTROLS_STANDARD)); - else - res.Add(new LSL_Integer(ScriptBaseClass.PRIM_MEDIA_CONTROLS_MINI)); - break; - - case ScriptBaseClass.PRIM_MEDIA_CURRENT_URL: - res.Add(new LSL_String(me.CurrentURL)); - break; - - case ScriptBaseClass.PRIM_MEDIA_HOME_URL: - res.Add(new LSL_String(me.HomeURL)); - break; - - case ScriptBaseClass.PRIM_MEDIA_AUTO_LOOP: - res.Add(me.AutoLoop ? ScriptBaseClass.TRUE : ScriptBaseClass.FALSE); - break; - - case ScriptBaseClass.PRIM_MEDIA_AUTO_PLAY: - res.Add(me.AutoPlay ? ScriptBaseClass.TRUE : ScriptBaseClass.FALSE); - break; - - case ScriptBaseClass.PRIM_MEDIA_AUTO_SCALE: - res.Add(me.AutoScale ? ScriptBaseClass.TRUE : ScriptBaseClass.FALSE); - break; - - case ScriptBaseClass.PRIM_MEDIA_AUTO_ZOOM: - res.Add(me.AutoZoom ? ScriptBaseClass.TRUE : ScriptBaseClass.FALSE); - break; - - case ScriptBaseClass.PRIM_MEDIA_FIRST_CLICK_INTERACT: - res.Add(me.InteractOnFirstClick ? ScriptBaseClass.TRUE : ScriptBaseClass.FALSE); - break; + case ScriptBaseClass.PRIM_MEDIA_FIRST_CLICK_INTERACT: + res.Add(me.InteractOnFirstClick ? ScriptBaseClass.TRUE : ScriptBaseClass.FALSE); + break; case ScriptBaseClass.PRIM_MEDIA_WIDTH_PIXELS: res.Add(new LSL_Integer(me.Width)); @@ -13015,142 +12754,403 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api LSL_Vector sitOffset = (llRot2Up(new LSL_Rotation(av.Rotation.X, av.Rotation.Y, av.Rotation.Z, av.Rotation.W)) * av.Appearance.AvatarHeight * 0.02638f); - v = v + 2 * sitOffset; + v = v + 2 * sitOffset; + + av.OffsetPosition = new Vector3((float)v.x, (float)v.y, (float)v.z); + av.SendAvatarDataToAllAgents(); + + } + break; + + case (int)ScriptBaseClass.PRIM_ROT_LOCAL: + case (int)ScriptBaseClass.PRIM_ROTATION: + { + if (remain < 1) + return null; + + LSL_Rotation r; + r = rules.GetQuaternionItem(idx++); + + SceneObjectPart part = World.GetSceneObjectPart(av.ParentID); + if (part == null) + break; + + LSL_Rotation localRot = ScriptBaseClass.ZERO_ROTATION; + LSL_Vector localPos = ScriptBaseClass.ZERO_VECTOR; + + if (part.LinkNum > 1) + localRot = GetPartLocalRot(part); + + r = r * llGetRootRotation() / localRot; + av.Rotation = new Quaternion((float)r.x, (float)r.y, (float)r.z, (float)r.s); + av.SendAvatarDataToAllAgents(); + } + break; + + // parse rest doing nothing but number of parameters error check + case (int)ScriptBaseClass.PRIM_SIZE: + case (int)ScriptBaseClass.PRIM_MATERIAL: + case (int)ScriptBaseClass.PRIM_PHANTOM: + case (int)ScriptBaseClass.PRIM_PHYSICS: + case (int)ScriptBaseClass.PRIM_PHYSICS_SHAPE_TYPE: + case (int)ScriptBaseClass.PRIM_TEMP_ON_REZ: + case (int)ScriptBaseClass.PRIM_NAME: + case (int)ScriptBaseClass.PRIM_DESC: + if (remain < 1) + return null; + idx++; + break; + + case (int)ScriptBaseClass.PRIM_GLOW: + case (int)ScriptBaseClass.PRIM_FULLBRIGHT: + case (int)ScriptBaseClass.PRIM_TEXGEN: + if (remain < 2) + return null; + idx += 2; + break; + + case (int)ScriptBaseClass.PRIM_TYPE: + if (remain < 3) + return null; + code = (int)rules.GetLSLIntegerItem(idx++); + remain = rules.Length - idx; + switch (code) + { + case (int)ScriptBaseClass.PRIM_TYPE_BOX: + case (int)ScriptBaseClass.PRIM_TYPE_CYLINDER: + case (int)ScriptBaseClass.PRIM_TYPE_PRISM: + if (remain < 6) + return null; + idx += 6; + break; + + case (int)ScriptBaseClass.PRIM_TYPE_SPHERE: + if (remain < 5) + return null; + idx += 5; + break; + + case (int)ScriptBaseClass.PRIM_TYPE_TORUS: + case (int)ScriptBaseClass.PRIM_TYPE_TUBE: + case (int)ScriptBaseClass.PRIM_TYPE_RING: + if (remain < 11) + return null; + idx += 11; + break; + + case (int)ScriptBaseClass.PRIM_TYPE_SCULPT: + if (remain < 2) + return null; + idx += 2; + break; + } + break; + + case (int)ScriptBaseClass.PRIM_COLOR: + case (int)ScriptBaseClass.PRIM_TEXT: + case (int)ScriptBaseClass.PRIM_BUMP_SHINY: + case (int)ScriptBaseClass.PRIM_OMEGA: + if (remain < 3) + return null; + idx += 3; + break; + + case (int)ScriptBaseClass.PRIM_TEXTURE: + case (int)ScriptBaseClass.PRIM_POINT_LIGHT: + case (int)ScriptBaseClass.PRIM_PHYSICS_MATERIAL: + if (remain < 5) + return null; + idx += 5; + break; + + case (int)ScriptBaseClass.PRIM_FLEXIBLE: + if (remain < 7) + return null; + + idx += 7; + break; + + case (int)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 null; + + return rules.GetSublist(idx, -1); + } + } + } + + finally + { + if (positionChanged) + { + av.OffsetPosition = finalPos; +// av.SendAvatarDataToAllAgents(); + av.SendTerseUpdateToAllClients(); + positionChanged = false; + } + } + return null; + } + + public LSL_List GetPrimParams(ScenePresence avatar, LSL_List rules) + { + // avatars case + // replies as SL wiki + + LSL_List res = new LSL_List(); +// SceneObjectPart sitPart = avatar.ParentPart; // most likelly it will be needed + SceneObjectPart sitPart = World.GetSceneObjectPart(avatar.ParentID); // maybe better do this expensive search for it in case it's gone?? + + int idx = 0; + while (idx < rules.Length) + { + int code = (int)rules.GetLSLIntegerItem(idx++); + int remain = rules.Length - idx; + + switch (code) + { + case (int)ScriptBaseClass.PRIM_MATERIAL: + res.Add(new LSL_Integer((int)SOPMaterialData.SopMaterial.Flesh)); + break; + + case (int)ScriptBaseClass.PRIM_PHYSICS: + res.Add(new LSL_Integer(0)); + break; + + case (int)ScriptBaseClass.PRIM_TEMP_ON_REZ: + res.Add(new LSL_Integer(0)); + break; + + case (int)ScriptBaseClass.PRIM_PHANTOM: + res.Add(new LSL_Integer(0)); + break; + + case (int)ScriptBaseClass.PRIM_POSITION: + + Vector3 pos = avatar.OffsetPosition; + + Vector3 sitOffset = (Zrot(avatar.Rotation)) * (avatar.Appearance.AvatarHeight * 0.02638f *2.0f); + pos -= sitOffset; + + if( sitPart != null) + pos = sitPart.GetWorldPosition() + pos * sitPart.GetWorldRotation(); + + res.Add(new LSL_Vector(pos.X,pos.Y,pos.Z)); + break; + + case (int)ScriptBaseClass.PRIM_SIZE: + // as in llGetAgentSize above + res.Add(new LSL_Vector(0.45f, 0.6f, avatar.Appearance.AvatarHeight)); + break; + + case (int)ScriptBaseClass.PRIM_ROTATION: + Quaternion rot = avatar.Rotation; + if (sitPart != null) + { + rot = sitPart.GetWorldRotation() * rot; // apply sit part world rotation + } + + res.Add(new LSL_Rotation (rot.X, rot.Y, rot.Z, rot.W)); + break; + + case (int)ScriptBaseClass.PRIM_TYPE: + res.Add(new LSL_Integer(ScriptBaseClass.PRIM_TYPE_BOX)); + res.Add(new LSL_Integer(ScriptBaseClass.PRIM_HOLE_DEFAULT)); + res.Add(new LSL_Vector(0f,1.0f,0f)); + res.Add(new LSL_Float(0.0f)); + res.Add(new LSL_Vector(0, 0, 0)); + res.Add(new LSL_Vector(1.0f,1.0f,0f)); + res.Add(new LSL_Vector(0, 0, 0)); + break; + + case (int)ScriptBaseClass.PRIM_TEXTURE: + if (remain < 1) + return res; + + int face = (int)rules.GetLSLIntegerItem(idx++); + if (face == ScriptBaseClass.ALL_SIDES) + { + for (face = 0; face < 21; face++) + { + res.Add(new LSL_String("")); + res.Add(new LSL_Vector(0,0,0)); + res.Add(new LSL_Vector(0,0,0)); + res.Add(new LSL_Float(0.0)); + } + } + else + { + if (face >= 0 && face < 21) + { + res.Add(new LSL_String("")); + res.Add(new LSL_Vector(0,0,0)); + res.Add(new LSL_Vector(0,0,0)); + res.Add(new LSL_Float(0.0)); + } + } + break; + + case (int)ScriptBaseClass.PRIM_COLOR: + if (remain < 1) + return res; - av.OffsetPosition = new Vector3((float)v.x, (float)v.y, (float)v.z); - av.SendAvatarDataToAllAgents(); + face = (int)rules.GetLSLIntegerItem(idx++); + if (face == ScriptBaseClass.ALL_SIDES) + { + for (face = 0; face < 21; face++) + { + res.Add(new LSL_Vector(0,0,0)); + res.Add(new LSL_Float(0)); } - break; + } + else + { + res.Add(new LSL_Vector(0,0,0)); + res.Add(new LSL_Float(0)); + } + break; - case (int)ScriptBaseClass.PRIM_ROT_LOCAL: - case (int)ScriptBaseClass.PRIM_ROTATION: + case (int)ScriptBaseClass.PRIM_BUMP_SHINY: + if (remain < 1) + return res; + face = (int)rules.GetLSLIntegerItem(idx++); + + if (face == ScriptBaseClass.ALL_SIDES) + { + for (face = 0; face < 21; face++) { - if (remain < 1) - return null; + res.Add(new LSL_Integer(ScriptBaseClass.PRIM_SHINY_NONE)); + res.Add(new LSL_Integer(ScriptBaseClass.PRIM_BUMP_NONE)); + } + } + else + { + res.Add(new LSL_Integer(ScriptBaseClass.PRIM_SHINY_NONE)); + res.Add(new LSL_Integer(ScriptBaseClass.PRIM_BUMP_NONE)); + } + break; - LSL_Rotation r; - r = rules.GetQuaternionItem(idx++); + case (int)ScriptBaseClass.PRIM_FULLBRIGHT: + if (remain < 1) + return res; + face = (int)rules.GetLSLIntegerItem(idx++); - SceneObjectPart part = World.GetSceneObjectPart(av.ParentID); - if (part == null) - break; + if (face == ScriptBaseClass.ALL_SIDES) + { + for (face = 0; face < 21; face++) + { + res.Add(new LSL_Integer(ScriptBaseClass.FALSE)); + } + } + else + { + res.Add(new LSL_Integer(ScriptBaseClass.FALSE)); + } + break; - LSL_Rotation localRot = ScriptBaseClass.ZERO_ROTATION; - LSL_Vector localPos = ScriptBaseClass.ZERO_VECTOR; + case (int)ScriptBaseClass.PRIM_FLEXIBLE: + res.Add(new LSL_Integer(0)); + res.Add(new LSL_Integer(0));// softness + res.Add(new LSL_Float(0.0f)); // gravity + res.Add(new LSL_Float(0.0f)); // friction + res.Add(new LSL_Float(0.0f)); // wind + res.Add(new LSL_Float(0.0f)); // tension + res.Add(new LSL_Vector(0f,0f,0f)); + break; - if (part.LinkNum > 1) - localRot = GetPartLocalRot(part); + case (int)ScriptBaseClass.PRIM_TEXGEN: + // (PRIM_TEXGEN_DEFAULT, PRIM_TEXGEN_PLANAR) + if (remain < 1) + return res; + face = (int)rules.GetLSLIntegerItem(idx++); - r = r * llGetRootRotation() / localRot; - av.Rotation = new Quaternion((float)r.x, (float)r.y, (float)r.z, (float)r.s); - av.SendAvatarDataToAllAgents(); + if (face == ScriptBaseClass.ALL_SIDES) + { + for (face = 0; face < 21; face++) + { + res.Add(new LSL_Integer(ScriptBaseClass.PRIM_TEXGEN_DEFAULT)); } - break; + } + else + { + res.Add(new LSL_Integer(ScriptBaseClass.PRIM_TEXGEN_DEFAULT)); + } + break; - // parse rest doing nothing but number of parameters error check - case (int)ScriptBaseClass.PRIM_SIZE: - case (int)ScriptBaseClass.PRIM_MATERIAL: - case (int)ScriptBaseClass.PRIM_PHANTOM: - case (int)ScriptBaseClass.PRIM_PHYSICS: - case (int)ScriptBaseClass.PRIM_PHYSICS_SHAPE_TYPE: - case (int)ScriptBaseClass.PRIM_TEMP_ON_REZ: - case (int)ScriptBaseClass.PRIM_NAME: - case (int)ScriptBaseClass.PRIM_DESC: - if (remain < 1) - return null; - idx++; - break; + case (int)ScriptBaseClass.PRIM_POINT_LIGHT: + res.Add(new LSL_Integer(0)); + res.Add(new LSL_Vector(0f,0f,0f)); + res.Add(new LSL_Float(0f)); // intensity + res.Add(new LSL_Float(0f)); // radius + res.Add(new LSL_Float(0f)); // falloff + break; - case (int)ScriptBaseClass.PRIM_GLOW: - case (int)ScriptBaseClass.PRIM_FULLBRIGHT: - case (int)ScriptBaseClass.PRIM_TEXGEN: - if (remain < 2) - return null; - idx += 2; - break; + case (int)ScriptBaseClass.PRIM_GLOW: + if (remain < 1) + return res; + face = (int)rules.GetLSLIntegerItem(idx++); - case (int)ScriptBaseClass.PRIM_TYPE: - if (remain < 3) - return null; - code = (int)rules.GetLSLIntegerItem(idx++); - remain = rules.Length - idx; - switch (code) + if (face == ScriptBaseClass.ALL_SIDES) + { + for (face = 0; face < 21; face++) { - case (int)ScriptBaseClass.PRIM_TYPE_BOX: - case (int)ScriptBaseClass.PRIM_TYPE_CYLINDER: - case (int)ScriptBaseClass.PRIM_TYPE_PRISM: - if (remain < 6) - return null; - idx += 6; - break; - - case (int)ScriptBaseClass.PRIM_TYPE_SPHERE: - if (remain < 5) - return null; - idx += 5; - break; + res.Add(new LSL_Float(0f)); + } + } + else + { + res.Add(new LSL_Float(0f)); + } + break; - case (int)ScriptBaseClass.PRIM_TYPE_TORUS: - case (int)ScriptBaseClass.PRIM_TYPE_TUBE: - case (int)ScriptBaseClass.PRIM_TYPE_RING: - if (remain < 11) - return null; - idx += 11; - break; + case (int)ScriptBaseClass.PRIM_TEXT: + res.Add(new LSL_String("")); + res.Add(new LSL_Vector(0f,0f,0f)); + res.Add(new LSL_Float(1.0f)); + break; - case (int)ScriptBaseClass.PRIM_TYPE_SCULPT: - if (remain < 2) - return null; - idx += 2; - break; - } - break; + case (int)ScriptBaseClass.PRIM_NAME: + res.Add(new LSL_String(avatar.Name)); + break; - case (int)ScriptBaseClass.PRIM_COLOR: - case (int)ScriptBaseClass.PRIM_TEXT: - case (int)ScriptBaseClass.PRIM_BUMP_SHINY: - case (int)ScriptBaseClass.PRIM_OMEGA: - if (remain < 3) - return null; - idx += 3; - break; + case (int)ScriptBaseClass.PRIM_DESC: + res.Add(new LSL_String("")); + break; - case (int)ScriptBaseClass.PRIM_TEXTURE: - case (int)ScriptBaseClass.PRIM_POINT_LIGHT: - case (int)ScriptBaseClass.PRIM_PHYSICS_MATERIAL: - if (remain < 5) - return null; - idx += 5; - break; + case (int)ScriptBaseClass.PRIM_ROT_LOCAL: + Quaternion lrot = avatar.Rotation; - case (int)ScriptBaseClass.PRIM_FLEXIBLE: - if (remain < 7) - return null; + if (sitPart != null && sitPart != sitPart.ParentGroup.RootPart) + { + lrot = sitPart.RotationOffset * lrot; // apply sit part rotation offset + } + res.Add(new LSL_Rotation(lrot.X, lrot.Y, lrot.Z, lrot.W)); + break; - idx += 7; - break; + case (int)ScriptBaseClass.PRIM_POS_LOCAL: + Vector3 lpos = avatar.OffsetPosition; // pos relative to sit part + Vector3 lsitOffset = (Zrot(avatar.Rotation)) * (avatar.Appearance.AvatarHeight * 0.02638f * 2.0f); + lpos -= lsitOffset; - case (int)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 null; + if (sitPart != null && sitPart != sitPart.ParentGroup.RootPart) + { + lpos = sitPart.OffsetPosition + (lpos * sitPart.RotationOffset); // make it relative to root prim + } + res.Add(new LSL_Vector(lpos.X,lpos.Y,lpos.Z)); + break; - return rules.GetSublist(idx, -1); - } - } - } + case (int)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 res; + LSL_Integer new_linknumber = rules.GetLSLIntegerItem(idx++); + LSL_List new_rules = rules.GetSublist(idx, -1); - finally - { - if (positionChanged) - { - av.OffsetPosition = finalPos; -// av.SendAvatarDataToAllAgents(); - av.SendTerseUpdateToAllClients(); - positionChanged = false; + res += llGetLinkPrimitiveParams((int)new_linknumber, new_rules); + return res; } } - return null; + return res; } } } -- cgit v1.1 From 86d4e45f4d5ce7de4a2043dfe753f620925e28c4 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sat, 25 Aug 2012 21:03:47 +0100 Subject: since we will be making the Get return type the remaining ruleset as with the Set return type, we need to move the original return type to a ref param Conflicts: OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs --- .../Shared/Api/Implementation/LSL_Api.cs | 274 +++++++++++---------- .../Shared/Api/Implementation/OSSL_Api.cs | 2 +- 2 files changed, 139 insertions(+), 137 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 64f145b..fbb91ce 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -8636,7 +8636,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public LSL_List llGetPrimitiveParams(LSL_List rules) { m_host.AddScriptLPS(1); - return GetPrimParams(m_host, rules); + + LSL_List result = new LSL_List(); + + GetPrimParams(m_host, rules, ref result); + + return result; } public LSL_List llGetLinkPrimitiveParams(int linknumber, LSL_List rules) @@ -8655,24 +8660,22 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { foreach (var part in parts) { - LSL_List partRes = GetPrimParams(part, rules); - res += partRes; + GetPrimParams(part, rules, ref res); } } if (avatars.Count > 0) { foreach (ScenePresence avatar in avatars) { - LSL_List avaRes = GetPrimParams(avatar, rules); - res += avaRes; + GetPrimParams(avatar, rules, ref res); } + // TODO: FINISH MERGE } return res; } - public LSL_List GetPrimParams(SceneObjectPart part, LSL_List rules) + public void GetPrimParams(SceneObjectPart part, LSL_List rules, ref LSL_List res) { - LSL_List res = new LSL_List(); int idx=0; while (idx < rules.Length) { @@ -8810,7 +8813,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api case (int)ScriptBaseClass.PRIM_TEXTURE: if (remain < 1) - return res; + return; int face = (int)rules.GetLSLIntegerItem(idx++); Primitive.TextureEntry tex = part.Shape.Textures; @@ -8850,7 +8853,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api case (int)ScriptBaseClass.PRIM_COLOR: if (remain < 1) - return res; + return; face=(int)rules.GetLSLIntegerItem(idx++); @@ -8879,7 +8882,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api case (int)ScriptBaseClass.PRIM_BUMP_SHINY: if (remain < 1) - return res; + return; face = (int)rules.GetLSLIntegerItem(idx++); tex = part.Shape.Textures; @@ -8935,7 +8938,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api case (int)ScriptBaseClass.PRIM_FULLBRIGHT: if (remain < 1) - return res; + return; face = (int)rules.GetLSLIntegerItem(idx++); tex = part.Shape.Textures; @@ -8989,7 +8992,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api case (int)ScriptBaseClass.PRIM_TEXGEN: // (PRIM_TEXGEN_DEFAULT, PRIM_TEXGEN_PLANAR) if (remain < 1) - return res; + return; face = (int)rules.GetLSLIntegerItem(idx++); tex = part.Shape.Textures; @@ -9037,7 +9040,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api case (int)ScriptBaseClass.PRIM_GLOW: if (remain < 1) - return res; + return; face = (int)rules.GetLSLIntegerItem(idx++); tex = part.Shape.Textures; @@ -9083,12 +9086,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api break; case (int)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 res; + return; LSL_Integer new_linknumber = rules.GetLSLIntegerItem(idx++); LSL_List new_rules = rules.GetSublist(idx, -1); LSL_List tres = llGetLinkPrimitiveParams((int)new_linknumber, new_rules); res += tres; - return res; + return; case (int)ScriptBaseClass.PRIM_SLICE: PrimType prim_type = part.GetPrimType(); bool useProfileBeginEnd = (prim_type == PrimType.SPHERE || prim_type == PrimType.TORUS || prim_type == PrimType.TUBE || prim_type == PrimType.RING); @@ -9100,7 +9103,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api break; } } - return res; } public LSL_List llGetPrimMediaParams(int face, LSL_List rules) @@ -11661,13 +11663,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public LSL_List GetPrimitiveParamsEx(LSL_Key prim, LSL_List rules) { SceneObjectPart obj = World.GetSceneObjectPart(new UUID(prim)); - if (obj == null) - return new LSL_List(); - if (obj.OwnerID != m_host.OwnerID) - return new LSL_List(); + LSL_List result = new LSL_List(); - return GetPrimParams(obj, rules); + if (obj != null && obj.OwnerID != m_host.OwnerID) + { + GetPrimParams(obj, rules, ref result); + } + + return result; } public LSL_Integer llGetLinkNumberOfSides(LSL_Integer link) @@ -12604,110 +12608,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } } } - } - - public class NotecardCache - { - protected class Notecard - { - public string[] text; - public DateTime lastRef; - } - - protected static Dictionary m_Notecards = - new Dictionary(); - - public static void Cache(UUID assetID, string text) - { - CacheCheck(); - - lock (m_Notecards) - { - if (m_Notecards.ContainsKey(assetID)) - return; - - Notecard nc = new Notecard(); - nc.lastRef = DateTime.Now; - nc.text = SLUtil.ParseNotecardToList(text).ToArray(); - m_Notecards[assetID] = nc; - } - } - - public static bool IsCached(UUID assetID) - { - lock (m_Notecards) - { - return m_Notecards.ContainsKey(assetID); - } - } - - public static int GetLines(UUID assetID) - { - if (!IsCached(assetID)) - return -1; - - lock (m_Notecards) - { - m_Notecards[assetID].lastRef = DateTime.Now; - return m_Notecards[assetID].text.Length; - } - } - - /// - /// Get a notecard line. - /// - /// - /// Lines start at index 0 - /// - public static string GetLine(UUID assetID, int lineNumber) - { - if (lineNumber < 0) - return ""; - - string data; - - if (!IsCached(assetID)) - return ""; - - lock (m_Notecards) - { - m_Notecards[assetID].lastRef = DateTime.Now; - - if (lineNumber >= m_Notecards[assetID].text.Length) - return "\n\n\n"; - - data = m_Notecards[assetID].text[lineNumber]; - - return data; - } - } - - /// - /// Get a notecard line. - /// - /// - /// Lines start at index 0 - /// Maximum length of the returned line. Longer lines will be truncated - /// - public static string GetLine(UUID assetID, int lineNumber, int maxLength) - { - string line = GetLine(assetID, lineNumber); - - if (line.Length > maxLength) - line = line.Substring(0, maxLength); - - return line; - } - - public static void CacheCheck() - { - foreach (UUID key in new List(m_Notecards.Keys)) - { - Notecard nc = m_Notecards[key]; - if (nc.lastRef.AddSeconds(30) < DateTime.Now) - m_Notecards.Remove(key); - } - } protected LSL_List SetPrimParams(ScenePresence av, LSL_List rules) { @@ -12892,12 +12792,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return null; } - public LSL_List GetPrimParams(ScenePresence avatar, LSL_List rules) + public void GetPrimParams(ScenePresence avatar, LSL_List rules, ref LSL_List res) { // avatars case // replies as SL wiki - LSL_List res = new LSL_List(); // SceneObjectPart sitPart = avatar.ParentPart; // most likelly it will be needed SceneObjectPart sitPart = World.GetSceneObjectPart(avatar.ParentID); // maybe better do this expensive search for it in case it's gone?? @@ -12965,7 +12864,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api case (int)ScriptBaseClass.PRIM_TEXTURE: if (remain < 1) - return res; + return; int face = (int)rules.GetLSLIntegerItem(idx++); if (face == ScriptBaseClass.ALL_SIDES) @@ -12992,7 +12891,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api case (int)ScriptBaseClass.PRIM_COLOR: if (remain < 1) - return res; + return; face = (int)rules.GetLSLIntegerItem(idx++); @@ -13013,7 +12912,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api case (int)ScriptBaseClass.PRIM_BUMP_SHINY: if (remain < 1) - return res; + return; face = (int)rules.GetLSLIntegerItem(idx++); if (face == ScriptBaseClass.ALL_SIDES) @@ -13033,7 +12932,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api case (int)ScriptBaseClass.PRIM_FULLBRIGHT: if (remain < 1) - return res; + return; face = (int)rules.GetLSLIntegerItem(idx++); if (face == ScriptBaseClass.ALL_SIDES) @@ -13062,7 +12961,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api case (int)ScriptBaseClass.PRIM_TEXGEN: // (PRIM_TEXGEN_DEFAULT, PRIM_TEXGEN_PLANAR) if (remain < 1) - return res; + return; face = (int)rules.GetLSLIntegerItem(idx++); if (face == ScriptBaseClass.ALL_SIDES) @@ -13088,7 +12987,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api case (int)ScriptBaseClass.PRIM_GLOW: if (remain < 1) - return res; + return; face = (int)rules.GetLSLIntegerItem(idx++); if (face == ScriptBaseClass.ALL_SIDES) @@ -13142,15 +13041,118 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api case (int)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 res; + return; LSL_Integer new_linknumber = rules.GetLSLIntegerItem(idx++); LSL_List new_rules = rules.GetSublist(idx, -1); res += llGetLinkPrimitiveParams((int)new_linknumber, new_rules); - return res; + return; } } - return res; + } + } + + public class NotecardCache + { + protected class Notecard + { + public string[] text; + public DateTime lastRef; + } + + protected static Dictionary m_Notecards = + new Dictionary(); + + public static void Cache(UUID assetID, string text) + { + CacheCheck(); + + lock (m_Notecards) + { + if (m_Notecards.ContainsKey(assetID)) + return; + + Notecard nc = new Notecard(); + nc.lastRef = DateTime.Now; + nc.text = SLUtil.ParseNotecardToList(text).ToArray(); + m_Notecards[assetID] = nc; + } + } + + public static bool IsCached(UUID assetID) + { + lock (m_Notecards) + { + return m_Notecards.ContainsKey(assetID); + } + } + + public static int GetLines(UUID assetID) + { + if (!IsCached(assetID)) + return -1; + + lock (m_Notecards) + { + m_Notecards[assetID].lastRef = DateTime.Now; + return m_Notecards[assetID].text.Length; + } + } + + /// + /// Get a notecard line. + /// + /// + /// Lines start at index 0 + /// + public static string GetLine(UUID assetID, int lineNumber) + { + if (lineNumber < 0) + return ""; + + string data; + + if (!IsCached(assetID)) + return ""; + + lock (m_Notecards) + { + m_Notecards[assetID].lastRef = DateTime.Now; + + if (lineNumber >= m_Notecards[assetID].text.Length) + return "\n\n\n"; + + data = m_Notecards[assetID].text[lineNumber]; + + return data; + } + } + + /// + /// Get a notecard line. + /// + /// + /// Lines start at index 0 + /// Maximum length of the returned line. Longer lines will be truncated + /// + public static string GetLine(UUID assetID, int lineNumber, int maxLength) + { + string line = GetLine(assetID, lineNumber); + + if (line.Length > maxLength) + line = line.Substring(0, maxLength); + + return line; + } + + public static void CacheCheck() + { + foreach (UUID key in new List(m_Notecards.Keys)) + { + Notecard nc = m_Notecards[key]; + if (nc.lastRef.AddSeconds(30) < DateTime.Now) + m_Notecards.Remove(key); + } } } } diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 7b71a24..efd1f39 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -2261,7 +2261,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api List parts = ((LSL_Api)m_LSL_Api).GetLinkParts(linknumber); foreach (SceneObjectPart part in parts) { - retVal += ((LSL_Api)m_LSL_Api).GetPrimParams(part, rules); + ((LSL_Api)m_LSL_Api).GetPrimParams(part, rules, ref retVal); } return retVal; } -- cgit v1.1 From 3d8f393fbe0072d93fc8303741420bb36c844d44 Mon Sep 17 00:00:00 2001 From: SignpostMarv Date: Fri, 24 Aug 2012 17:25:37 +0100 Subject: refactoring to local variable for cleaner code --- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index efd1f39..43cfea2 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -2257,11 +2257,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api CheckThreatLevel(ThreatLevel.High, "osGetLinkPrimitiveParams"); m_host.AddScriptLPS(1); InitLSL(); + // One needs to cast m_LSL_Api because we're using functions not + // on the ILSL_Api interface. + LSL_Api LSL_Api = (LSL_Api)m_LSL_Api; LSL_List retVal = new LSL_List(); - List parts = ((LSL_Api)m_LSL_Api).GetLinkParts(linknumber); + List parts = LSL_Api.GetLinkParts(linknumber); foreach (SceneObjectPart part in parts) { - ((LSL_Api)m_LSL_Api).GetPrimParams(part, rules, ref retVal); + LSL_Api.GetPrimParams(part, rules, ref retVal); } return retVal; } -- cgit v1.1 From bc4bda4441c51779b94307ad60782b037f0a3f2c Mon Sep 17 00:00:00 2001 From: Melanie Date: Sat, 25 Aug 2012 21:08:33 +0100 Subject: Minor formatting cleanup --- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index fbb91ce..ed3c2a4 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -7735,10 +7735,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api remaining = SetPrimParams((ScenePresence)part, rules); } - while((object)remaining != null && remaining.Length > 2) + while ((object)remaining != null && remaining.Length > 2) { linknumber = remaining.GetLSLIntegerItem(0); - rules = remaining.GetSublist(1,-1); + rules = remaining.GetSublist(1, -1); parts.Clear(); prims = GetLinkParts(linknumber); avatars = GetLinkAvatars(linknumber); -- cgit v1.1 From 3bf7bd6359ffbbc2a00b6870b72cc78287a70bc7 Mon Sep 17 00:00:00 2001 From: SignpostMarv Date: Tue, 28 Aug 2012 03:21:04 +0100 Subject: track originating IScriptApi method for SL-like error messages. Will add rule number tracking in next commit. --- .../Shared/Api/Implementation/LSL_Api.cs | 26 +++++++++++++--------- .../Shared/Api/Implementation/OSSL_Api.cs | 2 +- 2 files changed, 16 insertions(+), 12 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index b001c51..709cac2 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -7208,7 +7208,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { m_host.AddScriptLPS(1); - setLinkPrimParams(ScriptBaseClass.LINK_THIS, rules); + setLinkPrimParams(ScriptBaseClass.LINK_THIS, rules, "llSetPrimitiveParams"); ScriptSleep(200); } @@ -7217,7 +7217,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { m_host.AddScriptLPS(1); - setLinkPrimParams(linknumber, rules); + setLinkPrimParams(linknumber, rules, "llSetLinkPrimitiveParams"); ScriptSleep(200); } @@ -7226,17 +7226,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { m_host.AddScriptLPS(1); - setLinkPrimParams(linknumber, rules); + setLinkPrimParams(linknumber, rules, "llSetLinkPrimitiveParamsFast"); } - protected void setLinkPrimParams(int linknumber, LSL_List rules) + protected void setLinkPrimParams(int linknumber, LSL_List rules, string originFunc) { List parts = GetLinkParts(linknumber); LSL_List remaining = null; foreach (SceneObjectPart part in parts) - remaining = SetPrimParams(part, rules); + remaining = SetPrimParams(part, rules, originFunc); while (remaining != null && remaining.Length > 2) { @@ -7245,13 +7245,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api parts = GetLinkParts(linknumber); foreach (SceneObjectPart part in parts) - remaining = SetPrimParams(part, rules); + remaining = SetPrimParams(part, rules, originFunc); } } - protected LSL_List SetPrimParams(SceneObjectPart part, LSL_List rules) + protected LSL_List SetPrimParams(SceneObjectPart part, LSL_List rules, string originFunc) { int idx = 0; + int idxStart = 0; bool positionChanged = false; LSL_Vector currentPosition = GetPartLocalPos(part); @@ -7263,6 +7264,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api int code = rules.GetLSLIntegerItem(idx++); int remain = rules.Length - idx; + idxStart = idx; int face; LSL_Vector v; @@ -7639,7 +7641,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } catch (InvalidCastException e) { - ShoutError(e.Message); + ShoutError(string.Format( + "{0} error running rule #{1}: arg #{2} ", + originFunc, "unknown", idx - idxStart) + e.Message); } finally { @@ -10761,7 +10765,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return tid.ToString(); } - public void SetPrimitiveParamsEx(LSL_Key prim, LSL_List rules) + public void SetPrimitiveParamsEx(LSL_Key prim, LSL_List rules, string originFunc) { SceneObjectPart obj = World.GetSceneObjectPart(new UUID(prim)); if (obj == null) @@ -10770,14 +10774,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (obj.OwnerID != m_host.OwnerID) return; - LSL_List remaining = SetPrimParams(obj, rules); + LSL_List remaining = SetPrimParams(obj, rules, originFunc); while ((object)remaining != null && remaining.Length > 2) { LSL_Integer newLink = remaining.GetLSLIntegerItem(0); LSL_List newrules = remaining.GetSublist(1, -1); foreach(SceneObjectPart part in GetLinkParts(obj, newLink)){ - remaining = SetPrimParams(part, newrules); + remaining = SetPrimParams(part, newrules, originFunc); } } } diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 1afa4fb..09fcf50 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -2988,7 +2988,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api m_host.AddScriptLPS(1); InitLSL(); - m_LSL_Api.SetPrimitiveParamsEx(prim, rules); + m_LSL_Api.SetPrimitiveParamsEx(prim, rules, "osSetPrimitiveParams"); } /// -- cgit v1.1 From 0c3061f973417ecce8f412c82139cfad82504921 Mon Sep 17 00:00:00 2001 From: SignpostMarv Date: Tue, 28 Aug 2012 03:40:27 +0100 Subject: implementing rule tracking --- .../ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 709cac2..ae92716 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -7234,9 +7234,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api List parts = GetLinkParts(linknumber); LSL_List remaining = null; + uint rulesParsed = 0; foreach (SceneObjectPart part in parts) - remaining = SetPrimParams(part, rules, originFunc); + remaining = SetPrimParams(part, rules, originFunc, ref rulesParsed); while (remaining != null && remaining.Length > 2) { @@ -7245,11 +7246,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api parts = GetLinkParts(linknumber); foreach (SceneObjectPart part in parts) - remaining = SetPrimParams(part, rules, originFunc); + remaining = SetPrimParams(part, rules, originFunc, ref rulesParsed); } } - protected LSL_List SetPrimParams(SceneObjectPart part, LSL_List rules, string originFunc) + protected LSL_List SetPrimParams(SceneObjectPart part, LSL_List rules, string originFunc, ref uint rulesParsed) { int idx = 0; int idxStart = 0; @@ -7261,6 +7262,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { while (idx < rules.Length) { + ++rulesParsed; int code = rules.GetLSLIntegerItem(idx++); int remain = rules.Length - idx; @@ -7643,7 +7645,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { ShoutError(string.Format( "{0} error running rule #{1}: arg #{2} ", - originFunc, "unknown", idx - idxStart) + e.Message); + originFunc, rulesParsed, idx - idxStart) + e.Message); } finally { @@ -10774,14 +10776,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (obj.OwnerID != m_host.OwnerID) return; - LSL_List remaining = SetPrimParams(obj, rules, originFunc); + uint rulesParsed = 0; + LSL_List remaining = SetPrimParams(obj, rules, originFunc, ref rulesParsed); while ((object)remaining != null && remaining.Length > 2) { LSL_Integer newLink = remaining.GetLSLIntegerItem(0); LSL_List newrules = remaining.GetSublist(1, -1); foreach(SceneObjectPart part in GetLinkParts(obj, newLink)){ - remaining = SetPrimParams(part, newrules, originFunc); + remaining = SetPrimParams(part, newrules, originFunc, ref rulesParsed); } } } -- cgit v1.1 From 3d736d575ff9670ac813f13eb1cff07dea10328b Mon Sep 17 00:00:00 2001 From: Mic Bowman Date: Wed, 29 Aug 2012 14:56:51 -0700 Subject: This partially implements the LSL function to set the response type for an HTTP request. Since the "official" LSL function limits the use of the response type, it is implemented as osSetContentType with a string for the content mime type and a threat level of high. With this function you should be able to implement rather functional media-on-a-prim application with much less difficulty. --- .../ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 09fcf50..e245684 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -140,12 +140,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api internal float m_ScriptDistanceFactor = 1.0f; internal Dictionary m_FunctionPerms = new Dictionary(); + protected IUrlModule m_UrlModule = null; + public void Initialize(IScriptEngine ScriptEngine, SceneObjectPart host, TaskInventoryItem item) { m_ScriptEngine = ScriptEngine; m_host = host; m_item = item; + m_UrlModule = m_ScriptEngine.World.RequestModuleInterface(); + if (m_ScriptEngine.Config.GetBoolean("AllowOSFunctions", false)) m_OSFunctionsEnabled = true; @@ -3358,5 +3362,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return new LSL_Key(m_host.ParentGroup.FromPartID.ToString()); } - } + + /// + /// Sets the response type for an HTTP request/response + /// + /// + public void osSetContentType(LSL_Key id, string type) + { + CheckThreatLevel(ThreatLevel.High,"osSetResponseType"); + if (m_UrlModule != null) + m_UrlModule.HttpContentType(new UUID(id),type); + } + + } } \ No newline at end of file -- cgit v1.1 From 6b277394c080f5ad50d07e94f3e21340da4913b3 Mon Sep 17 00:00:00 2001 From: SignpostMarv Date: Wed, 29 Aug 2012 17:21:01 +0100 Subject: refactoring as the list funcs either skip invalid values or recall ToDoubleList --- .../Shared/Api/Implementation/LSL_Api.cs | 23 +++++++++++----------- 1 file changed, 11 insertions(+), 12 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index ae92716..45286c0 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -10119,31 +10119,30 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public LSL_Float llListStatistics(int operation, LSL_List src) { m_host.AddScriptLPS(1); - LSL_List nums = LSL_List.ToDoubleList(src); switch (operation) { case ScriptBaseClass.LIST_STAT_RANGE: - return nums.Range(); + return src.Range(); case ScriptBaseClass.LIST_STAT_MIN: - return nums.Min(); + return src.Min(); case ScriptBaseClass.LIST_STAT_MAX: - return nums.Max(); + return src.Max(); case ScriptBaseClass.LIST_STAT_MEAN: - return nums.Mean(); + return src.Mean(); case ScriptBaseClass.LIST_STAT_MEDIAN: - return nums.Median(); + return LSL_List.ToDoubleList(src).Median(); case ScriptBaseClass.LIST_STAT_NUM_COUNT: - return nums.NumericLength(); + return src.NumericLength(); case ScriptBaseClass.LIST_STAT_STD_DEV: - return nums.StdDev(); + return src.StdDev(); case ScriptBaseClass.LIST_STAT_SUM: - return nums.Sum(); + return src.Sum(); case ScriptBaseClass.LIST_STAT_SUM_SQUARES: - return nums.SumSqrs(); + return src.SumSqrs(); case ScriptBaseClass.LIST_STAT_GEOMETRIC_MEAN: - return nums.GeometricMean(); + return src.GeometricMean(); case ScriptBaseClass.LIST_STAT_HARMONIC_MEAN: - return nums.HarmonicMean(); + return src.HarmonicMean(); default: return 0.0; } -- cgit v1.1 From 3c019bea8c006c6d09e6fa5583f60e01a87b766b Mon Sep 17 00:00:00 2001 From: SignpostMarv Date: Thu, 30 Aug 2012 15:55:03 +0100 Subject: Implementing a vastly simpler means of allowing region modules to access GetLinkParts than mantis 6236 --- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 45286c0..be22cb4 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -247,7 +247,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return GetLinkParts(m_host, linkType); } - private List GetLinkParts(SceneObjectPart part, int linkType) + public static List GetLinkParts(SceneObjectPart part, int linkType) { List ret = new List(); ret.Add(part); -- cgit v1.1 From f7b88d1c40ba06c62491d8d32809fe6c1c4d360d Mon Sep 17 00:00:00 2001 From: SignpostMarv Date: Sun, 2 Sep 2012 13:43:16 +0100 Subject: made setting rotation match Second Life --- .../Shared/Api/Implementation/LSL_Api.cs | 33 +--------------------- 1 file changed, 1 insertion(+), 32 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index be22cb4..9f952d1 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -2083,23 +2083,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public void llSetRot(LSL_Rotation rot) { m_host.AddScriptLPS(1); - - // try to let this work as in SL... - if (m_host.ParentID == 0) - { - // special case: If we are root, rotate complete SOG to new rotation SetRot(m_host, rot); - } - else - { - // we are a child. The rotation values will be set to the one of root modified by rot, as in SL. Don't ask. - SceneObjectPart rootPart = m_host.ParentGroup.RootPart; - if (rootPart != null) // better safe than sorry - { - SetRot(m_host, rootPart.RotationOffset * (Quaternion)rot); - } - } - ScriptSleep(200); } @@ -7292,22 +7276,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api break; case (int)ScriptBaseClass.PRIM_ROTATION: + case (int)ScriptBaseClass.PRIM_ROT_LOCAL: if (remain < 1) return null; LSL_Rotation q = rules.GetQuaternionItem(idx++); - // try to let this work as in SL... - if (part.ParentID == 0) - { - // special case: If we are root, rotate complete SOG to new rotation SetRot(part, q); - } - else - { - // we are a child. The rotation values will be set to the one of root modified by rot, as in SL. Don't ask. - SceneObjectPart rootPart = part.ParentGroup.RootPart; - SetRot(part, rootPart.RotationOffset * (Quaternion)q); - } break; @@ -7614,11 +7588,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api string primDesc = rules.GetLSLStringItem(idx++); part.Description = primDesc; break; - case (int)ScriptBaseClass.PRIM_ROT_LOCAL: - if (remain < 1) - return null; - SetRot(part, rules.GetQuaternionItem(idx++)); - break; case (int)ScriptBaseClass.PRIM_OMEGA: if (remain < 3) return null; -- cgit v1.1 From a3d140b57c5e2ae0f3334d59b82e116d40199b49 Mon Sep 17 00:00:00 2001 From: SignpostMarv Date: Sun, 2 Sep 2012 13:45:42 +0100 Subject: no need to assign rotation to a variable now --- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 9f952d1..6f4bc8b 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -7280,8 +7280,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (remain < 1) return null; - LSL_Rotation q = rules.GetQuaternionItem(idx++); - SetRot(part, q); + SetRot(part, rules.GetQuaternionItem(idx++)); break; -- cgit v1.1 From fb211c64fd9d335f4879549023870b1e28416f74 Mon Sep 17 00:00:00 2001 From: SignpostMarv Date: Sun, 2 Sep 2012 13:47:18 +0100 Subject: formatting --- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 6f4bc8b..1d2ef40 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -2083,7 +2083,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public void llSetRot(LSL_Rotation rot) { m_host.AddScriptLPS(1); - SetRot(m_host, rot); + SetRot(m_host, rot); ScriptSleep(200); } @@ -7280,7 +7280,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (remain < 1) return null; - SetRot(part, rules.GetQuaternionItem(idx++)); + SetRot(part, rules.GetQuaternionItem(idx++)); break; -- cgit v1.1 From 359f9efc768d701460491b64b75660bf3c145419 Mon Sep 17 00:00:00 2001 From: Melanie Date: Mon, 3 Sep 2012 21:51:54 +0100 Subject: Revert "formatting" This reverts commit fb211c64fd9d335f4879549023870b1e28416f74. --- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 1d2ef40..6f4bc8b 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -2083,7 +2083,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public void llSetRot(LSL_Rotation rot) { m_host.AddScriptLPS(1); - SetRot(m_host, rot); + SetRot(m_host, rot); ScriptSleep(200); } @@ -7280,7 +7280,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (remain < 1) return null; - SetRot(part, rules.GetQuaternionItem(idx++)); + SetRot(part, rules.GetQuaternionItem(idx++)); break; -- cgit v1.1 From 29218cdb3169b70e047acc372433769ece3ffae1 Mon Sep 17 00:00:00 2001 From: Melanie Date: Mon, 3 Sep 2012 21:52:03 +0100 Subject: Revert "no need to assign rotation to a variable now" This reverts commit a3d140b57c5e2ae0f3334d59b82e116d40199b49. --- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 6f4bc8b..9f952d1 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -7280,7 +7280,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (remain < 1) return null; - SetRot(part, rules.GetQuaternionItem(idx++)); + LSL_Rotation q = rules.GetQuaternionItem(idx++); + SetRot(part, q); break; -- cgit v1.1 From d297eb39e57f9dc70abe43839e263af19b5777e2 Mon Sep 17 00:00:00 2001 From: Melanie Date: Mon, 3 Sep 2012 21:52:12 +0100 Subject: Revert "made setting rotation match Second Life" Second Life seems to have introduced a bug, as we have confirmation that SL behavior changed recently and changed in contradiction to their stated intention This appears to be another of the bugs SL is notorious for. Signpost and I have decided to back this out until SL's intention becomes clear. This reverts commit f7b88d1c40ba06c62491d8d32809fe6c1c4d360d. --- .../Shared/Api/Implementation/LSL_Api.cs | 33 +++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 9f952d1..be22cb4 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -2083,7 +2083,23 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public void llSetRot(LSL_Rotation rot) { m_host.AddScriptLPS(1); + + // try to let this work as in SL... + if (m_host.ParentID == 0) + { + // special case: If we are root, rotate complete SOG to new rotation SetRot(m_host, rot); + } + else + { + // we are a child. The rotation values will be set to the one of root modified by rot, as in SL. Don't ask. + SceneObjectPart rootPart = m_host.ParentGroup.RootPart; + if (rootPart != null) // better safe than sorry + { + SetRot(m_host, rootPart.RotationOffset * (Quaternion)rot); + } + } + ScriptSleep(200); } @@ -7276,12 +7292,22 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api break; case (int)ScriptBaseClass.PRIM_ROTATION: - case (int)ScriptBaseClass.PRIM_ROT_LOCAL: if (remain < 1) return null; LSL_Rotation q = rules.GetQuaternionItem(idx++); + // try to let this work as in SL... + if (part.ParentID == 0) + { + // special case: If we are root, rotate complete SOG to new rotation SetRot(part, q); + } + else + { + // we are a child. The rotation values will be set to the one of root modified by rot, as in SL. Don't ask. + SceneObjectPart rootPart = part.ParentGroup.RootPart; + SetRot(part, rootPart.RotationOffset * (Quaternion)q); + } break; @@ -7588,6 +7614,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api string primDesc = rules.GetLSLStringItem(idx++); part.Description = primDesc; break; + case (int)ScriptBaseClass.PRIM_ROT_LOCAL: + if (remain < 1) + return null; + SetRot(part, rules.GetQuaternionItem(idx++)); + break; case (int)ScriptBaseClass.PRIM_OMEGA: if (remain < 3) return null; -- cgit v1.1 From 574a6e35807d522a211f05d2370da2a31277051a Mon Sep 17 00:00:00 2001 From: Melanie Date: Mon, 3 Sep 2012 21:53:46 +0100 Subject: Revert "formatting" This reverts commit fb211c64fd9d335f4879549023870b1e28416f74. --- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index dda8257..89bd6ac 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -2314,7 +2314,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public void llSetRot(LSL_Rotation rot) { m_host.AddScriptLPS(1); - SetRot(m_host, rot); + SetRot(m_host, rot); ScriptSleep(200); } @@ -7850,7 +7850,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (remain < 1) return null; - SetRot(part, rules.GetQuaternionItem(idx++)); + SetRot(part, rules.GetQuaternionItem(idx++)); break; -- cgit v1.1 From f32c74b2ffdeb439b3e939a3e21fe210af717af4 Mon Sep 17 00:00:00 2001 From: Melanie Date: Mon, 3 Sep 2012 21:53:55 +0100 Subject: Revert "no need to assign rotation to a variable now" This reverts commit a3d140b57c5e2ae0f3334d59b82e116d40199b49. --- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 89bd6ac..c47893e 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -7850,7 +7850,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (remain < 1) return null; - SetRot(part, rules.GetQuaternionItem(idx++)); + LSL_Rotation q = rules.GetQuaternionItem(idx++); + SetRot(part, q); break; -- cgit v1.1 From 72d20b794a245f0e9b9e1f968b50067db2910b6c Mon Sep 17 00:00:00 2001 From: Melanie Date: Mon, 3 Sep 2012 21:54:02 +0100 Subject: Revert "made setting rotation match Second Life" This reverts commit f7b88d1c40ba06c62491d8d32809fe6c1c4d360d. --- .../Shared/Api/Implementation/LSL_Api.cs | 33 +++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index c47893e..efeca26 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -2314,7 +2314,23 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public void llSetRot(LSL_Rotation rot) { m_host.AddScriptLPS(1); + + // try to let this work as in SL... + if (m_host.ParentID == 0) + { + // special case: If we are root, rotate complete SOG to new rotation SetRot(m_host, rot); + } + else + { + // we are a child. The rotation values will be set to the one of root modified by rot, as in SL. Don't ask. + SceneObjectPart rootPart = m_host.ParentGroup.RootPart; + if (rootPart != null) // better safe than sorry + { + SetRot(m_host, rootPart.RotationOffset * (Quaternion)rot); + } + } + ScriptSleep(200); } @@ -7846,12 +7862,22 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api break; case (int)ScriptBaseClass.PRIM_ROTATION: - case (int)ScriptBaseClass.PRIM_ROT_LOCAL: if (remain < 1) return null; LSL_Rotation q = rules.GetQuaternionItem(idx++); + // try to let this work as in SL... + if (part.ParentID == 0) + { + // special case: If we are root, rotate complete SOG to new rotation SetRot(part, q); + } + else + { + // we are a child. The rotation values will be set to the one of root modified by rot, as in SL. Don't ask. + SceneObjectPart rootPart = part.ParentGroup.RootPart; + SetRot(part, rootPart.RotationOffset * (Quaternion)q); + } break; @@ -8188,6 +8214,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api string primDesc = rules.GetLSLStringItem(idx++); part.Description = primDesc; break; + case (int)ScriptBaseClass.PRIM_ROT_LOCAL: + if (remain < 1) + return null; + SetRot(part, rules.GetQuaternionItem(idx++)); + break; case (int)ScriptBaseClass.PRIM_OMEGA: if (remain < 3) return null; -- cgit v1.1 From a858c5daee64223355de04b77746142be0f5795f Mon Sep 17 00:00:00 2001 From: SignpostMarv Date: Sat, 1 Sep 2012 02:39:49 +0100 Subject: implementing a function to get the number of attachments worn --- .../Shared/Api/Implementation/OSSL_Api.cs | 38 ++++++++++++++++++++++ 1 file changed, 38 insertions(+) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index e245684..57f1e65 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -3313,6 +3313,44 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api ((LSL_Api)m_LSL_Api).DetachFromAvatar(); } + public LSL_List osGetNumberOfAttachments(LSL_Key avatar, LSL_List attachmentPoints) + { + CheckThreatLevel(ThreatLevel.Moderate, "osGetNumberOfAttachments"); + + m_host.AddScriptLPS(1); + + UUID targetUUID; + ScenePresence target; + LSL_List resp = new LSL_List(); + + if (attachmentPoints.Length >= 1 && UUID.TryParse(avatar.ToString(), out targetUUID) && World.TryGetScenePresence(targetUUID, out target)) + { + foreach (object point in attachmentPoints.Data) + { + LSL_Integer ipoint = new LSL_Integer( + (point is LSL_Integer || point is int || point is uint) ? + (int)point : + 0 + ); + resp.Add(ipoint); + if (ipoint == 0) + { + // indicates zero attachments + resp.Add(new LSL_Integer(0)); + } + else + { + // gets the number of attachments on the attachment point + resp.Add(new LSL_Integer(target.GetAttachments((uint)ipoint).Count)); + } + } + } + + return resp; + } + + #endregion + /// /// Checks if thing is a UUID. /// -- cgit v1.1 From d4b8a13a1d63c950feba694eca53df06f2cc5792 Mon Sep 17 00:00:00 2001 From: SignpostMarv Date: Sat, 1 Sep 2012 02:43:04 +0100 Subject: refactoring the grunt work of MessageObject into a private method with a UUID argument --- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 57f1e65..82114b3 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -1673,6 +1673,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return; } + MessageObject(objUUID, message); + } + + private void MessageObject(UUID objUUID, string message) + { object[] resobj = new object[] { new LSL_Types.LSLString(m_host.UUID.ToString()), new LSL_Types.LSLString(message) }; SceneObjectPart sceneOP = World.GetSceneObjectPart(objUUID); -- cgit v1.1 From ff867b59cf59fdab19413cd46f3dd04058fbf3c7 Mon Sep 17 00:00:00 2001 From: SignpostMarv Date: Sat, 1 Sep 2012 02:44:11 +0100 Subject: Implementing functing to send messages directly to attachments --- .../Shared/Api/Implementation/OSSL_Api.cs | 131 +++++++++++++++++++++ 1 file changed, 131 insertions(+) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 82114b3..8e80b4c 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -3354,6 +3354,137 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return resp; } + public void osMessageAttachments(LSL_Key avatar, string message, LSL_List attachmentPoints, int options) + { + CheckThreatLevel(ThreatLevel.Moderate, "osMessageAttachments"); + m_host.AddScriptLPS(1); + + UUID targetUUID; + ScenePresence target; + + if (attachmentPoints.Length >= 1 && UUID.TryParse(avatar.ToString(), out targetUUID) && World.TryGetScenePresence(targetUUID, out target)) + { + List aps = new List(); + foreach (object point in attachmentPoints.Data) + { + int ipoint; + if (int.TryParse(point.ToString(), out ipoint)) + { + aps.Add(ipoint); + } + } + + List attachments = new List(); + + bool msgAll = aps.Contains(ScriptBaseClass.OS_ATTACH_MSG_ALL); + bool invertPoints = (options & ScriptBaseClass.OS_ATTACH_MSG_INVERT_POINTS) != 0; + + if (msgAll && invertPoints) + { + return; + } + else if (msgAll || invertPoints) + { + attachments = target.GetAttachments(); + } + else + { + foreach (int point in aps) + { + if (point > 0) + { + attachments.AddRange(target.GetAttachments((uint)point)); + } + } + } + + // if we have no attachments at this point, exit now + if (attachments.Count == 0) + { + return; + } + + List ignoreThese = new List(); + + if (invertPoints) + { + foreach (SceneObjectGroup attachment in attachments) + { + if (aps.Contains((int)attachment.AttachmentPoint)) + { + ignoreThese.Add(attachment); + } + } + } + + foreach (SceneObjectGroup attachment in ignoreThese) + { + attachments.Remove(attachment); + } + ignoreThese.Clear(); + + // if inverting removed all attachments to check, exit now + if (attachments.Count < 1) + { + return; + } + + if ((options & ScriptBaseClass.OS_ATTACH_MSG_OBJECT_CREATOR) != 0) + { + foreach (SceneObjectGroup attachment in attachments) + { + if (attachment.RootPart.CreatorID != m_host.CreatorID) + { + ignoreThese.Add(attachment); + } + } + + foreach (SceneObjectGroup attachment in ignoreThese) + { + attachments.Remove(attachment); + } + ignoreThese.Clear(); + + // if filtering by same object creator removed all + // attachments to check, exit now + if (attachments.Count == 0) + { + return; + } + } + + if ((options & ScriptBaseClass.OS_ATTACH_MSG_SCRIPT_CREATOR) != 0) + { + foreach (SceneObjectGroup attachment in attachments) + { + if (attachment.RootPart.CreatorID != m_item.CreatorID) + { + ignoreThese.Add(attachment); + } + } + + foreach (SceneObjectGroup attachment in ignoreThese) + { + attachments.Remove(attachment); + } + ignoreThese.Clear(); + + // if filtering by object creator must match originating + // script creator removed all attachments to check, + // exit now + if (attachments.Count == 0) + { + return; + } + } + + foreach (SceneObjectGroup attachment in attachments) + { + MessageObject(attachment.RootPart.UUID, message); + } + } + } + #endregion /// -- cgit v1.1 From 07dbe46ba3c2b949c9da34eaa80d7e1afd68fece Mon Sep 17 00:00:00 2001 From: SignpostMarv Date: Sat, 1 Sep 2012 02:45:07 +0100 Subject: wrapping attachment functions in a region --- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 2 ++ 1 file changed, 2 insertions(+) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 8e80b4c..2e1e5b6 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -3229,6 +3229,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } } + #region Attachment commands + public void osForceAttachToAvatar(int attachmentPoint) { CheckThreatLevel(ThreatLevel.High, "osForceAttachToAvatar"); -- cgit v1.1 From 641b08aa781fcf4c1bf6d8425c98a302f96a8b88 Mon Sep 17 00:00:00 2001 From: Mic Bowman Date: Wed, 5 Sep 2012 09:13:16 -0700 Subject: Enables cast from int to float for MOD* functions; Thanks SignpostMarv! --- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs index 84cf6ca..cde2d9f 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs @@ -310,7 +310,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api // ---------- Integer ---------- else if (lslparm is LSL_Integer) { - if (type == typeof(int)) + if (type == typeof(int) || type == typeof(float)) return (int)(LSL_Integer)lslparm; } -- cgit v1.1 From 874bde366aa3f834957f757aa56a7634becb4415 Mon Sep 17 00:00:00 2001 From: SignpostMarv Date: Thu, 6 Sep 2012 10:54:45 +0100 Subject: 4096 is used in various places as the maximum height of a region, refactoring to be a constant --- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index be22cb4..83c9739 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -1948,7 +1948,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api pos.x > (Constants.RegionSize + 10) || // return FALSE if more than 10 meters into a east-adjacent region. pos.y < -10.0 || // return FALSE if more than 10 meters into a south-adjacent region. pos.y > (Constants.RegionSize + 10) || // return FALSE if more than 10 meters into a north-adjacent region. - pos.z > 4096 // return FALSE if altitude than 4096m + pos.z > Constants.RegionHeight // return FALSE if altitude than 4096m ) ) { -- cgit v1.1 From e041f09750419f60c819ee7e7a99044fe43a811c Mon Sep 17 00:00:00 2001 From: SignpostMarv Date: Thu, 6 Sep 2012 11:45:52 +0100 Subject: refactoring to allow Scene.GetLandData to accept Vector3 as an argument. Note that the prior work on LSL_Vector implicit operators means one does not need to explicitly cast a LSL_Vector to Vector3 --- .../ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 18 +++++++++--------- .../ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 2 +- 2 files changed, 10 insertions(+), 10 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 83c9739..11826bd 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -1959,8 +1959,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api // this could possibly be done in the above else-if block, but we're doing the check here to keep the code easier to read. Vector3 objectPos = m_host.ParentGroup.RootPart.AbsolutePosition; - LandData here = World.GetLandData((float)objectPos.X, (float)objectPos.Y); - LandData there = World.GetLandData((float)pos.x, (float)pos.y); + LandData here = World.GetLandData(objectPos); + LandData there = World.GetLandData(pos); // we're only checking prim limits if it's moving to a different parcel under the assumption that if the object got onto the parcel without exceeding the prim limits. @@ -9770,20 +9770,20 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api switch ((ParcelMediaCommandEnum) aList.Data[i]) { case ParcelMediaCommandEnum.Url: - list.Add(new LSL_String(World.GetLandData(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y).MediaURL)); + list.Add(new LSL_String(World.GetLandData(m_host.AbsolutePosition).MediaURL)); break; case ParcelMediaCommandEnum.Desc: - list.Add(new LSL_String(World.GetLandData(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y).Description)); + list.Add(new LSL_String(World.GetLandData(m_host.AbsolutePosition).Description)); break; case ParcelMediaCommandEnum.Texture: - list.Add(new LSL_String(World.GetLandData(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y).MediaID.ToString())); + list.Add(new LSL_String(World.GetLandData(m_host.AbsolutePosition).MediaID.ToString())); break; case ParcelMediaCommandEnum.Type: - list.Add(new LSL_String(World.GetLandData(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y).MediaType)); + list.Add(new LSL_String(World.GetLandData(m_host.AbsolutePosition).MediaType)); break; case ParcelMediaCommandEnum.Size: - list.Add(new LSL_String(World.GetLandData(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y).MediaWidth)); - list.Add(new LSL_String(World.GetLandData(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y).MediaHeight)); + list.Add(new LSL_String(World.GetLandData(m_host.AbsolutePosition).MediaWidth)); + list.Add(new LSL_String(World.GetLandData(m_host.AbsolutePosition).MediaHeight)); break; default: ParcelMediaCommandEnum mediaCommandEnum = ParcelMediaCommandEnum.Url; @@ -10398,7 +10398,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public LSL_List llGetParcelDetails(LSL_Vector pos, LSL_List param) { m_host.AddScriptLPS(1); - LandData land = World.GetLandData((float)pos.x, (float)pos.y); + LandData land = World.GetLandData(pos); if (land == null) { return new LSL_List(0); diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 2e1e5b6..8b73cd9 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -2941,7 +2941,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api ScenePresence presence = World.GetScenePresence(avatarId); if (presence != null) { - LandData land = World.GetLandData((float)pos.X, (float)pos.Y); + LandData land = World.GetLandData(pos); if ((land.Flags & (uint)ParcelFlags.AllowDamage) == (uint)ParcelFlags.AllowDamage) { float health = presence.Health; -- cgit v1.1 From 8db5d79f4bc3590edfb8bee7918d3bbb1e286dcb Mon Sep 17 00:00:00 2001 From: SignpostMarv Date: Mon, 10 Sep 2012 12:18:40 +0100 Subject: passing in the function name to MOD_Api.ConvertFromLSL for more user-friendly error messages --- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs index cde2d9f..6809c09 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs @@ -254,7 +254,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api object[] convertedParms = new object[parms.Length]; for (int i = 0; i < parms.Length; i++) - convertedParms[i] = ConvertFromLSL(parms[i],signature[i]); + convertedParms[i] = ConvertFromLSL(parms[i],signature[i], fname); // now call the function, the contract with the function is that it will always return // non-null but don't trust it completely @@ -294,7 +294,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api /// /// - protected object ConvertFromLSL(object lslparm, Type type) + protected object ConvertFromLSL(object lslparm, Type type, string fname) { // ---------- String ---------- if (lslparm is LSL_String) @@ -374,14 +374,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api (LSL_Vector)plist[i]); } else - MODError("unknown LSL list element type"); + MODError(String.Format("{0}: unknown LSL list element type", fname)); } return result; } } - MODError(String.Format("parameter type mismatch; expecting {0}",type.Name)); + MODError(String.Format("{1}: parameter type mismatch; expecting {0}",type.Name, fname)); return null; } -- cgit v1.1 From 5df39446078327106df5e9331f0156b149727d61 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 22 Sep 2012 00:23:25 +0100 Subject: Fix llListFindList() returning no match when there is a match with a script constant component in the source list. Adds regression test for this case. Based on http://opensimulator.org/mantis/view.php?id=6156 Thanks SignpostMarv. --- .../Shared/Api/Implementation/LSL_Api.cs | 24 ++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 11826bd..52d96bc 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -5465,27 +5465,36 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api /// Returns the index of the first occurrence of test /// in src. /// - + /// Source list + /// List to search for + /// + /// The index number of the point in src where test was found if it was found. + /// Otherwise returns -1 + /// public LSL_Integer llListFindList(LSL_List src, LSL_List test) { - int index = -1; int length = src.Length - test.Length + 1; m_host.AddScriptLPS(1); // If either list is empty, do not match - if (src.Length != 0 && test.Length != 0) { for (int i = 0; i < length; i++) { - if (src.Data[i].Equals(test.Data[0])) + // Why this piece of insanity? This is because most script constants are C# value types (e.g. int) + // rather than wrapped LSL types. Such a script constant does not have int.Equal(LSL_Integer) code + // and so the comparison fails even if the LSL_Integer conceptually has the same value. + // Therefore, here we test Equals on both the source and destination objects. + // However, a future better approach may be use LSL struct script constants (e.g. LSL_Integer(1)). + if (src.Data[i].Equals(test.Data[0]) || test.Data[0].Equals(src.Data[i])) { int j; for (j = 1; j < test.Length; j++) - if (!src.Data[i+j].Equals(test.Data[j])) + if (!(src.Data[i+j].Equals(test.Data[j]) || test.Data[j].Equals(src.Data[i+j]))) break; + if (j == test.Length) { index = i; @@ -5496,19 +5505,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } return index; - } public LSL_String llGetObjectName() { m_host.AddScriptLPS(1); - return m_host.Name!=null?m_host.Name:String.Empty; + return m_host.Name !=null ? m_host.Name : String.Empty; } public void llSetObjectName(string name) { m_host.AddScriptLPS(1); - m_host.Name = name!=null?name:String.Empty; + m_host.Name = name != null ? name : String.Empty; } public LSL_String llGetDate() -- cgit v1.1 From 35b7c80e0ba876649c606d5d047fcb59754372ea Mon Sep 17 00:00:00 2001 From: SignpostMarv Date: Tue, 31 Jul 2012 14:45:23 +0100 Subject: implementing osDropAttachment & osDropAttachmentAt --- .../Shared/Api/Implementation/OSSL_Api.cs | 33 ++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 8b73cd9..fec8a67 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -3549,6 +3549,35 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (m_UrlModule != null) m_UrlModule.HttpContentType(new UUID(id),type); } - - } + + public void osDropAttachment() + { + CheckThreatLevel(ThreatLevel.Moderate, "osDropAttachment"); + m_host.AddScriptLPS(1); + + IAttachmentsModule attachmentsModule = m_ScriptEngine.World.AttachmentsModule; + ScenePresence sp = attachmentsModule == null ? null : m_host.ParentGroup.Scene.GetScenePresence(m_host.ParentGroup.OwnerID); + + if (attachmentsModule != null && sp != null) + { + attachmentsModule.DetachSingleAttachmentToGround(sp, m_host.ParentGroup.LocalId); + } + } + + public void osDropAttachmentAt(LSL_Vector pos, LSL_Rotation rot) + { + CheckThreatLevel(ThreatLevel.Moderate, "osDropAttachment"); + m_host.AddScriptLPS(1); + + IAttachmentsModule attachmentsModule = m_ScriptEngine.World.AttachmentsModule; + ScenePresence sp = attachmentsModule == null ? null : m_host.ParentGroup.Scene.GetScenePresence(m_host.ParentGroup.OwnerID); + + if (attachmentsModule != null && sp != null) + { + Vector3 omvPos = new Vector3((float)pos.x, (float)pos.y, (float)pos.z); + Quaternion omvRot = LSL_Api.Rot2Quaternion(rot); + attachmentsModule.DetachSingleAttachmentToGround(sp, m_host.ParentGroup.LocalId, omvPos, omvRot); + } + } + } } \ No newline at end of file -- cgit v1.1 From c677c04f10bf0ec9ed66799effe2b3d4c881f5dd Mon Sep 17 00:00:00 2001 From: SignpostMarv Date: Tue, 31 Jul 2012 15:24:15 +0100 Subject: fixing copypasta --- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index fec8a67..02b97e8 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -3566,7 +3566,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public void osDropAttachmentAt(LSL_Vector pos, LSL_Rotation rot) { - CheckThreatLevel(ThreatLevel.Moderate, "osDropAttachment"); + CheckThreatLevel(ThreatLevel.Moderate, "osDropAttachmentAt"); m_host.AddScriptLPS(1); IAttachmentsModule attachmentsModule = m_ScriptEngine.World.AttachmentsModule; -- cgit v1.1 From ce7694c108e8abf2e52a0b0167eab3d550f364ab Mon Sep 17 00:00:00 2001 From: SignpostMarv Date: Wed, 1 Aug 2012 10:28:58 +0100 Subject: added perms checking, duplicated functionality to methods that do not require perms and have higher threat level --- .../Shared/Api/Implementation/OSSL_Api.cs | 70 ++++++++++++++++++++-- 1 file changed, 64 insertions(+), 6 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 02b97e8..d0db15f 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -3538,7 +3538,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return new LSL_Key(m_host.ParentGroup.FromPartID.ToString()); } - + /// /// Sets the response type for an HTTP request/response /// @@ -3549,11 +3549,35 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (m_UrlModule != null) m_UrlModule.HttpContentType(new UUID(id),type); } - - public void osDropAttachment() + /// Shout an error if the object owner did not grant the script the specified permissions. + /// + /// + /// boolean indicating whether an error was shouted. + protected bool ShoutErrorOnLackingOwnerPerms(int perms, string errorPrefix) { CheckThreatLevel(ThreatLevel.Moderate, "osDropAttachment"); m_host.AddScriptLPS(1); + bool fail = false; + if (m_item.PermsGranter != m_host.OwnerID) + { + fail = true; + OSSLShoutError(string.Format("{0}. Permissions not granted to owner.", errorPrefix)); + } + else if ((m_item.PermsMask & perms) == 0) + { + fail = true; + OSSLShoutError(string.Format("{0}. Permissions not granted.", errorPrefix)); + } + + return fail; + } + + protected void DropAttachment(bool checkPerms) + { + if (checkPerms && ShoutErrorOnLackingOwnerPerms(ScriptBaseClass.PERMISSION_ATTACH, "Cannot drop attachment")) + { + return; + } IAttachmentsModule attachmentsModule = m_ScriptEngine.World.AttachmentsModule; ScenePresence sp = attachmentsModule == null ? null : m_host.ParentGroup.Scene.GetScenePresence(m_host.ParentGroup.OwnerID); @@ -3564,10 +3588,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } } - public void osDropAttachmentAt(LSL_Vector pos, LSL_Rotation rot) + protected void DropAttachemntAt(bool checkPerms, LSL_Vector pos, LSL_Rotation rot) { - CheckThreatLevel(ThreatLevel.Moderate, "osDropAttachmentAt"); - m_host.AddScriptLPS(1); + if (checkPerms && ShoutErrorOnLackingOwnerPerms(ScriptBaseClass.PERMISSION_ATTACH, "Cannot drop attachment")) + { + return; + } IAttachmentsModule attachmentsModule = m_ScriptEngine.World.AttachmentsModule; ScenePresence sp = attachmentsModule == null ? null : m_host.ParentGroup.Scene.GetScenePresence(m_host.ParentGroup.OwnerID); @@ -3579,5 +3605,37 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api attachmentsModule.DetachSingleAttachmentToGround(sp, m_host.ParentGroup.LocalId, omvPos, omvRot); } } + + public void osDropAttachment() + { + CheckThreatLevel(ThreatLevel.Moderate, "osDropAttachment"); + m_host.AddScriptLPS(1); + + DropAttachment(true); + } + + public void osForceDropAttachment() + { + CheckThreatLevel(ThreatLevel.High, "osForceDropAttachment"); + m_host.AddScriptLPS(1); + + DropAttachment(false); + } + + public void osDropAttachmentAt(LSL_Vector pos, LSL_Rotation rot) + { + CheckThreatLevel(ThreatLevel.Moderate, "osDropAttachmentAt"); + m_host.AddScriptLPS(1); + + DropAttachemntAt(true, pos, rot); + } + + public void osForceDropAttachmentAt(LSL_Vector pos, LSL_Rotation rot) + { + CheckThreatLevel(ThreatLevel.High, "osForceDropAttachmentAt"); + m_host.AddScriptLPS(1); + + DropAttachemntAt(false, pos, rot); + } } } \ No newline at end of file -- cgit v1.1 From f555febdb7c6bbd9ef8b98f897e6c296a62b23fe Mon Sep 17 00:00:00 2001 From: SignpostMarv Date: Mon, 20 Aug 2012 10:19:39 +0100 Subject: taking into account the recent introduction of implicit operators --- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index d0db15f..e56a36f 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -3600,9 +3600,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (attachmentsModule != null && sp != null) { - Vector3 omvPos = new Vector3((float)pos.x, (float)pos.y, (float)pos.z); - Quaternion omvRot = LSL_Api.Rot2Quaternion(rot); - attachmentsModule.DetachSingleAttachmentToGround(sp, m_host.ParentGroup.LocalId, omvPos, omvRot); + attachmentsModule.DetachSingleAttachmentToGround(sp, m_host.ParentGroup.LocalId, pos, rot); } } -- cgit v1.1 From a1679517d39f11591c89203eba914f52c09838ea Mon Sep 17 00:00:00 2001 From: SignpostMarv Date: Sun, 30 Sep 2012 12:27:53 +0100 Subject: correcting typo --- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index e56a36f..31be450 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -3588,7 +3588,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } } - protected void DropAttachemntAt(bool checkPerms, LSL_Vector pos, LSL_Rotation rot) + protected void DropAttachmentAt(bool checkPerms, LSL_Vector pos, LSL_Rotation rot) { if (checkPerms && ShoutErrorOnLackingOwnerPerms(ScriptBaseClass.PERMISSION_ATTACH, "Cannot drop attachment")) { @@ -3625,7 +3625,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api CheckThreatLevel(ThreatLevel.Moderate, "osDropAttachmentAt"); m_host.AddScriptLPS(1); - DropAttachemntAt(true, pos, rot); + DropAttachmentAt(true, pos, rot); } public void osForceDropAttachmentAt(LSL_Vector pos, LSL_Rotation rot) @@ -3633,7 +3633,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api CheckThreatLevel(ThreatLevel.High, "osForceDropAttachmentAt"); m_host.AddScriptLPS(1); - DropAttachemntAt(false, pos, rot); + DropAttachmentAt(false, pos, rot); } } } \ No newline at end of file -- cgit v1.1 From 653a98e891dcd97b55010900bacc4d033958756a Mon Sep 17 00:00:00 2001 From: Melanie Date: Wed, 3 Oct 2012 17:39:13 +0100 Subject: Fix a viewer crash issue Conflicts: OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs --- .../ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 52d96bc..7fa6f05 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -4006,7 +4006,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { m_host.AddScriptLPS(1); Vector3 av3 = Util.Clip(color, 0.0f, 1.0f); - m_host.SetText(text.Length > 254 ? text.Remove(254) : text, av3, Util.Clip((float)alpha, 0.0f, 1.0f)); + if (text.Length > 254) + text = text.Remove(254); + + byte[] data; + do + { + data = Util.UTF8.GetBytes(text); + if (data.Length > 254) + text = text.Substring(0, text.Length - 1); + } while (data.Length > 254); + + m_host.SetText(text, av3, Util.Clip((float)alpha, 0.0f, 1.0f)); //m_host.ParentGroup.HasGroupChanged = true; //m_host.ParentGroup.ScheduleGroupForFullUpdate(); } -- cgit v1.1 From 16c9c1dff7bbf299efddd44e4f9aeeb7db38fff6 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 6 Oct 2012 02:34:49 +0100 Subject: On receiving TaskInventoryAccepted with a destination folder in the binary bucket slot for RLV, notify the viewer about inventory folder updates. The viewer would not see the folder move without this, either on accept or decline. This commit also updates the TaskInventoryOffered message to better conform with the data LL uses Changes are, agentID is prim owner rather than prim id, agent name is now simply object name rather than name with owner detail, message is just folder name in single quotes, message is not timestamped. However, folder is not renamed "still #RLV/~". Long term solution is probably not to do these operations server-side. Notes will be added to http://opensimulator.org/mantis/view.php?id=6311 --- .../ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 7fa6f05..7620df3 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -3978,7 +3978,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api World.RegionInfo.RegionName+" "+ m_host.AbsolutePosition.ToString(), agentItem.ID, true, m_host.AbsolutePosition, - bucket); + bucket, true); // TODO: May actually send no timestamp m_TransferModule.SendInstantMessage(msg, delegate(bool success) {}); } @@ -6452,16 +6452,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (m_TransferModule != null) { byte[] bucket = new byte[] { (byte)AssetType.Folder }; - + + Vector3 pos = m_host.AbsolutePosition; + GridInstantMessage msg = new GridInstantMessage(World, - m_host.UUID, m_host.Name + ", an object owned by " + - resolveName(m_host.OwnerID) + ",", destID, + m_host.OwnerID, m_host.Name, destID, (byte)InstantMessageDialog.TaskInventoryOffered, - false, category + "\n" + m_host.Name + " is located at " + - World.RegionInfo.RegionName + " " + - m_host.AbsolutePosition.ToString(), - folderID, true, m_host.AbsolutePosition, - bucket); + false, string.Format("'{0}'"), +// We won't go so far as to add a SLURL, but this is the format used by LL as of 2012-10-06 +// false, string.Format("'{0}' ( http://slurl.com/secondlife/{1}/{2}/{3}/{4} )", category, World.Name, (int)pos.X, (int)pos.Y, (int)pos.Z), + folderID, false, pos, + bucket, false); m_TransferModule.SendInstantMessage(msg, delegate(bool success) {}); } -- cgit v1.1 From 11d8119a21c645d6a0d71edc7444f058ba89414b Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 10 Oct 2012 01:37:57 +0100 Subject: Remove osDropAttachment threat level check wrongly placed in OSSL_Api.ShoutErrorOnLackingOwnerPerms. --- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 1 - 1 file changed, 1 deletion(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 31be450..279ad59 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -3555,7 +3555,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api /// boolean indicating whether an error was shouted. protected bool ShoutErrorOnLackingOwnerPerms(int perms, string errorPrefix) { - CheckThreatLevel(ThreatLevel.Moderate, "osDropAttachment"); m_host.AddScriptLPS(1); bool fail = false; if (m_item.PermsGranter != m_host.OwnerID) -- cgit v1.1 From 756ac4f32104db9dcdfb1c1da81075299e2cbfb4 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 10 Oct 2012 01:39:47 +0100 Subject: Correct osSetContentType() threat check to query osSetContentType rather than osSetResponseType --- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 279ad59..29bc163 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -3545,10 +3545,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api /// public void osSetContentType(LSL_Key id, string type) { - CheckThreatLevel(ThreatLevel.High,"osSetResponseType"); + CheckThreatLevel(ThreatLevel.High, "osSetContentType"); + if (m_UrlModule != null) m_UrlModule.HttpContentType(new UUID(id),type); } + /// Shout an error if the object owner did not grant the script the specified permissions. /// /// -- cgit v1.1 From f6e166cd0bfc868fe17fb003390872ae70190177 Mon Sep 17 00:00:00 2001 From: TBG Renfold Date: Tue, 9 Oct 2012 14:56:25 +0100 Subject: Now using region flags for llRequestSimulatorData DATA_SIM_POS. If the region is not classed a hypergrid region, then the region secret is checked to make sure that it is a valid UUID. Just a temporary fix at this time. --- .../Shared/Api/Implementation/LSL_Api.cs | 25 +++++++++++++++------- 1 file changed, 17 insertions(+), 8 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 7620df3..6b08b00 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -56,6 +56,7 @@ using GridRegion = OpenSim.Services.Interfaces.GridRegion; using PresenceInfo = OpenSim.Services.Interfaces.PresenceInfo; using PrimType = OpenSim.Region.Framework.Scenes.PrimType; using AssetLandmark = OpenSim.Framework.AssetLandmark; +using RegionFlags = OpenSim.Framework.RegionFlags; using LSL_Float = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLFloat; using LSL_Integer = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLInteger; @@ -9327,12 +9328,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api ScriptSleep(1000); return UUID.Zero.ToString(); } - if (m_ScriptEngine.World.RegionInfo.RegionName != simulator) + + RegionFlags regionFlags = (RegionFlags)m_ScriptEngine.World.GridService.GetRegionFlags(info.ScopeID, info.RegionID); + if ((regionFlags & RegionFlags.Hyperlink) != 0) { - //Hypergrid Region co-ordinates uint rx = 0, ry = 0; + //Hypergrid Region co-ordinates Utils.LongToUInts(Convert.ToUInt64(info.RegionSecret), out rx, out ry); - reply = new LSL_Vector( rx, ry, @@ -9340,11 +9342,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } else { - //Local-cooridnates - reply = new LSL_Vector( - info.RegionLocX, - info.RegionLocY, - 0).ToString(); + UUID regionSecret = UUID.Zero; + if (UUID.TryParse(info.RegionSecret, out regionSecret)) + { + if (regionSecret != UUID.Zero) + { + //Local co-oridnates + reply = new LSL_Vector( + info.RegionLocX, + info.RegionLocY, + 0).ToString(); + } + } } break; case ScriptBaseClass.DATA_SIM_STATUS: -- cgit v1.1 From 330b976a62b3153dadfb1acdaa99b60a9084453d Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 13 Oct 2012 01:03:09 +0100 Subject: Improve on TBG Renfold's fix to llRequestSimulatorData DATA_SIM_POS by only performing HG regionflags service check if the region secret is not empty. An empty RegionSecret is never HG, whilst a non-empty one may be HG or being genuinely used as a RegionSecret. --- .../Shared/Api/Implementation/LSL_Api.cs | 44 ++++++++++++---------- 1 file changed, 25 insertions(+), 19 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 6b08b00..1e8dec8 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -9314,11 +9314,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api GridRegion info; - if (m_ScriptEngine.World.RegionInfo.RegionName == simulator) //Det data for this simulator? - - info = new GridRegion(m_ScriptEngine.World.RegionInfo); + if (World.RegionInfo.RegionName == simulator) + info = new GridRegion(World.RegionInfo); else - info = m_ScriptEngine.World.GridService.GetRegionByName(m_ScriptEngine.World.RegionInfo.ScopeID, simulator); + info = World.GridService.GetRegionByName(m_ScriptEngine.World.RegionInfo.ScopeID, simulator); switch (data) { @@ -9329,12 +9328,26 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return UUID.Zero.ToString(); } - RegionFlags regionFlags = (RegionFlags)m_ScriptEngine.World.GridService.GetRegionFlags(info.ScopeID, info.RegionID); - if ((regionFlags & RegionFlags.Hyperlink) != 0) + bool isHypergridRegion = false; + + if (World.RegionInfo.RegionName != simulator && info.RegionSecret != "") + { + // Hypergrid is currently placing real destination region co-ords into RegionSecret. + // But other code can also use this field for a genuine RegionSecret! Therefore, if + // anything is present we need to disambiguate. + // + // FIXME: Hypergrid should be storing this data in a different field. + RegionFlags regionFlags + = (RegionFlags)m_ScriptEngine.World.GridService.GetRegionFlags( + info.ScopeID, info.RegionID); + isHypergridRegion = (regionFlags & RegionFlags.Hyperlink) != 0; + } + + if (isHypergridRegion) { uint rx = 0, ry = 0; - //Hypergrid Region co-ordinates Utils.LongToUInts(Convert.ToUInt64(info.RegionSecret), out rx, out ry); + reply = new LSL_Vector( rx, ry, @@ -9342,18 +9355,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } else { - UUID regionSecret = UUID.Zero; - if (UUID.TryParse(info.RegionSecret, out regionSecret)) - { - if (regionSecret != UUID.Zero) - { - //Local co-oridnates - reply = new LSL_Vector( - info.RegionLocX, - info.RegionLocY, - 0).ToString(); - } - } + // Local grid co-oridnates + reply = new LSL_Vector( + info.RegionLocX, + info.RegionLocY, + 0).ToString(); } break; case ScriptBaseClass.DATA_SIM_STATUS: -- cgit v1.1 From ab0294f0109416da0546e25797e7747b23071d33 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 16 Oct 2012 01:33:35 +0100 Subject: Add missing category paremeter to llGiveInventoryList grid IM construction. This was a regression from 16c9c1df Sat Oct 6 02:34:49 2012 +0100. Should resolve http://opensimulator.org/mantis/view.php?id=6360 --- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 1e8dec8..ac74bf8 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -6459,7 +6459,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api GridInstantMessage msg = new GridInstantMessage(World, m_host.OwnerID, m_host.Name, destID, (byte)InstantMessageDialog.TaskInventoryOffered, - false, string.Format("'{0}'"), + false, string.Format("'{0}'", category), // We won't go so far as to add a SLURL, but this is the format used by LL as of 2012-10-06 // false, string.Format("'{0}' ( http://slurl.com/secondlife/{1}/{2}/{3}/{4} )", category, World.Name, (int)pos.X, (int)pos.Y, (int)pos.Z), folderID, false, pos, -- cgit v1.1 From ec044537d50b425178c4e081abcf325d28028480 Mon Sep 17 00:00:00 2001 From: SignpostMarv Date: Thu, 18 Oct 2012 10:15:34 +0100 Subject: ensuring that operand order in llGetLinkName is internally consistent --- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index ac74bf8..42ab39a 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -3828,7 +3828,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } // simplest case, this prims link number - if (m_host.LinkNum == linknum) + if (linknum == m_host.LinkNum) return m_host.Name; // Single prim -- cgit v1.1 From 597df51f918327f2ac46bc452a3288ec624e029f Mon Sep 17 00:00:00 2001 From: SignpostMarv Date: Thu, 18 Oct 2012 10:16:42 +0100 Subject: the simplest case for llGetLinkName also applies to the LINK_THIS constant --- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 42ab39a..e8d0bea 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -3828,7 +3828,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } // simplest case, this prims link number - if (linknum == m_host.LinkNum) + if (linknum == m_host.LinkNum || linknum == ScriptBaseClass.LINK_THIS) return m_host.Name; // Single prim -- cgit v1.1 From 645e3171b41be4c5611bb43a9c14ec1d501ff8b9 Mon Sep 17 00:00:00 2001 From: SignpostMarv Date: Thu, 18 Oct 2012 10:18:46 +0100 Subject: since llGetLinkName has a "simplest case", it should be the first check made. --- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index e8d0bea..e8bf5cf 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -3804,6 +3804,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public LSL_String llGetLinkName(int linknum) { m_host.AddScriptLPS(1); + // simplest case, this prims link number + if (linknum == m_host.LinkNum || linknum == ScriptBaseClass.LINK_THIS) + return m_host.Name; + // parse for sitting avatare-names List nametable = new List(); World.ForEachRootScenePresence(delegate(ScenePresence presence) @@ -3827,10 +3831,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return nametable[totalprims - linknum]; } - // simplest case, this prims link number - if (linknum == m_host.LinkNum || linknum == ScriptBaseClass.LINK_THIS) - return m_host.Name; - // Single prim if (m_host.LinkNum == 0) { -- cgit v1.1 From af5383e479e264f2c257ff802f258bd03550e4b4 Mon Sep 17 00:00:00 2001 From: SignpostMarv Date: Thu, 18 Oct 2012 10:22:41 +0100 Subject: altering documentation for llGetLinkName, as the current documentation is rather lengthy for a "summary". --- .../Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index e8bf5cf..cf801ba 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -3773,6 +3773,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } /// + /// Returns the name of the child prim or seated avatar matching the + /// specified link number. + /// + /// + /// The number of a link in the linkset or a link-related constant. + /// + /// + /// The name determined to match the specified link number. + /// + /// /// The rules governing the returned name are not simple. The only /// time a blank name is returned is if the target prim has a blank /// name. If no prim with the given link number can be found then @@ -3800,7 +3810,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api /// Mentions NULL_KEY being returned /// http://wiki.secondlife.com/wiki/LlGetLinkName /// Mentions using the LINK_* constants, some of which are negative - /// + /// public LSL_String llGetLinkName(int linknum) { m_host.AddScriptLPS(1); -- cgit v1.1 From ae662b54ea972e4da4f805fe38b5714d595e032a Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 25 Oct 2012 01:07:06 +0100 Subject: Make osNpcCreate() return UUID.Zero instead of throwing an exception if notecard name is invalid. Make osNpcLoadAppearance() fail silently in same circumstance rather than throwing exception. --- .../Shared/Api/Implementation/OSSL_Api.cs | 26 +++++++++++++++------- 1 file changed, 18 insertions(+), 8 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 29bc163..804b0af 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -1780,18 +1780,24 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api protected string LoadNotecard(string notecardNameOrUuid) { UUID assetID = CacheNotecard(notecardNameOrUuid); - StringBuilder notecardData = new StringBuilder(); - for (int count = 0; count < NotecardCache.GetLines(assetID); count++) + if (assetID != UUID.Zero) { - string line = NotecardCache.GetLine(assetID, count) + "\n"; - -// m_log.DebugFormat("[OSSL]: From notecard {0} loading line {1}", notecardNameOrUuid, line); - - notecardData.Append(line); + StringBuilder notecardData = new StringBuilder(); + + for (int count = 0; count < NotecardCache.GetLines(assetID); count++) + { + string line = NotecardCache.GetLine(assetID, count) + "\n"; + + // m_log.DebugFormat("[OSSL]: From notecard {0} loading line {1}", notecardNameOrUuid, line); + + notecardData.Append(line); + } + + return notecardData.ToString(); } - return notecardData.ToString(); + return null; } /// @@ -2407,6 +2413,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return; string appearanceSerialized = LoadNotecard(notecard); + + if (appearanceSerialized == null) + return; + OSDMap appearanceOsd = (OSDMap)OSDParser.DeserializeLLSDXml(appearanceSerialized); // OSD a = OSDParser.DeserializeLLSDXml(appearanceSerialized); // Console.WriteLine("appearanceSerialized {0}", appearanceSerialized); -- cgit v1.1 From d9aaf51561ea7bb2ee030c648611a5281f21ec49 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 25 Oct 2012 02:52:20 +0100 Subject: When scripts generate expected exceptions (e.g. due to checked bad parameter) throw ScriptException instead of just a plain old exception. This is to make it easier to distinguish these exceptions from unexpected OpenSimulator problems internally and in regression tests. No functional changes. --- .../Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 4 ++-- .../Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs | 10 +++++----- .../Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index cf801ba..dc791d3 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -10685,12 +10685,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api internal void Deprecated(string command) { - throw new Exception("Command deprecated: " + command); + throw new ScriptException("Command deprecated: " + command); } internal void LSLError(string msg) { - throw new Exception("LSL Runtime Error: " + msg); + throw new ScriptException("LSL Runtime Error: " + msg); } public delegate void AssetRequestCallback(UUID assetID, AssetBase asset); diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs index 6809c09..a830a15 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs @@ -95,13 +95,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api internal void MODError(string msg) { - throw new Exception("MOD Runtime Error: " + msg); + throw new ScriptException("MOD Runtime Error: " + msg); } - // - //Dumps an error message on the debug console. - // - + /// + /// Dumps an error message on the debug console. + /// + /// internal void MODShoutError(string message) { if (message.Length > 1023) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 804b0af..5301ccd 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -210,7 +210,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api internal void OSSLError(string msg) { - throw new Exception("OSSL Runtime Error: " + msg); + throw new ScriptException("OSSL Runtime Error: " + msg); } /// -- cgit v1.1 From 8af8319b95c14819d0305527f8f6876a334fa3c0 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 25 Oct 2012 03:02:00 +0100 Subject: Get osNpcCreate() and osNpcLoadAppearance() to generate a script error if appearance notecard does not exist, rather than returning UUID.Zero or silently failing. --- .../Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 5301ccd..0811519 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -2346,11 +2346,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api appearance = new AvatarAppearance(); appearance.Unpack(appearanceOsd); } + else + { + OSSLError(string.Format("osNpcCreate: Notecard reference '{0}' not found.", notecard)); + } } - if (appearance == null) - return new LSL_Key(UUID.Zero.ToString()); - UUID ownerID = UUID.Zero; if (owned) ownerID = m_host.OwnerID; @@ -2415,8 +2416,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api string appearanceSerialized = LoadNotecard(notecard); if (appearanceSerialized == null) - return; - + OSSLError(string.Format("osNpcCreate: Notecard reference '{0}' not found.", notecard)); + OSDMap appearanceOsd = (OSDMap)OSDParser.DeserializeLLSDXml(appearanceSerialized); // OSD a = OSDParser.DeserializeLLSDXml(appearanceSerialized); // Console.WriteLine("appearanceSerialized {0}", appearanceSerialized); -- cgit v1.1 From 01972cc9e8f3288330cdc7ba343b99be7f1491ec Mon Sep 17 00:00:00 2001 From: SignpostMarv Date: Tue, 23 Oct 2012 11:34:43 +0100 Subject: system ints can end up in LSL lists, which can cause counter-intuitive unknown list element type errors in ConvertFromLSL (via modInvoke) --- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs | 2 ++ 1 file changed, 2 insertions(+) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs index a830a15..60bb107 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs @@ -359,6 +359,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api result[i] = (string)(LSL_String)plist[i]; else if (plist[i] is LSL_Integer) result[i] = (int)(LSL_Integer)plist[i]; + else if (plist[i] is int) + result[i] = plist[i]; else if (plist[i] is LSL_Float) result[i] = (float)(LSL_Float)plist[i]; else if (plist[i] is LSL_Key) -- cgit v1.1 From ecdb88679e6bb59da13da0f3994cc42d8e84a30d Mon Sep 17 00:00:00 2001 From: SignpostMarv Date: Tue, 23 Oct 2012 11:39:55 +0100 Subject: Removing the apparently superfluous explicit namespace reference so that the if-else-if-else block in ConvertFromLSL can have a consistent appearance --- .../Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs index 60bb107..a181dbe 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs @@ -366,15 +366,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api else if (plist[i] is LSL_Key) result[i] = new UUID((LSL_Key)plist[i]); else if (plist[i] is LSL_Rotation) - { - result[i] = (OpenMetaverse.Quaternion)( - (LSL_Rotation)plist[i]); - } + result[i] = (Quaternion)((LSL_Rotation)plist[i]); else if (plist[i] is LSL_Vector) - { - result[i] = (OpenMetaverse.Vector3)( - (LSL_Vector)plist[i]); - } + result[i] = (Vector3)((LSL_Vector)plist[i]); else MODError(String.Format("{0}: unknown LSL list element type", fname)); } -- cgit v1.1 From 1b3b7a61acf8784af3167a35c0f06eaeb413af9c Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 26 Oct 2012 01:50:46 +0100 Subject: minor: Add comment as to why we are pulcking plain old ints out of the LSL_List when converting values from LSL for modInvoke() --- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs | 2 ++ 1 file changed, 2 insertions(+) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs index a181dbe..8f34833 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs @@ -359,6 +359,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api result[i] = (string)(LSL_String)plist[i]; else if (plist[i] is LSL_Integer) result[i] = (int)(LSL_Integer)plist[i]; + // The int check exists because of the many plain old int script constants in ScriptBase which + // are not LSL_Integers. else if (plist[i] is int) result[i] = plist[i]; else if (plist[i] is LSL_Float) -- cgit v1.1 From 18b1ee6f379f4d34f72a9056bf6cdf185311fd05 Mon Sep 17 00:00:00 2001 From: SignpostMarv Date: Tue, 23 Oct 2012 15:29:40 +0100 Subject: Formatting and casing correction in WorldCommModule, trailing new line in OSSL to get git diff to not complain --- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 0811519..0650b90 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -3648,4 +3648,4 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api DropAttachmentAt(false, pos, rot); } } -} \ No newline at end of file +} -- cgit v1.1 From e977761071a2d614a9a621437fbf86479b414759 Mon Sep 17 00:00:00 2001 From: SignpostMarv Date: Tue, 23 Oct 2012 15:42:16 +0100 Subject: adding ability for listeners to be filtered by regular expressions and a general-purpose function to see if a given string matches a given regex --- .../Shared/Api/Implementation/OSSL_Api.cs | 63 ++++++++++++++++++++++ 1 file changed, 63 insertions(+) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 0650b90..828288d 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -3647,5 +3647,68 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api DropAttachmentAt(false, pos, rot); } + + public LSL_Integer osListenRegex(int channelID, string name, string ID, string msg, int regexBitfield) + { + CheckThreatLevel(ThreatLevel.Low, "osListenRegex"); + m_host.AddScriptLPS(1); + UUID keyID; + UUID.TryParse(ID, out keyID); + + // if we want the name to be used as a regular expression, ensure it is valid first. + if ((regexBitfield & ScriptBaseClass.OS_LISTEN_REGEX_NAME) == ScriptBaseClass.OS_LISTEN_REGEX_NAME) + { + try + { + Regex.IsMatch("", name); + } + catch (Exception) + { + OSSLShoutError("Name regex is invalid."); + return -1; + } + } + + // if we want the msg to be used as a regular expression, ensure it is valid first. + if ((regexBitfield & ScriptBaseClass.OS_LISTEN_REGEX_MESSAGE) == ScriptBaseClass.OS_LISTEN_REGEX_MESSAGE) + { + try + { + Regex.IsMatch("", msg); + } + catch (Exception) + { + OSSLShoutError("Message regex is invalid."); + return -1; + } + } + + IWorldComm wComm = m_ScriptEngine.World.RequestModuleInterface(); + return (wComm == null) ? -1 : wComm.Listen( + m_host.LocalId, + m_item.ItemID, + m_host.UUID, + channelID, + name, + keyID, + msg, + regexBitfield + ); + } + + public LSL_Integer osRegexIsMatch(string input, string pattern) + { + CheckThreatLevel(ThreatLevel.Low, "osRegexIsMatch"); + m_host.AddScriptLPS(1); + try + { + return Regex.IsMatch(input, pattern) ? 1 : 0; + } + catch (Exception) + { + OSSLShoutError("Possible invalid regular expression detected."); + return 0; + } + } } } -- cgit v1.1 From 1c5f6e48b80e15f97c8203f3db0df6745c7a2283 Mon Sep 17 00:00:00 2001 From: Melanie Date: Fri, 26 Oct 2012 21:23:20 +0100 Subject: Separate LSL's notion of the default anim from the actually playing anims. --- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index dc791d3..fa57845 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -4388,7 +4388,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { AnimationSet currentAnims = presence.Animator.Animations; string currentAnimationState = String.Empty; - if (animationstateNames.TryGetValue(currentAnims.DefaultAnimation.AnimID, out currentAnimationState)) + if (animationstateNames.TryGetValue(currentAnims.ImplicitDefaultAnimation.AnimID, out currentAnimationState)) return currentAnimationState; } } @@ -5705,7 +5705,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api flags |= ScriptBaseClass.AGENT_SITTING; } - if (agent.Animator.Animations.DefaultAnimation.AnimID + if (agent.Animator.Animations.ImplicitDefaultAnimation.AnimID == DefaultAvatarAnimations.AnimsUUID["SIT_GROUND_CONSTRAINED"]) { flags |= ScriptBaseClass.AGENT_SITTING; @@ -7892,7 +7892,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { LSL_Vector lower; LSL_Vector upper; - if (presence.Animator.Animations.DefaultAnimation.AnimID + if (presence.Animator.Animations.ImplicitDefaultAnimation.AnimID == DefaultAvatarAnimations.AnimsUUID["SIT_GROUND_CONSTRAINED"]) { // This is for ground sitting avatars -- cgit v1.1 From 7560010f340e9e67e0fb87d0e3863ed69bdbedf1 Mon Sep 17 00:00:00 2001 From: SignpostMarv Date: Thu, 4 Oct 2012 11:33:21 +0100 Subject: Immediately setting gain to zero as a workaround for code not stopping sound started by llPlaySound --- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 1 + 1 file changed, 1 insertion(+) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index fa57845..bedcd85 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -2452,6 +2452,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public void llStopSound() { m_host.AddScriptLPS(1); + m_host.AdjustSoundGain(0); if (m_host.ParentGroup.LoopSoundSlavePrims.Contains(m_host)) { if (m_host.ParentGroup.LoopSoundMasterPrim == m_host) -- cgit v1.1 From 206a694c6baf9603855cc8eab50909e5e63b0f10 Mon Sep 17 00:00:00 2001 From: SignpostMarv Date: Fri, 5 Oct 2012 14:50:31 +0100 Subject: moving comment for llStopSound inside the method block prior to transposition to sound module --- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index bedcd85..7fa01c1 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -2448,11 +2448,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api m_host.SendSound(KeyOrName(sound).ToString(), volume, true, 0, 0, false, false); } - // Xantor 20080528: Clear prim data of sound instead public void llStopSound() { m_host.AddScriptLPS(1); m_host.AdjustSoundGain(0); + // Xantor 20080528: Clear prim data of sound instead if (m_host.ParentGroup.LoopSoundSlavePrims.Contains(m_host)) { if (m_host.ParentGroup.LoopSoundMasterPrim == m_host) -- cgit v1.1 From 8763a637b5c2e48a97111b4f569e71b7e1c2f1d2 Mon Sep 17 00:00:00 2001 From: SignpostMarv Date: Fri, 5 Oct 2012 14:55:00 +0100 Subject: transposing stop sound into sound module --- .../Shared/Api/Implementation/LSL_Api.cs | 42 +++------------------- 1 file changed, 5 insertions(+), 37 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 7fa01c1..25be3ff 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -107,6 +107,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api protected IUrlModule m_UrlModule = null; protected Dictionary m_userInfoCache = new Dictionary(); protected int EMAIL_PAUSE_TIME = 20; // documented delay value for smtp. + protected ISoundModule m_SoundModule = null; public void Initialize(IScriptEngine ScriptEngine, SceneObjectPart host, TaskInventoryItem item) { @@ -119,6 +120,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api m_TransferModule = m_ScriptEngine.World.RequestModuleInterface(); m_UrlModule = m_ScriptEngine.World.RequestModuleInterface(); + m_SoundModule = m_ScriptEngine.World.RequestModuleInterface(); AsyncCommands = new AsyncCommandManager(ScriptEngine); } @@ -2451,43 +2453,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public void llStopSound() { m_host.AddScriptLPS(1); - m_host.AdjustSoundGain(0); - // Xantor 20080528: Clear prim data of sound instead - if (m_host.ParentGroup.LoopSoundSlavePrims.Contains(m_host)) - { - if (m_host.ParentGroup.LoopSoundMasterPrim == m_host) - { - foreach (SceneObjectPart part in m_host.ParentGroup.LoopSoundSlavePrims) - { - part.Sound = UUID.Zero; - part.SoundGain = 0; - part.SoundFlags = 0; - part.SoundRadius = 0; - part.ScheduleFullUpdate(); - part.SendFullUpdateToAllClients(); - } - m_host.ParentGroup.LoopSoundMasterPrim = null; - m_host.ParentGroup.LoopSoundSlavePrims.Clear(); - } - else - { - m_host.Sound = UUID.Zero; - m_host.SoundGain = 0; - m_host.SoundFlags = 0; - m_host.SoundRadius = 0; - m_host.ScheduleFullUpdate(); - m_host.SendFullUpdateToAllClients(); - } - } - else - { - m_host.Sound = UUID.Zero; - m_host.SoundGain = 0; - m_host.SoundFlags = 0; - m_host.SoundRadius = 0; - m_host.ScheduleFullUpdate(); - m_host.SendFullUpdateToAllClients(); - } + + if (m_SoundModule != null) + m_SoundModule.StopSound(m_host.UUID); } public void llPreloadSound(string sound) -- cgit v1.1 From a68e2fe1692a7611c58f774ac5b94c4298343433 Mon Sep 17 00:00:00 2001 From: SignpostMarv Date: Fri, 5 Oct 2012 15:16:30 +0100 Subject: transposing preload sound onto sound module --- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 25be3ff..61fd1aa 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -2461,7 +2461,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public void llPreloadSound(string sound) { m_host.AddScriptLPS(1); - m_host.PreloadSound(sound); + if (m_SoundModule != null) + m_SoundModule.PreloadSound(KeyOrName(sound), m_host.UUID, 0); ScriptSleep(1000); } -- cgit v1.1 From 29a8ae48b51de55a02f839b6e4566054ad3f7f58 Mon Sep 17 00:00:00 2001 From: SignpostMarv Date: Sat, 6 Oct 2012 22:23:14 +0100 Subject: transposing LoopSoundMaster to Sound Module --- .../Shared/Api/Implementation/LSL_Api.cs | 28 +++------------------- 1 file changed, 3 insertions(+), 25 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 61fd1aa..2669add 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -2397,33 +2397,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public void llLoopSoundMaster(string sound, double volume) { m_host.AddScriptLPS(1); - m_host.ParentGroup.LoopSoundMasterPrim = m_host; - lock (m_host.ParentGroup.LoopSoundSlavePrims) + if (m_SoundModule != null) { - foreach (SceneObjectPart prim in m_host.ParentGroup.LoopSoundSlavePrims) - { - if (prim.Sound != UUID.Zero) - llStopSound(); - - prim.Sound = KeyOrName(sound); - prim.SoundGain = volume; - prim.SoundFlags = 1; // looping - prim.SoundRadius = 20; // Magic number, 20 seems reasonable. Make configurable? - - prim.ScheduleFullUpdate(); - prim.SendFullUpdateToAllClients(); - } + m_SoundModule.LoopSoundMaster(m_host.UUID, KeyOrName(sound), + volume, 20); } - if (m_host.Sound != UUID.Zero) - llStopSound(); - - m_host.Sound = KeyOrName(sound); - m_host.SoundGain = volume; - m_host.SoundFlags = 1; // looping - m_host.SoundRadius = 20; // Magic number, 20 seems reasonable. Make configurable? - - m_host.ScheduleFullUpdate(); - m_host.SendFullUpdateToAllClients(); } public void llLoopSoundSlave(string sound, double volume) -- cgit v1.1 From d7ffcace8f596d9b0cf84f1e8cbe4e2d6a71baef Mon Sep 17 00:00:00 2001 From: SignpostMarv Date: Sat, 6 Oct 2012 22:27:20 +0100 Subject: adjusting parameter order of PreloadSound to be more logical --- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 2669add..0252145 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -2440,7 +2440,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { m_host.AddScriptLPS(1); if (m_SoundModule != null) - m_SoundModule.PreloadSound(KeyOrName(sound), m_host.UUID, 0); + m_SoundModule.PreloadSound(m_host.UUID, KeyOrName(sound), 0); ScriptSleep(1000); } -- cgit v1.1 From 9df510157e26ffcaf04fd4b85512778fddc08f68 Mon Sep 17 00:00:00 2001 From: SignpostMarv Date: Mon, 15 Oct 2012 14:28:34 +0100 Subject: deduplicating code into a single LoopSound method --- .../Shared/Api/Implementation/LSL_Api.cs | 28 ++++++---------------- 1 file changed, 7 insertions(+), 21 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 0252145..c479944 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -2370,28 +2370,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api m_host.SendSound(KeyOrName(sound).ToString(), volume, false, 0, 0, false, false); } - // Xantor 20080528 we should do this differently. - // 1) apply the sound to the object - // 2) schedule full update - // just sending the sound out once doesn't work so well when other avatars come in view later on - // or when the prim gets moved, changed, sat on, whatever - // see large number of mantises (mantes?) - // 20080530 Updated to remove code duplication - // 20080530 Stop sound if there is one, otherwise volume only changes don't work public void llLoopSound(string sound, double volume) { m_host.AddScriptLPS(1); - - if (m_host.Sound != UUID.Zero) - llStopSound(); - - m_host.Sound = KeyOrName(sound); - m_host.SoundGain = volume; - m_host.SoundFlags = 1; // looping - m_host.SoundRadius = 20; // Magic number, 20 seems reasonable. Make configurable? - - m_host.ScheduleFullUpdate(); - m_host.SendFullUpdateToAllClients(); + if (m_SoundModule != null) + { + m_SoundModule.LoopSound(m_host.UUID, KeyOrName(sound), + volume, 20, false); + } } public void llLoopSoundMaster(string sound, double volume) @@ -2399,8 +2385,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api m_host.AddScriptLPS(1); if (m_SoundModule != null) { - m_SoundModule.LoopSoundMaster(m_host.UUID, KeyOrName(sound), - volume, 20); + m_SoundModule.LoopSound(m_host.UUID, KeyOrName(sound), + volume, 20, true); } } -- cgit v1.1 From 5abcecc7356bf58c479a7cff86581131a6ab3c9e Mon Sep 17 00:00:00 2001 From: SignpostMarv Date: Tue, 16 Oct 2012 12:24:33 +0100 Subject: moving SendSound from SceneObjectPart to ISoundModule --- .../Shared/Api/Implementation/LSL_Api.cs | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index c479944..f29be92 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -2367,7 +2367,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api m_host.AddScriptLPS(1); // send the sound, once, to all clients in range - m_host.SendSound(KeyOrName(sound).ToString(), volume, false, 0, 0, false, false); + if (m_SoundModule != null) + { + m_SoundModule.SendSound(m_host.UUID, KeyOrName(sound).ToString(), volume, false, 0, 0, false, false); + } } public void llLoopSound(string sound, double volume) @@ -2404,14 +2407,20 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api m_host.AddScriptLPS(1); // send the sound, once, to all clients in range - m_host.SendSound(KeyOrName(sound).ToString(), volume, false, 0, 0, true, false); + if (m_SoundModule != null) + { + m_SoundModule.SendSound(m_host.UUID, KeyOrName(sound).ToString(), volume, false, 0, 0, true, false); + } } public void llTriggerSound(string sound, double volume) { m_host.AddScriptLPS(1); - // send the sound, once, to all clients in range - m_host.SendSound(KeyOrName(sound).ToString(), volume, true, 0, 0, false, false); + // send the sound, once, to all clients in rangeTrigger or play an attached sound in this part's inventory. + if (m_SoundModule != null) + { + m_SoundModule.SendSound(m_host.UUID, KeyOrName(sound).ToString(), volume, true, 0, 0, false, false); + } } public void llStopSound() @@ -5824,10 +5833,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api LSL_Vector bottom_south_west) { m_host.AddScriptLPS(1); + if (m_SoundModule != null) + { float radius1 = (float)llVecDist(llGetPos(), top_north_east); float radius2 = (float)llVecDist(llGetPos(), bottom_south_west); float radius = Math.Abs(radius1 - radius2); - m_host.SendSound(KeyOrName(sound).ToString(), volume, true, 0, radius, false, false); + m_SoundModule.SendSound(m_host.UUID, KeyOrName(sound).ToString(), volume, true, 0, radius, false, false); + } } public void llEjectFromLand(string pest) -- cgit v1.1 From c5af16aef82e2bdf2f4d877a231180e00a8893a6 Mon Sep 17 00:00:00 2001 From: SignpostMarv Date: Tue, 16 Oct 2012 12:40:21 +0100 Subject: shuffling code around so that the interface for ISoundModule.SendSound() specifies a UUID rather than a string --- .../Shared/Api/Implementation/LSL_Api.cs | 44 ++++++++++++++++++++-- 1 file changed, 40 insertions(+), 4 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index f29be92..869d94e 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -333,6 +333,42 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return key; } + /// + /// Return the UUID of the asset matching the specified key or name + /// and asset type. + /// + /// + /// + /// + protected UUID KeyOrName(string k, AssetType type) + { + UUID key; + + if (!UUID.TryParse(k, out key)) + { + TaskInventoryItem item = m_host.Inventory.GetInventoryItem(k); + if (item != null && item.Type == (int)type) + key = item.AssetID; + } + else + { + lock (m_host.TaskInventory) + { + foreach (KeyValuePair item in m_host.TaskInventory) + { + if (item.Value.Type == (int)type && item.Value.Name == k) + { + key = item.Value.ItemID; + break; + } + } + } + } + + + return key; + } + //These are the implementations of the various ll-functions used by the LSL scripts. public LSL_Float llSin(double f) { @@ -2369,7 +2405,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api // send the sound, once, to all clients in range if (m_SoundModule != null) { - m_SoundModule.SendSound(m_host.UUID, KeyOrName(sound).ToString(), volume, false, 0, 0, false, false); + m_SoundModule.SendSound(m_host.UUID, KeyOrName(sound, AssetType.Sound), volume, false, 0, 0, false, false); } } @@ -2409,7 +2445,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api // send the sound, once, to all clients in range if (m_SoundModule != null) { - m_SoundModule.SendSound(m_host.UUID, KeyOrName(sound).ToString(), volume, false, 0, 0, true, false); + m_SoundModule.SendSound(m_host.UUID, KeyOrName(sound, AssetType.Sound), volume, false, 0, 0, true, false); } } @@ -2419,7 +2455,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api // send the sound, once, to all clients in rangeTrigger or play an attached sound in this part's inventory. if (m_SoundModule != null) { - m_SoundModule.SendSound(m_host.UUID, KeyOrName(sound).ToString(), volume, true, 0, 0, false, false); + m_SoundModule.SendSound(m_host.UUID, KeyOrName(sound, AssetType.Sound), volume, true, 0, 0, false, false); } } @@ -5838,7 +5874,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api float radius1 = (float)llVecDist(llGetPos(), top_north_east); float radius2 = (float)llVecDist(llGetPos(), bottom_south_west); float radius = Math.Abs(radius1 - radius2); - m_SoundModule.SendSound(m_host.UUID, KeyOrName(sound).ToString(), volume, true, 0, radius, false, false); + m_SoundModule.SendSound(m_host.UUID, KeyOrName(sound, AssetType.Sound), volume, true, 0, radius, false, false); } } -- cgit v1.1 From c796f7861e318cc12248f3a86ee5b29e3fa99d79 Mon Sep 17 00:00:00 2001 From: SignpostMarv Date: Tue, 16 Oct 2012 12:44:09 +0100 Subject: 80-character width terminal formatting of recent commits to llPlaySound, llPlaySoundSlave, llTriggerSound and llTriggerSoundLimited --- .../Shared/Api/Implementation/LSL_Api.cs | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 869d94e..610cb14 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -2405,7 +2405,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api // send the sound, once, to all clients in range if (m_SoundModule != null) { - m_SoundModule.SendSound(m_host.UUID, KeyOrName(sound, AssetType.Sound), volume, false, 0, 0, false, false); + m_SoundModule.SendSound(m_host.UUID, + KeyOrName(sound, AssetType.Sound), volume, false, 0, + 0, false, false); } } @@ -2445,7 +2447,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api // send the sound, once, to all clients in range if (m_SoundModule != null) { - m_SoundModule.SendSound(m_host.UUID, KeyOrName(sound, AssetType.Sound), volume, false, 0, 0, true, false); + m_SoundModule.SendSound(m_host.UUID, + KeyOrName(sound, AssetType.Sound), volume, false, 0, + 0, true, false); } } @@ -2455,7 +2459,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api // send the sound, once, to all clients in rangeTrigger or play an attached sound in this part's inventory. if (m_SoundModule != null) { - m_SoundModule.SendSound(m_host.UUID, KeyOrName(sound, AssetType.Sound), volume, true, 0, 0, false, false); + m_SoundModule.SendSound(m_host.UUID, + KeyOrName(sound, AssetType.Sound), volume, true, 0, 0, + false, false); } } @@ -5871,10 +5877,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api m_host.AddScriptLPS(1); if (m_SoundModule != null) { - float radius1 = (float)llVecDist(llGetPos(), top_north_east); - float radius2 = (float)llVecDist(llGetPos(), bottom_south_west); - float radius = Math.Abs(radius1 - radius2); - m_SoundModule.SendSound(m_host.UUID, KeyOrName(sound, AssetType.Sound), volume, true, 0, radius, false, false); + float radius1 = (float)llVecDist(llGetPos(), top_north_east); + float radius2 = (float)llVecDist(llGetPos(), bottom_south_west); + float radius = Math.Abs(radius1 - radius2); + m_SoundModule.SendSound(m_host.UUID, + KeyOrName(sound, AssetType.Sound), volume, true, 0, + radius, false, false); } } -- cgit v1.1 From f9923d4423f8f9dcf09a12e702737d2030a26d4a Mon Sep 17 00:00:00 2001 From: SignpostMarv Date: Tue, 16 Oct 2012 12:45:30 +0100 Subject: shifting from two instances of typecasting to one instance of typecasting in llTriggerSoundLimited --- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 610cb14..2b6a3fd 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -5877,12 +5877,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api m_host.AddScriptLPS(1); if (m_SoundModule != null) { - float radius1 = (float)llVecDist(llGetPos(), top_north_east); - float radius2 = (float)llVecDist(llGetPos(), bottom_south_west); - float radius = Math.Abs(radius1 - radius2); + double radius1 = llVecDist(llGetPos(), top_north_east); + double radius2 = llVecDist(llGetPos(), bottom_south_west); + double radius = Math.Abs(radius1 - radius2); m_SoundModule.SendSound(m_host.UUID, KeyOrName(sound, AssetType.Sound), volume, true, 0, - radius, false, false); + (float)radius, false, false); } } -- cgit v1.1 From af9dc483e9db950ca4187a7afe186da80d2c7acf Mon Sep 17 00:00:00 2001 From: SignpostMarv Date: Tue, 16 Oct 2012 12:48:41 +0100 Subject: refactoring llGetPos() to take advantage of implicit converter --- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 2b6a3fd..2654b5a 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -2082,8 +2082,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public LSL_Vector llGetPos() { m_host.AddScriptLPS(1); - Vector3 pos = m_host.GetWorldPosition(); - return new LSL_Vector(pos.X, pos.Y, pos.Z); + return m_host.GetWorldPosition(); } public LSL_Vector llGetLocalPos() -- cgit v1.1 From ef157110897ef162c7f076d6d5f423b8cd9a8f47 Mon Sep 17 00:00:00 2001 From: SignpostMarv Date: Tue, 16 Oct 2012 12:49:25 +0100 Subject: refactoring llTriggerSoundLimited to not use the LSL methods, since that will cause unnecessary calls to m_host.AddScriptLPS(1) --- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 2654b5a..99b6189 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -5876,8 +5876,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api m_host.AddScriptLPS(1); if (m_SoundModule != null) { - double radius1 = llVecDist(llGetPos(), top_north_east); - double radius2 = llVecDist(llGetPos(), bottom_south_west); + double radius1 = VecDist(m_host.GetWorldPosition(), top_north_east); + double radius2 = VecDist(m_host.GetWorldPosition(), bottom_south_west); double radius = Math.Abs(radius1 - radius2); m_SoundModule.SendSound(m_host.UUID, KeyOrName(sound, AssetType.Sound), volume, true, 0, -- cgit v1.1 From a9999a9676d46669150343e4cdbf65428326a91d Mon Sep 17 00:00:00 2001 From: SignpostMarv Date: Tue, 16 Oct 2012 13:11:17 +0100 Subject: Refactoring llTriggerSoundLimited with a new method on ISoundModule, as the LL Wiki spec for llTriggerSoundLimited states an axis-aligned bounding box, not radial constraint --- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 99b6189..aeb74a5 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -5876,12 +5876,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api m_host.AddScriptLPS(1); if (m_SoundModule != null) { - double radius1 = VecDist(m_host.GetWorldPosition(), top_north_east); - double radius2 = VecDist(m_host.GetWorldPosition(), bottom_south_west); - double radius = Math.Abs(radius1 - radius2); - m_SoundModule.SendSound(m_host.UUID, - KeyOrName(sound, AssetType.Sound), volume, true, 0, - (float)radius, false, false); + m_SoundModule.TriggerSoundLimited(m_host.UUID, + KeyOrName(sound, AssetType.Sound), volume, + bottom_south_west, top_north_east); } } -- cgit v1.1 From dcac2a7f716e512b604cce02768770e1660600eb Mon Sep 17 00:00:00 2001 From: SignpostMarv Date: Tue, 16 Oct 2012 13:27:03 +0100 Subject: refactoring llCollisionSound to use new KeyOrName method --- .../Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index aeb74a5..0fa247d 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -4342,16 +4342,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api m_host.AddScriptLPS(1); // TODO: Parameter check logic required. - UUID soundId = UUID.Zero; - if (!UUID.TryParse(impact_sound, out soundId)) - { - TaskInventoryItem item = m_host.Inventory.GetInventoryItem(impact_sound); - - if (item != null && item.Type == (int)AssetType.Sound) - soundId = item.AssetID; - } - - m_host.CollisionSound = soundId; + m_host.CollisionSound = KeyOrName(impact_sound, AssetType.Sound); m_host.CollisionSoundVolume = (float)impact_volume; } -- cgit v1.1 From 236cc1f2686e16d8c3d80bce39f5aa13b177dbcc Mon Sep 17 00:00:00 2001 From: Melanie Date: Mon, 5 Nov 2012 00:05:01 +0000 Subject: Change user message on TeskInventoryAccepted to let the viewer format it properly --- .../Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 0fa247d..be030af 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -3963,17 +3963,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (m_TransferModule != null) { - byte[] bucket = new byte[] { (byte)item.Type }; + byte[] bucket = new byte[1]; + bucket[0] = (byte)item.Type; GridInstantMessage msg = new GridInstantMessage(World, - m_host.UUID, m_host.Name + ", an object owned by " + - resolveName(m_host.OwnerID) + ",", destId, + m_host.OwnerID, m_host.Name, destId, (byte)InstantMessageDialog.TaskInventoryOffered, - false, item.Name + "\n" + m_host.Name + " is located at " + + false, item.Name+". "+m_host.Name+" is located at "+ World.RegionInfo.RegionName+" "+ m_host.AbsolutePosition.ToString(), agentItem.ID, true, m_host.AbsolutePosition, - bucket, true); // TODO: May actually send no timestamp + bucket, true); m_TransferModule.SendInstantMessage(msg, delegate(bool success) {}); } -- cgit v1.1 From 64c80aec644b2fede1b08ad360f54a658d4849cb Mon Sep 17 00:00:00 2001 From: PixelTomsen Date: Mon, 5 Nov 2012 19:16:46 +0100 Subject: llSetLinkCamera implementation wiki: http://wiki.secondlife.com/wiki/LlSetLinkCamera mantis: http://opensimulator.org/mantis/view.php?id=6397 --- .../Shared/Api/Implementation/LSL_Api.cs | 30 ++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index be030af..acf4d8c 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -6637,6 +6637,36 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api m_host.SetCameraAtOffset(offset); } + public void llSetLinkCamera(LSL_Integer link, LSL_Vector eye, LSL_Vector at) + { + m_host.AddScriptLPS(1); + + if (link == ScriptBaseClass.LINK_SET || + link == ScriptBaseClass.LINK_ALL_CHILDREN || + link == ScriptBaseClass.LINK_ALL_OTHERS) return; + + SceneObjectPart part = null; + + switch (link) + { + case ScriptBaseClass.LINK_ROOT: + part = m_host.ParentGroup.RootPart; + break; + case ScriptBaseClass.LINK_THIS: + part = m_host; + break; + default: + part = m_host.ParentGroup.GetLinkNumPart(link); + break; + } + + if (null != part) + { + part.SetCameraEyeOffset(eye); + part.SetCameraAtOffset(at); + } + } + public LSL_String llDumpList2String(LSL_List src, string seperator) { m_host.AddScriptLPS(1); -- cgit v1.1 From aeeaa3a0a9b965dfe5d1111b178234c94de9ba9d Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Wed, 14 Nov 2012 11:09:43 -0800 Subject: Added AssemblyInfos to every dll in the OpenSim.Region namespace. --- .../Api/Implementation/Properties/AssemblyInfo.cs | 33 ++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Properties/AssemblyInfo.cs (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Properties/AssemblyInfo.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..d173db0 --- /dev/null +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Properties/AssemblyInfo.cs @@ -0,0 +1,33 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("OpenSim.Region.ScriptEngine.Shared.Api")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("http://opensimulator.org")] +[assembly: AssemblyProduct("OpenSim")] +[assembly: AssemblyCopyright("OpenSimulator developers")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("369ed06e-a3ca-40f0-98e3-3cd3ec1443c3")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +[assembly: AssemblyVersion("0.7.5.*")] +[assembly: AssemblyFileVersion("1.0.0.0")] -- cgit v1.1 From f254af29ac88c2aa073d604c89709b4abca9a2f1 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 24 Nov 2012 03:39:37 +0000 Subject: avoid potencial NullReferenceException --- .../ScriptEngine/Shared/Api/Implementation/AsyncCommandManager.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/AsyncCommandManager.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/AsyncCommandManager.cs index 94fd940..6879ebb 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/AsyncCommandManager.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/AsyncCommandManager.cs @@ -317,8 +317,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api comms.DeleteListener(itemID); IXMLRPC xmlrpc = engine.World.RequestModuleInterface(); - xmlrpc.DeleteChannels(itemID); - xmlrpc.CancelSRDRequests(itemID); + if (xmlrpc != null) + { + xmlrpc.DeleteChannels(itemID); + xmlrpc.CancelSRDRequests(itemID); + } // Remove Sensors m_SensorRepeat[engine].UnSetSenseRepeaterEvents(localID, itemID); -- cgit v1.1 From d3904ff48464fcde5266aac08b5c95227acbbcb1 Mon Sep 17 00:00:00 2001 From: Melanie Date: Mon, 3 Dec 2012 19:34:22 +0100 Subject: Add a transaction ID to the money module path for llTransferLindenDollars --- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 700f538..6b63d94 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -3013,7 +3013,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } bool result = money.ObjectGiveMoney( - m_host.ParentGroup.RootPart.UUID, m_host.ParentGroup.RootPart.OwnerID, toID, amount); + m_host.ParentGroup.RootPart.UUID, m_host.ParentGroup.RootPart.OwnerID, toID, amount, UUID.Zero); if (result) return 1; @@ -12529,7 +12529,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } bool result = money.ObjectGiveMoney( - m_host.ParentGroup.RootPart.UUID, m_host.ParentGroup.RootPart.OwnerID, toID, amount); + m_host.ParentGroup.RootPart.UUID, m_host.ParentGroup.RootPart.OwnerID, toID, amount, txn); if (result) { -- cgit v1.1