aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine
diff options
context:
space:
mode:
authorDahlia Trimble2008-07-24 07:45:58 +0000
committerDahlia Trimble2008-07-24 07:45:58 +0000
commitf74a9bcdc7b0682c1c205e9d640fbfa5f214840b (patch)
tree6d30a6964db7d79771a4ec7b655077b813f983b3 /OpenSim/Region/ScriptEngine
parentRefactor some tests. (diff)
downloadopensim-SC_OLD-f74a9bcdc7b0682c1c205e9d640fbfa5f214840b.zip
opensim-SC_OLD-f74a9bcdc7b0682c1c205e9d640fbfa5f214840b.tar.gz
opensim-SC_OLD-f74a9bcdc7b0682c1c205e9d640fbfa5f214840b.tar.bz2
opensim-SC_OLD-f74a9bcdc7b0682c1c205e9d640fbfa5f214840b.tar.xz
Implements llSetForce() and llGetForce(). These are experimental and the units may not match the Linden implementation.
Diffstat (limited to 'OpenSim/Region/ScriptEngine')
-rw-r--r--OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs33
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs33
2 files changed, 60 insertions, 6 deletions
diff --git a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs
index 2d5be27..1a60f45 100644
--- a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs
+++ b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs
@@ -42,6 +42,7 @@ using OpenSim.Region.Environment.Interfaces;
42using OpenSim.Region.Environment.Modules.Avatar.Currency.SampleMoney; 42using OpenSim.Region.Environment.Modules.Avatar.Currency.SampleMoney;
43using OpenSim.Region.Environment.Modules.World.Land; 43using OpenSim.Region.Environment.Modules.World.Land;
44using OpenSim.Region.Environment.Scenes; 44using OpenSim.Region.Environment.Scenes;
45using OpenSim.Region.Physics.Manager;
45using OpenSim.Region.ScriptEngine.Common.ScriptEngineBase; 46using OpenSim.Region.ScriptEngine.Common.ScriptEngineBase;
46 47
47//using OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL; 48//using OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL;
@@ -1578,14 +1579,40 @@ namespace OpenSim.Region.ScriptEngine.Common
1578 public void llSetForce(LSL_Types.Vector3 force, int local) 1579 public void llSetForce(LSL_Types.Vector3 force, int local)
1579 { 1580 {
1580 m_host.AddScriptLPS(1); 1581 m_host.AddScriptLPS(1);
1581 NotImplemented("llSetForce"); 1582 //NotImplemented("llSetForce");
1583
1584 if (m_host.ParentGroup != null)
1585 {
1586 if (m_host.ParentGroup.RootPart != null)
1587 {
1588 if (local != 0)
1589 force *= llGetRot();
1590
1591 m_host.ParentGroup.RootPart.SetForce(new PhysicsVector((float)force.x, (float)force.y, (float)force.z));
1592 }
1593 }
1582 } 1594 }
1583 1595
1584 public LSL_Types.Vector3 llGetForce() 1596 public LSL_Types.Vector3 llGetForce()
1585 { 1597 {
1598 LSL_Types.Vector3 force = new LSL_Types.Vector3(0.0, 0.0, 0.0);
1599
1586 m_host.AddScriptLPS(1); 1600 m_host.AddScriptLPS(1);
1587 NotImplemented("llGetForce"); 1601 //NotImplemented("llGetForce");
1588 return new LSL_Types.Vector3(); 1602 //return new LSL_Types.Vector3();
1603
1604 if (m_host.ParentGroup != null)
1605 {
1606 if (m_host.ParentGroup.RootPart != null)
1607 {
1608 PhysicsVector tmpForce = m_host.ParentGroup.RootPart.GetForce();
1609 force.x = tmpForce.X;
1610 force.y = tmpForce.Y;
1611 force.z = tmpForce.Z;
1612 }
1613 }
1614
1615 return force;
1589 } 1616 }
1590 1617
1591 public LSL_Types.LSLInteger llTarget(LSL_Types.Vector3 position, double range) 1618 public LSL_Types.LSLInteger llTarget(LSL_Types.Vector3 position, double range)
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 9832cfc..ed320f8 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -43,6 +43,7 @@ using OpenSim.Region.Environment.Interfaces;
43using OpenSim.Region.Environment.Modules.Avatar.Currency.SampleMoney; 43using OpenSim.Region.Environment.Modules.Avatar.Currency.SampleMoney;
44using OpenSim.Region.Environment.Modules.World.Land; 44using OpenSim.Region.Environment.Modules.World.Land;
45using OpenSim.Region.Environment.Scenes; 45using OpenSim.Region.Environment.Scenes;
46using OpenSim.Region.Physics.Manager;
46using OpenSim.Region.ScriptEngine.Shared; 47using OpenSim.Region.ScriptEngine.Shared;
47using OpenSim.Region.ScriptEngine.Shared.Api.Plugins; 48using OpenSim.Region.ScriptEngine.Shared.Api.Plugins;
48using OpenSim.Region.ScriptEngine.Shared.ScriptBase; 49using OpenSim.Region.ScriptEngine.Shared.ScriptBase;
@@ -1430,14 +1431,40 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1430 public void llSetForce(LSL_Types.Vector3 force, int local) 1431 public void llSetForce(LSL_Types.Vector3 force, int local)
1431 { 1432 {
1432 m_host.AddScriptLPS(1); 1433 m_host.AddScriptLPS(1);
1433 NotImplemented("llSetForce"); 1434 //NotImplemented("llSetForce");
1435
1436 if (m_host.ParentGroup != null)
1437 {
1438 if (m_host.ParentGroup.RootPart != null)
1439 {
1440 if (local != 0)
1441 force *= llGetRot();
1442
1443 m_host.ParentGroup.RootPart.SetForce(new PhysicsVector((float)force.x, (float)force.y, (float)force.z));
1444 }
1445 }
1434 } 1446 }
1435 1447
1436 public LSL_Types.Vector3 llGetForce() 1448 public LSL_Types.Vector3 llGetForce()
1437 { 1449 {
1450 LSL_Types.Vector3 force = new LSL_Types.Vector3(0.0, 0.0, 0.0);
1451
1438 m_host.AddScriptLPS(1); 1452 m_host.AddScriptLPS(1);
1439 NotImplemented("llGetForce"); 1453 //NotImplemented("llGetForce");
1440 return new LSL_Types.Vector3(); 1454 //return new LSL_Types.Vector3();
1455
1456 if (m_host.ParentGroup != null)
1457 {
1458 if (m_host.ParentGroup.RootPart != null)
1459 {
1460 PhysicsVector tmpForce = m_host.ParentGroup.RootPart.GetForce();
1461 force.x = tmpForce.X;
1462 force.y = tmpForce.Y;
1463 force.z = tmpForce.Z;
1464 }
1465 }
1466
1467 return force;
1441 } 1468 }
1442 1469
1443 public LSL_Types.LSLInteger llTarget(LSL_Types.Vector3 position, double range) 1470 public LSL_Types.LSLInteger llTarget(LSL_Types.Vector3 position, double range)