diff options
author | Melanie | 2013-03-14 22:34:15 +0000 |
---|---|---|
committer | Melanie | 2013-03-14 22:34:15 +0000 |
commit | 8b657773e4305dc853802017b3353d8d85872e14 (patch) | |
tree | 9810e0c221baf927110b34a2d0545182e25595fd /OpenSim/Region | |
parent | Merge branch 'avination' into careminster (diff) | |
parent | refactor: use LSL_Rotation(Quaternion) constructor in lLGetRootRotation() (diff) | |
download | opensim-SC_OLD-8b657773e4305dc853802017b3353d8d85872e14.zip opensim-SC_OLD-8b657773e4305dc853802017b3353d8d85872e14.tar.gz opensim-SC_OLD-8b657773e4305dc853802017b3353d8d85872e14.tar.bz2 opensim-SC_OLD-8b657773e4305dc853802017b3353d8d85872e14.tar.xz |
Merge branch 'master' into careminster
Conflicts:
OpenSim/Region/Framework/Scenes/ScenePresence.cs
OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs
Diffstat (limited to 'OpenSim/Region')
7 files changed, 251 insertions, 56 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/DynamicAttributes/DAExampleModule.cs b/OpenSim/Region/CoreModules/Framework/DynamicAttributes/DAExampleModule.cs index 37131b9..f874495 100644 --- a/OpenSim/Region/CoreModules/Framework/DynamicAttributes/DAExampleModule.cs +++ b/OpenSim/Region/CoreModules/Framework/DynamicAttributes/DAExampleModule.cs | |||
@@ -85,19 +85,27 @@ namespace OpenSim.Region.Framework.DynamicAttributes.DAExampleModule | |||
85 | { | 85 | { |
86 | OSDMap attrs = null; | 86 | OSDMap attrs = null; |
87 | SceneObjectPart sop = m_scene.GetSceneObjectPart(groupId); | 87 | SceneObjectPart sop = m_scene.GetSceneObjectPart(groupId); |
88 | |||
89 | if (sop == null) | ||
90 | return true; | ||
91 | |||
88 | if (!sop.DynAttrs.TryGetValue(Name, out attrs)) | 92 | if (!sop.DynAttrs.TryGetValue(Name, out attrs)) |
89 | attrs = new OSDMap(); | 93 | attrs = new OSDMap(); |
90 | 94 | ||
91 | OSDInteger newValue; | 95 | OSDInteger newValue; |
92 | |||
93 | if (!attrs.ContainsKey("moves")) | ||
94 | newValue = new OSDInteger(1); | ||
95 | else | ||
96 | newValue = new OSDInteger(((OSDInteger)attrs["moves"]).AsInteger() + 1); | ||
97 | |||
98 | attrs["moves"] = newValue; | ||
99 | 96 | ||
100 | sop.DynAttrs[Name] = attrs; | 97 | // We have to lock on the entire dynamic attributes map to avoid race conditions with serialization code. |
98 | lock (sop.DynAttrs) | ||
99 | { | ||
100 | if (!attrs.ContainsKey("moves")) | ||
101 | newValue = new OSDInteger(1); | ||
102 | else | ||
103 | newValue = new OSDInteger(attrs["moves"].AsInteger() + 1); | ||
104 | |||
105 | attrs["moves"] = newValue; | ||
106 | |||
107 | sop.DynAttrs[Name] = attrs; | ||
108 | } | ||
101 | 109 | ||
102 | m_dialogMod.SendGeneralAlert(string.Format("{0} {1} moved {2} times", sop.Name, sop.UUID, newValue)); | 110 | m_dialogMod.SendGeneralAlert(string.Format("{0} {1} moved {2} times", sop.Name, sop.UUID, newValue)); |
103 | 111 | ||
diff --git a/OpenSim/Region/CoreModules/Framework/DynamicAttributes/DOExampleModule.cs b/OpenSim/Region/CoreModules/Framework/DynamicAttributes/DOExampleModule.cs new file mode 100644 index 0000000..71bb3f0 --- /dev/null +++ b/OpenSim/Region/CoreModules/Framework/DynamicAttributes/DOExampleModule.cs | |||
@@ -0,0 +1,117 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Reflection; | ||
31 | using log4net; | ||
32 | using Mono.Addins; | ||
33 | using Nini.Config; | ||
34 | using OpenMetaverse; | ||
35 | using OpenMetaverse.Packets; | ||
36 | using OpenMetaverse.StructuredData; | ||
37 | using OpenSim.Framework; | ||
38 | using OpenSim.Region.Framework; | ||
39 | using OpenSim.Region.Framework.Interfaces; | ||
40 | using OpenSim.Region.Framework.Scenes; | ||
41 | |||
42 | namespace OpenSim.Region.Framework.DynamicAttributes.DOExampleModule | ||
43 | { | ||
44 | /// <summary> | ||
45 | /// Example module for experimenting with and demonstrating dynamic object ideas. | ||
46 | /// </summary> | ||
47 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "DOExampleModule")] | ||
48 | public class DOExampleModule : INonSharedRegionModule | ||
49 | { | ||
50 | public class MyObject | ||
51 | { | ||
52 | public int Moves { get; set; } | ||
53 | } | ||
54 | |||
55 | // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
56 | |||
57 | private static readonly bool ENABLED = false; // enable for testing | ||
58 | |||
59 | private Scene m_scene; | ||
60 | private IDialogModule m_dialogMod; | ||
61 | |||
62 | public string Name { get { return "DOExample Module"; } } | ||
63 | public Type ReplaceableInterface { get { return null; } } | ||
64 | |||
65 | public void Initialise(IConfigSource source) {} | ||
66 | |||
67 | public void AddRegion(Scene scene) | ||
68 | { | ||
69 | if (ENABLED) | ||
70 | { | ||
71 | m_scene = scene; | ||
72 | m_scene.EventManager.OnObjectAddedToScene += OnObjectAddedToScene; | ||
73 | m_scene.EventManager.OnSceneGroupMove += OnSceneGroupMove; | ||
74 | m_dialogMod = m_scene.RequestModuleInterface<IDialogModule>(); | ||
75 | } | ||
76 | } | ||
77 | |||
78 | public void RemoveRegion(Scene scene) | ||
79 | { | ||
80 | if (ENABLED) | ||
81 | { | ||
82 | m_scene.EventManager.OnSceneGroupMove -= OnSceneGroupMove; | ||
83 | } | ||
84 | } | ||
85 | |||
86 | public void RegionLoaded(Scene scene) {} | ||
87 | |||
88 | public void Close() | ||
89 | { | ||
90 | RemoveRegion(m_scene); | ||
91 | } | ||
92 | |||
93 | private void OnObjectAddedToScene(SceneObjectGroup so) | ||
94 | { | ||
95 | so.RootPart.DynObjs.Add(Name, new MyObject()); | ||
96 | } | ||
97 | |||
98 | private bool OnSceneGroupMove(UUID groupId, Vector3 delta) | ||
99 | { | ||
100 | SceneObjectGroup so = m_scene.GetSceneObjectGroup(groupId); | ||
101 | |||
102 | if (so == null) | ||
103 | return true; | ||
104 | |||
105 | object rawObj = so.RootPart.DynObjs.Get(Name); | ||
106 | |||
107 | if (rawObj != null) | ||
108 | { | ||
109 | MyObject myObj = (MyObject)rawObj; | ||
110 | |||
111 | m_dialogMod.SendGeneralAlert(string.Format("{0} {1} moved {2} times", so.Name, so.UUID, ++myObj.Moves)); | ||
112 | } | ||
113 | |||
114 | return true; | ||
115 | } | ||
116 | } | ||
117 | } \ No newline at end of file | ||
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index b8c209e..ffde415 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | |||
@@ -141,6 +141,27 @@ namespace OpenSim.Region.Framework.Scenes | |||
141 | /// Dynamic attributes can be created and deleted as required. | 141 | /// Dynamic attributes can be created and deleted as required. |
142 | /// </summary> | 142 | /// </summary> |
143 | public DAMap DynAttrs { get; set; } | 143 | public DAMap DynAttrs { get; set; } |
144 | |||
145 | private DOMap m_dynObjs; | ||
146 | |||
147 | /// <summary> | ||
148 | /// Dynamic objects that can be created and deleted as required. | ||
149 | /// </summary> | ||
150 | public DOMap DynObjs | ||
151 | { | ||
152 | get | ||
153 | { | ||
154 | if (m_dynObjs == null) | ||
155 | m_dynObjs = new DOMap(); | ||
156 | |||
157 | return m_dynObjs; | ||
158 | } | ||
159 | |||
160 | set | ||
161 | { | ||
162 | m_dynObjs = value; | ||
163 | } | ||
164 | } | ||
144 | 165 | ||
145 | /// <value> | 166 | /// <value> |
146 | /// Is this a root part? | 167 | /// Is this a root part? |
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index cda438f..3e3b3af 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -590,12 +590,25 @@ namespace OpenSim.Region.Framework.Scenes | |||
590 | */ | 590 | */ |
591 | private Quaternion m_bodyRot = Quaternion.Identity; | 591 | private Quaternion m_bodyRot = Quaternion.Identity; |
592 | 592 | ||
593 | /// <summary> | ||
594 | /// The rotation of the avatar. | ||
595 | /// </summary> | ||
596 | /// <remarks> | ||
597 | /// If the avatar is not sitting, this is with respect to the world | ||
598 | /// If the avatar is sitting, this is a with respect to the part that it's sitting upon (a local rotation). | ||
599 | /// If you always want the world rotation, use GetWorldRotation() | ||
600 | /// </remarks> | ||
593 | public Quaternion Rotation | 601 | public Quaternion Rotation |
594 | { | 602 | { |
595 | get { return m_bodyRot; } | 603 | get |
604 | { | ||
605 | return m_bodyRot; | ||
606 | } | ||
607 | |||
596 | set | 608 | set |
597 | { | 609 | { |
598 | m_bodyRot = value; | 610 | m_bodyRot = value; |
611 | |||
599 | if (PhysicsActor != null) | 612 | if (PhysicsActor != null) |
600 | { | 613 | { |
601 | try | 614 | try |
@@ -654,6 +667,26 @@ namespace OpenSim.Region.Framework.Scenes | |||
654 | set { m_health = value; } | 667 | set { m_health = value; } |
655 | } | 668 | } |
656 | 669 | ||
670 | /// <summary> | ||
671 | /// Gets the world rotation of this presence. | ||
672 | /// </summary> | ||
673 | /// <remarks> | ||
674 | /// Unlike Rotation, this returns the world rotation no matter whether the avatar is sitting on a prim or not. | ||
675 | /// </remarks> | ||
676 | /// <returns></returns> | ||
677 | public Quaternion GetWorldRotation() | ||
678 | { | ||
679 | if (IsSatOnObject) | ||
680 | { | ||
681 | SceneObjectPart sitPart = ParentPart; | ||
682 | |||
683 | if (sitPart != null) | ||
684 | return sitPart.GetWorldRotation() * Rotation; | ||
685 | } | ||
686 | |||
687 | return Rotation; | ||
688 | } | ||
689 | |||
657 | public void AdjustKnownSeeds() | 690 | public void AdjustKnownSeeds() |
658 | { | 691 | { |
659 | Dictionary<ulong, string> seeds; | 692 | Dictionary<ulong, string> seeds; |
@@ -755,8 +788,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
755 | 788 | ||
756 | #endregion | 789 | #endregion |
757 | 790 | ||
758 | |||
759 | |||
760 | #region Constructor(s) | 791 | #region Constructor(s) |
761 | 792 | ||
762 | public ScenePresence( | 793 | public ScenePresence( |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index ab4b172..d634805 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -2441,14 +2441,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2441 | if ((avatar.AgentControlFlags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_MOUSELOOK) != 0) | 2441 | if ((avatar.AgentControlFlags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_MOUSELOOK) != 0) |
2442 | q = avatar.CameraRotation; // Mouselook | 2442 | q = avatar.CameraRotation; // Mouselook |
2443 | else | 2443 | else |
2444 | q = avatar.Rotation; // Currently infrequently updated so may be inaccurate | 2444 | q = avatar.GetWorldRotation(); // Currently infrequently updated so may be inaccurate |
2445 | } | 2445 | } |
2446 | else | 2446 | else |
2447 | q = part.ParentGroup.GroupRotation; // Likely never get here but just in case | 2447 | q = part.ParentGroup.GroupRotation; // Likely never get here but just in case |
2448 | } | 2448 | } |
2449 | else | 2449 | else |
2450 | q = part.ParentGroup.GroupRotation; // just the group rotation | 2450 | q = part.ParentGroup.GroupRotation; // just the group rotation |
2451 | return new LSL_Rotation(q.X, q.Y, q.Z, q.W); | 2451 | |
2452 | return new LSL_Rotation(q); | ||
2452 | } | 2453 | } |
2453 | 2454 | ||
2454 | q = part.GetWorldRotation(); | 2455 | q = part.GetWorldRotation(); |
@@ -2572,8 +2573,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2572 | public LSL_Vector llGetTorque() | 2573 | public LSL_Vector llGetTorque() |
2573 | { | 2574 | { |
2574 | m_host.AddScriptLPS(1); | 2575 | m_host.AddScriptLPS(1); |
2575 | Vector3 torque = m_host.ParentGroup.GetTorque(); | 2576 | |
2576 | return new LSL_Vector(torque.X,torque.Y,torque.Z); | 2577 | return new LSL_Vector(m_host.ParentGroup.GetTorque()); |
2577 | } | 2578 | } |
2578 | 2579 | ||
2579 | public void llSetForceAndTorque(LSL_Vector force, LSL_Vector torque, int local) | 2580 | public void llSetForceAndTorque(LSL_Vector force, LSL_Vector torque, int local) |
@@ -2606,13 +2607,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2606 | vel = m_host.ParentGroup.RootPart.Velocity; | 2607 | vel = m_host.ParentGroup.RootPart.Velocity; |
2607 | } | 2608 | } |
2608 | 2609 | ||
2609 | return new LSL_Vector(vel.X, vel.Y, vel.Z); | 2610 | return new LSL_Vector(vel); |
2610 | } | 2611 | } |
2611 | 2612 | ||
2612 | public LSL_Vector llGetAccel() | 2613 | public LSL_Vector llGetAccel() |
2613 | { | 2614 | { |
2614 | m_host.AddScriptLPS(1); | 2615 | m_host.AddScriptLPS(1); |
2615 | return new LSL_Vector(m_host.Acceleration.X, m_host.Acceleration.Y, m_host.Acceleration.Z); | 2616 | |
2617 | return new LSL_Vector(m_host.Acceleration); | ||
2616 | } | 2618 | } |
2617 | 2619 | ||
2618 | public void llSetAngularVelocity(LSL_Vector avel, int local) | 2620 | public void llSetAngularVelocity(LSL_Vector avel, int local) |
@@ -3447,14 +3449,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3447 | msg.offline = (byte)0; //offline; | 3449 | msg.offline = (byte)0; //offline; |
3448 | msg.ParentEstateID = World.RegionInfo.EstateSettings.EstateID; | 3450 | msg.ParentEstateID = World.RegionInfo.EstateSettings.EstateID; |
3449 | msg.Position = new Vector3(m_host.AbsolutePosition); | 3451 | msg.Position = new Vector3(m_host.AbsolutePosition); |
3450 | msg.RegionID = World.RegionInfo.RegionID.Guid; | 3452 | msg.RegionID = World.RegionInfo.RegionID.Guid;//RegionID.Guid; |
3453 | |||
3454 | Vector3 pos = m_host.AbsolutePosition; | ||
3451 | msg.binaryBucket | 3455 | msg.binaryBucket |
3452 | = Util.StringToBytes256( | 3456 | = Util.StringToBytes256( |
3453 | "{0}/{1}/{2}/{3}", | 3457 | "{0}/{1}/{2}/{3}", |
3454 | World.RegionInfo.RegionName, | 3458 | World.RegionInfo.RegionName, |
3455 | (int)Math.Floor(m_host.AbsolutePosition.X), | 3459 | (int)Math.Floor(pos.X), |
3456 | (int)Math.Floor(m_host.AbsolutePosition.Y), | 3460 | (int)Math.Floor(pos.Y), |
3457 | (int)Math.Floor(m_host.AbsolutePosition.Z)); | 3461 | (int)Math.Floor(pos.Z)); |
3458 | 3462 | ||
3459 | if (m_TransferModule != null) | 3463 | if (m_TransferModule != null) |
3460 | { | 3464 | { |
@@ -4594,9 +4598,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
4594 | if (destination == String.Empty) | 4598 | if (destination == String.Empty) |
4595 | destination = World.RegionInfo.RegionName; | 4599 | destination = World.RegionInfo.RegionName; |
4596 | 4600 | ||
4601 | Vector3 pos = presence.AbsolutePosition; | ||
4602 | |||
4597 | // agent must be over the owners land | 4603 | // agent must be over the owners land |
4598 | if (m_host.OwnerID == World.LandChannel.GetLandObject( | 4604 | if (m_host.OwnerID == World.LandChannel.GetLandObject(pos.X, pos.Y).LandData.OwnerID) |
4599 | presence.AbsolutePosition.X, presence.AbsolutePosition.Y).LandData.OwnerID) | ||
4600 | { | 4605 | { |
4601 | DoLLTeleport(presence, destination, targetPos, targetLookAt); | 4606 | DoLLTeleport(presence, destination, targetPos, targetLookAt); |
4602 | } | 4607 | } |
@@ -4626,9 +4631,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
4626 | // agent must not be a god | 4631 | // agent must not be a god |
4627 | if (presence.GodLevel >= 200) return; | 4632 | if (presence.GodLevel >= 200) return; |
4628 | 4633 | ||
4634 | Vector3 pos = presence.AbsolutePosition; | ||
4635 | |||
4629 | // agent must be over the owners land | 4636 | // agent must be over the owners land |
4630 | if (m_host.OwnerID == World.LandChannel.GetLandObject( | 4637 | if (m_host.OwnerID == World.LandChannel.GetLandObject(pos.X, pos.Y).LandData.OwnerID) |
4631 | presence.AbsolutePosition.X, presence.AbsolutePosition.Y).LandData.OwnerID) | ||
4632 | { | 4638 | { |
4633 | World.RequestTeleportLocation(presence.ControllingClient, regionHandle, targetPos, targetLookAt, (uint)TeleportFlags.ViaLocation); | 4639 | World.RequestTeleportLocation(presence.ControllingClient, regionHandle, targetPos, targetLookAt, (uint)TeleportFlags.ViaLocation); |
4634 | } | 4640 | } |
@@ -5282,8 +5288,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
5282 | public LSL_Vector llGetCenterOfMass() | 5288 | public LSL_Vector llGetCenterOfMass() |
5283 | { | 5289 | { |
5284 | m_host.AddScriptLPS(1); | 5290 | m_host.AddScriptLPS(1); |
5285 | Vector3 center = m_host.GetCenterOfMass(); | 5291 | |
5286 | return new LSL_Vector(center.X,center.Y,center.Z); | 5292 | return new LSL_Vector(m_host.GetCenterOfMass()); |
5287 | } | 5293 | } |
5288 | 5294 | ||
5289 | public LSL_List llListSort(LSL_List src, int stride, int ascending) | 5295 | public LSL_List llListSort(LSL_List src, int stride, int ascending) |
@@ -6302,15 +6308,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
6302 | ScenePresence presence = World.GetScenePresence(agentID); | 6308 | ScenePresence presence = World.GetScenePresence(agentID); |
6303 | if (presence != null) | 6309 | if (presence != null) |
6304 | { | 6310 | { |
6311 | Vector3 pos = presence.AbsolutePosition; | ||
6312 | |||
6305 | // agent must be over the owners land | 6313 | // agent must be over the owners land |
6306 | ILandObject land = World.LandChannel.GetLandObject(presence.AbsolutePosition.X, presence.AbsolutePosition.Y); | 6314 | ILandObject land = World.LandChannel.GetLandObject(pos.X, pos.Y); |
6307 | if (land == null) | 6315 | if (land == null) |
6308 | return; | 6316 | return; |
6309 | 6317 | ||
6310 | if (m_host.OwnerID == land.LandData.OwnerID) | 6318 | if (m_host.OwnerID == land.LandData.OwnerID) |
6311 | { | 6319 | { |
6312 | Vector3 pos = World.GetNearestAllowedPosition(presence, land); | 6320 | Vector3 p = World.GetNearestAllowedPosition(presence, land); |
6313 | presence.TeleportWithMomentum(pos, null); | 6321 | presence.TeleportWithMomentum(p, null); |
6314 | presence.ControllingClient.SendAlertMessage("You have been ejected from this land"); | 6322 | presence.ControllingClient.SendAlertMessage("You have been ejected from this land"); |
6315 | } | 6323 | } |
6316 | } | 6324 | } |
@@ -6332,19 +6340,22 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
6332 | ScenePresence presence = World.GetScenePresence(key); | 6340 | ScenePresence presence = World.GetScenePresence(key); |
6333 | if (presence != null) // object is an avatar | 6341 | if (presence != null) // object is an avatar |
6334 | { | 6342 | { |
6335 | if (m_host.OwnerID | 6343 | Vector3 pos = presence.AbsolutePosition; |
6336 | == World.LandChannel.GetLandObject( | 6344 | |
6337 | presence.AbsolutePosition.X, presence.AbsolutePosition.Y).LandData.OwnerID) | 6345 | if (m_host.OwnerID == World.LandChannel.GetLandObject(pos.X, pos.Y).LandData.OwnerID) |
6338 | return 1; | 6346 | return 1; |
6339 | } | 6347 | } |
6340 | else // object is not an avatar | 6348 | else // object is not an avatar |
6341 | { | 6349 | { |
6342 | SceneObjectPart obj = World.GetSceneObjectPart(key); | 6350 | SceneObjectPart obj = World.GetSceneObjectPart(key); |
6351 | |||
6343 | if (obj != null) | 6352 | if (obj != null) |
6344 | if (m_host.OwnerID | 6353 | { |
6345 | == World.LandChannel.GetLandObject( | 6354 | Vector3 pos = obj.AbsolutePosition; |
6346 | obj.AbsolutePosition.X, obj.AbsolutePosition.Y).LandData.OwnerID) | 6355 | |
6356 | if (m_host.OwnerID == World.LandChannel.GetLandObject(pos.X, pos.Y).LandData.OwnerID) | ||
6347 | return 1; | 6357 | return 1; |
6358 | } | ||
6348 | } | 6359 | } |
6349 | } | 6360 | } |
6350 | 6361 | ||
@@ -6453,7 +6464,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
6453 | // or | 6464 | // or |
6454 | // if the object is owned by a person with estate access. | 6465 | // if the object is owned by a person with estate access. |
6455 | 6466 | ||
6456 | ILandObject parcel = World.LandChannel.GetLandObject(av.AbsolutePosition.X, av.AbsolutePosition.Y); | 6467 | Vector3 pos = av.AbsolutePosition; |
6468 | |||
6469 | ILandObject parcel = World.LandChannel.GetLandObject(pos.X, pos.Y); | ||
6457 | if (parcel != null) | 6470 | if (parcel != null) |
6458 | { | 6471 | { |
6459 | if (m_host.OwnerID == parcel.LandData.OwnerID || | 6472 | if (m_host.OwnerID == parcel.LandData.OwnerID || |
@@ -6465,14 +6478,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
6465 | } | 6478 | } |
6466 | } | 6479 | } |
6467 | } | 6480 | } |
6468 | |||
6469 | } | 6481 | } |
6470 | |||
6471 | } | 6482 | } |
6472 | 6483 | ||
6473 | public LSL_Vector llGroundSlope(LSL_Vector offset) | 6484 | public LSL_Vector llGroundSlope(LSL_Vector offset) |
6474 | { | 6485 | { |
6475 | m_host.AddScriptLPS(1); | 6486 | m_host.AddScriptLPS(1); |
6487 | |||
6476 | //Get the slope normal. This gives us the equation of the plane tangent to the slope. | 6488 | //Get the slope normal. This gives us the equation of the plane tangent to the slope. |
6477 | LSL_Vector vsn = llGroundNormal(offset); | 6489 | LSL_Vector vsn = llGroundNormal(offset); |
6478 | 6490 | ||
@@ -6483,7 +6495,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
6483 | vsl.Normalize(); | 6495 | vsl.Normalize(); |
6484 | //Normalization might be overkill here | 6496 | //Normalization might be overkill here |
6485 | 6497 | ||
6486 | return new LSL_Vector(vsl.X, vsl.Y, vsl.Z); | 6498 | vsn.x = vsl.X; |
6499 | vsn.y = vsl.Y; | ||
6500 | vsn.z = vsl.Z; | ||
6501 | |||
6502 | return vsn; | ||
6487 | } | 6503 | } |
6488 | 6504 | ||
6489 | public LSL_Vector llGroundNormal(LSL_Vector offset) | 6505 | public LSL_Vector llGroundNormal(LSL_Vector offset) |
@@ -6533,7 +6549,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
6533 | //I believe the crossproduct of two normalized vectors is a normalized vector so | 6549 | //I believe the crossproduct of two normalized vectors is a normalized vector so |
6534 | //this normalization may be overkill | 6550 | //this normalization may be overkill |
6535 | 6551 | ||
6536 | return new LSL_Vector(vsn.X, vsn.Y, vsn.Z); | 6552 | return new LSL_Vector(vsn); |
6537 | } | 6553 | } |
6538 | 6554 | ||
6539 | public LSL_Vector llGroundContour(LSL_Vector offset) | 6555 | public LSL_Vector llGroundContour(LSL_Vector offset) |
@@ -7037,7 +7053,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
7037 | { | 7053 | { |
7038 | m_host.AddScriptLPS(1); | 7054 | m_host.AddScriptLPS(1); |
7039 | UUID key; | 7055 | UUID key; |
7040 | ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y); | 7056 | Vector3 pos = m_host.AbsolutePosition; |
7057 | |||
7058 | ILandObject land = World.LandChannel.GetLandObject(pos.X, pos.Y); | ||
7041 | if (World.Permissions.CanEditParcelProperties(m_host.OwnerID, land, GroupPowers.LandManageBanned)) | 7059 | if (World.Permissions.CanEditParcelProperties(m_host.OwnerID, land, GroupPowers.LandManageBanned)) |
7042 | { | 7060 | { |
7043 | int expires = 0; | 7061 | int expires = 0; |
@@ -8474,7 +8492,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
8474 | { | 8492 | { |
8475 | m_host.AddScriptLPS(1); | 8493 | m_host.AddScriptLPS(1); |
8476 | 8494 | ||
8477 | ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y); | 8495 | Vector3 pos = m_host.AbsolutePosition; |
8496 | ILandObject land = World.LandChannel.GetLandObject(pos.X, pos.Y); | ||
8478 | 8497 | ||
8479 | if (land.LandData.OwnerID != m_host.OwnerID) | 8498 | if (land.LandData.OwnerID != m_host.OwnerID) |
8480 | return; | 8499 | return; |
@@ -8488,7 +8507,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
8488 | { | 8507 | { |
8489 | m_host.AddScriptLPS(1); | 8508 | m_host.AddScriptLPS(1); |
8490 | 8509 | ||
8491 | ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y); | 8510 | Vector3 pos = m_host.AbsolutePosition; |
8511 | ILandObject land = World.LandChannel.GetLandObject(pos.X, pos.Y); | ||
8492 | 8512 | ||
8493 | if (land.LandData.OwnerID != m_host.OwnerID) | 8513 | if (land.LandData.OwnerID != m_host.OwnerID) |
8494 | return String.Empty; | 8514 | return String.Empty; |
@@ -8499,8 +8519,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
8499 | public LSL_Vector llGetRootPosition() | 8519 | public LSL_Vector llGetRootPosition() |
8500 | { | 8520 | { |
8501 | m_host.AddScriptLPS(1); | 8521 | m_host.AddScriptLPS(1); |
8502 | return new LSL_Vector(m_host.ParentGroup.AbsolutePosition.X, m_host.ParentGroup.AbsolutePosition.Y, | 8522 | |
8503 | m_host.ParentGroup.AbsolutePosition.Z); | 8523 | return new LSL_Vector(m_host.ParentGroup.AbsolutePosition); |
8504 | } | 8524 | } |
8505 | 8525 | ||
8506 | /// <summary> | 8526 | /// <summary> |
@@ -8523,13 +8543,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
8523 | if ((avatar.AgentControlFlags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_MOUSELOOK) != 0) | 8543 | if ((avatar.AgentControlFlags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_MOUSELOOK) != 0) |
8524 | q = avatar.CameraRotation; // Mouselook | 8544 | q = avatar.CameraRotation; // Mouselook |
8525 | else | 8545 | else |
8526 | q = avatar.Rotation; // Currently infrequently updated so may be inaccurate | 8546 | q = avatar.GetWorldRotation(); // Currently infrequently updated so may be inaccurate |
8527 | else | 8547 | else |
8528 | q = m_host.ParentGroup.GroupRotation; // Likely never get here but just in case | 8548 | q = m_host.ParentGroup.GroupRotation; // Likely never get here but just in case |
8529 | } | 8549 | } |
8530 | else | 8550 | else |
8531 | q = m_host.ParentGroup.GroupRotation; // just the group rotation | 8551 | q = m_host.ParentGroup.GroupRotation; // just the group rotation |
8532 | return new LSL_Rotation(q.X, q.Y, q.Z, q.W); | 8552 | |
8553 | return new LSL_Rotation(q); | ||
8533 | } | 8554 | } |
8534 | 8555 | ||
8535 | public LSL_String llGetObjectDesc() | 8556 | public LSL_String llGetObjectDesc() |
@@ -13387,4 +13408,4 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
13387 | } | 13408 | } |
13388 | } | 13409 | } |
13389 | } | 13410 | } |
13390 | } \ No newline at end of file | 13411 | } |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index e87bb04..a214935 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | |||
@@ -2641,18 +2641,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2641 | { | 2641 | { |
2642 | UUID npcId; | 2642 | UUID npcId; |
2643 | if (!UUID.TryParse(npc.m_string, out npcId)) | 2643 | if (!UUID.TryParse(npc.m_string, out npcId)) |
2644 | return new LSL_Rotation(Quaternion.Identity.X, Quaternion.Identity.Y, Quaternion.Identity.Z, Quaternion.Identity.W); | 2644 | return new LSL_Rotation(Quaternion.Identity); |
2645 | 2645 | ||
2646 | if (!npcModule.CheckPermissions(npcId, m_host.OwnerID)) | 2646 | if (!npcModule.CheckPermissions(npcId, m_host.OwnerID)) |
2647 | return new LSL_Rotation(Quaternion.Identity.X, Quaternion.Identity.Y, Quaternion.Identity.Z, Quaternion.Identity.W); | 2647 | return new LSL_Rotation(Quaternion.Identity); |
2648 | 2648 | ||
2649 | ScenePresence sp = World.GetScenePresence(npcId); | 2649 | ScenePresence sp = World.GetScenePresence(npcId); |
2650 | 2650 | ||
2651 | if (sp != null) | 2651 | if (sp != null) |
2652 | { | 2652 | return new LSL_Rotation(sp.GetWorldRotation()); |
2653 | Quaternion rot = sp.Rotation; | ||
2654 | return new LSL_Rotation(rot.X, rot.Y, rot.Z, rot.W); | ||
2655 | } | ||
2656 | } | 2653 | } |
2657 | 2654 | ||
2658 | return new LSL_Rotation(Quaternion.Identity.X, Quaternion.Identity.Y, Quaternion.Identity.Z, Quaternion.Identity.W); | 2655 | return new LSL_Rotation(Quaternion.Identity.X, Quaternion.Identity.Y, Quaternion.Identity.Z, Quaternion.Identity.W); |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs index d3ef378..884f07c 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs | |||
@@ -700,4 +700,4 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins | |||
700 | return retList; | 700 | return retList; |
701 | } | 701 | } |
702 | } | 702 | } |
703 | } \ No newline at end of file | 703 | } |