aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorThomas Grimshaw2010-04-07 23:53:08 +0200
committerThomas Grimshaw2010-04-07 23:53:08 +0200
commitd834a2c3da1aa97887e087e5a265e73a914c5f7b (patch)
tree927f3a86501a09abfa1baf783cb85e072f1e332a
parentIncrease the amount of time we wait for a teleport to complete. This allows t... (diff)
downloadopensim-SC-d834a2c3da1aa97887e087e5a265e73a914c5f7b.zip
opensim-SC-d834a2c3da1aa97887e087e5a265e73a914c5f7b.tar.gz
opensim-SC-d834a2c3da1aa97887e087e5a265e73a914c5f7b.tar.bz2
opensim-SC-d834a2c3da1aa97887e087e5a265e73a914c5f7b.tar.xz
Implement cmGetAvatarList(). This returns a strided list of all avatars in the region, including their UUID, position and name. The radar is often the most taxing scripts on a sim, this function can help radars reduce their impact by 66% by eliminating the need for sensors.
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/CM_Api.cs130
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Interface/ICM_Api.cs3
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Runtime/CM_Stub.cs14
3 files changed, 87 insertions, 60 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 }
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ICM_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ICM_Api.cs
index ef990a1..6239726 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ICM_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ICM_Api.cs
@@ -15,7 +15,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
15 { 15 {
16 // Windlight Functions 16 // Windlight Functions
17 LSL_List cmGetWindlightScene(LSL_List rules); 17 LSL_List cmGetWindlightScene(LSL_List rules);
18 int cmSetWindlightScene(LSL_List rules); 18 int cmSetWindlightScene(LSL_List rules);
19 int cmSetWindlightSceneTargeted(LSL_List rules, key target); 19 int cmSetWindlightSceneTargeted(LSL_List rules, key target);
20 LSL_List cmGetAvatarList();
20 } 21 }
21} 22}
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/CM_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/CM_Stub.cs
index 5bc3a88..aaffbe4 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/CM_Stub.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/CM_Stub.cs
@@ -66,11 +66,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
66 public int cmSetWindlightScene(LSL_List rules) 66 public int cmSetWindlightScene(LSL_List rules)
67 { 67 {
68 return m_CM_Functions.cmSetWindlightScene(rules); 68 return m_CM_Functions.cmSetWindlightScene(rules);
69 } 69 }
70 70
71 public int cmSetWindlightSceneTargeted(LSL_List rules, key target) 71 public int cmSetWindlightSceneTargeted(LSL_List rules, key target)
72 { 72 {
73 return m_CM_Functions.cmSetWindlightSceneTargeted(rules, target); 73 return m_CM_Functions.cmSetWindlightSceneTargeted(rules, target);
74 }
75 public LSL_List cmGetAvatarList()
76 {
77 return m_CM_Functions.cmGetAvatarList();
74 } 78 }
75 } 79 }
76} 80}