diff options
author | Melanie | 2013-01-16 16:52:57 +0000 |
---|---|---|
committer | Melanie | 2013-01-16 16:52:57 +0000 |
commit | 9c99ed26ebe7cd2e42c10487e4ddfde0c934d921 (patch) | |
tree | 536b2d6530fdda925203afddd27a4b9444e4d2a7 /OpenSim/Region | |
parent | Complete removal of the now unused state queue (diff) | |
parent | Changed a couple of debug messages at the request of osgrid. (diff) | |
download | opensim-SC_OLD-9c99ed26ebe7cd2e42c10487e4ddfde0c934d921.zip opensim-SC_OLD-9c99ed26ebe7cd2e42c10487e4ddfde0c934d921.tar.gz opensim-SC_OLD-9c99ed26ebe7cd2e42c10487e4ddfde0c934d921.tar.bz2 opensim-SC_OLD-9c99ed26ebe7cd2e42c10487e4ddfde0c934d921.tar.xz |
Merge branch 'master' of melanie@opensimulator.org:/var/git/opensim
Diffstat (limited to 'OpenSim/Region')
28 files changed, 535 insertions, 151 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 77acacf..0ccd69a 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | |||
@@ -6427,19 +6427,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
6427 | #endregion | 6427 | #endregion |
6428 | 6428 | ||
6429 | AgentRequestSit handlerAgentRequestSit = OnAgentRequestSit; | 6429 | AgentRequestSit handlerAgentRequestSit = OnAgentRequestSit; |
6430 | if (handlerAgentRequestSit != null) | ||
6431 | if (!(agentRequestSit.AgentData == null | ||
6432 | || agentRequestSit.TargetObject == null | ||
6433 | || agentRequestSit.TargetObject.TargetID == null | ||
6434 | || agentRequestSit.TargetObject.Offset == null)) | ||
6435 | { | ||
6436 | var sp = m_scene.GetScenePresence(agentRequestSit.AgentData.AgentID); | ||
6437 | if (sp == null || sp.ParentID != 0) // ignore packet if agent is already sitting | ||
6438 | return true; | ||
6439 | 6430 | ||
6440 | handlerAgentRequestSit(this, agentRequestSit.AgentData.AgentID, | 6431 | if (handlerAgentRequestSit != null) |
6441 | agentRequestSit.TargetObject.TargetID, agentRequestSit.TargetObject.Offset); | 6432 | handlerAgentRequestSit(this, agentRequestSit.AgentData.AgentID, |
6442 | } | 6433 | agentRequestSit.TargetObject.TargetID, agentRequestSit.TargetObject.Offset); |
6443 | } | 6434 | } |
6444 | return true; | 6435 | return true; |
6445 | } | 6436 | } |
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs index 41ca13b..b188741 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs | |||
@@ -212,11 +212,11 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
212 | protected override GridRegion GetFinalDestination(GridRegion region) | 212 | protected override GridRegion GetFinalDestination(GridRegion region) |
213 | { | 213 | { |
214 | int flags = Scene.GridService.GetRegionFlags(Scene.RegionInfo.ScopeID, region.RegionID); | 214 | int flags = Scene.GridService.GetRegionFlags(Scene.RegionInfo.ScopeID, region.RegionID); |
215 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: region {0} flags: {1}", region.RegionID, flags); | 215 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: region {0} flags: {1}", region.RegionName, flags); |
216 | 216 | ||
217 | if ((flags & (int)OpenSim.Framework.RegionFlags.Hyperlink) != 0) | 217 | if ((flags & (int)OpenSim.Framework.RegionFlags.Hyperlink) != 0) |
218 | { | 218 | { |
219 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Destination region {0} is hyperlink", region.RegionID); | 219 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Destination region is hyperlink"); |
220 | GridRegion real_destination = m_GatekeeperConnector.GetHyperlinkRegion(region, region.RegionID); | 220 | GridRegion real_destination = m_GatekeeperConnector.GetHyperlinkRegion(region, region.RegionID); |
221 | if (real_destination != null) | 221 | if (real_destination != null) |
222 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: GetFinalDestination serveruri -> {0}", real_destination.ServerURI); | 222 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: GetFinalDestination serveruri -> {0}", real_destination.ServerURI); |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index 5c8b097..92bf85a 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | |||
@@ -1738,6 +1738,21 @@ namespace OpenSim.Region.Framework.Scenes | |||
1738 | /// <returns>The part where the script was rezzed if successful. False otherwise.</returns> | 1738 | /// <returns>The part where the script was rezzed if successful. False otherwise.</returns> |
1739 | public SceneObjectPart RezNewScript(UUID agentID, InventoryItemBase itemBase) | 1739 | public SceneObjectPart RezNewScript(UUID agentID, InventoryItemBase itemBase) |
1740 | { | 1740 | { |
1741 | return RezNewScript( | ||
1742 | agentID, | ||
1743 | itemBase, | ||
1744 | "default\n{\n state_entry()\n {\n llSay(0, \"Script running\");\n }\n}"); | ||
1745 | } | ||
1746 | |||
1747 | /// <summary> | ||
1748 | /// Rez a new script from nothing with given script text. | ||
1749 | /// </summary> | ||
1750 | /// <param name="remoteClient"></param> | ||
1751 | /// <param name="itemBase">Template item.</param> | ||
1752 | /// <param name="scriptText"></param> | ||
1753 | /// <returns>The part where the script was rezzed if successful. False otherwise.</returns> | ||
1754 | public SceneObjectPart RezNewScript(UUID agentID, InventoryItemBase itemBase, string scriptText) | ||
1755 | { | ||
1741 | // The part ID is the folder ID! | 1756 | // The part ID is the folder ID! |
1742 | SceneObjectPart part = GetSceneObjectPart(itemBase.Folder); | 1757 | SceneObjectPart part = GetSceneObjectPart(itemBase.Folder); |
1743 | if (part == null) | 1758 | if (part == null) |
@@ -1757,9 +1772,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
1757 | return null; | 1772 | return null; |
1758 | } | 1773 | } |
1759 | 1774 | ||
1760 | AssetBase asset = CreateAsset(itemBase.Name, itemBase.Description, (sbyte)itemBase.AssetType, | 1775 | AssetBase asset |
1761 | Encoding.ASCII.GetBytes("default\n{\n state_entry()\n {\n llSay(0, \"Script running\");\n }\n}"), | 1776 | = CreateAsset( |
1762 | agentID); | 1777 | itemBase.Name, |
1778 | itemBase.Description, | ||
1779 | (sbyte)itemBase.AssetType, | ||
1780 | Encoding.ASCII.GetBytes(scriptText), | ||
1781 | agentID); | ||
1782 | |||
1763 | AssetService.Store(asset); | 1783 | AssetService.Store(asset); |
1764 | 1784 | ||
1765 | TaskInventoryItem taskItem = new TaskInventoryItem(); | 1785 | TaskInventoryItem taskItem = new TaskInventoryItem(); |
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 0219540..6979c33 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -1954,6 +1954,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
1954 | { | 1954 | { |
1955 | if (ParentID != 0) | 1955 | if (ParentID != 0) |
1956 | { | 1956 | { |
1957 | var targetPart = m_scene.GetSceneObjectPart(targetID); | ||
1958 | if (targetPart != null && targetPart.LocalId == ParentID) | ||
1959 | return; // already sitting here, ignore | ||
1960 | |||
1957 | StandUp(); | 1961 | StandUp(); |
1958 | } | 1962 | } |
1959 | 1963 | ||
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSAPIUnman.cs b/OpenSim/Region/Physics/BulletSPlugin/BSAPIUnman.cs index 9ff7084..ae54499 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSAPIUnman.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSAPIUnman.cs | |||
@@ -166,7 +166,7 @@ public override BulletWorld Initialize(Vector3 maxPosition, ConfigurationParamet | |||
166 | 166 | ||
167 | // If Debug logging level, enable logging from the unmanaged code | 167 | // If Debug logging level, enable logging from the unmanaged code |
168 | m_DebugLogCallbackHandle = null; | 168 | m_DebugLogCallbackHandle = null; |
169 | if (BSScene.m_log.IsDebugEnabled || PhysicsScene.PhysicsLogging.Enabled) | 169 | if (BSScene.m_log.IsDebugEnabled && PhysicsScene.PhysicsLogging.Enabled) |
170 | { | 170 | { |
171 | BSScene.m_log.DebugFormat("{0}: Initialize: Setting debug callback for unmanaged code", BSScene.LogHeader); | 171 | BSScene.m_log.DebugFormat("{0}: Initialize: Setting debug callback for unmanaged code", BSScene.LogHeader); |
172 | if (PhysicsScene.PhysicsLogging.Enabled) | 172 | if (PhysicsScene.PhysicsLogging.Enabled) |
@@ -212,6 +212,19 @@ public override void Shutdown(BulletWorld world) | |||
212 | { | 212 | { |
213 | BulletWorldUnman worldu = world as BulletWorldUnman; | 213 | BulletWorldUnman worldu = world as BulletWorldUnman; |
214 | BSAPICPP.Shutdown2(worldu.ptr); | 214 | BSAPICPP.Shutdown2(worldu.ptr); |
215 | |||
216 | if (m_paramsHandle.IsAllocated) | ||
217 | { | ||
218 | m_paramsHandle.Free(); | ||
219 | } | ||
220 | if (m_collisionArrayPinnedHandle.IsAllocated) | ||
221 | { | ||
222 | m_collisionArrayPinnedHandle.Free(); | ||
223 | } | ||
224 | if (m_updateArrayPinnedHandle.IsAllocated) | ||
225 | { | ||
226 | m_updateArrayPinnedHandle.Free(); | ||
227 | } | ||
215 | } | 228 | } |
216 | 229 | ||
217 | public override bool PushUpdate(BulletBody obj) | 230 | public override bool PushUpdate(BulletBody obj) |
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs b/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs index a5fec87..87a06c1 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs | |||
@@ -215,7 +215,7 @@ public sealed class BSCharacter : BSPhysObject | |||
215 | // Add special movement force to allow avatars to walk up stepped surfaces. | 215 | // Add special movement force to allow avatars to walk up stepped surfaces. |
216 | moveForce += WalkUpStairs(); | 216 | moveForce += WalkUpStairs(); |
217 | 217 | ||
218 | DetailLog("{0},BSCharacter.MoveMotor,move,stepVel={1},vel={2},mass={3},moveForce={4}", LocalID, stepVelocity, _velocity, Mass, moveForce); | 218 | // DetailLog("{0},BSCharacter.MoveMotor,move,stepVel={1},vel={2},mass={3},moveForce={4}", LocalID, stepVelocity, _velocity, Mass, moveForce); |
219 | PhysicsScene.PE.ApplyCentralImpulse(PhysBody, moveForce); | 219 | PhysicsScene.PE.ApplyCentralImpulse(PhysBody, moveForce); |
220 | }); | 220 | }); |
221 | } | 221 | } |
@@ -855,7 +855,10 @@ public sealed class BSCharacter : BSPhysObject | |||
855 | _rotationalVelocity = entprop.RotationalVelocity; | 855 | _rotationalVelocity = entprop.RotationalVelocity; |
856 | 856 | ||
857 | // Do some sanity checking for the avatar. Make sure it's above ground and inbounds. | 857 | // Do some sanity checking for the avatar. Make sure it's above ground and inbounds. |
858 | PositionSanityCheck(true); | 858 | if (PositionSanityCheck(true)) |
859 | { | ||
860 | entprop.Position = _position; | ||
861 | } | ||
859 | 862 | ||
860 | // remember the current and last set values | 863 | // remember the current and last set values |
861 | LastEntityProperties = CurrentEntityProperties; | 864 | LastEntityProperties = CurrentEntityProperties; |
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs b/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs index bcebaec..6601479 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs | |||
@@ -124,9 +124,9 @@ namespace OpenSim.Region.Physics.BulletSPlugin | |||
124 | static readonly float PIOverTwo = ((float)Math.PI) / 2f; | 124 | static readonly float PIOverTwo = ((float)Math.PI) / 2f; |
125 | 125 | ||
126 | // For debugging, flags to turn on and off individual corrections. | 126 | // For debugging, flags to turn on and off individual corrections. |
127 | private bool enableAngularVerticalAttraction = true; | 127 | private bool enableAngularVerticalAttraction; |
128 | private bool enableAngularDeflection = true; | 128 | private bool enableAngularDeflection; |
129 | private bool enableAngularBanking = true; | 129 | private bool enableAngularBanking; |
130 | 130 | ||
131 | public BSDynamics(BSScene myScene, BSPrim myPrim) | 131 | public BSDynamics(BSScene myScene, BSPrim myPrim) |
132 | { | 132 | { |
@@ -141,8 +141,8 @@ namespace OpenSim.Region.Physics.BulletSPlugin | |||
141 | public void SetupVehicleDebugging() | 141 | public void SetupVehicleDebugging() |
142 | { | 142 | { |
143 | enableAngularVerticalAttraction = true; | 143 | enableAngularVerticalAttraction = true; |
144 | enableAngularDeflection = true; | 144 | enableAngularDeflection = false; |
145 | enableAngularBanking = true; | 145 | enableAngularBanking = false; |
146 | if (BSParam.VehicleDebuggingEnabled != ConfigurationParameters.numericFalse) | 146 | if (BSParam.VehicleDebuggingEnabled != ConfigurationParameters.numericFalse) |
147 | { | 147 | { |
148 | enableAngularVerticalAttraction = false; | 148 | enableAngularVerticalAttraction = false; |
@@ -649,6 +649,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin | |||
649 | private Quaternion m_knownOrientation; | 649 | private Quaternion m_knownOrientation; |
650 | private Vector3 m_knownRotationalVelocity; | 650 | private Vector3 m_knownRotationalVelocity; |
651 | private Vector3 m_knownRotationalForce; | 651 | private Vector3 m_knownRotationalForce; |
652 | private Vector3 m_knownRotationalImpulse; | ||
652 | private Vector3 m_knownForwardVelocity; // vehicle relative forward speed | 653 | private Vector3 m_knownForwardVelocity; // vehicle relative forward speed |
653 | 654 | ||
654 | private const int m_knownChangedPosition = 1 << 0; | 655 | private const int m_knownChangedPosition = 1 << 0; |
@@ -658,9 +659,10 @@ namespace OpenSim.Region.Physics.BulletSPlugin | |||
658 | private const int m_knownChangedOrientation = 1 << 4; | 659 | private const int m_knownChangedOrientation = 1 << 4; |
659 | private const int m_knownChangedRotationalVelocity = 1 << 5; | 660 | private const int m_knownChangedRotationalVelocity = 1 << 5; |
660 | private const int m_knownChangedRotationalForce = 1 << 6; | 661 | private const int m_knownChangedRotationalForce = 1 << 6; |
661 | private const int m_knownChangedTerrainHeight = 1 << 7; | 662 | private const int m_knownChangedRotationalImpulse = 1 << 7; |
662 | private const int m_knownChangedWaterLevel = 1 << 8; | 663 | private const int m_knownChangedTerrainHeight = 1 << 8; |
663 | private const int m_knownChangedForwardVelocity = 1 << 9; | 664 | private const int m_knownChangedWaterLevel = 1 << 9; |
665 | private const int m_knownChangedForwardVelocity = 1 <<10; | ||
664 | 666 | ||
665 | private void ForgetKnownVehicleProperties() | 667 | private void ForgetKnownVehicleProperties() |
666 | { | 668 | { |
@@ -700,6 +702,9 @@ namespace OpenSim.Region.Physics.BulletSPlugin | |||
700 | PhysicsScene.PE.SetInterpolationAngularVelocity(Prim.PhysBody, m_knownRotationalVelocity); | 702 | PhysicsScene.PE.SetInterpolationAngularVelocity(Prim.PhysBody, m_knownRotationalVelocity); |
701 | } | 703 | } |
702 | 704 | ||
705 | if ((m_knownChanged & m_knownChangedRotationalImpulse) != 0) | ||
706 | Prim.ApplyTorqueImpulse((Vector3)m_knownRotationalImpulse, true /*inTaintTime*/); | ||
707 | |||
703 | if ((m_knownChanged & m_knownChangedRotationalForce) != 0) | 708 | if ((m_knownChanged & m_knownChangedRotationalForce) != 0) |
704 | { | 709 | { |
705 | Prim.AddAngularForce((Vector3)m_knownRotationalForce, false /*pushForce*/, true /*inTaintTime*/); | 710 | Prim.AddAngularForce((Vector3)m_knownRotationalForce, false /*pushForce*/, true /*inTaintTime*/); |
@@ -843,6 +848,17 @@ namespace OpenSim.Region.Physics.BulletSPlugin | |||
843 | m_knownChanged |= m_knownChangedRotationalForce; | 848 | m_knownChanged |= m_knownChangedRotationalForce; |
844 | m_knownHas |= m_knownChangedRotationalForce; | 849 | m_knownHas |= m_knownChangedRotationalForce; |
845 | } | 850 | } |
851 | private void VehicleAddRotationalImpulse(Vector3 pImpulse) | ||
852 | { | ||
853 | if ((m_knownHas & m_knownChangedRotationalImpulse) == 0) | ||
854 | { | ||
855 | m_knownRotationalImpulse = Vector3.Zero; | ||
856 | m_knownHas |= m_knownChangedRotationalImpulse; | ||
857 | } | ||
858 | m_knownRotationalImpulse += pImpulse; | ||
859 | m_knownChanged |= m_knownChangedRotationalImpulse; | ||
860 | } | ||
861 | |||
846 | // Vehicle relative forward velocity | 862 | // Vehicle relative forward velocity |
847 | private Vector3 VehicleForwardVelocity | 863 | private Vector3 VehicleForwardVelocity |
848 | { | 864 | { |
@@ -1031,16 +1047,32 @@ namespace OpenSim.Region.Physics.BulletSPlugin | |||
1031 | else | 1047 | else |
1032 | { | 1048 | { |
1033 | // Error is positive if below the target and negative if above. | 1049 | // Error is positive if below the target and negative if above. |
1034 | float verticalError = m_VhoverTargetHeight - VehiclePosition.Z; | 1050 | Vector3 hpos = VehiclePosition; |
1035 | float verticalCorrectionVelocity = verticalError / m_VhoverTimescale * pTimestep; | 1051 | float verticalError = m_VhoverTargetHeight - hpos.Z; |
1052 | float verticalCorrection = verticalError / m_VhoverTimescale; | ||
1053 | verticalCorrection *= m_VhoverEfficiency; | ||
1054 | |||
1055 | hpos.Z += verticalCorrection; | ||
1056 | VehiclePosition = hpos; | ||
1057 | |||
1058 | // Since we are hovering, we need to do the opposite of falling -- get rid of world Z | ||
1059 | Vector3 vel = VehicleVelocity; | ||
1060 | vel.Z = 0f; | ||
1061 | VehicleVelocity = vel; | ||
1062 | |||
1063 | /* | ||
1064 | float verticalCorrectionVelocity = verticalError / m_VhoverTimescale; | ||
1065 | Vector3 verticalCorrection = new Vector3(0f, 0f, verticalCorrectionVelocity); | ||
1066 | verticalCorrection *= m_vehicleMass; | ||
1036 | 1067 | ||
1037 | // TODO: implement m_VhoverEfficiency correctly | 1068 | // TODO: implement m_VhoverEfficiency correctly |
1038 | VehicleAddForceImpulse(new Vector3(0f, 0f, verticalCorrectionVelocity)); | 1069 | VehicleAddForceImpulse(verticalCorrection); |
1070 | */ | ||
1039 | 1071 | ||
1040 | VDetailLog("{0}, MoveLinear,hover,pos={1},eff={2},hoverTS={3},height={4},target={5},err={6},corrVel={7}", | 1072 | VDetailLog("{0}, MoveLinear,hover,pos={1},eff={2},hoverTS={3},height={4},target={5},err={6},corr={7}", |
1041 | Prim.LocalID, VehiclePosition, m_VhoverEfficiency, | 1073 | Prim.LocalID, VehiclePosition, m_VhoverEfficiency, |
1042 | m_VhoverTimescale, m_VhoverHeight, m_VhoverTargetHeight, | 1074 | m_VhoverTimescale, m_VhoverHeight, m_VhoverTargetHeight, |
1043 | verticalError, verticalCorrectionVelocity); | 1075 | verticalError, verticalCorrection); |
1044 | } | 1076 | } |
1045 | 1077 | ||
1046 | } | 1078 | } |
@@ -1128,8 +1160,10 @@ namespace OpenSim.Region.Physics.BulletSPlugin | |||
1128 | if (!Prim.IsColliding && VehicleVelocity.Z > 0.1) | 1160 | if (!Prim.IsColliding && VehicleVelocity.Z > 0.1) |
1129 | { | 1161 | { |
1130 | // Get rid of any of the velocity vector that is pushing us up. | 1162 | // Get rid of any of the velocity vector that is pushing us up. |
1131 | VehicleVelocity += new Vector3(0, 0, -VehicleVelocity.Z); | 1163 | float upVelocity = VehicleVelocity.Z; |
1164 | VehicleVelocity += new Vector3(0, 0, -upVelocity); | ||
1132 | 1165 | ||
1166 | /* | ||
1133 | // If we're pointed up into the air, we should nose down | 1167 | // If we're pointed up into the air, we should nose down |
1134 | Vector3 pointingDirection = Vector3.UnitX * VehicleOrientation; | 1168 | Vector3 pointingDirection = Vector3.UnitX * VehicleOrientation; |
1135 | // The rotation around the Y axis is pitch up or down | 1169 | // The rotation around the Y axis is pitch up or down |
@@ -1143,11 +1177,9 @@ namespace OpenSim.Region.Physics.BulletSPlugin | |||
1143 | VDetailLog("{0}, MoveLinear,limitMotorUp,newVel={1},pntDir={2},corrFrc={3},aCorr={4}", | 1177 | VDetailLog("{0}, MoveLinear,limitMotorUp,newVel={1},pntDir={2},corrFrc={3},aCorr={4}", |
1144 | Prim.LocalID, VehicleVelocity, pointingDirection, angularCorrectionForce, angularCorrectionVector); | 1178 | Prim.LocalID, VehicleVelocity, pointingDirection, angularCorrectionForce, angularCorrectionVector); |
1145 | } | 1179 | } |
1146 | else | 1180 | */ |
1147 | { | 1181 | VDetailLog("{0}, MoveLinear,limitMotorUp,collide={1},upVel={2},newVel={3}", |
1148 | VDetailLog("{0}, MoveLinear,limitMotorUp,newVel={1},pntDir={2}", | 1182 | Prim.LocalID, Prim.IsColliding, upVelocity, VehicleVelocity); |
1149 | Prim.LocalID, VehicleVelocity, pointingDirection); | ||
1150 | } | ||
1151 | } | 1183 | } |
1152 | } | 1184 | } |
1153 | } | 1185 | } |
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs b/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs index 5a1b5c7..8c9a774 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs | |||
@@ -108,8 +108,8 @@ public sealed class BSLinksetCompound : BSLinkset | |||
108 | // Schedule a refresh to happen after all the other taint processing. | 108 | // Schedule a refresh to happen after all the other taint processing. |
109 | private void ScheduleRebuild(BSPhysObject requestor) | 109 | private void ScheduleRebuild(BSPhysObject requestor) |
110 | { | 110 | { |
111 | DetailLog("{0},BSLinksetCompound.ScheduleRebuild,,rebuilding={1},hasChildren={2}", | 111 | DetailLog("{0},BSLinksetCompound.ScheduleRebuild,,rebuilding={1},hasChildren={2},actuallyScheduling={3}", |
112 | requestor.LocalID, Rebuilding, HasAnyChildren); | 112 | requestor.LocalID, Rebuilding, HasAnyChildren, (!Rebuilding && HasAnyChildren)); |
113 | // When rebuilding, it is possible to set properties that would normally require a rebuild. | 113 | // When rebuilding, it is possible to set properties that would normally require a rebuild. |
114 | // If already rebuilding, don't request another rebuild. | 114 | // If already rebuilding, don't request another rebuild. |
115 | // If a linkset with just a root prim (simple non-linked prim) don't bother rebuilding. | 115 | // If a linkset with just a root prim (simple non-linked prim) don't bother rebuilding. |
@@ -195,8 +195,11 @@ public sealed class BSLinksetCompound : BSLinkset | |||
195 | && PhysicsScene.TerrainManager.IsWithinKnownTerrain(LinksetRoot.RawPosition)) | 195 | && PhysicsScene.TerrainManager.IsWithinKnownTerrain(LinksetRoot.RawPosition)) |
196 | { | 196 | { |
197 | // TODO: replace this with are calculation of the child prim's orientation and pos. | 197 | // TODO: replace this with are calculation of the child prim's orientation and pos. |
198 | updated.LinksetInfo = null; | 198 | // TODO: for the moment, don't rebuild the compound shape. |
199 | ScheduleRebuild(updated); | 199 | // This is often just the car turning its wheels. When we can just reorient the one |
200 | // member shape of the compound shape, the overhead of rebuilding won't be a problem. | ||
201 | // updated.LinksetInfo = null; | ||
202 | // ScheduleRebuild(updated); | ||
200 | } | 203 | } |
201 | } | 204 | } |
202 | 205 | ||
@@ -308,7 +311,7 @@ public sealed class BSLinksetCompound : BSLinkset | |||
308 | else | 311 | else |
309 | { | 312 | { |
310 | // Rebuild the compound shape with the child removed | 313 | // Rebuild the compound shape with the child removed |
311 | ScheduleRebuild(child); | 314 | ScheduleRebuild(LinksetRoot); |
312 | } | 315 | } |
313 | } | 316 | } |
314 | return; | 317 | return; |
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs index 27ff047..3e80aa4 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs | |||
@@ -94,16 +94,16 @@ public static class BSParam | |||
94 | public static float PID_D { get; private set; } // derivative | 94 | public static float PID_D { get; private set; } // derivative |
95 | public static float PID_P { get; private set; } // proportional | 95 | public static float PID_P { get; private set; } // proportional |
96 | 96 | ||
97 | // Various constants that come from that other virtual world that shall not be named | 97 | // Various constants that come from that other virtual world that shall not be named. |
98 | public const float MinGravityZ = -1f; | 98 | public const float MinGravityZ = -1f; |
99 | public const float MaxGravityZ = 28f; | 99 | public const float MaxGravityZ = 28f; |
100 | public const float MinFriction = 0f; | 100 | public const float MinFriction = 0f; |
101 | public const float MaxFriction = 255f; | 101 | public const float MaxFriction = 255f; |
102 | public const float MinDensity = 0f; | 102 | public const float MinDensity = 0.01f; |
103 | public const float MaxDensity = 22587f; | 103 | public const float MaxDensity = 22587f; |
104 | public const float MinRestitution = 0f; | 104 | public const float MinRestitution = 0f; |
105 | public const float MaxRestitution = 1f; | 105 | public const float MaxRestitution = 1f; |
106 | public const float MaxAddForceMagnitude = 20000f; | 106 | public const float MaxAddForceMagnitude = 20f; |
107 | 107 | ||
108 | // =========================================================================== | 108 | // =========================================================================== |
109 | public delegate void ParamUser(BSScene scene, IConfig conf, string paramName, float val); | 109 | public delegate void ParamUser(BSScene scene, IConfig conf, string paramName, float val); |
@@ -318,13 +318,13 @@ public static class BSParam | |||
318 | (s,p,l,v) => { s.UpdateParameterObject((x)=>{AngularSleepingThreshold=x;}, p, l, v); }, | 318 | (s,p,l,v) => { s.UpdateParameterObject((x)=>{AngularSleepingThreshold=x;}, p, l, v); }, |
319 | (s,o,v) => { s.PE.SetSleepingThresholds(o.PhysBody, v, v); } ), | 319 | (s,o,v) => { s.PE.SetSleepingThresholds(o.PhysBody, v, v); } ), |
320 | new ParameterDefn("CcdMotionThreshold", "Continuious collision detection threshold (0 means no CCD)" , | 320 | new ParameterDefn("CcdMotionThreshold", "Continuious collision detection threshold (0 means no CCD)" , |
321 | 0f, // set to zero to disable | 321 | 0.3f, // set to zero to disable |
322 | (s,cf,p,v) => { CcdMotionThreshold = cf.GetFloat(p, v); }, | 322 | (s,cf,p,v) => { CcdMotionThreshold = cf.GetFloat(p, v); }, |
323 | (s) => { return CcdMotionThreshold; }, | 323 | (s) => { return CcdMotionThreshold; }, |
324 | (s,p,l,v) => { s.UpdateParameterObject((x)=>{CcdMotionThreshold=x;}, p, l, v); }, | 324 | (s,p,l,v) => { s.UpdateParameterObject((x)=>{CcdMotionThreshold=x;}, p, l, v); }, |
325 | (s,o,v) => { s.PE.SetCcdMotionThreshold(o.PhysBody, v); } ), | 325 | (s,o,v) => { s.PE.SetCcdMotionThreshold(o.PhysBody, v); } ), |
326 | new ParameterDefn("CcdSweptSphereRadius", "Continuious collision detection test radius" , | 326 | new ParameterDefn("CcdSweptSphereRadius", "Continuious collision detection test radius" , |
327 | 0f, | 327 | 0.2f, |
328 | (s,cf,p,v) => { CcdSweptSphereRadius = cf.GetFloat(p, v); }, | 328 | (s,cf,p,v) => { CcdSweptSphereRadius = cf.GetFloat(p, v); }, |
329 | (s) => { return CcdSweptSphereRadius; }, | 329 | (s) => { return CcdSweptSphereRadius; }, |
330 | (s,p,l,v) => { s.UpdateParameterObject((x)=>{CcdSweptSphereRadius=x;}, p, l, v); }, | 330 | (s,p,l,v) => { s.UpdateParameterObject((x)=>{CcdSweptSphereRadius=x;}, p, l, v); }, |
@@ -465,7 +465,7 @@ public static class BSParam | |||
465 | (s) => { return s.UnmanagedParams[0].shouldSplitSimulationIslands; }, | 465 | (s) => { return s.UnmanagedParams[0].shouldSplitSimulationIslands; }, |
466 | (s,p,l,v) => { s.UnmanagedParams[0].shouldSplitSimulationIslands = v; } ), | 466 | (s,p,l,v) => { s.UnmanagedParams[0].shouldSplitSimulationIslands = v; } ), |
467 | new ParameterDefn("ShouldEnableFrictionCaching", "Enable friction computation caching", | 467 | new ParameterDefn("ShouldEnableFrictionCaching", "Enable friction computation caching", |
468 | ConfigurationParameters.numericFalse, | 468 | ConfigurationParameters.numericTrue, |
469 | (s,cf,p,v) => { s.UnmanagedParams[0].shouldEnableFrictionCaching = BSParam.NumericBool(cf.GetBoolean(p, BSParam.BoolNumeric(v))); }, | 469 | (s,cf,p,v) => { s.UnmanagedParams[0].shouldEnableFrictionCaching = BSParam.NumericBool(cf.GetBoolean(p, BSParam.BoolNumeric(v))); }, |
470 | (s) => { return s.UnmanagedParams[0].shouldEnableFrictionCaching; }, | 470 | (s) => { return s.UnmanagedParams[0].shouldEnableFrictionCaching; }, |
471 | (s,p,l,v) => { s.UnmanagedParams[0].shouldEnableFrictionCaching = v; } ), | 471 | (s,p,l,v) => { s.UnmanagedParams[0].shouldEnableFrictionCaching = v; } ), |
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs b/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs index addab29..9fbfcdc 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs | |||
@@ -442,7 +442,8 @@ public sealed class BSShapeCollection : IDisposable | |||
442 | return ret; | 442 | return ret; |
443 | } | 443 | } |
444 | 444 | ||
445 | // Create a mesh/hull shape or a native shape if 'nativeShapePossible' is 'true'. | 445 | // Create a mesh, hull or native shape. |
446 | // Return 'true' if the prim's shape was changed. | ||
446 | public bool CreateGeomNonSpecial(bool forceRebuild, BSPhysObject prim, ShapeDestructionCallback shapeCallback) | 447 | public bool CreateGeomNonSpecial(bool forceRebuild, BSPhysObject prim, ShapeDestructionCallback shapeCallback) |
447 | { | 448 | { |
448 | bool ret = false; | 449 | bool ret = false; |
@@ -472,7 +473,7 @@ public sealed class BSShapeCollection : IDisposable | |||
472 | if (DDetail) DetailLog("{0},BSShapeCollection.CreateGeom,maybeNative,force={1},primScale={2},primSize={3},primShape={4}", | 473 | if (DDetail) DetailLog("{0},BSShapeCollection.CreateGeom,maybeNative,force={1},primScale={2},primSize={3},primShape={4}", |
473 | prim.LocalID, forceRebuild, prim.Scale, prim.Size, prim.PhysShape.type); | 474 | prim.LocalID, forceRebuild, prim.Scale, prim.Size, prim.PhysShape.type); |
474 | 475 | ||
475 | // It doesn't look like Bullet scales spheres so make sure the scales are all equal | 476 | // It doesn't look like Bullet scales native spheres so make sure the scales are all equal |
476 | if ((pbs.ProfileShape == ProfileShape.HalfCircle && pbs.PathCurve == (byte)Extrusion.Curve1) | 477 | if ((pbs.ProfileShape == ProfileShape.HalfCircle && pbs.PathCurve == (byte)Extrusion.Curve1) |
477 | && pbs.Scale.X == pbs.Scale.Y && pbs.Scale.Y == pbs.Scale.Z) | 478 | && pbs.Scale.X == pbs.Scale.Y && pbs.Scale.Y == pbs.Scale.Z) |
478 | { | 479 | { |
@@ -484,9 +485,9 @@ public sealed class BSShapeCollection : IDisposable | |||
484 | { | 485 | { |
485 | ret = GetReferenceToNativeShape(prim, BSPhysicsShapeType.SHAPE_SPHERE, | 486 | ret = GetReferenceToNativeShape(prim, BSPhysicsShapeType.SHAPE_SPHERE, |
486 | FixedShapeKey.KEY_SPHERE, shapeCallback); | 487 | FixedShapeKey.KEY_SPHERE, shapeCallback); |
487 | if (DDetail) DetailLog("{0},BSShapeCollection.CreateGeom,sphere,force={1},shape={2}", | ||
488 | prim.LocalID, forceRebuild, prim.PhysShape); | ||
489 | } | 488 | } |
489 | if (DDetail) DetailLog("{0},BSShapeCollection.CreateGeom,sphere,force={1},rebuilt={2},shape={3}", | ||
490 | prim.LocalID, forceRebuild, ret, prim.PhysShape); | ||
490 | } | 491 | } |
491 | if (!haveShape && pbs.ProfileShape == ProfileShape.Square && pbs.PathCurve == (byte)Extrusion.Straight) | 492 | if (!haveShape && pbs.ProfileShape == ProfileShape.Square && pbs.PathCurve == (byte)Extrusion.Straight) |
492 | { | 493 | { |
@@ -498,9 +499,9 @@ public sealed class BSShapeCollection : IDisposable | |||
498 | { | 499 | { |
499 | ret = GetReferenceToNativeShape( prim, BSPhysicsShapeType.SHAPE_BOX, | 500 | ret = GetReferenceToNativeShape( prim, BSPhysicsShapeType.SHAPE_BOX, |
500 | FixedShapeKey.KEY_BOX, shapeCallback); | 501 | FixedShapeKey.KEY_BOX, shapeCallback); |
501 | if (DDetail) DetailLog("{0},BSShapeCollection.CreateGeom,box,force={1},shape={2}", | ||
502 | prim.LocalID, forceRebuild, prim.PhysShape); | ||
503 | } | 502 | } |
503 | if (DDetail) DetailLog("{0},BSShapeCollection.CreateGeom,box,force={1},rebuilt={2},shape={3}", | ||
504 | prim.LocalID, forceRebuild, ret, prim.PhysShape); | ||
504 | } | 505 | } |
505 | } | 506 | } |
506 | 507 | ||
@@ -513,6 +514,7 @@ public sealed class BSShapeCollection : IDisposable | |||
513 | return ret; | 514 | return ret; |
514 | } | 515 | } |
515 | 516 | ||
517 | // return 'true' if the prim's shape was changed. | ||
516 | public bool CreateGeomMeshOrHull(BSPhysObject prim, ShapeDestructionCallback shapeCallback) | 518 | public bool CreateGeomMeshOrHull(BSPhysObject prim, ShapeDestructionCallback shapeCallback) |
517 | { | 519 | { |
518 | 520 | ||
@@ -872,8 +874,7 @@ public sealed class BSShapeCollection : IDisposable | |||
872 | { | 874 | { |
873 | prim.LastAssetBuildFailed = true; | 875 | prim.LastAssetBuildFailed = true; |
874 | BSPhysObject xprim = prim; | 876 | BSPhysObject xprim = prim; |
875 | DetailLog("{0},BSShapeCollection.VerifyMeshCreated,fetchAsset,lID={1},lastFailed={2}", | 877 | DetailLog("{0},BSShapeCollection.VerifyMeshCreated,fetchAsset,lastFailed={1}", prim.LocalID, prim.LastAssetBuildFailed); |
876 | LogHeader, prim.LocalID, prim.LastAssetBuildFailed); | ||
877 | Util.FireAndForget(delegate | 878 | Util.FireAndForget(delegate |
878 | { | 879 | { |
879 | RequestAssetDelegate assetProvider = PhysicsScene.RequestAssetMethod; | 880 | RequestAssetDelegate assetProvider = PhysicsScene.RequestAssetMethod; |
@@ -882,19 +883,34 @@ public sealed class BSShapeCollection : IDisposable | |||
882 | BSPhysObject yprim = xprim; // probably not necessary, but, just in case. | 883 | BSPhysObject yprim = xprim; // probably not necessary, but, just in case. |
883 | assetProvider(yprim.BaseShape.SculptTexture, delegate(AssetBase asset) | 884 | assetProvider(yprim.BaseShape.SculptTexture, delegate(AssetBase asset) |
884 | { | 885 | { |
885 | if (!yprim.BaseShape.SculptEntry) | 886 | bool assetFound = false; // DEBUG DEBUG |
886 | return; | 887 | string mismatchIDs = String.Empty; // DEBUG DEBUG |
887 | if (yprim.BaseShape.SculptTexture.ToString() != asset.ID) | 888 | if (yprim.BaseShape.SculptEntry) |
888 | return; | 889 | { |
889 | 890 | if (yprim.BaseShape.SculptTexture.ToString() == asset.ID) | |
890 | yprim.BaseShape.SculptData = asset.Data; | 891 | { |
891 | // This will cause the prim to see that the filler shape is not the right | 892 | yprim.BaseShape.SculptData = asset.Data; |
892 | // one and try again to build the object. | 893 | // This will cause the prim to see that the filler shape is not the right |
893 | // No race condition with the normal shape setting since the rebuild is at taint time. | 894 | // one and try again to build the object. |
894 | yprim.ForceBodyShapeRebuild(false); | 895 | // No race condition with the normal shape setting since the rebuild is at taint time. |
896 | yprim.ForceBodyShapeRebuild(false /* inTaintTime */); | ||
897 | assetFound = true; | ||
898 | } | ||
899 | else | ||
900 | { | ||
901 | mismatchIDs = yprim.BaseShape.SculptTexture.ToString() + "/" + asset.ID; | ||
902 | } | ||
903 | } | ||
904 | DetailLog("{0},BSShapeCollection,fetchAssetCallback,found={1},isSculpt={2},ids={3}", | ||
905 | yprim.LocalID, assetFound, yprim.BaseShape.SculptEntry, mismatchIDs ); | ||
895 | 906 | ||
896 | }); | 907 | }); |
897 | } | 908 | } |
909 | else | ||
910 | { | ||
911 | PhysicsScene.Logger.ErrorFormat("{0} Physical object requires asset but no asset provider. Name={1}", | ||
912 | LogHeader, PhysicsScene.Name); | ||
913 | } | ||
898 | }); | 914 | }); |
899 | } | 915 | } |
900 | else | 916 | else |
@@ -906,9 +922,9 @@ public sealed class BSShapeCollection : IDisposable | |||
906 | } | 922 | } |
907 | } | 923 | } |
908 | 924 | ||
909 | // While we figure out the real problem, stick in a simple box for the object. | 925 | // While we wait for the mesh defining asset to be loaded, stick in a simple box for the object. |
910 | BulletShape fillinShape = | 926 | BulletShape fillinShape = BuildPhysicalNativeShape(prim, BSPhysicsShapeType.SHAPE_BOX, FixedShapeKey.KEY_BOX); |
911 | BuildPhysicalNativeShape(prim, BSPhysicsShapeType.SHAPE_BOX, FixedShapeKey.KEY_BOX); | 927 | DetailLog("{0},BSShapeCollection.VerifyMeshCreated,boxTempShape", prim.LocalID); |
912 | 928 | ||
913 | return fillinShape; | 929 | return fillinShape; |
914 | } | 930 | } |
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BulletSimTODO.txt b/OpenSim/Region/Physics/BulletSPlugin/BulletSimTODO.txt index 59cbab9..d4545f7 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BulletSimTODO.txt +++ b/OpenSim/Region/Physics/BulletSPlugin/BulletSimTODO.txt | |||
@@ -1,7 +1,14 @@ | |||
1 | CURRENT PRIORITIES | 1 | CURRENT PRIORITIES |
2 | ================================================= | 2 | ================================================= |
3 | Mantis 6040 script http://opensimulator.org/mantis/view.php?id=6040 | ||
4 | Msg Kayaker on OSGrid when working | ||
5 | Teravus llMoveToTarget script debug | ||
6 | Mixing of hover, buoyancy/gravity, moveToTarget, into one force | ||
7 | Boats floating at proper level | ||
3 | Nebadon vehicles turning funny in arena | 8 | Nebadon vehicles turning funny in arena |
4 | limitMotorUp calibration (more down?) | 9 | limitMotorUp calibration (more down?) |
10 | llRotLookAt | ||
11 | llLookAt | ||
5 | Vehicle angular vertical attraction | 12 | Vehicle angular vertical attraction |
6 | Vehicle angular deflection | 13 | Vehicle angular deflection |
7 | Preferred orientation angular correction fix | 14 | Preferred orientation angular correction fix |
@@ -9,8 +16,6 @@ vehicle angular banking | |||
9 | Avatars walking up stairs (HALF DONE) | 16 | Avatars walking up stairs (HALF DONE) |
10 | Radius of the capsule affects ability to climb edges. | 17 | Radius of the capsule affects ability to climb edges. |
11 | Vehicle movement on terrain smoothness | 18 | Vehicle movement on terrain smoothness |
12 | Surfboard go wonky when turning | ||
13 | Angular motor direction is global coordinates rather than local coordinates? | ||
14 | Boats float low in the water (DONE) | 19 | Boats float low in the water (DONE) |
15 | Avatar movement | 20 | Avatar movement |
16 | flying into a wall doesn't stop avatar who keeps appearing to move through the obstacle (DONE) | 21 | flying into a wall doesn't stop avatar who keeps appearing to move through the obstacle (DONE) |
@@ -27,6 +32,10 @@ Add material densities to the material types | |||
27 | 32 | ||
28 | CRASHES | 33 | CRASHES |
29 | ================================================= | 34 | ================================================= |
35 | Crazyness during 20130115 office hours was PositionAdjustUnderground for both char and prim | ||
36 | m1:logs/20130115.0934/physics-BulletSim-20130115083613.log | ||
37 | Creation of Neb's terrain made the terrain "disappear". Everything started to fall | ||
38 | and then get restored to be above terrain. | ||
30 | 20121129.1411: editting/moving phys object across region boundries causes crash | 39 | 20121129.1411: editting/moving phys object across region boundries causes crash |
31 | getPos-> btRigidBody::upcast -> getBodyType -> BOOM | 40 | getPos-> btRigidBody::upcast -> getBodyType -> BOOM |
32 | 20121128.1600: mesh object not rezzing (no physics mesh). | 41 | 20121128.1600: mesh object not rezzing (no physics mesh). |
@@ -111,6 +120,8 @@ Physical and phantom will drop through the terrain | |||
111 | 120 | ||
112 | LINKSETS | 121 | LINKSETS |
113 | ====================================================== | 122 | ====================================================== |
123 | Editing a child of a linkset causes the child to go phantom | ||
124 | Move a child prim once when it is physical and can never move it again without it going phantom | ||
114 | Offset the center of the linkset to be the geometric center of all the prims | 125 | Offset the center of the linkset to be the geometric center of all the prims |
115 | Not quite the same as the center-of-gravity | 126 | Not quite the same as the center-of-gravity |
116 | Linksets should allow collisions to individual children | 127 | Linksets should allow collisions to individual children |
@@ -133,6 +144,10 @@ Eliminate collisions between objects in a linkset. (LinksetConstraint) | |||
133 | 144 | ||
134 | MORE | 145 | MORE |
135 | ====================================================== | 146 | ====================================================== |
147 | Create tests for different interface components | ||
148 | Have test objects/scripts measure themselves and turn color if correct/bad | ||
149 | Test functions in SL and calibrate correctness there | ||
150 | Create auto rezzer and tracker to run through the tests | ||
136 | Use the HACD convex hull routine in Bullet rather than the C# version. | 151 | Use the HACD convex hull routine in Bullet rather than the C# version. |
137 | Do we need to do convex hulls all the time? Can complex meshes be left meshes? | 152 | Do we need to do convex hulls all the time? Can complex meshes be left meshes? |
138 | There is some problem with meshes and collisions | 153 | There is some problem with meshes and collisions |
@@ -167,6 +182,7 @@ Enforce physical parameter min/max: | |||
167 | Restitution [0, 1] | 182 | Restitution [0, 1] |
168 | http://wiki.secondlife.com/wiki/Physics_Material_Settings_test | 183 | http://wiki.secondlife.com/wiki/Physics_Material_Settings_test |
169 | Avatar attachments have no mass? http://forums-archive.secondlife.com/54/f0/31796/1.html | 184 | Avatar attachments have no mass? http://forums-archive.secondlife.com/54/f0/31796/1.html |
185 | Keep avatar scaling correct. http://pennycow.blogspot.fr/2011/07/matter-of-scale.html | ||
170 | 186 | ||
171 | INTERNAL IMPROVEMENT/CLEANUP | 187 | INTERNAL IMPROVEMENT/CLEANUP |
172 | ================================================= | 188 | ================================================= |
@@ -287,4 +303,7 @@ Disable activity of passive linkset children. (DONE) | |||
287 | Since the linkset is a compound object, the old prims are left lying | 303 | Since the linkset is a compound object, the old prims are left lying |
288 | around and need to be phantomized so they don't collide, ... | 304 | around and need to be phantomized so they don't collide, ... |
289 | Remove HeightmapInfo from terrain specification (DONE) | 305 | Remove HeightmapInfo from terrain specification (DONE) |
290 | Since C++ code does not need terrain height, this structure et al are not needed. \ No newline at end of file | 306 | Since C++ code does not need terrain height, this structure et al are not needed. |
307 | Surfboard go wonky when turning (DONE) | ||
308 | Angular motor direction is global coordinates rather than local coordinates? | ||
309 | (Resolution: made angular motor direction correct coordinate system) \ No newline at end of file | ||
diff --git a/OpenSim/Region/ScriptEngine/Interfaces/IScriptApi.cs b/OpenSim/Region/ScriptEngine/Interfaces/IScriptApi.cs index 2027ca6..d2323f5 100644 --- a/OpenSim/Region/ScriptEngine/Interfaces/IScriptApi.cs +++ b/OpenSim/Region/ScriptEngine/Interfaces/IScriptApi.cs | |||
@@ -26,9 +26,11 @@ | |||
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.Threading; | ||
29 | using OpenMetaverse; | 30 | using OpenMetaverse; |
30 | using OpenSim.Framework; | 31 | using OpenSim.Framework; |
31 | using OpenSim.Region.Framework.Scenes; | 32 | using OpenSim.Region.Framework.Scenes; |
33 | using OpenSim.Region.ScriptEngine.Shared; | ||
32 | 34 | ||
33 | namespace OpenSim.Region.ScriptEngine.Interfaces | 35 | namespace OpenSim.Region.ScriptEngine.Interfaces |
34 | { | 36 | { |
@@ -38,11 +40,12 @@ namespace OpenSim.Region.ScriptEngine.Interfaces | |||
38 | /// Initialize the API | 40 | /// Initialize the API |
39 | /// </summary> | 41 | /// </summary> |
40 | /// <remarks> | 42 | /// <remarks> |
41 | /// Each API has an identifier, which is used to load the | 43 | /// Each API has an identifier, which is used to load the proper runtime assembly at load time. |
42 | /// proper runtime assembly at load time. | 44 | /// <param name='scriptEngine'>/param> |
43 | /// <param name='engine'>/param> | 45 | /// <param name='host'>/param> |
44 | /// <param name='part'></param> | 46 | /// <param name='item'>/param> |
45 | /// <param name='item'></param> | 47 | /// <param name='coopSleepHandle'>/param> |
46 | void Initialize(IScriptEngine engine, SceneObjectPart part, TaskInventoryItem item); | 48 | void Initialize( |
49 | IScriptEngine scriptEngine, SceneObjectPart host, TaskInventoryItem item, EventWaitHandle coopSleepHandle); | ||
47 | } | 50 | } |
48 | } \ No newline at end of file | 51 | } \ No newline at end of file |
diff --git a/OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs b/OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs index 2f5b526..f68612c 100644 --- a/OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs +++ b/OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs | |||
@@ -28,9 +28,11 @@ | |||
28 | using System; | 28 | using System; |
29 | using System.Collections; | 29 | using System.Collections; |
30 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
31 | using System.Threading; | ||
31 | using OpenMetaverse; | 32 | using OpenMetaverse; |
32 | using log4net; | 33 | using log4net; |
33 | using OpenSim.Framework; | 34 | using OpenSim.Framework; |
35 | using OpenSim.Region.Framework.Scenes; | ||
34 | using OpenSim.Region.ScriptEngine.Shared; | 36 | using OpenSim.Region.ScriptEngine.Shared; |
35 | using OpenSim.Region.ScriptEngine.Interfaces; | 37 | using OpenSim.Region.ScriptEngine.Interfaces; |
36 | 38 | ||
@@ -105,6 +107,11 @@ namespace OpenSim.Region.ScriptEngine.Interfaces | |||
105 | /// </summary> | 107 | /// </summary> |
106 | long MeasurementPeriodExecutionTime { get; } | 108 | long MeasurementPeriodExecutionTime { get; } |
107 | 109 | ||
110 | /// <summary> | ||
111 | /// Scene part in which this script instance is contained. | ||
112 | /// </summary> | ||
113 | SceneObjectPart Part { get; } | ||
114 | |||
108 | IScriptEngine Engine { get; } | 115 | IScriptEngine Engine { get; } |
109 | UUID AppDomain { get; set; } | 116 | UUID AppDomain { get; set; } |
110 | string PrimName { get; } | 117 | string PrimName { get; } |
@@ -124,6 +131,12 @@ namespace OpenSim.Region.ScriptEngine.Interfaces | |||
124 | 131 | ||
125 | uint LocalID { get; } | 132 | uint LocalID { get; } |
126 | UUID AssetID { get; } | 133 | UUID AssetID { get; } |
134 | |||
135 | /// <summary> | ||
136 | /// Inventory item containing the script used. | ||
137 | /// </summary> | ||
138 | TaskInventoryItem ScriptTask { get; } | ||
139 | |||
127 | Queue EventQueue { get; } | 140 | Queue EventQueue { get; } |
128 | 141 | ||
129 | /// <summary> | 142 | /// <summary> |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index ea4e609..d47fd6b 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -83,10 +83,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
83 | public class LSL_Api : MarshalByRefObject, ILSL_Api, IScriptApi | 83 | public class LSL_Api : MarshalByRefObject, ILSL_Api, IScriptApi |
84 | { | 84 | { |
85 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 85 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
86 | |||
86 | protected IScriptEngine m_ScriptEngine; | 87 | protected IScriptEngine m_ScriptEngine; |
87 | protected SceneObjectPart m_host; | 88 | protected SceneObjectPart m_host; |
88 | 89 | ||
89 | /// <summary> | 90 | /// <summary> |
91 | /// Used for script sleeps when we are using co-operative script termination. | ||
92 | /// </summary> | ||
93 | /// <remarks>null if co-operative script termination is not active</remarks> | ||
94 | EventWaitHandle m_coopSleepHandle; | ||
95 | |||
96 | /// <summary> | ||
90 | /// The item that hosts this script | 97 | /// The item that hosts this script |
91 | /// </summary> | 98 | /// </summary> |
92 | protected TaskInventoryItem m_item; | 99 | protected TaskInventoryItem m_item; |
@@ -110,24 +117,28 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
110 | protected int EMAIL_PAUSE_TIME = 20; // documented delay value for smtp. | 117 | protected int EMAIL_PAUSE_TIME = 20; // documented delay value for smtp. |
111 | protected ISoundModule m_SoundModule = null; | 118 | protected ISoundModule m_SoundModule = null; |
112 | 119 | ||
113 | public void Initialize(IScriptEngine ScriptEngine, SceneObjectPart host, TaskInventoryItem item) | 120 | public void Initialize( |
121 | IScriptEngine scriptEngine, SceneObjectPart host, TaskInventoryItem item, EventWaitHandle coopSleepHandle) | ||
114 | { | 122 | { |
115 | m_ScriptEngine = ScriptEngine; | 123 | m_ScriptEngine = scriptEngine; |
116 | m_host = host; | 124 | m_host = host; |
117 | m_item = item; | 125 | m_item = item; |
126 | m_coopSleepHandle = coopSleepHandle; | ||
118 | 127 | ||
119 | LoadLimits(); // read script limits from config. | 128 | LoadConfig(); |
120 | 129 | ||
121 | m_TransferModule = | 130 | m_TransferModule = |
122 | m_ScriptEngine.World.RequestModuleInterface<IMessageTransferModule>(); | 131 | m_ScriptEngine.World.RequestModuleInterface<IMessageTransferModule>(); |
123 | m_UrlModule = m_ScriptEngine.World.RequestModuleInterface<IUrlModule>(); | 132 | m_UrlModule = m_ScriptEngine.World.RequestModuleInterface<IUrlModule>(); |
124 | m_SoundModule = m_ScriptEngine.World.RequestModuleInterface<ISoundModule>(); | 133 | m_SoundModule = m_ScriptEngine.World.RequestModuleInterface<ISoundModule>(); |
125 | 134 | ||
126 | AsyncCommands = new AsyncCommandManager(ScriptEngine); | 135 | AsyncCommands = new AsyncCommandManager(m_ScriptEngine); |
127 | } | 136 | } |
128 | 137 | ||
129 | /* load configuration items that affect script, object and run-time behavior. */ | 138 | /// <summary> |
130 | private void LoadLimits() | 139 | /// Load configuration items that affect script, object and run-time behavior. */ |
140 | /// </summary> | ||
141 | private void LoadConfig() | ||
131 | { | 142 | { |
132 | m_ScriptDelayFactor = | 143 | m_ScriptDelayFactor = |
133 | m_ScriptEngine.Config.GetFloat("ScriptDelayFactor", 1.0f); | 144 | m_ScriptEngine.Config.GetFloat("ScriptDelayFactor", 1.0f); |
@@ -141,12 +152,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
141 | m_ScriptEngine.Config.GetInt("NotecardLineReadCharsMax", 255); | 152 | m_ScriptEngine.Config.GetInt("NotecardLineReadCharsMax", 255); |
142 | if (m_notecardLineReadCharsMax > 65535) | 153 | if (m_notecardLineReadCharsMax > 65535) |
143 | m_notecardLineReadCharsMax = 65535; | 154 | m_notecardLineReadCharsMax = 65535; |
155 | |||
144 | // load limits for particular subsystems. | 156 | // load limits for particular subsystems. |
145 | IConfig SMTPConfig; | 157 | IConfig SMTPConfig; |
146 | if ((SMTPConfig = m_ScriptEngine.ConfigSource.Configs["SMTP"]) != null) { | 158 | if ((SMTPConfig = m_ScriptEngine.ConfigSource.Configs["SMTP"]) != null) { |
147 | // there's an smtp config, so load in the snooze time. | 159 | // there's an smtp config, so load in the snooze time. |
148 | EMAIL_PAUSE_TIME = SMTPConfig.GetInt("email_pause_time", EMAIL_PAUSE_TIME); | 160 | EMAIL_PAUSE_TIME = SMTPConfig.GetInt("email_pause_time", EMAIL_PAUSE_TIME); |
149 | } | 161 | } |
162 | |||
150 | // Rezzing an object with a velocity can create recoil. This feature seems to have been | 163 | // Rezzing an object with a velocity can create recoil. This feature seems to have been |
151 | // removed from recent versions of SL. The code computes recoil (vel*mass) and scales | 164 | // removed from recent versions of SL. The code computes recoil (vel*mass) and scales |
152 | // it by this factor. May be zero to turn off recoil all together. | 165 | // it by this factor. May be zero to turn off recoil all together. |
@@ -171,7 +184,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
171 | delay = (int)((float)delay * m_ScriptDelayFactor); | 184 | delay = (int)((float)delay * m_ScriptDelayFactor); |
172 | if (delay == 0) | 185 | if (delay == 0) |
173 | return; | 186 | return; |
174 | System.Threading.Thread.Sleep(delay); | 187 | |
188 | Sleep(delay); | ||
189 | } | ||
190 | |||
191 | protected virtual void Sleep(int delay) | ||
192 | { | ||
193 | if (m_coopSleepHandle == null) | ||
194 | System.Threading.Thread.Sleep(delay); | ||
195 | else if (m_coopSleepHandle.WaitOne(delay)) | ||
196 | throw new ScriptCoopStopException(); | ||
175 | } | 197 | } |
176 | 198 | ||
177 | public Scene World | 199 | public Scene World |
@@ -2910,7 +2932,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2910 | { | 2932 | { |
2911 | // m_log.Info("llSleep snoozing " + sec + "s."); | 2933 | // m_log.Info("llSleep snoozing " + sec + "s."); |
2912 | m_host.AddScriptLPS(1); | 2934 | m_host.AddScriptLPS(1); |
2913 | Thread.Sleep((int)(sec * 1000)); | 2935 | |
2936 | Sleep((int)(sec * 1000)); | ||
2914 | } | 2937 | } |
2915 | 2938 | ||
2916 | public LSL_Float llGetMass() | 2939 | public LSL_Float llGetMass() |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs index ceb4660..a08ccc8 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs | |||
@@ -30,6 +30,7 @@ using System.Reflection; | |||
30 | using System.Collections; | 30 | using System.Collections; |
31 | using System.Collections.Generic; | 31 | using System.Collections.Generic; |
32 | using System.Runtime.Remoting.Lifetime; | 32 | using System.Runtime.Remoting.Lifetime; |
33 | using System.Threading; | ||
33 | using OpenMetaverse; | 34 | using OpenMetaverse; |
34 | using Nini.Config; | 35 | using Nini.Config; |
35 | using OpenSim; | 36 | using OpenSim; |
@@ -61,9 +62,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
61 | internal bool m_LSFunctionsEnabled = false; | 62 | internal bool m_LSFunctionsEnabled = false; |
62 | internal IScriptModuleComms m_comms = null; | 63 | internal IScriptModuleComms m_comms = null; |
63 | 64 | ||
64 | public void Initialize(IScriptEngine ScriptEngine, SceneObjectPart host, TaskInventoryItem item) | 65 | public void Initialize( |
66 | IScriptEngine scriptEngine, SceneObjectPart host, TaskInventoryItem item, EventWaitHandle coopSleepHandle) | ||
65 | { | 67 | { |
66 | m_ScriptEngine = ScriptEngine; | 68 | m_ScriptEngine = scriptEngine; |
67 | m_host = host; | 69 | m_host = host; |
68 | 70 | ||
69 | if (m_ScriptEngine.Config.GetBoolean("AllowLightShareFunctions", false)) | 71 | if (m_ScriptEngine.Config.GetBoolean("AllowLightShareFunctions", false)) |
@@ -92,10 +94,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
92 | get { return m_ScriptEngine.World; } | 94 | get { return m_ScriptEngine.World; } |
93 | } | 95 | } |
94 | 96 | ||
95 | // | 97 | /// <summary> |
96 | //Dumps an error message on the debug console. | 98 | /// Dumps an error message on the debug console. |
97 | // | 99 | /// </summary> |
98 | |||
99 | internal void LSShoutError(string message) | 100 | internal void LSShoutError(string message) |
100 | { | 101 | { |
101 | if (message.Length > 1023) | 102 | if (message.Length > 1023) |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs index 8f34833..981499e 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs | |||
@@ -30,6 +30,7 @@ using System.Reflection; | |||
30 | using System.Collections; | 30 | using System.Collections; |
31 | using System.Collections.Generic; | 31 | using System.Collections.Generic; |
32 | using System.Runtime.Remoting.Lifetime; | 32 | using System.Runtime.Remoting.Lifetime; |
33 | using System.Threading; | ||
33 | using OpenMetaverse; | 34 | using OpenMetaverse; |
34 | using Nini.Config; | 35 | using Nini.Config; |
35 | using OpenSim; | 36 | using OpenSim; |
@@ -61,9 +62,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
61 | internal bool m_MODFunctionsEnabled = false; | 62 | internal bool m_MODFunctionsEnabled = false; |
62 | internal IScriptModuleComms m_comms = null; | 63 | internal IScriptModuleComms m_comms = null; |
63 | 64 | ||
64 | public void Initialize(IScriptEngine ScriptEngine, SceneObjectPart host, TaskInventoryItem item) | 65 | public void Initialize( |
66 | IScriptEngine scriptEngine, SceneObjectPart host, TaskInventoryItem item, EventWaitHandle coopSleepHandle) | ||
65 | { | 67 | { |
66 | m_ScriptEngine = ScriptEngine; | 68 | m_ScriptEngine = scriptEngine; |
67 | m_host = host; | 69 | m_host = host; |
68 | m_item = item; | 70 | m_item = item; |
69 | 71 | ||
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 958a448..25635ff 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | |||
@@ -142,9 +142,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
142 | 142 | ||
143 | protected IUrlModule m_UrlModule = null; | 143 | protected IUrlModule m_UrlModule = null; |
144 | 144 | ||
145 | public void Initialize(IScriptEngine ScriptEngine, SceneObjectPart host, TaskInventoryItem item) | 145 | public void Initialize( |
146 | IScriptEngine scriptEngine, SceneObjectPart host, TaskInventoryItem item, EventWaitHandle coopSleepHandle) | ||
146 | { | 147 | { |
147 | m_ScriptEngine = ScriptEngine; | 148 | m_ScriptEngine = scriptEngine; |
148 | m_host = host; | 149 | m_host = host; |
149 | m_item = item; | 150 | m_item = item; |
150 | 151 | ||
diff --git a/OpenSim/Region/ScriptEngine/Shared/Helpers.cs b/OpenSim/Region/ScriptEngine/Shared/Helpers.cs index 5a58f73..e02d35e 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Helpers.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Helpers.cs | |||
@@ -81,6 +81,24 @@ namespace OpenSim.Region.ScriptEngine.Shared | |||
81 | } | 81 | } |
82 | } | 82 | } |
83 | 83 | ||
84 | /// <summary> | ||
85 | /// Used to signal when the script is stopping in co-operation with the script engine | ||
86 | /// (instead of through Thread.Abort()). | ||
87 | /// </summary> | ||
88 | [Serializable] | ||
89 | public class ScriptCoopStopException : Exception | ||
90 | { | ||
91 | public ScriptCoopStopException() | ||
92 | { | ||
93 | } | ||
94 | |||
95 | protected ScriptCoopStopException( | ||
96 | SerializationInfo info, | ||
97 | StreamingContext context) | ||
98 | { | ||
99 | } | ||
100 | } | ||
101 | |||
84 | public class DetectParams | 102 | public class DetectParams |
85 | { | 103 | { |
86 | public const int AGENT = 1; | 104 | public const int AGENT = 1; |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs index f172216..75aea2b 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs | |||
@@ -157,9 +157,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance | |||
157 | 157 | ||
158 | public UUID AppDomain { get; set; } | 158 | public UUID AppDomain { get; set; } |
159 | 159 | ||
160 | /// <summary> | ||
161 | /// Scene part in which this script instance is contained. | ||
162 | /// </summary> | ||
163 | public SceneObjectPart Part { get; private set; } | 160 | public SceneObjectPart Part { get; private set; } |
164 | 161 | ||
165 | public string PrimName { get; private set; } | 162 | public string PrimName { get; private set; } |
@@ -203,49 +200,68 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance | |||
203 | 200 | ||
204 | public static readonly long MaxMeasurementPeriod = 30 * TimeSpan.TicksPerMinute; | 201 | public static readonly long MaxMeasurementPeriod = 30 * TimeSpan.TicksPerMinute; |
205 | 202 | ||
203 | private bool m_coopTermination; | ||
204 | |||
205 | private EventWaitHandle m_coopSleepHandle; | ||
206 | |||
206 | public void ClearQueue() | 207 | public void ClearQueue() |
207 | { | 208 | { |
208 | m_TimerQueued = false; | 209 | m_TimerQueued = false; |
209 | EventQueue.Clear(); | 210 | EventQueue.Clear(); |
210 | } | 211 | } |
211 | 212 | ||
212 | public ScriptInstance(IScriptEngine engine, SceneObjectPart part, | 213 | public ScriptInstance( |
213 | UUID itemID, UUID assetID, string assembly, | 214 | IScriptEngine engine, SceneObjectPart part, TaskInventoryItem item, |
214 | AppDomain dom, string primName, string scriptName, | 215 | int startParam, bool postOnRez, |
215 | int startParam, bool postOnRez, StateSource stateSource, | 216 | int maxScriptQueue) |
216 | int maxScriptQueue) | ||
217 | { | 217 | { |
218 | State = "default"; | 218 | State = "default"; |
219 | EventQueue = new Queue(32); | 219 | EventQueue = new Queue(32); |
220 | 220 | ||
221 | Engine = engine; | 221 | Engine = engine; |
222 | Part = part; | 222 | Part = part; |
223 | ItemID = itemID; | 223 | ScriptTask = item; |
224 | AssetID = assetID; | 224 | |
225 | PrimName = primName; | 225 | // This is currently only here to allow regression tests to get away without specifying any inventory |
226 | ScriptName = scriptName; | 226 | // item when they are testing script logic that doesn't require an item. |
227 | m_Assembly = assembly; | 227 | if (ScriptTask != null) |
228 | { | ||
229 | ScriptName = ScriptTask.Name; | ||
230 | ItemID = ScriptTask.ItemID; | ||
231 | AssetID = ScriptTask.AssetID; | ||
232 | } | ||
233 | |||
234 | PrimName = part.ParentGroup.Name; | ||
228 | StartParam = startParam; | 235 | StartParam = startParam; |
229 | m_MaxScriptQueue = maxScriptQueue; | 236 | m_MaxScriptQueue = maxScriptQueue; |
230 | m_stateSource = stateSource; | ||
231 | m_postOnRez = postOnRez; | 237 | m_postOnRez = postOnRez; |
232 | m_AttachedAvatar = Part.ParentGroup.AttachedAvatar; | 238 | m_AttachedAvatar = Part.ParentGroup.AttachedAvatar; |
233 | m_RegionID = Part.ParentGroup.Scene.RegionInfo.RegionID; | 239 | m_RegionID = Part.ParentGroup.Scene.RegionInfo.RegionID; |
234 | 240 | ||
235 | lock (Part.TaskInventory) | 241 | if (Engine.Config.GetString("ScriptStopStrategy", "abort") == "co-op") |
236 | { | 242 | { |
237 | if (Part.TaskInventory.ContainsKey(ItemID)) | 243 | m_coopTermination = true; |
238 | { | 244 | m_coopSleepHandle = new AutoResetEvent(false); |
239 | ScriptTask = Part.TaskInventory[ItemID]; | ||
240 | } | ||
241 | } | 245 | } |
246 | } | ||
247 | |||
248 | /// <summary> | ||
249 | /// Load the script from an assembly into an AppDomain. | ||
250 | /// </summary> | ||
251 | /// <param name='dom'></param> | ||
252 | /// <param name='assembly'></param> | ||
253 | /// <param name='stateSource'></param> | ||
254 | public void Load(AppDomain dom, string assembly, StateSource stateSource) | ||
255 | { | ||
256 | m_Assembly = assembly; | ||
257 | m_stateSource = stateSource; | ||
242 | 258 | ||
243 | ApiManager am = new ApiManager(); | 259 | ApiManager am = new ApiManager(); |
244 | 260 | ||
245 | foreach (string api in am.GetApis()) | 261 | foreach (string api in am.GetApis()) |
246 | { | 262 | { |
247 | m_Apis[api] = am.CreateApi(api); | 263 | m_Apis[api] = am.CreateApi(api); |
248 | m_Apis[api].Initialize(engine, part, ScriptTask); | 264 | m_Apis[api].Initialize(Engine, Part, ScriptTask, m_coopSleepHandle); |
249 | } | 265 | } |
250 | 266 | ||
251 | try | 267 | try |
@@ -279,7 +295,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance | |||
279 | 295 | ||
280 | // // m_log.Debug("[Script] Script instance created"); | 296 | // // m_log.Debug("[Script] Script instance created"); |
281 | 297 | ||
282 | part.SetScriptEvents(ItemID, | 298 | Part.SetScriptEvents(ItemID, |
283 | (int)m_Script.GetStateEventFlags(State)); | 299 | (int)m_Script.GetStateEventFlags(State)); |
284 | } | 300 | } |
285 | catch (Exception e) | 301 | catch (Exception e) |
@@ -526,9 +542,34 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance | |||
526 | } | 542 | } |
527 | 543 | ||
528 | // Wait for the current event to complete. | 544 | // Wait for the current event to complete. |
529 | if (!m_InSelfDelete && workItem.Wait(new TimeSpan((long)timeout * 100000))) | 545 | if (!m_InSelfDelete) |
530 | { | 546 | { |
531 | return true; | 547 | if (!m_coopTermination) |
548 | { | ||
549 | // If we're not co-operative terminating then try and wait for the event to complete before stopping | ||
550 | if (workItem.Wait(new TimeSpan((long)timeout * 100000))) | ||
551 | return true; | ||
552 | } | ||
553 | else | ||
554 | { | ||
555 | m_log.DebugFormat( | ||
556 | "[SCRIPT INSTANCE]: Co-operatively stopping script {0} {1} in {2} {3}", | ||
557 | ScriptName, ItemID, PrimName, ObjectID); | ||
558 | |||
559 | // This will terminate the event on next handle check by the script. | ||
560 | m_coopSleepHandle.Set(); | ||
561 | |||
562 | // For now, we will wait forever since the event should always cleanly terminate once LSL loop | ||
563 | // checking is implemented. May want to allow a shorter timeout option later. | ||
564 | if (workItem.Wait(TimeSpan.MaxValue)) | ||
565 | { | ||
566 | m_log.DebugFormat( | ||
567 | "[SCRIPT INSTANCE]: Co-operatively stopped script {0} {1} in {2} {3}", | ||
568 | ScriptName, ItemID, PrimName, ObjectID); | ||
569 | |||
570 | return true; | ||
571 | } | ||
572 | } | ||
532 | } | 573 | } |
533 | 574 | ||
534 | lock (EventQueue) | 575 | lock (EventQueue) |
@@ -541,6 +582,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance | |||
541 | 582 | ||
542 | // If the event still hasn't stopped and we the stop isn't the result of script or object removal, then | 583 | // If the event still hasn't stopped and we the stop isn't the result of script or object removal, then |
543 | // forcibly abort the work item (this aborts the underlying thread). | 584 | // forcibly abort the work item (this aborts the underlying thread). |
585 | // Co-operative termination should never reach this point. | ||
544 | if (!m_InSelfDelete) | 586 | if (!m_InSelfDelete) |
545 | { | 587 | { |
546 | m_log.DebugFormat( | 588 | m_log.DebugFormat( |
@@ -780,7 +822,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance | |||
780 | m_InEvent = false; | 822 | m_InEvent = false; |
781 | m_CurrentEvent = String.Empty; | 823 | m_CurrentEvent = String.Empty; |
782 | 824 | ||
783 | if ((!(e is TargetInvocationException) || (!(e.InnerException is SelfDeleteException) && !(e.InnerException is ScriptDeleteException))) && !(e is ThreadAbortException)) | 825 | if ((!(e is TargetInvocationException) |
826 | || (!(e.InnerException is SelfDeleteException) | ||
827 | && !(e.InnerException is ScriptDeleteException) | ||
828 | && !(e.InnerException is ScriptCoopStopException))) | ||
829 | && !(e is ThreadAbortException)) | ||
784 | { | 830 | { |
785 | try | 831 | try |
786 | { | 832 | { |
@@ -828,6 +874,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance | |||
828 | m_InSelfDelete = true; | 874 | m_InSelfDelete = true; |
829 | Part.Inventory.RemoveInventoryItem(ItemID); | 875 | Part.Inventory.RemoveInventoryItem(ItemID); |
830 | } | 876 | } |
877 | else if ((e is TargetInvocationException) && (e.InnerException is ScriptCoopStopException)) | ||
878 | { | ||
879 | m_log.DebugFormat( | ||
880 | "[SCRIPT INSTANCE]: Script {0}.{1} in event {2}, state {3} stopped co-operatively.", | ||
881 | PrimName, ScriptName, data.EventName, State); | ||
882 | } | ||
831 | } | 883 | } |
832 | } | 884 | } |
833 | } | 885 | } |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Instance/Tests/CoopTerminationTests.cs b/OpenSim/Region/ScriptEngine/Shared/Instance/Tests/CoopTerminationTests.cs new file mode 100644 index 0000000..8c3e9e0 --- /dev/null +++ b/OpenSim/Region/ScriptEngine/Shared/Instance/Tests/CoopTerminationTests.cs | |||
@@ -0,0 +1,157 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Threading; | ||
31 | using Nini.Config; | ||
32 | using NUnit.Framework; | ||
33 | using OpenMetaverse; | ||
34 | using OpenSim.Framework; | ||
35 | using OpenSim.Region.CoreModules.Scripting.WorldComm; | ||
36 | using OpenSim.Region.Framework.Scenes; | ||
37 | using OpenSim.Region.Framework.Interfaces; | ||
38 | using OpenSim.Region.ScriptEngine.XEngine; | ||
39 | using OpenSim.Tests.Common; | ||
40 | using OpenSim.Tests.Common.Mock; | ||
41 | |||
42 | namespace OpenSim.Region.ScriptEngine.Shared.Instance.Tests | ||
43 | { | ||
44 | /// <summary> | ||
45 | /// Test that co-operative script thread termination is working correctly. | ||
46 | /// </summary> | ||
47 | [TestFixture] | ||
48 | public class CoopTerminationTests : OpenSimTestCase | ||
49 | { | ||
50 | private TestScene m_scene; | ||
51 | private OpenSim.Region.ScriptEngine.XEngine.XEngine m_xEngine; | ||
52 | |||
53 | private AutoResetEvent m_chatEvent = new AutoResetEvent(false); | ||
54 | private AutoResetEvent m_stoppedEvent = new AutoResetEvent(false); | ||
55 | |||
56 | private OSChatMessage m_osChatMessageReceived; | ||
57 | |||
58 | [TestFixtureSetUp] | ||
59 | public void Init() | ||
60 | { | ||
61 | //AppDomain.CurrentDomain.SetData("APPBASE", Environment.CurrentDirectory + "/bin"); | ||
62 | // Console.WriteLine(AppDomain.CurrentDomain.BaseDirectory); | ||
63 | m_xEngine = new OpenSim.Region.ScriptEngine.XEngine.XEngine(); | ||
64 | |||
65 | IniConfigSource configSource = new IniConfigSource(); | ||
66 | |||
67 | IConfig startupConfig = configSource.AddConfig("Startup"); | ||
68 | startupConfig.Set("DefaultScriptEngine", "XEngine"); | ||
69 | |||
70 | IConfig xEngineConfig = configSource.AddConfig("XEngine"); | ||
71 | xEngineConfig.Set("Enabled", "true"); | ||
72 | xEngineConfig.Set("StartDelay", "0"); | ||
73 | |||
74 | // These tests will not run with AppDomainLoading = true, at least on mono. For unknown reasons, the call | ||
75 | // to AssemblyResolver.OnAssemblyResolve fails. | ||
76 | xEngineConfig.Set("AppDomainLoading", "false"); | ||
77 | |||
78 | xEngineConfig.Set("ScriptStopStrategy", "co-op"); | ||
79 | |||
80 | m_scene = new SceneHelpers().SetupScene("My Test", UUID.Random(), 1000, 1000, configSource); | ||
81 | SceneHelpers.SetupSceneModules(m_scene, configSource, m_xEngine); | ||
82 | m_scene.StartScripts(); | ||
83 | } | ||
84 | |||
85 | /// <summary> | ||
86 | /// Test co-operative termination on derez of an object containing a script with a long-running event. | ||
87 | /// </summary> | ||
88 | /// <remarks> | ||
89 | /// TODO: Actually compiling the script is incidental to this test. Really want a way to compile test scripts | ||
90 | /// within the build itself. | ||
91 | /// </remarks> | ||
92 | [Test] | ||
93 | public void TestStopOnLongSleep() | ||
94 | { | ||
95 | TestHelpers.InMethod(); | ||
96 | // TestHelpers.EnableLogging(); | ||
97 | |||
98 | UUID userId = TestHelpers.ParseTail(0x1); | ||
99 | // UUID objectId = TestHelpers.ParseTail(0x100); | ||
100 | // UUID itemId = TestHelpers.ParseTail(0x3); | ||
101 | string itemName = "TestStopOnObjectDerezLongSleep() Item"; | ||
102 | |||
103 | SceneObjectGroup so = SceneHelpers.CreateSceneObject(1, userId, "TestStopOnObjectDerezLongSleep", 0x100); | ||
104 | m_scene.AddNewSceneObject(so, true); | ||
105 | |||
106 | InventoryItemBase itemTemplate = new InventoryItemBase(); | ||
107 | // itemTemplate.ID = itemId; | ||
108 | itemTemplate.Name = itemName; | ||
109 | itemTemplate.Folder = so.UUID; | ||
110 | itemTemplate.InvType = (int)InventoryType.LSL; | ||
111 | |||
112 | m_scene.EventManager.OnChatFromWorld += OnChatFromWorld; | ||
113 | |||
114 | SceneObjectPart partWhereRezzed = m_scene.RezNewScript(userId, itemTemplate, | ||
115 | @"default | ||
116 | { | ||
117 | state_entry() | ||
118 | { | ||
119 | llSay(0, ""Thin Lizzy""); | ||
120 | llSleep(60); | ||
121 | } | ||
122 | }"); | ||
123 | |||
124 | TaskInventoryItem rezzedItem = partWhereRezzed.Inventory.GetInventoryItem(itemName); | ||
125 | |||
126 | // Wait for the script to start the event before we try stopping it. | ||
127 | m_chatEvent.WaitOne(60000); | ||
128 | |||
129 | Console.WriteLine("Script started with message [{0}]", m_osChatMessageReceived.Message); | ||
130 | |||
131 | // FIXME: This is a very poor way of trying to avoid a low-probability race condition where the script | ||
132 | // executes llSay() but has not started the sleep before we try to stop it. | ||
133 | Thread.Sleep(1000); | ||
134 | |||
135 | // We need a way of carrying on if StopScript() fail, since it won't return if the script isn't actually | ||
136 | // stopped. This kind of multi-threading is far from ideal in a regression test. | ||
137 | new Thread(() => { m_xEngine.StopScript(rezzedItem.ItemID); m_stoppedEvent.Set(); }).Start(); | ||
138 | |||
139 | if (!m_stoppedEvent.WaitOne(30000)) | ||
140 | Assert.Fail("Script did not co-operatively stop."); | ||
141 | |||
142 | bool running; | ||
143 | TaskInventoryItem scriptItem = partWhereRezzed.Inventory.GetInventoryItem(itemName); | ||
144 | Assert.That( | ||
145 | SceneObjectPartInventory.TryGetScriptInstanceRunning(m_scene, scriptItem, out running), Is.True); | ||
146 | Assert.That(running, Is.False); | ||
147 | } | ||
148 | |||
149 | private void OnChatFromWorld(object sender, OSChatMessage oscm) | ||
150 | { | ||
151 | // Console.WriteLine("Got chat [{0}]", oscm.Message); | ||
152 | |||
153 | m_osChatMessageReceived = oscm; | ||
154 | m_chatEvent.Set(); | ||
155 | } | ||
156 | } | ||
157 | } \ No newline at end of file | ||
diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiInventoryTests.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiInventoryTests.cs index cb7291a..6dd6c17 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiInventoryTests.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiInventoryTests.cs | |||
@@ -41,6 +41,7 @@ using OpenSim.Region.OptionalModules.World.NPC; | |||
41 | using OpenSim.Region.Framework.Scenes; | 41 | using OpenSim.Region.Framework.Scenes; |
42 | using OpenSim.Region.ScriptEngine.Shared; | 42 | using OpenSim.Region.ScriptEngine.Shared; |
43 | using OpenSim.Region.ScriptEngine.Shared.Api; | 43 | using OpenSim.Region.ScriptEngine.Shared.Api; |
44 | using OpenSim.Region.ScriptEngine.Shared.Instance; | ||
44 | using OpenSim.Services.Interfaces; | 45 | using OpenSim.Services.Interfaces; |
45 | using OpenSim.Tests.Common; | 46 | using OpenSim.Tests.Common; |
46 | using OpenSim.Tests.Common.Mock; | 47 | using OpenSim.Tests.Common.Mock; |
@@ -93,7 +94,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
93 | TaskInventoryHelpers.AddSceneObject(m_scene, so1.RootPart, inventoryItemName, itemId, userId); | 94 | TaskInventoryHelpers.AddSceneObject(m_scene, so1.RootPart, inventoryItemName, itemId, userId); |
94 | 95 | ||
95 | LSL_Api api = new LSL_Api(); | 96 | LSL_Api api = new LSL_Api(); |
96 | api.Initialize(m_engine, so1.RootPart, null); | 97 | api.Initialize(m_engine, so1.RootPart, null, null); |
97 | 98 | ||
98 | // Create a second object | 99 | // Create a second object |
99 | SceneObjectGroup so2 = SceneHelpers.CreateSceneObject(1, userId, "so2", 0x100); | 100 | SceneObjectGroup so2 = SceneHelpers.CreateSceneObject(1, userId, "so2", 0x100); |
@@ -126,7 +127,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
126 | SceneObjectGroup so1 = SceneHelpers.CreateSceneObject(1, user1Id, "so1", 0x10); | 127 | SceneObjectGroup so1 = SceneHelpers.CreateSceneObject(1, user1Id, "so1", 0x10); |
127 | m_scene.AddSceneObject(so1); | 128 | m_scene.AddSceneObject(so1); |
128 | LSL_Api api = new LSL_Api(); | 129 | LSL_Api api = new LSL_Api(); |
129 | api.Initialize(m_engine, so1.RootPart, null); | 130 | api.Initialize(m_engine, so1.RootPart, null, null); |
130 | 131 | ||
131 | // Create an object embedded inside the first | 132 | // Create an object embedded inside the first |
132 | UUID itemId = TestHelpers.ParseTail(0x20); | 133 | UUID itemId = TestHelpers.ParseTail(0x20); |
@@ -136,7 +137,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
136 | SceneObjectGroup so2 = SceneHelpers.CreateSceneObject(1, user2Id, "so2", 0x100); | 137 | SceneObjectGroup so2 = SceneHelpers.CreateSceneObject(1, user2Id, "so2", 0x100); |
137 | m_scene.AddSceneObject(so2); | 138 | m_scene.AddSceneObject(so2); |
138 | LSL_Api api2 = new LSL_Api(); | 139 | LSL_Api api2 = new LSL_Api(); |
139 | api2.Initialize(m_engine, so2.RootPart, null); | 140 | api2.Initialize(m_engine, so2.RootPart, null, null); |
140 | 141 | ||
141 | // *** Firstly, we test where llAllowInventoryDrop() has not been called. *** | 142 | // *** Firstly, we test where llAllowInventoryDrop() has not been called. *** |
142 | api.llGiveInventory(so2.UUID.ToString(), inventoryItemName); | 143 | api.llGiveInventory(so2.UUID.ToString(), inventoryItemName); |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiLinkingTests.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiLinkingTests.cs index d9b17d7..5b57bbe 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiLinkingTests.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiLinkingTests.cs | |||
@@ -41,6 +41,7 @@ using OpenSim.Region.OptionalModules.World.NPC; | |||
41 | using OpenSim.Region.Framework.Scenes; | 41 | using OpenSim.Region.Framework.Scenes; |
42 | using OpenSim.Region.ScriptEngine.Shared; | 42 | using OpenSim.Region.ScriptEngine.Shared; |
43 | using OpenSim.Region.ScriptEngine.Shared.Api; | 43 | using OpenSim.Region.ScriptEngine.Shared.Api; |
44 | using OpenSim.Region.ScriptEngine.Shared.Instance; | ||
44 | using OpenSim.Region.ScriptEngine.Shared.ScriptBase; | 45 | using OpenSim.Region.ScriptEngine.Shared.ScriptBase; |
45 | using OpenSim.Services.Interfaces; | 46 | using OpenSim.Services.Interfaces; |
46 | using OpenSim.Tests.Common; | 47 | using OpenSim.Tests.Common; |
@@ -104,7 +105,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
104 | m_scene.AddSceneObject(grp2); | 105 | m_scene.AddSceneObject(grp2); |
105 | 106 | ||
106 | LSL_Api apiGrp1 = new LSL_Api(); | 107 | LSL_Api apiGrp1 = new LSL_Api(); |
107 | apiGrp1.Initialize(m_engine, grp1.RootPart, grp1Item); | 108 | apiGrp1.Initialize(m_engine, grp1.RootPart, grp1Item, null); |
108 | 109 | ||
109 | apiGrp1.llCreateLink(grp2.UUID.ToString(), ScriptBaseClass.TRUE); | 110 | apiGrp1.llCreateLink(grp2.UUID.ToString(), ScriptBaseClass.TRUE); |
110 | 111 | ||
@@ -131,7 +132,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
131 | grp1Item.PermsMask |= ScriptBaseClass.PERMISSION_CHANGE_LINKS; | 132 | grp1Item.PermsMask |= ScriptBaseClass.PERMISSION_CHANGE_LINKS; |
132 | 133 | ||
133 | LSL_Api apiGrp1 = new LSL_Api(); | 134 | LSL_Api apiGrp1 = new LSL_Api(); |
134 | apiGrp1.Initialize(m_engine, grp1.RootPart, grp1Item); | 135 | apiGrp1.Initialize(m_engine, grp1.RootPart, grp1Item, null); |
135 | 136 | ||
136 | apiGrp1.llBreakLink(2); | 137 | apiGrp1.llBreakLink(2); |
137 | 138 | ||
diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiListTests.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiListTests.cs index 98017d8..60de5cb 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiListTests.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiListTests.cs | |||
@@ -34,6 +34,7 @@ using OpenSim.Region.ScriptEngine.Shared; | |||
34 | using OpenSim.Region.Framework.Scenes; | 34 | using OpenSim.Region.Framework.Scenes; |
35 | using Nini.Config; | 35 | using Nini.Config; |
36 | using OpenSim.Region.ScriptEngine.Shared.Api; | 36 | using OpenSim.Region.ScriptEngine.Shared.Api; |
37 | using OpenSim.Region.ScriptEngine.Shared.Instance; | ||
37 | using OpenSim.Region.ScriptEngine.Shared.ScriptBase; | 38 | using OpenSim.Region.ScriptEngine.Shared.ScriptBase; |
38 | using OpenMetaverse; | 39 | using OpenMetaverse; |
39 | using OpenSim.Tests.Common.Mock; | 40 | using OpenSim.Tests.Common.Mock; |
@@ -67,7 +68,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
67 | engine.AddRegion(scene); | 68 | engine.AddRegion(scene); |
68 | 69 | ||
69 | m_lslApi = new LSL_Api(); | 70 | m_lslApi = new LSL_Api(); |
70 | m_lslApi.Initialize(engine, part, null); | 71 | m_lslApi.Initialize(engine, part, null, null); |
71 | } | 72 | } |
72 | 73 | ||
73 | [Test] | 74 | [Test] |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs index c41d1e7..e97ae06 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs | |||
@@ -33,6 +33,7 @@ using OpenSim.Region.ScriptEngine.Shared; | |||
33 | using OpenSim.Region.Framework.Scenes; | 33 | using OpenSim.Region.Framework.Scenes; |
34 | using Nini.Config; | 34 | using Nini.Config; |
35 | using OpenSim.Region.ScriptEngine.Shared.Api; | 35 | using OpenSim.Region.ScriptEngine.Shared.Api; |
36 | using OpenSim.Region.ScriptEngine.Shared.Instance; | ||
36 | using OpenSim.Region.ScriptEngine.Shared.ScriptBase; | 37 | using OpenSim.Region.ScriptEngine.Shared.ScriptBase; |
37 | using OpenMetaverse; | 38 | using OpenMetaverse; |
38 | using System; | 39 | using System; |
@@ -66,7 +67,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
66 | engine.AddRegion(scene); | 67 | engine.AddRegion(scene); |
67 | 68 | ||
68 | m_lslApi = new LSL_Api(); | 69 | m_lslApi = new LSL_Api(); |
69 | m_lslApi.Initialize(engine, part, null); | 70 | m_lslApi.Initialize(engine, part, null, null); |
70 | } | 71 | } |
71 | 72 | ||
72 | [Test] | 73 | [Test] |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAppearanceTest.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAppearanceTest.cs index 1381d2b..c88bad5 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAppearanceTest.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAppearanceTest.cs | |||
@@ -41,6 +41,7 @@ using OpenSim.Region.OptionalModules.World.NPC; | |||
41 | using OpenSim.Region.Framework.Scenes; | 41 | using OpenSim.Region.Framework.Scenes; |
42 | using OpenSim.Region.ScriptEngine.Shared; | 42 | using OpenSim.Region.ScriptEngine.Shared; |
43 | using OpenSim.Region.ScriptEngine.Shared.Api; | 43 | using OpenSim.Region.ScriptEngine.Shared.Api; |
44 | using OpenSim.Region.ScriptEngine.Shared.Instance; | ||
44 | using OpenSim.Services.Interfaces; | 45 | using OpenSim.Services.Interfaces; |
45 | using OpenSim.Tests.Common; | 46 | using OpenSim.Tests.Common; |
46 | using OpenSim.Tests.Common.Mock; | 47 | using OpenSim.Tests.Common.Mock; |
@@ -93,7 +94,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
93 | m_scene.AddSceneObject(so); | 94 | m_scene.AddSceneObject(so); |
94 | 95 | ||
95 | OSSL_Api osslApi = new OSSL_Api(); | 96 | OSSL_Api osslApi = new OSSL_Api(); |
96 | osslApi.Initialize(m_engine, part, null); | 97 | osslApi.Initialize(m_engine, part, null, null); |
97 | 98 | ||
98 | string notecardName = "appearanceNc"; | 99 | string notecardName = "appearanceNc"; |
99 | 100 | ||
@@ -134,7 +135,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
134 | m_scene.AddSceneObject(so); | 135 | m_scene.AddSceneObject(so); |
135 | 136 | ||
136 | OSSL_Api osslApi = new OSSL_Api(); | 137 | OSSL_Api osslApi = new OSSL_Api(); |
137 | osslApi.Initialize(m_engine, part, null); | 138 | osslApi.Initialize(m_engine, part, null, null); |
138 | 139 | ||
139 | string notecardName = "appearanceNc"; | 140 | string notecardName = "appearanceNc"; |
140 | 141 | ||
diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAttachmentTests.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAttachmentTests.cs index 5ed1f3d..b2803a1 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAttachmentTests.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAttachmentTests.cs | |||
@@ -41,6 +41,7 @@ using OpenSim.Region.CoreModules.Framework.InventoryAccess; | |||
41 | using OpenSim.Region.Framework.Scenes; | 41 | using OpenSim.Region.Framework.Scenes; |
42 | using OpenSim.Region.ScriptEngine.Shared; | 42 | using OpenSim.Region.ScriptEngine.Shared; |
43 | using OpenSim.Region.ScriptEngine.Shared.Api; | 43 | using OpenSim.Region.ScriptEngine.Shared.Api; |
44 | using OpenSim.Region.ScriptEngine.Shared.Instance; | ||
44 | using OpenSim.Services.Interfaces; | 45 | using OpenSim.Services.Interfaces; |
45 | using OpenSim.Tests.Common; | 46 | using OpenSim.Tests.Common; |
46 | using OpenSim.Tests.Common.Mock; | 47 | using OpenSim.Tests.Common.Mock; |
@@ -98,9 +99,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
98 | SceneObjectGroup inWorldObj = SceneHelpers.AddSceneObject(m_scene, "inWorldObj", ua1.PrincipalID); | 99 | SceneObjectGroup inWorldObj = SceneHelpers.AddSceneObject(m_scene, "inWorldObj", ua1.PrincipalID); |
99 | TaskInventoryItem scriptItem = TaskInventoryHelpers.AddScript(m_scene, inWorldObj.RootPart); | 100 | TaskInventoryItem scriptItem = TaskInventoryHelpers.AddScript(m_scene, inWorldObj.RootPart); |
100 | 101 | ||
101 | new LSL_Api().Initialize(m_engine, inWorldObj.RootPart, scriptItem); | 102 | new LSL_Api().Initialize(m_engine, inWorldObj.RootPart, scriptItem, null); |
102 | OSSL_Api osslApi = new OSSL_Api(); | 103 | OSSL_Api osslApi = new OSSL_Api(); |
103 | osslApi.Initialize(m_engine, inWorldObj.RootPart, scriptItem); | 104 | osslApi.Initialize(m_engine, inWorldObj.RootPart, scriptItem, null); |
104 | 105 | ||
105 | // SceneObjectGroup sog1 = SceneHelpers.CreateSceneObject(1, ua1.PrincipalID); | 106 | // SceneObjectGroup sog1 = SceneHelpers.CreateSceneObject(1, ua1.PrincipalID); |
106 | 107 | ||
@@ -144,9 +145,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
144 | SceneObjectGroup inWorldObj = SceneHelpers.AddSceneObject(m_scene, "inWorldObj", ua1.PrincipalID); | 145 | SceneObjectGroup inWorldObj = SceneHelpers.AddSceneObject(m_scene, "inWorldObj", ua1.PrincipalID); |
145 | TaskInventoryItem scriptItem = TaskInventoryHelpers.AddScript(m_scene, inWorldObj.RootPart); | 146 | TaskInventoryItem scriptItem = TaskInventoryHelpers.AddScript(m_scene, inWorldObj.RootPart); |
146 | 147 | ||
147 | new LSL_Api().Initialize(m_engine, inWorldObj.RootPart, scriptItem); | 148 | new LSL_Api().Initialize(m_engine, inWorldObj.RootPart, scriptItem, null); |
148 | OSSL_Api osslApi = new OSSL_Api(); | 149 | OSSL_Api osslApi = new OSSL_Api(); |
149 | osslApi.Initialize(m_engine, inWorldObj.RootPart, scriptItem); | 150 | osslApi.Initialize(m_engine, inWorldObj.RootPart, scriptItem, null); |
150 | 151 | ||
151 | // Create an object embedded inside the first | 152 | // Create an object embedded inside the first |
152 | TaskInventoryHelpers.AddNotecard( | 153 | TaskInventoryHelpers.AddNotecard( |
@@ -192,12 +193,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
192 | SceneObjectGroup inWorldObj = SceneHelpers.AddSceneObject(m_scene, "inWorldObj", ua1.PrincipalID); | 193 | SceneObjectGroup inWorldObj = SceneHelpers.AddSceneObject(m_scene, "inWorldObj", ua1.PrincipalID); |
193 | TaskInventoryItem scriptItem = TaskInventoryHelpers.AddScript(m_scene, inWorldObj.RootPart); | 194 | TaskInventoryItem scriptItem = TaskInventoryHelpers.AddScript(m_scene, inWorldObj.RootPart); |
194 | 195 | ||
195 | new LSL_Api().Initialize(m_engine, inWorldObj.RootPart, scriptItem); | 196 | new LSL_Api().Initialize(m_engine, inWorldObj.RootPart, scriptItem, null); |
196 | OSSL_Api osslApi = new OSSL_Api(); | 197 | OSSL_Api osslApi = new OSSL_Api(); |
197 | osslApi.Initialize(m_engine, inWorldObj.RootPart, scriptItem); | 198 | osslApi.Initialize(m_engine, inWorldObj.RootPart, scriptItem, null); |
198 | 199 | ||
199 | // Create an object embedded inside the first | 200 | // Create an object embedded inside the first |
200 | TaskInventoryHelpers.AddSceneObject(m_scene, inWorldObj.RootPart, taskInvObjItemName, taskInvObjItemId, ua1.PrincipalID); | 201 | TaskInventoryHelpers.AddSceneObject( |
202 | m_scene, inWorldObj.RootPart, taskInvObjItemName, taskInvObjItemId, ua1.PrincipalID); | ||
201 | 203 | ||
202 | ScenePresence sp2 = SceneHelpers.AddScenePresence(m_scene, ua2); | 204 | ScenePresence sp2 = SceneHelpers.AddScenePresence(m_scene, ua2); |
203 | 205 | ||
diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiNpcTests.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiNpcTests.cs index d6c82f1..1f8a6e5 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiNpcTests.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiNpcTests.cs | |||
@@ -42,6 +42,7 @@ using OpenSim.Region.OptionalModules.World.NPC; | |||
42 | using OpenSim.Region.Framework.Scenes; | 42 | using OpenSim.Region.Framework.Scenes; |
43 | using OpenSim.Region.ScriptEngine.Shared; | 43 | using OpenSim.Region.ScriptEngine.Shared; |
44 | using OpenSim.Region.ScriptEngine.Shared.Api; | 44 | using OpenSim.Region.ScriptEngine.Shared.Api; |
45 | using OpenSim.Region.ScriptEngine.Shared.Instance; | ||
45 | using OpenSim.Region.ScriptEngine.Shared.ScriptBase; | 46 | using OpenSim.Region.ScriptEngine.Shared.ScriptBase; |
46 | using OpenSim.Services.Interfaces; | 47 | using OpenSim.Services.Interfaces; |
47 | using OpenSim.Tests.Common; | 48 | using OpenSim.Tests.Common; |
@@ -99,7 +100,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
99 | m_scene.AddSceneObject(so); | 100 | m_scene.AddSceneObject(so); |
100 | 101 | ||
101 | OSSL_Api osslApi = new OSSL_Api(); | 102 | OSSL_Api osslApi = new OSSL_Api(); |
102 | osslApi.Initialize(m_engine, part, null); | 103 | osslApi.Initialize(m_engine, part, null, null); |
103 | 104 | ||
104 | string notecardName = "appearanceNc"; | 105 | string notecardName = "appearanceNc"; |
105 | osslApi.osOwnerSaveAppearance(notecardName); | 106 | osslApi.osOwnerSaveAppearance(notecardName); |
@@ -125,7 +126,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
125 | m_scene.AddSceneObject(so); | 126 | m_scene.AddSceneObject(so); |
126 | 127 | ||
127 | OSSL_Api osslApi = new OSSL_Api(); | 128 | OSSL_Api osslApi = new OSSL_Api(); |
128 | osslApi.Initialize(m_engine, so.RootPart, null); | 129 | osslApi.Initialize(m_engine, so.RootPart, null, null); |
129 | 130 | ||
130 | bool gotExpectedException = false; | 131 | bool gotExpectedException = false; |
131 | try | 132 | try |
@@ -160,7 +161,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
160 | m_scene.AddSceneObject(so); | 161 | m_scene.AddSceneObject(so); |
161 | 162 | ||
162 | OSSL_Api osslApi = new OSSL_Api(); | 163 | OSSL_Api osslApi = new OSSL_Api(); |
163 | osslApi.Initialize(m_engine, part, null); | 164 | osslApi.Initialize(m_engine, part, null, null); |
164 | 165 | ||
165 | string notecardName = "appearanceNc"; | 166 | string notecardName = "appearanceNc"; |
166 | osslApi.osOwnerSaveAppearance(notecardName); | 167 | osslApi.osOwnerSaveAppearance(notecardName); |
@@ -194,7 +195,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
194 | m_scene.AddSceneObject(so); | 195 | m_scene.AddSceneObject(so); |
195 | 196 | ||
196 | OSSL_Api osslApi = new OSSL_Api(); | 197 | OSSL_Api osslApi = new OSSL_Api(); |
197 | osslApi.Initialize(m_engine, part, null); | 198 | osslApi.Initialize(m_engine, part, null, null); |
198 | 199 | ||
199 | osslApi.osOwnerSaveAppearance(firstAppearanceNcName); | 200 | osslApi.osOwnerSaveAppearance(firstAppearanceNcName); |
200 | 201 | ||
@@ -232,7 +233,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
232 | m_scene.AddSceneObject(so); | 233 | m_scene.AddSceneObject(so); |
233 | 234 | ||
234 | OSSL_Api osslApi = new OSSL_Api(); | 235 | OSSL_Api osslApi = new OSSL_Api(); |
235 | osslApi.Initialize(m_engine, part, null); | 236 | osslApi.Initialize(m_engine, part, null, null); |
236 | 237 | ||
237 | osslApi.osOwnerSaveAppearance(firstAppearanceNcName); | 238 | osslApi.osOwnerSaveAppearance(firstAppearanceNcName); |
238 | 239 | ||
@@ -284,10 +285,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
284 | m_scene.AddSceneObject(otherSo); | 285 | m_scene.AddSceneObject(otherSo); |
285 | 286 | ||
286 | OSSL_Api osslApi = new OSSL_Api(); | 287 | OSSL_Api osslApi = new OSSL_Api(); |
287 | osslApi.Initialize(m_engine, part, null); | 288 | osslApi.Initialize(m_engine, part, null, null); |
288 | 289 | ||
289 | OSSL_Api otherOsslApi = new OSSL_Api(); | 290 | OSSL_Api otherOsslApi = new OSSL_Api(); |
290 | otherOsslApi.Initialize(m_engine, otherPart, null); | 291 | otherOsslApi.Initialize(m_engine, otherPart, null, null); |
291 | 292 | ||
292 | string notecardName = "appearanceNc"; | 293 | string notecardName = "appearanceNc"; |
293 | osslApi.osOwnerSaveAppearance(notecardName); | 294 | osslApi.osOwnerSaveAppearance(notecardName); |
@@ -331,7 +332,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
331 | m_scene.AddSceneObject(so); | 332 | m_scene.AddSceneObject(so); |
332 | 333 | ||
333 | OSSL_Api osslApi = new OSSL_Api(); | 334 | OSSL_Api osslApi = new OSSL_Api(); |
334 | osslApi.Initialize(m_engine, part, null); | 335 | osslApi.Initialize(m_engine, part, null, null); |
335 | 336 | ||
336 | string notecardName = "appearanceNc"; | 337 | string notecardName = "appearanceNc"; |
337 | osslApi.osOwnerSaveAppearance(notecardName); | 338 | osslApi.osOwnerSaveAppearance(notecardName); |
diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs index 8c3bb5b..a17a018 100644 --- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs +++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs | |||
@@ -1284,11 +1284,11 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
1284 | m_DomainScripts[appDomain].Add(itemID); | 1284 | m_DomainScripts[appDomain].Add(itemID); |
1285 | 1285 | ||
1286 | instance = new ScriptInstance(this, part, | 1286 | instance = new ScriptInstance(this, part, |
1287 | itemID, assetID, assembly, | 1287 | item, |
1288 | m_AppDomains[appDomain], | 1288 | startParam, postOnRez, |
1289 | part.ParentGroup.RootPart.Name, | 1289 | m_MaxScriptQueue); |
1290 | item.Name, startParam, postOnRez, | 1290 | |
1291 | stateSource, m_MaxScriptQueue); | 1291 | instance.Load(m_AppDomains[appDomain], assembly, stateSource); |
1292 | 1292 | ||
1293 | // if (DebugLevel >= 1) | 1293 | // if (DebugLevel >= 1) |
1294 | // m_log.DebugFormat( | 1294 | // m_log.DebugFormat( |
@@ -1716,9 +1716,14 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
1716 | IScriptInstance instance = GetInstance(itemID); | 1716 | IScriptInstance instance = GetInstance(itemID); |
1717 | 1717 | ||
1718 | if (instance != null) | 1718 | if (instance != null) |
1719 | { | ||
1719 | instance.Stop(m_WaitForEventCompletionOnScriptStop); | 1720 | instance.Stop(m_WaitForEventCompletionOnScriptStop); |
1721 | } | ||
1720 | else | 1722 | else |
1723 | { | ||
1724 | // m_log.DebugFormat("[XENGINE]: Could not find script with ID {0} to stop in {1}", itemID, World.Name); | ||
1721 | m_runFlags.AddOrUpdate(itemID, false, 240); | 1725 | m_runFlags.AddOrUpdate(itemID, false, 240); |
1726 | } | ||
1722 | } | 1727 | } |
1723 | 1728 | ||
1724 | public DetectParams GetDetectParams(UUID itemID, int idx) | 1729 | public DetectParams GetDetectParams(UUID itemID, int idx) |