diff options
author | mingchen | 2008-05-28 23:20:01 +0000 |
---|---|---|
committer | mingchen | 2008-05-28 23:20:01 +0000 |
commit | 1d38510bd283aa1d4e3ecaa280c68beb8e5aa57c (patch) | |
tree | 8518b38281d983dbeb953925f3be335546c12644 | |
parent | From: Kurt Taylor <krtaylor@us.ibm.com> (diff) | |
download | opensim-SC-1d38510bd283aa1d4e3ecaa280c68beb8e5aa57c.zip opensim-SC-1d38510bd283aa1d4e3ecaa280c68beb8e5aa57c.tar.gz opensim-SC-1d38510bd283aa1d4e3ecaa280c68beb8e5aa57c.tar.bz2 opensim-SC-1d38510bd283aa1d4e3ecaa280c68beb8e5aa57c.tar.xz |
*Added a Few External Checks relating to scripts including the seperation of runscript into 3 different situations (Rez, start stop)
4 files changed, 107 insertions, 9 deletions
diff --git a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs index f5cb0b9..18f9148 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs | |||
@@ -1018,13 +1018,16 @@ namespace OpenSim.Region.Environment.Scenes | |||
1018 | SceneObjectPart part = GetSceneObjectPart(localID); | 1018 | SceneObjectPart part = GetSceneObjectPart(localID); |
1019 | if (part != null) | 1019 | if (part != null) |
1020 | { | 1020 | { |
1021 | part.ParentGroup.AddInventoryItem(remoteClient, localID, item, copyID); | 1021 | if (ExternalChecks.ExternalChecksCanRunScript(item.ID, part.UUID, remoteClient.AgentId)) |
1022 | part.ParentGroup.StartScript(localID, copyID); | 1022 | { |
1023 | part.GetProperties(remoteClient); | 1023 | part.ParentGroup.AddInventoryItem(remoteClient, localID, item, copyID); |
1024 | part.ParentGroup.StartScript(localID, copyID); | ||
1025 | part.GetProperties(remoteClient); | ||
1024 | 1026 | ||
1025 | // m_log.InfoFormat("[PRIMINVENTORY]: " + | 1027 | // m_log.InfoFormat("[PRIMINVENTORY]: " + |
1026 | // "Rezzed script {0} into prim local ID {1} for user {2}", | 1028 | // "Rezzed script {0} into prim local ID {1} for user {2}", |
1027 | // item.inventoryName, localID, remoteClient.Name); | 1029 | // item.inventoryName, localID, remoteClient.Name); |
1030 | } | ||
1028 | } | 1031 | } |
1029 | else | 1032 | else |
1030 | { | 1033 | { |
@@ -1076,7 +1079,10 @@ namespace OpenSim.Region.Environment.Scenes | |||
1076 | 1079 | ||
1077 | part.AddInventoryItem(taskItem); | 1080 | part.AddInventoryItem(taskItem); |
1078 | part.GetProperties(remoteClient); | 1081 | part.GetProperties(remoteClient); |
1079 | part.StartScript(taskItem); | 1082 | if (ExternalChecks.ExternalChecksCanRunScript(taskItem.AssetID, part.UUID, remoteClient.AgentId)) |
1083 | { | ||
1084 | part.StartScript(taskItem); | ||
1085 | } | ||
1080 | } | 1086 | } |
1081 | } | 1087 | } |
1082 | 1088 | ||
diff --git a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs index f5fe561..25e36c5 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs | |||
@@ -295,7 +295,11 @@ namespace OpenSim.Region.Environment.Scenes | |||
295 | SceneObjectPart part=GetSceneObjectPart(objectID); | 295 | SceneObjectPart part=GetSceneObjectPart(objectID); |
296 | if (part == null) | 296 | if (part == null) |
297 | return; | 297 | return; |
298 | EventManager.TriggerScriptReset(part.LocalId, itemID); | 298 | |
299 | if (ExternalChecks.ExternalChecksCanResetScript(itemID, remoteClient.AgentId)) | ||
300 | { | ||
301 | EventManager.TriggerScriptReset(part.LocalId, itemID); | ||
302 | } | ||
299 | } | 303 | } |
300 | } | 304 | } |
301 | } | 305 | } |
diff --git a/OpenSim/Region/Environment/Scenes/SceneExternalChecks.cs b/OpenSim/Region/Environment/Scenes/SceneExternalChecks.cs index 2be5ab9..47dd0bc 100644 --- a/OpenSim/Region/Environment/Scenes/SceneExternalChecks.cs +++ b/OpenSim/Region/Environment/Scenes/SceneExternalChecks.cs | |||
@@ -582,7 +582,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
582 | 582 | ||
583 | #endregion | 583 | #endregion |
584 | 584 | ||
585 | #region RUN SCRIPT | 585 | #region RUN SCRIPT (When Script Placed in Object) |
586 | public delegate bool CanRunScript(LLUUID script, LLUUID objectID, LLUUID user, Scene scene); | 586 | public delegate bool CanRunScript(LLUUID script, LLUUID objectID, LLUUID user, Scene scene); |
587 | private List<CanRunScript> CanRunScriptCheckFunctions = new List<CanRunScript>(); | 587 | private List<CanRunScript> CanRunScriptCheckFunctions = new List<CanRunScript>(); |
588 | 588 | ||
@@ -611,6 +611,93 @@ namespace OpenSim.Region.Environment.Scenes | |||
611 | 611 | ||
612 | #endregion | 612 | #endregion |
613 | 613 | ||
614 | #region START SCRIPT (When Script run box is Checked after placed in object) | ||
615 | public delegate bool CanStartScript(LLUUID script, LLUUID user, Scene scene); | ||
616 | private List<CanStartScript> CanStartScriptCheckFunctions = new List<CanStartScript>(); | ||
617 | |||
618 | public void addCheckStartScript(CanStartScript delegateFunc) | ||
619 | { | ||
620 | if (!CanStartScriptCheckFunctions.Contains(delegateFunc)) | ||
621 | CanStartScriptCheckFunctions.Add(delegateFunc); | ||
622 | } | ||
623 | public void removeCheckStartScript(CanStartScript delegateFunc) | ||
624 | { | ||
625 | if (CanStartScriptCheckFunctions.Contains(delegateFunc)) | ||
626 | CanStartScriptCheckFunctions.Remove(delegateFunc); | ||
627 | } | ||
628 | |||
629 | public bool ExternalChecksCanStartScript(LLUUID script, LLUUID user) | ||
630 | { | ||
631 | foreach (CanStartScript check in CanStartScriptCheckFunctions) | ||
632 | { | ||
633 | if (check(script, user, m_scene) == false) | ||
634 | { | ||
635 | return false; | ||
636 | } | ||
637 | } | ||
638 | return true; | ||
639 | } | ||
640 | |||
641 | #endregion | ||
642 | |||
643 | #region STOP SCRIPT (When Script run box is unchecked after placed in object) | ||
644 | public delegate bool CanStopScript(LLUUID script, LLUUID user, Scene scene); | ||
645 | private List<CanStopScript> CanStopScriptCheckFunctions = new List<CanStopScript>(); | ||
646 | |||
647 | public void addCheckStopScript(CanStopScript delegateFunc) | ||
648 | { | ||
649 | if (!CanStopScriptCheckFunctions.Contains(delegateFunc)) | ||
650 | CanStopScriptCheckFunctions.Add(delegateFunc); | ||
651 | } | ||
652 | public void removeCheckStopScript(CanStopScript delegateFunc) | ||
653 | { | ||
654 | if (CanStopScriptCheckFunctions.Contains(delegateFunc)) | ||
655 | CanStopScriptCheckFunctions.Remove(delegateFunc); | ||
656 | } | ||
657 | |||
658 | public bool ExternalChecksCanStopScript(LLUUID script, LLUUID user) | ||
659 | { | ||
660 | foreach (CanStopScript check in CanStopScriptCheckFunctions) | ||
661 | { | ||
662 | if (check(script, user, m_scene) == false) | ||
663 | { | ||
664 | return false; | ||
665 | } | ||
666 | } | ||
667 | return true; | ||
668 | } | ||
669 | |||
670 | #endregion | ||
671 | |||
672 | #region RESET SCRIPT | ||
673 | public delegate bool CanResetScript(LLUUID script, LLUUID user, Scene scene); | ||
674 | private List<CanResetScript> CanResetScriptCheckFunctions = new List<CanResetScript>(); | ||
675 | |||
676 | public void addCheckResetScript(CanResetScript delegateFunc) | ||
677 | { | ||
678 | if (!CanResetScriptCheckFunctions.Contains(delegateFunc)) | ||
679 | CanResetScriptCheckFunctions.Add(delegateFunc); | ||
680 | } | ||
681 | public void removeCheckResetScript(CanResetScript delegateFunc) | ||
682 | { | ||
683 | if (CanResetScriptCheckFunctions.Contains(delegateFunc)) | ||
684 | CanResetScriptCheckFunctions.Remove(delegateFunc); | ||
685 | } | ||
686 | |||
687 | public bool ExternalChecksCanResetScript(LLUUID script, LLUUID user) | ||
688 | { | ||
689 | foreach (CanResetScript check in CanResetScriptCheckFunctions) | ||
690 | { | ||
691 | if (check(script, user, m_scene) == false) | ||
692 | { | ||
693 | return false; | ||
694 | } | ||
695 | } | ||
696 | return true; | ||
697 | } | ||
698 | |||
699 | #endregion | ||
700 | |||
614 | #region TERRAFORM LAND | 701 | #region TERRAFORM LAND |
615 | public delegate bool CanTerraformLand(LLUUID user, LLVector3 position, Scene requestFromScene); | 702 | public delegate bool CanTerraformLand(LLUUID user, LLVector3 position, Scene requestFromScene); |
616 | private List<CanTerraformLand> CanTerraformLandCheckFunctions = new List<CanTerraformLand>(); | 703 | private List<CanTerraformLand> CanTerraformLandCheckFunctions = new List<CanTerraformLand>(); |
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.Inventory.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.Inventory.cs index d35765c..c49970f 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.Inventory.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.Inventory.cs | |||
@@ -49,6 +49,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
49 | SceneObjectPart part = GetChildPart(localID); | 49 | SceneObjectPart part = GetChildPart(localID); |
50 | if (part != null) | 50 | if (part != null) |
51 | { | 51 | { |
52 | |||
52 | part.StartScript(itemID); | 53 | part.StartScript(itemID); |
53 | 54 | ||
54 | } | 55 | } |