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(-) 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