diff options
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 150 |
1 files changed, 92 insertions, 58 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 7c2f8ed..f4e4f44 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | |||
@@ -62,6 +62,7 @@ using LSL_List = OpenSim.Region.ScriptEngine.Shared.LSL_Types.list; | |||
62 | using LSL_Rotation = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Quaternion; | 62 | using LSL_Rotation = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Quaternion; |
63 | using LSL_String = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString; | 63 | using LSL_String = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString; |
64 | using LSL_Vector = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Vector3; | 64 | using LSL_Vector = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Vector3; |
65 | using PermissionMask = OpenSim.Framework.PermissionMask; | ||
65 | 66 | ||
66 | namespace OpenSim.Region.ScriptEngine.Shared.Api | 67 | namespace OpenSim.Region.ScriptEngine.Shared.Api |
67 | { | 68 | { |
@@ -143,9 +144,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
143 | 144 | ||
144 | protected IUrlModule m_UrlModule = null; | 145 | protected IUrlModule m_UrlModule = null; |
145 | 146 | ||
146 | public void Initialize(IScriptEngine ScriptEngine, SceneObjectPart host, TaskInventoryItem item) | 147 | public void Initialize( |
148 | IScriptEngine scriptEngine, SceneObjectPart host, TaskInventoryItem item, WaitHandle coopSleepHandle) | ||
147 | { | 149 | { |
148 | m_ScriptEngine = ScriptEngine; | 150 | m_ScriptEngine = scriptEngine; |
149 | m_host = host; | 151 | m_host = host; |
150 | m_item = item; | 152 | m_item = item; |
151 | m_debuggerSafe = m_ScriptEngine.Config.GetBoolean("DebuggerSafe", false); | 153 | m_debuggerSafe = m_ScriptEngine.Config.GetBoolean("DebuggerSafe", false); |
@@ -254,11 +256,23 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
254 | wComm.DeliverMessage(ChatTypeEnum.Shout, ScriptBaseClass.DEBUG_CHANNEL, m_host.Name, m_host.UUID, message); | 256 | wComm.DeliverMessage(ChatTypeEnum.Shout, ScriptBaseClass.DEBUG_CHANNEL, m_host.Name, m_host.UUID, message); |
255 | } | 257 | } |
256 | 258 | ||
259 | // Returns of the function is allowed. Throws a script exception if not allowed. | ||
257 | public void CheckThreatLevel(ThreatLevel level, string function) | 260 | public void CheckThreatLevel(ThreatLevel level, string function) |
258 | { | 261 | { |
259 | if (!m_OSFunctionsEnabled) | 262 | if (!m_OSFunctionsEnabled) |
260 | OSSLError(String.Format("{0} permission denied. All OS functions are disabled.", function)); // throws | 263 | OSSLError(String.Format("{0} permission denied. All OS functions are disabled.", function)); // throws |
261 | 264 | ||
265 | string reasonWhyNot = CheckThreatLevelTest(level, function); | ||
266 | if (!String.IsNullOrEmpty(reasonWhyNot)) | ||
267 | { | ||
268 | OSSLError(reasonWhyNot); | ||
269 | } | ||
270 | } | ||
271 | |||
272 | // Check to see if function is allowed. Returns an empty string if function permitted | ||
273 | // or a string explaining why this function can't be used. | ||
274 | private string CheckThreatLevelTest(ThreatLevel level, string function) | ||
275 | { | ||
262 | if (!m_FunctionPerms.ContainsKey(function)) | 276 | if (!m_FunctionPerms.ContainsKey(function)) |
263 | { | 277 | { |
264 | FunctionPerms perms = new FunctionPerms(); | 278 | FunctionPerms perms = new FunctionPerms(); |
@@ -338,10 +352,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
338 | { | 352 | { |
339 | // Allow / disallow by threat level | 353 | // Allow / disallow by threat level |
340 | if (level > m_MaxThreatLevel) | 354 | if (level > m_MaxThreatLevel) |
341 | OSSLError( | 355 | return |
342 | String.Format( | 356 | String.Format( |
343 | "{0} permission denied. Allowed threat level is {1} but function threat level is {2}.", | 357 | "{0} permission denied. Allowed threat level is {1} but function threat level is {2}.", |
344 | function, m_MaxThreatLevel, level)); | 358 | function, m_MaxThreatLevel, level); |
345 | } | 359 | } |
346 | else | 360 | else |
347 | { | 361 | { |
@@ -351,7 +365,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
351 | if (m_FunctionPerms[function].AllowedOwners.Contains(m_host.OwnerID)) | 365 | if (m_FunctionPerms[function].AllowedOwners.Contains(m_host.OwnerID)) |
352 | { | 366 | { |
353 | // prim owner is in the list of allowed owners | 367 | // prim owner is in the list of allowed owners |
354 | return; | 368 | return String.Empty; |
355 | } | 369 | } |
356 | 370 | ||
357 | UUID ownerID = m_item.OwnerID; | 371 | UUID ownerID = m_item.OwnerID; |
@@ -359,22 +373,22 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
359 | //OSSL only may be used if object is in the same group as the parcel | 373 | //OSSL only may be used if object is in the same group as the parcel |
360 | if (m_FunctionPerms[function].AllowedOwnerClasses.Contains("PARCEL_GROUP_MEMBER")) | 374 | if (m_FunctionPerms[function].AllowedOwnerClasses.Contains("PARCEL_GROUP_MEMBER")) |
361 | { | 375 | { |
362 | ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y); | 376 | ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition); |
363 | 377 | ||
364 | if (land.LandData.GroupID == m_item.GroupID && land.LandData.GroupID != UUID.Zero) | 378 | if (land.LandData.GroupID == m_item.GroupID && land.LandData.GroupID != UUID.Zero) |
365 | { | 379 | { |
366 | return; | 380 | return String.Empty; |
367 | } | 381 | } |
368 | } | 382 | } |
369 | 383 | ||
370 | //Only Parcelowners may use the function | 384 | //Only Parcelowners may use the function |
371 | if (m_FunctionPerms[function].AllowedOwnerClasses.Contains("PARCEL_OWNER")) | 385 | if (m_FunctionPerms[function].AllowedOwnerClasses.Contains("PARCEL_OWNER")) |
372 | { | 386 | { |
373 | ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y); | 387 | ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition); |
374 | 388 | ||
375 | if (land.LandData.OwnerID == ownerID) | 389 | if (land.LandData.OwnerID == ownerID) |
376 | { | 390 | { |
377 | return; | 391 | return String.Empty; |
378 | } | 392 | } |
379 | } | 393 | } |
380 | 394 | ||
@@ -384,7 +398,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
384 | //Only Estate Managers may use the function | 398 | //Only Estate Managers may use the function |
385 | if (World.RegionInfo.EstateSettings.IsEstateManagerOrOwner(ownerID) && World.RegionInfo.EstateSettings.EstateOwner != ownerID) | 399 | if (World.RegionInfo.EstateSettings.IsEstateManagerOrOwner(ownerID) && World.RegionInfo.EstateSettings.EstateOwner != ownerID) |
386 | { | 400 | { |
387 | return; | 401 | return String.Empty; |
388 | } | 402 | } |
389 | } | 403 | } |
390 | 404 | ||
@@ -393,25 +407,24 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
393 | { | 407 | { |
394 | if (World.RegionInfo.EstateSettings.EstateOwner == ownerID) | 408 | if (World.RegionInfo.EstateSettings.EstateOwner == ownerID) |
395 | { | 409 | { |
396 | return; | 410 | return String.Empty; |
397 | } | 411 | } |
398 | } | 412 | } |
399 | 413 | ||
400 | if (!m_FunctionPerms[function].AllowedCreators.Contains(m_item.CreatorID)) | 414 | if (!m_FunctionPerms[function].AllowedCreators.Contains(m_item.CreatorID)) |
401 | OSSLError( | 415 | return( |
402 | String.Format("{0} permission denied. Script creator is not in the list of users allowed to execute this function and prim owner also has no permission.", | 416 | String.Format("{0} permission denied. Script creator is not in the list of users allowed to execute this function and prim owner also has no permission.", |
403 | function)); | 417 | function)); |
404 | 418 | ||
405 | if (m_item.CreatorID != ownerID) | 419 | if (m_item.CreatorID != ownerID) |
406 | { | 420 | { |
407 | if ((m_item.CurrentPermissions & (uint)PermissionMask.Modify) != 0) | 421 | if ((m_item.CurrentPermissions & (uint)PermissionMask.Modify) != 0) |
408 | OSSLError( | 422 | return String.Format("{0} permission denied. Script permissions error.", function); |
409 | String.Format("{0} permission denied. Script permissions error.", | ||
410 | function)); | ||
411 | 423 | ||
412 | } | 424 | } |
413 | } | 425 | } |
414 | } | 426 | } |
427 | return String.Empty; | ||
415 | } | 428 | } |
416 | 429 | ||
417 | internal void OSSLDeprecated(string function, string replacement) | 430 | internal void OSSLDeprecated(string function, string replacement) |
@@ -983,7 +996,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
983 | if (animID == UUID.Zero) | 996 | if (animID == UUID.Zero) |
984 | target.Animator.RemoveAnimation(animation); | 997 | target.Animator.RemoveAnimation(animation); |
985 | else | 998 | else |
986 | target.Animator.RemoveAnimation(animID); | 999 | target.Animator.RemoveAnimation(animID, true); |
987 | } | 1000 | } |
988 | } | 1001 | } |
989 | } | 1002 | } |
@@ -1214,12 +1227,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1214 | sunHour += 24.0; | 1227 | sunHour += 24.0; |
1215 | 1228 | ||
1216 | World.RegionInfo.RegionSettings.UseEstateSun = useEstateSun; | 1229 | World.RegionInfo.RegionSettings.UseEstateSun = useEstateSun; |
1217 | World.RegionInfo.RegionSettings.SunPosition = sunHour + 6; // LL Region Sun Hour is 6 to 30 | 1230 | World.RegionInfo.RegionSettings.SunPosition = sunHour + 6; // LL Region Sun Hour is 6 to 30 |
1218 | World.RegionInfo.RegionSettings.FixedSun = sunFixed; | 1231 | World.RegionInfo.RegionSettings.FixedSun = sunFixed; |
1219 | World.RegionInfo.RegionSettings.Save(); | 1232 | World.RegionInfo.RegionSettings.Save(); |
1220 | 1233 | ||
1221 | World.EventManager.TriggerEstateToolsSunUpdate( | 1234 | World.EventManager.TriggerEstateToolsSunUpdate(World.RegionInfo.RegionHandle); |
1222 | World.RegionInfo.RegionHandle, sunFixed, useEstateSun, (float)sunHour); | ||
1223 | } | 1235 | } |
1224 | 1236 | ||
1225 | /// <summary> | 1237 | /// <summary> |
@@ -1244,8 +1256,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1244 | World.RegionInfo.EstateSettings.FixedSun = sunFixed; | 1256 | World.RegionInfo.EstateSettings.FixedSun = sunFixed; |
1245 | World.RegionInfo.EstateSettings.Save(); | 1257 | World.RegionInfo.EstateSettings.Save(); |
1246 | 1258 | ||
1247 | World.EventManager.TriggerEstateToolsSunUpdate( | 1259 | World.EventManager.TriggerEstateToolsSunUpdate(World.RegionInfo.RegionHandle); |
1248 | World.RegionInfo.RegionHandle, sunFixed, World.RegionInfo.RegionSettings.UseEstateSun, (float)sunHour); | ||
1249 | } | 1260 | } |
1250 | 1261 | ||
1251 | /// <summary> | 1262 | /// <summary> |
@@ -1501,8 +1512,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1501 | 1512 | ||
1502 | m_host.AddScriptLPS(1); | 1513 | m_host.AddScriptLPS(1); |
1503 | 1514 | ||
1504 | ILandObject land | 1515 | ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition); |
1505 | = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y); | ||
1506 | 1516 | ||
1507 | if (land.LandData.OwnerID != m_host.OwnerID) | 1517 | if (land.LandData.OwnerID != m_host.OwnerID) |
1508 | return; | 1518 | return; |
@@ -1518,8 +1528,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1518 | 1528 | ||
1519 | m_host.AddScriptLPS(1); | 1529 | m_host.AddScriptLPS(1); |
1520 | 1530 | ||
1521 | ILandObject land | 1531 | ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition); |
1522 | = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y); | ||
1523 | 1532 | ||
1524 | if (land.LandData.OwnerID != m_host.OwnerID) | 1533 | if (land.LandData.OwnerID != m_host.OwnerID) |
1525 | { | 1534 | { |
@@ -1569,6 +1578,32 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1569 | } | 1578 | } |
1570 | } | 1579 | } |
1571 | 1580 | ||
1581 | public string osGetPhysicsEngineType() | ||
1582 | { | ||
1583 | // High because it can be used to target attacks to known weaknesses | ||
1584 | // This would allow a new class of griefer scripts that don't even | ||
1585 | // require their user to know what they are doing (see script | ||
1586 | // kiddie) | ||
1587 | // Because it would be nice if scripts didn't blow up if the information | ||
1588 | // about the physics engine, this function returns an empty string if | ||
1589 | // the user does not have permission to see it. This as opposed to | ||
1590 | // throwing an exception. | ||
1591 | m_host.AddScriptLPS(1); | ||
1592 | string ret = String.Empty; | ||
1593 | if (String.IsNullOrEmpty(CheckThreatLevelTest(ThreatLevel.High, "osGetPhysicsEngineType"))) | ||
1594 | { | ||
1595 | if (m_ScriptEngine.World.PhysicsScene != null) | ||
1596 | { | ||
1597 | ret = m_ScriptEngine.World.PhysicsScene.EngineType; | ||
1598 | // An old physics engine might have an uninitialized engine type | ||
1599 | if (ret == null) | ||
1600 | ret = "unknown"; | ||
1601 | } | ||
1602 | } | ||
1603 | |||
1604 | return ret; | ||
1605 | } | ||
1606 | |||
1572 | public string osGetSimulatorVersion() | 1607 | public string osGetSimulatorVersion() |
1573 | { | 1608 | { |
1574 | // High because it can be used to target attacks to known weaknesses | 1609 | // High because it can be used to target attacks to known weaknesses |
@@ -1619,7 +1654,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1619 | } | 1654 | } |
1620 | } | 1655 | } |
1621 | 1656 | ||
1622 | public Object osParseJSONNew(string JSON) | 1657 | private Object osParseJSONNew(string JSON) |
1623 | { | 1658 | { |
1624 | CheckThreatLevel(ThreatLevel.None, "osParseJSONNew"); | 1659 | CheckThreatLevel(ThreatLevel.None, "osParseJSONNew"); |
1625 | 1660 | ||
@@ -1762,8 +1797,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1762 | taskItem.InvType = (int)InventoryType.Notecard; | 1797 | taskItem.InvType = (int)InventoryType.Notecard; |
1763 | taskItem.OwnerID = m_host.OwnerID; | 1798 | taskItem.OwnerID = m_host.OwnerID; |
1764 | taskItem.CreatorID = m_host.OwnerID; | 1799 | taskItem.CreatorID = m_host.OwnerID; |
1765 | taskItem.BasePermissions = (uint)PermissionMask.All; | 1800 | taskItem.BasePermissions = (uint)PermissionMask.All | (uint)PermissionMask.Export; |
1766 | taskItem.CurrentPermissions = (uint)PermissionMask.All; | 1801 | taskItem.CurrentPermissions = (uint)PermissionMask.All | (uint)PermissionMask.Export; |
1767 | taskItem.EveryonePermissions = 0; | 1802 | taskItem.EveryonePermissions = 0; |
1768 | taskItem.NextPermissions = (uint)PermissionMask.All; | 1803 | taskItem.NextPermissions = (uint)PermissionMask.All; |
1769 | taskItem.GroupID = m_host.GroupID; | 1804 | taskItem.GroupID = m_host.GroupID; |
@@ -2136,9 +2171,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2136 | CheckThreatLevel(ThreatLevel.Moderate, "osGetGridHomeURI"); | 2171 | CheckThreatLevel(ThreatLevel.Moderate, "osGetGridHomeURI"); |
2137 | m_host.AddScriptLPS(1); | 2172 | m_host.AddScriptLPS(1); |
2138 | 2173 | ||
2139 | string HomeURI = String.Empty; | ||
2140 | IConfigSource config = m_ScriptEngine.ConfigSource; | 2174 | IConfigSource config = m_ScriptEngine.ConfigSource; |
2175 | string HomeURI = Util.GetConfigVarFromSections<string>(config, "HomeURI", | ||
2176 | new string[] { "Startup", "Hypergrid" }, String.Empty); | ||
2177 | |||
2178 | if (!string.IsNullOrEmpty(HomeURI)) | ||
2179 | return HomeURI; | ||
2141 | 2180 | ||
2181 | // Legacy. Remove soon! | ||
2142 | if (config.Configs["LoginService"] != null) | 2182 | if (config.Configs["LoginService"] != null) |
2143 | HomeURI = config.Configs["LoginService"].GetString("SRV_HomeURI", HomeURI); | 2183 | HomeURI = config.Configs["LoginService"].GetString("SRV_HomeURI", HomeURI); |
2144 | 2184 | ||
@@ -2153,9 +2193,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2153 | CheckThreatLevel(ThreatLevel.Moderate, "osGetGridGatekeeperURI"); | 2193 | CheckThreatLevel(ThreatLevel.Moderate, "osGetGridGatekeeperURI"); |
2154 | m_host.AddScriptLPS(1); | 2194 | m_host.AddScriptLPS(1); |
2155 | 2195 | ||
2156 | string gatekeeperURI = String.Empty; | ||
2157 | IConfigSource config = m_ScriptEngine.ConfigSource; | 2196 | IConfigSource config = m_ScriptEngine.ConfigSource; |
2197 | string gatekeeperURI = Util.GetConfigVarFromSections<string>(config, "GatekeeperURI", | ||
2198 | new string[] { "Startup", "Hypergrid" }, String.Empty); | ||
2199 | |||
2200 | if (!string.IsNullOrEmpty(gatekeeperURI)) | ||
2201 | return gatekeeperURI; | ||
2158 | 2202 | ||
2203 | // Legacy. Remove soon! | ||
2159 | if (config.Configs["GridService"] != null) | 2204 | if (config.Configs["GridService"] != null) |
2160 | gatekeeperURI = config.Configs["GridService"].GetString("Gatekeeper", gatekeeperURI); | 2205 | gatekeeperURI = config.Configs["GridService"].GetString("Gatekeeper", gatekeeperURI); |
2161 | 2206 | ||
@@ -2532,13 +2577,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2532 | ScenePresence sp = World.GetScenePresence(npcId); | 2577 | ScenePresence sp = World.GetScenePresence(npcId); |
2533 | 2578 | ||
2534 | if (sp != null) | 2579 | if (sp != null) |
2535 | { | 2580 | return new LSL_Vector(sp.AbsolutePosition); |
2536 | Vector3 pos = sp.AbsolutePosition; | ||
2537 | return new LSL_Vector(pos.X, pos.Y, pos.Z); | ||
2538 | } | ||
2539 | } | 2581 | } |
2540 | 2582 | ||
2541 | return new LSL_Vector(0, 0, 0); | 2583 | return Vector3.Zero; |
2542 | } | 2584 | } |
2543 | 2585 | ||
2544 | public void osNpcMoveTo(LSL_Key npc, LSL_Vector pos) | 2586 | public void osNpcMoveTo(LSL_Key npc, LSL_Vector pos) |
@@ -2595,21 +2637,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2595 | { | 2637 | { |
2596 | UUID npcId; | 2638 | UUID npcId; |
2597 | if (!UUID.TryParse(npc.m_string, out npcId)) | 2639 | if (!UUID.TryParse(npc.m_string, out npcId)) |
2598 | return new LSL_Rotation(Quaternion.Identity.X, Quaternion.Identity.Y, Quaternion.Identity.Z, Quaternion.Identity.W); | 2640 | return new LSL_Rotation(Quaternion.Identity); |
2599 | 2641 | ||
2600 | if (!npcModule.CheckPermissions(npcId, m_host.OwnerID)) | 2642 | if (!npcModule.CheckPermissions(npcId, m_host.OwnerID)) |
2601 | return new LSL_Rotation(Quaternion.Identity.X, Quaternion.Identity.Y, Quaternion.Identity.Z, Quaternion.Identity.W); | 2643 | return new LSL_Rotation(Quaternion.Identity); |
2602 | 2644 | ||
2603 | ScenePresence sp = World.GetScenePresence(npcId); | 2645 | ScenePresence sp = World.GetScenePresence(npcId); |
2604 | 2646 | ||
2605 | if (sp != null) | 2647 | if (sp != null) |
2606 | { | 2648 | return new LSL_Rotation(sp.GetWorldRotation()); |
2607 | Quaternion rot = sp.Rotation; | ||
2608 | return new LSL_Rotation(rot.X, rot.Y, rot.Z, rot.W); | ||
2609 | } | ||
2610 | } | 2649 | } |
2611 | 2650 | ||
2612 | return new LSL_Rotation(Quaternion.Identity.X, Quaternion.Identity.Y, Quaternion.Identity.Z, Quaternion.Identity.W); | 2651 | return Quaternion.Identity; |
2613 | } | 2652 | } |
2614 | 2653 | ||
2615 | public void osNpcSetRot(LSL_Key npc, LSL_Rotation rotation) | 2654 | public void osNpcSetRot(LSL_Key npc, LSL_Rotation rotation) |
@@ -3055,20 +3094,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3055 | 3094 | ||
3056 | UUID avatarId = new UUID(avatar); | 3095 | UUID avatarId = new UUID(avatar); |
3057 | ScenePresence presence = World.GetScenePresence(avatarId); | 3096 | ScenePresence presence = World.GetScenePresence(avatarId); |
3058 | Vector3 pos = m_host.GetWorldPosition(); | 3097 | |
3059 | bool result = World.ScriptDanger(m_host.LocalId, new Vector3((float)pos.X, (float)pos.Y, (float)pos.Z)); | 3098 | if (presence != null && World.ScriptDanger(m_host.LocalId, m_host.GetWorldPosition())) |
3060 | if (result) | ||
3061 | { | 3099 | { |
3062 | if (presence != null) | 3100 | float health = presence.Health; |
3063 | { | 3101 | health += (float)healing; |
3064 | float health = presence.Health; | 3102 | |
3065 | health += (float)healing; | 3103 | if (health >= 100) |
3066 | if (health >= 100) | 3104 | health = 100; |
3067 | { | 3105 | |
3068 | health = 100; | 3106 | presence.setHealthWithUpdate(health); |
3069 | } | ||
3070 | presence.setHealthWithUpdate(health); | ||
3071 | } | ||
3072 | } | 3107 | } |
3073 | } | 3108 | } |
3074 | 3109 | ||
@@ -3145,8 +3180,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3145 | if (avatar != null && avatar.UUID != m_host.OwnerID) | 3180 | if (avatar != null && avatar.UUID != m_host.OwnerID) |
3146 | { | 3181 | { |
3147 | result.Add(new LSL_String(avatar.UUID.ToString())); | 3182 | result.Add(new LSL_String(avatar.UUID.ToString())); |
3148 | OpenMetaverse.Vector3 ap = avatar.AbsolutePosition; | 3183 | result.Add(new LSL_Vector(avatar.AbsolutePosition)); |
3149 | result.Add(new LSL_Vector(ap.X, ap.Y, ap.Z)); | ||
3150 | result.Add(new LSL_String(avatar.Name)); | 3184 | result.Add(new LSL_String(avatar.Name)); |
3151 | } | 3185 | } |
3152 | }); | 3186 | }); |