From 386a8136c916a14c4d484da03bbfe86bf946ee1b Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 11 Jan 2017 18:41:06 +0000 Subject: don't let object lastowner be its group --- OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 5928764..bf991c6 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -2233,7 +2233,8 @@ namespace OpenSim.Region.Framework.Scenes { if (part.OwnerID != userId) { - part.LastOwnerID = part.OwnerID; + if(part.GroupID != part.OwnerID) + part.LastOwnerID = part.OwnerID; part.OwnerID = userId; } }); -- cgit v1.1 From fb86e415615ddfd917485daf5e4a4f2f0486359f Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 14 Jan 2017 14:19:58 +0000 Subject: fix incoerent definition of Slam bit (bits 3 and 4 used in diferent places.) this may still be wrong on other places; Do not loose folded permitions, WARNING MASTER IS NOW UNSTABLE. permissions are still broken" --- OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 3 --- 1 file changed, 3 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index bf991c6..3f531be 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -117,9 +117,6 @@ namespace OpenSim.Region.Framework.Scenes NOT_STATUS_ROTATE_Z = 0xF7 } - // This flag has the same purpose as InventoryItemFlags.ObjectSlamPerm - public static readonly uint SLAM = 16; - // private PrimCountTaintedDelegate handlerPrimCountTainted = null; /// -- cgit v1.1 From ffa6c7aae2266708884ec16d75d7b8b5bae638e5 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 16 Jan 2017 19:22:39 +0000 Subject: avoid lastOwner beeing the group --- OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 3f531be..4d1e564 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -2751,7 +2751,8 @@ namespace OpenSim.Region.Framework.Scenes /// public void SetRootPartOwner(SceneObjectPart part, UUID cAgentID, UUID cGroupID) { - part.LastOwnerID = part.OwnerID; + if(part.GroupID != part.OwnerID && cGroupID != part.OwnerID) + part.LastOwnerID = part.OwnerID; part.OwnerID = cAgentID; part.GroupID = cGroupID; -- cgit v1.1 From 180add745cea4a7e076afd1cfe1c922df1bf7e0b Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 16 Jan 2017 20:27:39 +0000 Subject: replace calls to SetOwnerId and SetRootPartOwner by a single new SetOwner() so owner is not changed twice on rootpart --- .../Region/Framework/Scenes/SceneObjectGroup.cs | 24 ++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 4d1e564..924b61f 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -2766,6 +2766,30 @@ namespace OpenSim.Region.Framework.Scenes part.ScheduleFullUpdate(); } + public void SetOwner(UUID cAgentID, UUID cGroupID) + { + SceneObjectPart rpart = RootPart; + UUID oldowner = rpart.OwnerID; + ForEachPart(delegate(SceneObjectPart part) + { + if(part.GroupID != part.OwnerID) + part.LastOwnerID = part.OwnerID; + part.OwnerID = cAgentID; + part.GroupID = cGroupID; + }); + + if (oldowner != cAgentID) + { + // Apply Next Owner Permissions if we're not bypassing permissions + if (!m_scene.Permissions.BypassPermissions()) + ApplyNextOwnerPermissions(); + } + + rpart.ScheduleFullUpdate(); + } + + + /// /// Make a copy of the given part. /// -- cgit v1.1 From 2b5ef892720c7dfd65e20104cf9ba9bd701463c1 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 16 Jan 2017 20:37:04 +0000 Subject: remove now unused SetRootPartOwner() --- .../Region/Framework/Scenes/SceneObjectGroup.cs | 22 +--------------------- 1 file changed, 1 insertion(+), 21 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 924b61f..639c8dd 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -2744,28 +2744,10 @@ namespace OpenSim.Region.Framework.Scenes } /// - /// Set the owner of the root part. + /// Set the owner of all linkset. /// - /// /// /// - public void SetRootPartOwner(SceneObjectPart part, UUID cAgentID, UUID cGroupID) - { - if(part.GroupID != part.OwnerID && cGroupID != part.OwnerID) - part.LastOwnerID = part.OwnerID; - part.OwnerID = cAgentID; - part.GroupID = cGroupID; - - if (part.OwnerID != cAgentID) - { - // Apply Next Owner Permissions if we're not bypassing permissions - if (!m_scene.Permissions.BypassPermissions()) - ApplyNextOwnerPermissions(); - } - - part.ScheduleFullUpdate(); - } - public void SetOwner(UUID cAgentID, UUID cGroupID) { SceneObjectPart rpart = RootPart; @@ -2788,8 +2770,6 @@ namespace OpenSim.Region.Framework.Scenes rpart.ScheduleFullUpdate(); } - - /// /// Make a copy of the given part. /// -- cgit v1.1 From 11134072806f43ddd35fe2a70331a4877ab1b38f Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 17 Jan 2017 01:22:44 +0000 Subject: add more calls to effective permissions aggregation; do not change groupmask on deed --- OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 3 +++ 1 file changed, 3 insertions(+) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 639c8dd..033170d 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -2764,7 +2764,10 @@ namespace OpenSim.Region.Framework.Scenes { // Apply Next Owner Permissions if we're not bypassing permissions if (!m_scene.Permissions.BypassPermissions()) + { ApplyNextOwnerPermissions(); + AggregatePerms(); + } } rpart.ScheduleFullUpdate(); -- cgit v1.1 From db2fbf6516a055beb71de9b82a9773c29bf3a73d Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 17 Jan 2017 13:24:09 +0000 Subject: add more calls to effective permissions aggregation, some paths may still be missing on objects changes, but remove the aggregation on check paths, so all can be tested. --- .../Region/Framework/Scenes/SceneObjectGroup.cs | 26 +++++++++++++--------- 1 file changed, 15 insertions(+), 11 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 033170d..d14c450 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -2441,17 +2441,16 @@ namespace OpenSim.Region.Framework.Scenes dupe.CopyRootPart(m_rootPart, OwnerID, GroupID, userExposed); dupe.m_rootPart.LinkNum = m_rootPart.LinkNum; - if (userExposed) dupe.m_rootPart.TrimPermissions(); List partList = new List(m_parts.GetArray()); partList.Sort(delegate(SceneObjectPart p1, SceneObjectPart p2) - { - return p1.LinkNum.CompareTo(p2.LinkNum); - } - ); + { + return p1.LinkNum.CompareTo(p2.LinkNum); + } + ); foreach (SceneObjectPart part in partList) { @@ -2503,10 +2502,12 @@ namespace OpenSim.Region.Framework.Scenes if (dupe.m_rootPart.PhysActor != null) dupe.m_rootPart.PhysActor.Building = false; // tell physics to finish building + dupe.AggregateDeepPerms(); + dupe.HasGroupChanged = true; dupe.AttachToBackup(); - ScheduleGroupForFullUpdate(); + dupe.ScheduleGroupForFullUpdate(); } m_dupeInProgress = false; @@ -3426,6 +3427,7 @@ namespace OpenSim.Region.Framework.Scenes objectGroup.HasGroupChangedDueToDelink = true; InvalidBoundsRadius(); + objectGroup.AggregatePerms(); if (sendEvents) linkPart.TriggerScriptChangedEvent(Changed.LINK); @@ -3964,8 +3966,8 @@ namespace OpenSim.Region.Framework.Scenes public void AdjustChildPrimPermissions(bool forceTaskInventoryPermissive) { - uint newOwnerMask = (uint)(PermissionMask.All | PermissionMask.Export) & 0xfffffff8; // Mask folded bits - uint foldedPerms = RootPart.OwnerMask & 3; + uint newOwnerMask = (uint)(PermissionMask.All | PermissionMask.Export) & 0xfffffff0; // Mask folded bits + uint foldedPerms = RootPart.OwnerMask & (uint)PermissionMask.FoldedMask; ForEachPart(part => { @@ -3976,14 +3978,14 @@ namespace OpenSim.Region.Framework.Scenes part.Inventory.ApplyGodPermissions(part.BaseMask); }); - uint lockMask = ~(uint)(PermissionMask.Move | PermissionMask.Modify); - uint lockBit = RootPart.OwnerMask & (uint)(PermissionMask.Move | PermissionMask.Modify); + uint lockMask = ~(uint)(PermissionMask.Move); + uint lockBit = RootPart.OwnerMask & (uint)(PermissionMask.Move); RootPart.OwnerMask = (RootPart.OwnerMask & lockBit) | ((newOwnerMask | foldedPerms) & lockMask); // m_log.DebugFormat( // "[SCENE OBJECT GROUP]: RootPart.OwnerMask now {0} for {1} in {2}", // (OpenMetaverse.PermissionMask)RootPart.OwnerMask, Name, Scene.Name); - + AggregatePerms(); RootPart.ScheduleFullUpdate(); } @@ -4008,6 +4010,7 @@ namespace OpenSim.Region.Framework.Scenes { foreach (SceneObjectPart part in Parts) part.Inventory.ApplyGodPermissions(RootPart.BaseMask); + AggregatePerms(); } HasGroupChanged = true; @@ -5223,6 +5226,7 @@ namespace OpenSim.Region.Framework.Scenes { part.ResetOwnerChangeFlag(); }); + AggregatePerms(); } // clear some references to easy cg -- cgit v1.1 From dac32c4e5acd76a3b42dede1c573dbef1a98c7e1 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 20 Jan 2017 14:26:24 +0000 Subject: change CanObjectEntry() to use a SOG --- OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index d14c450..83c5db4 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -4656,7 +4656,7 @@ namespace OpenSim.Region.Framework.Scenes } if ((change & ObjectChangeType.Position) != 0) { - if (IsAttachment || m_scene.Permissions.CanObjectEntry(group.UUID, false, data.position)) + if (IsAttachment || m_scene.Permissions.CanObjectEntry(group, false, data.position)) UpdateGroupPosition(data.position); updateType = updatetype.groupterse; } -- cgit v1.1 From cdc23bab74d5ed5250850bd9c4fc027809ad3d3c Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 26 Jan 2017 19:51:50 +0000 Subject: remove unused and wrong methods --- .../Region/Framework/Scenes/SceneObjectGroup.cs | 57 ---------------------- 1 file changed, 57 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 83c5db4..dff242e 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -1783,63 +1783,6 @@ namespace OpenSim.Region.Framework.Scenes } } - /// - /// Attach this scene object to the given avatar. - /// - /// - /// - /// - private void AttachToAgent( - ScenePresence avatar, SceneObjectGroup so, uint attachmentpoint, Vector3 attachOffset, bool silent) - { - if (avatar != null) - { - // don't attach attachments to child agents - if (avatar.IsChildAgent) return; - - // Remove from database and parcel prim count - m_scene.DeleteFromStorage(so.UUID); - m_scene.EventManager.TriggerParcelPrimCountTainted(); - - so.AttachedAvatar = avatar.UUID; - - if (so.RootPart.PhysActor != null) - { - m_scene.PhysicsScene.RemovePrim(so.RootPart.PhysActor); - so.RootPart.PhysActor = null; - } - - so.AbsolutePosition = attachOffset; - so.RootPart.AttachedPos = attachOffset; - so.IsAttachment = true; - so.RootPart.SetParentLocalId(avatar.LocalId); - so.AttachmentPoint = attachmentpoint; - - avatar.AddAttachment(this); - - if (!silent) - { - // Killing it here will cause the client to deselect it - // It then reappears on the avatar, deselected - // through the full update below - // - if (IsSelected) - { - m_scene.SendKillObject(new List { m_rootPart.LocalId }); - } - - IsSelected = false; // fudge.... - ScheduleGroupForFullUpdate(); - } - } - else - { - m_log.WarnFormat( - "[SOG]: Tried to add attachment {0} to avatar with UUID {1} in region {2} but the avatar is not present", - UUID, avatar.ControllingClient.AgentId, Scene.RegionInfo.RegionName); - } - } - public byte GetAttachmentPoint() { return m_rootPart.Shape.State; -- cgit v1.1 From 0091c37ed3fd3f9ed4edf079a61f986daadca16b Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 27 Jan 2017 20:21:24 +0000 Subject: several changes relative to objects return and parcel prim counts: avoid null refs, report correct count of returned objects, make obkects counts by ownership coerent with return rules, etc --- OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index dff242e..45196bb 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -645,7 +645,7 @@ namespace OpenSim.Region.Framework.Scenes localIDs.Add(sog.RootPart.LocalId); sogScene.AddReturn(sog.OwnerID, sog.Name, sog.AbsolutePosition, "Returned at region cross"); - sogScene.DeRezObjects(null, localIDs, UUID.Zero, DeRezAction.Return, UUID.Zero); + sogScene.DeRezObjects(null, localIDs, UUID.Zero, DeRezAction.Return, UUID.Zero, false); } catch (Exception) { @@ -2254,7 +2254,7 @@ namespace OpenSim.Region.Framework.Scenes RootPart.UUID); m_scene.AddReturn(OwnerID == GroupID ? LastOwnerID : OwnerID, Name, AbsolutePosition, "parcel autoreturn"); m_scene.DeRezObjects(null, new List() { RootPart.LocalId }, UUID.Zero, - DeRezAction.Return, UUID.Zero); + DeRezAction.Return, UUID.Zero, false); return; } -- cgit v1.1 From 91f142bbd2f11580da86c66fad2c08d176b09c97 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Thu, 9 Feb 2017 23:16:23 +0000 Subject: Add the option to link a scene object with a monitoring object For debugging purposes. --- OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 2 ++ 1 file changed, 2 insertions(+) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 3f531be..6332beb 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -376,6 +376,8 @@ namespace OpenSim.Region.Framework.Scenes public bool m_dupeInProgress = false; internal Dictionary m_savedScriptState; + public UUID MonitoringObject { get; set; } + #region Properties /// -- cgit v1.1 From 6a35a965ff7085b5962745437a10d798c0fb611d Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 31 Mar 2017 20:55:48 +0100 Subject: add OSSL functions to override linksets total mass, center of mass and inertia. replacing the crude automatic estimation based on prims known to physics and density. Changed parameters are still not saved, and are lost on region crossings. only suported by UbODE. EXPERIMENTAL feature, only test it for now.. don't try to use in products. --- .../Region/Framework/Scenes/SceneObjectGroup.cs | 41 ++++++++++++++++++++++ 1 file changed, 41 insertions(+) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index bf4d60c..77658ef 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -5010,6 +5010,47 @@ namespace OpenSim.Region.Framework.Scenes return Ptot; } + public void GetInertiaData(out float TotalMass, out Vector3 CenterOfMass, out Vector3 Inertia, out Vector4 aux ) + { + PhysicsActor pa = RootPart.PhysActor; + + if(((RootPart.Flags & PrimFlags.Physics) !=0) && pa !=null) + { + PhysicsInertiaData inertia; + + inertia = pa.GetInertiaData(); + + TotalMass = inertia.TotalMass; + CenterOfMass = inertia.CenterOfMass; + Inertia = inertia.Inertia; + aux = inertia.InertiaRotation; + + return; + } + + TotalMass = GetMass(); + CenterOfMass = GetCenterOfMass() - AbsolutePosition; + CenterOfMass *= Quaternion.Conjugate(RootPart.RotationOffset); + Inertia = Vector3.Zero; + aux = Vector4.Zero; + } + + public void SetInertiaData(float TotalMass, Vector3 CenterOfMass, Vector3 Inertia, Vector4 aux ) + { + PhysicsActor pa = RootPart.PhysActor; + + if(pa !=null) + { + PhysicsInertiaData inertia = new PhysicsInertiaData(); + inertia.TotalMass = TotalMass; + inertia.CenterOfMass = CenterOfMass; + inertia.Inertia = Inertia; + inertia.InertiaRotation = aux; + pa.SetInertiaData(inertia); + } + } + + /// /// Set the user group to which this scene object belongs. /// -- cgit v1.1 From 443fc60cdf399a49832e787ca58c2644bef7e457 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 1 Apr 2017 17:49:17 +0100 Subject: store the physics inertia override in Mysql and add it to serializer. run prebuild is required --- OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 77658ef..719a5dd 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -5037,20 +5037,22 @@ namespace OpenSim.Region.Framework.Scenes public void SetInertiaData(float TotalMass, Vector3 CenterOfMass, Vector3 Inertia, Vector4 aux ) { - PhysicsActor pa = RootPart.PhysActor; + PhysicsInertiaData inertia = new PhysicsInertiaData(); + inertia.TotalMass = TotalMass; + inertia.CenterOfMass = CenterOfMass; + inertia.Inertia = Inertia; + inertia.InertiaRotation = aux; + + if(TotalMass < 0) + RootPart.PhysicsInertia = null; + else + RootPart.PhysicsInertia = new PhysicsInertiaData(inertia); + PhysicsActor pa = RootPart.PhysActor; if(pa !=null) - { - PhysicsInertiaData inertia = new PhysicsInertiaData(); - inertia.TotalMass = TotalMass; - inertia.CenterOfMass = CenterOfMass; - inertia.Inertia = Inertia; - inertia.InertiaRotation = aux; pa.SetInertiaData(inertia); - } } - /// /// Set the user group to which this scene object belongs. /// -- cgit v1.1 From 2bb5e985740b7c6aa75cd31aa057d39d56f024b6 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 3 Apr 2017 17:19:28 +0100 Subject: add EXPERIMENTAL osObjectTeleport(LSL_Key objectUUID, LSL_Vector targetPos, LSL_Rotation rotation, LSL_Integer stop) --- .../Region/Framework/Scenes/SceneObjectGroup.cs | 85 ++++++++++++++++++++++ 1 file changed, 85 insertions(+) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 719a5dd..402e5f7 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -853,6 +853,91 @@ namespace OpenSim.Region.Framework.Scenes m_log.DebugFormat("[SCENE OBJECT]: Crossing agent {0} {1} completed.", agent.Firstname, agent.Lastname); } */ + public void ObjectTeleport(UUID sourceID, Vector3 targetPosition, Quaternion rotation, bool stop) + { + if(inTransit || IsDeleted || IsAttachmentCheckFull() || IsSelected || Scene == null) + return; + + inTransit = true; + + PhysicsActor pa = RootPart.PhysActor; + if(pa == null || RootPart.KeyframeMotion != null /*|| m_sittingAvatars.Count == 0*/) + { + inTransit = false; + return; + } + + if(Scene.PositionIsInCurrentRegion(targetPosition)) + { + if(Scene.InTeleportTargetsCoolDown(UUID, sourceID, 1.0)) + { + inTransit = false; + return; + } + + Vector3 curPos = AbsolutePosition; + ILandObject curLand = Scene.LandChannel.GetLandObject(curPos.X, curPos.Y); + float posX = targetPosition.X; + float posY = targetPosition.Y; + ILandObject land = Scene.LandChannel.GetLandObject(posX, posY); + if(land != null && land != curLand) + { + if(!Scene.Permissions.CanObjectEnterWithScripts(this, land)) + { + inTransit = false; + return; + } + + UUID agentID; + foreach (ScenePresence av in m_sittingAvatars) + { + agentID = av.UUID; + if(land.IsRestrictedFromLand(agentID) || land.IsBannedFromLand(agentID)) + { + inTransit = false; + return; + } + } + } + + if(stop) + RootPart.Stop(); + else + { + rotation.Normalize(); + if(Math.Abs(rotation.W) < 0.999) + { + Quaternion rot = RootPart.RotationOffset; + Vector3 vel = RootPart.Velocity; + Vector3 avel = RootPart.AngularVelocity; + Vector3 acc = RootPart.Acceleration; + + rot *= rotation; + vel *= rotation; + avel *= rotation; + acc *= rotation; + + RootPart.RotationOffset = rot; + RootPart.Velocity = vel; + RootPart.AngularVelocity = avel; + RootPart.Acceleration = acc; + } + } + + Vector3 s = RootPart.Scale * RootPart.RotationOffset; + float h = Scene.GetGroundHeight(posX, posY) + 0.5f * (float)Math.Abs(s.Z) + 0.01f; + if(targetPosition.Z < h) + targetPosition.Z = h; + + inTransit = false; + AbsolutePosition = targetPosition; + RootPart.ScheduleTerseUpdate(); + return; + } + + inTransit = false; + } + public override Vector3 Velocity { get { return RootPart.Velocity; } -- cgit v1.1 From c6150c206618fe50a45bd8673e010f862147daba Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 4 Apr 2017 00:30:19 +0100 Subject: mantis 8140: fix objectTeleport rotation if stop TRUE --- OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 402e5f7..24cdc7a 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -900,11 +900,19 @@ namespace OpenSim.Region.Framework.Scenes } } + rotation.Normalize(); if(stop) + { RootPart.Stop(); + if(Math.Abs(rotation.W) < 0.999) + { + Quaternion rot = RootPart.RotationOffset; + rot *= rotation; + RootPart.RotationOffset = rot; + } + } else { - rotation.Normalize(); if(Math.Abs(rotation.W) < 0.999) { Quaternion rot = RootPart.RotationOffset; -- cgit v1.1 From ca250e0b0b564efaaeb5c0b80760126cfd710c5e Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 4 Apr 2017 14:34:25 +0100 Subject: mantis 8740: rename osObjectTeleport as osTeleportObject, replaced the stop parameter by flags, add flags OSTPOBJ_STOPATTARRGET and OSTPOBJ_SETROT --- .../Region/Framework/Scenes/SceneObjectGroup.cs | 34 +++++++++++++++------- 1 file changed, 23 insertions(+), 11 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 24cdc7a..a0d7bfd 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -853,7 +853,13 @@ namespace OpenSim.Region.Framework.Scenes m_log.DebugFormat("[SCENE OBJECT]: Crossing agent {0} {1} completed.", agent.Firstname, agent.Lastname); } */ - public void ObjectTeleport(UUID sourceID, Vector3 targetPosition, Quaternion rotation, bool stop) + + // copy from LSL_constants.cs + const int OSTPOBJ_STOPATTARRGET = 0x1; // stops at destination + const int OSTPOBJ_STOPONFAIL = 0x2; // stops at start if tp fails + const int OSTPOBJ_SETROT = 0x4; // the rotation is the final rotation, otherwise is a added rotation + + public void TeleportObject(UUID sourceID, Vector3 targetPosition, Quaternion rotation, int flags) { if(inTransit || IsDeleted || IsAttachmentCheckFull() || IsSelected || Scene == null) return; @@ -900,38 +906,44 @@ namespace OpenSim.Region.Framework.Scenes } } + bool stop = (flags & OSTPOBJ_STOPATTARRGET) != 0; + bool setrot = (flags & OSTPOBJ_SETROT) != 0; + rotation.Normalize(); + bool dorot = (Math.Abs(rotation.W) < 0.999); + + Quaternion currentRot = RootPart.RotationOffset; + if(dorot && setrot) + rotation = rotation * Quaternion.Conjugate(currentRot); + if(stop) { RootPart.Stop(); - if(Math.Abs(rotation.W) < 0.999) - { - Quaternion rot = RootPart.RotationOffset; - rot *= rotation; - RootPart.RotationOffset = rot; - } } else { - if(Math.Abs(rotation.W) < 0.999) + if(dorot) { - Quaternion rot = RootPart.RotationOffset; Vector3 vel = RootPart.Velocity; Vector3 avel = RootPart.AngularVelocity; Vector3 acc = RootPart.Acceleration; - rot *= rotation; vel *= rotation; avel *= rotation; acc *= rotation; - RootPart.RotationOffset = rot; RootPart.Velocity = vel; RootPart.AngularVelocity = avel; RootPart.Acceleration = acc; } } + if(dorot) + { + currentRot *= rotation; + RootPart.RotationOffset = currentRot; + } + Vector3 s = RootPart.Scale * RootPart.RotationOffset; float h = Scene.GetGroundHeight(posX, posY) + 0.5f * (float)Math.Abs(s.Z) + 0.01f; if(targetPosition.Z < h) -- cgit v1.1 From e237e1b2fa444b0bf0077036c9436f919e344e2b Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 4 Apr 2017 19:27:45 +0100 Subject: add LSL_Integer osGetLinkNumber(LSL_String name). uses a cache for the string to linknumber map, cache invalidations may still be missing :( --- .../Region/Framework/Scenes/SceneObjectGroup.cs | 61 ++++++++++++++++++++++ 1 file changed, 61 insertions(+) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index a0d7bfd..b410b74 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -2004,6 +2004,7 @@ namespace OpenSim.Region.Framework.Scenes if (part.LinkNum == 2) RootPart.LinkNum = 1; + InvalidatePartsLinkMaps(); } /// @@ -2560,6 +2561,7 @@ namespace OpenSim.Region.Framework.Scenes dupe.ScheduleGroupForFullUpdate(); } + dupe.InvalidatePartsLinkMaps(); m_dupeInProgress = false; return dupe; } @@ -3321,6 +3323,7 @@ namespace OpenSim.Region.Framework.Scenes ResetChildPrimPhysicsPositions(); InvalidBoundsRadius(); + InvalidatePartsLinkMaps(); if (m_rootPart.PhysActor != null) m_rootPart.PhysActor.Building = false; @@ -3477,6 +3480,7 @@ namespace OpenSim.Region.Framework.Scenes objectGroup.HasGroupChangedDueToDelink = true; InvalidBoundsRadius(); + InvalidatePartsLinkMaps(); objectGroup.AggregatePerms(); if (sendEvents) @@ -5333,6 +5337,63 @@ namespace OpenSim.Region.Framework.Scenes m_PlaySoundSlavePrims.Clear(); m_LoopSoundMasterPrim = null; m_targets.Clear(); + m_partsNameToLinkMap.Clear(); + } + + Dictionary m_partsNameToLinkMap = new Dictionary(); + + // this scales bad but so does GetLinkNumPart + public int GetLinkNumber(string name) + { + if(String.IsNullOrEmpty(name) || name == "Object") + return -1; + + lock(m_partsNameToLinkMap) + { + if(m_partsNameToLinkMap.Count == 0) + { + SceneObjectPart[] parts = m_parts.GetArray(); + for (int i = 0; i < parts.Length; i++) + { + string s = parts[i].Name; + if(String.IsNullOrEmpty(s) || s == "Object" || s == "Primitive") + continue; + + if(m_partsNameToLinkMap.ContainsKey(s)) + { + int ol = parts[i].LinkNum; + if(ol < m_partsNameToLinkMap[s]) + m_partsNameToLinkMap[s] = ol; + } + else + m_partsNameToLinkMap[s] = parts[i].LinkNum; + } + } + + if(m_partsNameToLinkMap.ContainsKey(name)) + return m_partsNameToLinkMap[name]; + } + + if(m_sittingAvatars.Count > 0) + { + int j = m_parts.Count; + if(j > 1) + j++; + ScenePresence[] avs = m_sittingAvatars.ToArray(); + for (int i = 0; i < avs.Length; i++, j++) + { + if (avs[i].Name == name) + return j; + } + } + + return -1; + } + + public void InvalidatePartsLinkMaps() + { + lock(m_partsNameToLinkMap) + m_partsNameToLinkMap.Clear(); } #endregion -- cgit v1.1 From d085c337a9d08788837a2f54a2400e91c807f59f Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 4 Apr 2017 20:11:11 +0100 Subject: add a little speedup on repeated requests for same name on osGetLinkNumber. --- .../Region/Framework/Scenes/SceneObjectGroup.cs | 35 +++++++++++++++++----- 1 file changed, 28 insertions(+), 7 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index b410b74..d3490c2 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -5340,7 +5340,9 @@ namespace OpenSim.Region.Framework.Scenes m_partsNameToLinkMap.Clear(); } - Dictionary m_partsNameToLinkMap = new Dictionary(); + private Dictionary m_partsNameToLinkMap = new Dictionary(); + private string GetLinkNumber_lastname; + private int GetLinkNumber_lastnumber; // this scales bad but so does GetLinkNumPart public int GetLinkNumber(string name) @@ -5352,6 +5354,8 @@ namespace OpenSim.Region.Framework.Scenes { if(m_partsNameToLinkMap.Count == 0) { + GetLinkNumber_lastname = String.Empty; + GetLinkNumber_lastnumber = -1; SceneObjectPart[] parts = m_parts.GetArray(); for (int i = 0; i < parts.Length; i++) { @@ -5370,20 +5374,33 @@ namespace OpenSim.Region.Framework.Scenes } } + if(name == GetLinkNumber_lastname) + return GetLinkNumber_lastnumber; + if(m_partsNameToLinkMap.ContainsKey(name)) - return m_partsNameToLinkMap[name]; - } + { + lock(m_partsNameToLinkMap) + { + GetLinkNumber_lastname = name; + GetLinkNumber_lastnumber = m_partsNameToLinkMap[name]; + return GetLinkNumber_lastnumber; + } + } + } if(m_sittingAvatars.Count > 0) { - int j = m_parts.Count; - if(j > 1) - j++; + int j = m_parts.Count + 1; + ScenePresence[] avs = m_sittingAvatars.ToArray(); for (int i = 0; i < avs.Length; i++, j++) { if (avs[i].Name == name) - return j; + { + GetLinkNumber_lastname = name; + GetLinkNumber_lastnumber = j; + return j; + } } } @@ -5393,7 +5410,11 @@ namespace OpenSim.Region.Framework.Scenes public void InvalidatePartsLinkMaps() { lock(m_partsNameToLinkMap) + { m_partsNameToLinkMap.Clear(); + GetLinkNumber_lastname = String.Empty; + GetLinkNumber_lastnumber = -1; + } } #endregion -- cgit v1.1 From 1848b1fdb143462e6d0db47142e5f50bd8a9632c Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 6 Apr 2017 12:56:00 +0100 Subject: mantis 8740: fix osTeleportObject set rotation --- OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index d3490c2..af70848 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -910,11 +910,12 @@ namespace OpenSim.Region.Framework.Scenes bool setrot = (flags & OSTPOBJ_SETROT) != 0; rotation.Normalize(); - bool dorot = (Math.Abs(rotation.W) < 0.999); - Quaternion currentRot = RootPart.RotationOffset; - if(dorot && setrot) - rotation = rotation * Quaternion.Conjugate(currentRot); + + if(setrot) + rotation = Quaternion.Conjugate(currentRot) * rotation; + + bool dorot = setrot | (Math.Abs(rotation.W) < 0.999); if(stop) { -- cgit v1.1 From 0f7ffc56cee22aa95af58d19d3ea2193cea07340 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 15 Apr 2017 10:46:18 +0100 Subject: several changes for osTeleportObject --- .../Region/Framework/Scenes/SceneObjectGroup.cs | 407 ++++++++++++++------- 1 file changed, 265 insertions(+), 142 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index af70848..0e7ac58 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -538,7 +538,7 @@ namespace OpenSim.Region.Framework.Scenes public bool inTransit = false; - public delegate SceneObjectGroup SOGCrossDelegate(SceneObjectGroup sog,Vector3 pos); + private delegate SceneObjectGroup SOGCrossDelegate(SceneObjectGroup sog,Vector3 pos, TeleportObjectData tpData); /// /// The absolute position of this scene object in the scene @@ -560,7 +560,7 @@ namespace OpenSim.Region.Framework.Scenes { inTransit = true; SOGCrossDelegate d = CrossAsync; - d.BeginInvoke(this, val, CrossAsyncCompleted, d); + d.BeginInvoke(this, val, null, CrossAsyncCompleted, d); } return; } @@ -601,7 +601,6 @@ namespace OpenSim.Region.Framework.Scenes av.sitSOGmoved(); } - // now that position is changed tell it to scripts if (triggerScriptEvent) { @@ -617,64 +616,75 @@ namespace OpenSim.Region.Framework.Scenes } } - public SceneObjectGroup CrossAsync(SceneObjectGroup sog, Vector3 val) + private SceneObjectGroup CrossAsync(SceneObjectGroup sog, Vector3 val, TeleportObjectData tpdata) { Scene sogScene = sog.m_scene; - IEntityTransferModule entityTransfer = sogScene.RequestModuleInterface(); + SceneObjectPart root = sog.RootPart; - Vector3 newpos = Vector3.Zero; - OpenSim.Services.Interfaces.GridRegion destination = null; + bool isTeleport = tpdata != null; - if (sog.RootPart.DIE_AT_EDGE) + if(!isTeleport) { - try - { - sogScene.DeleteSceneObject(sog, false); - } - catch (Exception) + if (root.DIE_AT_EDGE) { - m_log.Warn("[SCENE]: exception when trying to remove the prim that crossed the border."); + try + { + sogScene.DeleteSceneObject(sog, false); + } + catch (Exception) + { + m_log.Warn("[SCENE]: exception when trying to remove the prim that crossed the border."); + } + return sog; } - return sog; - } - if (sog.RootPart.RETURN_AT_EDGE) - { - // We remove the object here - try + if (root.RETURN_AT_EDGE) { - List localIDs = new List(); - localIDs.Add(sog.RootPart.LocalId); - sogScene.AddReturn(sog.OwnerID, sog.Name, sog.AbsolutePosition, - "Returned at region cross"); - sogScene.DeRezObjects(null, localIDs, UUID.Zero, DeRezAction.Return, UUID.Zero, false); - } - catch (Exception) - { - m_log.Warn("[SCENE]: exception when trying to return the prim that crossed the border."); + // We remove the object here + try + { + List localIDs = new List(); + localIDs.Add(root.LocalId); + sogScene.AddReturn(sog.OwnerID, sog.Name, sog.AbsolutePosition, + "Returned at region cross"); + sogScene.DeRezObjects(null, localIDs, UUID.Zero, DeRezAction.Return, UUID.Zero, false); + } + catch (Exception) + { + m_log.Warn("[SCENE]: exception when trying to return the prim that crossed the border."); + } + return sog; } - return sog; } - if (sog.m_rootPart.KeyframeMotion != null) - sog.m_rootPart.KeyframeMotion.StartCrossingCheck(); + if (root.KeyframeMotion != null) + root.KeyframeMotion.StartCrossingCheck(); + + if(root.PhysActor != null) + root.PhysActor.CrossingStart(); + + IEntityTransferModule entityTransfer = sogScene.RequestModuleInterface(); if (entityTransfer == null) return sog; + Vector3 newpos = Vector3.Zero; + OpenSim.Services.Interfaces.GridRegion destination = null; + destination = entityTransfer.GetObjectDestination(sog, val, out newpos); if (destination == null) return sog; if (sog.m_sittingAvatars.Count == 0) { - entityTransfer.CrossPrimGroupIntoNewRegion(destination, newpos, sog, true, true); + entityTransfer.CrossPrimGroupIntoNewRegion(destination, newpos, sog, !isTeleport, true); return sog; } string reason = String.Empty; EntityTransferContext ctx = new EntityTransferContext(); + Vector3 curPos = root.GroupPosition; foreach (ScenePresence av in sog.m_sittingAvatars) { // We need to cross these agents. First, let's find @@ -685,10 +695,15 @@ namespace OpenSim.Region.Framework.Scenes // We set the avatar position as being the object // position to get the region to send to + if(av.IsNPC) + continue; + + if(av.IsInTransit) + return sog; + if(!entityTransfer.checkAgentAccessToRegion(av, destination, newpos, ctx, out reason)) - { return sog; - } + m_log.DebugFormat("[SCENE OBJECT]: Avatar {0} needs to be crossed to {1}", av.Name, destination.RegionName); } @@ -696,8 +711,10 @@ namespace OpenSim.Region.Framework.Scenes // be made to stand up List avsToCross = new List(); - - foreach (ScenePresence av in sog.m_sittingAvatars) + List avsToCrossFar = new List(); + ulong destHandle = destination.RegionHandle; + List sittingAvatars = GetSittingAvatars(); + foreach (ScenePresence av in sittingAvatars) { byte cflags = 1; @@ -711,68 +728,175 @@ namespace OpenSim.Region.Framework.Scenes else cflags = 3; } + if(!av.knowsNeighbourRegion(destHandle)) + cflags |= 8; // 1 is crossing // 2 is sitting // 4 is sitting at sittarget - av.crossingFlags = cflags; + // 8 far crossing avinfo.av = av; avinfo.ParentID = av.ParentID; avsToCross.Add(avinfo); + if(!av.knowsNeighbourRegion(destHandle)) + { + cflags |= 8; + avsToCrossFar.Add(av); + } + + if(av.IsNPC) + av.crossingFlags = 0; + else + av.crossingFlags = cflags; + av.PrevSitOffset = av.OffsetPosition; av.ParentID = 0; } + Vector3 vel = root.Velocity; + Vector3 avel = root.AngularVelocity; + Vector3 acc = root.Acceleration; + Quaternion ori = root.RotationOffset; + + if(isTeleport) + { + root.Stop(); + sogScene.ForEachScenePresence(delegate(ScenePresence av) + { + av.ControllingClient.SendEntityUpdate(root,PrimUpdateFlags.SendInTransit); + av.ControllingClient.SendEntityTerseUpdateImmediate(root); + }); + + root.Velocity = tpdata.vel; + root.AngularVelocity = tpdata.avel; + root.Acceleration = tpdata.acc; + root.RotationOffset = tpdata.ori; + } + if (entityTransfer.CrossPrimGroupIntoNewRegion(destination, newpos, sog, true, false)) { + if(isTeleport) + { + sogScene.ForEachScenePresence(delegate(ScenePresence oav) + { + if(sittingAvatars.Contains(oav)) + return; + if(oav.knowsNeighbourRegion(destHandle)) + return; + oav.ControllingClient.SendEntityUpdate(root, PrimUpdateFlags.Kill); + foreach (ScenePresence sav in sittingAvatars) + { + sav.SendKillTo(oav); + } + }); + } + bool crossedfar = false; + foreach (ScenePresence av in avsToCrossFar) + { + if(entityTransfer.CrossAgentCreateFarChild(av,destination, newpos, ctx)) + crossedfar = true; + else + av.crossingFlags = 0; + } + + if(crossedfar) + Thread.Sleep(1000); + foreach (avtocrossInfo avinfo in avsToCross) { ScenePresence av = avinfo.av; - if (!av.IsInTransit) // just in case... - { - m_log.DebugFormat("[SCENE OBJECT]: Crossing avatar {0} to {1}", av.Name, val); + av.IsInTransit = true; + m_log.DebugFormat("[SCENE OBJECT]: Crossing avatar {0} to {1}", av.Name, val); - av.IsInTransit = true; + if(av.crossingFlags > 0) + entityTransfer.CrossAgentToNewRegionAsync(av, newpos, destination, false, ctx); -// CrossAgentToNewRegionDelegate d = entityTransfer.CrossAgentToNewRegionAsync; -// d.BeginInvoke(av, val, destination, av.Flying, version, CrossAgentToNewRegionCompleted, d); - entityTransfer.CrossAgentToNewRegionAsync(av, newpos, destination, av.Flying, ctx); - if (av.IsChildAgent) - { - // avatar crossed do some extra cleanup - if (av.ParentUUID != UUID.Zero) - { - av.ClearControls(); - av.ParentPart = null; - } - } - else + if (av.IsChildAgent) + { + // avatar crossed do some extra cleanup + if (av.ParentUUID != UUID.Zero) { - // avatar cross failed we need do dedicated standUp - // part of it was done at CrossAgentToNewRegionAsync - // so for now just remove the sog controls - // this may need extra care - av.UnRegisterSeatControls(sog.UUID); + av.ClearControls(); + av.ParentPart = null; } - av.ParentUUID = UUID.Zero; + av.ParentPart = null; // In any case av.IsInTransit = false; av.crossingFlags = 0; m_log.DebugFormat("[SCENE OBJECT]: Crossing agent {0} {1} completed.", av.Firstname, av.Lastname); } else - m_log.DebugFormat("[SCENE OBJECT]: Crossing avatar already in transit {0} to {1}", av.Name, val); + { + // avatar cross failed we need do dedicated standUp + // part of it was done at CrossAgentToNewRegionAsync + // so for now just remove the sog controls + // this may need extra care + av.UnRegisterSeatControls(sog.UUID); + av.ParentUUID = UUID.Zero; + av.ParentPart = null; + Vector3 oldp = curPos; + oldp.X = Util.Clamp(oldp.X, 0.5f, sog.m_scene.RegionInfo.RegionSizeX - 0.5f); + oldp.Y = Util.Clamp(oldp.Y, 0.5f, sog.m_scene.RegionInfo.RegionSizeY - 0.5f); + av.AbsolutePosition = oldp; + av.crossingFlags = 0; + av.sitAnimation = "SIT"; + av.IsInTransit = false; + if(av.Animator!= null) + av.Animator.SetMovementAnimations("STAND"); + av.AddToPhysicalScene(false); + sogScene.ForEachScenePresence(delegate(ScenePresence oav) + { + if(sittingAvatars.Contains(oav)) + return; + if(oav.knowsNeighbourRegion(destHandle)) + av.SendAvatarDataToAgent(oav); + else + { + av.SendAvatarDataToAgent(oav); + av.SendAppearanceToAgent(oav); + if (av.Animator != null) + av.Animator.SendAnimPackToClient(oav.ControllingClient); + av.SendAttachmentsToAgentNF(oav); // not ok + } + }); + m_log.DebugFormat("[SCENE OBJECT]: Crossing agent {0} {1} failed.", av.Firstname, av.Lastname); + } } + + if(crossedfar) + { + Thread.Sleep(10000); + foreach (ScenePresence av in avsToCrossFar) + { + if(av.IsChildAgent) + { + av.Scene.CloseAgent(av.UUID, false); + } + else + av.RemoveNeighbourRegion(destHandle); + } + } + avsToCrossFar.Clear(); avsToCross.Clear(); sog.RemoveScriptInstances(true); sog.Clear(); return sog; } - else // cross failed, put avas back ?? + else { + if(isTeleport) + { + if((tpdata.flags & OSTPOBJ_STOPONFAIL) == 0) + { + root.Velocity = vel; + root.AngularVelocity = avel; + root.Acceleration = acc; + } + root.RotationOffset = ori; + } foreach (avtocrossInfo avinfo in avsToCross) { ScenePresence av = avinfo.av; @@ -782,7 +906,6 @@ namespace OpenSim.Region.Framework.Scenes } } avsToCross.Clear(); - return sog; } @@ -794,11 +917,14 @@ namespace OpenSim.Region.Framework.Scenes if (!sog.IsDeleted) { SceneObjectPart rootp = sog.m_rootPart; + Vector3 oldp = rootp.GroupPosition; oldp.X = Util.Clamp(oldp.X, 0.5f, sog.m_scene.RegionInfo.RegionSizeX - 0.5f); oldp.Y = Util.Clamp(oldp.Y, 0.5f, sog.m_scene.RegionInfo.RegionSizeY - 0.5f); rootp.GroupPosition = oldp; + rootp.Stop(); + SceneObjectPart[] parts = sog.m_parts.GetArray(); foreach (SceneObjectPart part in parts) @@ -812,57 +938,37 @@ namespace OpenSim.Region.Framework.Scenes av.sitSOGmoved(); } - sog.Velocity = Vector3.Zero; - if (sog.m_rootPart.KeyframeMotion != null) sog.m_rootPart.KeyframeMotion.CrossingFailure(); if (sog.RootPart.PhysActor != null) - { sog.RootPart.PhysActor.CrossingFailure(); - } sog.inTransit = false; + AttachToBackup(); sog.ScheduleGroupForFullUpdate(); } } -/* outdated - private void CrossAgentToNewRegionCompleted(ScenePresence agent) + private class TeleportObjectData { - //// If the cross was successful, this agent is a child agent - if (agent.IsChildAgent) - { - if (agent.ParentUUID != UUID.Zero) - { - agent.HandleForceReleaseControls(agent.ControllingClient,agent.UUID); - agent.ParentPart = null; -// agent.ParentPosition = Vector3.Zero; -// agent.ParentUUID = UUID.Zero; - } - } - - agent.ParentUUID = UUID.Zero; -// agent.Reset(); -// else // Not successful -// agent.RestoreInCurrentScene(); - - // In any case - agent.IsInTransit = false; - - m_log.DebugFormat("[SCENE OBJECT]: Crossing agent {0} {1} completed.", agent.Firstname, agent.Lastname); + public int flags; + public Vector3 vel; + public Vector3 avel; + public Vector3 acc; + public Quaternion ori; + public UUID sourceID; } -*/ // copy from LSL_constants.cs - const int OSTPOBJ_STOPATTARRGET = 0x1; // stops at destination + const int OSTPOBJ_STOPATTARGET = 0x1; // stops at destination const int OSTPOBJ_STOPONFAIL = 0x2; // stops at start if tp fails const int OSTPOBJ_SETROT = 0x4; // the rotation is the final rotation, otherwise is a added rotation - public void TeleportObject(UUID sourceID, Vector3 targetPosition, Quaternion rotation, int flags) + public int TeleportObject(UUID sourceID, Vector3 targetPosition, Quaternion rotation, int flags) { if(inTransit || IsDeleted || IsAttachmentCheckFull() || IsSelected || Scene == null) - return; + return -1; inTransit = true; @@ -870,7 +976,41 @@ namespace OpenSim.Region.Framework.Scenes if(pa == null || RootPart.KeyframeMotion != null /*|| m_sittingAvatars.Count == 0*/) { inTransit = false; - return; + return -1; + } + + bool stop = (flags & OSTPOBJ_STOPATTARGET) != 0; + bool setrot = (flags & OSTPOBJ_SETROT) != 0; + + rotation.Normalize(); + + Quaternion currentRot = RootPart.RotationOffset; + if(setrot) + rotation = Quaternion.Conjugate(currentRot) * rotation; + + bool dorot = setrot | (Math.Abs(rotation.W) < 0.99999); + + Vector3 vel = Vector3.Zero; + Vector3 avel = Vector3.Zero; + Vector3 acc = Vector3.Zero; + + if(!stop) + { + vel = RootPart.Velocity; + avel = RootPart.AngularVelocity; + acc = RootPart.Acceleration; + } + Quaternion ori = RootPart.RotationOffset; + + if(dorot) + { + if(!stop) + { + vel *= rotation; + avel *= rotation; + acc *= rotation; + } + ori *= rotation; } if(Scene.PositionIsInCurrentRegion(targetPosition)) @@ -878,7 +1018,7 @@ namespace OpenSim.Region.Framework.Scenes if(Scene.InTeleportTargetsCoolDown(UUID, sourceID, 1.0)) { inTransit = false; - return; + return -2; } Vector3 curPos = AbsolutePosition; @@ -891,7 +1031,7 @@ namespace OpenSim.Region.Framework.Scenes if(!Scene.Permissions.CanObjectEnterWithScripts(this, land)) { inTransit = false; - return; + return -3; } UUID agentID; @@ -901,49 +1041,15 @@ namespace OpenSim.Region.Framework.Scenes if(land.IsRestrictedFromLand(agentID) || land.IsBannedFromLand(agentID)) { inTransit = false; - return; + return -4; } } } - bool stop = (flags & OSTPOBJ_STOPATTARRGET) != 0; - bool setrot = (flags & OSTPOBJ_SETROT) != 0; - - rotation.Normalize(); - Quaternion currentRot = RootPart.RotationOffset; - - if(setrot) - rotation = Quaternion.Conjugate(currentRot) * rotation; - - bool dorot = setrot | (Math.Abs(rotation.W) < 0.999); - - if(stop) - { - RootPart.Stop(); - } - else - { - if(dorot) - { - Vector3 vel = RootPart.Velocity; - Vector3 avel = RootPart.AngularVelocity; - Vector3 acc = RootPart.Acceleration; - - vel *= rotation; - avel *= rotation; - acc *= rotation; - - RootPart.Velocity = vel; - RootPart.AngularVelocity = avel; - RootPart.Acceleration = acc; - } - } - - if(dorot) - { - currentRot *= rotation; - RootPart.RotationOffset = currentRot; - } + RootPart.Velocity = vel; + RootPart.AngularVelocity = avel; + RootPart.Acceleration = acc; + RootPart.RotationOffset = ori; Vector3 s = RootPart.Scale * RootPart.RotationOffset; float h = Scene.GetGroundHeight(posX, posY) + 0.5f * (float)Math.Abs(s.Z) + 0.01f; @@ -953,10 +1059,27 @@ namespace OpenSim.Region.Framework.Scenes inTransit = false; AbsolutePosition = targetPosition; RootPart.ScheduleTerseUpdate(); - return; + return 1; } - inTransit = false; + if(Scene.InTeleportTargetsCoolDown(UUID, sourceID, 20.0)) + { + inTransit = false; + return -1; + } + + TeleportObjectData tdata = new TeleportObjectData(); + tdata.flags = flags; + tdata.vel = vel; + tdata.avel = avel; + tdata.acc = acc; + tdata.ori = ori; + tdata.sourceID = sourceID; + + + SOGCrossDelegate d = CrossAsync; + d.BeginInvoke(this, targetPosition, tdata, CrossAsyncCompleted, d); + return 0; } public override Vector3 Velocity @@ -5398,9 +5521,9 @@ namespace OpenSim.Region.Framework.Scenes { if (avs[i].Name == name) { - GetLinkNumber_lastname = name; - GetLinkNumber_lastnumber = j; - return j; + GetLinkNumber_lastname = name; + GetLinkNumber_lastnumber = j; + return j; } } } -- cgit v1.1 From b52f7b920342b7ea3e0294eae054e7520801e339 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 15 Apr 2017 10:56:46 +0100 Subject: missing file and remove warnings --- OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 0e7ac58..e73795e 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -153,7 +153,7 @@ namespace OpenSim.Region.Framework.Scenes timeLastChanged = DateTime.UtcNow.Ticks; if (!m_hasGroupChanged) timeFirstChanged = DateTime.UtcNow.Ticks; - if (m_rootPart != null && m_rootPart.UUID != null && m_scene != null) + if (m_rootPart != null && m_scene != null) { /* if (m_rand == null) -- cgit v1.1