mirror of
https://github.com/opensim/opensim.git
synced 2026-08-13 05:05:43 +08:00
add llObjectGetLinkKey(...)
This commit is contained in:
@@ -655,14 +655,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
|||||||
}
|
}
|
||||||
|
|
||||||
public List<ScenePresence> GetLinkAvatars(int linkType)
|
public List<ScenePresence> GetLinkAvatars(int linkType)
|
||||||
|
{
|
||||||
|
if (m_host == null)
|
||||||
|
return new List<ScenePresence>();
|
||||||
|
|
||||||
|
return GetLinkAvatars(linkType, m_host.ParentGroup);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<ScenePresence> GetLinkAvatars(int linkType, SceneObjectGroup sog)
|
||||||
{
|
{
|
||||||
List<ScenePresence> ret = new List<ScenePresence>();
|
List<ScenePresence> ret = new List<ScenePresence>();
|
||||||
if (m_host == null || m_host.ParentGroup == null || m_host.ParentGroup.IsDeleted)
|
if (sog == null || sog.IsDeleted)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
// List<ScenePresence> avs = m_host.ParentGroup.GetLinkedAvatars();
|
List<ScenePresence> avs = sog.GetSittingAvatars();
|
||||||
// this needs check
|
|
||||||
List<ScenePresence> avs = m_host.ParentGroup.GetSittingAvatars();
|
|
||||||
switch (linkType)
|
switch (linkType)
|
||||||
{
|
{
|
||||||
case ScriptBaseClass.LINK_SET:
|
case ScriptBaseClass.LINK_SET:
|
||||||
@@ -684,15 +691,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
|||||||
if (linkType < 0)
|
if (linkType < 0)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
int partCount = m_host.ParentGroup.GetPartCount();
|
int partCount = sog.GetPartCount();
|
||||||
|
|
||||||
if (linkType <= partCount)
|
linkType -= partCount;
|
||||||
|
if (linkType <= 0)
|
||||||
{
|
{
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
linkType = linkType - partCount;
|
|
||||||
if (linkType > avs.Count)
|
if (linkType > avs.Count)
|
||||||
{
|
{
|
||||||
return ret;
|
return ret;
|
||||||
@@ -4638,28 +4645,70 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
|||||||
|
|
||||||
public LSL_Key llGetLinkKey(int linknum)
|
public LSL_Key llGetLinkKey(int linknum)
|
||||||
{
|
{
|
||||||
if(linknum < 0)
|
if (linknum < 0)
|
||||||
{
|
{
|
||||||
if (linknum == ScriptBaseClass.LINK_THIS)
|
if (linknum == ScriptBaseClass.LINK_THIS)
|
||||||
return m_host.UUID.ToString();
|
return m_host.UUID.ToString();
|
||||||
return ScriptBaseClass.NULL_KEY;
|
return ScriptBaseClass.NULL_KEY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SceneObjectGroup sog = m_host.ParentGroup;
|
||||||
if (linknum < 2)
|
if (linknum < 2)
|
||||||
return m_host.ParentGroup.RootPart.UUID.ToString();
|
return sog.RootPart.UUID.ToString();
|
||||||
|
|
||||||
SceneObjectPart part = m_host.ParentGroup.GetLinkNumPart(linknum);
|
SceneObjectPart part = sog.GetLinkNumPart(linknum);
|
||||||
if (part != null)
|
if (part != null)
|
||||||
{
|
{
|
||||||
return part.UUID.ToString();
|
return part.UUID.ToString();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (linknum > m_host.ParentGroup.PrimCount)
|
if (linknum > sog.PrimCount)
|
||||||
{
|
{
|
||||||
linknum -= m_host.ParentGroup.PrimCount + 1;
|
linknum -= sog.PrimCount + 1;
|
||||||
|
|
||||||
List<ScenePresence> avatars = GetLinkAvatars(ScriptBaseClass.LINK_SET);
|
List<ScenePresence> avatars = GetLinkAvatars(ScriptBaseClass.LINK_SET, sog);
|
||||||
|
if (avatars.Count > linknum)
|
||||||
|
{
|
||||||
|
return avatars[linknum].UUID.ToString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ScriptBaseClass.NULL_KEY;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public LSL_Key llObjectGetLinkKey(LSL_Key objectid, int linknum)
|
||||||
|
{
|
||||||
|
if(!UUID.TryParse(objectid, out UUID oID))
|
||||||
|
return ScriptBaseClass.NULL_KEY;
|
||||||
|
|
||||||
|
if (!World.TryGetSceneObjectPart(oID, out SceneObjectPart sop))
|
||||||
|
return ScriptBaseClass.NULL_KEY;
|
||||||
|
|
||||||
|
if (linknum < 0)
|
||||||
|
{
|
||||||
|
if (linknum == ScriptBaseClass.LINK_THIS)
|
||||||
|
return sop.UUID.ToString();
|
||||||
|
return ScriptBaseClass.NULL_KEY;
|
||||||
|
}
|
||||||
|
|
||||||
|
SceneObjectGroup sog = sop.ParentGroup;
|
||||||
|
|
||||||
|
if (linknum < 2)
|
||||||
|
return sog.RootPart.UUID.ToString();
|
||||||
|
|
||||||
|
SceneObjectPart part = sog.GetLinkNumPart(linknum);
|
||||||
|
if (part != null)
|
||||||
|
{
|
||||||
|
return part.UUID.ToString();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (linknum > sog.PrimCount)
|
||||||
|
{
|
||||||
|
linknum -= sog.PrimCount + 1;
|
||||||
|
|
||||||
|
List<ScenePresence> avatars = GetLinkAvatars(ScriptBaseClass.LINK_SET, sog);
|
||||||
if (avatars.Count > linknum)
|
if (avatars.Count > linknum)
|
||||||
{
|
{
|
||||||
return avatars[linknum].UUID.ToString();
|
return avatars[linknum].UUID.ToString();
|
||||||
|
|||||||
@@ -153,6 +153,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
|
|||||||
LSL_Key llGetKey();
|
LSL_Key llGetKey();
|
||||||
LSL_Key llGetLandOwnerAt(LSL_Vector pos);
|
LSL_Key llGetLandOwnerAt(LSL_Vector pos);
|
||||||
LSL_Key llGetLinkKey(int linknum);
|
LSL_Key llGetLinkKey(int linknum);
|
||||||
|
LSL_Key llObjectGetLinkKey(LSL_Key objectid, int linknum);
|
||||||
LSL_String llGetLinkName(int linknum);
|
LSL_String llGetLinkName(int linknum);
|
||||||
LSL_Integer llGetLinkNumber();
|
LSL_Integer llGetLinkNumber();
|
||||||
LSL_Integer llGetLinkNumberOfSides(int link);
|
LSL_Integer llGetLinkNumberOfSides(int link);
|
||||||
|
|||||||
@@ -563,6 +563,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
|
|||||||
return m_LSL_Functions.llGetLinkKey(linknum);
|
return m_LSL_Functions.llGetLinkKey(linknum);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public LSL_Key llObjectGetLinkKey(LSL_Key objectid, int linknum)
|
||||||
|
{
|
||||||
|
return m_LSL_Functions.llObjectGetLinkKey(objectid, linknum); ;
|
||||||
|
}
|
||||||
|
|
||||||
public LSL_String llGetLinkName(int linknum)
|
public LSL_String llGetLinkName(int linknum)
|
||||||
{
|
{
|
||||||
return m_LSL_Functions.llGetLinkName(linknum);
|
return m_LSL_Functions.llGetLinkName(linknum);
|
||||||
|
|||||||
Reference in New Issue
Block a user