* Refactor: Stop exposing the inner scene's ScenePresence dictionary directly to the world

0.6.0-stable
Justin Clarke Casey 2008-05-13 18:25:15 +00:00
parent 91aa7fa4fe
commit 3025dafa92
3 changed files with 29 additions and 21 deletions

View File

@ -53,7 +53,7 @@ namespace OpenSim.Region.Environment.Scenes
#region Fields #region Fields
public Dictionary<LLUUID, ScenePresence> ScenePresences; internal Dictionary<LLUUID, ScenePresence> ScenePresences;
// SceneObjects is not currently populated or used. // SceneObjects is not currently populated or used.
//public Dictionary<LLUUID, SceneObjectGroup> SceneObjects; //public Dictionary<LLUUID, SceneObjectGroup> SceneObjects;
public Dictionary<LLUUID, EntityBase> Entities; public Dictionary<LLUUID, EntityBase> Entities;

View File

@ -207,6 +207,7 @@ namespace OpenSim.Region.Environment.Scenes
get { return m_innerScene.Entities; } get { return m_innerScene.Entities; }
set { m_innerScene.Entities = value; } set { m_innerScene.Entities = value; }
} }
public Dictionary<LLUUID, ScenePresence> m_restorePresences public Dictionary<LLUUID, ScenePresence> m_restorePresences
{ {
get { return m_innerScene.RestorePresences; } get { return m_innerScene.RestorePresences; }
@ -3095,7 +3096,7 @@ namespace OpenSim.Region.Environment.Scenes
} }
/// <summary> /// <summary>
/// Request a List of all m_scenePresences in this World /// Request a List of all ScenePresences in this region
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
public List<ScenePresence> GetScenePresences() public List<ScenePresence> GetScenePresences()
@ -3104,7 +3105,7 @@ namespace OpenSim.Region.Environment.Scenes
} }
/// <summary> /// <summary>
/// Request a filtered list of m_scenePresences in this World /// Request a filtered list of ScenePresences in this region
/// </summary> /// </summary>
/// <param name="filter"></param> /// <param name="filter"></param>
/// <returns></returns> /// <returns></returns>
@ -3114,7 +3115,7 @@ namespace OpenSim.Region.Environment.Scenes
} }
/// <summary> /// <summary>
/// Request a Avatar by UUID /// Request a scene presence by UUID
/// </summary> /// </summary>
/// <param name="avatarID"></param> /// <param name="avatarID"></param>
/// <returns></returns> /// <returns></returns>

View File

