Implement temp-on-rez objecte really being temporary

0.6.0-stable
Melanie Thielker 2008-10-03 15:32:44 +00:00
parent fbc813e658
commit 3902149e1b
3 changed files with 49 additions and 6 deletions

View File

@ -760,6 +760,10 @@ namespace OpenSim.Region.Environment.Scenes
if (m_frame % m_update_presences == 0)
m_innerScene.UpdatePresences();
// Delete temp-on-rez stuff
if (m_frame % m_update_backup == 0)
CleanTempObjects();
if (Region_Status != RegionStatus.SlaveScene)
{
if (m_frame % m_update_events == 0)
@ -2069,6 +2073,12 @@ namespace OpenSim.Region.Environment.Scenes
}
else
{
// Remove, then add, to ensure the expire
// time is refreshed. Wouldn't do to
// have it poof before the avatar gets
// there.
//
RootPrim.RemFlag(PrimFlags.TemporaryOnRez);
RootPrim.AddFlag(PrimFlags.TemporaryOnRez);
}
}
@ -4183,5 +4193,27 @@ namespace OpenSim.Region.Environment.Scenes
break;
}
}
public void CleanTempObjects()
{
List<EntityBase> objs = GetEntities();
foreach (EntityBase obj in objs)
{
if (obj is SceneObjectGroup)
{
SceneObjectGroup grp = (SceneObjectGroup)obj;
if (grp.RootPart != null)
{
if ((grp.RootPart.Flags & PrimFlags.TemporaryOnRez) != 0)
{
if (grp.RootPart.Expires <= DateTime.Now)
DeleteSceneObject(grp);
}
}
}
}
}
}
}

View File

@ -2081,6 +2081,9 @@ namespace OpenSim.Region.Environment.Scenes
{
SceneObjectPart selectionPart = GetChildPart(localID);
if (data[47] != 0) // Temporary
DetachFromBackup();
if (selectionPart != null)
{
lock (m_parts)
@ -2089,7 +2092,7 @@ namespace OpenSim.Region.Environment.Scenes
{
if (part.Scale.X > 10.0 || part.Scale.Y > 10.0 || part.Scale.Z > 10.0)
{
data[47] = 0; // Reset physics
data[46] = 0; // Reset physics
break;
}
}

View File

@ -361,6 +361,7 @@ namespace OpenSim.Region.Environment.Scenes
private uint _everyoneMask = (uint)PermissionMask.None;
private uint _nextOwnerMask = (uint)PermissionMask.All;
private PrimFlags _flags = 0;
private DateTime m_expires;
public UUID CreatorID {
get
@ -451,6 +452,13 @@ namespace OpenSim.Region.Environment.Scenes
set { m_particleSystem = value; }
}
[XmlIgnore]
public DateTime Expires
{
get { return m_expires; }
set { m_expires = value; }
}
/// <summary>
/// The position of the entire group that this prim belongs to.
/// </summary>
@ -1050,15 +1058,15 @@ namespace OpenSim.Region.Environment.Scenes
public void AddFlag(PrimFlags flag)
{
// PrimFlags prevflag = Flags;
//uint objflags = Flags;
if ((ObjectFlags & (uint) flag) == 0)
{
//Console.WriteLine("Adding flag: " + ((PrimFlags) flag).ToString());
_flags |= flag;
if (flag == PrimFlags.TemporaryOnRez)
Expires = DateTime.Now + new TimeSpan(600000000);
}
//uint currflag = (uint)Flags;
// System.Console.WriteLine("Aprev: " + prevflag.ToString() + " curr: " + Flags.ToString());
//ScheduleFullUpdate();
}
/// <summary>