From 2787207aa287a60a3c7c06fad66d406180033ae2 Mon Sep 17 00:00:00 2001 From: BlueWall Date: Fri, 19 Aug 2011 18:47:21 -0400 Subject: Add llRegionSayTo llRegionSayTo(key target, integer channel, string messasge) Allows messages to be sent region-wide to a particular prim. --- .../Shared/Api/Implementation/LSL_Api.cs | 27 +++++++++++++++++----- .../ScriptEngine/Shared/Api/Interface/ILSL_Api.cs | 1 + .../ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs | 5 ++++ 3 files changed, 27 insertions(+), 6 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index c84afee..25d7ad9 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -843,6 +843,27 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api wComm.DeliverMessage(ChatTypeEnum.Region, channelID, m_host.Name, m_host.UUID, text); } + public void llRegionSayTo(string target, int channel, string msg) + { + if (channel == 0) + { + LSLError("Cannot use llRegionSay() on channel 0"); + return; + } + + if (msg.Length > 1023) + msg = msg.Substring(0, 1023); + + m_host.AddScriptLPS(1); + + UUID TargetID; + UUID.TryParse(target, out TargetID); + + IWorldComm wComm = m_ScriptEngine.World.RequestModuleInterface(); + if (wComm != null) + wComm.DeliverMessageTo(TargetID, channel, m_host.Name, m_host.UUID, msg); + } + public LSL_Integer llListen(int channelID, string name, string ID, string msg) { m_host.AddScriptLPS(1); @@ -10486,12 +10507,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api NotImplemented("llGetUsedMemory"); } - public void llRegionSayTo(LSL_Key target, LSL_Integer channel, LSL_String msg) - { - m_host.AddScriptLPS(1); - NotImplemented("llRegionSayTo"); - } - public void llScriptProfiler(LSL_Integer flags) { m_host.AddScriptLPS(1); diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs index 27f9c84..4d7d60d 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs @@ -271,6 +271,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces void llPushObject(string target, LSL_Vector impulse, LSL_Vector ang_impulse, int local); void llRefreshPrimURL(); void llRegionSay(int channelID, string text); + void llRegionSayTo(string target, int channelID, string text); void llReleaseCamera(string avatar); void llReleaseControls(); void llReleaseURL(string url); diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs index 303d75e..96e46fd 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs @@ -1199,6 +1199,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase m_LSL_Functions.llRegionSay(channelID, text); } + public void llRegionSayTo(string key, int channelID, string text) + { + m_LSL_Functions.llRegionSayTo(key, channelID, text); + } + public void llReleaseCamera(string avatar) { m_LSL_Functions.llReleaseCamera(avatar); -- cgit v1.1 From 5e231acdce7a006a4d88a205044d9862f7d4dda8 Mon Sep 17 00:00:00 2001 From: BlueWall Date: Sat, 20 Aug 2011 12:36:35 -0400 Subject: Add avatar and attachments to llRegionSay llRegionSay will now message avatars on chan 0 and will message attachments on the avatar that listen on channels other than 0. This behavior is consistant with the LL implementation as tested on regions in Agni with one exception: this implementation does not include issue: https://jira.secondlife.com/browse/SCR-66? --- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 25d7ad9..db45354 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -845,11 +845,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public void llRegionSayTo(string target, int channel, string msg) { - if (channel == 0) - { - LSLError("Cannot use llRegionSay() on channel 0"); - return; - } + string error = String.Empty; if (msg.Length > 1023) msg = msg.Substring(0, 1023); @@ -861,7 +857,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api IWorldComm wComm = m_ScriptEngine.World.RequestModuleInterface(); if (wComm != null) - wComm.DeliverMessageTo(TargetID, channel, m_host.Name, m_host.UUID, msg); + if (!wComm.DeliverMessageTo(TargetID, channel, m_host.AbsolutePosition, m_host.Name, m_host.UUID, msg, out error)) + LSLError(error); } public LSL_Integer llListen(int channelID, string name, string ID, string msg) -- cgit v1.1 From db91044593fc2592c7abb21034aeea8965febbd7 Mon Sep 17 00:00:00 2001 From: Snoopy Pfeffer Date: Mon, 22 Aug 2011 14:51:43 +0200 Subject: Thanks Neil Canham for fixing bulk inventory updates, no sending BulkInventoryUpdate after accepting inventory items. --- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/ScriptEngine/Shared') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index db45354..ef67a0c 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -3927,7 +3927,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api GridInstantMessage msg = new GridInstantMessage(World, m_host.UUID, m_host.Name+", an object owned by "+ resolveName(m_host.OwnerID)+",", destId, - (byte)InstantMessageDialog.InventoryOffered, + (byte)InstantMessageDialog.TaskInventoryOffered, false, objName+"\n"+m_host.Name+" is located at "+ World.RegionInfo.RegionName+" "+ m_host.AbsolutePosition.ToString(), -- cgit v1.1 From ce011d7e446e8f05247fc4ed7e0af5a94afbb074 Mon Sep 17 00:00:00 2001 From: Mic Bowman Date: Tue, 23 Aug 2011 10:52:12 -0700 Subject: Protect a check for default texture entry when setting alpha values. Apparently if all faces have their own textures then the default texture is null --- .../ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index ef67a0c..24be7d4 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -1619,9 +1619,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api tex.FaceTextures[i].RGBA = texcolor; } } - texcolor = tex.DefaultTexture.RGBA; - texcolor.A = Util.Clip((float)alpha, 0.0f, 1.0f); - tex.DefaultTexture.RGBA = texcolor; + + // In some cases, the default texture can be null, eg when every face + // has a unique texture + if (tex.DefaultTexture != null) + { + texcolor = tex.DefaultTexture.RGBA; + texcolor.A = Util.Clip((float)alpha, 0.0f, 1.0f); + tex.DefaultTexture.RGBA = texcolor; + } + part.UpdateTexture(tex); return; } -- cgit v1.1 From 97b207240ee79abfec08d2dfaa9385211eb305c8 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 23 Aug 2011 22:05:22 +0100 Subject: rename AttachmentsModule.ShowDetachInUserInventory() to DetachSingleAttachmentToInv() for consistency and to reflect it's actual behaviour --- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/ScriptEngine/Shared') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 24be7d4..ffa0e24 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -3031,7 +3031,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api IAttachmentsModule attachmentsModule = m_ScriptEngine.World.AttachmentsModule; if (attachmentsModule != null) - attachmentsModule.ShowDetachInUserInventory(itemID, presence.ControllingClient); + attachmentsModule.DetachSingleAttachmentToInv(itemID, presence.ControllingClient); } public void llTakeCamera(string avatar) -- cgit v1.1 From cf3ffe5bb4c6a8bea9599b6143c2f7793500c984 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 24 Aug 2011 20:49:23 +0100 Subject: Fix llAttachToAvatar() Apart from one obvious bug, this was failing because attempting to serialize the script from inside the script (as part of saving the attachment as an inventory asset) was triggering an extremely long delay. So we now don't do this. The state will be serialized anyway when the avatar normally logs out. The worst that can happen is that if the client/server crashes, the attachment scripts start without previous state. --- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index ffa0e24..d340ef2 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -2964,8 +2964,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { m_host.AddScriptLPS(1); - if (m_host.ParentGroup.RootPart.AttachmentPoint == 0) - return; +// if (m_host.ParentGroup.RootPart.AttachmentPoint == 0) +// return; TaskInventoryItem item; -- cgit v1.1 From cf42fcd978601a315ac1eb9599ab169f14fc9a8d Mon Sep 17 00:00:00 2001 From: Micheil Merlin Date: Wed, 24 Aug 2011 20:21:51 -0500 Subject: llSetPrimitiveParams correct prim hollow for cases where limit should be 70%. Signed-off-by: BlueWall --- .../Shared/Api/Implementation/LSL_Api.cs | 87 ++++++++++++---------- .../ScriptEngine/Shared/Tests/LSL_ApiTest.cs | 75 ++++++++++++++++--- 2 files changed, 111 insertions(+), 51 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index d340ef2..a690e3b 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -6608,7 +6608,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return Util.SHA1Hash(src).ToLower(); } - protected ObjectShapePacket.ObjectDataBlock SetPrimitiveBlockShapeParams(SceneObjectPart part, int holeshape, LSL_Vector cut, float hollow, LSL_Vector twist) + protected ObjectShapePacket.ObjectDataBlock SetPrimitiveBlockShapeParams(SceneObjectPart part, int holeshape, LSL_Vector cut, float hollow, LSL_Vector twist, byte profileshape, byte pathcurve) { ObjectShapePacket.ObjectDataBlock shapeBlock = new ObjectShapePacket.ObjectDataBlock(); @@ -6619,7 +6619,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { holeshape = (int)ScriptBaseClass.PRIM_HOLE_DEFAULT; } - shapeBlock.ProfileCurve = (byte)holeshape; + shapeBlock.PathCurve = pathcurve; + shapeBlock.ProfileCurve = (byte)holeshape; // Set the hole shape. + shapeBlock.ProfileCurve += profileshape; // Add in the profile shape. if (cut.x < 0f) { cut.x = 0f; @@ -6651,9 +6653,26 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { hollow = 0f; } - if (hollow > 0.95) + // If the prim is a Cylinder, Prism, Sphere, Torus or Ring (or not a + // Box or Tube) and the hole shape is a square, hollow is limited to + // a max of 70%. The viewer performs its own check on this value but + // we need to do it here also so llGetPrimitiveParams can have access + // to the correct value. + if (profileshape != (byte)ProfileCurve.Square && + holeshape == (int)ScriptBaseClass.PRIM_HOLE_SQUARE) { - hollow = 0.95f; + if (hollow > 0.70f) + { + hollow = 0.70f; + } + } + // Otherwise, hollow is limited to 95%. + else + { + if (hollow > 0.95f) + { + hollow = 0.95f; + } } shapeBlock.ProfileHollow = (ushort)(50000 * hollow); if (twist.x < -1.0f) @@ -6677,20 +6696,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api shapeBlock.ObjectLocalID = part.LocalId; - // retain pathcurve - shapeBlock.PathCurve = part.Shape.PathCurve; - part.Shape.SculptEntry = false; return shapeBlock; } - protected void SetPrimitiveShapeParams(SceneObjectPart part, int holeshape, LSL_Vector cut, float hollow, LSL_Vector twist, LSL_Vector taper_b, LSL_Vector topshear, byte fudge) + // Prim type box, cylinder and prism. + protected void SetPrimitiveShapeParams(SceneObjectPart part, int holeshape, LSL_Vector cut, float hollow, LSL_Vector twist, LSL_Vector taper_b, LSL_Vector topshear, byte profileshape, byte pathcurve) { ObjectShapePacket.ObjectDataBlock shapeBlock; - shapeBlock = SetPrimitiveBlockShapeParams(part, holeshape, cut, hollow, twist); - - shapeBlock.ProfileCurve += fudge; + shapeBlock = SetPrimitiveBlockShapeParams(part, holeshape, cut, hollow, twist, profileshape, pathcurve); if (taper_b.x < 0f) { @@ -6733,18 +6748,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api part.UpdateShape(shapeBlock); } - protected void SetPrimitiveShapeParams(SceneObjectPart part, int holeshape, LSL_Vector cut, float hollow, LSL_Vector twist, LSL_Vector dimple, byte fudge) + // Prim type sphere. + protected void SetPrimitiveShapeParams(SceneObjectPart part, int holeshape, LSL_Vector cut, float hollow, LSL_Vector twist, LSL_Vector dimple, byte profileshape, byte pathcurve) { ObjectShapePacket.ObjectDataBlock shapeBlock; - shapeBlock = SetPrimitiveBlockShapeParams(part, holeshape, cut, hollow, twist); + shapeBlock = SetPrimitiveBlockShapeParams(part, holeshape, cut, hollow, twist, profileshape, pathcurve); // profile/path swapped for a sphere shapeBlock.PathBegin = shapeBlock.ProfileBegin; shapeBlock.PathEnd = shapeBlock.ProfileEnd; - shapeBlock.ProfileCurve += fudge; - shapeBlock.PathScaleX = 100; shapeBlock.PathScaleY = 100; @@ -6775,13 +6789,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api part.UpdateShape(shapeBlock); } - protected void SetPrimitiveShapeParams(SceneObjectPart part, int holeshape, LSL_Vector cut, float hollow, LSL_Vector twist, LSL_Vector holesize, LSL_Vector topshear, LSL_Vector profilecut, LSL_Vector taper_a, float revolutions, float radiusoffset, float skew, byte fudge) + // Prim type torus, tube and ring. + protected void SetPrimitiveShapeParams(SceneObjectPart part, int holeshape, LSL_Vector cut, float hollow, LSL_Vector twist, LSL_Vector holesize, LSL_Vector topshear, LSL_Vector profilecut, LSL_Vector taper_a, float revolutions, float radiusoffset, float skew, byte profileshape, byte pathcurve) { ObjectShapePacket.ObjectDataBlock shapeBlock; - shapeBlock = SetPrimitiveBlockShapeParams(part, holeshape, cut, hollow, twist); - - shapeBlock.ProfileCurve += fudge; + shapeBlock = SetPrimitiveBlockShapeParams(part, holeshape, cut, hollow, twist, profileshape, pathcurve); // profile/path swapped for a torrus, tube, ring shapeBlock.PathBegin = shapeBlock.ProfileBegin; @@ -6901,7 +6914,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api part.UpdateShape(shapeBlock); } - protected void SetPrimitiveShapeParams(SceneObjectPart part, string map, int type) + // Prim type sculpt. + protected void SetPrimitiveShapeParams(SceneObjectPart part, string map, int type, byte pathcurve) { ObjectShapePacket.ObjectDataBlock shapeBlock = new ObjectShapePacket.ObjectDataBlock(); UUID sculptId; @@ -6914,6 +6928,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (sculptId == UUID.Zero) return; + shapeBlock.PathCurve = pathcurve; shapeBlock.ObjectLocalID = part.LocalId; shapeBlock.PathScaleX = 100; shapeBlock.PathScaleY = 150; @@ -6927,9 +6942,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api type = (int)ScriptBaseClass.PRIM_SCULPT_TYPE_SPHERE; } - // retain pathcurve - shapeBlock.PathCurve = part.Shape.PathCurve; - part.Shape.SetSculptProperties((byte)type, sculptId); part.Shape.SculptEntry = true; part.UpdateShape(shapeBlock); @@ -7053,8 +7065,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api taper_b = rules.GetVector3Item(idx++); topshear = rules.GetVector3Item(idx++); - part.Shape.PathCurve = (byte)Extrusion.Straight; - SetPrimitiveShapeParams(part, face, v, hollow, twist, taper_b, topshear, 1); + SetPrimitiveShapeParams(part, face, v, hollow, twist, taper_b, topshear, + (byte)ProfileShape.Square, (byte)Extrusion.Straight); break; case (int)ScriptBaseClass.PRIM_TYPE_CYLINDER: @@ -7067,9 +7079,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api twist = rules.GetVector3Item(idx++); taper_b = rules.GetVector3Item(idx++); topshear = rules.GetVector3Item(idx++); - part.Shape.ProfileShape = ProfileShape.Circle; - part.Shape.PathCurve = (byte)Extrusion.Straight; - SetPrimitiveShapeParams(part, face, v, hollow, twist, taper_b, topshear, 0); + SetPrimitiveShapeParams(part, face, v, hollow, twist, taper_b, topshear, + (byte)ProfileShape.Circle, (byte)Extrusion.Straight); break; case (int)ScriptBaseClass.PRIM_TYPE_PRISM: @@ -7082,8 +7093,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api twist = rules.GetVector3Item(idx++); taper_b = rules.GetVector3Item(idx++); topshear = rules.GetVector3Item(idx++); - part.Shape.PathCurve = (byte)Extrusion.Straight; - SetPrimitiveShapeParams(part, face, v, hollow, twist, taper_b, topshear, 3); + SetPrimitiveShapeParams(part, face, v, hollow, twist, taper_b, topshear, + (byte)ProfileShape.EquilateralTriangle, (byte)Extrusion.Straight); break; case (int)ScriptBaseClass.PRIM_TYPE_SPHERE: @@ -7095,8 +7106,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api hollow = (float)rules.GetLSLFloatItem(idx++); twist = rules.GetVector3Item(idx++); taper_b = rules.GetVector3Item(idx++); // dimple - part.Shape.PathCurve = (byte)Extrusion.Curve1; - SetPrimitiveShapeParams(part, face, v, hollow, twist, taper_b, 5); + SetPrimitiveShapeParams(part, face, v, hollow, twist, taper_b, + (byte)ProfileShape.HalfCircle, (byte)Extrusion.Curve1); break; case (int)ScriptBaseClass.PRIM_TYPE_TORUS: @@ -7114,9 +7125,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api revolutions = (float)rules.GetLSLFloatItem(idx++); radiusoffset = (float)rules.GetLSLFloatItem(idx++); skew = (float)rules.GetLSLFloatItem(idx++); - part.Shape.PathCurve = (byte)Extrusion.Curve1; SetPrimitiveShapeParams(part, face, v, hollow, twist, holesize, topshear, profilecut, taper_b, - revolutions, radiusoffset, skew, 0); + revolutions, radiusoffset, skew, (byte)ProfileShape.Circle, (byte)Extrusion.Curve1); break; case (int)ScriptBaseClass.PRIM_TYPE_TUBE: @@ -7134,9 +7144,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api revolutions = (float)rules.GetLSLFloatItem(idx++); radiusoffset = (float)rules.GetLSLFloatItem(idx++); skew = (float)rules.GetLSLFloatItem(idx++); - part.Shape.PathCurve = (byte)Extrusion.Curve1; SetPrimitiveShapeParams(part, face, v, hollow, twist, holesize, topshear, profilecut, taper_b, - revolutions, radiusoffset, skew, 1); + revolutions, radiusoffset, skew, (byte)ProfileShape.Square, (byte)Extrusion.Curve1); break; case (int)ScriptBaseClass.PRIM_TYPE_RING: @@ -7154,9 +7163,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api revolutions = (float)rules.GetLSLFloatItem(idx++); radiusoffset = (float)rules.GetLSLFloatItem(idx++); skew = (float)rules.GetLSLFloatItem(idx++); - part.Shape.PathCurve = (byte)Extrusion.Curve1; SetPrimitiveShapeParams(part, face, v, hollow, twist, holesize, topshear, profilecut, taper_b, - revolutions, radiusoffset, skew, 3); + revolutions, radiusoffset, skew, (byte)ProfileShape.EquilateralTriangle, (byte)Extrusion.Curve1); break; case (int)ScriptBaseClass.PRIM_TYPE_SCULPT: @@ -7165,8 +7173,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api string map = rules.Data[idx++].ToString(); face = (int)rules.GetLSLIntegerItem(idx++); // type - part.Shape.PathCurve = (byte)Extrusion.Curve1; - SetPrimitiveShapeParams(part, map, face); + SetPrimitiveShapeParams(part, map, face, (byte)Extrusion.Curve1); break; } diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs index 623c82d..8cd1e84 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs @@ -182,6 +182,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests Vector3.Zero) { Name = obj1Name, UUID = objUuid }; Assert.That(scene.AddNewSceneObject(new SceneObjectGroup(part1), false), Is.True); + // Note that prim hollow check is passed with the other prim params in order to allow the + // specification of a different check value from the prim param. A cylinder, prism, sphere, + // torus or ring, with a hole shape of square, is limited to a hollow of 70%. Test 5 below + // specifies a value of 95% and checks to see if 70% was properly returned. + // Test a sphere. CheckllSetPrimitiveParams( "test 1", // Prim test identification string @@ -191,7 +196,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests new LSL_Types.Vector3(0.0d, 0.075d, 0.0d), // Prim cut 0.80d, // Prim hollow new LSL_Types.Vector3(0.0d, 0.0d, 0.0d), // Prim twist - new LSL_Types.Vector3(0.32d, 0.76d, 0.0d)); // Prim dimple + new LSL_Types.Vector3(0.32d, 0.76d, 0.0d), // Prim dimple + 0.80d); // Prim hollow check // Test a prism. CheckllSetPrimitiveParams( @@ -203,7 +209,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests 0.90d, // Prim hollow new LSL_Types.Vector3(0.0d, 0.0d, 0.0d), // Prim twist new LSL_Types.Vector3(2.0d, 1.0d, 0.0d), // Prim taper - new LSL_Types.Vector3(0.0d, 0.0d, 0.0d)); // Prim shear + new LSL_Types.Vector3(0.0d, 0.0d, 0.0d), // Prim shear + 0.90d); // Prim hollow check // Test a box. CheckllSetPrimitiveParams( @@ -212,10 +219,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests ScriptBaseClass.PRIM_TYPE_BOX, // Prim type ScriptBaseClass.PRIM_HOLE_TRIANGLE, // Prim hole type new LSL_Types.Vector3(0.0d, 1.0d, 0.0d), // Prim cut - 0.90d, // Prim hollow + 0.95d, // Prim hollow new LSL_Types.Vector3(1.0d, 0.0d, 0.0d), // Prim twist new LSL_Types.Vector3(1.0d, 1.0d, 0.0d), // Prim taper - new LSL_Types.Vector3(0.0d, 0.0d, 0.0d)); // Prim shear + new LSL_Types.Vector3(0.0d, 0.0d, 0.0d), // Prim shear + 0.95d); // Prim hollow check // Test a tube. CheckllSetPrimitiveParams( @@ -232,13 +240,36 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests new LSL_Types.Vector3(-1.0d, 1.0d, 0.0d), // Prim taper 1.0d, // Prim revolutions 1.0d, // Prim radius - 0.0d); // Prim skew + 0.0d, // Prim skew + 0.00d); // Prim hollow check + + // Test a prism. + CheckllSetPrimitiveParams( + "test 5", // Prim test identification string + new LSL_Types.Vector3(3.5d, 3.5d, 3.5d), // Prim size + ScriptBaseClass.PRIM_TYPE_PRISM, // Prim type + ScriptBaseClass.PRIM_HOLE_SQUARE, // Prim hole type + new LSL_Types.Vector3(0.0d, 1.0d, 0.0d), // Prim cut + 0.95d, // Prim hollow + new LSL_Types.Vector3(0.0d, 0.0d, 0.0d), // Prim twist + new LSL_Types.Vector3(2.0d, 1.0d, 0.0d), // Prim taper + new LSL_Types.Vector3(0.0d, 0.0d, 0.0d), // Prim shear + 0.70d); // Prim hollow check + + // Test a sculpted prim. + CheckllSetPrimitiveParams( + "test 6", // Prim test identification string + new LSL_Types.Vector3(2.0d, 2.0d, 2.0d), // Prim size + ScriptBaseClass.PRIM_TYPE_SCULPT, // Prim type + "be293869-d0d9-0a69-5989-ad27f1946fd4", // Prim map + ScriptBaseClass.PRIM_SCULPT_TYPE_SPHERE); // Prim sculpt type } // Set prim params for a box, cylinder or prism and check results. public void CheckllSetPrimitiveParams(string primTest, LSL_Types.Vector3 primSize, int primType, int primHoleType, LSL_Types.Vector3 primCut, - double primHollow, LSL_Types.Vector3 primTwist, LSL_Types.Vector3 primTaper, LSL_Types.Vector3 primShear) + double primHollow, LSL_Types.Vector3 primTwist, LSL_Types.Vector3 primTaper, LSL_Types.Vector3 primShear, + double primHollowCheck) { // Set the prim params. m_lslApi.llSetPrimitiveParams(new LSL_Types.list(ScriptBaseClass.PRIM_SIZE, primSize, @@ -256,7 +287,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests Assert.AreEqual(primHoleType, m_lslApi.llList2Integer(primParams, 2), "TestllSetPrimitiveParams " + primTest + " prim hole default check fail"); CheckllSetPrimitiveParamsVector(primCut, m_lslApi.llList2Vector(primParams, 3), primTest + " prim cut"); - Assert.AreEqual(primHollow, m_lslApi.llList2Float(primParams, 4), FLOAT_ACCURACY, + Assert.AreEqual(primHollowCheck, m_lslApi.llList2Float(primParams, 4), FLOAT_ACCURACY, "TestllSetPrimitiveParams " + primTest + " prim hollow check fail"); CheckllSetPrimitiveParamsVector(primTwist, m_lslApi.llList2Vector(primParams, 5), primTest + " prim twist"); CheckllSetPrimitiveParamsVector(primTaper, m_lslApi.llList2Vector(primParams, 6), primTest + " prim taper"); @@ -266,7 +297,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests // Set prim params for a sphere and check results. public void CheckllSetPrimitiveParams(string primTest, LSL_Types.Vector3 primSize, int primType, int primHoleType, LSL_Types.Vector3 primCut, - double primHollow, LSL_Types.Vector3 primTwist, LSL_Types.Vector3 primDimple) + double primHollow, LSL_Types.Vector3 primTwist, LSL_Types.Vector3 primDimple, double primHollowCheck) { // Set the prim params. m_lslApi.llSetPrimitiveParams(new LSL_Types.list(ScriptBaseClass.PRIM_SIZE, primSize, @@ -284,7 +315,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests Assert.AreEqual(primHoleType, m_lslApi.llList2Integer(primParams, 2), "TestllSetPrimitiveParams " + primTest + " prim hole default check fail"); CheckllSetPrimitiveParamsVector(primCut, m_lslApi.llList2Vector(primParams, 3), primTest + " prim cut"); - Assert.AreEqual(primHollow, m_lslApi.llList2Float(primParams, 4), FLOAT_ACCURACY, + Assert.AreEqual(primHollowCheck, m_lslApi.llList2Float(primParams, 4), FLOAT_ACCURACY, "TestllSetPrimitiveParams " + primTest + " prim hollow check fail"); CheckllSetPrimitiveParamsVector(primTwist, m_lslApi.llList2Vector(primParams, 5), primTest + " prim twist"); CheckllSetPrimitiveParamsVector(primDimple, m_lslApi.llList2Vector(primParams, 6), primTest + " prim dimple"); @@ -295,7 +326,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests LSL_Types.Vector3 primSize, int primType, int primHoleType, LSL_Types.Vector3 primCut, double primHollow, LSL_Types.Vector3 primTwist, LSL_Types.Vector3 primHoleSize, LSL_Types.Vector3 primShear, LSL_Types.Vector3 primProfCut, LSL_Types.Vector3 primTaper, - double primRev, double primRadius, double primSkew) + double primRev, double primRadius, double primSkew, double primHollowCheck) { // Set the prim params. m_lslApi.llSetPrimitiveParams(new LSL_Types.list(ScriptBaseClass.PRIM_SIZE, primSize, @@ -314,7 +345,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests Assert.AreEqual(primHoleType, m_lslApi.llList2Integer(primParams, 2), "TestllSetPrimitiveParams " + primTest + " prim hole default check fail"); CheckllSetPrimitiveParamsVector(primCut, m_lslApi.llList2Vector(primParams, 3), primTest + " prim cut"); - Assert.AreEqual(primHollow, m_lslApi.llList2Float(primParams, 4), FLOAT_ACCURACY, + Assert.AreEqual(primHollowCheck, m_lslApi.llList2Float(primParams, 4), FLOAT_ACCURACY, "TestllSetPrimitiveParams " + primTest + " prim hollow check fail"); CheckllSetPrimitiveParamsVector(primTwist, m_lslApi.llList2Vector(primParams, 5), primTest + " prim twist"); CheckllSetPrimitiveParamsVector(primHoleSize, m_lslApi.llList2Vector(primParams, 6), primTest + " prim hole size"); @@ -329,6 +360,28 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests "TestllSetPrimitiveParams " + primTest + " prim skew fail"); } + // Set prim params for a sculpted prim and check results. + public void CheckllSetPrimitiveParams(string primTest, + LSL_Types.Vector3 primSize, int primType, string primMap, int primSculptType) + { + // Set the prim params. + m_lslApi.llSetPrimitiveParams(new LSL_Types.list(ScriptBaseClass.PRIM_SIZE, primSize, + ScriptBaseClass.PRIM_TYPE, primType, primMap, primSculptType)); + + // Get params for prim to validate settings. + LSL_Types.list primParams = + m_lslApi.llGetPrimitiveParams(new LSL_Types.list(ScriptBaseClass.PRIM_SIZE, ScriptBaseClass.PRIM_TYPE)); + + // Validate settings. + CheckllSetPrimitiveParamsVector(primSize, m_lslApi.llList2Vector(primParams, 0), primTest + " prim size"); + Assert.AreEqual(primType, m_lslApi.llList2Integer(primParams, 1), + "TestllSetPrimitiveParams " + primTest + " prim type check fail"); + Assert.AreEqual(primMap, (string)m_lslApi.llList2String(primParams, 2), + "TestllSetPrimitiveParams " + primTest + " prim map check fail"); + Assert.AreEqual(primSculptType, m_lslApi.llList2Integer(primParams, 3), + "TestllSetPrimitiveParams " + primTest + " prim type scuplt check fail"); + } + public void CheckllSetPrimitiveParamsVector(LSL_Types.Vector3 vecCheck, LSL_Types.Vector3 vecReturned, string msg) { // Check each vector component against expected result. -- cgit v1.1 From 15a514fcbc8f7447fc3a5997b6bbc2fe35974c9a Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 26 Aug 2011 23:06:41 +0100 Subject: refactor: simplify SOP.AttachedAvatar into SOG.AttachedAvatar This does a tiny bit to reduce code complexity, memory requirement and the cpu time of pointlessly setting this field to the same value in every SOP --- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 8 ++++---- .../Shared/Api/Implementation/Plugins/SensorRepeat.cs | 4 ++-- OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index a690e3b..81f1f38 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -2099,7 +2099,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { if (part.ParentGroup.RootPart.AttachmentPoint != 0) { - ScenePresence avatar = World.GetScenePresence(part.AttachedAvatar); + ScenePresence avatar = World.GetScenePresence(part.ParentGroup.AttachedAvatar); if (avatar != null) { if ((avatar.AgentControlFlags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_MOUSELOOK) != 0) @@ -2243,7 +2243,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (m_host.IsAttachment) { - ScenePresence avatar = m_host.ParentGroup.Scene.GetScenePresence(m_host.AttachedAvatar); + ScenePresence avatar = m_host.ParentGroup.Scene.GetScenePresence(m_host.ParentGroup.AttachedAvatar); vel = avatar.Velocity; } else @@ -3388,7 +3388,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api m_host.AddScriptLPS(1); - if (m_host.ParentGroup.IsAttachment && (UUID)agent == m_host.ParentGroup.RootPart.AttachedAvatar) + if (m_host.ParentGroup.IsAttachment && (UUID)agent == m_host.ParentGroup.AttachedAvatar) { // When attached, certain permissions are implicit if requested from owner int implicitPerms = ScriptBaseClass.PERMISSION_TAKE_CONTROLS | @@ -7460,7 +7460,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api Quaternion q; if (m_host.ParentGroup.RootPart.AttachmentPoint != 0) { - ScenePresence avatar = World.GetScenePresence(m_host.AttachedAvatar); + ScenePresence avatar = World.GetScenePresence(m_host.ParentGroup.AttachedAvatar); if (avatar != null) if ((avatar.AgentControlFlags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_MOUSELOOK) != 0) q = avatar.CameraRotation; // Mouselook diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs index e53a61a..bf74760 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs @@ -308,7 +308,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins // In attachments, the sensor cone always orients with the // avatar rotation. This may include a nonzero elevation if // in mouselook. - ScenePresence avatar = m_CmdManager.m_ScriptEngine.World.GetScenePresence(SensePoint.ParentGroup.RootPart.AttachedAvatar); + ScenePresence avatar = m_CmdManager.m_ScriptEngine.World.GetScenePresence(SensePoint.ParentGroup.AttachedAvatar); q = avatar.Rotation; } LSL_Types.Quaternion r = new LSL_Types.Quaternion(q.X, q.Y, q.Z, q.W); @@ -428,7 +428,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins // In attachments, the sensor cone always orients with the // avatar rotation. This may include a nonzero elevation if // in mouselook. - ScenePresence avatar = m_CmdManager.m_ScriptEngine.World.GetScenePresence(SensePoint.ParentGroup.RootPart.AttachedAvatar); + ScenePresence avatar = m_CmdManager.m_ScriptEngine.World.GetScenePresence(SensePoint.ParentGroup.AttachedAvatar); q = avatar.Rotation; } diff --git a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs index 783791f..ef9b2ac 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs @@ -233,7 +233,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance m_MaxScriptQueue = maxScriptQueue; m_stateSource = stateSource; m_postOnRez = postOnRez; - m_AttachedAvatar = part.AttachedAvatar; + m_AttachedAvatar = part.ParentGroup.AttachedAvatar; m_RegionID = part.ParentGroup.Scene.RegionInfo.RegionID; if (part != null) -- cgit v1.1