@ -1923,8 +1923,8 @@ namespace OpenSim.Region.ScriptEngine.Common
if (m_host.TaskInventory[InventorySelf()].PermsGranter != LLUUID.Zero) if (m_host.TaskInventory[InventorySelf()].PermsGranter != LLUUID.Zero)
{ {
ScenePresence presence = World.GetScenePresence(m_host.TaskInventory[InventorySelf()].PermsGranter);
ScenePresence presence = World.m_innerScene.ScenePresences[m_host.TaskInventory[InventorySelf()].PermsGranter];
if (presence != null) if (presence != null)
{ {
if ((m_host.TaskInventory[InventorySelf()].PermsMask & BuiltIn_Commands_BaseClass.PERMISSION_TAKE_CONTROLS) != 0) if ((m_host.TaskInventory[InventorySelf()].PermsMask & BuiltIn_Commands_BaseClass.PERMISSION_TAKE_CONTROLS) != 0)
@ -1950,8 +1950,8 @@ namespace OpenSim.Region.ScriptEngine.Common
if (m_host.TaskInventory[InventorySelf()].PermsGranter != LLUUID.Zero) if (m_host.TaskInventory[InventorySelf()].PermsGranter != LLUUID.Zero)
{ {
ScenePresence presence = World.GetScenePresence(m_host.TaskInventory[InventorySelf()].PermsGranter);
ScenePresence presence = World.m_innerScene.ScenePresences[m_host.TaskInventory[InventorySelf()].PermsGranter];
if (presence != null) if (presence != null)
{ {
if ((m_host.TaskInventory[InventorySelf()].PermsMask & BuiltIn_Commands_BaseClass.PERMISSION_TAKE_CONTROLS) != 0) if ((m_host.TaskInventory[InventorySelf()].PermsMask & BuiltIn_Commands_BaseClass.PERMISSION_TAKE_CONTROLS) != 0)
@ -2129,9 +2129,10 @@ namespace OpenSim.Region.ScriptEngine.Common
if ((m_host.TaskInventory[invItemID].PermsMask & BuiltIn_Commands_BaseClass.PERMISSION_TRIGGER_ANIMATION) != 0) if ((m_host.TaskInventory[invItemID].PermsMask & BuiltIn_Commands_BaseClass.PERMISSION_TRIGGER_ANIMATION) != 0)
{ {
if (World.m_innerScene.ScenePresences.ContainsKey(m_host.TaskInventory[invItemID].PermsGranter)) ScenePresence presence = World.GetScenePresence(m_host.TaskInventory[invItemID].PermsGranter);
if (presence != null)
{ {
ScenePresence presence = World.m_innerScene.ScenePresences[m_host.TaskInventory[invItemID].PermsGranter];
// Do NOT try to parse LLUUID, animations cannot be triggered by ID // Do NOT try to parse LLUUID, animations cannot be triggered by ID
LLUUID animID=InventoryKey(anim, (int)AssetType.Animation); LLUUID animID=InventoryKey(anim, (int)AssetType.Animation);
if (animID == LLUUID.Zero) if (animID == LLUUID.Zero)
@ -2165,9 +2166,10 @@ namespace OpenSim.Region.ScriptEngine.Common
if (animID == LLUUID.Zero) if (animID == LLUUID.Zero)
return; return;
if (World.m_innerScene.ScenePresences.ContainsKey(m_host.TaskInventory[invItemID].PermsGranter)) ScenePresence presence = World.GetScenePresence(m_host.TaskInventory[invItemID].PermsGranter);
if (presence != null)
{ {
ScenePresence presence = World.m_innerScene.ScenePresences[m_host.TaskInventory[invItemID].PermsGranter];
if (animID == LLUUID.Zero) if (animID == LLUUID.Zero)
presence.RemoveAnimation(anim); presence.RemoveAnimation(anim);
else else
@ -2271,13 +2273,14 @@ namespace OpenSim.Region.ScriptEngine.Common
} }
} }
if (World.m_innerScene.ScenePresences.ContainsKey(agentID)) ScenePresence presence = World.GetScenePresence(agentID);
if (presence != null)
{ {
string ownerName=resolveName(m_host.ParentGroup.RootPart.OwnerID); string ownerName=resolveName(m_host.ParentGroup.RootPart.OwnerID);
if (ownerName == String.Empty) if (ownerName == String.Empty)
ownerName="(hippos)"; ownerName="(hippos)";
ScenePresence presence = World.m_innerScene.ScenePresences[agentID];
if (!m_waitingForScriptAnswer) if (!m_waitingForScriptAnswer)
{ {
m_host.TaskInventory[invItemID].PermsGranter=agentID; m_host.TaskInventory[invItemID].PermsGranter=agentID;
@ -3711,10 +3714,13 @@ namespace OpenSim.Region.ScriptEngine.Common
LLUUID key = new LLUUID(); LLUUID key = new LLUUID();
if (LLUUID.TryParse(id,out key)) if (LLUUID.TryParse(id,out key))
{ {
if (World.m_innerScene.ScenePresences.ContainsKey(key)) ScenePresence presence = World.GetScenePresence(key);
if (presence != null)
{ {
return World.m_innerScene.ScenePresences[key].Firstname + " " + World.m_innerScene.ScenePresences[key].Lastname; return presence.Name;
} }
if (World.GetSceneObjectPart(key) != null) if (World.GetSceneObjectPart(key) != null)
{ {
return World.GetSceneObjectPart(key).Name; return World.GetSceneObjectPart(key).Name;
@ -3868,8 +3874,8 @@ namespace OpenSim.Region.ScriptEngine.Common
LLUUID key = new LLUUID(); LLUUID key = new LLUUID();
if (LLUUID.TryParse(id, out key)) if (LLUUID.TryParse(id, out key))
{ {
ScenePresence av = World.GetScenePresence(key); ScenePresence av = World.GetScenePresence(key);
if (av != null) if (av != null)
{ {
if (llAvatarOnSitTarget() == id) if (llAvatarOnSitTarget() == id)
@ -6162,10 +6168,11 @@ namespace OpenSim.Region.ScriptEngine.Common
LLUUID key = new LLUUID(); LLUUID key = new LLUUID();
if (LLUUID.TryParse(id, out key)) if (LLUUID.TryParse(id, out key))
{ {
if (World.m_innerScene.ScenePresences.ContainsKey(key)) ScenePresence av = World.GetScenePresence(key);
if (av != null);
{ {
ScenePresence av = World.m_innerScene.ScenePresences[key]; foreach (object o in args.Data)
foreach(object o in args.Data)
{ {
switch(o.ToString()) switch(o.ToString())
{ {