diff options
author | Melanie | 2013-01-10 01:25:07 +0000 |
---|---|---|
committer | Melanie | 2013-01-10 01:25:07 +0000 |
commit | aecb32b74efa5b74adcfc026f7261f43ad5934f4 (patch) | |
tree | 8c775eca7460a5c5c2bc08e25d2334897e693673 /OpenSim/Region/ScriptEngine/Shared | |
parent | Merge branch 'avination' into careminster (diff) | |
parent | Change IsRoot to use ReferenceEquals to prevent operator == messiness (diff) | |
download | opensim-SC-aecb32b74efa5b74adcfc026f7261f43ad5934f4.zip opensim-SC-aecb32b74efa5b74adcfc026f7261f43ad5934f4.tar.gz opensim-SC-aecb32b74efa5b74adcfc026f7261f43ad5934f4.tar.bz2 opensim-SC-aecb32b74efa5b74adcfc026f7261f43ad5934f4.tar.xz |
Merge branch 'avination' into careminster
Conflicts:
OpenSim/Region/Framework/Scenes/ScenePresence.cs
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 42 |
1 files changed, 38 insertions, 4 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index aa389ba..9ae9b59 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -2359,8 +2359,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2359 | { | 2359 | { |
2360 | m_host.AddScriptLPS(1); | 2360 | m_host.AddScriptLPS(1); |
2361 | 2361 | ||
2362 | |||
2363 | // Teravus: if (m_host.ParentID == 0) is bug code because the ParentID for the Avatar will cause this to be nonzero for root prim attachments | ||
2364 | // which is then treated like a child prim rotation and it's offset gets cumulatively multiplied against. | ||
2365 | // to fix the scripted rotations we also have to check to see if the root part localid is the same as the host's localid. | ||
2366 | // RootPart != null should shortcircuit | ||
2367 | |||
2362 | // try to let this work as in SL... | 2368 | // try to let this work as in SL... |
2363 | if (m_host.ParentID == 0) | 2369 | if (m_host.ParentID == 0 || (m_host.ParentGroup != null && m_host == m_host.ParentGroup.RootPart)) |
2364 | { | 2370 | { |
2365 | // special case: If we are root, rotate complete SOG to new rotation | 2371 | // special case: If we are root, rotate complete SOG to new rotation |
2366 | SetRot(m_host, rot); | 2372 | SetRot(m_host, rot); |
@@ -2443,6 +2449,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2443 | 2449 | ||
2444 | m_host.AddScriptLPS(1); | 2450 | m_host.AddScriptLPS(1); |
2445 | Quaternion q = m_host.GetWorldRotation(); | 2451 | Quaternion q = m_host.GetWorldRotation(); |
2452 | |||
2453 | if (m_host.ParentGroup != null && m_host.ParentGroup.AttachmentPoint != 0) | ||
2454 | { | ||
2455 | ScenePresence avatar = World.GetScenePresence(m_host.ParentGroup.AttachedAvatar); | ||
2456 | if (avatar != null) | ||
2457 | { | ||
2458 | if ((avatar.AgentControlFlags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_MOUSELOOK) != 0) | ||
2459 | q = avatar.CameraRotation * q; // Mouselook | ||
2460 | else | ||
2461 | q = avatar.Rotation * q; // Currently infrequently updated so may be inaccurate | ||
2462 | } | ||
2463 | } | ||
2464 | |||
2446 | return new LSL_Rotation(q.X, q.Y, q.Z, q.W); | 2465 | return new LSL_Rotation(q.X, q.Y, q.Z, q.W); |
2447 | } | 2466 | } |
2448 | 2467 | ||
@@ -2468,7 +2487,20 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2468 | q = part.ParentGroup.GroupRotation; // just the group rotation | 2487 | q = part.ParentGroup.GroupRotation; // just the group rotation |
2469 | return new LSL_Rotation(q.X, q.Y, q.Z, q.W); | 2488 | return new LSL_Rotation(q.X, q.Y, q.Z, q.W); |
2470 | } | 2489 | } |
2490 | |||
2471 | q = part.GetWorldRotation(); | 2491 | q = part.GetWorldRotation(); |
2492 | if (part.ParentGroup.AttachmentPoint != 0) | ||
2493 | { | ||
2494 | ScenePresence avatar = World.GetScenePresence(part.ParentGroup.AttachedAvatar); | ||
2495 | if (avatar != null) | ||
2496 | { | ||
2497 | if ((avatar.AgentControlFlags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_MOUSELOOK) != 0) | ||
2498 | q = avatar.CameraRotation * q; // Mouselook | ||
2499 | else | ||
2500 | q = avatar.Rotation * q; // Currently infrequently updated so may be inaccurate | ||
2501 | } | ||
2502 | } | ||
2503 | |||
2472 | return new LSL_Rotation(q.X, q.Y, q.Z, q.W); | 2504 | return new LSL_Rotation(q.X, q.Y, q.Z, q.W); |
2473 | } | 2505 | } |
2474 | 2506 | ||
@@ -7909,7 +7941,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
7909 | 7941 | ||
7910 | LSL_Rotation q = rules.GetQuaternionItem(idx++); | 7942 | LSL_Rotation q = rules.GetQuaternionItem(idx++); |
7911 | // try to let this work as in SL... | 7943 | // try to let this work as in SL... |
7912 | if (part.ParentID == 0) | 7944 | if (part.ParentID == 0 || (part.ParentGroup != null && part == part.ParentGroup.RootPart)) |
7913 | { | 7945 | { |
7914 | // special case: If we are root, rotate complete SOG to new rotation | 7946 | // special case: If we are root, rotate complete SOG to new rotation |
7915 | SetRot(part, q); | 7947 | SetRot(part, q); |
@@ -8701,7 +8733,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
8701 | 8733 | ||
8702 | LSL_List remaining = GetPrimParams(m_host, rules, ref result); | 8734 | LSL_List remaining = GetPrimParams(m_host, rules, ref result); |
8703 | 8735 | ||
8704 | while (remaining != null && remaining.Length > 2) | 8736 | while ((object)remaining != null && remaining.Length > 2) |
8705 | { | 8737 | { |
8706 | int linknumber = remaining.GetLSLIntegerItem(0); | 8738 | int linknumber = remaining.GetLSLIntegerItem(0); |
8707 | rules = remaining.GetSublist(1, -1); | 8739 | rules = remaining.GetSublist(1, -1); |
@@ -8742,11 +8774,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
8742 | remaining = GetPrimParams(avatar, rules, ref res); | 8774 | remaining = GetPrimParams(avatar, rules, ref res); |
8743 | } | 8775 | } |
8744 | 8776 | ||
8745 | if (remaining != null && remaining.Length > 0) | 8777 | if ((object)remaining != null && remaining.Length > 0) |
8746 | { | 8778 | { |
8747 | linknumber = remaining.GetLSLIntegerItem(0); | 8779 | linknumber = remaining.GetLSLIntegerItem(0); |
8748 | rules = remaining.GetSublist(1, -1); | 8780 | rules = remaining.GetSublist(1, -1); |
8749 | } | 8781 | } |
8782 | else | ||
8783 | break; | ||
8750 | } | 8784 | } |
8751 | 8785 | ||
8752 | return res; | 8786 | return res; |