From e6181941432640e4bc7c46fb740c04d04d94032e Mon Sep 17 00:00:00 2001
From: Talun
Date: Tue, 8 May 2012 15:52:25 +0100
Subject: Mantis 6015 new LSL function llGetAgentList.
Details in the lsl wiki
---
.../Shared/Api/Implementation/LSL_Api.cs | 85 ++++++++++++++++++++++
.../ScriptEngine/Shared/Api/Interface/ILSL_Api.cs | 1 +
.../Shared/Api/Runtime/LSL_Constants.cs | 5 ++
.../ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs | 5 ++
4 files changed, 96 insertions(+)
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
m_host.AddScriptLPS(1);
return "en-us";
}
+ ///
+ /// http://wiki.secondlife.com/wiki/LlGetAgentList
+ /// The list of options is currently not used in SL
+ /// scope is one of:-
+ /// AGENT_LIST_REGION - all in the region
+ /// AGENT_LIST_PARCEL - all in the same parcel as the scripted object
+ /// AGENT_LIST_PARCEL_OWNER - all in any parcel owned by the owner of the
+ /// current parcel.
+ ///
+ public LSL_List llGetAgentList(LSL_Integer scope, LSL_List options)
+ {
+ m_host.AddScriptLPS(1);
+
+ // the constants are 1, 2 and 4 so bits are being set, but you
+ // get an error "INVALID_SCOPE" if it is anything but 1, 2 and 4
+ bool regionWide = scope == ScriptBaseClass.AGENT_LIST_REGION;
+ bool parcelOwned = scope == ScriptBaseClass.AGENT_LIST_PARCEL_OWNER;
+ bool parcel = scope == ScriptBaseClass.AGENT_LIST_PARCEL;
+
+ LSL_List result = new LSL_List();
+
+ if (!regionWide && !parcelOwned && !parcel)
+ {
+ result.Add("INVALID_SCOPE");
+ return result;
+ }
+
+ ILandObject land;
+ Vector3 pos;
+ UUID id = UUID.Zero;
+ if (parcel || parcelOwned)
+ {
+ pos = m_host.ParentGroup.RootPart.GetWorldPosition();
+ land = World.LandChannel.GetLandObject(pos.X, pos.Y);
+ if (land == null)
+ {
+ id = UUID.Zero;
+ }
+ else
+ {
+ if (parcelOwned)
+ {
+ id = land.LandData.OwnerID;
+ }
+ else
+ {
+ id = land.LandData.GlobalID;
+ }
+ }
+ }
+ List presenceIds = new List();
+
+ World.ForEachRootScenePresence(
+ delegate (ScenePresence ssp)
+ {
+ // Gods are not listed in SL
+ if (!ssp.IsDeleted && ssp.GodLevel == 0.0 && !ssp.IsChildAgent)
+ {
+ if (!regionWide)
+ {
+ pos = ssp.AbsolutePosition;
+ land = World.LandChannel.GetLandObject(pos.X, pos.Y);
+ if (land != null)
+ {
+ if (parcelOwned && land.LandData.OwnerID == id ||
+ parcel && land.LandData.GlobalID == id)
+ {
+ result.Add(ssp.UUID.ToString());
+ }
+ }
+ }
+ else
+ {
+ result.Add(ssp.UUID.ToString());
+ }
+ }
+ // Maximum of 100 results
+ if (result.Length > 99)
+ {
+ return;
+ }
+ }
+ );
+ return result;
+ }
public void llAdjustSoundVolume(double volume)
{
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
LSL_Vector llGetAccel();
LSL_Integer llGetAgentInfo(string id);
LSL_String llGetAgentLanguage(string id);
+ LSL_List llGetAgentList(LSL_Integer scope, LSL_List options);
LSL_Vector llGetAgentSize(string id);
LSL_Float llGetAlpha(int face);
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
public const int OBJECT_STREAMING_COST = 15;
public const int OBJECT_PHYSICS_COST = 16;
+ // for llGetAgentList
+ public const int AGENT_LIST_PARCEL = 1;
+ public const int AGENT_LIST_PARCEL_OWNER = 2;
+ public const int AGENT_LIST_REGION = 4;
+
// Can not be public const?
public static readonly vector ZERO_VECTOR = new vector(0.0, 0.0, 0.0);
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
return m_LSL_Functions.llGetAgentLanguage(id);
}
+ public LSL_List llGetAgentList(LSL_Integer scope, LSL_List options)
+ {
+ return m_LSL_Functions.llGetAgentList(scope, options);
+ }
+
public LSL_Vector llGetAgentSize(string id)
{
return m_LSL_Functions.llGetAgentSize(id);
--
cgit v1.1
From 7461fe4554f8104212071e3e01b07786f8eb546f Mon Sep 17 00:00:00 2001
From: UbitUmarov
Date: Sat, 12 May 2012 15:27:37 +0100
Subject: ªTEST MESS* reduce animation packets send. Added onchangeanim event
with parameters to define if to add or remove, and if to send anims pack on
that evocation, etc
---
OpenSim/Framework/IClientAPI.cs | 3 +++
.../Region/ClientStack/Linden/UDP/LLClientView.cs | 22 +++++++++++++++++++++-
.../Scenes/Animation/ScenePresenceAnimator.cs | 20 ++++++++++++++++++--
OpenSim/Region/Framework/Scenes/ScenePresence.cs | 8 ++++++++
.../Server/IRCClientView.cs | 1 +
.../Region/OptionalModules/World/NPC/NPCAvatar.cs | 1 +
OpenSim/Tests/Common/Mock/TestClient.cs | 1 +
7 files changed, 53 insertions(+), 3 deletions(-)
diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs
index 2be78da..c1bd078 100644
--- a/OpenSim/Framework/IClientAPI.cs
+++ b/OpenSim/Framework/IClientAPI.cs
@@ -70,6 +70,8 @@ namespace OpenSim.Framework
public delegate void StopAnim(IClientAPI remoteClient, UUID animID);
+ public delegate void ChangeAnim(UUID animID, bool addOrRemove, bool sendPack);
+
public delegate void LinkObjects(IClientAPI remoteClient, uint parent, List children);
public delegate void DelinkObjects(List primIds, IClientAPI client);
@@ -791,6 +793,7 @@ namespace OpenSim.Framework
event ObjectDrop OnObjectDrop;
event StartAnim OnStartAnim;
event StopAnim OnStopAnim;
+ event ChangeAnim OnChangeAnim;
event LinkObjects OnLinkObjects;
event DelinkObjects OnDelinkObjects;
event RequestMapBlocks OnRequestMapBlocks;
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
index bb76717..7db6014 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
@@ -98,6 +98,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
public event AvatarPickerRequest OnAvatarPickerRequest;
public event StartAnim OnStartAnim;
public event StopAnim OnStopAnim;
+ public event ChangeAnim OnChangeAnim;
public event Action OnRequestAvatarsData;
public event LinkObjects OnLinkObjects;
public event DelinkObjects OnDelinkObjects;
@@ -6386,7 +6387,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
return true;
}
#endregion
-
+/*
StartAnim handlerStartAnim = null;
StopAnim handlerStopAnim = null;
@@ -6410,6 +6411,25 @@ namespace OpenSim.Region.ClientStack.LindenUDP
}
}
return true;
+*/
+ ChangeAnim handlerChangeAnim = null;
+
+ for (int i = 0; i < AgentAni.AnimationList.Length; i++)
+ {
+ handlerChangeAnim = OnChangeAnim;
+ if (handlerChangeAnim != null)
+ {
+ handlerChangeAnim(AgentAni.AnimationList[i].AnimID, AgentAni.AnimationList[i].StartAnim, false);
+ }
+ }
+
+ handlerChangeAnim = OnChangeAnim;
+ if (handlerChangeAnim != null)
+ {
+ handlerChangeAnim(UUID.Zero, false, true);
+ }
+
+ return true;
}
private bool HandleAgentRequestSit(IClientAPI sender, Packet Pack)
diff --git a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs
index f5623bd..e577958 100644
--- a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs
+++ b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs
@@ -79,13 +79,13 @@ namespace OpenSim.Region.Framework.Scenes.Animation
m_scenePresence = sp;
CurrentMovementAnimation = "CROUCH";
}
-
+
public void AddAnimation(UUID animID, UUID objectID)
{
if (m_scenePresence.IsChildAgent)
return;
-// m_log.DebugFormat("[SCENE PRESENCE ANIMATOR]: Adding animation {0} for {1}", animID, m_scenePresence.Name);
+ // m_log.DebugFormat("[SCENE PRESENCE ANIMATOR]: Adding animation {0} for {1}", animID, m_scenePresence.Name);
if (m_animations.Add(animID, m_scenePresence.ControllingClient.NextAnimationSequenceNumber, objectID))
SendAnimPack();
@@ -117,6 +117,22 @@ namespace OpenSim.Region.Framework.Scenes.Animation
SendAnimPack();
}
+ public void avnChangeAnim(UUID animID, bool addRemove, bool sendPack)
+ {
+ if (m_scenePresence.IsChildAgent)
+ return;
+
+ if (animID != UUID.Zero)
+ {
+ if (addRemove)
+ m_animations.Add(animID, m_scenePresence.ControllingClient.NextAnimationSequenceNumber, UUID.Zero);
+ else
+ m_animations.Remove(animID);
+ }
+ if(sendPack)
+ SendAnimPack();
+ }
+
// Called from scripts
public void RemoveAnimation(string name)
{
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 212720e..ba0ed95 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -781,6 +781,7 @@ namespace OpenSim.Region.Framework.Scenes
ControllingClient.OnSetAlwaysRun += HandleSetAlwaysRun;
ControllingClient.OnStartAnim += HandleStartAnim;
ControllingClient.OnStopAnim += HandleStopAnim;
+ ControllingClient.OnChangeAnim += avnHandleChangeAnim;
ControllingClient.OnForceReleaseControls += HandleForceReleaseControls;
ControllingClient.OnAutoPilotGo += MoveToTarget;
@@ -2432,6 +2433,13 @@ namespace OpenSim.Region.Framework.Scenes
Animator.RemoveAnimation(animID);
}
+ public void avnHandleChangeAnim(UUID animID, bool addRemove,bool sendPack)
+ {
+ Animator.avnChangeAnim(animID, addRemove, sendPack);
+ }
+
+
+
///
/// Rotate the avatar to the given rotation and apply a movement in the given relative vector
///
diff --git a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs
index a37e997..eac8e84 100644
--- a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs
+++ b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs
@@ -669,6 +669,7 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server
public event ObjectDrop OnObjectDrop;
public event StartAnim OnStartAnim;
public event StopAnim OnStopAnim;
+ public event ChangeAnim OnChangeAnim;
public event LinkObjects OnLinkObjects;
public event DelinkObjects OnDelinkObjects;
public event RequestMapBlocks OnRequestMapBlocks;
diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs
index c3335f0..8996865 100644
--- a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs
+++ b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs
@@ -189,6 +189,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC
public event ObjectDrop OnObjectDrop;
public event StartAnim OnStartAnim;
public event StopAnim OnStopAnim;
+ public event ChangeAnim OnChangeAnim;
public event LinkObjects OnLinkObjects;
public event DelinkObjects OnDelinkObjects;
public event RequestMapBlocks OnRequestMapBlocks;
diff --git a/OpenSim/Tests/Common/Mock/TestClient.cs b/OpenSim/Tests/Common/Mock/TestClient.cs
index 6a7cb0a..b2c824c 100644
--- a/OpenSim/Tests/Common/Mock/TestClient.cs
+++ b/OpenSim/Tests/Common/Mock/TestClient.cs
@@ -88,6 +88,7 @@ namespace OpenSim.Tests.Common.Mock
public event ObjectDrop OnObjectDrop;
public event StartAnim OnStartAnim;
public event StopAnim OnStopAnim;
+ public event ChangeAnim OnChangeAnim;
public event LinkObjects OnLinkObjects;
public event DelinkObjects OnDelinkObjects;
public event RequestMapBlocks OnRequestMapBlocks;
--
cgit v1.1