aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneObjectPart.cs118
1 files changed, 69 insertions, 49 deletions
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
index bf6025e..6c76d54 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
@@ -212,6 +212,7 @@ namespace OpenSim.Region.Environment.Scenes
212 // It's not necessary to persist this 212 // It's not necessary to persist this
213 m_TextureAnimation = new byte[0]; 213 m_TextureAnimation = new byte[0];
214 m_particleSystem = new byte[0]; 214 m_particleSystem = new byte[0];
215 Rezzed = DateTime.Now;
215 } 216 }
216 217
217 public SceneObjectPart(ulong regionHandle, SceneObjectGroup parent, UUID ownerID, uint localID, 218 public SceneObjectPart(ulong regionHandle, SceneObjectGroup parent, UUID ownerID, uint localID,
@@ -237,6 +238,7 @@ namespace OpenSim.Region.Environment.Scenes
237 m_regionHandle = regionHandle; 238 m_regionHandle = regionHandle;
238 m_parentGroup = parent; 239 m_parentGroup = parent;
239 240
241 Rezzed = DateTime.Now;
240 _creationDate = (Int32) (DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds; 242 _creationDate = (Int32) (DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds;
241 _ownerID = ownerID; 243 _ownerID = ownerID;
242 _creatorID = _ownerID; 244 _creatorID = _ownerID;
@@ -311,6 +313,8 @@ namespace OpenSim.Region.Environment.Scenes
311 RotationOffset = rotation; 313 RotationOffset = rotation;
312 ObjectFlags = flags; 314 ObjectFlags = flags;
313 315
316 Rezzed = DateTime.Now;
317
314 m_TextureAnimation = new byte[0]; 318 m_TextureAnimation = new byte[0];
315 m_particleSystem = new byte[0]; 319 m_particleSystem = new byte[0];
316 // Since we don't store script state, this is only a 'temporary' objectflag now 320 // Since we don't store script state, this is only a 'temporary' objectflag now
@@ -339,6 +343,7 @@ namespace OpenSim.Region.Environment.Scenes
339 */ 343 */
340 344
341 //System.Console.WriteLine("SceneObjectPart Deserialize END"); 345 //System.Console.WriteLine("SceneObjectPart Deserialize END");
346 Rezzed = DateTime.Now;
342 } 347 }
343 348
344 #endregion Constructors 349 #endregion Constructors
@@ -362,6 +367,7 @@ namespace OpenSim.Region.Environment.Scenes
362 private uint _nextOwnerMask = (uint)PermissionMask.All; 367 private uint _nextOwnerMask = (uint)PermissionMask.All;
363 private PrimFlags _flags = 0; 368 private PrimFlags _flags = 0;
364 private DateTime m_expires; 369 private DateTime m_expires;
370 private DateTime m_rezzed;
365 371
366 public UUID CreatorID { 372 public UUID CreatorID {
367 get 373 get
@@ -459,6 +465,13 @@ namespace OpenSim.Region.Environment.Scenes
459 set { m_expires = value; } 465 set { m_expires = value; }
460 } 466 }
461 467
468 [XmlIgnore]
469 public DateTime Rezzed
470 {
471 get { return m_rezzed; }
472 set { m_rezzed = value; }
473 }
474
462 /// <summary> 475 /// <summary>
463 /// The position of the entire group that this prim belongs to. 476 /// The position of the entire group that this prim belongs to.
464 /// </summary> 477 /// </summary>
@@ -1270,6 +1283,7 @@ if (m_shape != null) {
1270 dupe._objectSaleType = _objectSaleType; 1283 dupe._objectSaleType = _objectSaleType;
1271 dupe._salePrice = _salePrice; 1284 dupe._salePrice = _salePrice;
1272 dupe._category = _category; 1285 dupe._category = _category;
1286 dupe.m_rezzed = m_rezzed;
1273 1287
1274 dupe.TaskInventory = (TaskInventoryDictionary)dupe.TaskInventory.Clone(); 1288 dupe.TaskInventory = (TaskInventoryDictionary)dupe.TaskInventory.Clone();
1275 1289
@@ -2226,10 +2240,10 @@ if (m_shape != null) {
2226 /// Send a terse update to the client. 2240 /// Send a terse update to the client.
2227 /// </summary> 2241 /// </summary>
2228 /// <param name="remoteClient"></param> 2242 /// <param name="remoteClient"></param>
2229 public void SendTerseUpdate(IClientAPI remoteClient) 2243// public void SendTerseUpdate(IClientAPI remoteClient)
2230 { 2244// {
2231 m_parentGroup.SendPartTerseUpdate(remoteClient, this); 2245// SendTerseUpdateToClient(remoteClient);
2232 } 2246// }
2233 2247
2234 /// <summary> 2248 /// <summary>
2235 /// 2249 ///
@@ -2239,54 +2253,14 @@ if (m_shape != null) {
2239 List<ScenePresence> avatars = m_parentGroup.Scene.GetScenePresences(); 2253 List<ScenePresence> avatars = m_parentGroup.Scene.GetScenePresences();
2240 for (int i = 0; i < avatars.Count; i++) 2254 for (int i = 0; i < avatars.Count; i++)
2241 { 2255 {
2242 m_parentGroup.SendPartTerseUpdate(avatars[i].ControllingClient, this); 2256 SendTerseUpdateToClient(avatars[i].ControllingClient);
2243 }
2244 }
2245
2246 public void SendTerseUpdateToClient(IClientAPI remoteClient)
2247 {
2248 Vector3 lPos;
2249 lPos = OffsetPosition;
2250 Quaternion mRot = RotationOffset;
2251 // TODO: I have no idea why we are making this check. This should be sorted out
2252 if ((ObjectFlags & (uint) PrimFlags.Physics) == 0)
2253 {
2254 remoteClient.SendPrimTerseUpdate(m_regionHandle, (ushort)(m_parentGroup.GetTimeDilation() * (float)ushort.MaxValue), LocalId, lPos, mRot, Velocity, RotationalVelocity, Shape.State, FromAssetID);
2255 }
2256 else
2257 {
2258 remoteClient.SendPrimTerseUpdate(m_regionHandle, (ushort)(m_parentGroup.GetTimeDilation() * (float)ushort.MaxValue), LocalId, lPos, mRot, Velocity,
2259 RotationalVelocity);
2260 //System.Console.WriteLine("LID: " + LocalID + " RVel:" + RotationalVelocity.ToString() + " TD: " + ((ushort)(m_parentGroup.Scene.TimeDilation * 500000f)).ToString() + ":" + m_parentGroup.Scene.TimeDilation.ToString());
2261 } 2257 }
2262 } 2258 }
2263 2259
2264 public void SendTerseUpdateToClient(IClientAPI remoteClient, Vector3 lPos) 2260// public void SendTerseUpdateToClient(IClientAPI remoteClient, Vector3 lPos)
2265 { 2261// {
2266 Quaternion mRot = RotationOffset; 2262// SendTerseUpdateToClient(remoteclient);
2267 //bool isattachment = IsAttachment; 2263// }
2268 //if (LocalId != ParentGroup.RootPart.LocalId)
2269 //isattachment = ParentGroup.RootPart.IsAttachment;
2270
2271 if (IsAttachment)
2272 {
2273 //m_log.Debug(AttachmentPoint.ToString());
2274 remoteClient.SendPrimTerseUpdate(m_regionHandle, (ushort)(m_parentGroup.GetTimeDilation() * (float)ushort.MaxValue), LocalId, lPos, mRot, Velocity, RotationalVelocity, (byte)((AttachmentPoint % 16) * 16 + (AttachmentPoint / 16)),FromAssetID);
2275 }
2276 else
2277 {
2278 if ((ObjectFlags & (uint)PrimFlags.Physics) == 0)
2279 {
2280 remoteClient.SendPrimTerseUpdate(m_regionHandle, (ushort)(m_parentGroup.GetTimeDilation() * (float)ushort.MaxValue), LocalId, lPos, mRot, Velocity, RotationalVelocity, Shape.State, FromAssetID);
2281 }
2282 else
2283 {
2284 remoteClient.SendPrimTerseUpdate(m_regionHandle, (ushort)(m_parentGroup.GetTimeDilation() * (float)ushort.MaxValue), LocalId, lPos, mRot, Velocity,
2285 RotationalVelocity);
2286 //System.Console.WriteLine("LID: " + LocalID + "RVel:" + RotationalVelocity.ToString() + " TD: " + ((ushort)(m_parentGroup.Scene.TimeDilation * 500000f)).ToString() + ":" + m_parentGroup.Scene.TimeDilation.ToString());
2287 }
2288 }
2289 }
2290 2264
2291 public void SetAttachmentPoint(uint AttachmentPoint) 2265 public void SetAttachmentPoint(uint AttachmentPoint)
2292 { 2266 {
@@ -3257,6 +3231,15 @@ if (m_shape != null) {
3257 PhysActor.Shape = m_shape; 3231 PhysActor.Shape = m_shape;
3258 } 3232 }
3259 3233
3234 // This is what makes vehicle trailers work
3235 // A script in a child prim re-issues
3236 // llSetPrimitiveParams(PRIM_TYPE) every few seconds. That
3237 // prevents autoreturn. This is not well known. It also works
3238 // in SL.
3239 //
3240 if (ParentGroup.RootPart != this)
3241 ParentGroup.RootPart.Rezzed = DateTime.Now;
3242
3260 ParentGroup.HasGroupChanged = true; 3243 ParentGroup.HasGroupChanged = true;
3261 ScheduleFullUpdate(); 3244 ScheduleFullUpdate();
3262 } 3245 }
@@ -3427,5 +3410,42 @@ if (m_shape != null) {
3427 } 3410 }
3428 3411
3429 #endregion Public Methods 3412 #endregion Public Methods
3413
3414 private byte GetAttachPointEncoded()
3415 {
3416 return (byte)((AttachmentPoint % 16) * 16 + (AttachmentPoint / 16));
3417 }
3418
3419 public void SendTerseUpdateToClient(IClientAPI remoteClient)
3420 {
3421 if (ParentGroup == null || ParentGroup.RootPart == null)
3422 return;
3423
3424 Vector3 lPos = OffsetPosition;
3425
3426 byte state = Shape.State;
3427 if (IsAttachment)
3428 {
3429 if (ParentGroup.RootPart != this)
3430 return;
3431
3432 lPos = ParentGroup.RootPart.AttachedPos;
3433 state = GetAttachPointEncoded();
3434 }
3435 else
3436 {
3437 if (ParentGroup.RootPart == this)
3438 lPos = AbsolutePosition;
3439 }
3440
3441 remoteClient.SendPrimTerseUpdate(m_regionHandle,
3442 (ushort)(m_parentGroup.GetTimeDilation() *
3443 (float)ushort.MaxValue), LocalId, lPos,
3444 RotationOffset, Velocity,
3445 RotationalVelocity, state, FromAssetID);
3446 }
3430 } 3447 }
3431} 3448}
3449
3450
3451