handle change of hide avatars flag. Parcel limits edition still need work

avinationmerge
UbitUmarov 2014-08-01 18:59:08 +01:00
parent cb43dff2dc
commit ef1f37cf20
2 changed files with 116 additions and 69 deletions

View File

@ -194,7 +194,8 @@ namespace OpenSim.Region.CoreModules.World.Land
client.OnParcelEjectUser += ClientOnParcelEjectUser; client.OnParcelEjectUser += ClientOnParcelEjectUser;
client.OnParcelFreezeUser += ClientOnParcelFreezeUser; client.OnParcelFreezeUser += ClientOnParcelFreezeUser;
client.OnSetStartLocationRequest += ClientOnSetHome; client.OnSetStartLocationRequest += ClientOnSetHome;
/* avatar is still a child here position is unknow
/* avatar is still a child here position is unknown
EntityBase presenceEntity; EntityBase presenceEntity;
if (m_scene.Entities.TryGetValue(client.AgentId, out presenceEntity) && presenceEntity is ScenePresence) if (m_scene.Entities.TryGetValue(client.AgentId, out presenceEntity) && presenceEntity is ScenePresence)
{ {
@ -334,12 +335,13 @@ namespace OpenSim.Region.CoreModules.World.Land
if (!position.HasValue) if (!position.HasValue)
return; return;
bool isFlying = avatar.PhysicsActor.Flying; // land should have no word on avatar physics
avatar.RemoveFromPhysicalScene(); // bool isFlying = avatar.PhysicsActor.Flying;
// avatar.RemoveFromPhysicalScene();
avatar.AbsolutePosition = (Vector3)position; avatar.AbsolutePosition = (Vector3)position;
avatar.AddToPhysicalScene(isFlying); // avatar.AddToPhysicalScene(isFlying);
} }
public void SendYouAreRestrictedNotice(ScenePresence avatar) public void SendYouAreRestrictedNotice(ScenePresence avatar)
@ -388,13 +390,15 @@ namespace OpenSim.Region.CoreModules.World.Land
public void sendClientInitialLandInfo(IClientAPI remoteClient) public void sendClientInitialLandInfo(IClientAPI remoteClient)
{ {
SendParcelOverlay(remoteClient);
ScenePresence avatar; ScenePresence avatar;
if (!m_scene.TryGetScenePresence(remoteClient.AgentId, out avatar)) if (!m_scene.TryGetScenePresence(remoteClient.AgentId, out avatar))
return; return;
if (avatar.IsChildAgent) if (avatar.IsChildAgent)
return; return;
SendParcelOverlay(remoteClient);
ILandObject over = GetLandObject(avatar.AbsolutePosition.X,avatar.AbsolutePosition.Y); ILandObject over = GetLandObject(avatar.AbsolutePosition.X,avatar.AbsolutePosition.Y);
if (over == null) if (over == null)
return; return;
@ -416,8 +420,8 @@ namespace OpenSim.Region.CoreModules.World.Land
if (force || NotsameID) if (force || NotsameID)
{ {
over.SendLandUpdateToClient(avatar.ControllingClient); over.SendLandUpdateToClient(avatar.ControllingClient);
if (NotsameID) SendParcelOverlay(avatar.ControllingClient);
avatar.currentParcelUUID = over.LandData.GlobalID; avatar.currentParcelUUID = over.LandData.GlobalID;
m_scene.EventManager.TriggerAvatarEnteringNewParcel(avatar, over.LandData.LocalID, m_scene.EventManager.TriggerAvatarEnteringNewParcel(avatar, over.LandData.LocalID,
m_scene.RegionInfo.RegionID); m_scene.RegionInfo.RegionID);
} }
@ -1190,15 +1194,16 @@ namespace OpenSim.Region.CoreModules.World.Land
bool needOverlay = false; bool needOverlay = false;
if (land.UpdateLandProperties(args, remote_client, out snap_selection, out needOverlay)) if (land.UpdateLandProperties(args, remote_client, out snap_selection, out needOverlay))
{ {
//parcel //the proprieties to who changed it
land.SendLandProperties(-10000, true, LandChannel.LAND_RESULT_SINGLE, remote_client); land.SendLandProperties(0, true, LandChannel.LAND_RESULT_SINGLE, remote_client);
if (needOverlay) if (needOverlay)
{ {
UUID parcelID = land.LandData.GlobalID;
m_scene.ForEachRootScenePresence(delegate(ScenePresence avatar) m_scene.ForEachRootScenePresence(delegate(ScenePresence avatar)
{ {
if (avatar.IsChildAgent) if (avatar.IsDeleted || avatar.IsChildAgent)
return; return;
IClientAPI client = avatar.ControllingClient; IClientAPI client = avatar.ControllingClient;
@ -1209,6 +1214,8 @@ namespace OpenSim.Region.CoreModules.World.Land
if (client != remote_client || land != aland) if (client != remote_client || land != aland)
aland.SendLandProperties(0, false, LandChannel.LAND_RESULT_SINGLE, client); aland.SendLandProperties(0, false, LandChannel.LAND_RESULT_SINGLE, client);
} }
if (avatar.currentParcelUUID == parcelID)
avatar.currentParcelUUID = parcelID; // force parcel flags review
}); });
} }
} }

View File

@ -153,15 +153,21 @@ namespace OpenSim.Region.Framework.Scenes
{ {
lock (parcelLock) lock (parcelLock)
{ {
m_previusParcelHide = m_currentParcelHide; bool oldhide = m_currentParcelHide;
m_previusParcelUUID = m_currentParcelUUID; bool check = true;
if (value != m_currentParcelUUID)
{
m_previusParcelHide = m_currentParcelHide;
m_previusParcelUUID = m_currentParcelUUID;
check = false;
}
m_currentParcelUUID = value; m_currentParcelUUID = value;
m_currentParcelHide = false; m_currentParcelHide = false;
ILandObject land = m_scene.LandChannel.GetLandObject(AbsolutePosition.X, AbsolutePosition.Y); ILandObject land = m_scene.LandChannel.GetLandObject(AbsolutePosition.X, AbsolutePosition.Y);
if (land != null && !land.LandData.SeeAVs) if (land != null && !land.LandData.SeeAVs)
m_currentParcelHide = true; m_currentParcelHide = true;
if (m_previusParcelUUID != UUID.Zero) if (m_previusParcelUUID != UUID.Zero)
ParcelCrossCheck(); ParcelCrossCheck(m_currentParcelUUID,m_previusParcelUUID,m_currentParcelHide, m_previusParcelHide, oldhide,check);
} }
} }
} }
@ -195,17 +201,7 @@ namespace OpenSim.Region.Framework.Scenes
{ {
get get
{ {
try return m_currentParcelHide;
{
lock (parcelLock)
{
return m_currentParcelHide;
}
}
catch
{
return false;
}
} }
} }
@ -5312,7 +5308,8 @@ namespace OpenSim.Region.Framework.Scenes
} }
private void ParcelCrossCheck() private void ParcelCrossCheck(UUID currentParcelUUID,UUID previusParcelUUID,
bool currentParcelHide, bool previusParcelHide, bool oldhide,bool check)
{ {
List<ScenePresence> killsToSendto = new List<ScenePresence>(); List<ScenePresence> killsToSendto = new List<ScenePresence>();
List<ScenePresence> killsToSendme = new List<ScenePresence>(); List<ScenePresence> killsToSendme = new List<ScenePresence>();
@ -5320,82 +5317,125 @@ namespace OpenSim.Region.Framework.Scenes
List<ScenePresence> viewsToSendme = new List<ScenePresence>(); List<ScenePresence> viewsToSendme = new List<ScenePresence>();
List<ScenePresence> allpresences = null; List<ScenePresence> allpresences = null;
if (m_currentParcelHide) if (check)
{ {
// now on a private parcel if (currentParcelUUID == null || oldhide == currentParcelHide)
return;
allpresences = m_scene.GetScenePresences(); allpresences = m_scene.GetScenePresences();
if (m_previusParcelHide && m_previusParcelUUID != UUID.Zero) if (oldhide)
{ { // where private
foreach (ScenePresence p in allpresences) foreach (ScenePresence p in allpresences)
{ {
if (p.IsChildAgent || p.IsDeleted || p == this || p.ControllingClient == null || !p.ControllingClient.IsActive) if (p.IsChildAgent || p.IsDeleted || p == this || p.ControllingClient == null || !p.ControllingClient.IsActive)
continue; continue;
// only those on previus parcel need receive kills // those on not on parcel see me
if (m_previusParcelUUID == p.currentParcelUUID) if (currentParcelUUID != p.currentParcelUUID)
{
killsToSendto.Add(p); // they dont see me
killsToSendme.Add(p); // i dont see them
}
// only those on new parcel need see
if (m_currentParcelUUID == p.currentParcelUUID)
{ {
viewsToSendto.Add(p); // they see me viewsToSendto.Add(p); // they see me
viewsToSendme.Add(p); // i see them
} }
} }
} } // where private end
else
{
//was on a public area
allpresences = m_scene.GetScenePresences();
else
{ // where public
foreach (ScenePresence p in allpresences) foreach (ScenePresence p in allpresences)
{ {
if (p.IsChildAgent || p.IsDeleted || p == this || p.ControllingClient == null || !p.ControllingClient.IsActive) if (p.IsChildAgent || p.IsDeleted || p == this || p.ControllingClient == null || !p.ControllingClient.IsActive)
continue; continue;
// those not on new parcel dont see me // those not on parcel dont see me
if (m_currentParcelUUID != p.currentParcelUUID) if (currentParcelUUID != p.currentParcelUUID)
{ {
killsToSendto.Add(p); // they dont see me killsToSendto.Add(p); // they dont see me
} }
else
{
viewsToSendme.Add(p); // i see those on it
}
} }
} } // where public end
allpresences.Clear();
} // now on a private parcel end
allpresences.Clear();
}
else else
{ {
// now on public parcel if (currentParcelHide)
if (m_previusParcelHide && m_previusParcelUUID != UUID.Zero)
{ {
// was on private area // now on a private parcel
allpresences = m_scene.GetScenePresences(); allpresences = m_scene.GetScenePresences();
foreach (ScenePresence p in allpresences) if (previusParcelHide && previusParcelUUID != UUID.Zero)
{ {
if (p.IsChildAgent || p.IsDeleted || p == this || p.ControllingClient == null || !p.ControllingClient.IsActive) foreach (ScenePresence p in allpresences)
continue;
// only those old parcel need receive kills
if (m_previusParcelUUID == p.currentParcelUUID)
{ {
killsToSendme.Add(p); // i dont see them if (p.IsChildAgent || p.IsDeleted || p == this || p.ControllingClient == null || !p.ControllingClient.IsActive)
} continue;
else
{ // only those on previus parcel need receive kills
viewsToSendto.Add(p); // they see me if (previusParcelUUID == p.currentParcelUUID)
{
killsToSendto.Add(p); // they dont see me
killsToSendme.Add(p); // i dont see them
}
// only those on new parcel need see
if (currentParcelUUID == p.currentParcelUUID)
{
viewsToSendto.Add(p); // they see me
viewsToSendme.Add(p); // i see them
}
} }
} }
} else
{
//was on a public area
allpresences = m_scene.GetScenePresences();
foreach (ScenePresence p in allpresences)
{
if (p.IsChildAgent || p.IsDeleted || p == this || p.ControllingClient == null || !p.ControllingClient.IsActive)
continue;
// those not on new parcel dont see me
if (currentParcelUUID != p.currentParcelUUID)
{
killsToSendto.Add(p); // they dont see me
}
else
{
viewsToSendme.Add(p); // i see those on it
}
}
}
allpresences.Clear();
} // now on a private parcel end
else else
return; // was on a public area also {
} // now on public parcel end // now on public parcel
if (previusParcelHide && previusParcelUUID != UUID.Zero)
{
// was on private area
allpresences = m_scene.GetScenePresences();
foreach (ScenePresence p in allpresences)
{
if (p.IsChildAgent || p.IsDeleted || p == this || p.ControllingClient == null || !p.ControllingClient.IsActive)
continue;
// only those old parcel need receive kills
if (previusParcelUUID == p.currentParcelUUID)
{
killsToSendme.Add(p); // i dont see them
}
else
{
viewsToSendto.Add(p); // they see me
}
}
}
else
return; // was on a public area also
} // now on public parcel end
}
// send the things // send the things
// kill main avatar object // kill main avatar object