diff options
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SOPVehicle.cs (renamed from OpenSim/Region/Framework/Scenes/SOGVehicle.cs) | 6 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 90 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 87 |
3 files changed, 79 insertions, 104 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SOGVehicle.cs b/OpenSim/Region/Framework/Scenes/SOPVehicle.cs index 5651de3..39786bd 100644 --- a/OpenSim/Region/Framework/Scenes/SOGVehicle.cs +++ b/OpenSim/Region/Framework/Scenes/SOPVehicle.cs | |||
@@ -36,7 +36,7 @@ using OpenSim.Region.Framework.Scenes.Serialization; | |||
36 | 36 | ||
37 | namespace OpenSim.Region.Framework.Scenes | 37 | namespace OpenSim.Region.Framework.Scenes |
38 | { | 38 | { |
39 | public class SOGVehicle | 39 | public class SOPVehicle |
40 | { | 40 | { |
41 | public VehicleData vd; | 41 | public VehicleData vd; |
42 | 42 | ||
@@ -45,7 +45,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
45 | get { return vd.m_type; } | 45 | get { return vd.m_type; } |
46 | } | 46 | } |
47 | 47 | ||
48 | public SOGVehicle() | 48 | public SOPVehicle() |
49 | { | 49 | { |
50 | vd = new VehicleData(); | 50 | vd = new VehicleData(); |
51 | ProcessTypeChange(Vehicle.TYPE_NONE); // is needed? | 51 | ProcessTypeChange(Vehicle.TYPE_NONE); // is needed? |
@@ -259,7 +259,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
259 | vd.m_bankingEfficiency = 0; | 259 | vd.m_bankingEfficiency = 0; |
260 | vd.m_bankingMix = 1; | 260 | vd.m_bankingMix = 1; |
261 | vd.m_bankingTimescale = 1000; | 261 | vd.m_bankingTimescale = 1000; |
262 | vd.m_verticalAttractionEfficiency = 0; | 262 | vd.m_verticalAttractionEfficiency = 0; |
263 | vd.m_verticalAttractionTimescale = 1000; | 263 | vd.m_verticalAttractionTimescale = 1000; |
264 | 264 | ||
265 | vd.m_flags = (VehicleFlag)0; | 265 | vd.m_flags = (VehicleFlag)0; |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 1cce4c0..3427199 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | |||
@@ -115,90 +115,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
115 | private bool m_suspendUpdates; | 115 | private bool m_suspendUpdates; |
116 | private List<ScenePresence> m_linkedAvatars = new List<ScenePresence>(); | 116 | private List<ScenePresence> m_linkedAvatars = new List<ScenePresence>(); |
117 | 117 | ||
118 | private SOGVehicle m_vehicle = null; | ||
119 | |||
120 | public int VehicleType | ||
121 | { | ||
122 | get | ||
123 | { | ||
124 | if (m_vehicle == null) | ||
125 | return (int)Vehicle.TYPE_NONE; | ||
126 | else | ||
127 | return (int)m_vehicle.Type; | ||
128 | } | ||
129 | set | ||
130 | { | ||
131 | m_vehicle = null; | ||
132 | if (value == (int)Vehicle.TYPE_NONE) | ||
133 | { | ||
134 | if (RootPart.PhysActor != null) | ||
135 | RootPart.PhysActor.VehicleType = (int)Vehicle.TYPE_NONE; | ||
136 | return; | ||
137 | } | ||
138 | m_vehicle = new SOGVehicle(); | ||
139 | m_vehicle.ProcessTypeChange((Vehicle)value); | ||
140 | { | ||
141 | if (RootPart.PhysActor != null) | ||
142 | RootPart.PhysActor.VehicleType = value; | ||
143 | return; | ||
144 | } | ||
145 | |||
146 | } | ||
147 | } | ||
148 | |||
149 | public void SetVehicleFlags(int param, bool remove) | ||
150 | { | ||
151 | if (m_vehicle == null) | ||
152 | return; | ||
153 | |||
154 | m_vehicle.ProcessVehicleFlags(param, remove); | ||
155 | |||
156 | if (RootPart.PhysActor != null) | ||
157 | { | ||
158 | RootPart.PhysActor.VehicleFlags(param, remove); | ||
159 | } | ||
160 | } | ||
161 | |||
162 | public void SetVehicleFloatParam(int param, float value) | ||
163 | { | ||
164 | if (m_vehicle == null) | ||
165 | return; | ||
166 | |||
167 | m_vehicle.ProcessFloatVehicleParam((Vehicle)param, value); | ||
168 | |||
169 | if (RootPart.PhysActor != null) | ||
170 | { | ||
171 | RootPart.PhysActor.VehicleFloatParam(param, value); | ||
172 | } | ||
173 | } | ||
174 | |||
175 | public void SetVehicleVectorParam(int param, Vector3 value) | ||
176 | { | ||
177 | if (m_vehicle == null) | ||
178 | return; | ||
179 | |||
180 | m_vehicle.ProcessVectorVehicleParam((Vehicle)param, value); | ||
181 | |||
182 | if (RootPart.PhysActor != null) | ||
183 | { | ||
184 | RootPart.PhysActor.VehicleVectorParam(param, value); | ||
185 | } | ||
186 | } | ||
187 | |||
188 | public void SetVehicleRotationParam(int param, Quaternion rotation) | ||
189 | { | ||
190 | if (m_vehicle == null) | ||
191 | return; | ||
192 | |||
193 | m_vehicle.ProcessRotationVehicleParam((Vehicle)param, rotation); | ||
194 | |||
195 | if (RootPart.PhysActor != null) | ||
196 | { | ||
197 | RootPart.PhysActor.VehicleRotationParam(param, rotation); | ||
198 | } | ||
199 | } | ||
200 | |||
201 | |||
202 | public bool areUpdatesSuspended | 118 | public bool areUpdatesSuspended |
203 | { | 119 | { |
204 | get | 120 | get |
@@ -1782,8 +1698,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
1782 | // ResetChildPrimPhysicsPositions(); | 1698 | // ResetChildPrimPhysicsPositions(); |
1783 | if (m_rootPart.PhysActor != null) | 1699 | if (m_rootPart.PhysActor != null) |
1784 | { | 1700 | { |
1785 | if (m_vehicle != null) | ||
1786 | m_vehicle.SetVehicle(m_rootPart.PhysActor); | ||
1787 | m_rootPart.PhysActor.Building = false; | 1701 | m_rootPart.PhysActor.Building = false; |
1788 | } | 1702 | } |
1789 | } | 1703 | } |
@@ -1791,10 +1705,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
1791 | { | 1705 | { |
1792 | // Apply physics to the root prim | 1706 | // Apply physics to the root prim |
1793 | m_rootPart.ApplyPhysics(m_rootPart.GetEffectiveObjectFlags(), m_rootPart.VolumeDetectActive, false); | 1707 | m_rootPart.ApplyPhysics(m_rootPart.GetEffectiveObjectFlags(), m_rootPart.VolumeDetectActive, false); |
1794 | if (m_rootPart.PhysActor != null && m_vehicle != null) | ||
1795 | { | ||
1796 | m_vehicle.SetVehicle(m_rootPart.PhysActor); | ||
1797 | } | ||
1798 | } | 1708 | } |
1799 | } | 1709 | } |
1800 | 1710 | ||
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 6438694..eb59ffd 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | |||
@@ -310,6 +310,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
310 | private UUID m_collisionSound; | 310 | private UUID m_collisionSound; |
311 | private float m_collisionSoundVolume; | 311 | private float m_collisionSoundVolume; |
312 | 312 | ||
313 | |||
314 | private SOPVehicle m_vehicle = null; | ||
315 | |||
313 | #endregion Fields | 316 | #endregion Fields |
314 | 317 | ||
315 | // ~SceneObjectPart() | 318 | // ~SceneObjectPart() |
@@ -1556,8 +1559,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
1556 | { | 1559 | { |
1557 | PhysActor.SOPName = this.Name; // save object into the PhysActor so ODE internals know the joint/body info | 1560 | PhysActor.SOPName = this.Name; // save object into the PhysActor so ODE internals know the joint/body info |
1558 | PhysActor.SetMaterial(Material); | 1561 | PhysActor.SetMaterial(Material); |
1562 | |||
1563 | // if root part apply vehicle | ||
1564 | if (m_vehicle != null && LocalId == ParentGroup.RootPart.LocalId) | ||
1565 | m_vehicle.SetVehicle(PhysActor); | ||
1566 | |||
1559 | DoPhysicsPropertyUpdate(RigidBody, true); | 1567 | DoPhysicsPropertyUpdate(RigidBody, true); |
1560 | PhysActor.SetVolumeDetect(VolumeDetectActive ? 1 : 0); | 1568 | PhysActor.SetVolumeDetect(VolumeDetectActive ? 1 : 0); |
1569 | |||
1561 | if (!building) | 1570 | if (!building) |
1562 | PhysActor.Building = false; | 1571 | PhysActor.Building = false; |
1563 | } | 1572 | } |
@@ -3168,39 +3177,90 @@ namespace OpenSim.Region.Framework.Scenes | |||
3168 | } | 3177 | } |
3169 | } | 3178 | } |
3170 | 3179 | ||
3180 | |||
3181 | public int VehicleType | ||
3182 | { | ||
3183 | get | ||
3184 | { | ||
3185 | if (m_vehicle == null) | ||
3186 | return (int)Vehicle.TYPE_NONE; | ||
3187 | else | ||
3188 | return (int)m_vehicle.Type; | ||
3189 | } | ||
3190 | set | ||
3191 | { | ||
3192 | SetVehicleType(value); | ||
3193 | } | ||
3194 | } | ||
3195 | |||
3171 | public void SetVehicleType(int type) | 3196 | public void SetVehicleType(int type) |
3172 | { | 3197 | { |
3173 | if (ParentGroup.IsDeleted) | 3198 | m_vehicle = null; |
3174 | return; | 3199 | if (type == (int)Vehicle.TYPE_NONE) |
3175 | ParentGroup.VehicleType = type; | 3200 | { |
3201 | if (_parentID ==0 && PhysActor != null) | ||
3202 | PhysActor.VehicleType = (int)Vehicle.TYPE_NONE; | ||
3203 | return; | ||
3204 | } | ||
3205 | m_vehicle = new SOPVehicle(); | ||
3206 | m_vehicle.ProcessTypeChange((Vehicle)type); | ||
3207 | { | ||
3208 | if (_parentID ==0 && PhysActor != null) | ||
3209 | PhysActor.VehicleType = type; | ||
3210 | return; | ||
3211 | } | ||
3176 | } | 3212 | } |
3177 | 3213 | ||
3178 | public void SetVehicleFlags(int param, bool remove) | 3214 | public void SetVehicleFlags(int param, bool remove) |
3179 | { | 3215 | { |
3180 | if (ParentGroup.IsDeleted) | 3216 | if (m_vehicle == null) |
3181 | return; | 3217 | return; |
3182 | ParentGroup.SetVehicleFlags(param, remove); | 3218 | |
3219 | m_vehicle.ProcessVehicleFlags(param, remove); | ||
3220 | |||
3221 | if (_parentID ==0 && PhysActor != null) | ||
3222 | { | ||
3223 | PhysActor.VehicleFlags(param, remove); | ||
3224 | } | ||
3183 | } | 3225 | } |
3184 | 3226 | ||
3185 | public void SetVehicleFloatParam(int param, float value) | 3227 | public void SetVehicleFloatParam(int param, float value) |
3186 | { | 3228 | { |
3187 | if (ParentGroup.IsDeleted) | 3229 | if (m_vehicle == null) |
3188 | return; | 3230 | return; |
3189 | ParentGroup.SetVehicleFloatParam(param, value); | 3231 | |
3232 | m_vehicle.ProcessFloatVehicleParam((Vehicle)param, value); | ||
3233 | |||
3234 | if (_parentID == 0 && PhysActor != null) | ||
3235 | { | ||
3236 | PhysActor.VehicleFloatParam(param, value); | ||
3237 | } | ||
3190 | } | 3238 | } |
3191 | 3239 | ||
3192 | public void SetVehicleVectorParam(int param, Vector3 value) | 3240 | public void SetVehicleVectorParam(int param, Vector3 value) |
3193 | { | 3241 | { |
3194 | if (ParentGroup.IsDeleted) | 3242 | if (m_vehicle == null) |
3195 | return; | 3243 | return; |
3196 | ParentGroup.SetVehicleVectorParam(param, value); | 3244 | |
3245 | m_vehicle.ProcessVectorVehicleParam((Vehicle)param, value); | ||
3246 | |||
3247 | if (_parentID == 0 && PhysActor != null) | ||
3248 | { | ||
3249 | PhysActor.VehicleVectorParam(param, value); | ||
3250 | } | ||
3197 | } | 3251 | } |
3198 | 3252 | ||
3199 | public void SetVehicleRotationParam(int param, Quaternion rotation) | 3253 | public void SetVehicleRotationParam(int param, Quaternion rotation) |
3200 | { | 3254 | { |
3201 | if (ParentGroup.IsDeleted) | 3255 | if (m_vehicle == null) |
3202 | return; | 3256 | return; |
3203 | ParentGroup.SetVehicleRotationParam(param, rotation); | 3257 | |
3258 | m_vehicle.ProcessRotationVehicleParam((Vehicle)param, rotation); | ||
3259 | |||
3260 | if (_parentID == 0 && PhysActor != null) | ||
3261 | { | ||
3262 | PhysActor.VehicleRotationParam(param, rotation); | ||
3263 | } | ||
3204 | } | 3264 | } |
3205 | 3265 | ||
3206 | /// <summary> | 3266 | /// <summary> |
@@ -4380,6 +4440,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
4380 | m_localId); | 4440 | m_localId); |
4381 | 4441 | ||
4382 | PhysActor.SetMaterial(Material); | 4442 | PhysActor.SetMaterial(Material); |
4443 | |||
4444 | // if root part apply vehicle | ||
4445 | if (m_vehicle != null && LocalId == ParentGroup.RootPart.LocalId) | ||
4446 | m_vehicle.SetVehicle(PhysActor); | ||
4447 | |||
4383 | DoPhysicsPropertyUpdate(UsePhysics, true); | 4448 | DoPhysicsPropertyUpdate(UsePhysics, true); |
4384 | 4449 | ||
4385 | if (!ParentGroup.IsDeleted) | 4450 | if (!ParentGroup.IsDeleted) |