diff options
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared')
8 files changed, 83 insertions, 24 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index d4c872c..d641958 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -832,8 +832,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
832 | 832 | ||
833 | public void llRegionSayTo(string target, int channel, string msg) | 833 | public void llRegionSayTo(string target, int channel, string msg) |
834 | { | 834 | { |
835 | string error = String.Empty; | ||
836 | |||
837 | if (msg.Length > 1023) | 835 | if (msg.Length > 1023) |
838 | msg = msg.Substring(0, 1023); | 836 | msg = msg.Substring(0, 1023); |
839 | 837 | ||
@@ -3548,7 +3546,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3548 | public void llCreateLink(string target, int parent) | 3546 | public void llCreateLink(string target, int parent) |
3549 | { | 3547 | { |
3550 | m_host.AddScriptLPS(1); | 3548 | m_host.AddScriptLPS(1); |
3551 | |||
3552 | UUID targetID; | 3549 | UUID targetID; |
3553 | 3550 | ||
3554 | if (!UUID.TryParse(target, out targetID)) | 3551 | if (!UUID.TryParse(target, out targetID)) |
@@ -3572,11 +3569,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3572 | 3569 | ||
3573 | if (targetPart.ParentGroup.AttachmentPoint != 0) | 3570 | if (targetPart.ParentGroup.AttachmentPoint != 0) |
3574 | return; // Fail silently if attached | 3571 | return; // Fail silently if attached |
3572 | |||
3573 | if (targetPart.ParentGroup.RootPart.OwnerID != m_host.ParentGroup.RootPart.OwnerID) | ||
3574 | return; | ||
3575 | |||
3575 | SceneObjectGroup parentPrim = null, childPrim = null; | 3576 | SceneObjectGroup parentPrim = null, childPrim = null; |
3576 | 3577 | ||
3577 | if (targetPart != null) | 3578 | if (targetPart != null) |
3578 | { | 3579 | { |
3579 | if (parent != 0) { | 3580 | if (parent != 0) |
3581 | { | ||
3580 | parentPrim = m_host.ParentGroup; | 3582 | parentPrim = m_host.ParentGroup; |
3581 | childPrim = targetPart.ParentGroup; | 3583 | childPrim = targetPart.ParentGroup; |
3582 | } | 3584 | } |
@@ -3588,7 +3590,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3588 | 3590 | ||
3589 | // Required for linking | 3591 | // Required for linking |
3590 | childPrim.RootPart.ClearUpdateSchedule(); | 3592 | childPrim.RootPart.ClearUpdateSchedule(); |
3591 | parentPrim.LinkToGroup(childPrim); | 3593 | parentPrim.LinkToGroup(childPrim, true); |
3592 | } | 3594 | } |
3593 | 3595 | ||
3594 | parentPrim.TriggerScriptChangedEvent(Changed.LINK); | 3596 | parentPrim.TriggerScriptChangedEvent(Changed.LINK); |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 7fc7337..0d4ea19 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | |||
@@ -351,7 +351,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
351 | 351 | ||
352 | UUID ownerID = ti.OwnerID; | 352 | UUID ownerID = ti.OwnerID; |
353 | 353 | ||
354 | //OSSL only may be used if objet is in the same group as the parcel | 354 | //OSSL only may be used if object is in the same group as the parcel |
355 | if (m_FunctionPerms[function].AllowedOwnerClasses.Contains("PARCEL_GROUP_MEMBER")) | 355 | if (m_FunctionPerms[function].AllowedOwnerClasses.Contains("PARCEL_GROUP_MEMBER")) |
356 | { | 356 | { |
357 | ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y); | 357 | ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y); |
@@ -729,11 +729,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
729 | 729 | ||
730 | m_host.AddScriptLPS(1); | 730 | m_host.AddScriptLPS(1); |
731 | 731 | ||
732 | // For safety, we add another permission check here, and don't rely only on the standard OSSL permissions | ||
732 | if (World.Permissions.CanRunConsoleCommand(m_host.OwnerID)) | 733 | if (World.Permissions.CanRunConsoleCommand(m_host.OwnerID)) |
733 | { | 734 | { |
734 | MainConsole.Instance.RunCommand(command); | 735 | MainConsole.Instance.RunCommand(command); |
735 | return true; | 736 | return true; |
736 | } | 737 | } |
738 | |||
737 | return false; | 739 | return false; |
738 | } | 740 | } |
739 | 741 | ||
@@ -2539,6 +2541,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2539 | 2541 | ||
2540 | public void osNpcSay(LSL_Key npc, string message) | 2542 | public void osNpcSay(LSL_Key npc, string message) |
2541 | { | 2543 | { |
2544 | osNpcSay(npc, 0, message); | ||
2545 | } | ||
2546 | |||
2547 | public void osNpcSay(LSL_Key npc, int channel, string message) | ||
2548 | { | ||
2542 | CheckThreatLevel(ThreatLevel.High, "osNpcSay"); | 2549 | CheckThreatLevel(ThreatLevel.High, "osNpcSay"); |
2543 | m_host.AddScriptLPS(1); | 2550 | m_host.AddScriptLPS(1); |
2544 | 2551 | ||
@@ -2550,7 +2557,24 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2550 | if (!module.CheckPermissions(npcId, m_host.OwnerID)) | 2557 | if (!module.CheckPermissions(npcId, m_host.OwnerID)) |
2551 | return; | 2558 | return; |
2552 | 2559 | ||
2553 | module.Say(npcId, World, message); | 2560 | module.Say(npcId, World, message, channel); |
2561 | } | ||
2562 | } | ||
2563 | |||
2564 | public void osNpcShout(LSL_Key npc, int channel, string message) | ||
2565 | { | ||
2566 | CheckThreatLevel(ThreatLevel.High, "osNpcShout"); | ||
2567 | m_host.AddScriptLPS(1); | ||
2568 | |||
2569 | INPCModule module = World.RequestModuleInterface<INPCModule>(); | ||
2570 | if (module != null) | ||
2571 | { | ||
2572 | UUID npcId = new UUID(npc.m_string); | ||
2573 | |||
2574 | if (!module.CheckPermissions(npcId, m_host.OwnerID)) | ||
2575 | return; | ||
2576 | |||
2577 | module.Shout(npcId, World, message, channel); | ||
2554 | } | 2578 | } |
2555 | } | 2579 | } |
2556 | 2580 | ||
@@ -2635,6 +2659,23 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2635 | } | 2659 | } |
2636 | } | 2660 | } |
2637 | 2661 | ||
2662 | public void osNpcWhisper(LSL_Key npc, int channel, string message) | ||
2663 | { | ||
2664 | CheckThreatLevel(ThreatLevel.High, "osNpcWhisper"); | ||
2665 | m_host.AddScriptLPS(1); | ||
2666 | |||
2667 | INPCModule module = World.RequestModuleInterface<INPCModule>(); | ||
2668 | if (module != null) | ||
2669 | { | ||
2670 | UUID npcId = new UUID(npc.m_string); | ||
2671 | |||
2672 | if (!module.CheckPermissions(npcId, m_host.OwnerID)) | ||
2673 | return; | ||
2674 | |||
2675 | module.Whisper(npcId, World, message, channel); | ||
2676 | } | ||
2677 | } | ||
2678 | |||
2638 | /// <summary> | 2679 | /// <summary> |
2639 | /// Save the current appearance of the script owner permanently to the named notecard. | 2680 | /// Save the current appearance of the script owner permanently to the named notecard. |
2640 | /// </summary> | 2681 | /// </summary> |
@@ -2786,21 +2827,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2786 | CheckThreatLevel(ThreatLevel.Severe, "osKickAvatar"); | 2827 | CheckThreatLevel(ThreatLevel.Severe, "osKickAvatar"); |
2787 | m_host.AddScriptLPS(1); | 2828 | m_host.AddScriptLPS(1); |
2788 | 2829 | ||
2789 | if (World.Permissions.CanRunConsoleCommand(m_host.OwnerID)) | 2830 | World.ForEachRootScenePresence(delegate(ScenePresence sp) |
2790 | { | 2831 | { |
2791 | World.ForEachRootScenePresence(delegate(ScenePresence sp) | 2832 | if (sp.Firstname == FirstName && sp.Lastname == SurName) |
2792 | { | 2833 | { |
2793 | if (sp.Firstname == FirstName && sp.Lastname == SurName) | 2834 | // kick client... |
2794 | { | 2835 | if (alert != null) |
2795 | // kick client... | 2836 | sp.ControllingClient.Kick(alert); |
2796 | if (alert != null) | ||
2797 | sp.ControllingClient.Kick(alert); | ||
2798 | 2837 | ||
2799 | // ...and close on our side | 2838 | // ...and close on our side |
2800 | sp.Scene.IncomingCloseAgent(sp.UUID); | 2839 | sp.Scene.IncomingCloseAgent(sp.UUID); |
2801 | } | 2840 | } |
2802 | }); | 2841 | }); |
2803 | } | ||
2804 | } | 2842 | } |
2805 | 2843 | ||
2806 | public void osCauseDamage(string avatar, double damage) | 2844 | public void osCauseDamage(string avatar, double damage) |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs index d0c852b..e92518d 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs | |||
@@ -217,11 +217,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces | |||
217 | void osNpcSetRot(LSL_Key npc, rotation rot); | 217 | void osNpcSetRot(LSL_Key npc, rotation rot); |
218 | void osNpcStopMoveToTarget(LSL_Key npc); | 218 | void osNpcStopMoveToTarget(LSL_Key npc); |
219 | void osNpcSay(key npc, string message); | 219 | void osNpcSay(key npc, string message); |
220 | void osNpcSay(key npc, int channel, string message); | ||
221 | void osNpcShout(key npc, int channel, string message); | ||
220 | void osNpcSit(key npc, key target, int options); | 222 | void osNpcSit(key npc, key target, int options); |
221 | void osNpcStand(LSL_Key npc); | 223 | void osNpcStand(LSL_Key npc); |
222 | void osNpcRemove(key npc); | 224 | void osNpcRemove(key npc); |
223 | void osNpcPlayAnimation(LSL_Key npc, string animation); | 225 | void osNpcPlayAnimation(LSL_Key npc, string animation); |
224 | void osNpcStopAnimation(LSL_Key npc, string animation); | 226 | void osNpcStopAnimation(LSL_Key npc, string animation); |
227 | void osNpcWhisper(key npc, int channel, string message); | ||
225 | 228 | ||
226 | LSL_Key osOwnerSaveAppearance(string notecard); | 229 | LSL_Key osOwnerSaveAppearance(string notecard); |
227 | LSL_Key osAgentSaveAppearance(key agentId, string notecard); | 230 | LSL_Key osAgentSaveAppearance(key agentId, string notecard); |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs index 36ac0e3..d230662 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs | |||
@@ -580,6 +580,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase | |||
580 | m_OSSL_Functions.osNpcSay(npc, message); | 580 | m_OSSL_Functions.osNpcSay(npc, message); |
581 | } | 581 | } |
582 | 582 | ||
583 | public void osNpcSay(key npc, int channel, string message) | ||
584 | { | ||
585 | m_OSSL_Functions.osNpcSay(npc, channel, message); | ||
586 | } | ||
587 | |||
588 | |||
589 | public void osNpcShout(key npc, int channel, string message) | ||
590 | { | ||
591 | m_OSSL_Functions.osNpcShout(npc, channel, message); | ||
592 | } | ||
593 | |||
583 | public void osNpcSit(LSL_Key npc, LSL_Key target, int options) | 594 | public void osNpcSit(LSL_Key npc, LSL_Key target, int options) |
584 | { | 595 | { |
585 | m_OSSL_Functions.osNpcSit(npc, target, options); | 596 | m_OSSL_Functions.osNpcSit(npc, target, options); |
@@ -605,6 +616,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase | |||
605 | m_OSSL_Functions.osNpcStopAnimation(npc, animation); | 616 | m_OSSL_Functions.osNpcStopAnimation(npc, animation); |
606 | } | 617 | } |
607 | 618 | ||
619 | public void osNpcWhisper(key npc, int channel, string message) | ||
620 | { | ||
621 | m_OSSL_Functions.osNpcWhisper(npc, channel, message); | ||
622 | } | ||
623 | |||
608 | public LSL_Key osOwnerSaveAppearance(string notecard) | 624 | public LSL_Key osOwnerSaveAppearance(string notecard) |
609 | { | 625 | { |
610 | return m_OSSL_Functions.osOwnerSaveAppearance(notecard); | 626 | return m_OSSL_Functions.osOwnerSaveAppearance(notecard); |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiInventoryTests.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiInventoryTests.cs index e2d0db2..49266e9 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiInventoryTests.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiInventoryTests.cs | |||
@@ -63,7 +63,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
63 | IConfig config = initConfigSource.AddConfig("XEngine"); | 63 | IConfig config = initConfigSource.AddConfig("XEngine"); |
64 | config.Set("Enabled", "true"); | 64 | config.Set("Enabled", "true"); |
65 | 65 | ||
66 | m_scene = SceneHelpers.SetupScene(); | 66 | m_scene = new SceneHelpers().SetupScene(); |
67 | SceneHelpers.SetupSceneModules(m_scene, initConfigSource); | 67 | SceneHelpers.SetupSceneModules(m_scene, initConfigSource); |
68 | 68 | ||
69 | m_engine = new XEngine.XEngine(); | 69 | m_engine = new XEngine.XEngine(); |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs index 9cf9258..92a63bf 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs | |||
@@ -58,7 +58,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
58 | IConfig config = initConfigSource.AddConfig("XEngine"); | 58 | IConfig config = initConfigSource.AddConfig("XEngine"); |
59 | config.Set("Enabled", "true"); | 59 | config.Set("Enabled", "true"); |
60 | 60 | ||
61 | Scene scene = SceneHelpers.SetupScene(); | 61 | Scene scene = new SceneHelpers().SetupScene(); |
62 | SceneObjectPart part = SceneHelpers.AddSceneObject(scene); | 62 | SceneObjectPart part = SceneHelpers.AddSceneObject(scene); |
63 | 63 | ||
64 | XEngine.XEngine engine = new XEngine.XEngine(); | 64 | XEngine.XEngine engine = new XEngine.XEngine(); |
@@ -261,7 +261,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
261 | TestHelpers.InMethod(); | 261 | TestHelpers.InMethod(); |
262 | 262 | ||
263 | // Create Prim1. | 263 | // Create Prim1. |
264 | Scene scene = SceneHelpers.SetupScene(); | 264 | Scene scene = new SceneHelpers().SetupScene(); |
265 | string obj1Name = "Prim1"; | 265 | string obj1Name = "Prim1"; |
266 | UUID objUuid = new UUID("00000000-0000-0000-0000-000000000001"); | 266 | UUID objUuid = new UUID("00000000-0000-0000-0000-000000000001"); |
267 | SceneObjectPart part1 = | 267 | SceneObjectPart part1 = |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAppearanceTest.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAppearanceTest.cs index 7573dff..c51227b 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAppearanceTest.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAppearanceTest.cs | |||
@@ -67,7 +67,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
67 | config = initConfigSource.AddConfig("NPC"); | 67 | config = initConfigSource.AddConfig("NPC"); |
68 | config.Set("Enabled", "true"); | 68 | config.Set("Enabled", "true"); |
69 | 69 | ||
70 | m_scene = SceneHelpers.SetupScene(); | 70 | m_scene = new SceneHelpers().SetupScene(); |
71 | SceneHelpers.SetupSceneModules(m_scene, initConfigSource, new AvatarFactoryModule(), new NPCModule()); | 71 | SceneHelpers.SetupSceneModules(m_scene, initConfigSource, new AvatarFactoryModule(), new NPCModule()); |
72 | 72 | ||
73 | m_engine = new XEngine.XEngine(); | 73 | m_engine = new XEngine.XEngine(); |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiNpcTests.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiNpcTests.cs index 9d9fc51..9c36108 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiNpcTests.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiNpcTests.cs | |||
@@ -68,7 +68,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
68 | config = initConfigSource.AddConfig("NPC"); | 68 | config = initConfigSource.AddConfig("NPC"); |
69 | config.Set("Enabled", "true"); | 69 | config.Set("Enabled", "true"); |
70 | 70 | ||
71 | m_scene = SceneHelpers.SetupScene(); | 71 | m_scene = new SceneHelpers().SetupScene(); |
72 | SceneHelpers.SetupSceneModules(m_scene, initConfigSource, new AvatarFactoryModule(), new NPCModule()); | 72 | SceneHelpers.SetupSceneModules(m_scene, initConfigSource, new AvatarFactoryModule(), new NPCModule()); |
73 | 73 | ||
74 | m_engine = new XEngine.XEngine(); | 74 | m_engine = new XEngine.XEngine(); |