diff options
author | BlueWall | 2012-06-23 04:11:31 -0400 |
---|---|---|
committer | BlueWall | 2012-06-23 04:15:14 -0400 |
commit | 6d3ee8bb39d47ed7b32e8905fa0b2fc31c5a9f80 (patch) | |
tree | 355fc7f7b91c55f7de9a90f2bd12d4fa2cd91e0d /OpenSim/Region/ScriptEngine/Shared | |
parent | Resolve various race conditions between accessing and removing external scrip... (diff) | |
download | opensim-SC-6d3ee8bb39d47ed7b32e8905fa0b2fc31c5a9f80.zip opensim-SC-6d3ee8bb39d47ed7b32e8905fa0b2fc31c5a9f80.tar.gz opensim-SC-6d3ee8bb39d47ed7b32e8905fa0b2fc31c5a9f80.tar.bz2 opensim-SC-6d3ee8bb39d47ed7b32e8905fa0b2fc31c5a9f80.tar.xz |
Fix script "Running" behavior
Unchecking "Running" box in script editor now persists. This fixes http://opensimulator.org/mantis/view.php?id=6057
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs | 9 | ||||
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Instance/ScriptSerializer.cs | 11 |
2 files changed, 20 insertions, 0 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs index 5dfe58e..306090e 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs | |||
@@ -120,6 +120,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance | |||
120 | 120 | ||
121 | public bool Running { get; set; } | 121 | public bool Running { get; set; } |
122 | 122 | ||
123 | public bool Run { get; set; } | ||
124 | |||
123 | public bool Suspended | 125 | public bool Suspended |
124 | { | 126 | { |
125 | get { return m_Suspended; } | 127 | get { return m_Suspended; } |
@@ -215,6 +217,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance | |||
215 | m_postOnRez = postOnRez; | 217 | m_postOnRez = postOnRez; |
216 | m_AttachedAvatar = part.ParentGroup.AttachedAvatar; | 218 | m_AttachedAvatar = part.ParentGroup.AttachedAvatar; |
217 | m_RegionID = part.ParentGroup.Scene.RegionInfo.RegionID; | 219 | m_RegionID = part.ParentGroup.Scene.RegionInfo.RegionID; |
220 | Run = true; | ||
218 | 221 | ||
219 | if (part != null) | 222 | if (part != null) |
220 | { | 223 | { |
@@ -359,6 +362,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance | |||
359 | 362 | ||
360 | if (m_startedFromSavedState) | 363 | if (m_startedFromSavedState) |
361 | { | 364 | { |
365 | if (!Run) | ||
366 | return; | ||
367 | |||
362 | Start(); | 368 | Start(); |
363 | if (m_postOnRez) | 369 | if (m_postOnRez) |
364 | { | 370 | { |
@@ -391,6 +397,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance | |||
391 | } | 397 | } |
392 | else | 398 | else |
393 | { | 399 | { |
400 | if (!Run) | ||
401 | return; | ||
402 | |||
394 | Start(); | 403 | Start(); |
395 | PostEvent(new EventParams("state_entry", | 404 | PostEvent(new EventParams("state_entry", |
396 | new Object[0], new DetectParams[0])); | 405 | new Object[0], new DetectParams[0])); |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptSerializer.cs b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptSerializer.cs index bcdc7bf..797bce3 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptSerializer.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptSerializer.cs | |||
@@ -55,6 +55,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance | |||
55 | public static string Serialize(ScriptInstance instance) | 55 | public static string Serialize(ScriptInstance instance) |
56 | { | 56 | { |
57 | bool running = instance.Running; | 57 | bool running = instance.Running; |
58 | bool enabled = instance.Run; | ||
58 | 59 | ||
59 | XmlDocument xmldoc = new XmlDocument(); | 60 | XmlDocument xmldoc = new XmlDocument(); |
60 | 61 | ||
@@ -77,6 +78,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance | |||
77 | 78 | ||
78 | rootElement.AppendChild(run); | 79 | rootElement.AppendChild(run); |
79 | 80 | ||
81 | XmlElement run_enable = xmldoc.CreateElement("", "Run", ""); | ||
82 | run_enable.AppendChild(xmldoc.CreateTextNode( | ||
83 | enabled.ToString())); | ||
84 | |||
85 | rootElement.AppendChild(run_enable); | ||
86 | |||
80 | Dictionary<string, Object> vars = instance.GetVars(); | 87 | Dictionary<string, Object> vars = instance.GetVars(); |
81 | 88 | ||
82 | XmlElement variables = xmldoc.CreateElement("", "Variables", ""); | 89 | XmlElement variables = xmldoc.CreateElement("", "Variables", ""); |
@@ -225,6 +232,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance | |||
225 | { | 232 | { |
226 | object varValue; | 233 | object varValue; |
227 | XmlNodeList partL = rootNode.ChildNodes; | 234 | XmlNodeList partL = rootNode.ChildNodes; |
235 | instance.Run = true; | ||
228 | 236 | ||
229 | foreach (XmlNode part in partL) | 237 | foreach (XmlNode part in partL) |
230 | { | 238 | { |
@@ -236,6 +244,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance | |||
236 | case "Running": | 244 | case "Running": |
237 | instance.Running=bool.Parse(part.InnerText); | 245 | instance.Running=bool.Parse(part.InnerText); |
238 | break; | 246 | break; |
247 | case "Run": | ||
248 | instance.Run = bool.Parse(part.InnerText); | ||
249 | break; | ||
239 | case "Variables": | 250 | case "Variables": |
240 | XmlNodeList varL = part.ChildNodes; | 251 | XmlNodeList varL = part.ChildNodes; |
241 | foreach (XmlNode var in varL) | 252 | foreach (XmlNode var in varL) |