aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/Shared
diff options
context:
space:
mode:
authorMelanie2013-01-04 22:39:07 +0000
committerMelanie2013-01-04 22:39:07 +0000
commite62b14024f35121f1fd83bd6d3cd572ed9ba5897 (patch)
tree987892e6227b79eb45d48c5df0f8b9acfdf30755 /OpenSim/Region/ScriptEngine/Shared
parentMerge branch 'master' into careminster (diff)
parentSet default particle burst count to 1 instead of 0 in any set particle system... (diff)
downloadopensim-SC-e62b14024f35121f1fd83bd6d3cd572ed9ba5897.zip
opensim-SC-e62b14024f35121f1fd83bd6d3cd572ed9ba5897.tar.gz
opensim-SC-e62b14024f35121f1fd83bd6d3cd572ed9ba5897.tar.bz2
opensim-SC-e62b14024f35121f1fd83bd6d3cd572ed9ba5897.tar.xz
Merge branch 'master' into careminster
Conflicts: OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs122
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs10
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs29
3 files changed, 85 insertions, 76 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 253d193..aa389ba 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -3298,7 +3298,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3298 /// <summary> 3298 /// <summary>
3299 /// 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.
3300 /// </summary> 3300 /// </summary>
3301 /// <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>
3302 /// <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>
3303 public bool AttachToAvatar(int attachmentPoint) 3305 public bool AttachToAvatar(int attachmentPoint)
3304 { 3306 {
@@ -3729,21 +3731,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3729 } 3731 }
3730 else 3732 else
3731 { 3733 {
3732 bool sitting = false; 3734 if (m_host.ParentGroup.GetSittingAvatars().Contains(agentID))
3733 if (m_host.SitTargetAvatar == agentID)
3734 {
3735 sitting = true;
3736 }
3737 else
3738 {
3739 foreach (SceneObjectPart p in m_host.ParentGroup.Parts)
3740 {
3741 if (p.SitTargetAvatar == agentID)
3742 sitting = true;
3743 }
3744 }
3745
3746 if (sitting)
3747 { 3735 {
3748 // 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
3749 implicitPerms = ScriptBaseClass.PERMISSION_TRIGGER_ANIMATION | 3737 implicitPerms = ScriptBaseClass.PERMISSION_TRIGGER_ANIMATION |
@@ -3785,7 +3773,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3785 INPCModule npcModule = World.RequestModuleInterface<INPCModule>(); 3773 INPCModule npcModule = World.RequestModuleInterface<INPCModule>();
3786 if (npcModule != null && npcModule.IsNPC(agentID, World)) 3774 if (npcModule != null && npcModule.IsNPC(agentID, World))
3787 { 3775 {
3788 if (agentID == m_host.ParentGroup.OwnerID || npcModule.GetOwner(agentID) == m_host.ParentGroup.OwnerID) 3776 if (npcModule.CheckPermissions(agentID, m_host.OwnerID))
3789 { 3777 {
3790 lock (m_host.TaskInventory) 3778 lock (m_host.TaskInventory)
3791 { 3779 {
@@ -4160,62 +4148,56 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4160 public LSL_String llGetLinkName(int linknum) 4148 public LSL_String llGetLinkName(int linknum)
4161 { 4149 {
4162 m_host.AddScriptLPS(1); 4150 m_host.AddScriptLPS(1);
4163 // simplest case, this prims link number
4164 if (linknum == m_host.LinkNum || linknum == ScriptBaseClass.LINK_THIS)
4165 return m_host.Name;
4166 4151
4167 // parse for sitting avatare-names 4152 if (linknum < 0)
4168 List<String> nametable = new List<String>();
4169 World.ForEachRootScenePresence(delegate(ScenePresence presence)
4170 { 4153 {
4171 SceneObjectPart sitPart = presence.ParentPart; 4154 if (linknum == ScriptBaseClass.LINK_THIS)
4172 if (sitPart != null && m_host.ParentGroup.ContainsPart(sitPart.LocalId))
4173 nametable.Add(presence.ControllingClient.Name);
4174 });
4175
4176 int totalprims = m_host.ParentGroup.PrimCount + nametable.Count;
4177 if (totalprims > m_host.ParentGroup.PrimCount)
4178 {
4179 // sitting Avatar-Name with negativ linknum / SinglePrim
4180 if (linknum < 0 && m_host.ParentGroup.PrimCount == 1 && nametable.Count == 1)
4181 return nametable[0];
4182 // Prim-Name / SinglePrim Sitting Avatar
4183 if (linknum == 1 && m_host.ParentGroup.PrimCount == 1 && nametable.Count == 1)
4184 return m_host.Name; 4155 return m_host.Name;
4185 // LinkNumber > of Real PrimSet = AvatarName 4156 else
4186 if (linknum > m_host.ParentGroup.PrimCount && linknum <= totalprims) 4157 return ScriptBaseClass.NULL_KEY;
4187 return nametable[totalprims - linknum];
4188 } 4158 }
4189 4159
4190 // Single prim 4160 int actualPrimCount = m_host.ParentGroup.PrimCount;
4191 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)
4192 { 4167 {
4193 if (linknum == 0 || linknum == ScriptBaseClass.LINK_ROOT) 4168 if (actualPrimCount == 1 && sittingAvatarIds.Count == 0)
4194 return m_host.Name; 4169 return m_host.Name;
4195 else
4196 return UUID.Zero.ToString();
4197 }
4198 4170
4199 // Link set 4171 return ScriptBaseClass.NULL_KEY;
4200 SceneObjectPart part = null; 4172 }
4201 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)
4202 { 4176 {
4203 if (linknum < 0) 4177 if (sittingAvatarIds.Count > 0)
4204 part = m_host.ParentGroup.GetLinkNumPart(2); 4178 return m_host.ParentGroup.RootPart.Name;
4205 else 4179 else
4206 part = m_host.ParentGroup.GetLinkNumPart(linknum); 4180 return ScriptBaseClass.NULL_KEY;
4207 } 4181 }
4208 else // this is a child prim 4182 else if (linknum <= adjustedPrimCount)
4209 { 4183 {
4210 if (linknum < 2) 4184 if (linknum <= actualPrimCount)
4211 part = m_host.ParentGroup.GetLinkNumPart(1); 4185 {
4186 return m_host.ParentGroup.GetLinkNumPart(linknum).Name;
4187 }
4212 else 4188 else
4213 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 }
4214 } 4196 }
4215 if (part != null)
4216 return part.Name;
4217 else 4197 else
4218 return UUID.Zero.ToString(); 4198 {
4199 return ScriptBaseClass.NULL_KEY;
4200 }
4219 } 4201 }
4220 4202
4221 public LSL_Integer llGetInventoryNumber(int type) 4203 public LSL_Integer llGetInventoryNumber(int type)
@@ -5828,9 +5810,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
5828 } 5810 }
5829 5811
5830 /// <summary> 5812 /// <summary>
5831 /// Insert the list identified by <src> into the 5813 /// Insert the list identified by <paramref name="src"/> into the
5832 /// list designated by <dest> such that the first 5814 /// list designated by <paramref name="dest"/> such that the first
5833 /// new element has the index specified by <index> 5815 /// new element has the index specified by <paramref name="index"/>
5834 /// </summary> 5816 /// </summary>
5835 5817
5836 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)
@@ -6663,6 +6645,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6663 ps.BurstSpeedMax = 1.0f; 6645 ps.BurstSpeedMax = 1.0f;
6664 ps.BurstRate = 0.1f; 6646 ps.BurstRate = 0.1f;
6665 ps.PartMaxAge = 10.0f; 6647 ps.PartMaxAge = 10.0f;
6648 ps.BurstPartCount = 1;
6666 return ps; 6649 return ps;
6667 } 6650 }
6668 6651
@@ -6684,10 +6667,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6684 SetParticleSystem(m_host, rules); 6667 SetParticleSystem(m_host, rules);
6685 } 6668 }
6686 6669
6687 private void SetParticleSystem(SceneObjectPart part, LSL_List rules) 6670 private void SetParticleSystem(SceneObjectPart part, LSL_List rules)
6688 { 6671 {
6689
6690
6691 if (rules.Length == 0) 6672 if (rules.Length == 0)
6692 { 6673 {
6693 part.RemoveParticleSystem(); 6674 part.RemoveParticleSystem();
@@ -13232,7 +13213,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
13232 /// Get a notecard line. 13213 /// Get a notecard line.
13233 /// </summary> 13214 /// </summary>
13234 /// <param name="assetID"></param> 13215 /// <param name="assetID"></param>
13235 /// <param name="line">Lines start at index 0</param> 13216 /// <param name="lineNumber">Lines start at index 0</param>
13236 /// <returns></returns> 13217 /// <returns></returns>
13237 public static string GetLine(UUID assetID, int lineNumber) 13218 public static string GetLine(UUID assetID, int lineNumber)
13238 { 13219 {
@@ -13261,9 +13242,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
13261 /// Get a notecard line. 13242 /// Get a notecard line.
13262 /// </summary> 13243 /// </summary>
13263 /// <param name="assetID"></param> 13244 /// <param name="assetID"></param>
13264 /// <param name="line">Lines start at index 0</param> 13245 /// <param name="lineNumber">Lines start at index 0</param>
13265 /// <param name="maxLength">Maximum length of the returned line. Longer lines will be truncated</para> 13246 /// <param name="maxLength">
13266 /// <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>
13267 public static string GetLine(UUID assetID, int lineNumber, int maxLength) 13253 public static string GetLine(UUID assetID, int lineNumber, int maxLength)
13268 { 13254 {
13269 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>
diff --git a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs
index c9c4753..2e61fb8 100644
--- a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs
@@ -633,19 +633,44 @@ namespace OpenSim.Region.ScriptEngine.Shared
633 633
634 public LSL_Types.Vector3 GetVector3Item(int itemIndex) 634 public LSL_Types.Vector3 GetVector3Item(int itemIndex)
635 { 635 {
636 if(m_data[itemIndex] is LSL_Types.Vector3) 636 if (m_data[itemIndex] is LSL_Types.Vector3)
637 {
637 return (LSL_Types.Vector3)m_data[itemIndex]; 638 return (LSL_Types.Vector3)m_data[itemIndex];
639 }
640 else if(m_data[itemIndex] is OpenMetaverse.Vector3)
641 {
642 return new LSL_Types.Vector3(
643 (OpenMetaverse.Vector3)m_data[itemIndex]);
644 }
638 else 645 else
646 {
639 throw new InvalidCastException(string.Format( 647 throw new InvalidCastException(string.Format(
640 "{0} expected but {1} given", 648 "{0} expected but {1} given",
641 typeof(LSL_Types.Vector3).Name, 649 typeof(LSL_Types.Vector3).Name,
642 m_data[itemIndex] != null ? 650 m_data[itemIndex] != null ?
643 m_data[itemIndex].GetType().Name : "null")); 651 m_data[itemIndex].GetType().Name : "null"));
652 }
644 } 653 }
645 654
646 public LSL_Types.Quaternion GetQuaternionItem(int itemIndex) 655 public LSL_Types.Quaternion GetQuaternionItem(int itemIndex)
647 { 656 {
648 return (LSL_Types.Quaternion)m_data[itemIndex]; 657 if (m_data[itemIndex] is LSL_Types.Quaternion)
658 {
659 return (LSL_Types.Quaternion)m_data[itemIndex];
660 }
661 else if(m_data[itemIndex] is OpenMetaverse.Quaternion)
662 {
663 return new LSL_Types.Quaternion(
664 (OpenMetaverse.Quaternion)m_data[itemIndex]);
665 }
666 else
667 {
668 throw new InvalidCastException(string.Format(
669 "{0} expected but {1} given",
670 typeof(LSL_Types.Quaternion).Name,
671 m_data[itemIndex] != null ?
672 m_data[itemIndex].GetType().Name : "null"));
673 }
649 } 674 }
650 675
651 public LSL_Types.key GetKeyItem(int itemIndex) 676 public LSL_Types.key GetKeyItem(int itemIndex)