aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/Shared/Instance
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/Instance')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs54
1 files changed, 32 insertions, 22 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
index 2b858ec..549c038 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
@@ -74,27 +74,27 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
74 private string m_PrimName; 74 private string m_PrimName;
75 private string m_ScriptName; 75 private string m_ScriptName;
76 private string m_Assembly; 76 private string m_Assembly;
77 private int m_StartParam = 0; 77 private int m_StartParam;
78 private string m_CurrentEvent = String.Empty; 78 private string m_CurrentEvent = String.Empty;
79 private bool m_InSelfDelete = false; 79 private bool m_InSelfDelete;
80 private int m_MaxScriptQueue; 80 private int m_MaxScriptQueue;
81 private bool m_SaveState = true; 81 private bool m_SaveState = true;
82 private bool m_ShuttingDown = false; 82 private bool m_ShuttingDown;
83 private int m_ControlEventsInQueue = 0; 83 private int m_ControlEventsInQueue;
84 private int m_LastControlLevel = 0; 84 private int m_LastControlLevel;
85 private bool m_CollisionInQueue = false; 85 private bool m_CollisionInQueue;
86 private TaskInventoryItem m_thisScriptTask; 86 private TaskInventoryItem m_thisScriptTask;
87 // The following is for setting a minimum delay between events 87 // The following is for setting a minimum delay between events
88 private double m_minEventDelay = 0; 88 private double m_minEventDelay;
89 private long m_eventDelayTicks = 0; 89 private long m_eventDelayTicks;
90 private long m_nextEventTimeTicks = 0; 90 private long m_nextEventTimeTicks;
91 private bool m_startOnInit = true; 91 private bool m_startOnInit = true;
92 private UUID m_AttachedAvatar = UUID.Zero; 92 private UUID m_AttachedAvatar;
93 private StateSource m_stateSource; 93 private StateSource m_stateSource;
94 private bool m_postOnRez; 94 private bool m_postOnRez;
95 private bool m_startedFromSavedState = false; 95 private bool m_startedFromSavedState;
96 private string m_CurrentState = String.Empty; 96 private UUID m_CurrentStateHash;
97 private UUID m_RegionID = UUID.Zero; 97 private UUID m_RegionID;
98 98
99 private Dictionary<KeyValuePair<int, int>, KeyValuePair<int, int>> 99 private Dictionary<KeyValuePair<int, int>, KeyValuePair<int, int>>
100 m_LineMap; 100 m_LineMap;
@@ -252,16 +252,22 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
252 { 252 {
253 m_Apis[api] = am.CreateApi(api); 253 m_Apis[api] = am.CreateApi(api);
254 m_Apis[api].Initialize(engine, part, m_LocalID, itemID); 254 m_Apis[api].Initialize(engine, part, m_LocalID, itemID);
255 } 255 }
256
257 try
258 {
259 if (dom != System.AppDomain.CurrentDomain)
260 m_Script = (IScript)dom.CreateInstanceAndUnwrap(
261 Path.GetFileNameWithoutExtension(assembly),
262 "SecondLife.Script");
263 else
264 m_Script = (IScript)Assembly.Load(
265 Path.GetFileNameWithoutExtension(assembly)).CreateInstance(
266 "SecondLife.Script");
256 267
257 try
258 {
259 m_Script = (IScript)dom.CreateInstanceAndUnwrap(
260 Path.GetFileNameWithoutExtension(assembly),
261 "SecondLife.Script");
262 268
263 //ILease lease = (ILease)RemotingServices.GetLifetimeService(m_Script as ScriptBaseClass); 269 //ILease lease = (ILease)RemotingServices.GetLifetimeService(m_Script as ScriptBaseClass);
264 RemotingServices.GetLifetimeService(m_Script as ScriptBaseClass); 270 //RemotingServices.GetLifetimeService(m_Script as ScriptBaseClass);
265// lease.Register(this); 271// lease.Register(this);
266 } 272 }
267 catch (Exception) 273 catch (Exception)
@@ -893,7 +899,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
893 899
894 string xml = ScriptSerializer.Serialize(this); 900 string xml = ScriptSerializer.Serialize(this);
895 901
896 if (m_CurrentState != xml) 902 // Compare hash of the state we just just created with the state last written to disk
903 // If the state is different, update the disk file.
904 UUID hash = UUID.Parse(Utils.MD5String(xml));
905
906 if(hash != m_CurrentStateHash)
897 { 907 {
898 try 908 try
899 { 909 {
@@ -911,7 +921,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
911 //{ 921 //{
912 // throw new Exception("Completed persistence save, but no file was created"); 922 // throw new Exception("Completed persistence save, but no file was created");
913 //} 923 //}
914 m_CurrentState = xml; 924 m_CurrentStateHash = hash;
915 } 925 }
916 } 926 }
917 927