make sceneobjectpart inherit EntityBase

This commit is contained in:
UbitUmarov
2020-08-07 18:13:41 +01:00
parent 3af36ca26f
commit c25d881ebd
5 changed files with 40 additions and 53 deletions

View File

@@ -37,92 +37,98 @@ namespace OpenSim.Region.Framework.Scenes
{
public abstract class EntityBase : ISceneEntity
{
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
/// <summary>
/// The scene to which this entity belongs
/// </summary>
protected Scene m_scene;
public Scene Scene
{
get { return m_scene; }
}
protected Scene m_scene;
protected UUID m_uuid;
public virtual UUID UUID
{
get { return m_uuid; }
set { m_uuid = value; }
}
protected string m_name;
/// <summary>
/// The name of this entity
/// </summary>
protected string m_name;
public virtual string Name
{
get { return m_name; }
set { m_name = value; }
}
/// <summary>
/// id local to scene
/// </summary>
protected uint m_localId;
public virtual uint LocalId
{
get
{
return m_localId;
}
set
{
m_localId = value;
// m_log.DebugFormat("[ENTITY BASE]: Set part {0} to local id {1}", Name, m_localId);
}
}
/// <summary>
/// Signals whether this entity was in a scene but has since been removed from it.
/// </summary>
public bool IsDeleted { get; protected internal set; }
protected Vector3 m_pos;
/// <summary>
/// Absolute position of this entity in a scene.
/// </summary>
protected Vector3 m_pos;
public virtual Vector3 AbsolutePosition
{
get { return m_pos; }
get
{
return m_pos;
}
set
{
m_pos = value;
}
}
protected Vector3 m_velocity;
protected Vector3 m_rotationalvelocity;
/// <summary>
/// Current velocity of the entity.
/// </summary>
protected Vector3 m_velocity;
public virtual Vector3 Velocity
{
get { return m_velocity; }
set { m_velocity = value; }
}
protected uint m_localId;
public virtual uint LocalId
{
get { return m_localId; }
set
{
m_localId = value;
// m_log.DebugFormat("[ENTITY BASE]: Set part {0} to local id {1}", Name, m_localId);
}
}
protected Vector3 m_rotationalvelocity;
/// <summary>
/// Creates a new Entity (should not occur on it's own)
/// </summary>
public EntityBase()
{
m_name = "(basic entity)";
}
/// <summary>
/// Performs any updates that need to be done at each frame, as opposed to immediately.
/// These included scheduled updates and updates that occur due to physics processing.
/// </summary>
public abstract void Update();
public virtual void Update()
{
}
/// <summary>
/// Copies the entity

View File

@@ -100,7 +100,9 @@ namespace OpenSim.Region.Framework.Scenes
/// </summary>
public void StopScriptInstances()
{
Array.ForEach<SceneObjectPart>(m_parts.GetArray(), p => p.Inventory.StopScriptInstances());
SceneObjectPart[] parts = m_parts.GetArray();
for(int i = 0; i < parts.Length; ++i)
parts[i].Inventory.StopScriptInstances();
}
public void SendReleaseScriptsControl()

View File

@@ -500,8 +500,6 @@ namespace OpenSim.Region.Framework.Scenes
/// <summary>
/// Does this group contain the given part?
/// should be able to remove these methods once we have a entity index in scene
/// </summary>
/// <param name="localID"></param>
/// <returns></returns>
public bool ContainsPart(uint localID)
@@ -612,7 +610,6 @@ namespace OpenSim.Region.Framework.Scenes
// this is needed because physics may not have linksets but just loose SOPs in world
SceneObjectPart[] parts = m_parts.GetArray();
foreach (SceneObjectPart part in parts)
{
if (part != m_rootPart)

View File

@@ -93,7 +93,7 @@ namespace OpenSim.Region.Framework.Scenes
#endregion Enumerations
public class SceneObjectPart : ISceneEntity, IDisposable
public class SceneObjectPart : EntityBase, IDisposable
{
/// <value>
/// Denote all sides of the prim
@@ -325,9 +325,7 @@ namespace OpenSim.Region.Framework.Scenes
//unkown if this will be kept, added as a way of removing the group position from the group class
protected Vector3 m_groupPosition;
protected uint m_localId;
protected Material m_material = OpenMetaverse.Material.Wood;
protected string m_name;
protected Vector3 m_offsetPosition;
protected SceneObjectGroup m_parentGroup;
@@ -335,8 +333,6 @@ namespace OpenSim.Region.Framework.Scenes
protected ulong m_regionHandle;
protected Quaternion m_rotationOffset = Quaternion.Identity;
protected PrimitiveBaseShape m_shape;
protected UUID m_uuid;
protected Vector3 m_velocity;
protected Vector3 m_lastPosition;
protected Quaternion m_lastRotation;
@@ -611,7 +607,7 @@ namespace OpenSim.Region.Framework.Scenes
set { Flags = (PrimFlags)value; }
}
public UUID UUID
public override UUID UUID
{
get { return m_uuid; }
set
@@ -623,18 +619,8 @@ namespace OpenSim.Region.Framework.Scenes
Inventory.ResetObjectID();
}
}
public uint LocalId
{
get { return m_localId; }
set
{
m_localId = value;
// m_log.DebugFormat("[SCENE OBJECT PART]: Set part {0} to local id {1}", Name, m_localId);
}
}
public virtual string Name
public override string Name
{
get { return m_name; }
set
@@ -644,7 +630,6 @@ namespace OpenSim.Region.Framework.Scenes
ParentGroup.InvalidatePartsLinkMaps();
PhysicsActor pa = PhysActor;
if (pa != null)
pa.SOPName = value;
}
@@ -708,14 +693,12 @@ namespace OpenSim.Region.Framework.Scenes
set { m_APIDTarget = value; }
}
protected float APIDDamp
{
get { return m_APIDDamp; }
set { m_APIDDamp = value; }
}
protected float APIDStrength
{
get { return m_APIDStrength; }
@@ -955,7 +938,7 @@ namespace OpenSim.Region.Framework.Scenes
}
/// <summary></summary>
public Vector3 Velocity
public override Vector3 Velocity
{
get
{
@@ -1232,7 +1215,7 @@ namespace OpenSim.Region.Framework.Scenes
//---------------
#region Public Properties with only Get
public Vector3 AbsolutePosition
public override Vector3 AbsolutePosition
{
get
{
@@ -1468,7 +1451,7 @@ namespace OpenSim.Region.Framework.Scenes
set { m_sitAnimation = value; }
}
public UUID invalidCollisionSoundUUID = new UUID("ffffffff-ffff-ffff-ffff-ffffffffffff");
public readonly UUID invalidCollisionSoundUUID = new UUID("ffffffff-ffff-ffff-ffff-ffffffffffff");
// 0 for default collision sounds, -1 for script disabled sound 1 for script defined sound
// runtime thing.. do not persist

View File

@@ -401,7 +401,6 @@ namespace OpenSim.Region.Framework.Scenes
}
}
// If the prim is a sculpt then preserve this information too
if (part.Shape.SculptTexture != UUID.Zero)
GatheredUuids[part.Shape.SculptTexture] = (sbyte)AssetType.Texture;