aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs142
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/BorderTests.cs4
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs6
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs3
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs7
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs1
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs5
7 files changed, 97 insertions, 71 deletions
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 1e717d9..3452f90 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -1456,6 +1456,7 @@ namespace OpenSim.Region.Framework.Scenes
1456 PhysicsActor actor = PhysicsActor; 1456 PhysicsActor actor = PhysicsActor;
1457 if (actor == null) 1457 if (actor == null)
1458 { 1458 {
1459 SendControlsToScripts(flagsForScripts);
1459 return; 1460 return;
1460 } 1461 }
1461 1462
@@ -1632,15 +1633,7 @@ namespace OpenSim.Region.Framework.Scenes
1632 if (update_movementflag && ParentID == 0) 1633 if (update_movementflag && ParentID == 0)
1633 Animator.UpdateMovementAnimations(); 1634 Animator.UpdateMovementAnimations();
1634 1635
1635 lock (scriptedcontrols) 1636 SendControlsToScripts(flagsForScripts);
1636 {
1637 if (scriptedcontrols.Count > 0)
1638 {
1639 // Notify the scripts only after calling UpdateMovementAnimations(), so that if a script
1640 // (e.g., a walking script) checks which animation is active it will be the correct animation.
1641 SendControlToScripts(flagsForScripts);
1642 }
1643 }
1644 } 1637 }
1645 1638
1646 m_scene.EventManager.TriggerOnClientMovement(this); 1639 m_scene.EventManager.TriggerOnClientMovement(this);
@@ -3830,77 +3823,92 @@ namespace OpenSim.Region.Framework.Scenes
3830 } 3823 }
3831 } 3824 }
3832 3825
3833 internal void SendControlToScripts(uint flags) 3826 private void SendControlsToScripts(uint flags)
3834 { 3827 {
3835 ScriptControlled allflags = ScriptControlled.CONTROL_ZERO; 3828 // Notify the scripts only after calling UpdateMovementAnimations(), so that if a script
3836 3829 // (e.g., a walking script) checks which animation is active it will be the correct animation.
3837 if (MouseDown) 3830 lock (scriptedcontrols)
3838 { 3831 {
3839 allflags = LastCommands & (ScriptControlled.CONTROL_ML_LBUTTON | ScriptControlled.CONTROL_LBUTTON); 3832 if (scriptedcontrols.Count <= 0)
3840 if ((flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_LBUTTON_UP) != 0 || (flags & unchecked((uint)AgentManager.ControlFlags.AGENT_CONTROL_ML_LBUTTON_UP)) != 0) 3833 return;
3834
3835 ScriptControlled allflags = ScriptControlled.CONTROL_ZERO;
3836
3837 if (MouseDown)
3841 { 3838 {
3842 allflags = ScriptControlled.CONTROL_ZERO; 3839 allflags = LastCommands & (ScriptControlled.CONTROL_ML_LBUTTON | ScriptControlled.CONTROL_LBUTTON);
3840 if ((flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_LBUTTON_UP) != 0 || (flags & unchecked((uint)AgentManager.ControlFlags.AGENT_CONTROL_ML_LBUTTON_UP)) != 0)
3841 {
3842 allflags = ScriptControlled.CONTROL_ZERO;
3843 MouseDown = true;
3844 }
3845 }
3846
3847 if ((flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_ML_LBUTTON_DOWN) != 0)
3848 {
3849 allflags |= ScriptControlled.CONTROL_ML_LBUTTON;
3843 MouseDown = true; 3850 MouseDown = true;
3844 } 3851 }
3845 } 3852
3853 if ((flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_LBUTTON_DOWN) != 0)
3854 {
3855 allflags |= ScriptControlled.CONTROL_LBUTTON;
3856 MouseDown = true;
3857 }
3858
3859 // find all activated controls, whether the scripts are interested in them or not
3860 if ((flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_AT_POS) != 0 || (flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_AT_POS) != 0)
3861 {
3862 allflags |= ScriptControlled.CONTROL_FWD;
3863 }
3864
3865 if ((flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_AT_NEG) != 0 || (flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_AT_NEG) != 0)
3866 {
3867 allflags |= ScriptControlled.CONTROL_BACK;
3868 }
3869
3870 if ((flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_UP_POS) != 0 || (flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_UP_POS) != 0)
3871 {
3872 allflags |= ScriptControlled.CONTROL_UP;
3873 }
3874
3875 if ((flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_UP_NEG) != 0 || (flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_UP_NEG) != 0)
3876 {
3877 allflags |= ScriptControlled.CONTROL_DOWN;
3878 }
3846 3879
3847 if ((flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_ML_LBUTTON_DOWN) != 0) 3880 if ((flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_LEFT_POS) != 0 || (flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_LEFT_POS) != 0)
3848 { 3881 {
3849 allflags |= ScriptControlled.CONTROL_ML_LBUTTON; 3882 allflags |= ScriptControlled.CONTROL_LEFT;
3850 MouseDown = true; 3883 }
3851 } 3884
3852 if ((flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_LBUTTON_DOWN) != 0) 3885 if ((flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_LEFT_NEG) != 0 || (flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_LEFT_NEG) != 0)
3853 { 3886 {
3854 allflags |= ScriptControlled.CONTROL_LBUTTON; 3887 allflags |= ScriptControlled.CONTROL_RIGHT;
3855 MouseDown = true; 3888 }
3856 } 3889
3890 if ((flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_YAW_NEG) != 0)
3891 {
3892 allflags |= ScriptControlled.CONTROL_ROT_RIGHT;
3893 }
3894
3895 if ((flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_YAW_POS) != 0)
3896 {
3897 allflags |= ScriptControlled.CONTROL_ROT_LEFT;
3898 }
3857 3899
3858 // find all activated controls, whether the scripts are interested in them or not 3900 // optimization; we have to check per script, but if nothing is pressed and nothing changed, we can skip that
3859 if ((flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_AT_POS) != 0 || (flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_AT_POS) != 0) 3901 if (allflags != ScriptControlled.CONTROL_ZERO || allflags != LastCommands)
3860 {
3861 allflags |= ScriptControlled.CONTROL_FWD;
3862 }
3863 if ((flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_AT_NEG) != 0 || (flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_AT_NEG) != 0)
3864 {
3865 allflags |= ScriptControlled.CONTROL_BACK;
3866 }
3867 if ((flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_UP_POS) != 0 || (flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_UP_POS) != 0)
3868 {
3869 allflags |= ScriptControlled.CONTROL_UP;
3870 }
3871 if ((flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_UP_NEG) != 0 || (flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_UP_NEG) != 0)
3872 {
3873 allflags |= ScriptControlled.CONTROL_DOWN;
3874 }
3875 if ((flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_LEFT_POS) != 0 || (flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_LEFT_POS) != 0)
3876 {
3877 allflags |= ScriptControlled.CONTROL_LEFT;
3878 }
3879 if ((flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_LEFT_NEG) != 0 || (flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_LEFT_NEG) != 0)
3880 {
3881 allflags |= ScriptControlled.CONTROL_RIGHT;
3882 }
3883 if ((flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_YAW_NEG) != 0)
3884 {
3885 allflags |= ScriptControlled.CONTROL_ROT_RIGHT;
3886 }
3887 if ((flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_YAW_POS) != 0)
3888 {
3889 allflags |= ScriptControlled.CONTROL_ROT_LEFT;
3890 }
3891 // optimization; we have to check per script, but if nothing is pressed and nothing changed, we can skip that
3892 if (allflags != ScriptControlled.CONTROL_ZERO || allflags != LastCommands)
3893 {
3894 lock (scriptedcontrols)
3895 { 3902 {
3896 foreach (KeyValuePair<UUID, ScriptControllers> kvp in scriptedcontrols) 3903 foreach (KeyValuePair<UUID, ScriptControllers> kvp in scriptedcontrols)
3897 { 3904 {
3898 UUID scriptUUID = kvp.Key; 3905 UUID scriptUUID = kvp.Key;
3899 ScriptControllers scriptControlData = kvp.Value; 3906 ScriptControllers scriptControlData = kvp.Value;
3900 3907
3901 ScriptControlled localHeld = allflags & scriptControlData.eventControls; // the flags interesting for us 3908 ScriptControlled localHeld = allflags & scriptControlData.eventControls; // the flags interesting for us
3902 ScriptControlled localLast = LastCommands & scriptControlData.eventControls; // the activated controls in the last cycle 3909 ScriptControlled localLast = LastCommands & scriptControlData.eventControls; // the activated controls in the last cycle
3903 ScriptControlled localChange = localHeld ^ localLast; // the changed bits 3910 ScriptControlled localChange = localHeld ^ localLast; // the changed bits
3911
3904 if (localHeld != ScriptControlled.CONTROL_ZERO || localChange != ScriptControlled.CONTROL_ZERO) 3912 if (localHeld != ScriptControlled.CONTROL_ZERO || localChange != ScriptControlled.CONTROL_ZERO)
3905 { 3913 {
3906 // only send if still pressed or just changed 3914 // only send if still pressed or just changed
@@ -3908,9 +3916,9 @@ namespace OpenSim.Region.Framework.Scenes
3908 } 3916 }
3909 } 3917 }
3910 } 3918 }
3919
3920 LastCommands = allflags;
3911 } 3921 }
3912
3913 LastCommands = allflags;
3914 } 3922 }
3915 3923
3916 internal static AgentManager.ControlFlags RemoveIgnoredControls(AgentManager.ControlFlags flags, ScriptControlled ignored) 3924 internal static AgentManager.ControlFlags RemoveIgnoredControls(AgentManager.ControlFlags flags, ScriptControlled ignored)
diff --git a/OpenSim/Region/Framework/Scenes/Tests/BorderTests.cs b/OpenSim/Region/Framework/Scenes/Tests/BorderTests.cs
index ab6311b..4a21dc9 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/BorderTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/BorderTests.cs
@@ -27,6 +27,7 @@
27 27
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.IO;
30using System.Text; 31using System.Text;
31using NUnit.Framework; 32using NUnit.Framework;
32using OpenMetaverse; 33using OpenMetaverse;
@@ -68,11 +69,8 @@ namespace OpenSim.Region.Framework.Scenes.Tests
68 Vector3 position = new Vector3(200,200,21); 69 Vector3 position = new Vector3(200,200,21);
69 70
70 foreach (Border b in testborders) 71 foreach (Border b in testborders)
71 {
72 Assert.That(!b.TestCross(position)); 72 Assert.That(!b.TestCross(position));
73 73
74 }
75
76 position = new Vector3(200,280,21); 74 position = new Vector3(200,280,21);
77 Assert.That(NorthBorder.TestCross(position)); 75 Assert.That(NorthBorder.TestCross(position));
78 76
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs
index 1c33a5f..d23c965 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs
@@ -26,7 +26,9 @@
26 */ 26 */
27 27
28using System; 28using System;
29using System.IO;
29using System.Reflection; 30using System.Reflection;
31using System.Text;
30using NUnit.Framework; 32using NUnit.Framework;
31using OpenMetaverse; 33using OpenMetaverse;
32using OpenSim.Framework; 34using OpenSim.Framework;
@@ -44,6 +46,8 @@ namespace OpenSim.Region.Framework.Scenes.Tests
44 public void TestDuplicateObject() 46 public void TestDuplicateObject()
45 { 47 {
46 TestHelpers.InMethod(); 48 TestHelpers.InMethod();
49// TestHelpers.EnableLogging();
50
47 Scene scene = new SceneHelpers().SetupScene(); 51 Scene scene = new SceneHelpers().SetupScene();
48 52
49 UUID ownerId = new UUID("00000000-0000-0000-0000-000000000010"); 53 UUID ownerId = new UUID("00000000-0000-0000-0000-000000000010");
@@ -82,6 +86,8 @@ namespace OpenSim.Region.Framework.Scenes.Tests
82 Assert.That(dupePart1.PhysActor, Is.Not.Null); 86 Assert.That(dupePart1.PhysActor, Is.Not.Null);
83 Assert.That(dupePart2.PhysActor, Is.Not.Null); 87 Assert.That(dupePart2.PhysActor, Is.Not.Null);
84 */ 88 */
89
90// TestHelpers.DisableLogging();
85 } 91 }
86 } 92 }
87} \ No newline at end of file 93} \ No newline at end of file
diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs
index 19542ff..c750cc5 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs
@@ -38,7 +38,8 @@ using OpenSim.Region.Framework.Interfaces;
38using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation; 38using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation;
39using OpenSim.Tests.Common; 39using OpenSim.Tests.Common;
40using OpenSim.Tests.Common.Mock; 40using OpenSim.Tests.Common.Mock;
41using System.Threading; 41using System.IO;
42using System.Text;
42 43
43namespace OpenSim.Region.Framework.Scenes.Tests 44namespace OpenSim.Region.Framework.Scenes.Tests
44{ 45{
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 3fe5780..a067868 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -1922,6 +1922,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1922 rgb.y = texcolor.G; 1922 rgb.y = texcolor.G;
1923 rgb.z = texcolor.B; 1923 rgb.z = texcolor.B;
1924 return rgb; 1924 return rgb;
1925
1925 } 1926 }
1926 else 1927 else
1927 { 1928 {
@@ -3492,6 +3493,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3492 return m_host.UUID.ToString(); 3493 return m_host.UUID.ToString();
3493 } 3494 }
3494 3495
3496 public LSL_Key llGenerateKey()
3497 {
3498 m_host.AddScriptLPS(1);
3499 return UUID.Random().ToString();
3500 }
3501
3495 public void llSetBuoyancy(double buoyancy) 3502 public void llSetBuoyancy(double buoyancy)
3496 { 3503 {
3497 m_host.AddScriptLPS(1); 3504 m_host.AddScriptLPS(1);
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs
index eab6851..2ecc455 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs
@@ -105,6 +105,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
105 LSL_Integer llFloor(double f); 105 LSL_Integer llFloor(double f);
106 void llForceMouselook(int mouselook); 106 void llForceMouselook(int mouselook);
107 LSL_Float llFrand(double mag); 107 LSL_Float llFrand(double mag);
108 LSL_Key llGenerateKey();
108 LSL_Vector llGetAccel(); 109 LSL_Vector llGetAccel();
109 LSL_Integer llGetAgentInfo(string id); 110 LSL_Integer llGetAgentInfo(string id);
110 LSL_String llGetAgentLanguage(string id); 111 LSL_String llGetAgentLanguage(string id);
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs
index 9446099..8db4006 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs
@@ -376,6 +376,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
376 return m_LSL_Functions.llFrand(mag); 376 return m_LSL_Functions.llFrand(mag);
377 } 377 }
378 378
379 public LSL_Key llGenerateKey()
380 {
381 return m_LSL_Functions.llGenerateKey();
382 }
383
379 public LSL_Vector llGetAccel() 384 public LSL_Vector llGetAccel()
380 { 385 {
381 return m_LSL_Functions.llGetAccel(); 386 return m_LSL_Functions.llGetAccel();