diff options
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 118 |
1 files changed, 59 insertions, 59 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 5269bf9..8f9ff03 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -100,7 +100,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
100 | 100 | ||
101 | protected IScriptEngine m_ScriptEngine; | 101 | protected IScriptEngine m_ScriptEngine; |
102 | protected SceneObjectPart m_host; | 102 | protected SceneObjectPart m_host; |
103 | 103 | ||
104 | /// <summary> | 104 | /// <summary> |
105 | /// The item that hosts this script | 105 | /// The item that hosts this script |
106 | /// </summary> | 106 | /// </summary> |
@@ -298,7 +298,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
298 | m_host = host; | 298 | m_host = host; |
299 | m_item = item; | 299 | m_item = item; |
300 | m_debuggerSafe = m_ScriptEngine.Config.GetBoolean("DebuggerSafe", false); | 300 | m_debuggerSafe = m_ScriptEngine.Config.GetBoolean("DebuggerSafe", false); |
301 | 301 | ||
302 | LoadConfig(); | 302 | LoadConfig(); |
303 | 303 | ||
304 | m_TransferModule = | 304 | m_TransferModule = |
@@ -400,7 +400,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
400 | } | 400 | } |
401 | 401 | ||
402 | IConfig smtpConfig = seConfigSource.Configs["SMTP"]; | 402 | IConfig smtpConfig = seConfigSource.Configs["SMTP"]; |
403 | if (smtpConfig != null) | 403 | if (smtpConfig != null) |
404 | { | 404 | { |
405 | // there's an smtp config, so load in the snooze time. | 405 | // there's an smtp config, so load in the snooze time. |
406 | EMAIL_PAUSE_TIME = smtpConfig.GetInt("email_pause_time", EMAIL_PAUSE_TIME); | 406 | EMAIL_PAUSE_TIME = smtpConfig.GetInt("email_pause_time", EMAIL_PAUSE_TIME); |
@@ -666,7 +666,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
666 | case ScriptBaseClass.LINK_SET: | 666 | case ScriptBaseClass.LINK_SET: |
667 | return new List<SceneObjectPart>(part.ParentGroup.Parts); | 667 | return new List<SceneObjectPart>(part.ParentGroup.Parts); |
668 | 668 | ||
669 | case ScriptBaseClass.LINK_ROOT: | 669 | case ScriptBaseClass.LINK_ROOT: |
670 | ret.Add(part.ParentGroup.RootPart); | 670 | ret.Add(part.ParentGroup.RootPart); |
671 | return ret; | 671 | return ret; |
672 | 672 | ||
@@ -807,8 +807,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
807 | m_host.AddScriptLPS(1); | 807 | m_host.AddScriptLPS(1); |
808 | lock (Util.RandomClass) | 808 | lock (Util.RandomClass) |
809 | { | 809 | { |
810 | return Util.RandomClass.NextDouble() * mag; | 810 | return Util.RandomClass.NextDouble() * mag; |
811 | } | 811 | } |
812 | } | 812 | } |
813 | 813 | ||
814 | public LSL_Integer llFloor(double f) | 814 | public LSL_Integer llFloor(double f) |
@@ -1097,7 +1097,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1097 | m_host.AddScriptLPS(1); | 1097 | m_host.AddScriptLPS(1); |
1098 | /* This method is more accurate than the SL one, and thus causes problems | 1098 | /* This method is more accurate than the SL one, and thus causes problems |
1099 | for scripts that deal with the SL inaccuracy around 180-degrees -.- .._. | 1099 | for scripts that deal with the SL inaccuracy around 180-degrees -.- .._. |
1100 | 1100 | ||
1101 | double dotProduct = LSL_Vector.Dot(a, b); | 1101 | double dotProduct = LSL_Vector.Dot(a, b); |
1102 | LSL_Vector crossProduct = LSL_Vector.Cross(a, b); | 1102 | LSL_Vector crossProduct = LSL_Vector.Cross(a, b); |
1103 | double magProduct = LSL_Vector.Mag(a) * LSL_Vector.Mag(b); | 1103 | double magProduct = LSL_Vector.Mag(a) * LSL_Vector.Mag(b); |
@@ -1115,12 +1115,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1115 | 1115 | ||
1116 | return new LSL_Rotation((float)x, (float)y, (float)z, (float)w); | 1116 | return new LSL_Rotation((float)x, (float)y, (float)z, (float)w); |
1117 | */ | 1117 | */ |
1118 | 1118 | ||
1119 | // This method mimics the 180 errors found in SL | 1119 | // This method mimics the 180 errors found in SL |
1120 | // See www.euclideanspace.com... angleBetween | 1120 | // See www.euclideanspace.com... angleBetween |
1121 | LSL_Vector vec_a = a; | 1121 | LSL_Vector vec_a = a; |
1122 | LSL_Vector vec_b = b; | 1122 | LSL_Vector vec_b = b; |
1123 | 1123 | ||
1124 | // Eliminate zero length | 1124 | // Eliminate zero length |
1125 | LSL_Float vec_a_mag = LSL_Vector.Mag(vec_a); | 1125 | LSL_Float vec_a_mag = LSL_Vector.Mag(vec_a); |
1126 | LSL_Float vec_b_mag = LSL_Vector.Mag(vec_b); | 1126 | LSL_Float vec_b_mag = LSL_Vector.Mag(vec_b); |
@@ -1129,7 +1129,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1129 | { | 1129 | { |
1130 | return new LSL_Rotation(0.0f, 0.0f, 0.0f, 1.0f); | 1130 | return new LSL_Rotation(0.0f, 0.0f, 0.0f, 1.0f); |
1131 | } | 1131 | } |
1132 | 1132 | ||
1133 | // Normalize | 1133 | // Normalize |
1134 | vec_a = llVecNorm(vec_a); | 1134 | vec_a = llVecNorm(vec_a); |
1135 | vec_b = llVecNorm(vec_b); | 1135 | vec_b = llVecNorm(vec_b); |
@@ -1137,13 +1137,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1137 | // Calculate axis and rotation angle | 1137 | // Calculate axis and rotation angle |
1138 | LSL_Vector axis = vec_a % vec_b; | 1138 | LSL_Vector axis = vec_a % vec_b; |
1139 | LSL_Float cos_theta = vec_a * vec_b; | 1139 | LSL_Float cos_theta = vec_a * vec_b; |
1140 | 1140 | ||
1141 | // Check if parallel | 1141 | // Check if parallel |
1142 | if (cos_theta > 0.99999) | 1142 | if (cos_theta > 0.99999) |
1143 | { | 1143 | { |
1144 | return new LSL_Rotation(0.0f, 0.0f, 0.0f, 1.0f); | 1144 | return new LSL_Rotation(0.0f, 0.0f, 0.0f, 1.0f); |
1145 | } | 1145 | } |
1146 | 1146 | ||
1147 | // Check if anti-parallel | 1147 | // Check if anti-parallel |
1148 | else if (cos_theta < -0.99999) | 1148 | else if (cos_theta < -0.99999) |
1149 | { | 1149 | { |
@@ -1164,7 +1164,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1164 | return new LSL_Rotation(x,y,z,s); | 1164 | return new LSL_Rotation(x,y,z,s); |
1165 | } | 1165 | } |
1166 | } | 1166 | } |
1167 | 1167 | ||
1168 | public void llWhisper(int channelID, string text) | 1168 | public void llWhisper(int channelID, string text) |
1169 | { | 1169 | { |
1170 | m_host.AddScriptLPS(1); | 1170 | m_host.AddScriptLPS(1); |
@@ -1261,7 +1261,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1261 | { | 1261 | { |
1262 | World.SimChat(Utils.StringToBytes(text), | 1262 | World.SimChat(Utils.StringToBytes(text), |
1263 | ChatTypeEnum.Shout, channelID, m_host.ParentGroup.RootPart.AbsolutePosition, m_host.Name, m_host.UUID, true); | 1263 | ChatTypeEnum.Shout, channelID, m_host.ParentGroup.RootPart.AbsolutePosition, m_host.Name, m_host.UUID, true); |
1264 | 1264 | ||
1265 | } | 1265 | } |
1266 | 1266 | ||
1267 | IWorldComm wComm = m_ScriptEngine.World.RequestModuleInterface<IWorldComm>(); | 1267 | IWorldComm wComm = m_ScriptEngine.World.RequestModuleInterface<IWorldComm>(); |
@@ -1830,7 +1830,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1830 | { | 1830 | { |
1831 | m_host.AddScriptLPS(1); | 1831 | m_host.AddScriptLPS(1); |
1832 | SceneObjectGroup group = m_host.ParentGroup; | 1832 | SceneObjectGroup group = m_host.ParentGroup; |
1833 | 1833 | ||
1834 | if (group == null || group.IsDeleted || group.inTransit) | 1834 | if (group == null || group.IsDeleted || group.inTransit) |
1835 | return 1.0f; | 1835 | return 1.0f; |
1836 | 1836 | ||
@@ -1841,7 +1841,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1841 | { | 1841 | { |
1842 | m_host.AddScriptLPS(1); | 1842 | m_host.AddScriptLPS(1); |
1843 | SceneObjectGroup group = m_host.ParentGroup; | 1843 | SceneObjectGroup group = m_host.ParentGroup; |
1844 | 1844 | ||
1845 | if (group == null || group.IsDeleted || group.inTransit) | 1845 | if (group == null || group.IsDeleted || group.inTransit) |
1846 | return 1.0f; | 1846 | return 1.0f; |
1847 | 1847 | ||
@@ -1970,7 +1970,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1970 | string userAgent = m_UrlModule.GetHttpHeader(new UUID(id), "user-agent"); | 1970 | string userAgent = m_UrlModule.GetHttpHeader(new UUID(id), "user-agent"); |
1971 | if (userAgent.IndexOf("SecondLife") < 0) | 1971 | if (userAgent.IndexOf("SecondLife") < 0) |
1972 | return; // Not the embedded browser. Is this check good enough? | 1972 | return; // Not the embedded browser. Is this check good enough? |
1973 | 1973 | ||
1974 | // Use the IP address of the client and check against the request | 1974 | // Use the IP address of the client and check against the request |
1975 | // seperate logins from the same IP will allow all of them to get non-text/plain as long | 1975 | // seperate logins from the same IP will allow all of them to get non-text/plain as long |
1976 | // as the owner is in the region. Same as SL! | 1976 | // as the owner is in the region. Same as SL! |
@@ -2030,7 +2030,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2030 | m_UrlModule.HttpContentType(new UUID(id),type); | 2030 | m_UrlModule.HttpContentType(new UUID(id),type); |
2031 | } | 2031 | } |
2032 | } | 2032 | } |
2033 | */ | 2033 | */ |
2034 | public void SetTexGen(SceneObjectPart part, int face,int style) | 2034 | public void SetTexGen(SceneObjectPart part, int face,int style) |
2035 | { | 2035 | { |
2036 | if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted) | 2036 | if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted) |
@@ -2774,7 +2774,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2774 | public void llSetRot(LSL_Rotation rot) | 2774 | public void llSetRot(LSL_Rotation rot) |
2775 | { | 2775 | { |
2776 | m_host.AddScriptLPS(1); | 2776 | m_host.AddScriptLPS(1); |
2777 | 2777 | ||
2778 | // try to let this work as in SL... | 2778 | // try to let this work as in SL... |
2779 | if (m_host.ParentID == 0 || (m_host.ParentGroup != null && m_host == m_host.ParentGroup.RootPart)) | 2779 | if (m_host.ParentID == 0 || (m_host.ParentGroup != null && m_host == m_host.ParentGroup.RootPart)) |
2780 | { | 2780 | { |
@@ -2960,7 +2960,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2960 | m_host.AddScriptLPS(1); | 2960 | m_host.AddScriptLPS(1); |
2961 | m_host.SetVelocity(new Vector3((float)vel.x, (float)vel.y, (float)vel.z), local != 0); | 2961 | m_host.SetVelocity(new Vector3((float)vel.x, (float)vel.y, (float)vel.z), local != 0); |
2962 | } | 2962 | } |
2963 | 2963 | ||
2964 | public void llSetAngularVelocity(LSL_Vector avel, int local) | 2964 | public void llSetAngularVelocity(LSL_Vector avel, int local) |
2965 | { | 2965 | { |
2966 | m_host.AddScriptLPS(1); | 2966 | m_host.AddScriptLPS(1); |
@@ -3129,7 +3129,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3129 | { | 3129 | { |
3130 | m_SoundModule.SendSound( | 3130 | m_SoundModule.SendSound( |
3131 | m_host.UUID, | 3131 | m_host.UUID, |
3132 | ScriptUtils.GetAssetIdFromKeyOrItemName(m_host, sound, AssetType.Sound), | 3132 | ScriptUtils.GetAssetIdFromKeyOrItemName(m_host, sound, AssetType.Sound), |
3133 | volume, false, 0, | 3133 | volume, false, 0, |
3134 | 0, false, false); | 3134 | 0, false, false); |
3135 | } | 3135 | } |
@@ -3602,7 +3602,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3602 | // LSL_Vector up = new LSL_Vector(0.0, 0.0, 1.0); | 3602 | // LSL_Vector up = new LSL_Vector(0.0, 0.0, 1.0); |
3603 | // find normalized left axis parallel to horizon | 3603 | // find normalized left axis parallel to horizon |
3604 | // LSL_Vector left = llVecNorm(LSL_Vector.Cross(up, dir)); | 3604 | // LSL_Vector left = llVecNorm(LSL_Vector.Cross(up, dir)); |
3605 | 3605 | ||
3606 | LSL_Vector left = new LSL_Vector(-dir.y, dir.x, 0.0f); | 3606 | LSL_Vector left = new LSL_Vector(-dir.y, dir.x, 0.0f); |
3607 | left = llVecNorm(left); | 3607 | left = llVecNorm(left); |
3608 | // make up orthogonal to left and dir | 3608 | // make up orthogonal to left and dir |
@@ -3851,7 +3851,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3851 | ScriptSleep(2000); | 3851 | ScriptSleep(2000); |
3852 | return; | 3852 | return; |
3853 | } | 3853 | } |
3854 | 3854 | ||
3855 | // We may be able to use ClientView.SendInstantMessage here, but we need a client instance. | 3855 | // We may be able to use ClientView.SendInstantMessage here, but we need a client instance. |
3856 | // InstantMessageModule.OnInstantMessage searches through a list of scenes for a client matching the toAgent, | 3856 | // InstantMessageModule.OnInstantMessage searches through a list of scenes for a client matching the toAgent, |
3857 | // but I don't think we have a list of scenes available from here. | 3857 | // but I don't think we have a list of scenes available from here. |
@@ -3864,7 +3864,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3864 | UUID friendTransactionID = UUID.Random(); | 3864 | UUID friendTransactionID = UUID.Random(); |
3865 | 3865 | ||
3866 | //m_pendingFriendRequests.Add(friendTransactionID, fromAgentID); | 3866 | //m_pendingFriendRequests.Add(friendTransactionID, fromAgentID); |
3867 | 3867 | ||
3868 | GridInstantMessage msg = new GridInstantMessage(); | 3868 | GridInstantMessage msg = new GridInstantMessage(); |
3869 | msg.fromAgentID = new Guid(m_host.OwnerID.ToString()); // fromAgentID.Guid; | 3869 | msg.fromAgentID = new Guid(m_host.OwnerID.ToString()); // fromAgentID.Guid; |
3870 | msg.toAgentID = new Guid(user); // toAgentID.Guid; | 3870 | msg.toAgentID = new Guid(user); // toAgentID.Guid; |
@@ -4217,7 +4217,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
4217 | } | 4217 | } |
4218 | 4218 | ||
4219 | ScenePresence presence = World.GetScenePresence(agentID); | 4219 | ScenePresence presence = World.GetScenePresence(agentID); |
4220 | 4220 | ||
4221 | if (presence != null) | 4221 | if (presence != null) |
4222 | { | 4222 | { |
4223 | // If permissions are being requested from an NPC and were not implicitly granted above then | 4223 | // If permissions are being requested from an NPC and were not implicitly granted above then |
@@ -4285,7 +4285,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
4285 | m_host.TaskInventory.LockItemsForWrite(true); | 4285 | m_host.TaskInventory.LockItemsForWrite(true); |
4286 | m_host.TaskInventory[m_item.ItemID].PermsMask = answer; | 4286 | m_host.TaskInventory[m_item.ItemID].PermsMask = answer; |
4287 | m_host.TaskInventory.LockItemsForWrite(false); | 4287 | m_host.TaskInventory.LockItemsForWrite(false); |
4288 | 4288 | ||
4289 | m_ScriptEngine.PostScriptEvent(m_item.ItemID, new EventParams( | 4289 | m_ScriptEngine.PostScriptEvent(m_item.ItemID, new EventParams( |
4290 | "run_time_permissions", new Object[] { | 4290 | "run_time_permissions", new Object[] { |
4291 | new LSL_Integer(answer) }, | 4291 | new LSL_Integer(answer) }, |
@@ -4363,7 +4363,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
4363 | UUID targetID; | 4363 | UUID targetID; |
4364 | 4364 | ||
4365 | if (!UUID.TryParse(target, out targetID)) | 4365 | if (!UUID.TryParse(target, out targetID)) |
4366 | return; | 4366 | return; |
4367 | 4367 | ||
4368 | SceneObjectPart targetPart = World.GetSceneObjectPart((UUID)targetID); | 4368 | SceneObjectPart targetPart = World.GetSceneObjectPart((UUID)targetID); |
4369 | if (targetPart == null) | 4369 | if (targetPart == null) |
@@ -4493,7 +4493,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
4493 | } | 4493 | } |
4494 | } | 4494 | } |
4495 | finally { } | 4495 | finally { } |
4496 | 4496 | ||
4497 | newRoot.ParentGroup.HasGroupChanged = true; | 4497 | newRoot.ParentGroup.HasGroupChanged = true; |
4498 | newRoot.ParentGroup.ScheduleGroupForFullUpdate(); | 4498 | newRoot.ParentGroup.ScheduleGroupForFullUpdate(); |
4499 | } | 4499 | } |
@@ -4515,7 +4515,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
4515 | m_host.AddScriptLPS(1); | 4515 | m_host.AddScriptLPS(1); |
4516 | 4516 | ||
4517 | TaskInventoryItem item = m_item; | 4517 | TaskInventoryItem item = m_item; |
4518 | 4518 | ||
4519 | if ((item.PermsMask & ScriptBaseClass.PERMISSION_CHANGE_LINKS) == 0 | 4519 | if ((item.PermsMask & ScriptBaseClass.PERMISSION_CHANGE_LINKS) == 0 |
4520 | && !m_automaticLinkPermission) | 4520 | && !m_automaticLinkPermission) |
4521 | { | 4521 | { |
@@ -4634,7 +4634,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
4634 | count = count + 1; | 4634 | count = count + 1; |
4635 | } | 4635 | } |
4636 | } | 4636 | } |
4637 | 4637 | ||
4638 | m_host.TaskInventory.LockItemsForRead(false); | 4638 | m_host.TaskInventory.LockItemsForRead(false); |
4639 | return count; | 4639 | return count; |
4640 | } | 4640 | } |
@@ -4729,7 +4729,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
4729 | 4729 | ||
4730 | if (agentItem == null) | 4730 | if (agentItem == null) |
4731 | { | 4731 | { |
4732 | llSay(0, message); | 4732 | llSay(0, message); |
4733 | return; | 4733 | return; |
4734 | } | 4734 | } |
4735 | 4735 | ||
@@ -4758,7 +4758,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
4758 | if (m_TransferModule != null) | 4758 | if (m_TransferModule != null) |
4759 | m_TransferModule.SendInstantMessage(msg, delegate(bool success) {}); | 4759 | m_TransferModule.SendInstantMessage(msg, delegate(bool success) {}); |
4760 | } | 4760 | } |
4761 | 4761 | ||
4762 | //This delay should only occur when giving inventory to avatars. | 4762 | //This delay should only occur when giving inventory to avatars. |
4763 | ScriptSleep(m_sleepMsOnGiveInventory); | 4763 | ScriptSleep(m_sleepMsOnGiveInventory); |
4764 | } | 4764 | } |
@@ -5064,7 +5064,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
5064 | // Can't TP sitting avatars | 5064 | // Can't TP sitting avatars |
5065 | if (presence.ParentID != 0) // Sitting | 5065 | if (presence.ParentID != 0) // Sitting |
5066 | return; | 5066 | return; |
5067 | 5067 | ||
5068 | if (m_item.PermsGranter == agentId) | 5068 | if (m_item.PermsGranter == agentId) |
5069 | { | 5069 | { |
5070 | // If attached using llAttachToAvatarTemp, cowardly refuse | 5070 | // If attached using llAttachToAvatarTemp, cowardly refuse |
@@ -5190,7 +5190,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
5190 | 5190 | ||
5191 | string movementAnimation = presence.Animator.CurrentMovementAnimation; | 5191 | string movementAnimation = presence.Animator.CurrentMovementAnimation; |
5192 | string lslMovementAnimation; | 5192 | string lslMovementAnimation; |
5193 | 5193 | ||
5194 | if (MovementAnimationsForLSL.TryGetValue(movementAnimation, out lslMovementAnimation)) | 5194 | if (MovementAnimationsForLSL.TryGetValue(movementAnimation, out lslMovementAnimation)) |
5195 | return lslMovementAnimation; | 5195 | return lslMovementAnimation; |
5196 | } | 5196 | } |
@@ -5531,7 +5531,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
5531 | rot.Normalize(); | 5531 | rot.Normalize(); |
5532 | 5532 | ||
5533 | double angle = 2 * Math.Acos(rot.s); | 5533 | double angle = 2 * Math.Acos(rot.s); |
5534 | if (angle > Math.PI) | 5534 | if (angle > Math.PI) |
5535 | angle = 2 * Math.PI - angle; | 5535 | angle = 2 * Math.PI - angle; |
5536 | 5536 | ||
5537 | return angle; | 5537 | return angle; |
@@ -6916,10 +6916,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
6916 | SceneObjectPart part = World.GetSceneObjectPart(uuid); | 6916 | SceneObjectPart part = World.GetSceneObjectPart(uuid); |
6917 | if (part != null) | 6917 | if (part != null) |
6918 | { | 6918 | { |
6919 | 6919 | ||
6920 | if(part.ParentGroup.IsAttachment) | 6920 | if(part.ParentGroup.IsAttachment) |
6921 | { | 6921 | { |
6922 | uuid = part.ParentGroup.AttachedAvatar; | 6922 | uuid = part.ParentGroup.AttachedAvatar; |
6923 | } | 6923 | } |
6924 | else | 6924 | else |
6925 | { | 6925 | { |
@@ -10266,7 +10266,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
10266 | } | 10266 | } |
10267 | break; | 10267 | break; |
10268 | 10268 | ||
10269 | case ScriptBaseClass.PRIM_ROTATION: | 10269 | case ScriptBaseClass.PRIM_ROTATION: |
10270 | if (remain < 1) | 10270 | if (remain < 1) |
10271 | return new LSL_List(); | 10271 | return new LSL_List(); |
10272 | 10272 | ||
@@ -10329,7 +10329,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
10329 | catch (InvalidCastException e) | 10329 | catch (InvalidCastException e) |
10330 | { | 10330 | { |
10331 | Error( | 10331 | Error( |
10332 | originFunc, | 10332 | originFunc, |
10333 | string.Format("Error running rule #{0}: arg #{1} - ", rulesParsed, idx - idxStart) + e.Message); | 10333 | string.Format("Error running rule #{0}: arg #{1} - ", rulesParsed, idx - idxStart) + e.Message); |
10334 | } | 10334 | } |
10335 | 10335 | ||
@@ -10433,7 +10433,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
10433 | } | 10433 | } |
10434 | while (str2.EndsWith("=")) | 10434 | while (str2.EndsWith("=")) |
10435 | str2 = str2.Substring(0, str2.Length - 1); | 10435 | str2 = str2.Substring(0, str2.Length - 1); |
10436 | 10436 | ||
10437 | byte[] d1 = new byte[str1.Length]; | 10437 | byte[] d1 = new byte[str1.Length]; |
10438 | byte[] d2 = new byte[str2.Length]; | 10438 | byte[] d2 = new byte[str2.Length]; |
10439 | 10439 | ||
@@ -10638,7 +10638,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
10638 | 10638 | ||
10639 | Vector3 box = presence.Appearance.AvatarBoxSize * 0.5f; | 10639 | Vector3 box = presence.Appearance.AvatarBoxSize * 0.5f; |
10640 | 10640 | ||
10641 | if (presence.Animator.Animations.ImplicitDefaultAnimation.AnimID | 10641 | if (presence.Animator.Animations.ImplicitDefaultAnimation.AnimID |
10642 | == DefaultAvatarAnimations.AnimsUUID["SIT_GROUND_CONSTRAINED"]) | 10642 | == DefaultAvatarAnimations.AnimsUUID["SIT_GROUND_CONSTRAINED"]) |
10643 | /* | 10643 | /* |
10644 | { | 10644 | { |
@@ -10803,7 +10803,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
10803 | 10803 | ||
10804 | List<SceneObjectPart> parts; | 10804 | List<SceneObjectPart> parts; |
10805 | List<ScenePresence> avatars; | 10805 | List<ScenePresence> avatars; |
10806 | 10806 | ||
10807 | LSL_List res = new LSL_List(); | 10807 | LSL_List res = new LSL_List(); |
10808 | LSL_List remaining = new LSL_List(); | 10808 | LSL_List remaining = new LSL_List(); |
10809 | 10809 | ||
@@ -12887,7 +12887,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
12887 | return; | 12887 | return; |
12888 | } | 12888 | } |
12889 | } | 12889 | } |
12890 | 12890 | ||
12891 | ScenePresence avatar = World.GetScenePresence(detectedParams.Key); | 12891 | ScenePresence avatar = World.GetScenePresence(detectedParams.Key); |
12892 | if (avatar != null) | 12892 | if (avatar != null) |
12893 | { | 12893 | { |
@@ -13239,7 +13239,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
13239 | 13239 | ||
13240 | byte[] d2 = new Byte[data1.Length]; | 13240 | byte[] d2 = new Byte[data1.Length]; |
13241 | int pos = 0; | 13241 | int pos = 0; |
13242 | 13242 | ||
13243 | if (data1.Length <= data2.Length) | 13243 | if (data1.Length <= data2.Length) |
13244 | { | 13244 | { |
13245 | Array.Copy(data2, 0, d2, 0, data1.Length); | 13245 | Array.Copy(data2, 0, d2, 0, data1.Length); |
@@ -13636,7 +13636,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
13636 | 13636 | ||
13637 | LSL_List ret = new LSL_List(); | 13637 | LSL_List ret = new LSL_List(); |
13638 | UUID key = new UUID(); | 13638 | UUID key = new UUID(); |
13639 | 13639 | ||
13640 | 13640 | ||
13641 | if (UUID.TryParse(id, out key)) | 13641 | if (UUID.TryParse(id, out key)) |
13642 | { | 13642 | { |
@@ -13824,7 +13824,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
13824 | case ScriptBaseClass.OBJECT_NAME: | 13824 | case ScriptBaseClass.OBJECT_NAME: |
13825 | ret.Add(new LSL_String(obj.Name)); | 13825 | ret.Add(new LSL_String(obj.Name)); |
13826 | break; | 13826 | break; |
13827 | case ScriptBaseClass.OBJECT_DESC: | 13827 | case ScriptBaseClass.OBJECT_DESC: |
13828 | ret.Add(new LSL_String(obj.Description)); | 13828 | ret.Add(new LSL_String(obj.Description)); |
13829 | break; | 13829 | break; |
13830 | case ScriptBaseClass.OBJECT_POS: | 13830 | case ScriptBaseClass.OBJECT_POS: |
@@ -13865,7 +13865,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
13865 | } | 13865 | } |
13866 | else | 13866 | else |
13867 | { | 13867 | { |
13868 | vel = obj.Velocity; | 13868 | vel = obj.Velocity; |
13869 | } | 13869 | } |
13870 | 13870 | ||
13871 | ret.Add(vel); | 13871 | ret.Add(vel); |
@@ -14263,8 +14263,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
14263 | ossl.CheckThreatLevel(ThreatLevel.High, "print"); | 14263 | ossl.CheckThreatLevel(ThreatLevel.High, "print"); |
14264 | m_log.Info("LSL print():" + str); | 14264 | m_log.Info("LSL print():" + str); |
14265 | } | 14265 | } |
14266 | } | 14266 | } |
14267 | 14267 | ||
14268 | public LSL_Integer llGetLinkNumberOfSides(LSL_Integer link) | 14268 | public LSL_Integer llGetLinkNumberOfSides(LSL_Integer link) |
14269 | { | 14269 | { |
14270 | List<SceneObjectPart> parts = GetLinkParts(link); | 14270 | List<SceneObjectPart> parts = GetLinkParts(link); |
@@ -14488,7 +14488,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
14488 | { | 14488 | { |
14489 | // get work copies | 14489 | // get work copies |
14490 | float sx = rayStart.X; | 14490 | float sx = rayStart.X; |
14491 | float ex = rayEnd.X; | 14491 | float ex = rayEnd.X; |
14492 | float sy = rayStart.Y; | 14492 | float sy = rayStart.Y; |
14493 | float ey = rayEnd.Y; | 14493 | float ey = rayEnd.Y; |
14494 | 14494 | ||
@@ -14497,7 +14497,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
14497 | 14497 | ||
14498 | // region size info | 14498 | // region size info |
14499 | float rsx = World.RegionInfo.RegionSizeX; | 14499 | float rsx = World.RegionInfo.RegionSizeX; |
14500 | 14500 | ||
14501 | float tmp; | 14501 | float tmp; |
14502 | 14502 | ||
14503 | // region bounds | 14503 | // region bounds |
@@ -14513,7 +14513,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
14513 | sy += dy * dx; | 14513 | sy += dy * dx; |
14514 | sx = 0; | 14514 | sx = 0; |
14515 | } | 14515 | } |
14516 | else if(sx >= rsx) | 14516 | else if(sx >= rsx) |
14517 | { | 14517 | { |
14518 | if(ex >= rsx) // totally outside | 14518 | if(ex >= rsx) // totally outside |
14519 | return null; | 14519 | return null; |
@@ -14537,7 +14537,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
14537 | sx += dy * dx; | 14537 | sx += dy * dx; |
14538 | sy = 0; | 14538 | sy = 0; |
14539 | } | 14539 | } |
14540 | else if(sy >= rsy) | 14540 | else if(sy >= rsy) |
14541 | { | 14541 | { |
14542 | if(dy >= 0) // out and going away | 14542 | if(dy >= 0) // out and going away |
14543 | return null; | 14543 | return null; |
@@ -14875,7 +14875,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
14875 | { | 14875 | { |
14876 | return a.Depth.CompareTo(b.Depth); | 14876 | return a.Depth.CompareTo(b.Depth); |
14877 | }); | 14877 | }); |
14878 | 14878 | ||
14879 | int values = 0; | 14879 | int values = 0; |
14880 | SceneObjectGroup thisgrp = m_host.ParentGroup; | 14880 | SceneObjectGroup thisgrp = m_host.ParentGroup; |
14881 | 14881 | ||
@@ -14931,7 +14931,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
14931 | list.Add(new LSL_Integer(values)); | 14931 | list.Add(new LSL_Integer(values)); |
14932 | return list; | 14932 | return list; |
14933 | } | 14933 | } |
14934 | 14934 | ||
14935 | 14935 | ||
14936 | /// <summary> | 14936 | /// <summary> |
14937 | /// Implementation of llCastRay similar to SL 2015-04-21. | 14937 | /// Implementation of llCastRay similar to SL 2015-04-21. |
@@ -15076,7 +15076,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
15076 | isNonphysical = !isPhysical; | 15076 | isNonphysical = !isPhysical; |
15077 | isPhantom = ((part.Flags & PrimFlags.Phantom) != 0) || | 15077 | isPhantom = ((part.Flags & PrimFlags.Phantom) != 0) || |
15078 | (part.VolumeDetectActive); | 15078 | (part.VolumeDetectActive); |
15079 | 15079 | ||
15080 | if (isPhysical && rejectPhysical) | 15080 | if (isPhysical && rejectPhysical) |
15081 | continue; | 15081 | continue; |
15082 | if (isNonphysical && rejectNonphysical) | 15082 | if (isNonphysical && rejectNonphysical) |
@@ -16291,7 +16291,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
16291 | pos = sitroot.AbsolutePosition + pos * sitroot.GetWorldRotation(); | 16291 | pos = sitroot.AbsolutePosition + pos * sitroot.GetWorldRotation(); |
16292 | } | 16292 | } |
16293 | else | 16293 | else |
16294 | pos = avatar.AbsolutePosition; | 16294 | pos = avatar.AbsolutePosition; |
16295 | 16295 | ||
16296 | res.Add(new LSL_Vector(pos.X,pos.Y,pos.Z)); | 16296 | res.Add(new LSL_Vector(pos.X,pos.Y,pos.Z)); |
16297 | break; | 16297 | break; |
@@ -16471,7 +16471,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
16471 | res.Add(new LSL_String("")); | 16471 | res.Add(new LSL_String("")); |
16472 | break; | 16472 | break; |
16473 | 16473 | ||
16474 | case (int)ScriptBaseClass.PRIM_ROT_LOCAL: | 16474 | case (int)ScriptBaseClass.PRIM_ROT_LOCAL: |
16475 | Quaternion lrot = avatar.Rotation; | 16475 | Quaternion lrot = avatar.Rotation; |
16476 | res.Add(new LSL_Rotation(lrot.X, lrot.Y, lrot.Z, lrot.W)); | 16476 | res.Add(new LSL_Rotation(lrot.X, lrot.Y, lrot.Z, lrot.W)); |
16477 | break; | 16477 | break; |
@@ -16577,7 +16577,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
16577 | presence.SetAnimationOverride("ALL", UUID.Zero); | 16577 | presence.SetAnimationOverride("ALL", UUID.Zero); |
16578 | return; | 16578 | return; |
16579 | } | 16579 | } |
16580 | 16580 | ||
16581 | string state = String.Empty; | 16581 | string state = String.Empty; |
16582 | 16582 | ||
16583 | foreach (KeyValuePair<string, string> kvp in MovementAnimationsForLSL) | 16583 | foreach (KeyValuePair<string, string> kvp in MovementAnimationsForLSL) |