* Slowly but surely working my way towards Regionality...

afrisby
lbsa71 2007-09-21 06:00:34 +00:00
parent 80a9b81448
commit 34043cd351
3 changed files with 44 additions and 44 deletions

View File

@ -504,11 +504,11 @@ namespace OpenSim.Region.Environment.Scenes
} }
} }
public void StartAnimation(IClientAPI client, LLUUID animID, int seq) public void StartAnimation(LLUUID animID, int seq, LLUUID agentId)
{ {
ForEachScenePresence(delegate(ScenePresence presence) Broadcast(delegate(IClientAPI client)
{ {
presence.ControllingClient.SendAnimation(animID, seq, client.AgentId); client.SendAnimation(animID, seq, agentId);
}); });
} }

View File

@ -367,6 +367,10 @@ namespace OpenSim.Region.Environment.Scenes
updateLock.ReleaseMutex(); updateLock.ReleaseMutex();
} }
/// <summary>
/// Perform delegate action on all clients subscribing to updates from this region.
/// </summary>
/// <returns></returns>
internal void Broadcast(Action<IClientAPI> whatToDo) internal void Broadcast(Action<IClientAPI> whatToDo)
{ {
m_region.Broadcast(whatToDo); m_region.Broadcast(whatToDo);
@ -775,7 +779,6 @@ namespace OpenSim.Region.Environment.Scenes
client.SendKillObject(avatar.RegionHandle, avatar.LocalId); client.SendKillObject(avatar.RegionHandle, avatar.LocalId);
}); });
ForEachScenePresence( ForEachScenePresence(
delegate(ScenePresence presence) delegate(ScenePresence presence)
{ {
@ -897,10 +900,18 @@ namespace OpenSim.Region.Environment.Scenes
} }
public void SendKillObject(uint localID) public void SendKillObject(uint localID)
{
Broadcast(delegate(IClientAPI client)
{
client.SendKillObject(m_regionHandle, localID);
});
}
public void NotifyMyCoarseLocationChange()
{ {
ForEachScenePresence(delegate(ScenePresence presence) ForEachScenePresence(delegate(ScenePresence presence)
{ {
presence.ControllingClient.SendKillObject(m_regionHandle, localID); presence.CoarseLocationChange();
}); });
} }

View File

@ -60,8 +60,8 @@ namespace OpenSim.Region.Environment.Scenes
public bool IsRestrictedToRegion = false; public bool IsRestrictedToRegion = false;
private bool m_newForce = false; private bool m_newForce = false;
private bool newAvatar = false; private bool m_newAvatar = false;
private bool newCoarseLocations = true; private bool m_newCoarseLocations = true;
protected RegionInfo m_regionInfo; protected RegionInfo m_regionInfo;
protected ulong crossingFromRegion = 0; protected ulong crossingFromRegion = 0;
@ -279,7 +279,7 @@ namespace OpenSim.Region.Environment.Scenes
//temporary until we move some code into the body classes //temporary until we move some code into the body classes
if (newAvatar) if (m_newAvatar)
{ {
//do we need to use newAvatar? not sure so have added this to kill the compile warning //do we need to use newAvatar? not sure so have added this to kill the compile warning
} }
@ -338,7 +338,7 @@ namespace OpenSim.Region.Environment.Scenes
public void MakeAvatarPhysical(LLVector3 pos, bool isFlying) public void MakeAvatarPhysical(LLVector3 pos, bool isFlying)
{ {
newAvatar = true; m_newAvatar = true;
m_isChildAgent = false; m_isChildAgent = false;
AbsolutePosition = pos; AbsolutePosition = pos;
@ -402,7 +402,7 @@ namespace OpenSim.Region.Environment.Scenes
visualParams[i] = visualParam[i].ParamValue; visualParams[i] = visualParam[i].ParamValue;
} }
SendArrearanceToAllOtherAgents(); SendAppearanceToAllOtherAgents();
} }
/// <summary> /// <summary>
@ -541,10 +541,10 @@ namespace OpenSim.Region.Environment.Scenes
{ {
SendPrimUpdates(); SendPrimUpdates();
if (newCoarseLocations) if (m_newCoarseLocations)
{ {
SendCoarseLocations(); SendCoarseLocations();
newCoarseLocations = false; m_newCoarseLocations = false;
} }
if (m_isChildAgent == false) if (m_isChildAgent == false)
@ -605,13 +605,9 @@ namespace OpenSim.Region.Environment.Scenes
/// </summary> /// </summary>
public void SendTerseUpdateToAllClients() public void SendTerseUpdateToAllClients()
{ {
m_scene.ForEachScenePresence(delegate(ScenePresence presence) m_scene.Broadcast( SendTerseUpdateToClient );
{
SendTerseUpdateToClient(presence.m_controllingClient);
});
} }
public void SendCoarseLocations() public void SendCoarseLocations()
{ {
List<LLVector3> CoarseLocations = new List<LLVector3>(); List<LLVector3> CoarseLocations = new List<LLVector3>();
@ -629,19 +625,10 @@ namespace OpenSim.Region.Environment.Scenes
public void CoarseLocationChange() public void CoarseLocationChange()
{ {
newCoarseLocations = true; m_newCoarseLocations = true;
} }
private void NotifyMyCoarseLocationChange()
{
m_scene.ForEachScenePresence(delegate(ScenePresence presence)
{
if (presence != this)
{
presence.CoarseLocationChange();
}
});
}
/// <summary> /// <summary>
@ -681,11 +668,11 @@ namespace OpenSim.Region.Environment.Scenes
if (!m_isChildAgent) if (!m_isChildAgent)
{ {
m_scene.InformClientOfNeighbours(m_controllingClient); m_scene.InformClientOfNeighbours(m_controllingClient);
newAvatar = false; m_newAvatar = false;
} }
SendFullUpdateToAllClients(); SendFullUpdateToAllClients();
SendArrearanceToAllOtherAgents(); SendAppearanceToAllOtherAgents();
} }
/// <summary> /// <summary>
@ -697,7 +684,7 @@ namespace OpenSim.Region.Environment.Scenes
m_controllingClient.SendWearables(Wearables); m_controllingClient.SendWearables(Wearables);
//this.SendFullUpdateToAllClients(); //this.SendFullUpdateToAllClients();
//this.SendArrearanceToAllOtherAgents(); //this.SendAppearanceToAllOtherAgents();
m_scene.SendAllSceneObjectsToClient(this); m_scene.SendAllSceneObjectsToClient(this);
m_controllingClient.SendViewerTime(m_scene.TimePhase); m_controllingClient.SendViewerTime(m_scene.TimePhase);
@ -716,11 +703,14 @@ namespace OpenSim.Region.Environment.Scenes
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
public void SendArrearanceToAllOtherAgents() public void SendAppearanceToAllOtherAgents()
{ {
m_scene.ForEachScenePresence(delegate(ScenePresence scenePresence) m_scene.ForEachScenePresence(delegate(ScenePresence scenePresence)
{
if (scenePresence != this)
{ {
SendAppearanceToOtherAgent(scenePresence); SendAppearanceToOtherAgent(scenePresence);
}
}); });
} }
@ -743,11 +733,11 @@ namespace OpenSim.Region.Environment.Scenes
{ {
CurrentAnimation = animID; CurrentAnimation = animID;
AnimationSeq = seq; AnimationSeq = seq;
LLUUID sourceAgentId = m_controllingClient.AgentId;
m_scene.ForEachScenePresence(delegate(ScenePresence scenePresence) m_scene.Broadcast(delegate(IClientAPI client)
{ {
scenePresence.m_controllingClient.SendAnimation(animID, seq, client.SendAnimation(animID, seq, sourceAgentId);
m_controllingClient.AgentId);
}); });
} }
@ -771,7 +761,7 @@ namespace OpenSim.Region.Environment.Scenes
if (OnSignificantClientMovement != null) if (OnSignificantClientMovement != null)
{ {
OnSignificantClientMovement(m_controllingClient); OnSignificantClientMovement(m_controllingClient);
NotifyMyCoarseLocationChange(); m_scene.NotifyMyCoarseLocationChange();
} }
} }
} }
@ -845,14 +835,13 @@ namespace OpenSim.Region.Environment.Scenes
m_physicsActor.Flying); m_physicsActor.Flying);
if (res) if (res)
{ {
//TODO: following line is hard coded to port 9000, really need to change this as soon as possible
AgentCircuitData circuitdata = m_controllingClient.RequestClientInfo(); AgentCircuitData circuitdata = m_controllingClient.RequestClientInfo();
string capsPath = Util.GetCapsURL(m_controllingClient.AgentId); string capsPath = Util.GetCapsURL(m_controllingClient.AgentId);
m_controllingClient.CrossRegion(neighbourHandle, newpos, vel, neighbourRegion.ExternalEndPoint, m_controllingClient.CrossRegion(neighbourHandle, newpos, vel, neighbourRegion.ExternalEndPoint,
capsPath); capsPath);
MakeChildAgent(); MakeChildAgent();
m_scene.SendKillObject(m_localId); m_scene.SendKillObject(m_localId);
NotifyMyCoarseLocationChange(); m_scene.NotifyMyCoarseLocationChange();
} }
} }
} }