diff options
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Implementation/CM_Api.cs | 130 |
1 files changed, 76 insertions, 54 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/CM_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/CM_Api.cs index 99973b4..9f829da 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/CM_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/CM_Api.cs | |||
@@ -86,6 +86,28 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
86 | } | 86 | } |
87 | 87 | ||
88 | /// <summary> | 88 | /// <summary> |
89 | /// Like osGetAgents but returns enough info for a radar | ||
90 | /// </summary> | ||
91 | /// <returns>Strided list of the UUID, position and name of each avatar in the region</returns> | ||
92 | public LSL_List cmGetAvatarList() | ||
93 | { | ||
94 | LSL_List result = new LSL_List(); | ||
95 | foreach (ScenePresence avatar in World.GetAvatars()) | ||
96 | { | ||
97 | if (avatar.UUID != m_host.OwnerID) | ||
98 | { | ||
99 | if (avatar.IsChildAgent == false) | ||
100 | { | ||
101 | result.Add(avatar.UUID); | ||
102 | result.Add(avatar.PhysicsActor.Position); | ||
103 | result.Add(avatar.Name); | ||
104 | } | ||
105 | } | ||
106 | } | ||
107 | return result; | ||
108 | } | ||
109 | |||
110 | /// <summary> | ||
89 | /// Get the current Windlight scene | 111 | /// Get the current Windlight scene |
90 | /// </summary> | 112 | /// </summary> |
91 | /// <returns>List of windlight parameters</returns> | 113 | /// <returns>List of windlight parameters</returns> |
@@ -229,10 +251,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
229 | 251 | ||
230 | return values; | 252 | return values; |
231 | 253 | ||
232 | } | 254 | } |
233 | 255 | ||
234 | private RegionMeta7WindlightData getWindlightProfileFromRules(LSL_List rules) | 256 | private RegionMeta7WindlightData getWindlightProfileFromRules(LSL_List rules) |
235 | { | 257 | { |
236 | RegionMeta7WindlightData wl = (RegionMeta7WindlightData)m_host.ParentGroup.Scene.RegionInfo.WindlightSettings.Clone(); | 258 | RegionMeta7WindlightData wl = (RegionMeta7WindlightData)m_host.ParentGroup.Scene.RegionInfo.WindlightSettings.Clone(); |
237 | 259 | ||
238 | LSL_List values = new LSL_List(); | 260 | LSL_List values = new LSL_List(); |
@@ -244,9 +266,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
244 | LSL_Types.Vector3 iV; | 266 | LSL_Types.Vector3 iV; |
245 | switch (rule) | 267 | switch (rule) |
246 | { | 268 | { |
247 | case (int)ScriptBaseClass.WL_SUN_MOON_POSITION: | 269 | case (int)ScriptBaseClass.WL_SUN_MOON_POSITION: |
248 | idx++; | 270 | idx++; |
249 | wl.sunMoonPosition = (float)rules.GetLSLFloatItem(idx); | 271 | wl.sunMoonPosition = (float)rules.GetLSLFloatItem(idx); |
250 | break; | 272 | break; |
251 | case (int)ScriptBaseClass.WL_AMBIENT: | 273 | case (int)ScriptBaseClass.WL_AMBIENT: |
252 | idx++; | 274 | idx++; |
@@ -419,58 +441,58 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
419 | { | 441 | { |
420 | CMShoutError("Careminster functions are not enabled."); | 442 | CMShoutError("Careminster functions are not enabled."); |
421 | return 0; | 443 | return 0; |
422 | } | 444 | } |
423 | if (!World.RegionInfo.EstateSettings.IsEstateManager(m_host.OwnerID) && World.GetScenePresence(m_host.OwnerID).GodLevel < 200) | 445 | if (!World.RegionInfo.EstateSettings.IsEstateManager(m_host.OwnerID) && World.GetScenePresence(m_host.OwnerID).GodLevel < 200) |
424 | { | 446 | { |
425 | CMShoutError("cmSetWindlightScene can only be used by estate managers or owners."); | 447 | CMShoutError("cmSetWindlightScene can only be used by estate managers or owners."); |
426 | return 0; | 448 | return 0; |
449 | } | ||
450 | int success = 0; | ||
451 | m_host.AddScriptLPS(1); | ||
452 | if (Meta7WindlightModule.EnableWindlight) | ||
453 | { | ||
454 | RegionMeta7WindlightData wl = getWindlightProfileFromRules(rules); | ||
455 | m_host.ParentGroup.Scene.StoreWindlightProfile(wl); | ||
456 | success = 1; | ||
457 | } | ||
458 | else | ||
459 | { | ||
460 | CMShoutError("Windlight module is disabled"); | ||
461 | return 0; | ||
462 | } | ||
463 | return success; | ||
464 | } | ||
465 | /// <summary> | ||
466 | /// Set the current Windlight scene to a target avatar | ||
467 | /// </summary> | ||
468 | /// <param name="rules"></param> | ||
469 | /// <returns>success: true or false</returns> | ||
470 | public int cmSetWindlightSceneTargeted(LSL_List rules, LSL_Key target) | ||
471 | { | ||
472 | if (!m_CMFunctionsEnabled) | ||
473 | { | ||
474 | CMShoutError("Careminster functions are not enabled."); | ||
475 | return 0; | ||
476 | } | ||
477 | if (!World.RegionInfo.EstateSettings.IsEstateManager(m_host.OwnerID) && World.GetScenePresence(m_host.OwnerID).GodLevel < 200) | ||
478 | { | ||
479 | CMShoutError("cmSetWindlightSceneTargeted can only be used by estate managers or owners."); | ||
480 | return 0; | ||
427 | } | 481 | } |
428 | int success = 0; | 482 | int success = 0; |
429 | m_host.AddScriptLPS(1); | 483 | m_host.AddScriptLPS(1); |
430 | if (Meta7WindlightModule.EnableWindlight) | 484 | if (Meta7WindlightModule.EnableWindlight) |
431 | { | 485 | { |
432 | RegionMeta7WindlightData wl = getWindlightProfileFromRules(rules); | 486 | RegionMeta7WindlightData wl = getWindlightProfileFromRules(rules); |
433 | m_host.ParentGroup.Scene.StoreWindlightProfile(wl); | 487 | World.EventManager.TriggerOnSendNewWindlightProfileTargeted(wl, new UUID(target.m_string)); |
434 | success = 1; | 488 | success = 1; |
435 | } | 489 | } |
436 | else | 490 | else |
437 | { | 491 | { |
438 | CMShoutError("Windlight module is disabled"); | 492 | CMShoutError("Windlight module is disabled"); |
439 | return 0; | 493 | return 0; |
440 | } | 494 | } |
441 | return success; | 495 | return success; |
442 | } | ||
443 | /// <summary> | ||
444 | /// Set the current Windlight scene to a target avatar | ||
445 | /// </summary> | ||
446 | /// <param name="rules"></param> | ||
447 | /// <returns>success: true or false</returns> | ||
448 | public int cmSetWindlightSceneTargeted(LSL_List rules, LSL_Key target) | ||
449 | { | ||
450 | if (!m_CMFunctionsEnabled) | ||
451 | { | ||
452 | CMShoutError("Careminster functions are not enabled."); | ||
453 | return 0; | ||
454 | } | ||
455 | if (!World.RegionInfo.EstateSettings.IsEstateManager(m_host.OwnerID) && World.GetScenePresence(m_host.OwnerID).GodLevel < 200) | ||
456 | { | ||
457 | CMShoutError("cmSetWindlightSceneTargeted can only be used by estate managers or owners."); | ||
458 | return 0; | ||
459 | } | ||
460 | int success = 0; | ||
461 | m_host.AddScriptLPS(1); | ||
462 | if (Meta7WindlightModule.EnableWindlight) | ||
463 | { | ||
464 | RegionMeta7WindlightData wl = getWindlightProfileFromRules(rules); | ||
465 | World.EventManager.TriggerOnSendNewWindlightProfileTargeted(wl, new UUID(target.m_string)); | ||
466 | success = 1; | ||
467 | } | ||
468 | else | ||
469 | { | ||
470 | CMShoutError("Windlight module is disabled"); | ||
471 | return 0; | ||
472 | } | ||
473 | return success; | ||
474 | } | 496 | } |
475 | 497 | ||
476 | } | 498 | } |