diff options
Diffstat (limited to 'OpenSim')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/ScenePresence.cs | 62 | ||||
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 40 |
2 files changed, 60 insertions, 42 deletions
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 9cceb06..059a846 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -457,6 +457,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
457 | /// </summary> | 457 | /// </summary> |
458 | private object m_originRegionIDAccessLock = new object(); | 458 | private object m_originRegionIDAccessLock = new object(); |
459 | 459 | ||
460 | |||
461 | private AutoResetEvent m_updateAgentReceivedAfterTransferEvent = new AutoResetEvent(false); | ||
462 | |||
460 | /// <summary> | 463 | /// <summary> |
461 | /// Used by the entity transfer module to signal when the presence should not be closed because a subsequent | 464 | /// Used by the entity transfer module to signal when the presence should not be closed because a subsequent |
462 | /// teleport is reusing the connection. | 465 | /// teleport is reusing the connection. |
@@ -1950,30 +1953,32 @@ namespace OpenSim.Region.Framework.Scenes | |||
1950 | // (which triggers Scene.IncomingUpdateChildAgent(AgentData cAgentData) here in the destination, | 1953 | // (which triggers Scene.IncomingUpdateChildAgent(AgentData cAgentData) here in the destination, |
1951 | // m_originRegionID is UUID.Zero; after, it's non-Zero. The CompleteMovement sequence initiated from the | 1954 | // m_originRegionID is UUID.Zero; after, it's non-Zero. The CompleteMovement sequence initiated from the |
1952 | // viewer (in turn triggered by the source region sending it a TeleportFinish event) waits until it's non-zero | 1955 | // viewer (in turn triggered by the source region sending it a TeleportFinish event) waits until it's non-zero |
1953 | // m_updateAgentReceivedAfterTransferEvent.WaitOne(10000); | ||
1954 | int count = 50; | ||
1955 | UUID originID = UUID.Zero; | ||
1956 | |||
1957 | lock (m_originRegionIDAccessLock) | ||
1958 | originID = m_originRegionID; | ||
1959 | 1956 | ||
1960 | while (originID.Equals(UUID.Zero) && count-- > 0) | 1957 | try |
1961 | { | 1958 | { |
1962 | lock (m_originRegionIDAccessLock) | 1959 | if(m_updateAgentReceivedAfterTransferEvent.WaitOne(10000)) |
1963 | originID = m_originRegionID; | 1960 | { |
1964 | 1961 | UUID originID = UUID.Zero; | |
1965 | m_log.DebugFormat("[SCENE PRESENCE]: Agent {0} waiting for update in {1}", client.Name, Scene.Name); | ||
1966 | Thread.Sleep(200); | ||
1967 | } | ||
1968 | 1962 | ||
1969 | if (originID.Equals(UUID.Zero)) | 1963 | lock (m_originRegionIDAccessLock) |
1970 | { | 1964 | originID = m_originRegionID; |
1971 | // Movement into region will fail | 1965 | if (originID.Equals(UUID.Zero)) |
1972 | m_log.WarnFormat("[SCENE PRESENCE]: Update agent {0} never arrived in {1}", client.Name, Scene.Name); | 1966 | { |
1973 | return false; | 1967 | // Movement into region will fail |
1968 | m_log.WarnFormat("[SCENE PRESENCE]: Update agent {0} at {1} got invalid origin region id ", client.Name, Scene.Name); | ||
1969 | return false; | ||
1970 | } | ||
1971 | return true; | ||
1972 | } | ||
1973 | else | ||
1974 | { | ||
1975 | m_log.WarnFormat("[SCENE PRESENCE]: Update agent {0} at {1} did not receive agent update ", client.Name, Scene.Name); | ||
1976 | return false; | ||
1977 | } | ||
1974 | } | 1978 | } |
1979 | catch { } | ||
1975 | 1980 | ||
1976 | return true; | 1981 | return false; |
1977 | } | 1982 | } |
1978 | 1983 | ||
1979 | public void RotateToLookAt(Vector3 lookAt) | 1984 | public void RotateToLookAt(Vector3 lookAt) |
@@ -2283,6 +2288,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
2283 | } | 2288 | } |
2284 | } | 2289 | } |
2285 | 2290 | ||
2291 | if(gotCrossUpdate) | ||
2292 | { | ||
2293 | if(IgnoredControls != ScriptControlled.CONTROL_ZERO) | ||
2294 | ControllingClient.SendTakeControls((int)IgnoredControls, false, true); | ||
2295 | |||
2296 | } | ||
2297 | |||
2286 | m_log.DebugFormat("[CompleteMovement] attachments: {0}ms", Util.EnvironmentTickCountSubtract(ts)); | 2298 | m_log.DebugFormat("[CompleteMovement] attachments: {0}ms", Util.EnvironmentTickCountSubtract(ts)); |
2287 | if (openChildAgents) | 2299 | if (openChildAgents) |
2288 | { | 2300 | { |
@@ -4574,7 +4586,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
4574 | return; | 4586 | return; |
4575 | 4587 | ||
4576 | CopyFrom(cAgentData); | 4588 | CopyFrom(cAgentData); |
4577 | 4589 | m_updateAgentReceivedAfterTransferEvent.Set(); | |
4578 | } | 4590 | } |
4579 | 4591 | ||
4580 | private static Vector3 marker = new Vector3(-1f, -1f, -1f); | 4592 | private static Vector3 marker = new Vector3(-1f, -1f, -1f); |
@@ -4787,6 +4799,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
4787 | AddToPhysicalScene(isFlying); | 4799 | AddToPhysicalScene(isFlying); |
4788 | } | 4800 | } |
4789 | */ | 4801 | */ |
4802 | |||
4803 | if (Scene.AttachmentsModule != null) | ||
4804 | Scene.AttachmentsModule.CopyAttachments(cAgent, this); | ||
4805 | |||
4790 | try | 4806 | try |
4791 | { | 4807 | { |
4792 | lock (scriptedcontrols) | 4808 | lock (scriptedcontrols) |
@@ -4794,6 +4810,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
4794 | if (cAgent.Controllers != null) | 4810 | if (cAgent.Controllers != null) |
4795 | { | 4811 | { |
4796 | scriptedcontrols.Clear(); | 4812 | scriptedcontrols.Clear(); |
4813 | IgnoredControls = ScriptControlled.CONTROL_ZERO; | ||
4797 | 4814 | ||
4798 | foreach (ControllerData c in cAgent.Controllers) | 4815 | foreach (ControllerData c in cAgent.Controllers) |
4799 | { | 4816 | { |
@@ -4804,6 +4821,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
4804 | sc.eventControls = (ScriptControlled)c.EventControls; | 4821 | sc.eventControls = (ScriptControlled)c.EventControls; |
4805 | 4822 | ||
4806 | scriptedcontrols[sc.itemID] = sc; | 4823 | scriptedcontrols[sc.itemID] = sc; |
4824 | IgnoredControls |= sc.ignoreControls; // this is not correct, aparently only last applied should count | ||
4807 | } | 4825 | } |
4808 | } | 4826 | } |
4809 | } | 4827 | } |
@@ -4824,8 +4842,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
4824 | if (cAgent.MotionState != 0) | 4842 | if (cAgent.MotionState != 0) |
4825 | Animator.currentControlState = (ScenePresenceAnimator.motionControlStates) cAgent.MotionState; | 4843 | Animator.currentControlState = (ScenePresenceAnimator.motionControlStates) cAgent.MotionState; |
4826 | 4844 | ||
4827 | if (Scene.AttachmentsModule != null) | ||
4828 | Scene.AttachmentsModule.CopyAttachments(cAgent, this); | ||
4829 | 4845 | ||
4830 | crossingFlags = cAgent.CrossingFlags; | 4846 | crossingFlags = cAgent.CrossingFlags; |
4831 | gotCrossUpdate = (crossingFlags != 0); | 4847 | gotCrossUpdate = (crossingFlags != 0); |
@@ -5108,6 +5124,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
5108 | ControllingClient = null; | 5124 | ControllingClient = null; |
5109 | LifecycleState = ScenePresenceState.Removed; | 5125 | LifecycleState = ScenePresenceState.Removed; |
5110 | IsDeleted = true; | 5126 | IsDeleted = true; |
5127 | m_updateAgentReceivedAfterTransferEvent.Dispose(); | ||
5128 | m_updateAgentReceivedAfterTransferEvent = null; | ||
5111 | } | 5129 | } |
5112 | 5130 | ||
5113 | public void AddAttachment(SceneObjectGroup gobj) | 5131 | public void AddAttachment(SceneObjectGroup gobj) |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index ba07f9c..6e28fe0 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | |||
@@ -261,7 +261,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
261 | } | 261 | } |
262 | 262 | ||
263 | // Returns if OSSL is enabled. Throws a script exception if OSSL is not allowed.. | 263 | // Returns if OSSL is enabled. Throws a script exception if OSSL is not allowed.. |
264 | // for safe funtions always active | 264 | // for safe funtions always active |
265 | public void CheckThreatLevel() | 265 | public void CheckThreatLevel() |
266 | { | 266 | { |
267 | m_host.AddScriptLPS(1); | 267 | m_host.AddScriptLPS(1); |
@@ -1056,7 +1056,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1056 | targetID, | 1056 | targetID, |
1057 | part.SitTargetPosition); | 1057 | part.SitTargetPosition); |
1058 | } | 1058 | } |
1059 | 1059 | ||
1060 | // Get a list of all the avatars/agents in the region | 1060 | // Get a list of all the avatars/agents in the region |
1061 | public LSL_List osGetAgents() | 1061 | public LSL_List osGetAgents() |
1062 | { | 1062 | { |
@@ -1074,7 +1074,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1074 | 1074 | ||
1075 | public string osGetAgentIP(string agent) | 1075 | public string osGetAgentIP(string agent) |
1076 | { | 1076 | { |
1077 | CheckThreatLevel(ThreatLevel.Severe, "osGetAgentIP"); | 1077 | CheckThreatLevel(ThreatLevel.Severe, "osGetAgentIP"); |
1078 | if(!(World.Permissions.IsGod(m_host.OwnerID))) // user god always needed | 1078 | if(!(World.Permissions.IsGod(m_host.OwnerID))) // user god always needed |
1079 | return ""; | 1079 | return ""; |
1080 | 1080 | ||
@@ -1651,7 +1651,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1651 | else | 1651 | else |
1652 | { | 1652 | { |
1653 | if (UUID.TryParse(arg, out uuid)) | 1653 | if (UUID.TryParse(arg, out uuid)) |
1654 | { | 1654 | { |
1655 | if(newLand.OwnerID != uuid) | 1655 | if(newLand.OwnerID != uuid) |
1656 | { | 1656 | { |
1657 | changed = true; | 1657 | changed = true; |
@@ -1760,7 +1760,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1760 | 1760 | ||
1761 | if(changedSeeAvs && avatar.currentParcelUUID == parcelID ) | 1761 | if(changedSeeAvs && avatar.currentParcelUUID == parcelID ) |
1762 | avatar.currentParcelUUID = parcelID; // force parcel flags review | 1762 | avatar.currentParcelUUID = parcelID; // force parcel flags review |
1763 | 1763 | ||
1764 | if(avatar.ControllingClient == null) | 1764 | if(avatar.ControllingClient == null) |
1765 | return; | 1765 | return; |
1766 | 1766 | ||
@@ -3593,7 +3593,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3593 | 3593 | ||
3594 | public int osGetSimulatorMemoryKB() | 3594 | public int osGetSimulatorMemoryKB() |
3595 | { | 3595 | { |
3596 | CheckThreatLevel(ThreatLevel.Moderate, "osGetSimulatorMemory"); | 3596 | CheckThreatLevel(ThreatLevel.Moderate, "osGetSimulatorMemoryKB"); |
3597 | 3597 | ||
3598 | long pws = System.Diagnostics.Process.GetCurrentProcess().WorkingSet64; | 3598 | long pws = System.Diagnostics.Process.GetCurrentProcess().WorkingSet64; |
3599 | 3599 | ||
@@ -4500,7 +4500,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
4500 | /// LSL_Vector CenterOfMass, center mass relative to root prim | 4500 | /// LSL_Vector CenterOfMass, center mass relative to root prim |
4501 | /// LSL_Vector Inertia, elements of diagonal of inertia Ixx,Iyy,Izz divided by total mass | 4501 | /// LSL_Vector Inertia, elements of diagonal of inertia Ixx,Iyy,Izz divided by total mass |
4502 | /// LSL_Vector aux, elements of upper triagle of inertia Ixy (= Iyx), Ixz (= Izx), Iyz(= Izy) divided by total mass | 4502 | /// LSL_Vector aux, elements of upper triagle of inertia Ixy (= Iyx), Ixz (= Izx), Iyz(= Izy) divided by total mass |
4503 | /// </returns> | 4503 | /// </returns> |
4504 | public LSL_List osGetInertiaData() | 4504 | public LSL_List osGetInertiaData() |
4505 | { | 4505 | { |
4506 | CheckThreatLevel(); | 4506 | CheckThreatLevel(); |
@@ -4513,8 +4513,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
4513 | 4513 | ||
4514 | SceneObjectGroup sog = m_host.ParentGroup; | 4514 | SceneObjectGroup sog = m_host.ParentGroup; |
4515 | if(sog== null || sog.IsDeleted) | 4515 | if(sog== null || sog.IsDeleted) |
4516 | return result; | 4516 | return result; |
4517 | 4517 | ||
4518 | sog.GetInertiaData(out TotalMass, out CenterOfMass, out Inertia, out aux ); | 4518 | sog.GetInertiaData(out TotalMass, out CenterOfMass, out Inertia, out aux ); |
4519 | if(TotalMass > 0) | 4519 | if(TotalMass > 0) |
4520 | { | 4520 | { |
@@ -4538,7 +4538,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
4538 | /// <summary> | 4538 | /// <summary> |
4539 | /// set inertial data | 4539 | /// set inertial data |
4540 | /// replaces the automatic calculation of mass, center of mass and inertia | 4540 | /// replaces the automatic calculation of mass, center of mass and inertia |
4541 | /// | 4541 | /// |
4542 | /// </summary> | 4542 | /// </summary> |
4543 | /// <param name="Mass">total mass of linkset</param> | 4543 | /// <param name="Mass">total mass of linkset</param> |
4544 | /// <param name="centerOfMass">location of center of mass relative to root prim in local coords</param> | 4544 | /// <param name="centerOfMass">location of center of mass relative to root prim in local coords</param> |
@@ -4562,7 +4562,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
4562 | // need more checks | 4562 | // need more checks |
4563 | 4563 | ||
4564 | Vector3 CenterOfMass = new Vector3((float)centerOfMass.x,(float)centerOfMass.y,(float)centerOfMass.z); | 4564 | Vector3 CenterOfMass = new Vector3((float)centerOfMass.x,(float)centerOfMass.y,(float)centerOfMass.z); |
4565 | Vector3 Inertia; | 4565 | Vector3 Inertia; |
4566 | float m = (float)mass; | 4566 | float m = (float)mass; |
4567 | 4567 | ||
4568 | Inertia.X = m * (float)principalInertiaScaled.x; | 4568 | Inertia.X = m * (float)principalInertiaScaled.x; |
@@ -4578,7 +4578,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
4578 | /// <summary> | 4578 | /// <summary> |
4579 | /// set inertial data as a sphere | 4579 | /// set inertial data as a sphere |
4580 | /// replaces the automatic calculation of mass, center of mass and inertia | 4580 | /// replaces the automatic calculation of mass, center of mass and inertia |
4581 | /// | 4581 | /// |
4582 | /// </summary> | 4582 | /// </summary> |
4583 | /// <param name="Mass">total mass of linkset</param> | 4583 | /// <param name="Mass">total mass of linkset</param> |
4584 | /// <param name="boxsize">size of the Box</param> | 4584 | /// <param name="boxsize">size of the Box</param> |
@@ -4600,7 +4600,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
4600 | // need more checks | 4600 | // need more checks |
4601 | 4601 | ||
4602 | Vector3 CenterOfMass = new Vector3((float)centerOfMass.x,(float)centerOfMass.y,(float)centerOfMass.z); | 4602 | Vector3 CenterOfMass = new Vector3((float)centerOfMass.x,(float)centerOfMass.y,(float)centerOfMass.z); |
4603 | Vector3 Inertia; | 4603 | Vector3 Inertia; |
4604 | float lx = (float)boxSize.x; | 4604 | float lx = (float)boxSize.x; |
4605 | float ly = (float)boxSize.y; | 4605 | float ly = (float)boxSize.y; |
4606 | float lz = (float)boxSize.z; | 4606 | float lz = (float)boxSize.z; |
@@ -4620,7 +4620,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
4620 | /// <summary> | 4620 | /// <summary> |
4621 | /// set inertial data as a sphere | 4621 | /// set inertial data as a sphere |
4622 | /// replaces the automatic calculation of mass, center of mass and inertia | 4622 | /// replaces the automatic calculation of mass, center of mass and inertia |
4623 | /// | 4623 | /// |
4624 | /// </summary> | 4624 | /// </summary> |
4625 | /// <param name="Mass">total mass of linkset</param> | 4625 | /// <param name="Mass">total mass of linkset</param> |
4626 | /// <param name="radius">radius of the sphere</param> | 4626 | /// <param name="radius">radius of the sphere</param> |
@@ -4639,9 +4639,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
4639 | return; | 4639 | return; |
4640 | 4640 | ||
4641 | // need more checks | 4641 | // need more checks |
4642 | 4642 | ||
4643 | Vector3 CenterOfMass = new Vector3((float)centerOfMass.x,(float)centerOfMass.y,(float)centerOfMass.z); | 4643 | Vector3 CenterOfMass = new Vector3((float)centerOfMass.x,(float)centerOfMass.y,(float)centerOfMass.z); |
4644 | Vector3 Inertia; | 4644 | Vector3 Inertia; |
4645 | float r = (float)radius; | 4645 | float r = (float)radius; |
4646 | float m = (float)mass; | 4646 | float m = (float)mass; |
4647 | float t = 0.4f * m * r * r; | 4647 | float t = 0.4f * m * r * r; |
@@ -4656,7 +4656,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
4656 | /// <summary> | 4656 | /// <summary> |
4657 | /// set inertial data as a cylinder | 4657 | /// set inertial data as a cylinder |
4658 | /// replaces the automatic calculation of mass, center of mass and inertia | 4658 | /// replaces the automatic calculation of mass, center of mass and inertia |
4659 | /// | 4659 | /// |
4660 | /// </summary> | 4660 | /// </summary> |
4661 | /// <param name="Mass">total mass of linkset</param> | 4661 | /// <param name="Mass">total mass of linkset</param> |
4662 | /// <param name="radius">radius of the cylinder</param> | 4662 | /// <param name="radius">radius of the cylinder</param> |
@@ -4678,9 +4678,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
4678 | return; | 4678 | return; |
4679 | 4679 | ||
4680 | // need more checks | 4680 | // need more checks |
4681 | 4681 | ||
4682 | Vector3 CenterOfMass = new Vector3((float)centerOfMass.x,(float)centerOfMass.y,(float)centerOfMass.z); | 4682 | Vector3 CenterOfMass = new Vector3((float)centerOfMass.x,(float)centerOfMass.y,(float)centerOfMass.z); |
4683 | Vector3 Inertia; | 4683 | Vector3 Inertia; |
4684 | float m = (float)mass; | 4684 | float m = (float)mass; |
4685 | float r = (float)radius; | 4685 | float r = (float)radius; |
4686 | r *= r; | 4686 | r *= r; |
@@ -4702,7 +4702,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
4702 | /// <summary> | 4702 | /// <summary> |
4703 | /// removes inertial data manual override | 4703 | /// removes inertial data manual override |
4704 | /// default automatic calculation is used again | 4704 | /// default automatic calculation is used again |
4705 | /// | 4705 | /// |
4706 | /// </summary> | 4706 | /// </summary> |
4707 | public void osClearInertia() | 4707 | public void osClearInertia() |
4708 | { | 4708 | { |