aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs150
1 files changed, 3 insertions, 147 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
index 49df5e7..2633f30 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
@@ -654,7 +654,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
654 if (state == State) 654 if (state == State)
655 return; 655 return;
656 656
657<<<<<<< HEAD
658 EventParams lastTimerEv = null; 657 EventParams lastTimerEv = null;
659 658
660 lock (EventQueue) 659 lock (EventQueue)
@@ -682,15 +681,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
682 m_StateChangeInProgress = true; 681 m_StateChangeInProgress = true;
683 } 682 }
684 683
685=======
686 PostEvent(new EventParams("state_exit", new Object[0],
687 new DetectParams[0]));
688 PostEvent(new EventParams("state", new Object[] { state },
689 new DetectParams[0]));
690 PostEvent(new EventParams("state_entry", new Object[0],
691 new DetectParams[0]));
692
693>>>>>>> avn/ubitvar
694 throw new EventAbortException(); 684 throw new EventAbortException();
695 } 685 }
696 686
@@ -789,9 +779,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
789 if (!Running) 779 if (!Running)
790 return 0; 780 return 0;
791 781
782 lock (m_Script)
783 {
792// m_log.DebugFormat("[XEngine]: EventProcessor() invoked for {0}.{1}", PrimName, ScriptName); 784// m_log.DebugFormat("[XEngine]: EventProcessor() invoked for {0}.{1}", PrimName, ScriptName);
793 785
794<<<<<<< HEAD
795 if (Suspended) 786 if (Suspended)
796 return 0; 787 return 0;
797 788
@@ -817,14 +808,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
817 lock (EventQueue) 808 lock (EventQueue)
818 { 809 {
819 data = (EventParams)EventQueue.Dequeue(); 810 data = (EventParams)EventQueue.Dequeue();
820=======
821 if (Suspended)
822 return 0;
823
824 lock (EventQueue)
825 {
826 data = (EventParams) EventQueue.Dequeue();
827>>>>>>> avn/ubitvar
828 if (data == null) // Shouldn't happen 811 if (data == null) // Shouldn't happen
829 { 812 {
830 if (EventQueue.Count > 0 && Running && !ShuttingDown) 813 if (EventQueue.Count > 0 && Running && !ShuttingDown)
@@ -849,7 +832,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
849 m_CollisionInQueue = false; 832 m_CollisionInQueue = false;
850 } 833 }
851 834
852<<<<<<< HEAD
853 if (DebugLevel >= 2) 835 if (DebugLevel >= 2)
854 m_log.DebugFormat( 836 m_log.DebugFormat(
855 "[SCRIPT INSTANCE]: Processing event {0} for {1}/{2}({3})/{4}({5}) @ {6}/{7}", 837 "[SCRIPT INSTANCE]: Processing event {0} for {1}/{2}({3})/{4}({5}) @ {6}/{7}",
@@ -879,26 +861,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
879 Part.ParentGroup.UUID, 861 Part.ParentGroup.UUID,
880 Part.AbsolutePosition, 862 Part.AbsolutePosition,
881 Part.ParentGroup.Scene.Name); 863 Part.ParentGroup.Scene.Name);
882=======
883 lock(m_Script)
884 {
885
886// m_log.DebugFormat("[XEngine]: Processing event {0} for {1}", data.EventName, this);
887 SceneObjectPart part = Engine.World.GetSceneObjectPart(LocalID);
888
889 if (DebugLevel >= 2)
890 m_log.DebugFormat(
891 "[SCRIPT INSTANCE]: Processing event {0} for {1}/{2}({3})/{4}({5}) @ {6}/{7}",
892 data.EventName,
893 ScriptName,
894 part.Name,
895 part.LocalId,
896 part.ParentGroup.Name,
897 part.ParentGroup.UUID,
898 part.AbsolutePosition,
899 part.ParentGroup.Scene.Name);
900>>>>>>> avn/ubitvar
901
902 AsyncCommandManager.StateChange(Engine, 864 AsyncCommandManager.StateChange(Engine,
903 LocalID, ItemID); 865 LocalID, ItemID);
904 // we are effectively in the new state now, so we can resume queueing 866 // we are effectively in the new state now, so we can resume queueing
@@ -915,35 +877,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
915 // m_log.DebugFormat("[Script] Delivered event {2} in state {3} to {0}.{1}", 877 // m_log.DebugFormat("[Script] Delivered event {2} in state {3} to {0}.{1}",
916 // PrimName, ScriptName, data.EventName, State); 878 // PrimName, ScriptName, data.EventName, State);
917 879
918<<<<<<< HEAD 880
919 try 881 try
920=======
921 if (DebugLevel >= 1)
922 m_log.DebugFormat(
923 "[SCRIPT INSTANCE]: Changing state to {0} for {1}/{2}({3})/{4}({5}) @ {6}/{7}",
924 State,
925 ScriptName,
926 part.Name,
927 part.LocalId,
928 part.ParentGroup.Name,
929 part.ParentGroup.UUID,
930 part.AbsolutePosition,
931 part.ParentGroup.Scene.Name);
932
933 AsyncCommandManager.RemoveScript(Engine,
934 LocalID, ItemID);
935
936 if (part != null)
937 {
938 part.SetScriptEvents(ItemID,
939 (int)m_Script.GetStateEventFlags(State));
940 }
941 }
942 else
943 {
944 if (Engine.World.PipeEventsForScript(LocalID) ||
945 data.EventName == "control") // Don't freeze avies!
946>>>>>>> avn/ubitvar
947 { 882 {
948 m_CurrentEvent = data.EventName; 883 m_CurrentEvent = data.EventName;
949 m_EventStart = DateTime.Now; 884 m_EventStart = DateTime.Now;
@@ -981,7 +916,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
981 && !(e.InnerException is ScriptCoopStopException))) 916 && !(e.InnerException is ScriptCoopStopException)))
982 && !(e is ThreadAbortException)) 917 && !(e is ThreadAbortException))
983 { 918 {
984<<<<<<< HEAD
985 try 919 try
986 { 920 {
987 // DISPLAY ERROR INWORLD 921 // DISPLAY ERROR INWORLD
@@ -1004,88 +938,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
1004 Part.AbsolutePosition, 938 Part.AbsolutePosition,
1005 Part.ParentGroup.Scene.Name), 939 Part.ParentGroup.Scene.Name),
1006 e); 940 e);
1007=======
1008// m_log.DebugFormat(
1009// "[SCRIPT] Exception in script {0} {1}: {2}{3}",
1010// ScriptName, ItemID, e.Message, e.StackTrace);
1011
1012 m_InEvent = false;
1013 m_CurrentEvent = String.Empty;
1014
1015 if ((!(e is TargetInvocationException)
1016 || (!(e.InnerException is SelfDeleteException)
1017 && !(e.InnerException is ScriptDeleteException)
1018 && !(e.InnerException is ScriptCoopStopException)))
1019 && !(e is ThreadAbortException))
1020 {
1021 try
1022 {
1023 // DISPLAY ERROR INWORLD
1024 string text = FormatException(e);
1025
1026 if (text.Length > 1000)
1027 text = text.Substring(0, 1000);
1028 Engine.World.SimChat(Utils.StringToBytes(text),
1029 ChatTypeEnum.DebugChannel, 2147483647,
1030 part.AbsolutePosition,
1031 part.Name, part.UUID, false);
1032
1033
1034 m_log.DebugFormat(
1035 "[SCRIPT INSTANCE]: Runtime error in script {0}, part {1} {2} at {3} in {4}, displayed error {5}, actual exception {6}",
1036 ScriptName,
1037 PrimName,
1038 part.UUID,
1039 part.AbsolutePosition,
1040 part.ParentGroup.Scene.Name,
1041 text.Replace("\n", "\\n"),
1042 e.InnerException);
1043 }
1044 catch (Exception)
1045 {
1046 }
1047 // catch (Exception e2) // LEGIT: User Scripting
1048 // {
1049 // m_log.Error("[SCRIPT]: "+
1050 // "Error displaying error in-world: " +
1051 // e2.ToString());
1052 // m_log.Error("[SCRIPT]: " +
1053 // "Errormessage: Error compiling script:\r\n" +
1054 // e.ToString());
1055 // }
1056 }
1057 else if ((e is TargetInvocationException) && (e.InnerException is SelfDeleteException))
1058 {
1059 m_InSelfDelete = true;
1060 if (part != null)
1061 Engine.World.DeleteSceneObject(part.ParentGroup, false);
1062>>>>>>> avn/ubitvar
1063 } 941 }
1064 catch (Exception) 942 catch (Exception)
1065 { 943 {
1066<<<<<<< HEAD
1067=======
1068 m_InSelfDelete = true;
1069 if (part != null)
1070 part.Inventory.RemoveInventoryItem(ItemID);
1071 }
1072 else if ((e is TargetInvocationException) && (e.InnerException is ScriptCoopStopException))
1073 {
1074 if (DebugLevel >= 1)
1075 m_log.DebugFormat(
1076 "[SCRIPT INSTANCE]: Script {0}.{1} in event {2}, state {3} stopped co-operatively.",
1077 PrimName, ScriptName, data.EventName, State);
1078>>>>>>> avn/ubitvar
1079 } 944 }
1080 // catch (Exception e2) // LEGIT: User Scripting
1081 // {
1082 // m_log.Error("[SCRIPT]: "+
1083 // "Error displaying error in-world: " +
1084 // e2.ToString());
1085 // m_log.Error("[SCRIPT]: " +
1086 // "Errormessage: Error compiling script:\r\n" +
1087 // e.ToString());
1088 // }
1089 } 945 }
1090 else if ((e is TargetInvocationException) && (e.InnerException is SelfDeleteException)) 946 else if ((e is TargetInvocationException) && (e.InnerException is SelfDeleteException))
1091 { 947 {