diff options
author | Talun | 2012-05-08 15:52:25 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2012-05-09 00:14:24 +0100 |
commit | 61e99bcdcba5480aa8a2a8b8e2f2b0a66c08e6b4 (patch) | |
tree | d1d863334169d2b229fdf8ef372787570c24b711 /OpenSim/Region/ScriptEngine/Shared | |
parent | Remove physics actor related race conditions in SetVehicleFlags() and SetPhys... (diff) | |
download | opensim-SC-61e99bcdcba5480aa8a2a8b8e2f2b0a66c08e6b4.zip opensim-SC-61e99bcdcba5480aa8a2a8b8e2f2b0a66c08e6b4.tar.gz opensim-SC-61e99bcdcba5480aa8a2a8b8e2f2b0a66c08e6b4.tar.bz2 opensim-SC-61e99bcdcba5480aa8a2a8b8e2f2b0a66c08e6b4.tar.xz |
Mantis 6015 new LSL function llGetAgentList.
Details in the lsl wiki
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared')
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 afd943b..5b5cab8 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -5529,6 +5529,91 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
5529 | m_host.AddScriptLPS(1); | 5529 | m_host.AddScriptLPS(1); |
5530 | return "en-us"; | 5530 | return "en-us"; |
5531 | } | 5531 | } |
5532 | /// <summary> | ||
5533 | /// http://wiki.secondlife.com/wiki/LlGetAgentList | ||
5534 | /// The list of options is currently not used in SL | ||
5535 | /// scope is one of:- | ||
5536 | /// AGENT_LIST_REGION - all in the region | ||
5537 | /// AGENT_LIST_PARCEL - all in the same parcel as the scripted object | ||
5538 | /// AGENT_LIST_PARCEL_OWNER - all in any parcel owned by the owner of the | ||
5539 | /// current parcel. | ||
5540 | /// </summary> | ||
5541 | public LSL_List llGetAgentList(LSL_Integer scope, LSL_List options) | ||
5542 | { | ||
5543 | m_host.AddScriptLPS(1); | ||
5544 | |||
5545 | // the constants are 1, 2 and 4 so bits are being set, but you | ||
5546 | // get an error "INVALID_SCOPE" if it is anything but 1, 2 and 4 | ||
5547 | bool regionWide = scope == ScriptBaseClass.AGENT_LIST_REGION; | ||
5548 | bool parcelOwned = scope == ScriptBaseClass.AGENT_LIST_PARCEL_OWNER; | ||
5549 | bool parcel = scope == ScriptBaseClass.AGENT_LIST_PARCEL; | ||
5550 | |||
5551 | LSL_List result = new LSL_List(); | ||
5552 | |||
5553 | if (!regionWide && !parcelOwned && !parcel) | ||
5554 | { | ||
5555 | result.Add("INVALID_SCOPE"); | ||
5556 | return result; | ||
5557 | } | ||
5558 | |||
5559 | ILandObject land; | ||
5560 | Vector3 pos; | ||
5561 | UUID id = UUID.Zero; | ||
5562 | if (parcel || parcelOwned) | ||
5563 | { | ||
5564 | pos = m_host.ParentGroup.RootPart.GetWorldPosition(); | ||
5565 | land = World.LandChannel.GetLandObject(pos.X, pos.Y); | ||
5566 | if (land == null) | ||
5567 | { | ||
5568 | id = UUID.Zero; | ||
5569 | } | ||
5570 | else | ||
5571 | { | ||
5572 | if (parcelOwned) | ||
5573 | { | ||
5574 | id = land.LandData.OwnerID; | ||
5575 | } | ||
5576 | else | ||
5577 | { | ||
5578 | id = land.LandData.GlobalID; | ||
5579 | } | ||
5580 | } | ||
5581 | } | ||
5582 | List<UUID> presenceIds = new List<UUID>(); | ||
5583 | |||
5584 | World.ForEachRootScenePresence( | ||
5585 | delegate (ScenePresence ssp) | ||
5586 | { | ||
5587 | // Gods are not listed in SL | ||
5588 | if (!ssp.IsDeleted && ssp.GodLevel == 0.0 && !ssp.IsChildAgent) | ||
5589 | { | ||
5590 | if (!regionWide) | ||
5591 | { | ||
5592 | pos = ssp.AbsolutePosition; | ||
5593 | land = World.LandChannel.GetLandObject(pos.X, pos.Y); | ||
5594 | if (land != null) | ||
5595 | { | ||
5596 | if (parcelOwned && land.LandData.OwnerID == id || | ||
5597 | parcel && land.LandData.GlobalID == id) | ||
5598 | { | ||
5599 | result.Add(ssp.UUID.ToString()); | ||
5600 | } | ||
5601 | } | ||
5602 | } | ||
5603 | else | ||
5604 | { | ||
5605 | result.Add(ssp.UUID.ToString()); | ||
5606 | } | ||
5607 | } | ||
5608 | // Maximum of 100 results | ||
5609 | if (result.Length > 99) | ||
5610 | { | ||
5611 | return; | ||
5612 | } | ||
5613 | } | ||
5614 | ); | ||
5615 | return result; | ||
5616 | } | ||
5532 | 5617 | ||
5533 | public void llAdjustSoundVolume(double volume) | 5618 | public void llAdjustSoundVolume(double volume) |
5534 | { | 5619 | { |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs index 7a797ac..7f5d1fe 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs | |||
@@ -109,6 +109,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces | |||
109 | LSL_Vector llGetAccel(); | 109 | LSL_Vector llGetAccel(); |
110 | LSL_Integer llGetAgentInfo(string id); | 110 | LSL_Integer llGetAgentInfo(string id); |
111 | LSL_String llGetAgentLanguage(string id); | 111 | LSL_String llGetAgentLanguage(string id); |
112 | LSL_List llGetAgentList(LSL_Integer scope, LSL_List options); | ||
112 | LSL_Vector llGetAgentSize(string id); | 113 | LSL_Vector llGetAgentSize(string id); |
113 | LSL_Float llGetAlpha(int face); | 114 | LSL_Float llGetAlpha(int face); |
114 | LSL_Float llGetAndResetTime(); | 115 | 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 2a28542..b6c21e6 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs | |||
@@ -501,6 +501,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase | |||
501 | public const int OBJECT_STREAMING_COST = 15; | 501 | public const int OBJECT_STREAMING_COST = 15; |
502 | public const int OBJECT_PHYSICS_COST = 16; | 502 | public const int OBJECT_PHYSICS_COST = 16; |
503 | 503 | ||
504 | // for llGetAgentList | ||
505 | public const int AGENT_LIST_PARCEL = 1; | ||
506 | public const int AGENT_LIST_PARCEL_OWNER = 2; | ||
507 | public const int AGENT_LIST_REGION = 4; | ||
508 | |||
504 | // Can not be public const? | 509 | // Can not be public const? |
505 | public static readonly vector ZERO_VECTOR = new vector(0.0, 0.0, 0.0); | 510 | public static readonly vector ZERO_VECTOR = new vector(0.0, 0.0, 0.0); |
506 | public static readonly rotation ZERO_ROTATION = new rotation(0.0, 0.0, 0.0, 1.0); | 511 | 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 80fa530..c0bf29c 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs | |||
@@ -389,6 +389,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase | |||
389 | return m_LSL_Functions.llGetAgentLanguage(id); | 389 | return m_LSL_Functions.llGetAgentLanguage(id); |
390 | } | 390 | } |
391 | 391 | ||
392 | public LSL_List llGetAgentList(LSL_Integer scope, LSL_List options) | ||
393 | { | ||
394 | return m_LSL_Functions.llGetAgentList(scope, options); | ||
395 | } | ||
396 | |||
392 | public LSL_Vector llGetAgentSize(string id) | 397 | public LSL_Vector llGetAgentSize(string id) |
393 | { | 398 | { |
394 | return m_LSL_Functions.llGetAgentSize(id); | 399 | return m_LSL_Functions.llGetAgentSize(id); |