aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
diff options
context:
space:
mode:
authorTalun2012-05-08 15:52:25 +0100
committerMelanie2012-05-11 02:25:52 +0100
commite6181941432640e4bc7c46fb740c04d04d94032e (patch)
treed775ab5527af9f1e809a4d1f583668a4576951e1 /OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
parentreduce avatars terminal velocity to less than 30m/s or colisions with basic b... (diff)
downloadopensim-SC_OLD-e6181941432640e4bc7c46fb740c04d04d94032e.zip
opensim-SC_OLD-e6181941432640e4bc7c46fb740c04d04d94032e.tar.gz
opensim-SC_OLD-e6181941432640e4bc7c46fb740c04d04d94032e.tar.bz2
opensim-SC_OLD-e6181941432640e4bc7c46fb740c04d04d94032e.tar.xz
Mantis 6015 new LSL function llGetAgentList.
Details in the lsl wiki
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs85
1 files changed, 85 insertions, 0 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 0c28bf5..6523c2d 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -6132,6 +6132,91 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6132 m_host.AddScriptLPS(1); 6132 m_host.AddScriptLPS(1);
6133 return "en-us"; 6133 return "en-us";
6134 } 6134 }
6135 /// <summary>
6136 /// http://wiki.secondlife.com/wiki/LlGetAgentList
6137 /// The list of options is currently not used in SL
6138 /// scope is one of:-
6139 /// AGENT_LIST_REGION - all in the region
6140 /// AGENT_LIST_PARCEL - all in the same parcel as the scripted object
6141 /// AGENT_LIST_PARCEL_OWNER - all in any parcel owned by the owner of the
6142 /// current parcel.
6143 /// </summary>
6144 public LSL_List llGetAgentList(LSL_Integer scope, LSL_List options)
6145 {
6146 m_host.AddScriptLPS(1);
6147
6148 // the constants are 1, 2 and 4 so bits are being set, but you
6149 // get an error "INVALID_SCOPE" if it is anything but 1, 2 and 4
6150 bool regionWide = scope == ScriptBaseClass.AGENT_LIST_REGION;
6151 bool parcelOwned = scope == ScriptBaseClass.AGENT_LIST_PARCEL_OWNER;
6152 bool parcel = scope == ScriptBaseClass.AGENT_LIST_PARCEL;
6153
6154 LSL_List result = new LSL_List();
6155
6156 if (!regionWide && !parcelOwned && !parcel)
6157 {
6158 result.Add("INVALID_SCOPE");
6159 return result;
6160 }
6161
6162 ILandObject land;
6163 Vector3 pos;
6164 UUID id = UUID.Zero;
6165 if (parcel || parcelOwned)
6166 {
6167 pos = m_host.ParentGroup.RootPart.GetWorldPosition();
6168 land = World.LandChannel.GetLandObject(pos.X, pos.Y);
6169 if (land == null)
6170 {
6171 id = UUID.Zero;
6172 }
6173 else
6174 {
6175 if (parcelOwned)
6176 {
6177 id = land.LandData.OwnerID;
6178 }
6179 else
6180 {
6181 id = land.LandData.GlobalID;
6182 }
6183 }
6184 }
6185 List<UUID> presenceIds = new List<UUID>();
6186
6187 World.ForEachRootScenePresence(
6188 delegate (ScenePresence ssp)
6189 {
6190 // Gods are not listed in SL
6191 if (!ssp.IsDeleted && ssp.GodLevel == 0.0 && !ssp.IsChildAgent)
6192 {
6193 if (!regionWide)
6194 {
6195 pos = ssp.AbsolutePosition;
6196 land = World.LandChannel.GetLandObject(pos.X, pos.Y);
6197 if (land != null)
6198 {
6199 if (parcelOwned && land.LandData.OwnerID == id ||
6200 parcel && land.LandData.GlobalID == id)
6201 {
6202 result.Add(ssp.UUID.ToString());
6203 }
6204 }
6205 }
6206 else
6207 {
6208 result.Add(ssp.UUID.ToString());
6209 }
6210 }
6211 // Maximum of 100 results
6212 if (result.Length > 99)
6213 {
6214 return;
6215 }
6216 }
6217 );
6218 return result;
6219 }
6135 6220
6136 public void llAdjustSoundVolume(double volume) 6221 public void llAdjustSoundVolume(double volume)
6137 { 6222 {