fix some issue on parcels loading and make parcels dwell show something. Resolution is 2.5min aprox.
parent
25ca8695f3
commit
cb21caae77
|
@ -97,7 +97,9 @@ namespace OpenSim.Framework
|
||||||
private bool _mediaLoop = false;
|
private bool _mediaLoop = false;
|
||||||
private bool _obscureMusic = false;
|
private bool _obscureMusic = false;
|
||||||
private bool _obscureMedia = false;
|
private bool _obscureMedia = false;
|
||||||
private float _dwell = 0;
|
|
||||||
|
private float m_dwell = 0;
|
||||||
|
public double LastDwellTimeMS;
|
||||||
|
|
||||||
public bool SeeAVs { get; set; }
|
public bool SeeAVs { get; set; }
|
||||||
public bool AnyAVSounds { get; set; }
|
public bool AnyAVSounds { get; set; }
|
||||||
|
@ -111,11 +113,12 @@ namespace OpenSim.Framework
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return _dwell;
|
return m_dwell;
|
||||||
}
|
}
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
_dwell = value;
|
m_dwell = value;
|
||||||
|
LastDwellTimeMS = Util.GetTimeStampMS();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -735,6 +738,7 @@ namespace OpenSim.Framework
|
||||||
SeeAVs = true;
|
SeeAVs = true;
|
||||||
AnyAVSounds = true;
|
AnyAVSounds = true;
|
||||||
GroupAVSounds = true;
|
GroupAVSounds = true;
|
||||||
|
LastDwellTimeMS = Util.GetTimeStampMS();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -784,7 +788,7 @@ namespace OpenSim.Framework
|
||||||
landData._obscureMedia = _obscureMedia;
|
landData._obscureMedia = _obscureMedia;
|
||||||
landData._simwideArea = _simwideArea;
|
landData._simwideArea = _simwideArea;
|
||||||
landData._simwidePrims = _simwidePrims;
|
landData._simwidePrims = _simwidePrims;
|
||||||
landData._dwell = _dwell;
|
landData.m_dwell = m_dwell;
|
||||||
landData.SeeAVs = SeeAVs;
|
landData.SeeAVs = SeeAVs;
|
||||||
landData.AnyAVSounds = AnyAVSounds;
|
landData.AnyAVSounds = AnyAVSounds;
|
||||||
landData.GroupAVSounds = GroupAVSounds;
|
landData.GroupAVSounds = GroupAVSounds;
|
||||||
|
|
|
@ -3114,7 +3114,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
float dwell = 0.0f;
|
float dwell = 0.0f;
|
||||||
IDwellModule dwellModule = m_scene.RequestModuleInterface<IDwellModule>();
|
IDwellModule dwellModule = m_scene.RequestModuleInterface<IDwellModule>();
|
||||||
if (dwellModule != null)
|
if (dwellModule != null)
|
||||||
dwell = dwellModule.GetDwell(land.GlobalID);
|
dwell = dwellModule.GetDwell(land);
|
||||||
ParcelInfoReplyPacket reply = (ParcelInfoReplyPacket)PacketPool.Instance.GetPacket(PacketType.ParcelInfoReply);
|
ParcelInfoReplyPacket reply = (ParcelInfoReplyPacket)PacketPool.Instance.GetPacket(PacketType.ParcelInfoReply);
|
||||||
reply.AgentData.AgentID = m_agentId;
|
reply.AgentData.AgentID = m_agentId;
|
||||||
reply.Data.ParcelID = parcelID;
|
reply.Data.ParcelID = parcelID;
|
||||||
|
|
|
@ -53,7 +53,7 @@ using GridRegion = OpenSim.Services.Interfaces.GridRegion;
|
||||||
namespace OpenSim.Region.CoreModules.World.Land
|
namespace OpenSim.Region.CoreModules.World.Land
|
||||||
{
|
{
|
||||||
[Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "DefaultDwellModule")]
|
[Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "DefaultDwellModule")]
|
||||||
public class DefaultDwellModule : IDwellModule, INonSharedRegionModule
|
public class DefaultDwellModule : INonSharedRegionModule, IDwellModule
|
||||||
{
|
{
|
||||||
private Scene m_scene;
|
private Scene m_scene;
|
||||||
private IConfigSource m_Config;
|
private IConfigSource m_Config;
|
||||||
|
@ -88,16 +88,21 @@ namespace OpenSim.Region.CoreModules.World.Land
|
||||||
return;
|
return;
|
||||||
|
|
||||||
m_scene = scene;
|
m_scene = scene;
|
||||||
|
m_scene.RegisterModuleInterface<IDwellModule>(this);
|
||||||
m_scene.EventManager.OnNewClient += OnNewClient;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RegionLoaded(Scene scene)
|
public void RegionLoaded(Scene scene)
|
||||||
{
|
{
|
||||||
|
if (!m_Enabled)
|
||||||
|
return;
|
||||||
|
m_scene.EventManager.OnNewClient += OnNewClient;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RemoveRegion(Scene scene)
|
public void RemoveRegion(Scene scene)
|
||||||
{
|
{
|
||||||
|
if (!m_Enabled)
|
||||||
|
return;
|
||||||
|
m_scene.EventManager.OnNewClient -= OnNewClient;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Close()
|
public void Close()
|
||||||
|
@ -115,15 +120,26 @@ namespace OpenSim.Region.CoreModules.World.Land
|
||||||
if (parcel == null)
|
if (parcel == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
client.SendParcelDwellReply(localID, parcel.LandData.GlobalID, parcel.LandData.Dwell);
|
LandData land = parcel.LandData;
|
||||||
|
if(land!= null)
|
||||||
|
client.SendParcelDwellReply(localID, land.GlobalID, land.Dwell);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public int GetDwell(UUID parcelID)
|
public int GetDwell(UUID parcelID)
|
||||||
{
|
{
|
||||||
ILandObject parcel = m_scene.LandChannel.GetLandObject(parcelID);
|
ILandObject parcel = m_scene.LandChannel.GetLandObject(parcelID);
|
||||||
if (parcel != null && parcel.LandData != null)
|
if (parcel != null && parcel.LandData != null)
|
||||||
return (int)parcel.LandData.Dwell;
|
return (int)(parcel.LandData.Dwell + 0.5f);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int GetDwell(LandData land)
|
||||||
|
{
|
||||||
|
if (land != null)
|
||||||
|
return (int)(land.Dwell + 0.5f);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -439,15 +439,6 @@ namespace OpenSim.Region.CoreModules.World.Land
|
||||||
if (parcelAvatarIsEntering != null &&
|
if (parcelAvatarIsEntering != null &&
|
||||||
avatar.currentParcelUUID != parcelAvatarIsEntering.LandData.GlobalID)
|
avatar.currentParcelUUID != parcelAvatarIsEntering.LandData.GlobalID)
|
||||||
{
|
{
|
||||||
if(!avatar.IsNPC && avatar.currentParcelUUID != UUID.Zero)
|
|
||||||
{
|
|
||||||
ILandObject last = GetLandObject(avatar.currentParcelUUID);
|
|
||||||
if(last != null)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
SendLandUpdate(avatar, parcelAvatarIsEntering);
|
SendLandUpdate(avatar, parcelAvatarIsEntering);
|
||||||
avatar.currentParcelUUID = parcelAvatarIsEntering.LandData.GlobalID;
|
avatar.currentParcelUUID = parcelAvatarIsEntering.LandData.GlobalID;
|
||||||
EnforceBans(parcelAvatarIsEntering, avatar);
|
EnforceBans(parcelAvatarIsEntering, avatar);
|
||||||
|
@ -602,10 +593,8 @@ namespace OpenSim.Region.CoreModules.World.Land
|
||||||
/// The land object being added.
|
/// The land object being added.
|
||||||
/// Will return null if this overlaps with an existing parcel that has not had its bitmap adjusted.
|
/// Will return null if this overlaps with an existing parcel that has not had its bitmap adjusted.
|
||||||
/// </param>
|
/// </param>
|
||||||
public ILandObject AddLandObject(ILandObject land)
|
public ILandObject AddLandObject(ILandObject new_land)
|
||||||
{
|
{
|
||||||
ILandObject new_land = land.Copy();
|
|
||||||
|
|
||||||
// Only now can we add the prim counts to the land object - we rely on the global ID which is generated
|
// Only now can we add the prim counts to the land object - we rely on the global ID which is generated
|
||||||
// as a random UUID inside LandData initialization
|
// as a random UUID inside LandData initialization
|
||||||
if (m_primCountModule != null)
|
if (m_primCountModule != null)
|
||||||
|
@ -1621,8 +1610,7 @@ namespace OpenSim.Region.CoreModules.World.Land
|
||||||
|
|
||||||
private void IncomingLandObjectFromStorage(LandData data)
|
private void IncomingLandObjectFromStorage(LandData data)
|
||||||
{
|
{
|
||||||
ILandObject new_land = new LandObject(data.OwnerID, data.IsGroupOwned, m_scene);
|
ILandObject new_land = new LandObject(data.OwnerID, data.IsGroupOwned, m_scene, data);
|
||||||
new_land.LandData = data.Copy();
|
|
||||||
|
|
||||||
new_land.SetLandBitmapFromByteArray();
|
new_land.SetLandBitmapFromByteArray();
|
||||||
AddLandObject(new_land);
|
AddLandObject(new_land);
|
||||||
|
|
|
@ -270,7 +270,7 @@ namespace OpenSim.Region.CoreModules.World.Land
|
||||||
m_scene = scene;
|
m_scene = scene;
|
||||||
}
|
}
|
||||||
|
|
||||||
public LandObject(UUID owner_id, bool is_group_owned, Scene scene)
|
public LandObject(UUID owner_id, bool is_group_owned, Scene scene, LandData data = null)
|
||||||
{
|
{
|
||||||
m_scene = scene;
|
m_scene = scene;
|
||||||
if (m_scene == null)
|
if (m_scene == null)
|
||||||
|
@ -278,12 +278,17 @@ namespace OpenSim.Region.CoreModules.World.Land
|
||||||
else
|
else
|
||||||
LandBitmap = new bool[m_scene.RegionInfo.RegionSizeX / landUnit, m_scene.RegionInfo.RegionSizeY / landUnit];
|
LandBitmap = new bool[m_scene.RegionInfo.RegionSizeX / landUnit, m_scene.RegionInfo.RegionSizeY / landUnit];
|
||||||
|
|
||||||
|
if(data == null)
|
||||||
LandData = new LandData();
|
LandData = new LandData();
|
||||||
|
else
|
||||||
|
LandData = data;
|
||||||
|
|
||||||
LandData.OwnerID = owner_id;
|
LandData.OwnerID = owner_id;
|
||||||
if (is_group_owned)
|
if (is_group_owned)
|
||||||
LandData.GroupID = owner_id;
|
LandData.GroupID = owner_id;
|
||||||
else
|
else
|
||||||
LandData.GroupID = UUID.Zero;
|
LandData.GroupID = UUID.Zero;
|
||||||
|
|
||||||
LandData.IsGroupOwned = is_group_owned;
|
LandData.IsGroupOwned = is_group_owned;
|
||||||
|
|
||||||
m_scene.EventManager.OnFrame += OnFrame;
|
m_scene.EventManager.OnFrame += OnFrame;
|
||||||
|
@ -1812,6 +1817,37 @@ namespace OpenSim.Region.CoreModules.World.Land
|
||||||
ExpireAccessList();
|
ExpireAccessList();
|
||||||
m_expiryCounter = 0;
|
m_expiryCounter = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// need to update dwell here bc landdata has no parent info
|
||||||
|
if(LandData != null)
|
||||||
|
{
|
||||||
|
double now = Util.GetTimeStampMS();
|
||||||
|
double elapsed = now - LandData.LastDwellTimeMS;
|
||||||
|
if(elapsed > 150000) //2.5 minutes resolution / throttle
|
||||||
|
{
|
||||||
|
float dwell = LandData.Dwell;
|
||||||
|
double cur = dwell * 60000.0;
|
||||||
|
double decay = 1.5e-8 * cur * elapsed;
|
||||||
|
cur -= decay;
|
||||||
|
if(cur < 0)
|
||||||
|
cur = 0;
|
||||||
|
|
||||||
|
UUID lgid = LandData.GlobalID;
|
||||||
|
m_scene.ForEachRootScenePresence(delegate(ScenePresence sp)
|
||||||
|
{
|
||||||
|
if(sp.IsNPC || sp.IsLoggingIn || sp.IsDeleted || sp.currentParcelUUID != lgid)
|
||||||
|
return;
|
||||||
|
cur += (now - sp.ParcelDwellTickMS);
|
||||||
|
sp.ParcelDwellTickMS = now;
|
||||||
|
});
|
||||||
|
|
||||||
|
float newdwell = (float)(cur * 1.666666666667e-5);
|
||||||
|
LandData.Dwell = newdwell;
|
||||||
|
|
||||||
|
if(Math.Abs(newdwell - dwell) > 1.0)
|
||||||
|
m_scene.EventManager.TriggerLandObjectAdded(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ExpireAccessList()
|
private void ExpireAccessList()
|
||||||
|
|
|
@ -33,5 +33,6 @@ namespace OpenSim.Region.Framework.Interfaces
|
||||||
public interface IDwellModule
|
public interface IDwellModule
|
||||||
{
|
{
|
||||||
int GetDwell(UUID parcelID);
|
int GetDwell(UUID parcelID);
|
||||||
|
int GetDwell(LandData land);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -170,6 +170,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
private bool m_previusParcelHide = false;
|
private bool m_previusParcelHide = false;
|
||||||
private bool m_currentParcelHide = false;
|
private bool m_currentParcelHide = false;
|
||||||
private object parcelLock = new Object();
|
private object parcelLock = new Object();
|
||||||
|
public double ParcelDwellTickMS;
|
||||||
|
|
||||||
public UUID currentParcelUUID
|
public UUID currentParcelUUID
|
||||||
{
|
{
|
||||||
|
@ -182,6 +183,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
bool checksame = true;
|
bool checksame = true;
|
||||||
if (value != m_currentParcelUUID)
|
if (value != m_currentParcelUUID)
|
||||||
{
|
{
|
||||||
|
ParcelDwellTickMS = Util.GetTimeStampMS();
|
||||||
m_previusParcelHide = m_currentParcelHide;
|
m_previusParcelHide = m_currentParcelHide;
|
||||||
m_previusParcelUUID = m_currentParcelUUID;
|
m_previusParcelUUID = m_currentParcelUUID;
|
||||||
checksame = false;
|
checksame = false;
|
||||||
|
@ -2141,6 +2143,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
m_previusParcelUUID = UUID.Zero;
|
m_previusParcelUUID = UUID.Zero;
|
||||||
m_currentParcelHide = false;
|
m_currentParcelHide = false;
|
||||||
m_currentParcelUUID = UUID.Zero;
|
m_currentParcelUUID = UUID.Zero;
|
||||||
|
ParcelDwellTickMS = Util.GetTimeStampMS();
|
||||||
|
|
||||||
if(!IsNPC)
|
if(!IsNPC)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue