diff options
author | Talun | 2012-05-08 15:52:25 +0100 |
---|---|---|
committer | Melanie | 2012-05-11 02:25:52 +0100 |
commit | e6181941432640e4bc7c46fb740c04d04d94032e (patch) | |
tree | d775ab5527af9f1e809a4d1f583668a4576951e1 /OpenSim | |
parent | reduce avatars terminal velocity to less than 30m/s or colisions with basic b... (diff) | |
download | opensim-SC-e6181941432640e4bc7c46fb740c04d04d94032e.zip opensim-SC-e6181941432640e4bc7c46fb740c04d04d94032e.tar.gz opensim-SC-e6181941432640e4bc7c46fb740c04d04d94032e.tar.bz2 opensim-SC-e6181941432640e4bc7c46fb740c04d04d94032e.tar.xz |
Mantis 6015 new LSL function llGetAgentList.
Details in the lsl wiki
Diffstat (limited to 'OpenSim')
4 files changed, 96 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 | { |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs index 5c528977..be5740e 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs | |||
@@ -108,6 +108,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces | |||
108 | LSL_Vector llGetAccel(); | 108 | LSL_Vector llGetAccel(); |
109 | LSL_Integer llGetAgentInfo(string id); | 109 | LSL_Integer llGetAgentInfo(string id); |
110 | LSL_String llGetAgentLanguage(string id); | 110 | LSL_String llGetAgentLanguage(string id); |
111 | LSL_List llGetAgentList(LSL_Integer scope, LSL_List options); | ||
111 | LSL_Vector llGetAgentSize(string id); | 112 | LSL_Vector llGetAgentSize(string id); |
112 | LSL_Float llGetAlpha(int face); | 113 | LSL_Float llGetAlpha(int face); |
113 | LSL_Float llGetAndResetTime(); | 114 | LSL_Float llGetAndResetTime(); |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs index 6246b57..278f74e 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs | |||
@@ -500,6 +500,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase | |||
500 | public const int OBJECT_STREAMING_COST = 15; | 500 | public const int OBJECT_STREAMING_COST = 15; |
501 | public const int OBJECT_PHYSICS_COST = 16; | 501 | public const int OBJECT_PHYSICS_COST = 16; |
502 | 502 | ||
503 | // for llGetAgentList | ||
504 | public const int AGENT_LIST_PARCEL = 1; | ||
505 | public const int AGENT_LIST_PARCEL_OWNER = 2; | ||
506 | public const int AGENT_LIST_REGION = 4; | ||
507 | |||
503 | // Can not be public const? | 508 | // Can not be public const? |
504 | public static readonly vector ZERO_VECTOR = new vector(0.0, 0.0, 0.0); | 509 | public static readonly vector ZERO_VECTOR = new vector(0.0, 0.0, 0.0); |
505 | public static readonly rotation ZERO_ROTATION = new rotation(0.0, 0.0, 0.0, 1.0); | 510 | public static readonly rotation ZERO_ROTATION = new rotation(0.0, 0.0, 0.0, 1.0); |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs index 70c5fcd..9ba9561 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs | |||
@@ -391,6 +391,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase | |||
391 | return m_LSL_Functions.llGetAgentLanguage(id); | 391 | return m_LSL_Functions.llGetAgentLanguage(id); |
392 | } | 392 | } |
393 | 393 | ||
394 | public LSL_List llGetAgentList(LSL_Integer scope, LSL_List options) | ||
395 | { | ||
396 | return m_LSL_Functions.llGetAgentList(scope, options); | ||
397 | } | ||
398 | |||
394 | public LSL_Vector llGetAgentSize(string id) | 399 | public LSL_Vector llGetAgentSize(string id) |
395 | { | 400 | { |
396 | return m_LSL_Functions.llGetAgentSize(id); | 401 | return m_LSL_Functions.llGetAgentSize(id); |