Merge branch 'master' into careminster

Conflicts:
	OpenSim/Region/Framework/Scenes/ScenePresence.cs
	OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
avinationmerge
Melanie 2012-03-09 02:39:14 +00:00
commit dc5f831ca8
5 changed files with 61 additions and 94 deletions

View File

@ -230,27 +230,9 @@ namespace OpenSim.Region.Framework.Scenes
if (sp.IsChildAgent) if (sp.IsChildAgent)
continue; continue;
if (sp.ParentID != 0) coarseLocations.Add(sp.AbsolutePosition);
{
// sitting avatar avatarUUIDs.Add(sp.UUID);
SceneObjectPart sop = m_parentScene.GetSceneObjectPart(sp.ParentID);
if (sop != null)
{
coarseLocations.Add(sop.AbsolutePosition + sp.OffsetPosition);
avatarUUIDs.Add(sp.UUID);
}
else
{
// we can't find the parent.. ! arg!
coarseLocations.Add(sp.AbsolutePosition);
avatarUUIDs.Add(sp.UUID);
}
}
else
{
coarseLocations.Add(sp.AbsolutePosition);
avatarUUIDs.Add(sp.UUID);
}
} }
} }

View File

@ -438,7 +438,7 @@ namespace OpenSim.Region.Framework.Scenes
{ {
get get
{ {
if (PhysicsActor != null && m_parentID == 0) if (PhysicsActor != null)
{ {
m_pos = PhysicsActor.Position; m_pos = PhysicsActor.Position;
@ -461,12 +461,12 @@ namespace OpenSim.Region.Framework.Scenes
// in the sim unless the avatar is on a sit target. While // in the sim unless the avatar is on a sit target. While
// on a sit target, m_pos will contain the desired offset // on a sit target, m_pos will contain the desired offset
// without the parent rotation applied. // without the parent rotation applied.
if (ParentID != 0) SceneObjectPart sitPart = ParentPart;
{
SceneObjectPart part = ParentPart; if (sitPart != null)
return part.AbsolutePosition + (m_pos * part.GetWorldRotation()); return sitPart.AbsolutePosition + (m_pos * sitPart.GetWorldRotation());
}
} }
return m_pos; return m_pos;
} }
set set
@ -483,7 +483,7 @@ namespace OpenSim.Region.Framework.Scenes
} }
} }
// Don't update while sitting // Don't update while sitting. The PhysicsActor above is null whilst sitting.
if (ParentID == 0) if (ParentID == 0)
{ {
m_pos = value; m_pos = value;
@ -510,6 +510,7 @@ namespace OpenSim.Region.Framework.Scenes
// There is no offset position when not seated // There is no offset position when not seated
if (ParentID == 0) if (ParentID == 0)
return; return;
m_pos = value; m_pos = value;
} }
} }
@ -568,12 +569,10 @@ namespace OpenSim.Region.Framework.Scenes
public bool IsChildAgent { get; set; } public bool IsChildAgent { get; set; }
public uint ParentID /// <summary>
{ /// If the avatar is sitting, the local ID of the prim that it's sitting on. If not sitting then zero.
get { return m_parentID; } /// </summary>
set { m_parentID = value; } public uint ParentID { get; set; }
}
private uint m_parentID;
public UUID ParentUUID public UUID ParentUUID
{ {
@ -582,12 +581,13 @@ namespace OpenSim.Region.Framework.Scenes
} }
private UUID m_parentUUID = UUID.Zero; private UUID m_parentUUID = UUID.Zero;
public SceneObjectPart ParentPart /// <summary>
{ /// If the avatar is sitting, the prim that it's sitting on. If not sitting then null.
get { return m_parentPart; } /// </summary>
set { m_parentPart = value; } /// <remarks>
} /// If you use this property then you must take a reference since another thread could set it to null.
private SceneObjectPart m_parentPart = null; /// </remarks>
public SceneObjectPart ParentPart { get; set; }
public float Health public float Health
{ {
@ -2285,23 +2285,16 @@ namespace OpenSim.Region.Framework.Scenes
// "[SCENE PRESENCE]: Sitting {0} at position {1} ({2} + {3}) on part {4} {5} without sit target", // "[SCENE PRESENCE]: Sitting {0} at position {1} ({2} + {3}) on part {4} {5} without sit target",
// Name, part.AbsolutePosition, m_pos, ParentPosition, part.Name, part.LocalId); // Name, part.AbsolutePosition, m_pos, ParentPosition, part.Name, part.LocalId);
} }
ParentPart = m_scene.GetSceneObjectPart(m_requestedSitTargetID);
ParentID = m_requestedSitTargetID;
Velocity = Vector3.Zero;
RemoveFromPhysicalScene();
Animator.TrySetMovementAnimation(sitAnimation);
SendAvatarDataToAllAgents();
} }
else
{
return;
}
ParentPart = m_scene.GetSceneObjectPart(m_requestedSitTargetID);
if (ParentPart == null)
return;
ParentID = m_requestedSitTargetID;
Velocity = Vector3.Zero;
RemoveFromPhysicalScene();
Animator.TrySetMovementAnimation(sitAnimation);
SendAvatarDataToAllAgents();
} }
public void HandleAgentSitOnGround() public void HandleAgentSitOnGround()

