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.cs149
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs10
2 files changed, 80 insertions, 79 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 7ff30ca..aa389ba 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -100,6 +100,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
100 protected float m_ScriptDelayFactor = 1.0f; 100 protected float m_ScriptDelayFactor = 1.0f;
101 protected float m_ScriptDistanceFactor = 1.0f; 101 protected float m_ScriptDistanceFactor = 1.0f;
102 protected float m_MinTimerInterval = 0.5f; 102 protected float m_MinTimerInterval = 0.5f;
103 protected float m_recoilScaleFactor = 0.0f;
103 104
104 protected DateTime m_timer = DateTime.Now; 105 protected DateTime m_timer = DateTime.Now;
105 protected bool m_waitingForScriptAnswer = false; 106 protected bool m_waitingForScriptAnswer = false;
@@ -187,6 +188,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
187 // there's an smtp config, so load in the snooze time. 188 // there's an smtp config, so load in the snooze time.
188 EMAIL_PAUSE_TIME = SMTPConfig.GetInt("email_pause_time", EMAIL_PAUSE_TIME); 189 EMAIL_PAUSE_TIME = SMTPConfig.GetInt("email_pause_time", EMAIL_PAUSE_TIME);
189 } 190 }
191 // Rezzing an object with a velocity can create recoil. This feature seems to have been
192 // removed from recent versions of SL. The code computes recoil (vel*mass) and scales
193 // it by this factor. May be zero to turn off recoil all together.
194 m_recoilScaleFactor = m_ScriptEngine.Config.GetFloat("RecoilScaleFactor", m_recoilScaleFactor);
190 } 195 }
191 196
192 public override Object InitializeLifetimeService() 197 public override Object InitializeLifetimeService()
@@ -1483,19 +1488,20 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1483 return 0; 1488 return 0;
1484 1489
1485 case ScriptBaseClass.STATUS_ROTATE_X: 1490 case ScriptBaseClass.STATUS_ROTATE_X:
1486 if (m_host.GetAxisRotation(2) == 2) 1491 // if (m_host.GetAxisRotation(2) != 0)
1492 if (m_host.GetAxisRotation((int)SceneObjectGroup.axisSelect.STATUS_ROTATE_X) != 0)
1487 return 1; 1493 return 1;
1488 else 1494 else
1489 return 0; 1495 return 0;
1490 1496
1491 case ScriptBaseClass.STATUS_ROTATE_Y: 1497 case ScriptBaseClass.STATUS_ROTATE_Y:
1492 if (m_host.GetAxisRotation(4) == 4) 1498 if (m_host.GetAxisRotation((int)SceneObjectGroup.axisSelect.STATUS_ROTATE_Y) != 0)
1493 return 1; 1499 return 1;
1494 else 1500 else
1495 return 0; 1501 return 0;
1496 1502
1497 case ScriptBaseClass.STATUS_ROTATE_Z: 1503 case ScriptBaseClass.STATUS_ROTATE_Z:
1498 if (m_host.GetAxisRotation(8) == 8) 1504 if (m_host.GetAxisRotation((int)SceneObjectGroup.axisSelect.STATUS_ROTATE_Z) != 0)
1499 return 1; 1505 return 1;
1500 else 1506 else
1501 return 0; 1507 return 0;
@@ -3107,11 +3113,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3107 3113
3108 PhysicsActor pa = new_group.RootPart.PhysActor; 3114 PhysicsActor pa = new_group.RootPart.PhysActor;
3109 3115
3116 //Recoil.
3110 if (pa != null && pa.IsPhysical && (Vector3)vel != Vector3.Zero) 3117 if (pa != null && pa.IsPhysical && (Vector3)vel != Vector3.Zero)
3111 { 3118 {
3112 float groupmass = new_group.GetMass(); 3119 float groupmass = new_group.GetMass();
3113 vel *= -groupmass; 3120 Vector3 recoil = -vel * groupmass * m_recoilScaleFactor;
3114 llApplyImpulse(vel, 0); 3121 if (recoil != Vector3.Zero)
3122 {
3123 llApplyImpulse(recoil, 0);
3124 }
3115 } 3125 }
3116 // Variable script delay? (see (http://wiki.secondlife.com/wiki/LSL_Delay) 3126 // Variable script delay? (see (http://wiki.secondlife.com/wiki/LSL_Delay)
3117 return; 3127 return;
@@ -3288,7 +3298,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3288 /// <summary> 3298 /// <summary>
3289 /// Attach the object containing this script to the avatar that owns it. 3299 /// Attach the object containing this script to the avatar that owns it.
3290 /// </summary> 3300 /// </summary>
3291 /// <param name='attachment'>The attachment point (e.g. ATTACH_CHEST)</param> 3301 /// <param name='attachmentPoint'>
3302 /// The attachment point (e.g. <see cref="OpenSim.Region.ScriptEngine.Shared.ScriptBase.ScriptBaseClass.ATTACH_CHEST">ATTACH_CHEST</see>)
3303 /// </param>
3292 /// <returns>true if the attach suceeded, false if it did not</returns> 3304 /// <returns>true if the attach suceeded, false if it did not</returns>
3293 public bool AttachToAvatar(int attachmentPoint) 3305 public bool AttachToAvatar(int attachmentPoint)
3294 { 3306 {
@@ -3719,21 +3731,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3719 } 3731 }
3720 else 3732 else
3721 { 3733 {
3722 bool sitting = false; 3734 if (m_host.ParentGroup.GetSittingAvatars().Contains(agentID))
3723 if (m_host.SitTargetAvatar == agentID)
3724 {
3725 sitting = true;
3726 }
3727 else
3728 {
3729 foreach (SceneObjectPart p in m_host.ParentGroup.Parts)
3730 {
3731 if (p.SitTargetAvatar == agentID)
3732 sitting = true;
3733 }
3734 }
3735
3736 if (sitting)
3737 { 3735 {
3738 // When agent is sitting, certain permissions are implicit if requested from sitting agent 3736 // When agent is sitting, certain permissions are implicit if requested from sitting agent
3739 implicitPerms = ScriptBaseClass.PERMISSION_TRIGGER_ANIMATION | 3737 implicitPerms = ScriptBaseClass.PERMISSION_TRIGGER_ANIMATION |
@@ -3775,7 +3773,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3775 INPCModule npcModule = World.RequestModuleInterface<INPCModule>(); 3773 INPCModule npcModule = World.RequestModuleInterface<INPCModule>();
3776 if (npcModule != null && npcModule.IsNPC(agentID, World)) 3774 if (npcModule != null && npcModule.IsNPC(agentID, World))
3777 { 3775 {
3778 if (agentID == m_host.ParentGroup.OwnerID || npcModule.GetOwner(agentID) == m_host.ParentGroup.OwnerID) 3776 if (npcModule.CheckPermissions(agentID, m_host.OwnerID))
3779 { 3777 {
3780 lock (m_host.TaskInventory) 3778 lock (m_host.TaskInventory)
3781 { 3779 {
@@ -4150,62 +4148,56 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4150 public LSL_String llGetLinkName(int linknum) 4148 public LSL_String llGetLinkName(int linknum)
4151 { 4149 {
4152 m_host.AddScriptLPS(1); 4150 m_host.AddScriptLPS(1);
4153 // simplest case, this prims link number
4154 if (linknum == m_host.LinkNum || linknum == ScriptBaseClass.LINK_THIS)
4155 return m_host.Name;
4156 4151
4157 // parse for sitting avatare-names 4152 if (linknum < 0)
4158 List<String> nametable = new List<String>();
4159 World.ForEachRootScenePresence(delegate(ScenePresence presence)
4160 { 4153 {
4161 SceneObjectPart sitPart = presence.ParentPart; 4154 if (linknum == ScriptBaseClass.LINK_THIS)
4162 if (sitPart != null && m_host.ParentGroup.ContainsPart(sitPart.LocalId))
4163 nametable.Add(presence.ControllingClient.Name);
4164 });
4165
4166 int totalprims = m_host.ParentGroup.PrimCount + nametable.Count;
4167 if (totalprims > m_host.ParentGroup.PrimCount)
4168 {
4169 // sitting Avatar-Name with negativ linknum / SinglePrim
4170 if (linknum < 0 && m_host.ParentGroup.PrimCount == 1 && nametable.Count == 1)
4171 return nametable[0];
4172 // Prim-Name / SinglePrim Sitting Avatar
4173 if (linknum == 1 && m_host.ParentGroup.PrimCount == 1 && nametable.Count == 1)
4174 return m_host.Name; 4155 return m_host.Name;
4175 // LinkNumber > of Real PrimSet = AvatarName 4156 else
4176 if (linknum > m_host.ParentGroup.PrimCount && linknum <= totalprims) 4157 return ScriptBaseClass.NULL_KEY;
4177 return nametable[totalprims - linknum];
4178 } 4158 }
4179 4159
4180 // Single prim 4160 int actualPrimCount = m_host.ParentGroup.PrimCount;
4181 if (m_host.LinkNum == 0) 4161 List<UUID> sittingAvatarIds = m_host.ParentGroup.GetSittingAvatars();
4162 int adjustedPrimCount = actualPrimCount + sittingAvatarIds.Count;
4163
4164 // Special case for a single prim. In this case the linknum is zero. However, this will not match a single
4165 // prim that has any avatars sat upon it (in which case the root prim is link 1).
4166 if (linknum == 0)
4182 { 4167 {
4183 if (linknum == 0 || linknum == ScriptBaseClass.LINK_ROOT) 4168 if (actualPrimCount == 1 && sittingAvatarIds.Count == 0)
4184 return m_host.Name; 4169 return m_host.Name;
4185 else
4186 return UUID.Zero.ToString();
4187 }
4188 4170
4189 // Link set 4171 return ScriptBaseClass.NULL_KEY;
4190 SceneObjectPart part = null; 4172 }
4191 if (m_host.LinkNum == 1) // this is the Root prim 4173 // Special case to handle a single prim with sitting avatars. GetLinkPart() would only match zero but
4174 // here we must match 1 (ScriptBaseClass.LINK_ROOT).
4175 else if (linknum == 1 && actualPrimCount == 1)
4192 { 4176 {
4193 if (linknum < 0) 4177 if (sittingAvatarIds.Count > 0)
4194 part = m_host.ParentGroup.GetLinkNumPart(2); 4178 return m_host.ParentGroup.RootPart.Name;
4195 else 4179 else
4196 part = m_host.ParentGroup.GetLinkNumPart(linknum); 4180 return ScriptBaseClass.NULL_KEY;
4197 } 4181 }
4198 else // this is a child prim 4182 else if (linknum <= adjustedPrimCount)
4199 { 4183 {
4200 if (linknum < 2) 4184 if (linknum <= actualPrimCount)
4201 part = m_host.ParentGroup.GetLinkNumPart(1); 4185 {
4186 return m_host.ParentGroup.GetLinkNumPart(linknum).Name;
4187 }
4202 else 4188 else
4203 part = m_host.ParentGroup.GetLinkNumPart(linknum); 4189 {
4190 ScenePresence sp = World.GetScenePresence(sittingAvatarIds[linknum - actualPrimCount - 1]);
4191 if (sp != null)
4192 return sp.Name;
4193 else
4194 return ScriptBaseClass.NULL_KEY;
4195 }
4204 } 4196 }
4205 if (part != null)
4206 return part.Name;
4207 else 4197 else
4208 return UUID.Zero.ToString(); 4198 {
4199 return ScriptBaseClass.NULL_KEY;
4200 }
4209 } 4201 }
4210 4202
4211 public LSL_Integer llGetInventoryNumber(int type) 4203 public LSL_Integer llGetInventoryNumber(int type)
@@ -5818,9 +5810,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
5818 } 5810 }
5819 5811
5820 /// <summary> 5812 /// <summary>
5821 /// Insert the list identified by <src> into the 5813 /// Insert the list identified by <paramref name="src"/> into the
5822 /// list designated by <dest> such that the first 5814 /// list designated by <paramref name="dest"/> such that the first
5823 /// new element has the index specified by <index> 5815 /// new element has the index specified by <paramref name="index"/>
5824 /// </summary> 5816 /// </summary>
5825 5817
5826 public LSL_List llListInsertList(LSL_List dest, LSL_List src, int index) 5818 public LSL_List llListInsertList(LSL_List dest, LSL_List src, int index)
@@ -6653,6 +6645,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6653 ps.BurstSpeedMax = 1.0f; 6645 ps.BurstSpeedMax = 1.0f;
6654 ps.BurstRate = 0.1f; 6646 ps.BurstRate = 0.1f;
6655 ps.PartMaxAge = 10.0f; 6647 ps.PartMaxAge = 10.0f;
6648 ps.BurstPartCount = 1;
6656 return ps; 6649 return ps;
6657 } 6650 }
6658 6651
@@ -6674,10 +6667,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6674 SetParticleSystem(m_host, rules); 6667 SetParticleSystem(m_host, rules);
6675 } 6668 }
6676 6669
6677 private void SetParticleSystem(SceneObjectPart part, LSL_List rules) 6670 private void SetParticleSystem(SceneObjectPart part, LSL_List rules)
6678 { 6671 {
6679
6680
6681 if (rules.Length == 0) 6672 if (rules.Length == 0)
6682 { 6673 {
6683 part.RemoveParticleSystem(); 6674 part.RemoveParticleSystem();
@@ -7334,6 +7325,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7334 public void llCloseRemoteDataChannel(string channel) 7325 public void llCloseRemoteDataChannel(string channel)
7335 { 7326 {
7336 m_host.AddScriptLPS(1); 7327 m_host.AddScriptLPS(1);
7328
7329 IXmlRpcRouter xmlRpcRouter = m_ScriptEngine.World.RequestModuleInterface<IXmlRpcRouter>();
7330 if (xmlRpcRouter != null)
7331 {
7332 xmlRpcRouter.UnRegisterReceiver(channel, m_item.ItemID);
7333 }
7334
7337 IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface<IXMLRPC>(); 7335 IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface<IXMLRPC>();
7338 xmlrpcMod.CloseXMLRPCChannel((UUID)channel); 7336 xmlrpcMod.CloseXMLRPCChannel((UUID)channel);
7339 ScriptSleep(1000); 7337 ScriptSleep(1000);
@@ -13215,7 +13213,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
13215 /// Get a notecard line. 13213 /// Get a notecard line.
13216 /// </summary> 13214 /// </summary>
13217 /// <param name="assetID"></param> 13215 /// <param name="assetID"></param>
13218 /// <param name="line">Lines start at index 0</param> 13216 /// <param name="lineNumber">Lines start at index 0</param>
13219 /// <returns></returns> 13217 /// <returns></returns>
13220 public static string GetLine(UUID assetID, int lineNumber) 13218 public static string GetLine(UUID assetID, int lineNumber)
13221 { 13219 {
@@ -13244,9 +13242,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
13244 /// Get a notecard line. 13242 /// Get a notecard line.
13245 /// </summary> 13243 /// </summary>
13246 /// <param name="assetID"></param> 13244 /// <param name="assetID"></param>
13247 /// <param name="line">Lines start at index 0</param> 13245 /// <param name="lineNumber">Lines start at index 0</param>
13248 /// <param name="maxLength">Maximum length of the returned line. Longer lines will be truncated</para> 13246 /// <param name="maxLength">
13249 /// <returns></returns> 13247 /// Maximum length of the returned line.
13248 /// </param>
13249 /// <returns>
13250 /// If the line length is longer than <paramref name="maxLength"/>,
13251 /// the return string will be truncated.
13252 /// </returns>
13250 public static string GetLine(UUID assetID, int lineNumber, int maxLength) 13253 public static string GetLine(UUID assetID, int lineNumber, int maxLength)
13251 { 13254 {
13252 string line = GetLine(assetID, lineNumber); 13255 string line = GetLine(assetID, lineNumber);
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
index 51c8c7e..637d83a 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -1214,12 +1214,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1214 sunHour += 24.0; 1214 sunHour += 24.0;
1215 1215
1216 World.RegionInfo.RegionSettings.UseEstateSun = useEstateSun; 1216 World.RegionInfo.RegionSettings.UseEstateSun = useEstateSun;
1217 World.RegionInfo.RegionSettings.SunPosition = sunHour + 6; // LL Region Sun Hour is 6 to 30 1217 World.RegionInfo.RegionSettings.SunPosition = sunHour + 6; // LL Region Sun Hour is 6 to 30
1218 World.RegionInfo.RegionSettings.FixedSun = sunFixed; 1218 World.RegionInfo.RegionSettings.FixedSun = sunFixed;
1219 World.RegionInfo.RegionSettings.Save(); 1219 World.RegionInfo.RegionSettings.Save();
1220 1220
1221 World.EventManager.TriggerEstateToolsSunUpdate( 1221 World.EventManager.TriggerEstateToolsSunUpdate(World.RegionInfo.RegionHandle);
1222 World.RegionInfo.RegionHandle, sunFixed, useEstateSun, (float)sunHour);
1223 } 1222 }
1224 1223
1225 /// <summary> 1224 /// <summary>
@@ -1244,8 +1243,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1244 World.RegionInfo.EstateSettings.FixedSun = sunFixed; 1243 World.RegionInfo.EstateSettings.FixedSun = sunFixed;
1245 World.RegionInfo.EstateSettings.Save(); 1244 World.RegionInfo.EstateSettings.Save();
1246 1245
1247 World.EventManager.TriggerEstateToolsSunUpdate( 1246 World.EventManager.TriggerEstateToolsSunUpdate(World.RegionInfo.RegionHandle);
1248 World.RegionInfo.RegionHandle, sunFixed, World.RegionInfo.RegionSettings.UseEstateSun, (float)sunHour);
1249 } 1247 }
1250 1248
1251 /// <summary> 1249 /// <summary>