aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/Shared/Api
diff options
context:
space:
mode:
authorKittoFlora2009-10-27 22:42:55 +0100
committerKittoFlora2009-10-27 22:42:55 +0100
commit1113b3b6ebba3e358326a7be90b338d8c95af688 (patch)
treed923340600e5a2699ceaceeb52fd6c45994f334a /OpenSim/Region/ScriptEngine/Shared/Api
parentllRotLookAt Pt 2 (diff)
parentMerge branch 'master' into vehicles (diff)
downloadopensim-SC-1113b3b6ebba3e358326a7be90b338d8c95af688.zip
opensim-SC-1113b3b6ebba3e358326a7be90b338d8c95af688.tar.gz
opensim-SC-1113b3b6ebba3e358326a7be90b338d8c95af688.tar.bz2
opensim-SC-1113b3b6ebba3e358326a7be90b338d8c95af688.tar.xz
Merge branch 'vehicles' into tests
Conflicts: OpenSim/Region/Physics/Manager/PhysicsActor.cs OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/Api')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/AsyncCommandManager.cs8
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs28
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs32
3 files changed, 38 insertions, 30 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/AsyncCommandManager.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/AsyncCommandManager.cs
index 1607d34..9d97cb2 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/AsyncCommandManager.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/AsyncCommandManager.cs
@@ -137,11 +137,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
137 if (cmdHandlerThread == null) 137 if (cmdHandlerThread == null)
138 { 138 {
139 // Start the thread that will be doing the work 139 // Start the thread that will be doing the work
140 cmdHandlerThread = new Thread(CmdHandlerThreadLoop); 140 cmdHandlerThread = Watchdog.StartThread(CmdHandlerThreadLoop, "AsyncLSLCmdHandlerThread", ThreadPriority.Normal, true);
141 cmdHandlerThread.Name = "AsyncLSLCmdHandlerThread";
142 cmdHandlerThread.Priority = ThreadPriority.BelowNormal;
143 cmdHandlerThread.IsBackground = true;
144 cmdHandlerThread.Start();
145 } 141 }
146 } 142 }
147 143
@@ -185,6 +181,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
185 Thread.Sleep(cmdHandlerThreadCycleSleepms); 181 Thread.Sleep(cmdHandlerThreadCycleSleepms);
186 182
187 DoOneCmdHandlerPass(); 183 DoOneCmdHandlerPass();
184
185 Watchdog.UpdateThread();
188 } 186 }
189 } 187 }
190 catch 188 catch
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 1dc20ff..0f01c36 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -1267,12 +1267,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1267 protected void SetScale(SceneObjectPart part, LSL_Vector scale) 1267 protected void SetScale(SceneObjectPart part, LSL_Vector scale)
1268 { 1268 {
1269 // TODO: this needs to trigger a persistance save as well 1269 // TODO: this needs to trigger a persistance save as well
1270
1271 if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted) 1270 if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted)
1272 return; 1271 return;
1273 1272 if (scale.x < 0.01)
1274 if (scale.x < 0.01 || scale.y < 0.01 || scale.z < 0.01) 1273 scale.x = 0.01;
1275 return; 1274 if (scale.y < 0.01)
1275 scale.y = 0.01;
1276 if (scale.z < 0.01)
1277 scale.z = 0.01;
1276 1278
1277 if (part.ParentGroup.RootPart.PhysActor != null && part.ParentGroup.RootPart.PhysActor.IsPhysical) 1279 if (part.ParentGroup.RootPart.PhysActor != null && part.ParentGroup.RootPart.PhysActor.IsPhysical)
1278 { 1280 {
@@ -1283,12 +1285,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1283 if (scale.z > World.m_maxPhys) 1285 if (scale.z > World.m_maxPhys)
1284 scale.z = World.m_maxPhys; 1286 scale.z = World.m_maxPhys;
1285 } 1287 }
1288
1286 if (scale.x > World.m_maxNonphys) 1289 if (scale.x > World.m_maxNonphys)
1287 scale.x = World.m_maxNonphys; 1290 scale.x = World.m_maxNonphys;
1288 if (scale.y > World.m_maxNonphys) 1291 if (scale.y > World.m_maxNonphys)
1289 scale.y = World.m_maxNonphys; 1292 scale.y = World.m_maxNonphys;
1290 if (scale.z > World.m_maxNonphys) 1293 if (scale.z > World.m_maxNonphys)
1291 scale.z = World.m_maxNonphys; 1294 scale.z = World.m_maxNonphys;
1295
1292 Vector3 tmp = part.Scale; 1296 Vector3 tmp = part.Scale;
1293 tmp.X = (float)scale.x; 1297 tmp.X = (float)scale.x;
1294 tmp.Y = (float)scale.y; 1298 tmp.Y = (float)scale.y;
@@ -2043,7 +2047,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2043 if (local != 0) 2047 if (local != 0)
2044 force *= llGetRot(); 2048 force *= llGetRot();
2045 2049
2046 m_host.ParentGroup.RootPart.SetForce(new PhysicsVector((float)force.x, (float)force.y, (float)force.z)); 2050 m_host.ParentGroup.RootPart.SetForce(new Vector3((float)force.x, (float)force.y, (float)force.z));
2047 } 2051 }
2048 } 2052 }
2049 } 2053 }
@@ -2058,7 +2062,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2058 { 2062 {
2059 if (!m_host.ParentGroup.IsDeleted) 2063 if (!m_host.ParentGroup.IsDeleted)
2060 { 2064 {
2061 PhysicsVector tmpForce = m_host.ParentGroup.RootPart.GetForce(); 2065 Vector3 tmpForce = m_host.ParentGroup.RootPart.GetForce();
2062 force.x = tmpForce.X; 2066 force.x = tmpForce.X;
2063 force.y = tmpForce.Y; 2067 force.y = tmpForce.Y;
2064 force.z = tmpForce.Z; 2068 force.z = tmpForce.Z;
@@ -4180,7 +4184,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4180 { 4184 {
4181 applied_linear_impulse *= m_host.GetWorldRotation(); 4185 applied_linear_impulse *= m_host.GetWorldRotation();
4182 } 4186 }
4183 pusheeav.PhysicsActor.AddForce(new PhysicsVector(applied_linear_impulse.X, applied_linear_impulse.Y, applied_linear_impulse.Z), true); 4187 pusheeav.PhysicsActor.AddForce(applied_linear_impulse, true);
4184 } 4188 }
4185 } 4189 }
4186 } 4190 }
@@ -6088,7 +6092,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6088 if (!m_host.ParentGroup.IsDeleted) 6092 if (!m_host.ParentGroup.IsDeleted)
6089 { 6093 {
6090 m_host.ParentGroup.RootPart.SetVehicleVectorParam(param, 6094 m_host.ParentGroup.RootPart.SetVehicleVectorParam(param,
6091 new PhysicsVector((float)vec.x, (float)vec.y, (float)vec.z)); 6095 new Vector3((float)vec.x, (float)vec.y, (float)vec.z));
6092 } 6096 }
6093 } 6097 }
6094 } 6098 }
@@ -7227,13 +7231,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7227 public LSL_Integer llGetNumberOfPrims() 7231 public LSL_Integer llGetNumberOfPrims()
7228 { 7232 {
7229 m_host.AddScriptLPS(1); 7233 m_host.AddScriptLPS(1);
7230 List<ScenePresence> presences = World.GetScenePresences(); 7234 ScenePresence[] presences = World.GetScenePresences();
7231 if (presences.Count == 0) 7235 if (presences.Length == 0)
7232 return 0; 7236 return 0;
7233 7237
7234 int avatarCount = 0; 7238 int avatarCount = 0;
7235 foreach (ScenePresence presence in presences) 7239 for (int i = 0; i < presences.Length; i++)
7236 { 7240 {
7241 ScenePresence presence = presences[i];
7242
7237 if (!presence.IsChildAgent && presence.ParentID != 0) 7243 if (!presence.IsChildAgent && presence.ParentID != 0)
7238 { 7244 {
7239 if (m_host.ParentGroup.HasChildPrim(presence.ParentID)) 7245 if (m_host.ParentGroup.HasChildPrim(presence.ParentID))
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs
index a09c8db..b75a2e4 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs
@@ -404,7 +404,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
404 404
405 private List<SensedEntity> doAgentSensor(SenseRepeatClass ts) 405 private List<SensedEntity> doAgentSensor(SenseRepeatClass ts)
406 { 406 {
407 List<ScenePresence> Presences; 407 List<ScenePresence> presences;
408 List<SensedEntity> sensedEntities = new List<SensedEntity>(); 408 List<SensedEntity> sensedEntities = new List<SensedEntity>();
409 409
410 // If this is an avatar sense by key try to get them directly 410 // If this is an avatar sense by key try to get them directly
@@ -414,16 +414,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
414 ScenePresence p = m_CmdManager.m_ScriptEngine.World.GetScenePresence(ts.keyID); 414 ScenePresence p = m_CmdManager.m_ScriptEngine.World.GetScenePresence(ts.keyID);
415 if (p == null) 415 if (p == null)
416 return sensedEntities; 416 return sensedEntities;
417 Presences = new List<ScenePresence>(); 417 presences = new List<ScenePresence>();
418 Presences.Add(p); 418 presences.Add(p);
419 } 419 }
420 else 420 else
421 { 421 {
422 Presences = m_CmdManager.m_ScriptEngine.World.GetScenePresences(); 422 presences = new List<ScenePresence>(m_CmdManager.m_ScriptEngine.World.GetScenePresences());
423 } 423 }
424 424
425 // If nobody about quit fast 425 // If nobody about quit fast
426 if (Presences.Count == 0) 426 if (presences.Count == 0)
427 return sensedEntities; 427 return sensedEntities;
428 428
429 SceneObjectPart SensePoint = ts.host; 429 SceneObjectPart SensePoint = ts.host;
@@ -440,8 +440,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
440 Vector3 toRegionPos; 440 Vector3 toRegionPos;
441 double dis; 441 double dis;
442 442
443 foreach (ScenePresence presence in Presences) 443 for (int i = 0; i < presences.Count; i++)
444 { 444 {
445 ScenePresence presence = presences[i];
445 bool keep = true; 446 bool keep = true;
446 447
447 if (presence.IsDeleted) 448 if (presence.IsDeleted)
@@ -515,16 +516,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
515 { 516 {
516 List<Object> data = new List<Object>(); 517 List<Object> data = new List<Object>();
517 518
518 foreach (SenseRepeatClass ts in SenseRepeaters) 519 lock (SenseRepeatListLock)
519 { 520 {
520 if (ts.itemID == itemID) 521 foreach (SenseRepeatClass ts in SenseRepeaters)
521 { 522 {
522 data.Add(ts.interval); 523 if (ts.itemID == itemID)
523 data.Add(ts.name); 524 {
524 data.Add(ts.keyID); 525 data.Add(ts.interval);
525 data.Add(ts.type); 526 data.Add(ts.name);
526 data.Add(ts.range); 527 data.Add(ts.keyID);
527 data.Add(ts.arc); 528 data.Add(ts.type);
529 data.Add(ts.range);
530 data.Add(ts.arc);
531 }
528 } 532 }
529 } 533 }
530 return data.ToArray(); 534 return data.ToArray();