aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs90
1 files changed, 80 insertions, 10 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 18c0dd2..03c1e12 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -2116,15 +2116,30 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2116 { 2116 {
2117 face = 0; 2117 face = 0;
2118 } 2118 }
2119
2119 if (face >= 0 && face < GetNumberOfSides(part)) 2120 if (face >= 0 && face < GetNumberOfSides(part))
2120 { 2121 {
2121 Primitive.TextureEntryFace texface; 2122 Primitive.TextureEntryFace texface;
2122 texface = tex.GetFace((uint)face); 2123 texface = tex.GetFace((uint)face);
2123 return texface.TextureID.ToString(); 2124 string texture = texface.TextureID.ToString();
2125
2126 lock (part.TaskInventory)
2127 {
2128 foreach (KeyValuePair<UUID, TaskInventoryItem> inv in part.TaskInventory)
2129 {
2130 if (inv.Value.AssetID == texface.TextureID)
2131 {
2132 texture = inv.Value.Name.ToString();
2133 break;
2134 }
2135 }
2136 }
2137
2138 return texture;
2124 } 2139 }
2125 else 2140 else
2126 { 2141 {
2127 return String.Empty; 2142 return UUID.Zero.ToString();
2128 } 2143 }
2129 } 2144 }
2130 2145
@@ -3250,10 +3265,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3250 SceneObjectGroup grp = m_host.ParentGroup; 3265 SceneObjectGroup grp = m_host.ParentGroup;
3251 3266
3252 ScenePresence presence = World.GetScenePresence(m_host.OwnerID); 3267 ScenePresence presence = World.GetScenePresence(m_host.OwnerID);
3253 if (presence.Scene.AttachmentsModule != null) 3268
3254 { 3269 IAttachmentsModule attachmentsModule = m_ScriptEngine.World.AttachmentsModule;
3255 presence.Scene.AttachmentsModule.AttachObject(presence.ControllingClient, grp, (uint)attachment, false); 3270 if (attachmentsModule != null)
3256 } 3271 attachmentsModule.AttachObject(presence, grp, (uint)attachment, false);
3257 } 3272 }
3258 } 3273 }
3259 3274
@@ -3301,7 +3316,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3301 3316
3302 IAttachmentsModule attachmentsModule = m_ScriptEngine.World.AttachmentsModule; 3317 IAttachmentsModule attachmentsModule = m_ScriptEngine.World.AttachmentsModule;
3303 if (attachmentsModule != null) 3318 if (attachmentsModule != null)
3304 attachmentsModule.DetachSingleAttachmentToInv(itemID, presence.ControllingClient); 3319 attachmentsModule.DetachSingleAttachmentToInv(presence, itemID);
3305 } 3320 }
3306 3321
3307 public void llTakeCamera(string avatar) 3322 public void llTakeCamera(string avatar)
@@ -3953,7 +3968,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3953 parentPrim.ScheduleGroupForFullUpdate(); 3968 parentPrim.ScheduleGroupForFullUpdate();
3954 3969
3955 if (client != null) 3970 if (client != null)
3956 parentPrim.GetProperties(client); 3971 parentPrim.SendPropertiesToClient(client);
3957 3972
3958 ScriptSleep(1000); 3973 ScriptSleep(1000);
3959 } 3974 }
@@ -4104,6 +4119,25 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4104 public LSL_String llGetLinkKey(int linknum) 4119 public LSL_String llGetLinkKey(int linknum)
4105 { 4120 {
4106 m_host.AddScriptLPS(1); 4121 m_host.AddScriptLPS(1);
4122 List<UUID> keytable = new List<UUID>();
4123 // parse for sitting avatare-uuids
4124 World.ForEachScenePresence(delegate(ScenePresence presence)
4125 {
4126 if (!presence.IsChildAgent && presence.ParentID != 0 && m_host.ParentGroup.HasChildPrim(presence.ParentID))
4127 keytable.Add(presence.UUID);
4128 });
4129
4130 int totalprims = m_host.ParentGroup.PrimCount + keytable.Count;
4131 if (linknum > m_host.ParentGroup.PrimCount && linknum <= totalprims)
4132 {
4133 return keytable[totalprims - linknum].ToString();
4134 }
4135
4136 if (linknum == 1 && m_host.ParentGroup.PrimCount == 1 && keytable.Count == 1)
4137 {
4138 return m_host.UUID.ToString();
4139 }
4140
4107 SceneObjectPart part = m_host.ParentGroup.GetLinkNumPart(linknum); 4141 SceneObjectPart part = m_host.ParentGroup.GetLinkNumPart(linknum);
4108 if (part != null) 4142 if (part != null)
4109 { 4143 {
@@ -4160,6 +4194,27 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4160 public LSL_String llGetLinkName(int linknum) 4194 public LSL_String llGetLinkName(int linknum)
4161 { 4195 {
4162 m_host.AddScriptLPS(1); 4196 m_host.AddScriptLPS(1);
4197 // parse for sitting avatare-names
4198 List<String> nametable = new List<String>();
4199 World.ForEachScenePresence(delegate(ScenePresence presence)
4200 {
4201 if (!presence.IsChildAgent && presence.ParentID != 0 && m_host.ParentGroup.HasChildPrim(presence.ParentID))
4202 nametable.Add(presence.ControllingClient.Name);
4203 });
4204
4205 int totalprims = m_host.ParentGroup.PrimCount + nametable.Count;
4206 if (totalprims > m_host.ParentGroup.PrimCount)
4207 {
4208 // sitting Avatar-Name with negativ linknum / SinglePrim
4209 if (linknum < 0 && m_host.ParentGroup.PrimCount == 1 && nametable.Count == 1)
4210 return nametable[0];
4211 // Prim-Name / SinglePrim Sitting Avatar
4212 if (linknum == 1 && m_host.ParentGroup.PrimCount == 1 && nametable.Count == 1)
4213 return m_host.Name;
4214 // LinkNumber > of Real PrimSet = AvatarName
4215 if (linknum > m_host.ParentGroup.PrimCount && linknum <= totalprims)
4216 return nametable[totalprims - linknum];
4217 }
4163 4218
4164 // simplest case, this prims link number 4219 // simplest case, this prims link number
4165 if (m_host.LinkNum == linknum) 4220 if (m_host.LinkNum == linknum)
@@ -4173,6 +4228,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4173 else 4228 else
4174 return UUID.Zero.ToString(); 4229 return UUID.Zero.ToString();
4175 } 4230 }
4231
4176 // Link set 4232 // Link set
4177 SceneObjectPart part = null; 4233 SceneObjectPart part = null;
4178 if (m_host.LinkNum == 1) // this is the Root prim 4234 if (m_host.LinkNum == 1) // this is the Root prim
@@ -4619,8 +4675,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4619 4675
4620 public void llCollisionSound(string impact_sound, double impact_volume) 4676 public void llCollisionSound(string impact_sound, double impact_volume)
4621 { 4677 {
4622
4623 m_host.AddScriptLPS(1); 4678 m_host.AddScriptLPS(1);
4679
4624 // TODO: Parameter check logic required. 4680 // TODO: Parameter check logic required.
4625 UUID soundId = UUID.Zero; 4681 UUID soundId = UUID.Zero;
4626 if (!UUID.TryParse(impact_sound, out soundId)) 4682 if (!UUID.TryParse(impact_sound, out soundId))
@@ -6756,6 +6812,20 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6756 return m_host.GetAvatarOnSitTarget().ToString(); 6812 return m_host.GetAvatarOnSitTarget().ToString();
6757 } 6813 }
6758 6814
6815 // http://wiki.secondlife.com/wiki/LlAvatarOnLinkSitTarget
6816 public LSL_String llAvatarOnLinkSitTarget(int linknum)
6817 {
6818 m_host.AddScriptLPS(1);
6819 if(linknum == ScriptBaseClass.LINK_SET ||
6820 linknum == ScriptBaseClass.LINK_ALL_CHILDREN ||
6821 linknum == ScriptBaseClass.LINK_ALL_OTHERS) return UUID.Zero.ToString();
6822
6823 List<SceneObjectPart> parts = GetLinkParts(linknum);
6824 if (parts.Count == 0) return UUID.Zero.ToString();
6825 return parts[0].SitTargetAvatar.ToString();
6826 }
6827
6828
6759 public void llAddToLandPassList(string avatar, double hours) 6829 public void llAddToLandPassList(string avatar, double hours)
6760 { 6830 {
6761 m_host.AddScriptLPS(1); 6831 m_host.AddScriptLPS(1);
@@ -7481,7 +7551,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7481 return; 7551 return;
7482 LSL_Vector v; 7552 LSL_Vector v;
7483 v = rules.GetVector3Item(idx++); 7553 v = rules.GetVector3Item(idx++);
7484 av.OffsetPosition = new Vector3((float)v.x, (float)v.y, (float)v.z); 7554 av.AbsolutePosition = new Vector3((float)v.x, (float)v.y, (float)v.z);
7485 av.SendAvatarDataToAllAgents(); 7555 av.SendAvatarDataToAllAgents();
7486 7556
7487 break; 7557 break;