aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/Shared/Api
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/Api')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs78
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs2
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs7
3 files changed, 61 insertions, 26 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 8903c3b..139b4f1 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -68,6 +68,14 @@ using System.Reflection;
68 68
69namespace OpenSim.Region.ScriptEngine.Shared.Api 69namespace OpenSim.Region.ScriptEngine.Shared.Api
70{ 70{
71 // MUST be a ref type
72 public class UserInfoCacheEntry
73 {
74 public int time;
75 public UserAccount account;
76 public PresenceInfo pinfo;
77 }
78
71 /// <summary> 79 /// <summary>
72 /// Contains all LSL ll-functions. This class will be in Default AppDomain. 80 /// Contains all LSL ll-functions. This class will be in Default AppDomain.
73 /// </summary> 81 /// </summary>
@@ -92,6 +100,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
92 protected int m_scriptConsoleChannel = 0; 100 protected int m_scriptConsoleChannel = 0;
93 protected bool m_scriptConsoleChannelEnabled = false; 101 protected bool m_scriptConsoleChannelEnabled = false;
94 protected IUrlModule m_UrlModule = null; 102 protected IUrlModule m_UrlModule = null;
103 protected Dictionary<UUID, UserInfoCacheEntry> m_userInfoCache =
104 new Dictionary<UUID, UserInfoCacheEntry>();
95 105
96 public void Initialize(IScriptEngine ScriptEngine, SceneObjectPart host, uint localID, UUID itemID) 106 public void Initialize(IScriptEngine ScriptEngine, SceneObjectPart host, uint localID, UUID itemID)
97 { 107 {
@@ -1934,13 +1944,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1934 } 1944 }
1935 else 1945 else
1936 { 1946 {
1937 if (llVecDist(new LSL_Vector(0,0,0), targetPos) <= 10.0f) 1947 LSL_Vector rel_vec = SetPosAdjust(currentPos, targetPos);
1938 { 1948 part.OffsetPosition = new Vector3((float)rel_vec.x, (float)rel_vec.y, (float)rel_vec.z);
1939 part.OffsetPosition = new Vector3((float)targetPos.x, (float)targetPos.y, (float)targetPos.z); 1949 SceneObjectGroup parent = part.ParentGroup;
1940 SceneObjectGroup parent = part.ParentGroup; 1950 parent.HasGroupChanged = true;
1941 parent.HasGroupChanged = true; 1951 parent.ScheduleGroupForTerseUpdate();
1942 parent.ScheduleGroupForTerseUpdate();
1943 }
1944 } 1952 }
1945 } 1953 }
1946 1954
@@ -3250,17 +3258,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3250 public void llPointAt(LSL_Vector pos) 3258 public void llPointAt(LSL_Vector pos)
3251 { 3259 {
3252 m_host.AddScriptLPS(1); 3260 m_host.AddScriptLPS(1);
3253 ScenePresence Owner = World.GetScenePresence(m_host.UUID);
3254 LSL_Rotation rot = llEuler2Rot(pos);
3255 Owner.PreviousRotation = Owner.Rotation;
3256 Owner.Rotation = (new Quaternion((float)rot.x,(float)rot.y,(float)rot.z,(float)rot.s));
3257 } 3261 }
3258 3262
3259 public void llStopPointAt() 3263 public void llStopPointAt()
3260 { 3264 {
3261 m_host.AddScriptLPS(1); 3265 m_host.AddScriptLPS(1);
3262 ScenePresence Owner = m_host.ParentGroup.Scene.GetScenePresence(m_host.OwnerID);
3263 Owner.Rotation = Owner.PreviousRotation;
3264 } 3266 }
3265 3267
3266 public void llTargetOmega(LSL_Vector axis, double spinrate, double gain) 3268 public void llTargetOmega(LSL_Vector axis, double spinrate, double gain)
@@ -3916,24 +3918,56 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3916 m_host.AddScriptLPS(1); 3918 m_host.AddScriptLPS(1);
3917 3919
3918 UUID uuid = (UUID)id; 3920 UUID uuid = (UUID)id;
3921 PresenceInfo pinfo = null;
3922 UserAccount account;
3919 3923
3920 UserAccount account = World.UserAccountService.GetUserAccount(World.RegionInfo.ScopeID, uuid); 3924 UserInfoCacheEntry ce;
3925 if (!m_userInfoCache.TryGetValue(uuid, out ce))
3926 {
3927 account = World.UserAccountService.GetUserAccount(World.RegionInfo.ScopeID, uuid);
3928 if (account == null)
3929 {
3930 m_userInfoCache[uuid] = null; // Cache negative
3931 return UUID.Zero.ToString();
3932 }
3921 3933
3922 PresenceInfo pinfo = null;
3923 PresenceInfo[] pinfos = World.PresenceService.GetAgents(new string[] { uuid.ToString() });
3924 if (pinfos != null && pinfos.Length > 0)
3925 pinfo = pinfos[0];
3926 3934
3927 if (pinfo == null) 3935 PresenceInfo[] pinfos = World.PresenceService.GetAgents(new string[] { uuid.ToString() });
3928 return UUID.Zero.ToString(); 3936 if (pinfos != null && pinfos.Length > 0)
3937 pinfo = pinfos[0];
3938
3939 ce = new UserInfoCacheEntry();
3940 ce.time = Util.EnvironmentTickCount();
3941 ce.account = account;
3942 ce.pinfo = pinfo;
3943 }
3944 else
3945 {
3946 if (ce == null)
3947 return UUID.Zero.ToString();
3948
3949 account = ce.account;
3950 pinfo = ce.pinfo;
3951 }
3952
3953 if (Util.EnvironmentTickCount() < ce.time || (Util.EnvironmentTickCount() - ce.time) >= 20000)
3954 {
3955 PresenceInfo[] pinfos = World.PresenceService.GetAgents(new string[] { uuid.ToString() });
3956 if (pinfos != null && pinfos.Length > 0)
3957 pinfo = pinfos[0];
3958 else
3959 pinfo = null;
3960
3961 ce.time = Util.EnvironmentTickCount();
3962 ce.pinfo = pinfo;
3963 }
3929 3964
3930 string reply = String.Empty; 3965 string reply = String.Empty;
3931 3966
3932 switch (data) 3967 switch (data)
3933 { 3968 {
3934 case 1: // DATA_ONLINE (0|1) 3969 case 1: // DATA_ONLINE (0|1)
3935 // TODO: implement fetching of this information 3970 if (pinfo != null && pinfo.RegionID != UUID.Zero)
3936 if (pinfo != null)
3937 reply = "1"; 3971 reply = "1";
3938 else 3972 else
3939 reply = "0"; 3973 reply = "0";
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs
index fe71ed5..5ae6439 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs
@@ -1,4 +1,4 @@
1/* 1/*
2 * Copyright (c) Contributors, http://opensimulator.org/ 2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders. 3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 * 4 *
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs
index 06f9426..5da6bb9 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs
@@ -273,9 +273,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
273 public const int CHANGED_LINK = 32; 273 public const int CHANGED_LINK = 32;
274 public const int CHANGED_ALLOWED_DROP = 64; 274 public const int CHANGED_ALLOWED_DROP = 64;
275 public const int CHANGED_OWNER = 128; 275 public const int CHANGED_OWNER = 128;
276 public const int CHANGED_REGION_RESTART = 256; 276 public const int CHANGED_REGION = 256;
277 public const int CHANGED_REGION = 512; 277 public const int CHANGED_TELEPORT = 512;
278 public const int CHANGED_TELEPORT = 1024; 278 public const int CHANGED_REGION_RESTART = 1024;
279 public const int CHANGED_REGION_START = 1024; //LL Changed the constant from CHANGED_REGION_RESTART
279 public const int CHANGED_MEDIA = 2048; 280 public const int CHANGED_MEDIA = 2048;
280 public const int CHANGED_ANIMATION = 16384; 281 public const int CHANGED_ANIMATION = 16384;
281 public const int TYPE_INVALID = 0; 282 public const int TYPE_INVALID = 0;