View File

@ -630,33 +630,16 @@ 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.ForEachRootScenePresence(delegate(ScenePresence sp) connectiondata.RegionScene.ForEachRootScenePresence(delegate(ScenePresence sp)
{ {
if (sp.UUID != presence.UUID) if (sp.UUID != presence.UUID)
{ {
if (sp.ParentID != 0) CoarseLocations.Add(sp.AbsolutePosition);
{ AvatarUUIDs.Add(sp.UUID);
// sitting avatar
SceneObjectPart sop = connectiondata.RegionScene.GetSceneObjectPart(sp.ParentID);
if (sop != null)
{
CoarseLocations.Add(sop.AbsolutePosition + sp.AbsolutePosition);
AvatarUUIDs.Add(sp.UUID);
}
else
{
// we can't find the parent.. ! arg!
CoarseLocations.Add(sp.AbsolutePosition);
AvatarUUIDs.Add(sp.UUID);
}
}
else
{
CoarseLocations.Add(sp.AbsolutePosition);
AvatarUUIDs.Add(sp.UUID);
}
} }
}); });
DistributeCourseLocationUpdates(CoarseLocations, AvatarUUIDs, connectiondata, presence); DistributeCourseLocationUpdates(CoarseLocations, AvatarUUIDs, connectiondata, presence);
} }

View File

@ -4213,7 +4213,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
List<String> nametable = new List<String>(); List<String> nametable = new List<String>();
World.ForEachRootScenePresence(delegate(ScenePresence presence) World.ForEachRootScenePresence(delegate(ScenePresence presence)
{ {
if (presence.ParentID != 0 && m_host.ParentGroup.HasChildPrim(presence.ParentID)) SceneObjectPart sitPart = presence.ParentPart;
if (sitPart != null && m_host.ParentGroup.HasChildPrim(sitPart.LocalId))
nametable.Add(presence.ControllingClient.Name); nametable.Add(presence.ControllingClient.Name);
}); });
@ -4844,22 +4845,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
// Find pushee position // Find pushee position
// Pushee Linked? // Pushee Linked?
if (pusheeav.ParentID != 0) SceneObjectPart sitPart = pusheeav.ParentPart;
{ if (sitPart != null)
SceneObjectPart parentobj = World.GetSceneObjectPart(pusheeav.ParentID); PusheePos = sitPart.AbsolutePosition;
if (parentobj != null)
{
PusheePos = parentobj.AbsolutePosition;
}
else
{
PusheePos = pusheeav.AbsolutePosition;
}
}
else else
{
PusheePos = pusheeav.AbsolutePosition; PusheePos = pusheeav.AbsolutePosition;
}
} }
if (!pusheeIsAvatar) if (!pusheeIsAvatar)
@ -6067,7 +6057,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
flags |= ScriptBaseClass.AGENT_IN_AIR; flags |= ScriptBaseClass.AGENT_IN_AIR;
} }
if (agent.ParentID != 0) if (agent.ParentPart != null)
{ {
flags |= ScriptBaseClass.AGENT_ON_OBJECT; flags |= ScriptBaseClass.AGENT_ON_OBJECT;
flags |= ScriptBaseClass.AGENT_SITTING; flags |= ScriptBaseClass.AGENT_SITTING;

View File

@ -45,6 +45,24 @@ namespace OpenSim.Services.Connectors
LogManager.GetLogger( LogManager.GetLogger(
MethodBase.GetCurrentMethod().DeclaringType); MethodBase.GetCurrentMethod().DeclaringType);
private Dictionary<IAssetService, object> m_endpointSerializer = new Dictionary<IAssetService, object>();
private object EndPointLock(IAssetService connector)
{
lock (m_endpointSerializer)
{
object eplock = null;
if (! m_endpointSerializer.TryGetValue(connector, out eplock))
{
eplock = new object();
m_endpointSerializer.Add(connector, eplock);
// m_log.WarnFormat("[WEB UTIL] add a new host to end point serializer {0}",endpoint);
}
return eplock;
}
}
private Dictionary<string, IAssetService> m_connectors = new Dictionary<string, IAssetService>(); private Dictionary<string, IAssetService> m_connectors = new Dictionary<string, IAssetService>();
public HGAssetServiceConnector(IConfigSource source) public HGAssetServiceConnector(IConfigSource source)
@ -197,7 +215,8 @@ namespace OpenSim.Services.Connectors
IAssetService connector = GetConnector(url); IAssetService connector = GetConnector(url);
// Restore the assetID to a simple UUID // Restore the assetID to a simple UUID
asset.ID = assetID; asset.ID = assetID;
return connector.Store(asset); lock (EndPointLock(connector))
return connector.Store(asset);
} }
return String.Empty; return String.Empty;