diff options
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared')
18 files changed, 273 insertions, 160 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 1e1e574..4ce2afd 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; |
@@ -3139,11 +3145,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3139 | 3145 | ||
3140 | PhysicsActor pa = new_group.RootPart.PhysActor; | 3146 | PhysicsActor pa = new_group.RootPart.PhysActor; |
3141 | 3147 | ||
3148 | //Recoil. | ||
3142 | if (pa != null && pa.IsPhysical && (Vector3)vel != Vector3.Zero) | 3149 | if (pa != null && pa.IsPhysical && (Vector3)vel != Vector3.Zero) |
3143 | { | 3150 | { |
3144 | float groupmass = new_group.GetMass(); | 3151 | float groupmass = new_group.GetMass(); |
3145 | vel *= -groupmass; | 3152 | Vector3 recoil = -vel * groupmass * m_recoilScaleFactor; |
3146 | llApplyImpulse(vel, 0); | 3153 | if (recoil != Vector3.Zero) |
3154 | { | ||
3155 | llApplyImpulse(recoil, 0); | ||
3156 | } | ||
3147 | } | 3157 | } |
3148 | // Variable script delay? (see (http://wiki.secondlife.com/wiki/LSL_Delay) | 3158 | // Variable script delay? (see (http://wiki.secondlife.com/wiki/LSL_Delay) |
3149 | return; | 3159 | return; |
@@ -3320,7 +3330,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3320 | /// <summary> | 3330 | /// <summary> |
3321 | /// Attach the object containing this script to the avatar that owns it. | 3331 | /// Attach the object containing this script to the avatar that owns it. |
3322 | /// </summary> | 3332 | /// </summary> |
3323 | /// <param name='attachment'>The attachment point (e.g. ATTACH_CHEST)</param> | 3333 | /// <param name='attachmentPoint'> |
3334 | /// The attachment point (e.g. <see cref="OpenSim.Region.ScriptEngine.Shared.ScriptBase.ScriptBaseClass.ATTACH_CHEST">ATTACH_CHEST</see>) | ||
3335 | /// </param> | ||
3324 | /// <returns>true if the attach suceeded, false if it did not</returns> | 3336 | /// <returns>true if the attach suceeded, false if it did not</returns> |
3325 | public bool AttachToAvatar(int attachmentPoint) | 3337 | public bool AttachToAvatar(int attachmentPoint) |
3326 | { | 3338 | { |
@@ -3751,21 +3763,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3751 | } | 3763 | } |
3752 | else | 3764 | else |
3753 | { | 3765 | { |
3754 | bool sitting = false; | 3766 | if (m_host.ParentGroup.GetSittingAvatars().Contains(agentID)) |
3755 | if (m_host.SitTargetAvatar == agentID) | ||
3756 | { | ||
3757 | sitting = true; | ||
3758 | } | ||
3759 | else | ||
3760 | { | ||
3761 | foreach (SceneObjectPart p in m_host.ParentGroup.Parts) | ||
3762 | { | ||
3763 | if (p.SitTargetAvatar == agentID) | ||
3764 | sitting = true; | ||
3765 | } | ||
3766 | } | ||
3767 | |||
3768 | if (sitting) | ||
3769 | { | 3767 | { |
3770 | // When agent is sitting, certain permissions are implicit if requested from sitting agent | 3768 | // When agent is sitting, certain permissions are implicit if requested from sitting agent |
3771 | implicitPerms = ScriptBaseClass.PERMISSION_TRIGGER_ANIMATION | | 3769 | implicitPerms = ScriptBaseClass.PERMISSION_TRIGGER_ANIMATION | |
@@ -3807,7 +3805,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3807 | INPCModule npcModule = World.RequestModuleInterface<INPCModule>(); | 3805 | INPCModule npcModule = World.RequestModuleInterface<INPCModule>(); |
3808 | if (npcModule != null && npcModule.IsNPC(agentID, World)) | 3806 | if (npcModule != null && npcModule.IsNPC(agentID, World)) |
3809 | { | 3807 | { |
3810 | if (agentID == m_host.ParentGroup.OwnerID || npcModule.GetOwner(agentID) == m_host.ParentGroup.OwnerID) | 3808 | if (npcModule.CheckPermissions(agentID, m_host.OwnerID)) |
3811 | { | 3809 | { |
3812 | lock (m_host.TaskInventory) | 3810 | lock (m_host.TaskInventory) |
3813 | { | 3811 | { |
@@ -4182,62 +4180,56 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
4182 | public LSL_String llGetLinkName(int linknum) | 4180 | public LSL_String llGetLinkName(int linknum) |
4183 | { | 4181 | { |
4184 | m_host.AddScriptLPS(1); | 4182 | m_host.AddScriptLPS(1); |
4185 | // simplest case, this prims link number | ||
4186 | if (linknum == m_host.LinkNum || linknum == ScriptBaseClass.LINK_THIS) | ||
4187 | return m_host.Name; | ||
4188 | 4183 | ||
4189 | // parse for sitting avatare-names | 4184 | if (linknum < 0) |
4190 | List<String> nametable = new List<String>(); | ||
4191 | World.ForEachRootScenePresence(delegate(ScenePresence presence) | ||
4192 | { | 4185 | { |
4193 | SceneObjectPart sitPart = presence.ParentPart; | 4186 | if (linknum == ScriptBaseClass.LINK_THIS) |
4194 | if (sitPart != null && m_host.ParentGroup.ContainsPart(sitPart.LocalId)) | ||
4195 | nametable.Add(presence.ControllingClient.Name); | ||
4196 | }); | ||
4197 | |||
4198 | int totalprims = m_host.ParentGroup.PrimCount + nametable.Count; | ||
4199 | if (totalprims > m_host.ParentGroup.PrimCount) | ||
4200 | { | ||
4201 | // sitting Avatar-Name with negativ linknum / SinglePrim | ||
4202 | if (linknum < 0 && m_host.ParentGroup.PrimCount == 1 && nametable.Count == 1) | ||
4203 | return nametable[0]; | ||
4204 | // Prim-Name / SinglePrim Sitting Avatar | ||
4205 | if (linknum == 1 && m_host.ParentGroup.PrimCount == 1 && nametable.Count == 1) | ||
4206 | return m_host.Name; | 4187 | return m_host.Name; |
4207 | // LinkNumber > of Real PrimSet = AvatarName | 4188 | else |
4208 | if (linknum > m_host.ParentGroup.PrimCount && linknum <= totalprims) | 4189 | return ScriptBaseClass.NULL_KEY; |
4209 | return nametable[totalprims - linknum]; | ||
4210 | } | 4190 | } |
4211 | 4191 | ||
4212 | // Single prim | 4192 | int actualPrimCount = m_host.ParentGroup.PrimCount; |
4213 | if (m_host.LinkNum == 0) | 4193 | List<UUID> sittingAvatarIds = m_host.ParentGroup.GetSittingAvatars(); |
4194 | int adjustedPrimCount = actualPrimCount + sittingAvatarIds.Count; | ||
4195 | |||
4196 | // Special case for a single prim. In this case the linknum is zero. However, this will not match a single | ||
4197 | // prim that has any avatars sat upon it (in which case the root prim is link 1). | ||
4198 | if (linknum == 0) | ||
4214 | { | 4199 | { |
4215 | if (linknum == 0 || linknum == ScriptBaseClass.LINK_ROOT) | 4200 | if (actualPrimCount == 1 && sittingAvatarIds.Count == 0) |
4216 | return m_host.Name; | 4201 | return m_host.Name; |
4217 | else | ||
4218 | return UUID.Zero.ToString(); | ||
4219 | } | ||
4220 | 4202 | ||
4221 | // Link set | 4203 | return ScriptBaseClass.NULL_KEY; |
4222 | SceneObjectPart part = null; | 4204 | } |
4223 | if (m_host.LinkNum == 1) // this is the Root prim | 4205 | // Special case to handle a single prim with sitting avatars. GetLinkPart() would only match zero but |
4206 | // here we must match 1 (ScriptBaseClass.LINK_ROOT). | ||
4207 | else if (linknum == 1 && actualPrimCount == 1) | ||
4224 | { | 4208 | { |
4225 | if (linknum < 0) | 4209 | if (sittingAvatarIds.Count > 0) |
4226 | part = m_host.ParentGroup.GetLinkNumPart(2); | 4210 | return m_host.ParentGroup.RootPart.Name; |
4227 | else | 4211 | else |
4228 | part = m_host.ParentGroup.GetLinkNumPart(linknum); | 4212 | return ScriptBaseClass.NULL_KEY; |
4229 | } | 4213 | } |
4230 | else // this is a child prim | 4214 | else if (linknum <= adjustedPrimCount) |
4231 | { | 4215 | { |
4232 | if (linknum < 2) | 4216 | if (linknum <= actualPrimCount) |
4233 | part = m_host.ParentGroup.GetLinkNumPart(1); | 4217 | { |
4218 | return m_host.ParentGroup.GetLinkNumPart(linknum).Name; | ||
4219 | } | ||
4234 | else | 4220 | else |
4235 | part = m_host.ParentGroup.GetLinkNumPart(linknum); | 4221 | { |
4222 | ScenePresence sp = World.GetScenePresence(sittingAvatarIds[linknum - actualPrimCount - 1]); | ||
4223 | if (sp != null) | ||
4224 | return sp.Name; | ||
4225 | else | ||
4226 | return ScriptBaseClass.NULL_KEY; | ||
4227 | } | ||
4236 | } | 4228 | } |
4237 | if (part != null) | ||
4238 | return part.Name; | ||
4239 | else | 4229 | else |
4240 | return UUID.Zero.ToString(); | 4230 | { |
4231 | return ScriptBaseClass.NULL_KEY; | ||
4232 | } | ||
4241 | } | 4233 | } |
4242 | 4234 | ||
4243 | public LSL_Integer llGetInventoryNumber(int type) | 4235 | public LSL_Integer llGetInventoryNumber(int type) |
@@ -5850,9 +5842,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
5850 | } | 5842 | } |
5851 | 5843 | ||
5852 | /// <summary> | 5844 | /// <summary> |
5853 | /// Insert the list identified by <src> into the | 5845 | /// Insert the list identified by <paramref name="src"/> into the |
5854 | /// list designated by <dest> such that the first | 5846 | /// list designated by <paramref name="dest"/> such that the first |
5855 | /// new element has the index specified by <index> | 5847 | /// new element has the index specified by <paramref name="index"/> |
5856 | /// </summary> | 5848 | /// </summary> |
5857 | 5849 | ||
5858 | public LSL_List llListInsertList(LSL_List dest, LSL_List src, int index) | 5850 | public LSL_List llListInsertList(LSL_List dest, LSL_List src, int index) |
@@ -6685,6 +6677,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
6685 | ps.BurstSpeedMax = 1.0f; | 6677 | ps.BurstSpeedMax = 1.0f; |
6686 | ps.BurstRate = 0.1f; | 6678 | ps.BurstRate = 0.1f; |
6687 | ps.PartMaxAge = 10.0f; | 6679 | ps.PartMaxAge = 10.0f; |
6680 | ps.BurstPartCount = 1; | ||
6688 | return ps; | 6681 | return ps; |
6689 | } | 6682 | } |
6690 | 6683 | ||
@@ -6706,10 +6699,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
6706 | SetParticleSystem(m_host, rules); | 6699 | SetParticleSystem(m_host, rules); |
6707 | } | 6700 | } |
6708 | 6701 | ||
6709 | private void SetParticleSystem(SceneObjectPart part, LSL_List rules) | 6702 | private void SetParticleSystem(SceneObjectPart part, LSL_List rules) |
6710 | { | 6703 | { |
6711 | |||
6712 | |||
6713 | if (rules.Length == 0) | 6704 | if (rules.Length == 0) |
6714 | { | 6705 | { |
6715 | part.RemoveParticleSystem(); | 6706 | part.RemoveParticleSystem(); |
@@ -7366,6 +7357,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
7366 | public void llCloseRemoteDataChannel(string channel) | 7357 | public void llCloseRemoteDataChannel(string channel) |
7367 | { | 7358 | { |
7368 | m_host.AddScriptLPS(1); | 7359 | m_host.AddScriptLPS(1); |
7360 | |||
7361 | IXmlRpcRouter xmlRpcRouter = m_ScriptEngine.World.RequestModuleInterface<IXmlRpcRouter>(); | ||
7362 | if (xmlRpcRouter != null) | ||
7363 | { | ||
7364 | xmlRpcRouter.UnRegisterReceiver(channel, m_item.ItemID); | ||
7365 | } | ||
7366 | |||
7369 | IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface<IXMLRPC>(); | 7367 | IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface<IXMLRPC>(); |
7370 | xmlrpcMod.CloseXMLRPCChannel((UUID)channel); | 7368 | xmlrpcMod.CloseXMLRPCChannel((UUID)channel); |
7371 | ScriptSleep(1000); | 7369 | ScriptSleep(1000); |
@@ -13251,7 +13249,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
13251 | /// Get a notecard line. | 13249 | /// Get a notecard line. |
13252 | /// </summary> | 13250 | /// </summary> |
13253 | /// <param name="assetID"></param> | 13251 | /// <param name="assetID"></param> |
13254 | /// <param name="line">Lines start at index 0</param> | 13252 | /// <param name="lineNumber">Lines start at index 0</param> |
13255 | /// <returns></returns> | 13253 | /// <returns></returns> |
13256 | public static string GetLine(UUID assetID, int lineNumber) | 13254 | public static string GetLine(UUID assetID, int lineNumber) |
13257 | { | 13255 | { |
@@ -13280,9 +13278,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
13280 | /// Get a notecard line. | 13278 | /// Get a notecard line. |
13281 | /// </summary> | 13279 | /// </summary> |
13282 | /// <param name="assetID"></param> | 13280 | /// <param name="assetID"></param> |
13283 | /// <param name="line">Lines start at index 0</param> | 13281 | /// <param name="lineNumber">Lines start at index 0</param> |
13284 | /// <param name="maxLength">Maximum length of the returned line. Longer lines will be truncated</para> | 13282 | /// <param name="maxLength"> |
13285 | /// <returns></returns> | 13283 | /// Maximum length of the returned line. |
13284 | /// </param> | ||
13285 | /// <returns> | ||
13286 | /// If the line length is longer than <paramref name="maxLength"/>, | ||
13287 | /// the return string will be truncated. | ||
13288 | /// </returns> | ||
13286 | public static string GetLine(UUID assetID, int lineNumber, int maxLength) | 13289 | public static string GetLine(UUID assetID, int lineNumber, int maxLength) |
13287 | { | 13290 | { |
13288 | string line = GetLine(assetID, lineNumber); | 13291 | 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/Api/Implementation/Plugins/SensorRepeat.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs index 4dd795d..d3ef378 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs | |||
@@ -42,6 +42,29 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins | |||
42 | { | 42 | { |
43 | // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 43 | // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
44 | 44 | ||
45 | /// <summary> | ||
46 | /// Used by one-off and repeated sensors | ||
47 | /// </summary> | ||
48 | public class SensorInfo | ||
49 | { | ||
50 | public uint localID; | ||
51 | public UUID itemID; | ||
52 | public double interval; | ||
53 | public DateTime next; | ||
54 | |||
55 | public string name; | ||
56 | public UUID keyID; | ||
57 | public int type; | ||
58 | public double range; | ||
59 | public double arc; | ||
60 | public SceneObjectPart host; | ||
61 | |||
62 | public SensorInfo Clone() | ||
63 | { | ||
64 | return (SensorInfo)this.MemberwiseClone(); | ||
65 | } | ||
66 | } | ||
67 | |||
45 | public AsyncCommandManager m_CmdManager; | 68 | public AsyncCommandManager m_CmdManager; |
46 | 69 | ||
47 | /// <summary> | 70 | /// <summary> |
@@ -78,24 +101,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins | |||
78 | private int maximumToReturn = 16; | 101 | private int maximumToReturn = 16; |
79 | 102 | ||
80 | // | 103 | // |
81 | // SenseRepeater and Sensors | ||
82 | // | ||
83 | private class SenseRepeatClass | ||
84 | { | ||
85 | public uint localID; | ||
86 | public UUID itemID; | ||
87 | public double interval; | ||
88 | public DateTime next; | ||
89 | |||
90 | public string name; | ||
91 | public UUID keyID; | ||
92 | public int type; | ||
93 | public double range; | ||
94 | public double arc; | ||
95 | public SceneObjectPart host; | ||
96 | } | ||
97 | |||
98 | // | ||
99 | // Sensed entity | 104 | // Sensed entity |
100 | // | 105 | // |
101 | private class SensedEntity : IComparable | 106 | private class SensedEntity : IComparable |
@@ -127,7 +132,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins | |||
127 | /// | 132 | /// |
128 | /// Always lock SenseRepeatListLock when updating this list. | 133 | /// Always lock SenseRepeatListLock when updating this list. |
129 | /// </remarks> | 134 | /// </remarks> |
130 | private List<SenseRepeatClass> SenseRepeaters = new List<SenseRepeatClass>(); | 135 | private List<SensorInfo> SenseRepeaters = new List<SensorInfo>(); |
131 | private object SenseRepeatListLock = new object(); | 136 | private object SenseRepeatListLock = new object(); |
132 | 137 | ||
133 | public void SetSenseRepeatEvent(uint m_localID, UUID m_itemID, | 138 | public void SetSenseRepeatEvent(uint m_localID, UUID m_itemID, |
@@ -141,7 +146,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins | |||
141 | return; | 146 | return; |
142 | 147 | ||
143 | // Add to timer | 148 | // Add to timer |
144 | SenseRepeatClass ts = new SenseRepeatClass(); | 149 | SensorInfo ts = new SensorInfo(); |
145 | ts.localID = m_localID; | 150 | ts.localID = m_localID; |
146 | ts.itemID = m_itemID; | 151 | ts.itemID = m_itemID; |
147 | ts.interval = sec; | 152 | ts.interval = sec; |
@@ -160,11 +165,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins | |||
160 | AddSenseRepeater(ts); | 165 | AddSenseRepeater(ts); |
161 | } | 166 | } |
162 | 167 | ||
163 | private void AddSenseRepeater(SenseRepeatClass senseRepeater) | 168 | private void AddSenseRepeater(SensorInfo senseRepeater) |
164 | { | 169 | { |
165 | lock (SenseRepeatListLock) | 170 | lock (SenseRepeatListLock) |
166 | { | 171 | { |
167 | List<SenseRepeatClass> newSenseRepeaters = new List<SenseRepeatClass>(SenseRepeaters); | 172 | List<SensorInfo> newSenseRepeaters = new List<SensorInfo>(SenseRepeaters); |
168 | newSenseRepeaters.Add(senseRepeater); | 173 | newSenseRepeaters.Add(senseRepeater); |
169 | SenseRepeaters = newSenseRepeaters; | 174 | SenseRepeaters = newSenseRepeaters; |
170 | } | 175 | } |
@@ -175,8 +180,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins | |||
175 | // Remove from timer | 180 | // Remove from timer |
176 | lock (SenseRepeatListLock) | 181 | lock (SenseRepeatListLock) |
177 | { | 182 | { |
178 | List<SenseRepeatClass> newSenseRepeaters = new List<SenseRepeatClass>(); | 183 | List<SensorInfo> newSenseRepeaters = new List<SensorInfo>(); |
179 | foreach (SenseRepeatClass ts in SenseRepeaters) | 184 | foreach (SensorInfo ts in SenseRepeaters) |
180 | { | 185 | { |
181 | if (ts.localID != m_localID || ts.itemID != m_itemID) | 186 | if (ts.localID != m_localID || ts.itemID != m_itemID) |
182 | { | 187 | { |
@@ -191,7 +196,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins | |||
191 | public void CheckSenseRepeaterEvents() | 196 | public void CheckSenseRepeaterEvents() |
192 | { | 197 | { |
193 | // Go through all timers | 198 | // Go through all timers |
194 | foreach (SenseRepeatClass ts in SenseRepeaters) | 199 | foreach (SensorInfo ts in SenseRepeaters) |
195 | { | 200 | { |
196 | // Time has passed? | 201 | // Time has passed? |
197 | if (ts.next.ToUniversalTime() < DateTime.Now.ToUniversalTime()) | 202 | if (ts.next.ToUniversalTime() < DateTime.Now.ToUniversalTime()) |
@@ -208,7 +213,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins | |||
208 | double range, double arc, SceneObjectPart host) | 213 | double range, double arc, SceneObjectPart host) |
209 | { | 214 | { |
210 | // Add to timer | 215 | // Add to timer |
211 | SenseRepeatClass ts = new SenseRepeatClass(); | 216 | SensorInfo ts = new SensorInfo(); |
212 | ts.localID = m_localID; | 217 | ts.localID = m_localID; |
213 | ts.itemID = m_itemID; | 218 | ts.itemID = m_itemID; |
214 | ts.interval = 0; | 219 | ts.interval = 0; |
@@ -224,7 +229,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins | |||
224 | SensorSweep(ts); | 229 | SensorSweep(ts); |
225 | } | 230 | } |
226 | 231 | ||
227 | private void SensorSweep(SenseRepeatClass ts) | 232 | private void SensorSweep(SensorInfo ts) |
228 | { | 233 | { |
229 | if (ts.host == null) | 234 | if (ts.host == null) |
230 | { | 235 | { |
@@ -300,7 +305,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins | |||
300 | } | 305 | } |
301 | } | 306 | } |
302 | 307 | ||
303 | private List<SensedEntity> doObjectSensor(SenseRepeatClass ts) | 308 | private List<SensedEntity> doObjectSensor(SensorInfo ts) |
304 | { | 309 | { |
305 | List<EntityBase> Entities; | 310 | List<EntityBase> Entities; |
306 | List<SensedEntity> sensedEntities = new List<SensedEntity>(); | 311 | List<SensedEntity> sensedEntities = new List<SensedEntity>(); |
@@ -451,7 +456,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins | |||
451 | return sensedEntities; | 456 | return sensedEntities; |
452 | } | 457 | } |
453 | 458 | ||
454 | private List<SensedEntity> doAgentSensor(SenseRepeatClass ts) | 459 | private List<SensedEntity> doAgentSensor(SensorInfo ts) |
455 | { | 460 | { |
456 | List<SensedEntity> sensedEntities = new List<SensedEntity>(); | 461 | List<SensedEntity> sensedEntities = new List<SensedEntity>(); |
457 | 462 | ||
@@ -630,7 +635,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins | |||
630 | { | 635 | { |
631 | List<Object> data = new List<Object>(); | 636 | List<Object> data = new List<Object>(); |
632 | 637 | ||
633 | foreach (SenseRepeatClass ts in SenseRepeaters) | 638 | foreach (SensorInfo ts in SenseRepeaters) |
634 | { | 639 | { |
635 | if (ts.itemID == itemID) | 640 | if (ts.itemID == itemID) |
636 | { | 641 | { |
@@ -660,7 +665,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins | |||
660 | 665 | ||
661 | while (idx < data.Length) | 666 | while (idx < data.Length) |
662 | { | 667 | { |
663 | SenseRepeatClass ts = new SenseRepeatClass(); | 668 | SensorInfo ts = new SensorInfo(); |
664 | 669 | ||
665 | ts.localID = localID; | 670 | ts.localID = localID; |
666 | ts.itemID = itemID; | 671 | ts.itemID = itemID; |
@@ -681,5 +686,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins | |||
681 | idx += 6; | 686 | idx += 6; |
682 | } | 687 | } |
683 | } | 688 | } |
689 | |||
690 | public List<SensorInfo> GetSensorInfo() | ||
691 | { | ||
692 | List<SensorInfo> retList = new List<SensorInfo>(); | ||
693 | |||
694 | lock (SenseRepeatListLock) | ||
695 | { | ||
696 | foreach (SensorInfo i in SenseRepeaters) | ||
697 | retList.Add(i.Clone()); | ||
698 | } | ||
699 | |||
700 | return retList; | ||
701 | } | ||
684 | } | 702 | } |
685 | } | 703 | } \ No newline at end of file |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/Timer.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/Timer.cs index 9ee6946..68aacd2 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/Timer.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/Timer.cs | |||
@@ -35,6 +35,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins | |||
35 | { | 35 | { |
36 | public class Timer | 36 | public class Timer |
37 | { | 37 | { |
38 | public class TimerInfo | ||
39 | { | ||
40 | public uint localID; | ||
41 | public UUID itemID; | ||
42 | //public double interval; | ||
43 | public long interval; | ||
44 | //public DateTime next; | ||
45 | public long next; | ||
46 | |||
47 | public TimerInfo Clone() | ||
48 | { | ||
49 | return (TimerInfo)this.MemberwiseClone(); | ||
50 | } | ||
51 | } | ||
52 | |||
38 | public AsyncCommandManager m_CmdManager; | 53 | public AsyncCommandManager m_CmdManager; |
39 | 54 | ||
40 | public int TimersCount | 55 | public int TimersCount |
@@ -59,17 +74,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins | |||
59 | return localID.ToString() + itemID.ToString(); | 74 | return localID.ToString() + itemID.ToString(); |
60 | } | 75 | } |
61 | 76 | ||
62 | private class TimerClass | 77 | private Dictionary<string,TimerInfo> Timers = new Dictionary<string,TimerInfo>(); |
63 | { | ||
64 | public uint localID; | ||
65 | public UUID itemID; | ||
66 | //public double interval; | ||
67 | public long interval; | ||
68 | //public DateTime next; | ||
69 | public long next; | ||
70 | } | ||
71 | |||
72 | private Dictionary<string,TimerClass> Timers = new Dictionary<string,TimerClass>(); | ||
73 | private object TimerListLock = new object(); | 78 | private object TimerListLock = new object(); |
74 | 79 | ||
75 | public void SetTimerEvent(uint m_localID, UUID m_itemID, double sec) | 80 | public void SetTimerEvent(uint m_localID, UUID m_itemID, double sec) |
@@ -81,7 +86,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins | |||
81 | } | 86 | } |
82 | 87 | ||
83 | // Add to timer | 88 | // Add to timer |
84 | TimerClass ts = new TimerClass(); | 89 | TimerInfo ts = new TimerInfo(); |
85 | ts.localID = m_localID; | 90 | ts.localID = m_localID; |
86 | ts.itemID = m_itemID; | 91 | ts.itemID = m_itemID; |
87 | ts.interval = Convert.ToInt64(sec * 10000000); // How many 100 nanoseconds (ticks) should we wait | 92 | ts.interval = Convert.ToInt64(sec * 10000000); // How many 100 nanoseconds (ticks) should we wait |
@@ -118,14 +123,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins | |||
118 | if (Timers.Count == 0) | 123 | if (Timers.Count == 0) |
119 | return; | 124 | return; |
120 | 125 | ||
121 | Dictionary<string, TimerClass>.ValueCollection tvals; | 126 | Dictionary<string, TimerInfo>.ValueCollection tvals; |
122 | lock (TimerListLock) | 127 | lock (TimerListLock) |
123 | { | 128 | { |
124 | // Go through all timers | 129 | // Go through all timers |
125 | tvals = Timers.Values; | 130 | tvals = Timers.Values; |
126 | } | 131 | } |
127 | 132 | ||
128 | foreach (TimerClass ts in tvals) | 133 | foreach (TimerInfo ts in tvals) |
129 | { | 134 | { |
130 | // Time has passed? | 135 | // Time has passed? |
131 | if (ts.next < DateTime.Now.Ticks) | 136 | if (ts.next < DateTime.Now.Ticks) |
@@ -149,8 +154,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins | |||
149 | 154 | ||
150 | lock (TimerListLock) | 155 | lock (TimerListLock) |
151 | { | 156 | { |
152 | Dictionary<string, TimerClass>.ValueCollection tvals = Timers.Values; | 157 | Dictionary<string, TimerInfo>.ValueCollection tvals = Timers.Values; |
153 | foreach (TimerClass ts in tvals) | 158 | foreach (TimerInfo ts in tvals) |
154 | { | 159 | { |
155 | if (ts.itemID == itemID) | 160 | if (ts.itemID == itemID) |
156 | { | 161 | { |
@@ -169,7 +174,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins | |||
169 | 174 | ||
170 | while (idx < data.Length) | 175 | while (idx < data.Length) |
171 | { | 176 | { |
172 | TimerClass ts = new TimerClass(); | 177 | TimerInfo ts = new TimerInfo(); |
173 | 178 | ||
174 | ts.localID = localID; | 179 | ts.localID = localID; |
175 | ts.itemID = itemID; | 180 | ts.itemID = itemID; |
@@ -183,5 +188,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins | |||
183 | } | 188 | } |
184 | } | 189 | } |
185 | } | 190 | } |
191 | |||
192 | public List<TimerInfo> GetTimersInfo() | ||
193 | { | ||
194 | List<TimerInfo> retList = new List<TimerInfo>(); | ||
195 | |||
196 | lock (TimerListLock) | ||
197 | { | ||
198 | foreach (TimerInfo i in Timers.Values) | ||
199 | retList.Add(i.Clone()); | ||
200 | } | ||
201 | |||
202 | return retList; | ||
203 | } | ||
186 | } | 204 | } |
187 | } | 205 | } |
diff --git a/OpenSim/Region/ScriptEngine/Shared/CodeTools/Tests/CSCodeGeneratorTest.cs b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Tests/CSCodeGeneratorTest.cs index 7763619..77e087c 100644 --- a/OpenSim/Region/ScriptEngine/Shared/CodeTools/Tests/CSCodeGeneratorTest.cs +++ b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Tests/CSCodeGeneratorTest.cs | |||
@@ -39,7 +39,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools.Tests | |||
39 | /// The generated C# code is compared against the expected C# code. | 39 | /// The generated C# code is compared against the expected C# code. |
40 | /// </summary> | 40 | /// </summary> |
41 | [TestFixture] | 41 | [TestFixture] |
42 | public class CSCodeGeneratorTest | 42 | public class CSCodeGeneratorTest : OpenSimTestCase |
43 | { | 43 | { |
44 | [Test] | 44 | [Test] |
45 | public void TestDefaultState() | 45 | public void TestDefaultState() |
diff --git a/OpenSim/Region/ScriptEngine/Shared/CodeTools/Tests/CompilerTest.cs b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Tests/CompilerTest.cs index 1fa6954..05a8756 100644 --- a/OpenSim/Region/ScriptEngine/Shared/CodeTools/Tests/CompilerTest.cs +++ b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Tests/CompilerTest.cs | |||
@@ -41,7 +41,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools.Tests | |||
41 | /// the LSL source. | 41 | /// the LSL source. |
42 | /// </summary> | 42 | /// </summary> |
43 | [TestFixture] | 43 | [TestFixture] |
44 | public class CompilerTest | 44 | public class CompilerTest : OpenSimTestCase |
45 | { | 45 | { |
46 | private string m_testDir; | 46 | private string m_testDir; |
47 | private CSharpCodeProvider m_CSCodeProvider; | 47 | private CSharpCodeProvider m_CSCodeProvider; |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs index 771db0c..ff4d130 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs | |||
@@ -94,6 +94,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance | |||
94 | private UUID m_CurrentStateHash; | 94 | private UUID m_CurrentStateHash; |
95 | private UUID m_RegionID; | 95 | private UUID m_RegionID; |
96 | 96 | ||
97 | public int DebugLevel { get; set; } | ||
98 | |||
97 | public Dictionary<KeyValuePair<int, int>, KeyValuePair<int, int>> LineMap { get; set; } | 99 | public Dictionary<KeyValuePair<int, int>, KeyValuePair<int, int>> LineMap { get; set; } |
98 | 100 | ||
99 | private Dictionary<string,IScriptApi> m_Apis = new Dictionary<string,IScriptApi>(); | 101 | private Dictionary<string,IScriptApi> m_Apis = new Dictionary<string,IScriptApi>(); |
@@ -174,6 +176,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance | |||
174 | 176 | ||
175 | public Queue EventQueue { get; private set; } | 177 | public Queue EventQueue { get; private set; } |
176 | 178 | ||
179 | public long EventsQueued | ||
180 | { | ||
181 | get | ||
182 | { | ||
183 | lock (EventQueue) | ||
184 | return EventQueue.Count; | ||
185 | } | ||
186 | } | ||
187 | |||
188 | public long EventsProcessed { get; private set; } | ||
189 | |||
177 | public int StartParam { get; set; } | 190 | public int StartParam { get; set; } |
178 | 191 | ||
179 | public TaskInventoryItem ScriptTask { get; private set; } | 192 | public TaskInventoryItem ScriptTask { get; private set; } |
@@ -538,9 +551,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance | |||
538 | // forcibly abort the work item (this aborts the underlying thread). | 551 | // forcibly abort the work item (this aborts the underlying thread). |
539 | if (!m_InSelfDelete) | 552 | if (!m_InSelfDelete) |
540 | { | 553 | { |
541 | // m_log.ErrorFormat( | 554 | m_log.DebugFormat( |
542 | // "[SCRIPT INSTANCE]: Aborting script {0} {1} in prim {2} {3} {4} {5}", | 555 | "[SCRIPT INSTANCE]: Aborting unstopped script {0} {1} in prim {2}, localID {3}, timeout was {4} ms", |
543 | // ScriptName, ItemID, PrimName, ObjectID, m_InSelfDelete, DateTime.Now.Ticks); | 556 | ScriptName, ItemID, PrimName, LocalID, timeout); |
544 | 557 | ||
545 | workItem.Abort(); | 558 | workItem.Abort(); |
546 | } | 559 | } |
@@ -696,19 +709,41 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance | |||
696 | { | 709 | { |
697 | 710 | ||
698 | // m_log.DebugFormat("[XEngine]: Processing event {0} for {1}", data.EventName, this); | 711 | // m_log.DebugFormat("[XEngine]: Processing event {0} for {1}", data.EventName, this); |
712 | SceneObjectPart part = Engine.World.GetSceneObjectPart(LocalID); | ||
713 | |||
714 | if (DebugLevel >= 2) | ||
715 | m_log.DebugFormat( | ||
716 | "[SCRIPT INSTANCE]: Processing event {0} for {1}/{2}({3})/{4}({5}) @ {6}/{7}", | ||
717 | data.EventName, | ||
718 | ScriptName, | ||
719 | part.Name, | ||
720 | part.LocalId, | ||
721 | part.ParentGroup.Name, | ||
722 | part.ParentGroup.UUID, | ||
723 | part.AbsolutePosition, | ||
724 | part.ParentGroup.Scene.Name); | ||
699 | 725 | ||
700 | m_DetectParams = data.DetectParams; | 726 | m_DetectParams = data.DetectParams; |
701 | 727 | ||
702 | if (data.EventName == "state") // Hardcoded state change | 728 | if (data.EventName == "state") // Hardcoded state change |
703 | { | 729 | { |
704 | // m_log.DebugFormat("[Script] Script {0}.{1} state set to {2}", | ||
705 | // PrimName, ScriptName, data.Params[0].ToString()); | ||
706 | State = data.Params[0].ToString(); | 730 | State = data.Params[0].ToString(); |
731 | |||
732 | if (DebugLevel >= 1) | ||
733 | m_log.DebugFormat( | ||
734 | "[SCRIPT INSTANCE]: Changing state to {0} for {1}/{2}({3})/{4}({5}) @ {6}/{7}", | ||
735 | State, | ||
736 | ScriptName, | ||
737 | part.Name, | ||
738 | part.LocalId, | ||
739 | part.ParentGroup.Name, | ||
740 | part.ParentGroup.UUID, | ||
741 | part.AbsolutePosition, | ||
742 | part.ParentGroup.Scene.Name); | ||
743 | |||
707 | AsyncCommandManager.RemoveScript(Engine, | 744 | AsyncCommandManager.RemoveScript(Engine, |
708 | LocalID, ItemID); | 745 | LocalID, ItemID); |
709 | 746 | ||
710 | SceneObjectPart part = Engine.World.GetSceneObjectPart( | ||
711 | LocalID); | ||
712 | if (part != null) | 747 | if (part != null) |
713 | { | 748 | { |
714 | part.SetScriptEvents(ItemID, | 749 | part.SetScriptEvents(ItemID, |
@@ -720,8 +755,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance | |||
720 | if (Engine.World.PipeEventsForScript(LocalID) || | 755 | if (Engine.World.PipeEventsForScript(LocalID) || |
721 | data.EventName == "control") // Don't freeze avies! | 756 | data.EventName == "control") // Don't freeze avies! |
722 | { | 757 | { |
723 | SceneObjectPart part = Engine.World.GetSceneObjectPart( | ||
724 | LocalID); | ||
725 | // m_log.DebugFormat("[Script] Delivered event {2} in state {3} to {0}.{1}", | 758 | // m_log.DebugFormat("[Script] Delivered event {2} in state {3} to {0}.{1}", |
726 | // PrimName, ScriptName, data.EventName, State); | 759 | // PrimName, ScriptName, data.EventName, State); |
727 | 760 | ||
@@ -776,6 +809,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance | |||
776 | ChatTypeEnum.DebugChannel, 2147483647, | 809 | ChatTypeEnum.DebugChannel, 2147483647, |
777 | part.AbsolutePosition, | 810 | part.AbsolutePosition, |
778 | part.Name, part.UUID, false); | 811 | part.Name, part.UUID, false); |
812 | |||
813 | |||
814 | m_log.DebugFormat( | ||
815 | "[SCRIPT INSTANCE]: Runtime error in script {0}, part {1} {2} at {3} in {4}, displayed error {5}, actual exception {6}", | ||
816 | ScriptName, | ||
817 | PrimName, | ||
818 | part.UUID, | ||
819 | part.AbsolutePosition, | ||
820 | part.ParentGroup.Scene.Name, | ||
821 | text.Replace("\n", "\\n"), | ||
822 | e.InnerException); | ||
779 | } | 823 | } |
780 | catch (Exception) | 824 | catch (Exception) |
781 | { | 825 | { |
@@ -810,6 +854,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance | |||
810 | // script engine to run the next event. | 854 | // script engine to run the next event. |
811 | lock (EventQueue) | 855 | lock (EventQueue) |
812 | { | 856 | { |
857 | EventsProcessed++; | ||
858 | |||
813 | if (EventQueue.Count > 0 && Running && !ShuttingDown) | 859 | if (EventQueue.Count > 0 && Running && !ShuttingDown) |
814 | { | 860 | { |
815 | m_CurrentWorkItem = Engine.QueueEventHandler(this); | 861 | m_CurrentWorkItem = Engine.QueueEventHandler(this); |
@@ -834,7 +880,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance | |||
834 | return (DateTime.Now - m_EventStart).Seconds; | 880 | return (DateTime.Now - m_EventStart).Seconds; |
835 | } | 881 | } |
836 | 882 | ||
837 | public void ResetScript() | 883 | public void ResetScript(int timeout) |
838 | { | 884 | { |
839 | if (m_Script == null) | 885 | if (m_Script == null) |
840 | return; | 886 | return; |
@@ -844,7 +890,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance | |||
844 | RemoveState(); | 890 | RemoveState(); |
845 | ReleaseControls(); | 891 | ReleaseControls(); |
846 | 892 | ||
847 | Stop(0); | 893 | Stop(timeout); |
848 | SceneObjectPart part = Engine.World.GetSceneObjectPart(LocalID); | 894 | SceneObjectPart part = Engine.World.GetSceneObjectPart(LocalID); |
849 | part.Inventory.GetInventoryItem(ItemID).PermsMask = 0; | 895 | part.Inventory.GetInventoryItem(ItemID).PermsMask = 0; |
850 | part.Inventory.GetInventoryItem(ItemID).PermsGranter = UUID.Zero; | 896 | part.Inventory.GetInventoryItem(ItemID).PermsGranter = UUID.Zero; |
@@ -1015,7 +1061,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance | |||
1015 | "({0}): {1}", scriptLine - 1, | 1061 | "({0}): {1}", scriptLine - 1, |
1016 | e.InnerException.Message); | 1062 | e.InnerException.Message); |
1017 | 1063 | ||
1018 | System.Console.WriteLine(e.ToString()+"\n"); | ||
1019 | return message; | 1064 | return message; |
1020 | } | 1065 | } |
1021 | } | 1066 | } |
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) |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiInventoryTests.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiInventoryTests.cs index c73e22f..cb7291a 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiInventoryTests.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiInventoryTests.cs | |||
@@ -51,14 +51,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
51 | /// Tests for inventory functions in LSL | 51 | /// Tests for inventory functions in LSL |
52 | /// </summary> | 52 | /// </summary> |
53 | [TestFixture] | 53 | [TestFixture] |
54 | public class LSL_ApiInventoryTests | 54 | public class LSL_ApiInventoryTests : OpenSimTestCase |
55 | { | 55 | { |
56 | protected Scene m_scene; | 56 | protected Scene m_scene; |
57 | protected XEngine.XEngine m_engine; | 57 | protected XEngine.XEngine m_engine; |
58 | 58 | ||
59 | [SetUp] | 59 | [SetUp] |
60 | public void SetUp() | 60 | public override void SetUp() |
61 | { | 61 | { |
62 | base.SetUp(); | ||
63 | |||
62 | IConfigSource initConfigSource = new IniConfigSource(); | 64 | IConfigSource initConfigSource = new IniConfigSource(); |
63 | IConfig config = initConfigSource.AddConfig("XEngine"); | 65 | IConfig config = initConfigSource.AddConfig("XEngine"); |
64 | config.Set("Enabled", "true"); | 66 | config.Set("Enabled", "true"); |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiLinkingTests.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiLinkingTests.cs index 2565ae7..d9b17d7 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiLinkingTests.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiLinkingTests.cs | |||
@@ -56,14 +56,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
56 | /// OpenSim.Region.Framework.Scenes.Tests.SceneObjectLinkingTests. | 56 | /// OpenSim.Region.Framework.Scenes.Tests.SceneObjectLinkingTests. |
57 | /// </remarks> | 57 | /// </remarks> |
58 | [TestFixture] | 58 | [TestFixture] |
59 | public class LSL_ApiLinkingTests | 59 | public class LSL_ApiLinkingTests : OpenSimTestCase |
60 | { | 60 | { |
61 | protected Scene m_scene; | 61 | protected Scene m_scene; |
62 | protected XEngine.XEngine m_engine; | 62 | protected XEngine.XEngine m_engine; |
63 | 63 | ||
64 | [SetUp] | 64 | [SetUp] |
65 | public void SetUp() | 65 | public override void SetUp() |
66 | { | 66 | { |
67 | base.SetUp(); | ||
68 | |||
67 | IConfigSource initConfigSource = new IniConfigSource(); | 69 | IConfigSource initConfigSource = new IniConfigSource(); |
68 | IConfig config = initConfigSource.AddConfig("XEngine"); | 70 | IConfig config = initConfigSource.AddConfig("XEngine"); |
69 | config.Set("Enabled", "true"); | 71 | config.Set("Enabled", "true"); |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiListTests.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiListTests.cs index dd23be8..98017d8 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiListTests.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiListTests.cs | |||
@@ -46,13 +46,15 @@ using LSL_String = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString; | |||
46 | namespace OpenSim.Region.ScriptEngine.Shared.Tests | 46 | namespace OpenSim.Region.ScriptEngine.Shared.Tests |
47 | { | 47 | { |
48 | [TestFixture] | 48 | [TestFixture] |
49 | public class LSL_ApiListTests | 49 | public class LSL_ApiListTests : OpenSimTestCase |
50 | { | 50 | { |
51 | private LSL_Api m_lslApi; | 51 | private LSL_Api m_lslApi; |
52 | 52 | ||
53 | [SetUp] | 53 | [SetUp] |
54 | public void SetUp() | 54 | public override void SetUp() |
55 | { | 55 | { |
56 | base.SetUp(); | ||
57 | |||
56 | IConfigSource initConfigSource = new IniConfigSource(); | 58 | IConfigSource initConfigSource = new IniConfigSource(); |
57 | IConfig config = initConfigSource.AddConfig("XEngine"); | 59 | IConfig config = initConfigSource.AddConfig("XEngine"); |
58 | config.Set("Enabled", "true"); | 60 | config.Set("Enabled", "true"); |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_TypesTestLSLFloat.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_TypesTestLSLFloat.cs index 3ed2562..c8c7f82 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_TypesTestLSLFloat.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_TypesTestLSLFloat.cs | |||
@@ -33,7 +33,7 @@ using OpenSim.Region.ScriptEngine.Shared; | |||
33 | namespace OpenSim.Region.ScriptEngine.Shared.Tests | 33 | namespace OpenSim.Region.ScriptEngine.Shared.Tests |
34 | { | 34 | { |
35 | [TestFixture] | 35 | [TestFixture] |
36 | public class LSL_TypesTestLSLFloat | 36 | public class LSL_TypesTestLSLFloat : OpenSimTestCase |
37 | { | 37 | { |
38 | // Used for testing equality of two floats. | 38 | // Used for testing equality of two floats. |
39 | private double _lowPrecisionTolerance = 0.000001; | 39 | private double _lowPrecisionTolerance = 0.000001; |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_TypesTestLSLInteger.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_TypesTestLSLInteger.cs index 8d1169a..c664108 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_TypesTestLSLInteger.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_TypesTestLSLInteger.cs | |||
@@ -33,7 +33,7 @@ using OpenSim.Region.ScriptEngine.Shared; | |||
33 | namespace OpenSim.Region.ScriptEngine.Shared.Tests | 33 | namespace OpenSim.Region.ScriptEngine.Shared.Tests |
34 | { | 34 | { |
35 | [TestFixture] | 35 | [TestFixture] |
36 | public class LSL_TypesTestLSLInteger | 36 | public class LSL_TypesTestLSLInteger : OpenSimTestCase |
37 | { | 37 | { |
38 | private Dictionary<double, int> m_doubleIntSet; | 38 | private Dictionary<double, int> m_doubleIntSet; |
39 | private Dictionary<string, int> m_stringIntSet; | 39 | private Dictionary<string, int> m_stringIntSet; |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_TypesTestLSLString.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_TypesTestLSLString.cs index c4ca1a8..8550f2d 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_TypesTestLSLString.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_TypesTestLSLString.cs | |||
@@ -33,7 +33,7 @@ using OpenSim.Region.ScriptEngine.Shared; | |||
33 | namespace OpenSim.Region.ScriptEngine.Shared.Tests | 33 | namespace OpenSim.Region.ScriptEngine.Shared.Tests |
34 | { | 34 | { |
35 | [TestFixture] | 35 | [TestFixture] |
36 | public class LSL_TypesTestLSLString | 36 | public class LSL_TypesTestLSLString : OpenSimTestCase |
37 | { | 37 | { |
38 | private Dictionary<double, string> m_doubleStringSet; | 38 | private Dictionary<double, string> m_doubleStringSet; |
39 | 39 | ||
diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_TypesTestList.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_TypesTestList.cs index b81225f..71b88bc 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_TypesTestList.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_TypesTestList.cs | |||
@@ -36,7 +36,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
36 | /// Tests the LSL_Types.list class. | 36 | /// Tests the LSL_Types.list class. |
37 | /// </summary> | 37 | /// </summary> |
38 | [TestFixture] | 38 | [TestFixture] |
39 | public class LSL_TypesTestList | 39 | public class LSL_TypesTestList : OpenSimTestCase |
40 | { | 40 | { |
41 | /// <summary> | 41 | /// <summary> |
42 | /// Tests concatenating a string to a list. | 42 | /// Tests concatenating a string to a list. |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_TypesTestVector3.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_TypesTestVector3.cs index ebf8001..0c838af 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_TypesTestVector3.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_TypesTestVector3.cs | |||
@@ -36,7 +36,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
36 | /// Tests for Vector3 | 36 | /// Tests for Vector3 |
37 | /// </summary> | 37 | /// </summary> |
38 | [TestFixture] | 38 | [TestFixture] |
39 | public class LSL_TypesTestVector3 | 39 | public class LSL_TypesTestVector3 : OpenSimTestCase |
40 | { | 40 | { |
41 | [Test] | 41 | [Test] |
42 | public void TestDotProduct() | 42 | public void TestDotProduct() |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAppearanceTest.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAppearanceTest.cs index c401794..1381d2b 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAppearanceTest.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAppearanceTest.cs | |||
@@ -51,14 +51,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
51 | /// Tests for OSSL_Api | 51 | /// Tests for OSSL_Api |
52 | /// </summary> | 52 | /// </summary> |
53 | [TestFixture] | 53 | [TestFixture] |
54 | public class OSSL_ApiAppearanceTest | 54 | public class OSSL_ApiAppearanceTest : OpenSimTestCase |
55 | { | 55 | { |
56 | protected Scene m_scene; | 56 | protected Scene m_scene; |
57 | protected XEngine.XEngine m_engine; | 57 | protected XEngine.XEngine m_engine; |
58 | 58 | ||
59 | [SetUp] | 59 | [SetUp] |
60 | public void SetUp() | 60 | public override void SetUp() |
61 | { | 61 | { |
62 | base.SetUp(); | ||
63 | |||
62 | IConfigSource initConfigSource = new IniConfigSource(); | 64 | IConfigSource initConfigSource = new IniConfigSource(); |
63 | IConfig config = initConfigSource.AddConfig("XEngine"); | 65 | IConfig config = initConfigSource.AddConfig("XEngine"); |
64 | config.Set("Enabled", "true"); | 66 | config.Set("Enabled", "true"); |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiNpcTests.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiNpcTests.cs index b49bcc2..d6c82f1 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiNpcTests.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiNpcTests.cs | |||
@@ -127,12 +127,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
127 | OSSL_Api osslApi = new OSSL_Api(); | 127 | OSSL_Api osslApi = new OSSL_Api(); |
128 | osslApi.Initialize(m_engine, so.RootPart, null); | 128 | osslApi.Initialize(m_engine, so.RootPart, null); |
129 | 129 | ||
130 | string npcRaw; | ||
131 | bool gotExpectedException = false; | 130 | bool gotExpectedException = false; |
132 | try | 131 | try |
133 | { | 132 | { |
134 | npcRaw | 133 | osslApi.osNpcCreate("Jane", "Doe", new LSL_Types.Vector3(128, 128, 128), "not existing notecard name"); |
135 | = osslApi.osNpcCreate("Jane", "Doe", new LSL_Types.Vector3(128, 128, 128), "not existing notecard name"); | ||
136 | } | 134 | } |
137 | catch (ScriptException) | 135 | catch (ScriptException) |
138 | { | 136 | { |