diff options
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/SceneGraph.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneGraph.cs | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index 1dab4df..80f9114 100644 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs | |||
@@ -211,6 +211,43 @@ namespace OpenSim.Region.Framework.Scenes | |||
211 | }); | 211 | }); |
212 | } | 212 | } |
213 | 213 | ||
214 | public void GetCoarseLocations(out List<Vector3> coarseLocations, out List<UUID> avatarUUIDs, uint maxLocations) | ||
215 | { | ||
216 | coarseLocations = new List<Vector3>(); | ||
217 | avatarUUIDs = new List<UUID>(); | ||
218 | |||
219 | List<ScenePresence> presences = GetScenePresences(); | ||
220 | for (int i = 0; i < Math.Min(presences.Count, maxLocations); ++i) | ||
221 | { | ||
222 | ScenePresence sp = presences[i]; | ||
223 | // If this presence is a child agent, we don't want its coarse locations | ||
224 | if (sp.IsChildAgent) | ||
225 | return; | ||
226 | |||
227 | if (sp.ParentID != 0) | ||
228 | { | ||
229 | // sitting avatar | ||
230 | SceneObjectPart sop = m_parentScene.GetSceneObjectPart(sp.ParentID); | ||
231 | if (sop != null) | ||
232 | { | ||
233 | coarseLocations.Add(sop.AbsolutePosition + sp.AbsolutePosition); | ||
234 | avatarUUIDs.Add(sp.UUID); | ||
235 | } | ||
236 | else | ||
237 | { | ||
238 | // we can't find the parent.. ! arg! | ||
239 | coarseLocations.Add(sp.AbsolutePosition); | ||
240 | avatarUUIDs.Add(sp.UUID); | ||
241 | } | ||
242 | } | ||
243 | else | ||
244 | { | ||
245 | coarseLocations.Add(sp.AbsolutePosition); | ||
246 | avatarUUIDs.Add(sp.UUID); | ||
247 | } | ||
248 | } | ||
249 | } | ||
250 | |||
214 | #endregion | 251 | #endregion |
215 | 252 | ||
216 | #region Entity Methods | 253 | #region Entity Methods |