Merge branch 'master' into bigmerge

Conflicts:
	OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs
	OpenSim/Region/CoreModules/Avatar/Gods/GodsModule.cs
	OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs
	OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs
	OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
avinationmerge
Melanie 2011-10-27 18:14:38 +01:00
commit b975cbcbed
27 changed files with 207 additions and 216 deletions

View File

@ -1976,8 +1976,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
SendBulkUpdateInventoryItem((InventoryItemBase)node); SendBulkUpdateInventoryItem((InventoryItemBase)node);
else if (node is InventoryFolderBase) else if (node is InventoryFolderBase)
SendBulkUpdateInventoryFolder((InventoryFolderBase)node); SendBulkUpdateInventoryFolder((InventoryFolderBase)node);
else if (node != null)
m_log.ErrorFormat("[CLIENT]: {0} sent unknown inventory node named {1}", Name, node.Name);
else else
m_log.ErrorFormat("[CLIENT]: Client for {0} sent unknown inventory node named {1}", Name, node.Name); m_log.ErrorFormat("[CLIENT]: {0} sent null inventory node", Name);
} }
protected void SendBulkUpdateInventoryItem(InventoryItemBase item) protected void SendBulkUpdateInventoryItem(InventoryItemBase item)

View File

@ -306,13 +306,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat
if (c.Scene != null) if (c.Scene != null)
{ {
((Scene)c.Scene).ForEachScenePresence ((Scene)c.Scene).ForEachRootScenePresence
( (
delegate(ScenePresence presence) delegate(ScenePresence presence)
{ {
// ignore chat from child agents
if (presence.IsChildAgent) return;
IClientAPI client = presence.ControllingClient; IClientAPI client = presence.ControllingClient;
// don't forward SayOwner chat from objects to // don't forward SayOwner chat from objects to

View File

@ -98,10 +98,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Dialog
public void SendGeneralAlert(string message) public void SendGeneralAlert(string message)
{ {
m_scene.ForEachScenePresence(delegate(ScenePresence presence) m_scene.ForEachRootScenePresence(delegate(ScenePresence presence)
{ {
if (!presence.IsChildAgent) presence.ControllingClient.SendAlertMessage(message);
presence.ControllingClient.SendAlertMessage(message);
}); });
} }
@ -163,10 +162,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Dialog
public void SendNotificationToUsersInRegion( public void SendNotificationToUsersInRegion(
UUID fromAvatarID, string fromAvatarName, string message) UUID fromAvatarID, string fromAvatarName, string message)
{ {
m_scene.ForEachScenePresence(delegate(ScenePresence presence) m_scene.ForEachRootScenePresence(delegate(ScenePresence presence)
{ {
if (!presence.IsChildAgent) presence.ControllingClient.SendBlueBoxMessage(fromAvatarID, fromAvatarName, message);
presence.ControllingClient.SendBlueBoxMessage(fromAvatarID, fromAvatarName, message);
}); });
} }

View File

@ -221,7 +221,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Gods
} }
else if (agentID == ALL_AGENTS) else if (agentID == ALL_AGENTS)
{ {
m_scene.ForEachScenePresence( m_scene.ForEachRootScenePresence(
delegate(ScenePresence p) delegate(ScenePresence p)
{ {
if (p.UUID != godID && (!m_scene.Permissions.IsGod(p.UUID))) if (p.UUID != godID && (!m_scene.Permissions.IsGod(p.UUID)))

View File

@ -143,24 +143,19 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
// Try root avatar only first // Try root avatar only first
foreach (Scene scene in m_Scenes) foreach (Scene scene in m_Scenes)
{ {
if (scene.Entities.ContainsKey(toAgentID) && // m_log.DebugFormat(
scene.Entities[toAgentID] is ScenePresence) // "[HG INSTANT MESSAGE]: Looking for root agent {0} in {1}",
{ // toAgentID.ToString(), scene.RegionInfo.RegionName);
// m_log.DebugFormat( ScenePresence sp = scene.GetScenePresence(toAgentID);
// "[HG INSTANT MESSAGE]: Looking for root agent {0} in {1}", if (sp != null && !sp.IsChildAgent)
// toAgentID.ToString(), scene.RegionInfo.RegionName); {
// Local message
ScenePresence user = (ScenePresence) scene.Entities[toAgentID]; // m_log.DebugFormat("[HG INSTANT MESSAGE]: Delivering IM to root agent {0} {1}", user.Name, toAgentID);
if (!user.IsChildAgent) sp.ControllingClient.SendInstantMessage(im);
{
// Local message
// m_log.DebugFormat("[HG INSTANT MESSAGE]: Delivering IM to root agent {0} {1}", user.Name, toAgentID);
user.ControllingClient.SendInstantMessage(im);
// Message sent // Message sent
result(true); result(true);
return; return;
}
} }
} }
@ -168,16 +163,14 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
foreach (Scene scene in m_Scenes) foreach (Scene scene in m_Scenes)
{ {
// m_log.DebugFormat( // m_log.DebugFormat(
// "[HG INSTANT MESSAGE]: Looking for child of {0} in {1}", toAgentID, scene.RegionInfo.RegionName); // "[HG INSTANT MESSAGE]: Looking for child of {0} in {1}",
// toAgentID, scene.RegionInfo.RegionName);
if (scene.Entities.ContainsKey(toAgentID) && ScenePresence sp = scene.GetScenePresence(toAgentID);
scene.Entities[toAgentID] is ScenePresence) if (sp != null)
{ {
// Local message // Local message
ScenePresence user = (ScenePresence) scene.Entities[toAgentID];
// m_log.DebugFormat("[HG INSTANT MESSAGE]: Delivering IM to child agent {0} {1}", user.Name, toAgentID); // m_log.DebugFormat("[HG INSTANT MESSAGE]: Delivering IM to child agent {0} {1}", user.Name, toAgentID);
user.ControllingClient.SendInstantMessage(im); sp.ControllingClient.SendInstantMessage(im);
// Message sent // Message sent
result(true); result(true);
@ -231,17 +224,11 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
bool successful = false; bool successful = false;
foreach (Scene scene in m_Scenes) foreach (Scene scene in m_Scenes)
{ {
if (scene.Entities.ContainsKey(toAgentID) && ScenePresence sp = scene.GetScenePresence(toAgentID);
scene.Entities[toAgentID] is ScenePresence) if(!sp.IsChildAgent)
{ {
ScenePresence user = scene.EventManager.TriggerIncomingInstantMessage(gim);
(ScenePresence)scene.Entities[toAgentID]; successful = true;
if (!user.IsChildAgent)
{
scene.EventManager.TriggerIncomingInstantMessage(gim);
successful = true;
}
} }
} }
if (!successful) if (!successful)

View File

@ -140,8 +140,11 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
// Try root avatar only first // Try root avatar only first
foreach (Scene scene in m_Scenes) foreach (Scene scene in m_Scenes)
{ {
if (scene.Entities.ContainsKey(toAgentID) && // m_log.DebugFormat(
scene.Entities[toAgentID] is ScenePresence) // "[INSTANT MESSAGE]: Looking for root agent {0} in {1}",
// toAgentID.ToString(), scene.RegionInfo.RegionName);
ScenePresence sp = scene.GetScenePresence(toAgentID);
if (sp != null && !sp.IsChildAgent)
{ {
// m_log.DebugFormat( // m_log.DebugFormat(
// "[INSTANT MESSAGE]: Looking for root agent {0} in {1}", // "[INSTANT MESSAGE]: Looking for root agent {0} in {1}",
@ -165,9 +168,8 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
{ {
// m_log.DebugFormat( // m_log.DebugFormat(
// "[INSTANT MESSAGE]: Looking for child of {0} in {1}", toAgentID, scene.RegionInfo.RegionName); // "[INSTANT MESSAGE]: Looking for child of {0} in {1}", toAgentID, scene.RegionInfo.RegionName);
ScenePresence sp = scene.GetScenePresence(toAgentID);
if (scene.Entities.ContainsKey(toAgentID) && if (sp != null)
scene.Entities[toAgentID] is ScenePresence)
{ {
// Local message // Local message
ScenePresence user = (ScenePresence) scene.Entities[toAgentID]; ScenePresence user = (ScenePresence) scene.Entities[toAgentID];
@ -405,17 +407,11 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
// Trigger the Instant message in the scene. // Trigger the Instant message in the scene.
foreach (Scene scene in m_Scenes) foreach (Scene scene in m_Scenes)
{ {
if (scene.Entities.ContainsKey(toAgentID) && ScenePresence sp = scene.GetScenePresence(toAgentID);
scene.Entities[toAgentID] is ScenePresence) if (sp != null && !sp.IsChildAgent)
{ {
ScenePresence user = scene.EventManager.TriggerIncomingInstantMessage(gim);
(ScenePresence)scene.Entities[toAgentID]; successful = true;
if (!user.IsChildAgent)
{
scene.EventManager.TriggerIncomingInstantMessage(gim);
successful = true;
}
} }
} }
if (!successful) if (!successful)

View File

@ -277,19 +277,25 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
{ {
if (m_TransferModule != null) if (m_TransferModule != null)
m_TransferModule.SendInstantMessage(im, delegate(bool success) { m_TransferModule.SendInstantMessage(im, delegate(bool success) {
// Send BulkUpdateInventory
IInventoryService invService = scene.InventoryService;
UUID inventoryEntityID = new UUID(im.imSessionID); // The inventory item /folder, back from it's trip
InventoryFolderBase folder = new InventoryFolderBase(inventoryEntityID, client.AgentId); // justincc - FIXME: Comment out for now. This code was added in commit db91044 Mon Aug 22 2011
folder = invService.GetFolder(folder); // and is apparently supposed to fix bulk inventory updates after accepting items. But
// instead it appears to cause two copies of an accepted folder for the receiving user in
// at least some cases. Folder/item update is already done when the offer is made (see code above)
ScenePresence fromUser = scene.GetScenePresence(new UUID(im.fromAgentID)); // // Send BulkUpdateInventory
// IInventoryService invService = scene.InventoryService;
// If the user has left the scene by the time the message comes back then we can't send // UUID inventoryEntityID = new UUID(im.imSessionID); // The inventory item /folder, back from it's trip
// them the update. //
if (fromUser != null) // InventoryFolderBase folder = new InventoryFolderBase(inventoryEntityID, client.AgentId);
fromUser.ControllingClient.SendBulkUpdateInventory(folder); // folder = invService.GetFolder(folder);
//
// ScenePresence fromUser = scene.GetScenePresence(new UUID(im.fromAgentID));
//
// // If the user has left the scene by the time the message comes back then we can't send
// // them the update.
// if (fromUser != null)
// fromUser.ControllingClient.SendBulkUpdateInventory(folder);
}); });
} }
} }

View File

@ -678,11 +678,10 @@ namespace OpenSim.Region.CoreModules.World.Estate
if (!Scene.Permissions.CanIssueEstateCommand(remover_client.AgentId, false)) if (!Scene.Permissions.CanIssueEstateCommand(remover_client.AgentId, false))
return; return;
Scene.ForEachScenePresence(delegate(ScenePresence sp) Scene.ForEachRootScenePresence(delegate(ScenePresence p)
{ {
if (sp.UUID != senderID) if (p.UUID != senderID)
{ {
ScenePresence p = Scene.GetScenePresence(sp.UUID);
// make sure they are still there, we could be working down a long list // make sure they are still there, we could be working down a long list
// Also make sure they are actually in the region // Also make sure they are actually in the region
if (p != null && !p.IsChildAgent) if (p != null && !p.IsChildAgent)
@ -953,10 +952,9 @@ namespace OpenSim.Region.CoreModules.World.Estate
public void sendRegionInfoPacketToAll() public void sendRegionInfoPacketToAll()
{ {
Scene.ForEachScenePresence(delegate(ScenePresence sp) Scene.ForEachRootScenePresence(delegate(ScenePresence sp)
{ {
if (!sp.IsChildAgent) HandleRegionInfoRequest(sp.ControllingClient);
HandleRegionInfoRequest(sp.ControllingClient);
}); });
} }

View File

@ -533,11 +533,8 @@ namespace OpenSim.Region.CoreModules.World.Land
public void SendLandUpdateToAvatarsOverMe(bool snap_selection) public void SendLandUpdateToAvatarsOverMe(bool snap_selection)
{ {
m_scene.ForEachScenePresence(delegate(ScenePresence avatar) m_scene.ForEachRootScenePresence(delegate(ScenePresence avatar)
{ {
if (avatar.IsChildAgent)
return;
ILandObject over = null; ILandObject over = null;
try try
{ {

View File

@ -70,11 +70,8 @@ namespace OpenSim.Region.CoreModules.World.Sound
SceneObjectGroup grp = part.ParentGroup; SceneObjectGroup grp = part.ParentGroup;
m_scene.ForEachScenePresence(delegate(ScenePresence sp) m_scene.ForEachRootScenePresence(delegate(ScenePresence sp)
{ {
if (sp.IsChildAgent)
return;
double dis = Util.GetDistanceTo(sp.AbsolutePosition, position); double dis = Util.GetDistanceTo(sp.AbsolutePosition, position);
if (dis > 100.0) // Max audio distance if (dis > 100.0) // Max audio distance
return; return;
@ -122,11 +119,8 @@ namespace OpenSim.Region.CoreModules.World.Sound
} }
} }
m_scene.ForEachScenePresence(delegate(ScenePresence sp) m_scene.ForEachRootScenePresence(delegate(ScenePresence sp)
{ {
if (sp.IsChildAgent)
return;
double dis = Util.GetDistanceTo(sp.AbsolutePosition, position); double dis = Util.GetDistanceTo(sp.AbsolutePosition, position);
if (dis > 100.0) // Max audio distance if (dis > 100.0) // Max audio distance
return; return;

View File

@ -488,12 +488,9 @@ namespace OpenSim.Region.CoreModules
private void SunUpdateToAllClients() private void SunUpdateToAllClients()
{ {
m_scene.ForEachScenePresence(delegate(ScenePresence sp) m_scene.ForEachRootScenePresence(delegate(ScenePresence sp)
{ {
if (!sp.IsChildAgent)
{
SunToClient(sp.ControllingClient); SunToClient(sp.ControllingClient);
}
}); });
} }

View File

@ -435,10 +435,9 @@ namespace OpenSim.Region.CoreModules
m_frameLastUpdateClientArray = m_frame; m_frameLastUpdateClientArray = m_frame;
} }
m_scene.ForEachScenePresence(delegate(ScenePresence sp) m_scene.ForEachRootScenePresence(delegate(ScenePresence sp)
{ {
if (!sp.IsChildAgent) sp.ControllingClient.SendWindData(windSpeeds);
sp.ControllingClient.SendWindData(windSpeeds);
}); });
} }
} }

View File

@ -401,10 +401,10 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
} }
else else
{ {
m_scene.ForEachScenePresence(delegate(ScenePresence sp) m_scene.ForEachRootScenePresence(delegate(ScenePresence sp)
{ {
// Don't send a green dot for yourself // Don't send a green dot for yourself
if (!sp.IsChildAgent && sp.UUID != remoteClient.AgentId) if (sp.UUID != remoteClient.AgentId)
{ {
mapitem = new mapItemReply(); mapitem = new mapItemReply();
mapitem.x = (uint)(xstart + sp.AbsolutePosition.X); mapitem.x = (uint)(xstart + sp.AbsolutePosition.X);

View File

@ -920,22 +920,17 @@ namespace OpenSim.Region.Framework.Scenes
try try
{ {
ForEachScenePresence(delegate(ScenePresence agent) ForEachRootScenePresence(delegate(ScenePresence agent)
{ {
// If agent is a root agent. //agent.ControllingClient.new
if (!agent.IsChildAgent) //this.CommsManager.InterRegion.InformRegionOfChildAgent(otherRegion.RegionHandle, agent.ControllingClient.RequestClientInfo());
{
//agent.ControllingClient.new
//this.CommsManager.InterRegion.InformRegionOfChildAgent(otherRegion.RegionHandle, agent.ControllingClient.RequestClientInfo());
List<ulong> old = new List<ulong>(); List<ulong> old = new List<ulong>();
old.Add(otherRegion.RegionHandle); old.Add(otherRegion.RegionHandle);
agent.DropOldNeighbours(old); agent.DropOldNeighbours(old);
if (m_teleportModule != null) if (m_teleportModule != null)
m_teleportModule.EnableChildAgent(agent, otherRegion); m_teleportModule.EnableChildAgent(agent, otherRegion);
} });
}
);
} }
catch (NullReferenceException) catch (NullReferenceException)
{ {
@ -1070,16 +1065,11 @@ namespace OpenSim.Region.Framework.Scenes
GridRegion r = new GridRegion(region); GridRegion r = new GridRegion(region);
try try
{ {
ForEachScenePresence(delegate(ScenePresence agent) ForEachRootScenePresence(delegate(ScenePresence agent)
{ {
// If agent is a root agent. if (m_teleportModule != null)
if (!agent.IsChildAgent) m_teleportModule.EnableChildAgent(agent, r);
{ });
if (m_teleportModule != null)
m_teleportModule.EnableChildAgent(agent, r);
}
}
);
} }
catch (NullReferenceException) catch (NullReferenceException)
{ {
@ -1493,11 +1483,10 @@ namespace OpenSim.Region.Framework.Scenes
/// <param name="stats">Stats on the Simulator's performance</param> /// <param name="stats">Stats on the Simulator's performance</param>
private void SendSimStatsPackets(SimStats stats) private void SendSimStatsPackets(SimStats stats)
{ {
ForEachScenePresence( ForEachRootScenePresence(
delegate(ScenePresence agent) delegate(ScenePresence agent)
{ {
if (!agent.IsChildAgent) agent.ControllingClient.SendSimStats(stats);
agent.ControllingClient.SendSimStats(stats);
} }
); );
} }
@ -4462,6 +4451,19 @@ namespace OpenSim.Region.Framework.Scenes
return cp.IsChildAgent; return cp.IsChildAgent;
} }
/// <summary>
/// Performs action on all ROOT (not child) scene presences.
/// This is just a shortcut function since frequently actions only appy to root SPs
/// </summary>
/// <param name="action"></param>
public void ForEachRootScenePresence(Action<ScenePresence> action)
{
if(m_sceneGraph != null)
{
m_sceneGraph.ForEachRootScenePresence(action);
}
}
/// <summary> /// <summary>
/// Performs action on all scene presences. /// Performs action on all scene presences.
/// </summary> /// </summary>

View File

@ -1265,7 +1265,21 @@ namespace OpenSim.Region.Framework.Scenes
} }
} }
} }
/// <summary>
/// Performs action on all ROOT (not child) scene presences.
/// This is just a shortcut function since frequently actions only appy to root SPs
/// </summary>
/// <param name="action"></param>
public void ForEachRootScenePresence(Action<ScenePresence> action)
{
ForEachScenePresence(delegate(ScenePresence sp)
{
if (!sp.IsChildAgent)
action(sp);
});
}
/// <summary> /// <summary>
/// Performs action on all scene presences. This can ultimately run the actions in parallel but /// Performs action on all scene presences. This can ultimately run the actions in parallel but
/// any delegates passed in will need to implement their own locking on data they reference and /// any delegates passed in will need to implement their own locking on data they reference and

View File

@ -458,9 +458,9 @@ namespace OpenSim.Region.Framework.Scenes
ForEachCurrentScene( ForEachCurrentScene(
delegate(Scene scene) delegate(Scene scene)
{ {
scene.ForEachScenePresence(delegate(ScenePresence scenePresence) scene.ForEachRootScenePresence(delegate(ScenePresence scenePresence)
{ {
if (!scenePresence.IsChildAgent && (name == null || scenePresence.Name == name)) if (name == null || scenePresence.Name == name)
{ {
m_log.DebugFormat("Packet debug for {0} {1} set to {2}", m_log.DebugFormat("Packet debug for {0} {1} set to {2}",
scenePresence.Firstname, scenePresence.Firstname,
@ -481,10 +481,9 @@ namespace OpenSim.Region.Framework.Scenes
ForEachCurrentScene( ForEachCurrentScene(
delegate(Scene scene) delegate(Scene scene)
{ {
scene.ForEachScenePresence(delegate(ScenePresence scenePresence) scene.ForEachRootScenePresence(delegate(ScenePresence scenePresence)
{ {
if (!scenePresence.IsChildAgent) avatars.Add(scenePresence);
avatars.Add(scenePresence);
}); });
} }
); );

View File

@ -1493,10 +1493,9 @@ namespace OpenSim.Region.Framework.Scenes
if (volume < 0) if (volume < 0)
volume = 0; volume = 0;
m_parentGroup.Scene.ForEachScenePresence(delegate(ScenePresence sp) m_parentGroup.Scene.ForEachRootScenePresence(delegate(ScenePresence sp)
{ {
if (!sp.IsChildAgent) sp.ControllingClient.SendAttachedSoundGainChange(UUID, (float)volume);
sp.ControllingClient.SendAttachedSoundGainChange(UUID, (float)volume);
}); });
} }
@ -2136,6 +2135,8 @@ namespace OpenSim.Region.Framework.Scenes
public void PhysicsCollision(EventArgs e) public void PhysicsCollision(EventArgs e)
{ {
// m_log.DebugFormat("Invoking PhysicsCollision on {0} {1} {2}", Name, LocalId, UUID);
// single threaded here // single threaded here
CollisionEventUpdate a = (CollisionEventUpdate)e; CollisionEventUpdate a = (CollisionEventUpdate)e;
@ -2729,10 +2730,8 @@ namespace OpenSim.Region.Framework.Scenes
TaskInventory.LockItemsForRead(false); TaskInventory.LockItemsForRead(false);
} }
m_parentGroup.Scene.ForEachScenePresence(delegate(ScenePresence sp) m_parentGroup.Scene.ForEachRootScenePresence(delegate(ScenePresence sp)
{ {
if (sp.IsChildAgent)
return;
if (!(Util.GetDistanceTo(sp.AbsolutePosition, AbsolutePosition) >= 100)) if (!(Util.GetDistanceTo(sp.AbsolutePosition, AbsolutePosition) >= 100))
sp.ControllingClient.SendPreLoadSound(objectID, objectID, soundID); sp.ControllingClient.SendPreLoadSound(objectID, objectID, soundID);
}); });

View File

@ -2950,19 +2950,15 @@ namespace OpenSim.Region.Framework.Scenes
public void SendOtherAgentsAvatarDataToMe() public void SendOtherAgentsAvatarDataToMe()
{ {
int count = 0; int count = 0;
m_scene.ForEachScenePresence(delegate(ScenePresence scenePresence) m_scene.ForEachRootScenePresence(delegate(ScenePresence scenePresence)
{ {
// only send information about root agents // only send information about other root agents
if (scenePresence.IsChildAgent) if (scenePresence.UUID == UUID)
return; return;
// only send information about other root agents scenePresence.SendAvatarDataToAgent(this);
if (scenePresence.UUID == UUID) count++;
return; });
scenePresence.SendAvatarDataToAgent(this);
count++;
});
m_scene.StatsReporter.AddAgentUpdates(count); m_scene.StatsReporter.AddAgentUpdates(count);
} }
@ -2996,13 +2992,14 @@ namespace OpenSim.Region.Framework.Scenes
int count = 0; int count = 0;
m_scene.ForEachScenePresence(delegate(ScenePresence scenePresence) m_scene.ForEachScenePresence(delegate(ScenePresence scenePresence)
{ {
if (scenePresence.UUID == UUID) // only send information to other root agents
return; if (scenePresence.UUID == UUID)
return;
SendAppearanceToAgent(scenePresence); SendAppearanceToAgent(scenePresence);
count++; count++;
}); });
m_scene.StatsReporter.AddAgentUpdates(count); m_scene.StatsReporter.AddAgentUpdates(count);
} }
@ -3016,19 +3013,15 @@ namespace OpenSim.Region.Framework.Scenes
//m_log.DebugFormat("[SCENE PRESENCE] SendOtherAgentsAppearanceToMe: {0} ({1})", Name, UUID); //m_log.DebugFormat("[SCENE PRESENCE] SendOtherAgentsAppearanceToMe: {0} ({1})", Name, UUID);
int count = 0; int count = 0;
m_scene.ForEachScenePresence(delegate(ScenePresence scenePresence) m_scene.ForEachRootScenePresence(delegate(ScenePresence scenePresence)
{ {
// only send information about root agents // only send information about other root agents
if (scenePresence.IsChildAgent) if (scenePresence.UUID == UUID)
return; return;
// only send information about other root agents scenePresence.SendAppearanceToAgent(this);
if (scenePresence.UUID == UUID) count++;
return; });
scenePresence.SendAppearanceToAgent(this);
count++;
});
m_scene.StatsReporter.AddAgentUpdates(count); m_scene.StatsReporter.AddAgentUpdates(count);
} }

View File

@ -373,13 +373,10 @@ namespace OpenSim.Region.OptionalModules.Avatar.Concierge
scene.GetRootAgentCount(), scene.RegionInfo.RegionName, scene.GetRootAgentCount(), scene.RegionInfo.RegionName,
scene.RegionInfo.RegionID, scene.RegionInfo.RegionID,
DateTime.UtcNow.ToString("s"))); DateTime.UtcNow.ToString("s")));
scene.ForEachScenePresence(delegate(ScenePresence sp) scene.ForEachRootScenePresence(delegate(ScenePresence sp)
{ {
if (!sp.IsChildAgent)
{
list.Append(String.Format(" <avatar name=\"{0}\" uuid=\"{1}\" />\n", sp.Name, sp.UUID)); list.Append(String.Format(" <avatar name=\"{0}\" uuid=\"{1}\" />\n", sp.Name, sp.UUID));
list.Append("</avatars>"); list.Append("</avatars>");
}
}); });
string payload = list.ToString(); string payload = list.ToString();

View File

@ -504,19 +504,18 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
// Try root avatar first // Try root avatar first
foreach (Scene scene in m_sceneList) foreach (Scene scene in m_sceneList)
{ {
if (scene.Entities.ContainsKey(agentID) && ScenePresence sp = scene.GetScenePresence(agentID);
scene.Entities[agentID] is ScenePresence) if (sp != null)
{ {
ScenePresence user = (ScenePresence)scene.Entities[agentID]; if (!sp.IsChildAgent)
if (!user.IsChildAgent)
{ {
if (m_debugEnabled) m_log.WarnFormat("[GROUPS-MESSAGING]: Found root agent for client : {0}", user.ControllingClient.Name); if (m_debugEnabled) m_log.WarnFormat("[GROUPS-MESSAGING]: Found root agent for client : {0}", sp.ControllingClient.Name);
return user.ControllingClient; return sp.ControllingClient;
} }
else else
{ {
if (m_debugEnabled) m_log.WarnFormat("[GROUPS-MESSAGING]: Found child agent for client : {0}", user.ControllingClient.Name); if (m_debugEnabled) m_log.WarnFormat("[GROUPS-MESSAGING]: Found child agent for client : {0}", sp.ControllingClient.Name);
child = user.ControllingClient; child = sp.ControllingClient;
} }
} }
} }

View File

@ -1076,17 +1076,16 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
// Try root avatar first // Try root avatar first
foreach (Scene scene in m_sceneList) foreach (Scene scene in m_sceneList)
{ {
if (scene.Entities.ContainsKey(agentID) && ScenePresence sp = scene.GetScenePresence(agentID);
scene.Entities[agentID] is ScenePresence) if (sp != null)
{ {
ScenePresence user = (ScenePresence)scene.Entities[agentID]; if (!sp.IsChildAgent)
if (!user.IsChildAgent)
{ {
return user.ControllingClient; return sp.ControllingClient;
} }
else else
{ {
child = user.ControllingClient; child = sp.ControllingClient;
} }
} }
} }

View File

@ -76,6 +76,8 @@ namespace OpenSim.Region.Physics.Manager
/// </summary> /// </summary>
public int Count { get { return m_objCollisionList.Count; } } public int Count { get { return m_objCollisionList.Count; } }
public bool CollisionsOnPreviousFrame { get; private set; }
public Dictionary<uint, ContactPoint> m_objCollisionList; public Dictionary<uint, ContactPoint> m_objCollisionList;
public CollisionEventUpdate(Dictionary<uint, ContactPoint> objCollisionList) public CollisionEventUpdate(Dictionary<uint, ContactPoint> objCollisionList)

View File

@ -193,6 +193,15 @@ namespace OpenSim.Region.Physics.OdePlugin
private int m_eventsubscription; private int m_eventsubscription;
private CollisionEventUpdate CollisionEventsThisFrame = new CollisionEventUpdate(); private CollisionEventUpdate CollisionEventsThisFrame = new CollisionEventUpdate();
/// <summary>
/// Signal whether there were collisions on the previous frame, so we know if we need to send the
/// empty CollisionEventsThisFrame to the prim so that it can detect the end of a collision.
/// </summary>
/// <remarks>
/// This is probably a temporary measure, pending storing this information consistently in CollisionEventUpdate itself.
/// </remarks>
private bool m_collisionsOnPreviousFrame;
private IntPtr m_linkJoint = IntPtr.Zero; private IntPtr m_linkJoint = IntPtr.Zero;
internal volatile bool childPrim; internal volatile bool childPrim;
@ -3025,8 +3034,20 @@ Console.WriteLine(" JointCreateFixed");
public void SendCollisions() public void SendCollisions()
{ {
if (CollisionEventsThisFrame.Count > 0) if (m_collisionsOnPreviousFrame || CollisionEventsThisFrame.Count > 0)
{
base.SendCollisionUpdate(CollisionEventsThisFrame); base.SendCollisionUpdate(CollisionEventsThisFrame);
if (CollisionEventsThisFrame.Count > 0)
{
m_collisionsOnPreviousFrame = true;
CollisionEventsThisFrame.Clear();
}
else
{
m_collisionsOnPreviousFrame = false;
}
}
} }
public override bool SubscribedEvents() public override bool SubscribedEvents()

View File

@ -629,10 +629,8 @@ namespace OpenSim.Region.RegionCombinerModule
List<Vector3> CoarseLocations = new List<Vector3>(); List<Vector3> CoarseLocations = new List<Vector3>();
List<UUID> AvatarUUIDs = new List<UUID>(); List<UUID> AvatarUUIDs = new List<UUID>();
connectiondata.RegionScene.ForEachScenePresence(delegate(ScenePresence sp) connectiondata.RegionScene.ForEachRootScenePresence(delegate(ScenePresence sp)
{ {
if (sp.IsChildAgent)
return;
if (sp.UUID != presence.UUID) if (sp.UUID != presence.UUID)
{ {
if (sp.ParentID != 0) if (sp.ParentID != 0)

View File

@ -4124,9 +4124,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
m_host.AddScriptLPS(1); m_host.AddScriptLPS(1);
List<UUID> keytable = new List<UUID>(); List<UUID> keytable = new List<UUID>();
// parse for sitting avatare-uuids // parse for sitting avatare-uuids
World.ForEachScenePresence(delegate(ScenePresence presence) World.ForEachRootScenePresence(delegate(ScenePresence presence)
{ {
if (!presence.IsChildAgent && presence.ParentID != 0 && m_host.ParentGroup.HasChildPrim(presence.ParentID)) if (presence.ParentID != 0 && m_host.ParentGroup.HasChildPrim(presence.ParentID))
keytable.Add(presence.UUID); keytable.Add(presence.UUID);
}); });
@ -4199,9 +4199,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
m_host.AddScriptLPS(1); m_host.AddScriptLPS(1);
// parse for sitting avatare-names // parse for sitting avatare-names
List<String> nametable = new List<String>(); List<String> nametable = new List<String>();
World.ForEachScenePresence(delegate(ScenePresence presence) World.ForEachRootScenePresence(delegate(ScenePresence presence)
{ {
if (!presence.IsChildAgent && presence.ParentID != 0 && m_host.ParentGroup.HasChildPrim(presence.ParentID)) if (presence.ParentID != 0 && m_host.ParentGroup.HasChildPrim(presence.ParentID))
nametable.Add(presence.ControllingClient.Name); nametable.Add(presence.ControllingClient.Name);
}); });
@ -9933,9 +9933,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
landObject.SetMediaUrl(url); landObject.SetMediaUrl(url);
// now send to all (non-child) agents in the parcel // now send to all (non-child) agents in the parcel
World.ForEachScenePresence(delegate(ScenePresence sp) World.ForEachRootScenePresence(delegate(ScenePresence sp)
{ {
if (!sp.IsChildAgent && (sp.currentParcelUUID == landData.GlobalID)) if (sp.currentParcelUUID == landData.GlobalID)
{ {
sp.ControllingClient.SendParcelMediaUpdate(landData.MediaURL, sp.ControllingClient.SendParcelMediaUpdate(landData.MediaURL,
landData.MediaID, landData.MediaID,
@ -9966,9 +9966,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (presence == null) if (presence == null)
{ {
// send to all (non-child) agents in the parcel // send to all (non-child) agents in the parcel
World.ForEachScenePresence(delegate(ScenePresence sp) World.ForEachRootScenePresence(delegate(ScenePresence sp)
{ {
if (!sp.IsChildAgent && (sp.currentParcelUUID == landData.GlobalID)) if (sp.currentParcelUUID == landData.GlobalID)
{ {
sp.ControllingClient.SendParcelMediaCommand(0x4, // TODO what is this? sp.ControllingClient.SendParcelMediaCommand(0x4, // TODO what is this?
(ParcelMediaCommandEnum)commandToSend, (ParcelMediaCommandEnum)commandToSend,

View File

@ -882,10 +882,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
CheckThreatLevel(ThreatLevel.None, "osGetAgents"); CheckThreatLevel(ThreatLevel.None, "osGetAgents");
LSL_List result = new LSL_List(); LSL_List result = new LSL_List();
World.ForEachScenePresence(delegate(ScenePresence sp) World.ForEachRootScenePresence(delegate(ScenePresence sp)
{ {
if (!sp.IsChildAgent) result.Add(new LSL_String(sp.Name));
result.Add(new LSL_String(sp.Name));
}); });
return result; return result;
} }
@ -2590,11 +2589,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
CheckThreatLevel(ThreatLevel.Severe, "osKickAvatar"); CheckThreatLevel(ThreatLevel.Severe, "osKickAvatar");
if (World.Permissions.CanRunConsoleCommand(m_host.OwnerID)) if (World.Permissions.CanRunConsoleCommand(m_host.OwnerID))
{ {
World.ForEachScenePresence(delegate(ScenePresence sp) World.ForEachRootScenePresence(delegate(ScenePresence sp)
{ {
if (!sp.IsChildAgent && if (sp.Firstname == FirstName && sp.Lastname == SurName)
sp.Firstname == FirstName &&
sp.Lastname == SurName)
{ {
// kick client... // kick client...
if (alert != null) if (alert != null)
@ -2726,17 +2723,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
CheckThreatLevel(ThreatLevel.None, "osGetAvatarList"); CheckThreatLevel(ThreatLevel.None, "osGetAvatarList");
LSL_List result = new LSL_List(); LSL_List result = new LSL_List();
World.ForEachScenePresence(delegate (ScenePresence avatar) World.ForEachRootScenePresence(delegate (ScenePresence avatar)
{ {
if (avatar != null && avatar.UUID != m_host.OwnerID) if (avatar != null && avatar.UUID != m_host.OwnerID)
{ {
if (avatar.IsChildAgent == false) result.Add(new LSL_String(avatar.UUID.ToString()));
{ OpenMetaverse.Vector3 ap = avatar.AbsolutePosition;
result.Add(new LSL_String(avatar.UUID.ToString())); result.Add(new LSL_Vector(ap.X, ap.Y, ap.Z));
OpenMetaverse.Vector3 ap = avatar.AbsolutePosition; result.Add(new LSL_String(avatar.Name));
result.Add(new LSL_Vector(ap.X, ap.Y, ap.Z));
result.Add(new LSL_String(avatar.Name));
}
} }
}); });

View File

@ -442,7 +442,10 @@ namespace OpenSim.Region.ScriptEngine.XEngine
IScriptInstance instance = GetInstance(itemId); IScriptInstance instance = GetInstance(itemId);
if (instance == null) if (instance == null)
{ {
MainConsole.Instance.OutputFormat("Error - No item found with id {0}", itemId); // Commented out for now since this will cause false reports on simulators with more than
// one scene where the current command line set region is 'root' (which causes commands to
// go to both regions... (sigh)
// MainConsole.Instance.OutputFormat("Error - No item found with id {0}", itemId);
return; return;
} }
else else