diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index dbf493c7bc..5a3dc20be0 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -469,13 +469,22 @@ namespace OpenSim.Region.Framework.Scenes return; } } - foreach (SceneObjectPart part in m_parts.Values) + List parts = new List(m_parts.Values); + lockPartsForRead(false); + foreach (SceneObjectPart part in parts) { part.IgnoreUndoUpdate = false; part.StoreUndoState(UndoType.STATE_GROUP_POSITION); part.GroupPosition = val; } - lockPartsForRead(false); + + foreach (ScenePresence av in m_linkedAvatars) + { + Vector3 offset = m_parts[av.LinkedPrim].GetWorldPosition() - av.ParentPosition; + av.AbsolutePosition += offset; + av.ParentPosition = m_parts[av.LinkedPrim].GetWorldPosition(); //ParentPosition gets cleared by AbsolutePosition + av.SendFullUpdateToAllClients(); + } //if (m_rootPart.PhysActor != null) //{ diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index ba84b88381..badd357b1b 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -682,25 +682,13 @@ namespace OpenSim.Region.Framework.Scenes // Tell the physics engines that this prim changed. m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(actor); + } catch (Exception e) { m_log.Error("[SCENEOBJECTPART]: GROUP POSITION. " + e.Message); } } - - // TODO if we decide to do sitting in a more SL compatible way (multiple avatars per prim), this has to be fixed, too - if (m_sitTargetAvatar != UUID.Zero) - { - if (m_parentGroup != null) // TODO can there be a SOP without a SOG? - { - ScenePresence avatar; - if (m_parentGroup.Scene.TryGetScenePresence(m_sitTargetAvatar, out avatar)) - { - avatar.ParentPosition = GetWorldPosition(); - } - } - } } } @@ -709,6 +697,7 @@ namespace OpenSim.Region.Framework.Scenes get { return m_offsetPosition; } set { + Vector3 oldpos = m_offsetPosition; StoreUndoState(UndoType.STATE_PRIM_POSITION); m_offsetPosition = value; @@ -727,7 +716,12 @@ namespace OpenSim.Region.Framework.Scenes List avs = ParentGroup.GetLinkedAvatars(); foreach (ScenePresence av in avs) { - av.SendFullUpdateToAllClients(); + if (av.LinkedPrim == m_uuid) + { + Vector3 offset = (m_offsetPosition - oldpos); + av.OffsetPosition += offset; + av.SendFullUpdateToAllClients(); + } } } } diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 5fcd1c2903..44c3d12521 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -595,11 +595,21 @@ namespace OpenSim.Region.Framework.Scenes private uint m_parentID; + + private UUID m_linkedPrim; + public uint ParentID { get { return m_parentID; } set { m_parentID = value; } } + + public UUID LinkedPrim + { + get { return m_linkedPrim; } + set { m_linkedPrim = value; } + } + public float Health { get { return m_health; } @@ -1835,6 +1845,7 @@ namespace OpenSim.Region.Framework.Scenes m_parentPosition = Vector3.Zero; m_parentID = 0; + m_linkedPrim = UUID.Zero; m_offsetRotation = new Quaternion(0.0f, 0.0f, 0.0f, 1.0f); SendFullUpdateToAllClients(); m_requestedSitTargetID = 0; @@ -2422,6 +2433,8 @@ Console.WriteLine("Scripted Sit ofset {0}", m_pos); m_parentID = m_requestedSitTargetID; } + m_linkedPrim = part.UUID; + Velocity = Vector3.Zero; RemoveFromPhysicalScene(); diff --git a/OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs b/OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs index 9f6ea35e31..0c99d8cb95 100644 --- a/OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs +++ b/OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs @@ -38,10 +38,11 @@ namespace OpenSim.Region.ScriptEngine.Interfaces { public enum StateSource { - NewRez = 0, - PrimCrossing = 1, - ScriptedRez = 2, - AttachedRez = 3 + RegionStart = 0, + NewRez = 1, + PrimCrossing = 2, + ScriptedRez = 3, + AttachedRez = 4 } public interface IScriptWorkItem