From 8e8c26acac73cc50d43976fe58ba8fcdaa4afe33 Mon Sep 17 00:00:00 2001 From: Charles Krinke Date: Mon, 17 Dec 2007 02:30:03 +0000 Subject: Again, thanks to Alondria for: Added: LinkNum to SceneObjectPart Added: Bunch-o settings of LinkNum in SceneObjectGroup Added: llGetNumberOfPrims() Added: llGetLinkNumber() Added: llGetLinkKey() Added: llGetLinkName() (and change to string return type) --- .../Region/Environment/Scenes/SceneObjectGroup.cs | 41 ++++++++++++++++++---- .../Region/Environment/Scenes/SceneObjectPart.cs | 7 ++++ .../Common/LSL_BuiltIn_Commands_Interface.cs | 2 +- .../DotNetEngine/Compiler/LSL/LSL_BaseClass.cs | 6 ++-- .../Compiler/Server_API/LSL_BuiltIn_Commands.cs | 35 +++++++++++++----- 5 files changed, 71 insertions(+), 20 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs index e44705c..263ac27 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs @@ -67,7 +67,7 @@ namespace OpenSim.Region.Environment.Scenes /// public int PrimCount { - get { return 1; } + get { return m_parts.Count; } } public LLQuaternion GroupRotation @@ -240,8 +240,9 @@ namespace OpenSim.Region.Environment.Scenes m_scene = scene; part.SetParent(this); part.ParentID = 0; - + part.LinkNum = 0; m_parts.Add(part.UUID, part); + SetPartAsRoot(part); RegionHandle = regionHandle; @@ -267,7 +268,7 @@ namespace OpenSim.Region.Environment.Scenes reader.ReadStartElement("SceneObjectGroup"); reader.ReadStartElement("RootPart"); m_rootPart = SceneObjectPart.FromXml(reader); - + AddPart(m_rootPart); reader.ReadEndElement(); while (reader.Read()) @@ -293,7 +294,7 @@ namespace OpenSim.Region.Environment.Scenes reader.Close(); sr.Close(); - AddPart(m_rootPart); + m_rootPart.LocalID = m_scene.PrimIDAllocate(); m_rootPart.ParentID = 0; @@ -318,6 +319,10 @@ namespace OpenSim.Region.Environment.Scenes reader.ReadStartElement("SceneObjectGroup"); m_rootPart = SceneObjectPart.FromXml(reader); + m_rootPart.SetParent(this); + m_parts.Add(m_rootPart.UUID, m_rootPart); + m_rootPart.ParentID = 0; + m_rootPart.LinkNum = 0; reader.Read(); bool more = true; @@ -346,9 +351,7 @@ namespace OpenSim.Region.Environment.Scenes } reader.Close(); sr.Close(); - m_rootPart.SetParent(this); - m_parts.Add(m_rootPart.UUID, m_rootPart); - m_rootPart.ParentID = 0; + UpdateParentIDs(); ScheduleGroupForFullUpdate(); @@ -431,6 +434,7 @@ namespace OpenSim.Region.Environment.Scenes LLVector3 rootOffset = new LLVector3(0, 0, 0); SceneObjectPart newPart = new SceneObjectPart(m_regionHandle, this, ownerID, localID, shape, pos, rot, rootOffset); + newPart.LinkNum = m_parts.Count; m_parts.Add(newPart.UUID, newPart); SetPartAsRoot(newPart); @@ -586,6 +590,7 @@ namespace OpenSim.Region.Environment.Scenes { SceneObjectPart newPart = part.Copy(m_scene.PrimIDAllocate(), OwnerID, GroupID); newPart.SetParent(this); + newPart.LinkNum = m_parts.Count; m_parts.Add(newPart.UUID, newPart); SetPartAsRoot(newPart); } @@ -615,6 +620,7 @@ namespace OpenSim.Region.Environment.Scenes { SceneObjectPart newPart = part.Copy(m_scene.PrimIDAllocate(), OwnerID, GroupID); newPart.SetParent(this); + newPart.LinkNum = m_parts.Count; m_parts.Add(newPart.UUID, newPart); SetPartAsNonRoot(newPart); } @@ -627,6 +633,7 @@ namespace OpenSim.Region.Environment.Scenes foreach (SceneObjectPart part in partsList) { part.UUID = LLUUID.Random(); + part.LinkNum = m_parts.Count; m_parts.Add(part.UUID, part); } } @@ -770,6 +777,23 @@ namespace OpenSim.Region.Environment.Scenes #region SceneGroupPart Methods /// + /// Get the child part by LinkNum + /// + /// + /// null if no child part with that linknum or child part + public SceneObjectPart GetLinkNumPart(int linknum) + { + foreach (SceneObjectPart part in m_parts.Values) + { + if (part.LinkNum == linknum) + { + return part; + } + } + return null; + } + + /// /// Get a child part with a given UUID /// /// @@ -868,6 +892,7 @@ namespace OpenSim.Region.Environment.Scenes Quaternion newRot = parentRot.Inverse() * oldRot; linkPart.RotationOffset = new LLQuaternion(newRot.x, newRot.y, newRot.z, newRot.w); linkPart.ParentID = m_rootPart.LocalID; + linkPart.LinkNum = m_parts.Count; m_parts.Add(linkPart.UUID, linkPart); linkPart.SetParent(this); @@ -979,6 +1004,7 @@ namespace OpenSim.Region.Environment.Scenes { part.SetParent(this); part.ParentID = m_rootPart.LocalID; + part.LinkNum = m_parts.Count; m_parts.Add(part.UUID, part); Vector3 axiomOldPos = new Vector3(part.OffsetPosition.X, part.OffsetPosition.Y, part.OffsetPosition.Z); @@ -1612,6 +1638,7 @@ namespace OpenSim.Region.Environment.Scenes public void AddPart(SceneObjectPart part) { part.SetParent(this); + part.LinkNum = m_parts.Count; m_parts.Add(part.UUID, part); } diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs index f6c0ee3..5e5b8b5 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs @@ -364,6 +364,13 @@ namespace OpenSim.Region.Environment.Scenes set { m_touchName = value; } } + private int m_linkNum = 0; + public int LinkNum + { + get { return m_linkNum; } + set { m_linkNum = value; } + } + private byte m_clickAction = 0; public byte ClickAction { diff --git a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands_Interface.cs b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands_Interface.cs index 10e71b3..60e2a0e 100644 --- a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands_Interface.cs +++ b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands_Interface.cs @@ -268,7 +268,7 @@ namespace OpenSim.Region.ScriptEngine.Common //wiki: key llGetLinkKey(integer linknum) string llGetLinkKey(int linknum); //wiki: llGetLinkName(integer linknum) - void llGetLinkName(int linknum); + string llGetLinkName(int linknum); //wiki: integer llGetInventoryNumber(integer type) int llGetInventoryNumber(int type); //wiki: string llGetInventoryName(integer type, integer number) diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL_BaseClass.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL_BaseClass.cs index 99f8d3b..d669c15 100644 --- a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL_BaseClass.cs +++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL_BaseClass.cs @@ -860,9 +860,9 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL return m_LSL_Functions.llGetLinkKey(linknum); } - public void llGetLinkName(int linknum) + public string llGetLinkName(int linknum) { - m_LSL_Functions.llGetLinkName(linknum); + return m_LSL_Functions.llGetLinkName(linknum); } public int llGetInventoryNumber(int type) @@ -2122,4 +2122,4 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL public vector ZERO_VECTOR = new vector(0, 0, 0); public rotation ZERO_ROTATION = new rotation(0, 0, 0, 0); } -} \ No newline at end of file +} diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/Server_API/LSL_BuiltIn_Commands.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/Server_API/LSL_BuiltIn_Commands.cs index 00e79c0..61c4b10 100644 --- a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/Server_API/LSL_BuiltIn_Commands.cs +++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/Server_API/LSL_BuiltIn_Commands.cs @@ -1128,7 +1128,11 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler public void llTargetOmega(LSL_Types.Vector3 axis, double spinrate, double gain) { - NotImplemented("llTargetOmega"); + m_host.RotationalVelocity = new LLVector3((float)(axis.x * spinrate), (float)(axis.y * spinrate), (float)(axis.z * spinrate)); + m_host.AngularVelocity = new LLVector3((float)(axis.x * spinrate), (float)(axis.y * spinrate), (float)(axis.z * spinrate)); + m_host.ScheduleTerseUpdate(); + m_host.SendTerseUpdateToAllClients(); + //NotImplemented("llTargetOmega"); } public int llGetStartParameter() @@ -1161,8 +1165,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler public int llGetLinkNumber() { - NotImplemented("llGetLinkNumber"); - return 0; + return m_host.LinkNum; } public void llSetLinkColor(int linknumber, LSL_Types.Vector3 color, int face) @@ -1187,13 +1190,28 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler public string llGetLinkKey(int linknum) { - NotImplemented("llGetLinkKey"); - return ""; + SceneObjectPart part = m_host.ParentGroup.GetLinkNumPart(linknum); + if (part != null) + { + return part.UUID.ToStringHyphenated(); + } + else + { + return "00000000-0000-0000-0000-000000000000"; + } } - public void llGetLinkName(int linknum) + public string llGetLinkName(int linknum) { - NotImplemented("llGetLinkName"); + SceneObjectPart part = m_host.ParentGroup.GetLinkNumPart(linknum); + if (part != null) + { + return part.Name; + } + else + { + return "00000000-0000-0000-0000-000000000000"; + } } public int llGetInventoryNumber(int type) @@ -2194,8 +2212,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler public int llGetNumberOfPrims() { - NotImplemented("llGetNumberOfPrims"); - return 0; + return m_host.ParentGroup.PrimCount; } public string llGetNumberOfNotecardLines(string name) -- cgit v1.1