several changes to parcels access control and scenepresence updates rates
parent
1d131a0c33
commit
41ae6f06e0
|
@ -98,6 +98,7 @@ namespace OpenSim.Region.CoreModules.World.Land
|
||||||
private int m_lastLandLocalID = LandChannel.START_LAND_LOCAL_ID - 1;
|
private int m_lastLandLocalID = LandChannel.START_LAND_LOCAL_ID - 1;
|
||||||
|
|
||||||
private bool m_allowedForcefulBans = true;
|
private bool m_allowedForcefulBans = true;
|
||||||
|
private bool m_showBansLines = true;
|
||||||
private UUID DefaultGodParcelGroup;
|
private UUID DefaultGodParcelGroup;
|
||||||
private string DefaultGodParcelName;
|
private string DefaultGodParcelName;
|
||||||
|
|
||||||
|
@ -107,7 +108,7 @@ namespace OpenSim.Region.CoreModules.World.Land
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Record positions that avatar's are currently being forced to move to due to parcel entry restrictions.
|
/// Record positions that avatar's are currently being forced to move to due to parcel entry restrictions.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private Dictionary<UUID, Vector3> forcedPosition = new Dictionary<UUID, Vector3>();
|
private HashSet<UUID> forcedPosition = new HashSet<UUID>();
|
||||||
|
|
||||||
|
|
||||||
// Enables limiting parcel layer info transmission when doing simple updates
|
// Enables limiting parcel layer info transmission when doing simple updates
|
||||||
|
@ -133,6 +134,9 @@ namespace OpenSim.Region.CoreModules.World.Land
|
||||||
parcelLayerViewDistance = landManagementConfig.GetInt("ParcelLayerViewDistance", parcelLayerViewDistance);
|
parcelLayerViewDistance = landManagementConfig.GetInt("ParcelLayerViewDistance", parcelLayerViewDistance);
|
||||||
DefaultGodParcelGroup = new UUID(landManagementConfig.GetString("DefaultAdministratorGroupUUID", UUID.Zero.ToString()));
|
DefaultGodParcelGroup = new UUID(landManagementConfig.GetString("DefaultAdministratorGroupUUID", UUID.Zero.ToString()));
|
||||||
DefaultGodParcelName = landManagementConfig.GetString("DefaultAdministratorParcelName", "Default Parcel");
|
DefaultGodParcelName = landManagementConfig.GetString("DefaultAdministratorParcelName", "Default Parcel");
|
||||||
|
bool disablebans = landManagementConfig.GetBoolean("DisableParcelBans", !m_allowedForcefulBans);
|
||||||
|
m_allowedForcefulBans = !disablebans;
|
||||||
|
m_showBansLines = landManagementConfig.GetBoolean("ShowParcelBansLines", m_showBansLines);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -212,15 +216,6 @@ 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 unknown
|
|
||||||
EntityBase presenceEntity;
|
|
||||||
if (m_scene.Entities.TryGetValue(client.AgentId, out presenceEntity) && presenceEntity is ScenePresence)
|
|
||||||
{
|
|
||||||
SendLandUpdate((ScenePresence)presenceEntity, true);
|
|
||||||
SendParcelOverlay(client);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void EventMakeChildAgent(ScenePresence avatar)
|
public void EventMakeChildAgent(ScenePresence avatar)
|
||||||
|
@ -316,9 +311,9 @@ namespace OpenSim.Region.CoreModules.World.Land
|
||||||
public List<ILandObject> ParcelsNearPoint(Vector3 position)
|
public List<ILandObject> ParcelsNearPoint(Vector3 position)
|
||||||
{
|
{
|
||||||
List<ILandObject> parcelsNear = new List<ILandObject>();
|
List<ILandObject> parcelsNear = new List<ILandObject>();
|
||||||
for (int x = -4; x <= 4; x += 4)
|
for (int x = -8; x <= 8; x += 4)
|
||||||
{
|
{
|
||||||
for (int y = -4; y <= 4; y += 4)
|
for (int y = -8; y <= 8; y += 4)
|
||||||
{
|
{
|
||||||
ILandObject check = GetLandObject(position.X + x, position.Y + y);
|
ILandObject check = GetLandObject(position.X + x, position.Y + y);
|
||||||
if (check != null)
|
if (check != null)
|
||||||
|
@ -334,17 +329,81 @@ namespace OpenSim.Region.CoreModules.World.Land
|
||||||
return parcelsNear;
|
return parcelsNear;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SendYouAreBannedNotice(ScenePresence avatar)
|
// checks and enforces bans or restrictions
|
||||||
|
// returns true if enforced
|
||||||
|
public bool EnforceBans(ILandObject land, ScenePresence avatar)
|
||||||
{
|
{
|
||||||
if (AllowedForcefulBans)
|
Vector3 agentpos = avatar.AbsolutePosition;
|
||||||
|
float h = m_scene.GetGroundHeight(agentpos.X, agentpos.Y) + LandChannel.BAN_LINE_SAFETY_HEIGHT;
|
||||||
|
float zdif = avatar.AbsolutePosition.Z - h;
|
||||||
|
if (zdif > 0 )
|
||||||
{
|
{
|
||||||
avatar.ControllingClient.SendAlertMessage(
|
forcedPosition.Remove(avatar.UUID);
|
||||||
"You are not allowed on this parcel because you are banned. Please go away.");
|
avatar.lastKnownAllowedPosition = agentpos;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ban = false;
|
||||||
|
string reason = "";
|
||||||
|
if (land.IsRestrictedFromLand(avatar.UUID))
|
||||||
|
{
|
||||||
|
reason = "You do not have access to the parcel";
|
||||||
|
ban = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (land.IsBannedFromLand(avatar.UUID))
|
||||||
|
{
|
||||||
|
if ( m_allowedForcefulBans)
|
||||||
|
{
|
||||||
|
reason ="You are banned from parcel";
|
||||||
|
ban = true;
|
||||||
|
}
|
||||||
|
else if(!ban)
|
||||||
|
{
|
||||||
|
if (forcedPosition.Contains(avatar.UUID))
|
||||||
|
avatar.ControllingClient.SendAlertMessage("You are banned from parcel, please leave by your own will");
|
||||||
|
forcedPosition.Remove(avatar.UUID);
|
||||||
|
avatar.lastKnownAllowedPosition = agentpos;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(ban)
|
||||||
|
{
|
||||||
|
if (!forcedPosition.Contains(avatar.UUID))
|
||||||
|
avatar.ControllingClient.SendAlertMessage(reason);
|
||||||
|
|
||||||
|
if(zdif > -4f)
|
||||||
|
{
|
||||||
|
|
||||||
|
agentpos.Z = h + 4.0f;
|
||||||
|
ForceAvatarToPosition(avatar, agentpos);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (land.ContainsPoint((int)avatar.lastKnownAllowedPosition.X,
|
||||||
|
(int) avatar.lastKnownAllowedPosition.Y))
|
||||||
|
{
|
||||||
|
Vector3? pos = m_scene.GetNearestAllowedPosition(avatar);
|
||||||
|
if (pos == null)
|
||||||
|
{
|
||||||
|
forcedPosition.Remove(avatar.UUID);
|
||||||
|
m_scene.TeleportClientHome(avatar.UUID, avatar.ControllingClient);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
ForceAvatarToPosition(avatar, (Vector3)pos);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ForceAvatarToPosition(avatar, avatar.lastKnownAllowedPosition);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
avatar.ControllingClient.SendAlertMessage(
|
forcedPosition.Remove(avatar.UUID);
|
||||||
"You are not allowed on this parcel because you are banned; however, the grid administrator has disabled ban lines globally. Please obey the land owner's requests or you can be banned from the entire sim!");
|
avatar.lastKnownAllowedPosition = agentpos;
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -360,12 +419,7 @@ namespace OpenSim.Region.CoreModules.World.Land
|
||||||
avatar.Velocity = Vector3.Zero;
|
avatar.Velocity = Vector3.Zero;
|
||||||
if(avatar.IsSatOnObject)
|
if(avatar.IsSatOnObject)
|
||||||
avatar.StandUp();
|
avatar.StandUp();
|
||||||
}
|
forcedPosition.Add(avatar.UUID);
|
||||||
|
|
||||||
public void SendYouAreRestrictedNotice(ScenePresence avatar)
|
|
||||||
{
|
|
||||||
avatar.ControllingClient.SendAlertMessage(
|
|
||||||
"You are not allowed on this parcel because the land owner has restricted access.");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void EventManagerOnAvatarEnteringNewParcel(ScenePresence avatar, int localLandID, UUID regionID)
|
public void EventManagerOnAvatarEnteringNewParcel(ScenePresence avatar, int localLandID, UUID regionID)
|
||||||
|
@ -378,15 +432,20 @@ namespace OpenSim.Region.CoreModules.World.Land
|
||||||
parcelAvatarIsEntering = m_landList[localLandID];
|
parcelAvatarIsEntering = m_landList[localLandID];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (parcelAvatarIsEntering != null)
|
if (parcelAvatarIsEntering != null &&
|
||||||
|
avatar.currentParcelUUID != parcelAvatarIsEntering.LandData.GlobalID)
|
||||||
|
{
|
||||||
|
SendLandUpdate(avatar, parcelAvatarIsEntering);
|
||||||
|
avatar.currentParcelUUID = parcelAvatarIsEntering.LandData.GlobalID;
|
||||||
EnforceBans(parcelAvatarIsEntering, avatar);
|
EnforceBans(parcelAvatarIsEntering, avatar);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SendOutNearestBanLine(IClientAPI client)
|
public void SendOutNearestBanLine(IClientAPI client)
|
||||||
{
|
{
|
||||||
ScenePresence sp = m_scene.GetScenePresence(client.AgentId);
|
ScenePresence sp = m_scene.GetScenePresence(client.AgentId);
|
||||||
if (sp == null)
|
if (sp == null || sp.IsDeleted)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
List<ILandObject> checkLandParcels = ParcelsNearPoint(sp.AbsolutePosition);
|
List<ILandObject> checkLandParcels = ParcelsNearPoint(sp.AbsolutePosition);
|
||||||
|
@ -413,7 +472,6 @@ namespace OpenSim.Region.CoreModules.World.Land
|
||||||
if (!m_scene.TryGetScenePresence(remoteClient.AgentId, out avatar))
|
if (!m_scene.TryGetScenePresence(remoteClient.AgentId, out avatar))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
||||||
if (!avatar.IsChildAgent)
|
if (!avatar.IsChildAgent)
|
||||||
{
|
{
|
||||||
ILandObject over = GetLandObject(avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y);
|
ILandObject over = GetLandObject(avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y);
|
||||||
|
@ -426,77 +484,26 @@ namespace OpenSim.Region.CoreModules.World.Land
|
||||||
SendParcelOverlay(remoteClient);
|
SendParcelOverlay(remoteClient);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SendLandUpdate(ScenePresence avatar, bool force)
|
public void SendLandUpdate(ScenePresence avatar, ILandObject over)
|
||||||
{
|
{
|
||||||
if (avatar.IsChildAgent)
|
if (avatar.IsChildAgent)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ILandObject over = GetLandObjectClipedXY(avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y);
|
|
||||||
|
|
||||||
if (over != null)
|
if (over != null)
|
||||||
{
|
{
|
||||||
bool NotsameID = (avatar.currentParcelUUID != over.LandData.GlobalID);
|
over.SendLandUpdateToClient(avatar.ControllingClient);
|
||||||
if (force || NotsameID)
|
|
||||||
{
|
|
||||||
over.SendLandUpdateToClient(avatar.ControllingClient);
|
|
||||||
// sl doesnt seem to send this now, as it used 2
|
// sl doesnt seem to send this now, as it used 2
|
||||||
// SendParcelOverlay(avatar.ControllingClient);
|
// SendParcelOverlay(avatar.ControllingClient);
|
||||||
avatar.currentParcelUUID = over.LandData.GlobalID;
|
|
||||||
m_scene.EventManager.TriggerAvatarEnteringNewParcel(avatar, over.LandData.LocalID,
|
|
||||||
m_scene.RegionInfo.RegionID);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SendLandUpdate(ScenePresence avatar)
|
public void EventManagerOnSignificantClientMovement(ScenePresence avatar)
|
||||||
{
|
{
|
||||||
SendLandUpdate(avatar, false);
|
if (avatar.IsChildAgent)
|
||||||
}
|
return;
|
||||||
|
|
||||||
public void EventManagerOnSignificantClientMovement(ScenePresence clientAvatar)
|
if ( m_allowedForcefulBans && m_showBansLines)
|
||||||
{
|
SendOutNearestBanLine(avatar.ControllingClient);
|
||||||
SendLandUpdate(clientAvatar);
|
|
||||||
SendOutNearestBanLine(clientAvatar.ControllingClient);
|
|
||||||
ILandObject parcel = GetLandObject(clientAvatar.AbsolutePosition.X, clientAvatar.AbsolutePosition.Y);
|
|
||||||
if (parcel != null)
|
|
||||||
{
|
|
||||||
if (clientAvatar.AbsolutePosition.Z < LandChannel.BAN_LINE_SAFETY_HEIGHT &&
|
|
||||||
clientAvatar.sentMessageAboutRestrictedParcelFlyingDown)
|
|
||||||
{
|
|
||||||
EventManagerOnAvatarEnteringNewParcel(clientAvatar, parcel.LandData.LocalID,
|
|
||||||
m_scene.RegionInfo.RegionID);
|
|
||||||
//They are going under the safety line!
|
|
||||||
if (!parcel.IsBannedFromLand(clientAvatar.UUID))
|
|
||||||
{
|
|
||||||
clientAvatar.sentMessageAboutRestrictedParcelFlyingDown = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (clientAvatar.AbsolutePosition.Z < LandChannel.BAN_LINE_SAFETY_HEIGHT &&
|
|
||||||
parcel.IsBannedFromLand(clientAvatar.UUID))
|
|
||||||
{
|
|
||||||
//once we've sent the message once, keep going toward the target until we are done
|
|
||||||
if (forcedPosition.ContainsKey(clientAvatar.ControllingClient.AgentId))
|
|
||||||
{
|
|
||||||
SendYouAreBannedNotice(clientAvatar);
|
|
||||||
ForceAvatarToPosition(clientAvatar, m_scene.GetNearestAllowedPosition(clientAvatar));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (parcel.IsRestrictedFromLand(clientAvatar.UUID))
|
|
||||||
{
|
|
||||||
//once we've sent the message once, keep going toward the target until we are done
|
|
||||||
if (forcedPosition.ContainsKey(clientAvatar.ControllingClient.AgentId))
|
|
||||||
{
|
|
||||||
SendYouAreRestrictedNotice(clientAvatar);
|
|
||||||
ForceAvatarToPosition(clientAvatar, m_scene.GetNearestAllowedPosition(clientAvatar));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
//when we are finally in a safe place, lets release the forced position lock
|
|
||||||
forcedPosition.Remove(clientAvatar.ControllingClient.AgentId);
|
|
||||||
}
|
|
||||||
EnforceBans(parcel, clientAvatar);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -505,12 +512,22 @@ namespace OpenSim.Region.CoreModules.World.Land
|
||||||
/// <param name="avatar"></param>
|
/// <param name="avatar"></param>
|
||||||
public void EventManagerOnClientMovement(ScenePresence avatar)
|
public void EventManagerOnClientMovement(ScenePresence avatar)
|
||||||
{
|
{
|
||||||
|
if (avatar.IsChildAgent)
|
||||||
|
return;
|
||||||
|
|
||||||
Vector3 pos = avatar.AbsolutePosition;
|
Vector3 pos = avatar.AbsolutePosition;
|
||||||
ILandObject over = GetLandObject(pos.X, pos.Y);
|
ILandObject over = GetLandObject(pos.X, pos.Y);
|
||||||
if (over != null)
|
if (over != null)
|
||||||
{
|
{
|
||||||
if (!over.IsRestrictedFromLand(avatar.UUID) && (!over.IsBannedFromLand(avatar.UUID) || pos.Z >= LandChannel.BAN_LINE_SAFETY_HEIGHT))
|
EnforceBans(over, avatar);
|
||||||
avatar.lastKnownAllowedPosition = pos;
|
pos = avatar.AbsolutePosition;
|
||||||
|
ILandObject newover = GetLandObject(pos.X, pos.Y);
|
||||||
|
if(over != newover || avatar.currentParcelUUID != newover.LandData.GlobalID)
|
||||||
|
{
|
||||||
|
avatar.currentParcelUUID = newover.LandData.GlobalID;
|
||||||
|
m_scene.EventManager.TriggerAvatarEnteringNewParcel(avatar,
|
||||||
|
newover.LandData.LocalID, m_scene.RegionInfo.RegionID);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1216,7 +1233,6 @@ namespace OpenSim.Region.CoreModules.World.Land
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (byteArrayCount > 0)
|
if (byteArrayCount > 0)
|
||||||
|
@ -1965,8 +1981,7 @@ namespace OpenSim.Region.CoreModules.World.Land
|
||||||
returns.Add(e);
|
returns.Add(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
);
|
|
||||||
}
|
}
|
||||||
if (flags == 4) //not target parcel, scripted object
|
if (flags == 4) //not target parcel, scripted object
|
||||||
{
|
{
|
||||||
|
@ -1983,8 +1998,7 @@ namespace OpenSim.Region.CoreModules.World.Land
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
);
|
|
||||||
}
|
}
|
||||||
foreach (SceneObjectGroup ol in returns)
|
foreach (SceneObjectGroup ol in returns)
|
||||||
{
|
{
|
||||||
|
@ -2044,7 +2058,6 @@ namespace OpenSim.Region.CoreModules.World.Land
|
||||||
targetAvatar.ControllingClient.SendAgentAlertMessage("The freeze has worn off; you may go about your business.", false);
|
targetAvatar.ControllingClient.SendAgentAlertMessage("The freeze has worn off; you may go about your business.", false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void ClientOnParcelEjectUser(IClientAPI client, UUID parcelowner, uint flags, UUID target)
|
public void ClientOnParcelEjectUser(IClientAPI client, UUID parcelowner, uint flags, UUID target)
|
||||||
{
|
{
|
||||||
ScenePresence targetAvatar = null;
|
ScenePresence targetAvatar = null;
|
||||||
|
@ -2247,28 +2260,6 @@ namespace OpenSim.Region.CoreModules.World.Land
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void EnforceBans(ILandObject land, ScenePresence avatar)
|
|
||||||
{
|
|
||||||
if (avatar.AbsolutePosition.Z > LandChannel.BAN_LINE_SAFETY_HEIGHT)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (land.IsEitherBannedOrRestricted(avatar.UUID))
|
|
||||||
{
|
|
||||||
if (land.ContainsPoint((int)avatar.lastKnownAllowedPosition.X, (int)avatar.lastKnownAllowedPosition.Y))
|
|
||||||
{
|
|
||||||
Vector3? pos = m_scene.GetNearestAllowedPosition(avatar);
|
|
||||||
if (pos == null)
|
|
||||||
m_scene.TeleportClientHome(avatar.UUID, avatar.ControllingClient);
|
|
||||||
else
|
|
||||||
ForceAvatarToPosition(avatar, (Vector3)pos);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ForceAvatarToPosition(avatar, avatar.lastKnownAllowedPosition);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void AppendParcelReport(StringBuilder report, ILandObject lo)
|
private void AppendParcelReport(StringBuilder report, ILandObject lo)
|
||||||
{
|
{
|
||||||
LandData ld = lo.LandData;
|
LandData ld = lo.LandData;
|
||||||
|
|
|
@ -150,8 +150,12 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
/// Movement updates for agents in neighboring regions are sent directly to clients.
|
/// Movement updates for agents in neighboring regions are sent directly to clients.
|
||||||
/// This value only affects how often agent positions are sent to neighbor regions
|
/// This value only affects how often agent positions are sent to neighbor regions
|
||||||
/// for things such as distance-based update prioritization
|
/// for things such as distance-based update prioritization
|
||||||
|
/// this are the square of real distances
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static readonly float SIGNIFICANT_MOVEMENT = 2.0f;
|
public static readonly float MOVEMENT = .25f;
|
||||||
|
public static readonly float SIGNIFICANT_MOVEMENT = 16.0f;
|
||||||
|
public static readonly float CHILDUPDATES_MOVEMENT = 100.0f;
|
||||||
|
public static readonly float CHILDUPDATES_TIME = 10000f; // min time between child updates (ms)
|
||||||
|
|
||||||
private UUID m_previusParcelUUID = UUID.Zero;
|
private UUID m_previusParcelUUID = UUID.Zero;
|
||||||
private UUID m_currentParcelUUID = UUID.Zero;
|
private UUID m_currentParcelUUID = UUID.Zero;
|
||||||
|
@ -189,6 +193,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
public void sitSOGmoved()
|
public void sitSOGmoved()
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
if (IsDeleted || !IsSatOnObject)
|
if (IsDeleted || !IsSatOnObject)
|
||||||
//what me? nahh
|
//what me? nahh
|
||||||
return;
|
return;
|
||||||
|
@ -201,6 +206,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
UUID parcelID = land.LandData.GlobalID;
|
UUID parcelID = land.LandData.GlobalID;
|
||||||
if (m_currentParcelUUID != parcelID)
|
if (m_currentParcelUUID != parcelID)
|
||||||
currentParcelUUID = parcelID;
|
currentParcelUUID = parcelID;
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -325,6 +331,8 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
private float m_sitAvatarHeight = 2.0f;
|
private float m_sitAvatarHeight = 2.0f;
|
||||||
|
|
||||||
|
private bool childUpdatesActive = false;
|
||||||
|
private int lastChildUpdatesTime;
|
||||||
private Vector3 m_lastChildAgentUpdatePosition;
|
private Vector3 m_lastChildAgentUpdatePosition;
|
||||||
// private Vector3 m_lastChildAgentUpdateCamPosition;
|
// private Vector3 m_lastChildAgentUpdateCamPosition;
|
||||||
|
|
||||||
|
@ -417,6 +425,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
/// Position at which a significant movement was made
|
/// Position at which a significant movement was made
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private Vector3 posLastSignificantMove;
|
private Vector3 posLastSignificantMove;
|
||||||
|
private Vector3 posLastMove;
|
||||||
|
|
||||||
#region For teleports and crossings callbacks
|
#region For teleports and crossings callbacks
|
||||||
|
|
||||||
|
@ -1021,9 +1030,11 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
m_scriptEngines = m_scene.RequestModuleInterfaces<IScriptModule>();
|
m_scriptEngines = m_scene.RequestModuleInterfaces<IScriptModule>();
|
||||||
|
|
||||||
AbsolutePosition = posLastSignificantMove = CameraPosition =
|
AbsolutePosition = posLastMove = posLastSignificantMove = CameraPosition =
|
||||||
m_lastCameraPosition = ControllingClient.StartPos;
|
m_lastCameraPosition = ControllingClient.StartPos;
|
||||||
|
|
||||||
|
childUpdatesActive = true; // disable it for now
|
||||||
|
|
||||||
m_reprioritization_timer = new Timer(world.ReprioritizationInterval);
|
m_reprioritization_timer = new Timer(world.ReprioritizationInterval);
|
||||||
m_reprioritization_timer.Elapsed += new ElapsedEventHandler(Reprioritize);
|
m_reprioritization_timer.Elapsed += new ElapsedEventHandler(Reprioritize);
|
||||||
m_reprioritization_timer.AutoReset = false;
|
m_reprioritization_timer.AutoReset = false;
|
||||||
|
@ -2024,6 +2035,9 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
{
|
{
|
||||||
m_agentTransfer.EnableChildAgents(this);
|
m_agentTransfer.EnableChildAgents(this);
|
||||||
}
|
}
|
||||||
|
// let updates be sent, with some delay
|
||||||
|
lastChildUpdatesTime = Util.EnvironmentTickCount() + 10000;
|
||||||
|
childUpdatesActive = false; // allow them
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2502,7 +2516,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
if ((State & (uint)AgentState.Editing) != 0)
|
if ((State & (uint)AgentState.Editing) != 0)
|
||||||
SendAgentTerseUpdate(this);
|
SendAgentTerseUpdate(this);
|
||||||
|
|
||||||
m_scene.EventManager.TriggerOnClientMovement(this);
|
// m_scene.EventManager.TriggerOnClientMovement(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -3464,7 +3478,8 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
if (Appearance.AvatarSize != m_lastSize && !IsLoggingIn)
|
if (Appearance.AvatarSize != m_lastSize && !IsLoggingIn)
|
||||||
SendAvatarDataToAllAgents();
|
SendAvatarDataToAllAgents();
|
||||||
|
|
||||||
if (!Rotation.ApproxEquals(m_lastRotation, ROTATION_TOLERANCE) ||
|
if (!IsSatOnObject ||
|
||||||
|
!Rotation.ApproxEquals(m_lastRotation, ROTATION_TOLERANCE) ||
|
||||||
!Velocity.ApproxEquals(m_lastVelocity, VELOCITY_TOLERANCE) ||
|
!Velocity.ApproxEquals(m_lastVelocity, VELOCITY_TOLERANCE) ||
|
||||||
!m_pos.ApproxEquals(m_lastPosition, POSITION_TOLERANCE))
|
!m_pos.ApproxEquals(m_lastPosition, POSITION_TOLERANCE))
|
||||||
{
|
{
|
||||||
|
@ -3865,63 +3880,55 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
/// </summary>
|
/// </summary>
|
||||||
protected void CheckForSignificantMovement()
|
protected void CheckForSignificantMovement()
|
||||||
{
|
{
|
||||||
if (Util.GetDistanceTo(AbsolutePosition, posLastSignificantMove) > SIGNIFICANT_MOVEMENT)
|
Vector3 pos = AbsolutePosition;
|
||||||
|
|
||||||
|
Vector3 diff = pos - posLastMove;
|
||||||
|
if (diff.LengthSquared() > MOVEMENT)
|
||||||
{
|
{
|
||||||
posLastSignificantMove = AbsolutePosition;
|
posLastMove = pos;
|
||||||
|
m_scene.EventManager.TriggerOnClientMovement(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
diff = pos - posLastSignificantMove;
|
||||||
|
if (diff.LengthSquared() > SIGNIFICANT_MOVEMENT)
|
||||||
|
{
|
||||||
|
posLastSignificantMove = pos;
|
||||||
m_scene.EventManager.TriggerSignificantClientMovement(this);
|
m_scene.EventManager.TriggerSignificantClientMovement(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Minimum Draw distance is 64 meters, the Radius of the draw distance sphere is 32m
|
if(!childUpdatesActive)
|
||||||
if (Util.GetDistanceTo(AbsolutePosition, m_lastChildAgentUpdatePosition) >= Scene.ChildReprioritizationDistance)
|
|
||||||
{
|
{
|
||||||
m_lastChildAgentUpdatePosition = AbsolutePosition;
|
int tdiff = Util.EnvironmentTickCountSubtract(lastChildUpdatesTime);
|
||||||
// m_lastChildAgentUpdateCamPosition = CameraPosition;
|
if(tdiff > CHILDUPDATES_TIME)
|
||||||
|
{
|
||||||
|
diff = pos - m_lastChildAgentUpdatePosition;
|
||||||
|
if (diff.LengthSquared() > CHILDUPDATES_MOVEMENT)
|
||||||
|
{
|
||||||
|
childUpdatesActive = true;
|
||||||
|
m_lastChildAgentUpdatePosition = pos;
|
||||||
|
// m_lastChildAgentUpdateCamPosition = CameraPosition;
|
||||||
|
|
||||||
/* cadu is not used
|
AgentPosition agentpos = new AgentPosition();
|
||||||
ChildAgentDataUpdate cadu = new ChildAgentDataUpdate();
|
agentpos.AgentID = new UUID(UUID.Guid);
|
||||||
cadu.ActiveGroupID = UUID.Zero.Guid;
|
agentpos.SessionID = ControllingClient.SessionId;
|
||||||
cadu.AgentID = UUID.Guid;
|
agentpos.Size = Appearance.AvatarSize;
|
||||||
cadu.alwaysrun = SetAlwaysRun;
|
agentpos.Center = CameraPosition;
|
||||||
cadu.AVHeight = Appearance.AvatarHeight;
|
agentpos.Far = DrawDistance;
|
||||||
cadu.cameraPosition = CameraPosition;
|
agentpos.Position = AbsolutePosition;
|
||||||
cadu.drawdistance = DrawDistance;
|
agentpos.Velocity = Velocity;
|
||||||
cadu.GroupAccess = 0;
|
agentpos.RegionHandle = RegionHandle;
|
||||||
cadu.Position = AbsolutePosition;
|
agentpos.Throttles = ControllingClient.GetThrottlesPacked(1);
|
||||||
cadu.regionHandle = RegionHandle;
|
|
||||||
|
|
||||||
// Throttles
|
// Let's get this out of the update loop
|
||||||
float multiplier = 1;
|
Util.FireAndForget(
|
||||||
|
o =>
|
||||||
int childRegions = KnownRegionCount;
|
{
|
||||||
if (childRegions != 0)
|
m_scene.SendOutChildAgentUpdates(agentpos, this);
|
||||||
multiplier = 1f / childRegions;
|
lastChildUpdatesTime = Util.EnvironmentTickCount();
|
||||||
|
childUpdatesActive= false;
|
||||||
// Minimum throttle for a child region is 1/4 of the root region throttle
|
}, null, "ScenePresence.SendOutChildAgentUpdates");
|
||||||
if (multiplier <= 0.25f)
|
}
|
||||||
multiplier = 0.25f;
|
}
|
||||||
|
|
||||||
cadu.throttles = ControllingClient.GetThrottlesPacked(multiplier);
|
|
||||||
cadu.Velocity = Velocity;
|
|
||||||
*/
|
|
||||||
AgentPosition agentpos = new AgentPosition();
|
|
||||||
// agentpos.CopyFrom(cadu, ControllingClient.SessionId);
|
|
||||||
|
|
||||||
agentpos.AgentID = new UUID(UUID.Guid);
|
|
||||||
agentpos.SessionID = ControllingClient.SessionId;
|
|
||||||
|
|
||||||
agentpos.Size = Appearance.AvatarSize;
|
|
||||||
|
|
||||||
agentpos.Center = CameraPosition;
|
|
||||||
agentpos.Far = DrawDistance;
|
|
||||||
agentpos.Position = AbsolutePosition;
|
|
||||||
agentpos.Velocity = Velocity;
|
|
||||||
agentpos.RegionHandle = RegionHandle;
|
|
||||||
agentpos.Throttles = ControllingClient.GetThrottlesPacked(1);
|
|
||||||
|
|
||||||
|
|
||||||
// Let's get this out of the update loop
|
|
||||||
Util.FireAndForget(
|
|
||||||
o => m_scene.SendOutChildAgentUpdates(agentpos, this), null, "ScenePresence.SendOutChildAgentUpdates");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue