aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorMelanie2013-12-16 22:11:03 +0000
committerMelanie2013-12-16 22:11:03 +0000
commitfe01e7d1cce9d875b5989931b9652e4cd00c311d (patch)
treed7e12171d5952d5a96c3f405a5d80c6eebb00937 /OpenSim/Region
parentThis is the acutal sitting avatar crossing code. This commit implements the (diff)
parentMerge branch 'justincc-master' (diff)
downloadopensim-SC-fe01e7d1cce9d875b5989931b9652e4cd00c311d.zip
opensim-SC-fe01e7d1cce9d875b5989931b9652e4cd00c311d.tar.gz
opensim-SC-fe01e7d1cce9d875b5989931b9652e4cd00c311d.tar.bz2
opensim-SC-fe01e7d1cce9d875b5989931b9652e4cd00c311d.tar.xz
Merge branch 'master' of melanie@opensimulator.org:/var/git/opensim
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/CoreModules/World/Wind/WindModule.cs38
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs25
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/ScenePresenceSitTests.cs14
-rw-r--r--OpenSim/Region/Framework/Scenes/UuidGatherer.cs15
-rw-r--r--OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs8
-rw-r--r--OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs16
-rw-r--r--OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsActor.cs9
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiNotecardTests.cs2
-rw-r--r--OpenSim/Region/ScriptEngine/XEngine/XEngine.cs20
9 files changed, 80 insertions, 67 deletions
diff --git a/OpenSim/Region/CoreModules/World/Wind/WindModule.cs b/OpenSim/Region/CoreModules/World/Wind/WindModule.cs
index 9de588c..35014f5 100644
--- a/OpenSim/Region/CoreModules/World/Wind/WindModule.cs
+++ b/OpenSim/Region/CoreModules/World/Wind/WindModule.cs
@@ -216,13 +216,13 @@ namespace OpenSim.Region.CoreModules
216 // FIXME: If console region is root then this will be printed by every module. Currently, there is no 216 // FIXME: If console region is root then this will be printed by every module. Currently, there is no
217 // way to prevent this, short of making the entire module shared (which is complete overkill). 217 // way to prevent this, short of making the entire module shared (which is complete overkill).
218 // One possibility is to return a bool to signal whether the module has completely handled the command 218 // One possibility is to return a bool to signal whether the module has completely handled the command
219 m_log.InfoFormat("[WIND]: Please change to a specific region in order to set Sun parameters."); 219 MainConsole.Instance.Output("Please change to a specific region in order to set Sun parameters.");
220 return; 220 return;
221 } 221 }
222 222
223 if (m_scene.ConsoleScene() != m_scene) 223 if (m_scene.ConsoleScene() != m_scene)
224 { 224 {
225 m_log.InfoFormat("[WIND]: Console Scene is not my scene."); 225 MainConsole.Instance.Output("Console Scene is not my scene.");
226 return; 226 return;
227 } 227 }
228 } 228 }
@@ -233,7 +233,9 @@ namespace OpenSim.Region.CoreModules
233 private void HandleConsoleCommand(string module, string[] cmdparams) 233 private void HandleConsoleCommand(string module, string[] cmdparams)
234 { 234 {
235 ValidateConsole(); 235 ValidateConsole();
236 m_log.Info("[WIND] The wind command can be used to change the currently active wind model plugin and update the parameters for wind plugins."); 236
237 MainConsole.Instance.Output(
238 "The wind command can be used to change the currently active wind model plugin and update the parameters for wind plugins.");
237 } 239 }
238 240
239 /// <summary> 241 /// <summary>
@@ -246,7 +248,9 @@ namespace OpenSim.Region.CoreModules
246 if ((cmdparams.Length != 4) 248 if ((cmdparams.Length != 4)
247 || !cmdparams[1].Equals("base")) 249 || !cmdparams[1].Equals("base"))
248 { 250 {
249 m_log.Info("[WIND] Invalid parameters to change parameters for Wind module base, usage: wind base <parameter> <value>"); 251 MainConsole.Instance.Output(
252 "Invalid parameters to change parameters for Wind module base, usage: wind base <parameter> <value>");
253
250 return; 254 return;
251 } 255 }
252 256
@@ -261,7 +265,9 @@ namespace OpenSim.Region.CoreModules
261 } 265 }
262 else 266 else
263 { 267 {
264 m_log.InfoFormat("[WIND] Invalid value {0} specified for {1}", cmdparams[3], cmdparams[2]); 268 MainConsole.Instance.OutputFormat(
269 "Invalid value {0} specified for {1}", cmdparams[3], cmdparams[2]);
270
265 return; 271 return;
266 } 272 }
267 273
@@ -271,22 +277,23 @@ namespace OpenSim.Region.CoreModules
271 277
272 if (desiredPlugin.Equals(m_activeWindPlugin.Name)) 278 if (desiredPlugin.Equals(m_activeWindPlugin.Name))
273 { 279 {
274 m_log.InfoFormat("[WIND] Wind model plugin {0} is already active", cmdparams[3]); 280 MainConsole.Instance.OutputFormat("Wind model plugin {0} is already active", cmdparams[3]);
281
275 return; 282 return;
276 } 283 }
277 284
278 if (m_availableWindPlugins.ContainsKey(desiredPlugin)) 285 if (m_availableWindPlugins.ContainsKey(desiredPlugin))
279 { 286 {
280 m_activeWindPlugin = m_availableWindPlugins[cmdparams[3]]; 287 m_activeWindPlugin = m_availableWindPlugins[cmdparams[3]];
281 m_log.InfoFormat("[WIND] {0} wind model plugin now active", m_activeWindPlugin.Name); 288
289 MainConsole.Instance.OutputFormat("{0} wind model plugin now active", m_activeWindPlugin.Name);
282 } 290 }
283 else 291 else
284 { 292 {
285 m_log.InfoFormat("[WIND] Could not find wind model plugin {0}", desiredPlugin); 293 MainConsole.Instance.OutputFormat("Could not find wind model plugin {0}", desiredPlugin);
286 } 294 }
287 break; 295 break;
288 } 296 }
289
290 } 297 }
291 298
292 /// <summary> 299 /// <summary>
@@ -300,7 +307,7 @@ namespace OpenSim.Region.CoreModules
300 if ((cmdparams.Length != 4) 307 if ((cmdparams.Length != 4)
301 && (cmdparams.Length != 3)) 308 && (cmdparams.Length != 3))
302 { 309 {
303 m_log.Info("[WIND] Usage: wind <plugin> <param> [value]"); 310 MainConsole.Instance.Output("Usage: wind <plugin> <param> [value]");
304 return; 311 return;
305 } 312 }
306 313
@@ -311,16 +318,17 @@ namespace OpenSim.Region.CoreModules
311 { 318 {
312 if (!float.TryParse(cmdparams[3], out value)) 319 if (!float.TryParse(cmdparams[3], out value))
313 { 320 {
314 m_log.InfoFormat("[WIND] Invalid value {0}", cmdparams[3]); 321 MainConsole.Instance.OutputFormat("Invalid value {0}", cmdparams[3]);
315 } 322 }
316 323
317 try 324 try
318 { 325 {
319 WindParamSet(plugin, param, value); 326 WindParamSet(plugin, param, value);
327 MainConsole.Instance.OutputFormat("{0} set to {1}", param, value);
320 } 328 }
321 catch (Exception e) 329 catch (Exception e)
322 { 330 {
323 m_log.InfoFormat("[WIND] {0}", e.Message); 331 MainConsole.Instance.OutputFormat("{0}", e.Message);
324 } 332 }
325 } 333 }
326 else 334 else
@@ -328,11 +336,11 @@ namespace OpenSim.Region.CoreModules
328 try 336 try
329 { 337 {
330 value = WindParamGet(plugin, param); 338 value = WindParamGet(plugin, param);
331 m_log.InfoFormat("[WIND] {0} : {1}", param, value); 339 MainConsole.Instance.OutputFormat("{0} : {1}", param, value);
332 } 340 }
333 catch (Exception e) 341 catch (Exception e)
334 { 342 {
335 m_log.InfoFormat("[WIND] {0}", e.Message); 343 MainConsole.Instance.OutputFormat("{0}", e.Message);
336 } 344 }
337 } 345 }
338 346
@@ -366,13 +374,11 @@ namespace OpenSim.Region.CoreModules
366 { 374 {
367 IWindModelPlugin windPlugin = m_availableWindPlugins[plugin]; 375 IWindModelPlugin windPlugin = m_availableWindPlugins[plugin];
368 windPlugin.WindParamSet(param, value); 376 windPlugin.WindParamSet(param, value);
369 m_log.InfoFormat("[WIND] {0} set to {1}", param, value);
370 } 377 }
371 else 378 else
372 { 379 {
373 throw new Exception(String.Format("Could not find plugin {0}", plugin)); 380 throw new Exception(String.Format("Could not find plugin {0}", plugin));
374 } 381 }
375
376 } 382 }
377 383
378 public float WindParamGet(string plugin, string param) 384 public float WindParamGet(string plugin, string param)
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index edb8ca8..cf98ef2 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -2866,16 +2866,33 @@ namespace OpenSim.Region.Framework.Scenes
2866 Vector3 up = new Vector3((float)x, (float)y, (float)z); 2866 Vector3 up = new Vector3((float)x, (float)y, (float)z);
2867 Vector3 sitOffset = up * Appearance.AvatarHeight * 0.02638f; 2867 Vector3 sitOffset = up * Appearance.AvatarHeight * 0.02638f;
2868 2868
2869 m_pos = sitTargetPos + sitOffset + SIT_TARGET_ADJUSTMENT; 2869 Vector3 newPos = sitTargetPos + sitOffset + SIT_TARGET_ADJUSTMENT;
2870 Quaternion newRot;
2871
2872 if (part.IsRoot)
2873 {
2874 newRot = sitTargetOrient;
2875 }
2876 else
2877 {
2878 newPos = newPos * part.RotationOffset;
2879 newRot = part.RotationOffset * sitTargetOrient;
2880 }
2881
2882 newPos += part.OffsetPosition;
2883
2884 m_pos = newPos;
2885 Rotation = newRot;
2870 2886
2871// m_pos = sitTargetPos + SIT_TARGET_ADJUSTMENT - sitOffset;
2872 Rotation = sitTargetOrient;
2873// ParentPosition = part.AbsolutePosition; 2887// ParentPosition = part.AbsolutePosition;
2874 part.ParentGroup.AddAvatar(UUID); 2888 part.ParentGroup.AddAvatar(UUID);
2875 } 2889 }
2876 else 2890 else
2877 { 2891 {
2878 m_pos -= part.AbsolutePosition; 2892 // An viewer expects to specify sit positions as offsets to the root prim, even if a child prim is
2893 // being sat upon.
2894 m_pos -= part.GroupPosition;
2895
2879// ParentPosition = part.AbsolutePosition; 2896// ParentPosition = part.AbsolutePosition;
2880 part.ParentGroup.AddAvatar(UUID); 2897 part.ParentGroup.AddAvatar(UUID);
2881 2898
diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceSitTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceSitTests.cs
index acaeb90..0911f00 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceSitTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceSitTests.cs
@@ -111,15 +111,13 @@ namespace OpenSim.Region.Framework.Scenes.Tests
111 111
112 SceneObjectPart part = SceneHelpers.AddSceneObject(m_scene).RootPart; 112 SceneObjectPart part = SceneHelpers.AddSceneObject(m_scene).RootPart;
113 113
114 // We need to preserve this here because phys actor is removed by the sit.
115 Vector3 spPhysActorSize = m_sp.PhysicsActor.Size;
114 m_sp.HandleAgentRequestSit(m_sp.ControllingClient, m_sp.UUID, part.UUID, Vector3.Zero); 116 m_sp.HandleAgentRequestSit(m_sp.ControllingClient, m_sp.UUID, part.UUID, Vector3.Zero);
115 117
116 // FIXME: This is different for live avatars - z position is adjusted. This is half the height of the
117 // default avatar.
118 // Curiously, Vector3.ToString() will not display the last two places of the float. For example,
119 // printing out npc.AbsolutePosition will give <0, 0, 0.8454993> not <0, 0, 0.845499337>
120 Assert.That( 118 Assert.That(
121 m_sp.AbsolutePosition, 119 m_sp.AbsolutePosition,
122 Is.EqualTo(part.AbsolutePosition + new Vector3(0, 0, 0.845499337f))); 120 Is.EqualTo(part.AbsolutePosition + new Vector3(0, 0, spPhysActorSize.Z / 2)));
123 121
124 m_sp.StandUp(); 122 m_sp.StandUp();
125 123
@@ -147,9 +145,9 @@ namespace OpenSim.Region.Framework.Scenes.Tests
147 145
148 Assert.That(part.SitTargetAvatar, Is.EqualTo(m_sp.UUID)); 146 Assert.That(part.SitTargetAvatar, Is.EqualTo(m_sp.UUID));
149 Assert.That(m_sp.ParentID, Is.EqualTo(part.LocalId)); 147 Assert.That(m_sp.ParentID, Is.EqualTo(part.LocalId));
150 Assert.That( 148// Assert.That(
151 m_sp.AbsolutePosition, 149// m_sp.AbsolutePosition,
152 Is.EqualTo(part.AbsolutePosition + part.SitTargetPosition + ScenePresence.SIT_TARGET_ADJUSTMENT)); 150// Is.EqualTo(part.AbsolutePosition + part.SitTargetPosition + ScenePresence.SIT_TARGET_ADJUSTMENT));
153 Assert.That(m_sp.PhysicsActor, Is.Null); 151 Assert.That(m_sp.PhysicsActor, Is.Null);
154 152
155 Assert.That(part.GetSittingAvatarsCount(), Is.EqualTo(1)); 153 Assert.That(part.GetSittingAvatarsCount(), Is.EqualTo(1));
diff --git a/OpenSim/Region/Framework/Scenes/UuidGatherer.cs b/OpenSim/Region/Framework/Scenes/UuidGatherer.cs
index 502c748..3e074b9 100644
--- a/OpenSim/Region/Framework/Scenes/UuidGatherer.cs
+++ b/OpenSim/Region/Framework/Scenes/UuidGatherer.cs
@@ -181,9 +181,18 @@ namespace OpenSim.Region.Framework.Scenes
181 181
182 if (part.ParticleSystem.Length > 0) 182 if (part.ParticleSystem.Length > 0)
183 { 183 {
184 Primitive.ParticleSystem ps = new Primitive.ParticleSystem(part.ParticleSystem, 0); 184 try
185 if (ps.Texture != UUID.Zero) 185 {
186 assetUuids[ps.Texture] = AssetType.Texture; 186 Primitive.ParticleSystem ps = new Primitive.ParticleSystem(part.ParticleSystem, 0);
187 if (ps.Texture != UUID.Zero)
188 assetUuids[ps.Texture] = AssetType.Texture;
189 }
190 catch (Exception e)
191 {
192 m_log.WarnFormat(
193 "[UUID GATHERER]: Could not check particle system for part {0} {1} in object {2} {3} since it is corrupt. Continuing.",
194 part.Name, part.UUID, sceneObject.Name, sceneObject.UUID);
195 }
187 } 196 }
188 197
189 TaskInventoryDictionary taskDictionary = (TaskInventoryDictionary)part.TaskInventory.Clone(); 198 TaskInventoryDictionary taskDictionary = (TaskInventoryDictionary)part.TaskInventory.Clone();
diff --git a/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs b/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs
index c717128..eb386fe 100644
--- a/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs
+++ b/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs
@@ -216,9 +216,11 @@ namespace OpenSim.Region.OptionalModules.Scripting.RegionReady
216 // m_log.InfoFormat("[RegionReady]: Logins enabled for {0}, Oar {1}", 216 // m_log.InfoFormat("[RegionReady]: Logins enabled for {0}, Oar {1}",
217 // m_scene.RegionInfo.RegionName, m_oarFileLoading.ToString()); 217 // m_scene.RegionInfo.RegionName, m_oarFileLoading.ToString());
218 218
219 // Warn level because the region cannot be used while logins are disabled 219 // Putting this out to console to make it eye-catching for people who are running OpenSimulator
220 m_log.WarnFormat( 220 // without info log messages enabled. Making this a warning is arguably misleading since it isn't a
221 "[RegionReady]: INITIALIZATION COMPLETE FOR {0} - LOGINS ENABLED", m_scene.Name); 221 // warning, and monitor scripts looking for warn/error/fatal messages will received false positives.
222 // Arguably, log4net needs a status log level (like Apache).
223 MainConsole.Instance.OutputFormat("INITIALIZATION COMPLETE FOR {0} - LOGINS ENABLED", m_scene.Name);
222 } 224 }
223 225
224 m_scene.SceneGridService.InformNeighborsThatRegionisUp( 226 m_scene.SceneGridService.InformNeighborsThatRegionisUp(
diff --git a/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs b/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs
index e1ef4d0..7f9e440 100644
--- a/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs
+++ b/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs
@@ -323,9 +323,9 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests
323 323
324 Assert.That(part.SitTargetAvatar, Is.EqualTo(npcId)); 324 Assert.That(part.SitTargetAvatar, Is.EqualTo(npcId));
325 Assert.That(npc.ParentID, Is.EqualTo(part.LocalId)); 325 Assert.That(npc.ParentID, Is.EqualTo(part.LocalId));
326 Assert.That( 326// Assert.That(
327 npc.AbsolutePosition, 327// npc.AbsolutePosition,
328 Is.EqualTo(part.AbsolutePosition + part.SitTargetPosition + ScenePresence.SIT_TARGET_ADJUSTMENT)); 328// Is.EqualTo(part.AbsolutePosition + part.SitTargetPosition + ScenePresence.SIT_TARGET_ADJUSTMENT));
329 329
330 m_npcMod.Stand(npc.UUID, m_scene); 330 m_npcMod.Stand(npc.UUID, m_scene);
331 331
@@ -337,7 +337,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests
337 public void TestSitAndStandWithNoSitTarget() 337 public void TestSitAndStandWithNoSitTarget()
338 { 338 {
339 TestHelpers.InMethod(); 339 TestHelpers.InMethod();
340// log4net.Config.XmlConfigurator.Configure(); 340// TestHelpers.EnableLogging();
341 341
342 ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, TestHelpers.ParseTail(0x1)); 342 ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, TestHelpers.ParseTail(0x1));
343 343
@@ -355,13 +355,11 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests
355 Assert.That(part.SitTargetAvatar, Is.EqualTo(UUID.Zero)); 355 Assert.That(part.SitTargetAvatar, Is.EqualTo(UUID.Zero));
356 Assert.That(npc.ParentID, Is.EqualTo(part.LocalId)); 356 Assert.That(npc.ParentID, Is.EqualTo(part.LocalId));
357 357
358 // FIXME: This is different for live avatars - z position is adjusted. This is half the height of the 358 // We should really be using the NPC size but this would mean preserving the physics actor since it is
359 // default avatar. 359 // removed on sit.
360 // Curiously, Vector3.ToString() will not display the last two places of the float. For example,
361 // printing out npc.AbsolutePosition will give <0, 0, 0.8454993> not <0, 0, 0.845499337>
362 Assert.That( 360 Assert.That(
363 npc.AbsolutePosition, 361 npc.AbsolutePosition,
364 Is.EqualTo(part.AbsolutePosition + new Vector3(0, 0, 0.845499337f))); 362 Is.EqualTo(part.AbsolutePosition + new Vector3(0, 0, sp.PhysicsActor.Size.Z / 2)));
365 363
366 m_npcMod.Stand(npc.UUID, m_scene); 364 m_npcMod.Stand(npc.UUID, m_scene);
367 365
diff --git a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsActor.cs b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsActor.cs
index e43136a..0d17e0e 100644
--- a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsActor.cs
+++ b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsActor.cs
@@ -118,14 +118,7 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
118 118
119 public override Vector3 Position { get; set; } 119 public override Vector3 Position { get; set; }
120 120
121 public override Vector3 Size 121 public override Vector3 Size { get; set; }
122 {
123 get { return _size; }
124 set {
125 _size = value;
126 _size.Z = _size.Z / 2.0f;
127 }
128 }
129 122
130 public override PrimitiveBaseShape Shape 123 public override PrimitiveBaseShape Shape
131 { 124 {
diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiNotecardTests.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiNotecardTests.cs
index c92bcdb..42d1b3b 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiNotecardTests.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiNotecardTests.cs
@@ -75,7 +75,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
75 { 75 {
76 TestHelpers.InMethod(); 76 TestHelpers.InMethod();
77 77
78 string[] ncLines = { "One", "Two", "Three" }; 78 string[] ncLines = { "One", "Twoรจ", "Three" };
79 79
80 TaskInventoryItem ncItem 80 TaskInventoryItem ncItem
81 = TaskInventoryHelpers.AddNotecard(m_scene, m_so.RootPart, "nc", "1", "10", string.Join("\n", ncLines)); 81 = TaskInventoryHelpers.AddNotecard(m_scene, m_so.RootPart, "nc", "1", "10", string.Join("\n", ncLines));
diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
index 5804aa8..b261b9f 100644
--- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
+++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
@@ -1709,9 +1709,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
1709 public bool GetScriptState(UUID itemID) 1709 public bool GetScriptState(UUID itemID)
1710 { 1710 {
1711 IScriptInstance instance = GetInstance(itemID); 1711 IScriptInstance instance = GetInstance(itemID);
1712 if (instance != null) 1712 return instance != null && instance.Running;
1713 return instance.Running;
1714 return false;
1715 } 1713 }
1716 1714
1717 public void ApiResetScript(UUID itemID) 1715 public void ApiResetScript(UUID itemID)
@@ -1755,9 +1753,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
1755 public DetectParams GetDetectParams(UUID itemID, int idx) 1753 public DetectParams GetDetectParams(UUID itemID, int idx)
1756 { 1754 {
1757 IScriptInstance instance = GetInstance(itemID); 1755 IScriptInstance instance = GetInstance(itemID);
1758 if (instance != null) 1756 return instance != null ? instance.GetDetectParams(idx) : null;
1759 return instance.GetDetectParams(idx);
1760 return null;
1761 } 1757 }
1762 1758
1763 public void SetMinEventDelay(UUID itemID, double delay) 1759 public void SetMinEventDelay(UUID itemID, double delay)
@@ -1770,9 +1766,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
1770 public UUID GetDetectID(UUID itemID, int idx) 1766 public UUID GetDetectID(UUID itemID, int idx)
1771 { 1767 {
1772 IScriptInstance instance = GetInstance(itemID); 1768 IScriptInstance instance = GetInstance(itemID);
1773 if (instance != null) 1769 return instance != null ? instance.GetDetectID(idx) : UUID.Zero;
1774 return instance.GetDetectID(idx);
1775 return UUID.Zero;
1776 } 1770 }
1777 1771
1778 public void SetState(UUID itemID, string newState) 1772 public void SetState(UUID itemID, string newState)
@@ -1786,9 +1780,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
1786 public int GetStartParameter(UUID itemID) 1780 public int GetStartParameter(UUID itemID)
1787 { 1781 {
1788 IScriptInstance instance = GetInstance(itemID); 1782 IScriptInstance instance = GetInstance(itemID);
1789 if (instance == null) 1783 return instance == null ? 0 : instance.StartParam;
1790 return 0;
1791 return instance.StartParam;
1792 } 1784 }
1793 1785
1794 public void OnShutdown() 1786 public void OnShutdown()
@@ -1822,9 +1814,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
1822 public IScriptApi GetApi(UUID itemID, string name) 1814 public IScriptApi GetApi(UUID itemID, string name)
1823 { 1815 {
1824 IScriptInstance instance = GetInstance(itemID); 1816 IScriptInstance instance = GetInstance(itemID);
1825 if (instance == null) 1817 return instance == null ? null : instance.GetApi(name);
1826 return null;
1827 return instance.GetApi(name);
1828 } 1818 }
1829 1819
1830 public void OnGetScriptRunning(IClientAPI controllingClient, UUID objectID, UUID itemID) 1820 public void OnGetScriptRunning(IClientAPI controllingClient, UUID objectID, UUID itemID)