Implement cmGetAvatarList(). This returns a strided list of all avatars in the region, including their UUID, position and name. The radar is often the most taxing scripts on a sim, this function can help radars reduce their impact by 66% by eliminating the need for sensors.
parent
e80e04c5fd
commit
d834a2c3da
|
@ -85,6 +85,28 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
|||
wComm.DeliverMessage(ChatTypeEnum.Shout, ScriptBaseClass.DEBUG_CHANNEL, m_host.Name, m_host.UUID, message);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Like osGetAgents but returns enough info for a radar
|
||||
/// </summary>
|
||||
/// <returns>Strided list of the UUID, position and name of each avatar in the region</returns>
|
||||
public LSL_List cmGetAvatarList()
|
||||
{
|
||||
LSL_List result = new LSL_List();
|
||||
foreach (ScenePresence avatar in World.GetAvatars())
|
||||
{
|
||||
if (avatar.UUID != m_host.OwnerID)
|
||||
{
|
||||
if (avatar.IsChildAgent == false)
|
||||
{
|
||||
result.Add(avatar.UUID);
|
||||
result.Add(avatar.PhysicsActor.Position);
|
||||
result.Add(avatar.Name);
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the current Windlight scene
|
||||
/// </summary>
|
||||
|
|
|
@ -17,5 +17,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
|
|||
LSL_List cmGetWindlightScene(LSL_List rules);
|
||||
int cmSetWindlightScene(LSL_List rules);
|
||||
int cmSetWindlightSceneTargeted(LSL_List rules, key target);
|
||||
LSL_List cmGetAvatarList();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -72,5 +72,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
|
|||
{
|
||||
return m_CM_Functions.cmSetWindlightSceneTargeted(rules, target);
|
||||
}
|
||||
public LSL_List cmGetAvatarList()
|
||||
{
|
||||
return m_CM_Functions.cmGetAvatarList();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue