diff options
author | Charles Krinke | 2007-12-17 02:30:03 +0000 |
---|---|---|
committer | Charles Krinke | 2007-12-17 02:30:03 +0000 |
commit | 8e8c26acac73cc50d43976fe58ba8fcdaa4afe33 (patch) | |
tree | c7b4edece68b2c1549e665f7e27936279afb531f | |
parent | The "Got a packet from an invalid client" has served its purpose (diff) | |
download | opensim-SC-8e8c26acac73cc50d43976fe58ba8fcdaa4afe33.zip opensim-SC-8e8c26acac73cc50d43976fe58ba8fcdaa4afe33.tar.gz opensim-SC-8e8c26acac73cc50d43976fe58ba8fcdaa4afe33.tar.bz2 opensim-SC-8e8c26acac73cc50d43976fe58ba8fcdaa4afe33.tar.xz |
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)
5 files changed, 71 insertions, 20 deletions
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 | |||
67 | /// </summary> | 67 | /// </summary> |
68 | public int PrimCount | 68 | public int PrimCount |
69 | { | 69 | { |
70 | get { return 1; } | 70 | get { return m_parts.Count; } |
71 | } | 71 | } |
72 | 72 | ||
73 | public LLQuaternion GroupRotation | 73 | public LLQuaternion GroupRotation |
@@ -240,8 +240,9 @@ namespace OpenSim.Region.Environment.Scenes | |||
240 | m_scene = scene; | 240 | m_scene = scene; |
241 | part.SetParent(this); | 241 | part.SetParent(this); |
242 | part.ParentID = 0; | 242 | part.ParentID = 0; |
243 | 243 | part.LinkNum = 0; | |
244 | m_parts.Add(part.UUID, part); | 244 | m_parts.Add(part.UUID, part); |
245 | |||
245 | SetPartAsRoot(part); | 246 | SetPartAsRoot(part); |
246 | 247 | ||
247 | RegionHandle = regionHandle; | 248 | RegionHandle = regionHandle; |
@@ -267,7 +268,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
267 | reader.ReadStartElement("SceneObjectGroup"); | 268 | reader.ReadStartElement("SceneObjectGroup"); |
268 | reader.ReadStartElement("RootPart"); | 269 | reader.ReadStartElement("RootPart"); |
269 | m_rootPart = SceneObjectPart.FromXml(reader); | 270 | m_rootPart = SceneObjectPart.FromXml(reader); |
270 | 271 | AddPart(m_rootPart); | |
271 | reader.ReadEndElement(); | 272 | reader.ReadEndElement(); |
272 | 273 | ||
273 | while (reader.Read()) | 274 | while (reader.Read()) |
@@ -293,7 +294,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
293 | reader.Close(); | 294 | reader.Close(); |
294 | sr.Close(); | 295 | sr.Close(); |
295 | 296 | ||
296 | AddPart(m_rootPart); | 297 | |
297 | 298 | ||
298 | m_rootPart.LocalID = m_scene.PrimIDAllocate(); | 299 | m_rootPart.LocalID = m_scene.PrimIDAllocate(); |
299 | m_rootPart.ParentID = 0; | 300 | m_rootPart.ParentID = 0; |
@@ -318,6 +319,10 @@ namespace OpenSim.Region.Environment.Scenes | |||
318 | 319 | ||
319 | reader.ReadStartElement("SceneObjectGroup"); | 320 | reader.ReadStartElement("SceneObjectGroup"); |
320 | m_rootPart = SceneObjectPart.FromXml(reader); | 321 | m_rootPart = SceneObjectPart.FromXml(reader); |
322 | m_rootPart.SetParent(this); | ||
323 | m_parts.Add(m_rootPart.UUID, m_rootPart); | ||
324 | m_rootPart.ParentID = 0; | ||
325 | m_rootPart.LinkNum = 0; | ||
321 | 326 | ||
322 | reader.Read(); | 327 | reader.Read(); |
323 | bool more = true; | 328 | bool more = true; |
@@ -346,9 +351,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
346 | } | 351 | } |
347 | reader.Close(); | 352 | reader.Close(); |
348 | sr.Close(); | 353 | sr.Close(); |
349 | m_rootPart.SetParent(this); | 354 | |
350 | m_parts.Add(m_rootPart.UUID, m_rootPart); | ||
351 | m_rootPart.ParentID = 0; | ||
352 | UpdateParentIDs(); | 355 | UpdateParentIDs(); |
353 | 356 | ||
354 | ScheduleGroupForFullUpdate(); | 357 | ScheduleGroupForFullUpdate(); |
@@ -431,6 +434,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
431 | LLVector3 rootOffset = new LLVector3(0, 0, 0); | 434 | LLVector3 rootOffset = new LLVector3(0, 0, 0); |
432 | SceneObjectPart newPart = | 435 | SceneObjectPart newPart = |
433 | new SceneObjectPart(m_regionHandle, this, ownerID, localID, shape, pos, rot, rootOffset); | 436 | new SceneObjectPart(m_regionHandle, this, ownerID, localID, shape, pos, rot, rootOffset); |
437 | newPart.LinkNum = m_parts.Count; | ||
434 | m_parts.Add(newPart.UUID, newPart); | 438 | m_parts.Add(newPart.UUID, newPart); |
435 | SetPartAsRoot(newPart); | 439 | SetPartAsRoot(newPart); |
436 | 440 | ||
@@ -586,6 +590,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
586 | { | 590 | { |
587 | SceneObjectPart newPart = part.Copy(m_scene.PrimIDAllocate(), OwnerID, GroupID); | 591 | SceneObjectPart newPart = part.Copy(m_scene.PrimIDAllocate(), OwnerID, GroupID); |
588 | newPart.SetParent(this); | 592 | newPart.SetParent(this); |
593 | newPart.LinkNum = m_parts.Count; | ||
589 | m_parts.Add(newPart.UUID, newPart); | 594 | m_parts.Add(newPart.UUID, newPart); |
590 | SetPartAsRoot(newPart); | 595 | SetPartAsRoot(newPart); |
591 | } | 596 | } |
@@ -615,6 +620,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
615 | { | 620 | { |
616 | SceneObjectPart newPart = part.Copy(m_scene.PrimIDAllocate(), OwnerID, GroupID); | 621 | SceneObjectPart newPart = part.Copy(m_scene.PrimIDAllocate(), OwnerID, GroupID); |
617 | newPart.SetParent(this); | 622 | newPart.SetParent(this); |
623 | newPart.LinkNum = m_parts.Count; | ||
618 | m_parts.Add(newPart.UUID, newPart); | 624 | m_parts.Add(newPart.UUID, newPart); |
619 | SetPartAsNonRoot(newPart); | 625 | SetPartAsNonRoot(newPart); |
620 | } | 626 | } |
@@ -627,6 +633,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
627 | foreach (SceneObjectPart part in partsList) | 633 | foreach (SceneObjectPart part in partsList) |
628 | { | 634 | { |
629 | part.UUID = LLUUID.Random(); | 635 | part.UUID = LLUUID.Random(); |
636 | part.LinkNum = m_parts.Count; | ||
630 | m_parts.Add(part.UUID, part); | 637 | m_parts.Add(part.UUID, part); |
631 | } | 638 | } |
632 | } | 639 | } |
@@ -770,6 +777,23 @@ namespace OpenSim.Region.Environment.Scenes | |||
770 | #region SceneGroupPart Methods | 777 | #region SceneGroupPart Methods |
771 | 778 | ||
772 | /// <summary> | 779 | /// <summary> |
780 | /// Get the child part by LinkNum | ||
781 | /// </summary> | ||
782 | /// <param name="linknum"></param> | ||
783 | /// <returns>null if no child part with that linknum or child part</returns> | ||
784 | public SceneObjectPart GetLinkNumPart(int linknum) | ||
785 | { | ||
786 | foreach (SceneObjectPart part in m_parts.Values) | ||
787 | { | ||
788 | if (part.LinkNum == linknum) | ||
789 | { | ||
790 | return part; | ||
791 | } | ||
792 | } | ||
793 | return null; | ||
794 | } | ||
795 | |||
796 | /// <summary> | ||
773 | /// Get a child part with a given UUID | 797 | /// Get a child part with a given UUID |
774 | /// </summary> | 798 | /// </summary> |
775 | /// <param name="primID"></param> | 799 | /// <param name="primID"></param> |
@@ -868,6 +892,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
868 | Quaternion newRot = parentRot.Inverse() * oldRot; | 892 | Quaternion newRot = parentRot.Inverse() * oldRot; |
869 | linkPart.RotationOffset = new LLQuaternion(newRot.x, newRot.y, newRot.z, newRot.w); | 893 | linkPart.RotationOffset = new LLQuaternion(newRot.x, newRot.y, newRot.z, newRot.w); |
870 | linkPart.ParentID = m_rootPart.LocalID; | 894 | linkPart.ParentID = m_rootPart.LocalID; |
895 | linkPart.LinkNum = m_parts.Count; | ||
871 | m_parts.Add(linkPart.UUID, linkPart); | 896 | m_parts.Add(linkPart.UUID, linkPart); |
872 | linkPart.SetParent(this); | 897 | linkPart.SetParent(this); |
873 | 898 | ||
@@ -979,6 +1004,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
979 | { | 1004 | { |
980 | part.SetParent(this); | 1005 | part.SetParent(this); |
981 | part.ParentID = m_rootPart.LocalID; | 1006 | part.ParentID = m_rootPart.LocalID; |
1007 | part.LinkNum = m_parts.Count; | ||
982 | m_parts.Add(part.UUID, part); | 1008 | m_parts.Add(part.UUID, part); |
983 | 1009 | ||
984 | Vector3 axiomOldPos = new Vector3(part.OffsetPosition.X, part.OffsetPosition.Y, part.OffsetPosition.Z); | 1010 | Vector3 axiomOldPos = new Vector3(part.OffsetPosition.X, part.OffsetPosition.Y, part.OffsetPosition.Z); |
@@ -1612,6 +1638,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1612 | public void AddPart(SceneObjectPart part) | 1638 | public void AddPart(SceneObjectPart part) |
1613 | { | 1639 | { |
1614 | part.SetParent(this); | 1640 | part.SetParent(this); |
1641 | part.LinkNum = m_parts.Count; | ||
1615 | m_parts.Add(part.UUID, part); | 1642 | m_parts.Add(part.UUID, part); |
1616 | } | 1643 | } |
1617 | 1644 | ||
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 | |||
364 | set { m_touchName = value; } | 364 | set { m_touchName = value; } |
365 | } | 365 | } |
366 | 366 | ||
367 | private int m_linkNum = 0; | ||
368 | public int LinkNum | ||
369 | { | ||
370 | get { return m_linkNum; } | ||
371 | set { m_linkNum = value; } | ||
372 | } | ||
373 | |||
367 | private byte m_clickAction = 0; | 374 | private byte m_clickAction = 0; |
368 | public byte ClickAction | 375 | public byte ClickAction |
369 | { | 376 | { |
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 | |||
268 | //wiki: key llGetLinkKey(integer linknum) | 268 | //wiki: key llGetLinkKey(integer linknum) |
269 | string llGetLinkKey(int linknum); | 269 | string llGetLinkKey(int linknum); |
270 | //wiki: llGetLinkName(integer linknum) | 270 | //wiki: llGetLinkName(integer linknum) |
271 | void llGetLinkName(int linknum); | 271 | string llGetLinkName(int linknum); |
272 | //wiki: integer llGetInventoryNumber(integer type) | 272 | //wiki: integer llGetInventoryNumber(integer type) |
273 | int llGetInventoryNumber(int type); | 273 | int llGetInventoryNumber(int type); |
274 | //wiki: string llGetInventoryName(integer type, integer number) | 274 | //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 | |||
860 | return m_LSL_Functions.llGetLinkKey(linknum); | 860 | return m_LSL_Functions.llGetLinkKey(linknum); |
861 | } | 861 | } |
862 | 862 | ||
863 | public void llGetLinkName(int linknum) | 863 | public string llGetLinkName(int linknum) |
864 | { | 864 | { |
865 | m_LSL_Functions.llGetLinkName(linknum); | 865 | return m_LSL_Functions.llGetLinkName(linknum); |
866 | } | 866 | } |
867 | 867 | ||
868 | public int llGetInventoryNumber(int type) | 868 | public int llGetInventoryNumber(int type) |
@@ -2122,4 +2122,4 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL | |||
2122 | public vector ZERO_VECTOR = new vector(0, 0, 0); | 2122 | public vector ZERO_VECTOR = new vector(0, 0, 0); |
2123 | public rotation ZERO_ROTATION = new rotation(0, 0, 0, 0); | 2123 | public rotation ZERO_ROTATION = new rotation(0, 0, 0, 0); |
2124 | } | 2124 | } |
2125 | } \ No newline at end of file | 2125 | } |
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 | |||
1128 | 1128 | ||
1129 | public void llTargetOmega(LSL_Types.Vector3 axis, double spinrate, double gain) | 1129 | public void llTargetOmega(LSL_Types.Vector3 axis, double spinrate, double gain) |
1130 | { | 1130 | { |
1131 | NotImplemented("llTargetOmega"); | 1131 | m_host.RotationalVelocity = new LLVector3((float)(axis.x * spinrate), (float)(axis.y * spinrate), (float)(axis.z * spinrate)); |
1132 | m_host.AngularVelocity = new LLVector3((float)(axis.x * spinrate), (float)(axis.y * spinrate), (float)(axis.z * spinrate)); | ||
1133 | m_host.ScheduleTerseUpdate(); | ||
1134 | m_host.SendTerseUpdateToAllClients(); | ||
1135 | //NotImplemented("llTargetOmega"); | ||
1132 | } | 1136 | } |
1133 | 1137 | ||
1134 | public int llGetStartParameter() | 1138 | public int llGetStartParameter() |
@@ -1161,8 +1165,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler | |||
1161 | 1165 | ||
1162 | public int llGetLinkNumber() | 1166 | public int llGetLinkNumber() |
1163 | { | 1167 | { |
1164 | NotImplemented("llGetLinkNumber"); | 1168 | return m_host.LinkNum; |
1165 | return 0; | ||
1166 | } | 1169 | } |
1167 | 1170 | ||
1168 | public void llSetLinkColor(int linknumber, LSL_Types.Vector3 color, int face) | 1171 | public void llSetLinkColor(int linknumber, LSL_Types.Vector3 color, int face) |
@@ -1187,13 +1190,28 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler | |||
1187 | 1190 | ||
1188 | public string llGetLinkKey(int linknum) | 1191 | public string llGetLinkKey(int linknum) |
1189 | { | 1192 | { |
1190 | NotImplemented("llGetLinkKey"); | 1193 | SceneObjectPart part = m_host.ParentGroup.GetLinkNumPart(linknum); |
1191 | return ""; | 1194 | if (part != null) |
1195 | { | ||
1196 | return part.UUID.ToStringHyphenated(); | ||
1197 | } | ||
1198 | else | ||
1199 | { | ||
1200 | return "00000000-0000-0000-0000-000000000000"; | ||
1201 | } | ||
1192 | } | 1202 | } |
1193 | 1203 | ||
1194 | public void llGetLinkName(int linknum) | 1204 | public string llGetLinkName(int linknum) |
1195 | { | 1205 | { |
1196 | NotImplemented("llGetLinkName"); | 1206 | SceneObjectPart part = m_host.ParentGroup.GetLinkNumPart(linknum); |
1207 | if (part != null) | ||
1208 | { | ||
1209 | return part.Name; | ||
1210 | } | ||
1211 | else | ||
1212 | { | ||
1213 | return "00000000-0000-0000-0000-000000000000"; | ||
1214 | } | ||
1197 | } | 1215 | } |
1198 | 1216 | ||
1199 | public int llGetInventoryNumber(int type) | 1217 | public int llGetInventoryNumber(int type) |
@@ -2194,8 +2212,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler | |||
2194 | 2212 | ||
2195 | public int llGetNumberOfPrims() | 2213 | public int llGetNumberOfPrims() |
2196 | { | 2214 | { |
2197 | NotImplemented("llGetNumberOfPrims"); | 2215 | return m_host.ParentGroup.PrimCount; |
2198 | return 0; | ||
2199 | } | 2216 | } |
2200 | 2217 | ||
2201 | public string llGetNumberOfNotecardLines(string name) | 2218 | public string llGetNumberOfNotecardLines(string name) |