moved vehicle from SOG to SOP
parent
736fb0b41d
commit
b77d354e6d
|
@ -36,7 +36,7 @@ using OpenSim.Region.Framework.Scenes.Serialization;
|
|||
|
||||
namespace OpenSim.Region.Framework.Scenes
|
||||
{
|
||||
public class SOGVehicle
|
||||
public class SOPVehicle
|
||||
{
|
||||
public VehicleData vd;
|
||||
|
||||
|
@ -45,7 +45,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
get { return vd.m_type; }
|
||||
}
|
||||
|
||||
public SOGVehicle()
|
||||
public SOPVehicle()
|
||||
{
|
||||
vd = new VehicleData();
|
||||
ProcessTypeChange(Vehicle.TYPE_NONE); // is needed?
|
|
@ -115,90 +115,6 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
private bool m_suspendUpdates;
|
||||
private List<ScenePresence> m_linkedAvatars = new List<ScenePresence>();
|
||||
|
||||
private SOGVehicle m_vehicle = null;
|
||||
|
||||
public int VehicleType
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_vehicle == null)
|
||||
return (int)Vehicle.TYPE_NONE;
|
||||
else
|
||||
return (int)m_vehicle.Type;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_vehicle = null;
|
||||
if (value == (int)Vehicle.TYPE_NONE)
|
||||
{
|
||||
if (RootPart.PhysActor != null)
|
||||
RootPart.PhysActor.VehicleType = (int)Vehicle.TYPE_NONE;
|
||||
return;
|
||||
}
|
||||
m_vehicle = new SOGVehicle();
|
||||
m_vehicle.ProcessTypeChange((Vehicle)value);
|
||||
{
|
||||
if (RootPart.PhysActor != null)
|
||||
RootPart.PhysActor.VehicleType = value;
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public void SetVehicleFlags(int param, bool remove)
|
||||
{
|
||||
if (m_vehicle == null)
|
||||
return;
|
||||
|
||||
m_vehicle.ProcessVehicleFlags(param, remove);
|
||||
|
||||
if (RootPart.PhysActor != null)
|
||||
{
|
||||
RootPart.PhysActor.VehicleFlags(param, remove);
|
||||
}
|
||||
}
|
||||
|
||||
public void SetVehicleFloatParam(int param, float value)
|
||||
{
|
||||
if (m_vehicle == null)
|
||||
return;
|
||||
|
||||
m_vehicle.ProcessFloatVehicleParam((Vehicle)param, value);
|
||||
|
||||
if (RootPart.PhysActor != null)
|
||||
{
|
||||
RootPart.PhysActor.VehicleFloatParam(param, value);
|
||||
}
|
||||
}
|
||||
|
||||
public void SetVehicleVectorParam(int param, Vector3 value)
|
||||
{
|
||||
if (m_vehicle == null)
|
||||
return;
|
||||
|
||||
m_vehicle.ProcessVectorVehicleParam((Vehicle)param, value);
|
||||
|
||||
if (RootPart.PhysActor != null)
|
||||
{
|
||||
RootPart.PhysActor.VehicleVectorParam(param, value);
|
||||
}
|
||||
}
|
||||
|
||||
public void SetVehicleRotationParam(int param, Quaternion rotation)
|
||||
{
|
||||
if (m_vehicle == null)
|
||||
return;
|
||||
|
||||
m_vehicle.ProcessRotationVehicleParam((Vehicle)param, rotation);
|
||||
|
||||
if (RootPart.PhysActor != null)
|
||||
{
|
||||
RootPart.PhysActor.VehicleRotationParam(param, rotation);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public bool areUpdatesSuspended
|
||||
{
|
||||
get
|
||||
|
@ -1782,8 +1698,6 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
// ResetChildPrimPhysicsPositions();
|
||||
if (m_rootPart.PhysActor != null)
|
||||
{
|
||||
if (m_vehicle != null)
|
||||
m_vehicle.SetVehicle(m_rootPart.PhysActor);
|
||||
m_rootPart.PhysActor.Building = false;
|
||||
}
|
||||
}
|
||||
|
@ -1791,10 +1705,6 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
{
|
||||
// Apply physics to the root prim
|
||||
m_rootPart.ApplyPhysics(m_rootPart.GetEffectiveObjectFlags(), m_rootPart.VolumeDetectActive, false);
|
||||
if (m_rootPart.PhysActor != null && m_vehicle != null)
|
||||
{
|
||||
m_vehicle.SetVehicle(m_rootPart.PhysActor);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -310,6 +310,9 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
private UUID m_collisionSound;
|
||||
private float m_collisionSoundVolume;
|
||||
|
||||
|
||||
private SOPVehicle m_vehicle = null;
|
||||
|
||||
#endregion Fields
|
||||
|
||||
// ~SceneObjectPart()
|
||||
|
@ -1556,8 +1559,14 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
{
|
||||
PhysActor.SOPName = this.Name; // save object into the PhysActor so ODE internals know the joint/body info
|
||||
PhysActor.SetMaterial(Material);
|
||||
|
||||
// if root part apply vehicle
|
||||
if (m_vehicle != null && LocalId == ParentGroup.RootPart.LocalId)
|
||||
m_vehicle.SetVehicle(PhysActor);
|
||||
|
||||
DoPhysicsPropertyUpdate(RigidBody, true);
|
||||
PhysActor.SetVolumeDetect(VolumeDetectActive ? 1 : 0);
|
||||
|
||||
if (!building)
|
||||
PhysActor.Building = false;
|
||||
}
|
||||
|
@ -3168,39 +3177,90 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
public int VehicleType
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_vehicle == null)
|
||||
return (int)Vehicle.TYPE_NONE;
|
||||
else
|
||||
return (int)m_vehicle.Type;
|
||||
}
|
||||
set
|
||||
{
|
||||
SetVehicleType(value);
|
||||
}
|
||||
}
|
||||
|
||||
public void SetVehicleType(int type)
|
||||
{
|
||||
if (ParentGroup.IsDeleted)
|
||||
m_vehicle = null;
|
||||
if (type == (int)Vehicle.TYPE_NONE)
|
||||
{
|
||||
if (_parentID ==0 && PhysActor != null)
|
||||
PhysActor.VehicleType = (int)Vehicle.TYPE_NONE;
|
||||
return;
|
||||
ParentGroup.VehicleType = type;
|
||||
}
|
||||
m_vehicle = new SOPVehicle();
|
||||
m_vehicle.ProcessTypeChange((Vehicle)type);
|
||||
{
|
||||
if (_parentID ==0 && PhysActor != null)
|
||||
PhysActor.VehicleType = type;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
public void SetVehicleFlags(int param, bool remove)
|
||||
{
|
||||
if (ParentGroup.IsDeleted)
|
||||
if (m_vehicle == null)
|
||||
return;
|
||||
ParentGroup.SetVehicleFlags(param, remove);
|
||||
|
||||
m_vehicle.ProcessVehicleFlags(param, remove);
|
||||
|
||||
if (_parentID ==0 && PhysActor != null)
|
||||
{
|
||||
PhysActor.VehicleFlags(param, remove);
|
||||
}
|
||||
}
|
||||
|
||||
public void SetVehicleFloatParam(int param, float value)
|
||||
{
|
||||
if (ParentGroup.IsDeleted)
|
||||
if (m_vehicle == null)
|
||||
return;
|
||||
ParentGroup.SetVehicleFloatParam(param, value);
|
||||
|
||||
m_vehicle.ProcessFloatVehicleParam((Vehicle)param, value);
|
||||
|
||||
if (_parentID == 0 && PhysActor != null)
|
||||
{
|
||||
PhysActor.VehicleFloatParam(param, value);
|
||||
}
|
||||
}
|
||||
|
||||
public void SetVehicleVectorParam(int param, Vector3 value)
|
||||
{
|
||||
if (ParentGroup.IsDeleted)
|
||||
if (m_vehicle == null)
|
||||
return;
|
||||
ParentGroup.SetVehicleVectorParam(param, value);
|
||||
|
||||
m_vehicle.ProcessVectorVehicleParam((Vehicle)param, value);
|
||||
|
||||
if (_parentID == 0 && PhysActor != null)
|
||||
{
|
||||
PhysActor.VehicleVectorParam(param, value);
|
||||
}
|
||||
}
|
||||
|
||||
public void SetVehicleRotationParam(int param, Quaternion rotation)
|
||||
{
|
||||
if (ParentGroup.IsDeleted)
|
||||
if (m_vehicle == null)
|
||||
return;
|
||||
ParentGroup.SetVehicleRotationParam(param, rotation);
|
||||
|
||||
m_vehicle.ProcessRotationVehicleParam((Vehicle)param, rotation);
|
||||
|
||||
if (_parentID == 0 && PhysActor != null)
|
||||
{
|
||||
PhysActor.VehicleRotationParam(param, rotation);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -4380,6 +4440,11 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
m_localId);
|
||||
|
||||
PhysActor.SetMaterial(Material);
|
||||
|
||||
// if root part apply vehicle
|
||||
if (m_vehicle != null && LocalId == ParentGroup.RootPart.LocalId)
|
||||
m_vehicle.SetVehicle(PhysActor);
|
||||
|
||||
DoPhysicsPropertyUpdate(UsePhysics, true);
|
||||
|
||||
if (!ParentGroup.IsDeleted)
|
||||
|
|
Loading…
Reference in New Issue