aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2013-01-24 00:02:43 +0000
committerJustin Clark-Casey (justincc)2013-01-24 00:02:43 +0000
commita1f78ceb37dda544f8d04aa00bf3fedd298f024e (patch)
treee3f9b4f03f712dc63a4aefc5ac389f9b1c36ed8d /OpenSim/Region/ScriptEngine
parentNew constants for llGetObjectDetails (diff)
parentBulletSim: remove setting of vehicle InterpolationRotationalVelocity. (diff)
downloadopensim-SC_OLD-a1f78ceb37dda544f8d04aa00bf3fedd298f024e.zip
opensim-SC_OLD-a1f78ceb37dda544f8d04aa00bf3fedd298f024e.tar.gz
opensim-SC_OLD-a1f78ceb37dda544f8d04aa00bf3fedd298f024e.tar.bz2
opensim-SC_OLD-a1f78ceb37dda544f8d04aa00bf3fedd298f024e.tar.xz
Merge branch 'master' of ssh://opensimulator.org/var/git/opensim
Diffstat (limited to 'OpenSim/Region/ScriptEngine')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs227
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs3
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs9
-rw-r--r--OpenSim/Region/ScriptEngine/XEngine/XEngine.cs4
4 files changed, 194 insertions, 49 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index db5add1..3a7e1c7 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -2738,42 +2738,40 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2738 return src.ToLower(); 2738 return src.ToLower();
2739 } 2739 }
2740 2740
2741 public LSL_Integer llGiveMoney(string destination, int amount) 2741 public void llGiveMoney(string destination, int amount)
2742 { 2742 {
2743 m_host.AddScriptLPS(1); 2743 Util.FireAndForget(x =>
2744
2745 if (m_item.PermsGranter == UUID.Zero)
2746 return 0;
2747
2748 if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_DEBIT) == 0)
2749 { 2744 {
2750 LSLError("No permissions to give money"); 2745 m_host.AddScriptLPS(1);
2751 return 0;
2752 }
2753 2746
2754 UUID toID = new UUID(); 2747 if (m_item.PermsGranter == UUID.Zero)
2748 return;
2755 2749
2756 if (!UUID.TryParse(destination, out toID)) 2750 if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_DEBIT) == 0)
2757 { 2751 {
2758 LSLError("Bad key in llGiveMoney"); 2752 LSLError("No permissions to give money");
2759 return 0; 2753 return;
2760 } 2754 }
2761 2755
2762 IMoneyModule money = World.RequestModuleInterface<IMoneyModule>(); 2756 UUID toID = new UUID();
2763 2757
2764 if (money == null) 2758 if (!UUID.TryParse(destination, out toID))
2765 { 2759 {
2766 NotImplemented("llGiveMoney"); 2760 LSLError("Bad key in llGiveMoney");
2767 return 0; 2761 return;
2768 } 2762 }
2769 2763
2770 bool result = money.ObjectGiveMoney( 2764 IMoneyModule money = World.RequestModuleInterface<IMoneyModule>();
2771 m_host.ParentGroup.RootPart.UUID, m_host.ParentGroup.RootPart.OwnerID, toID, amount);
2772 2765
2773 if (result) 2766 if (money == null)
2774 return 1; 2767 {
2768 NotImplemented("llGiveMoney");
2769 return;
2770 }
2775 2771
2776 return 0; 2772 money.ObjectGiveMoney(
2773 m_host.ParentGroup.RootPart.UUID, m_host.ParentGroup.RootPart.OwnerID, toID, amount);
2774 });
2777 } 2775 }
2778 2776
2779 public void llMakeExplosion(int particles, double scale, double vel, double lifetime, double arc, string texture, LSL_Vector offset) 2777 public void llMakeExplosion(int particles, double scale, double vel, double lifetime, double arc, string texture, LSL_Vector offset)
@@ -4923,7 +4921,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4923 public LSL_Vector llGetCenterOfMass() 4921 public LSL_Vector llGetCenterOfMass()
4924 { 4922 {
4925 m_host.AddScriptLPS(1); 4923 m_host.AddScriptLPS(1);
4926 Vector3 center = m_host.GetGeometricCenter(); 4924 Vector3 center = m_host.GetCenterOfMass();
4927 return new LSL_Vector(center.X,center.Y,center.Z); 4925 return new LSL_Vector(center.X,center.Y,center.Z);
4928 } 4926 }
4929 4927
@@ -6839,7 +6837,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6839 { 6837 {
6840 m_host.AddScriptLPS(1); 6838 m_host.AddScriptLPS(1);
6841 IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface<IXMLRPC>(); 6839 IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface<IXMLRPC>();
6842 if (xmlrpcMod.IsEnabled()) 6840 if (xmlrpcMod != null && xmlrpcMod.IsEnabled())
6843 { 6841 {
6844 UUID channelID = xmlrpcMod.OpenXMLRPCChannel(m_host.LocalId, m_item.ItemID, UUID.Zero); 6842 UUID channelID = xmlrpcMod.OpenXMLRPCChannel(m_host.LocalId, m_item.ItemID, UUID.Zero);
6845 IXmlRpcRouter xmlRpcRouter = m_ScriptEngine.World.RequestModuleInterface<IXmlRpcRouter>(); 6843 IXmlRpcRouter xmlRpcRouter = m_ScriptEngine.World.RequestModuleInterface<IXmlRpcRouter>();
@@ -6871,6 +6869,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6871 m_host.AddScriptLPS(1); 6869 m_host.AddScriptLPS(1);
6872 IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface<IXMLRPC>(); 6870 IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface<IXMLRPC>();
6873 ScriptSleep(3000); 6871 ScriptSleep(3000);
6872 if (xmlrpcMod == null)
6873 return "";
6874 return (xmlrpcMod.SendRemoteData(m_host.LocalId, m_item.ItemID, channel, dest, idata, sdata)).ToString(); 6874 return (xmlrpcMod.SendRemoteData(m_host.LocalId, m_item.ItemID, channel, dest, idata, sdata)).ToString();
6875 } 6875 }
6876 6876
@@ -6878,7 +6878,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6878 { 6878 {
6879 m_host.AddScriptLPS(1); 6879 m_host.AddScriptLPS(1);
6880 IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface<IXMLRPC>(); 6880 IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface<IXMLRPC>();
6881 xmlrpcMod.RemoteDataReply(channel, message_id, sdata, idata); 6881 if (xmlrpcMod != null)
6882 xmlrpcMod.RemoteDataReply(channel, message_id, sdata, idata);
6882 ScriptSleep(3000); 6883 ScriptSleep(3000);
6883 } 6884 }
6884 6885
@@ -6893,7 +6894,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6893 } 6894 }
6894 6895
6895 IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface<IXMLRPC>(); 6896 IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface<IXMLRPC>();
6896 xmlrpcMod.CloseXMLRPCChannel((UUID)channel); 6897 if (xmlrpcMod != null)
6898 xmlrpcMod.CloseXMLRPCChannel((UUID)channel);
6897 ScriptSleep(1000); 6899 ScriptSleep(1000);
6898 } 6900 }
6899 6901
@@ -11338,25 +11340,89 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
11338 bool checkPhysical = !((rejectTypes & ScriptBaseClass.RC_REJECT_PHYSICAL) == ScriptBaseClass.RC_REJECT_PHYSICAL); 11340 bool checkPhysical = !((rejectTypes & ScriptBaseClass.RC_REJECT_PHYSICAL) == ScriptBaseClass.RC_REJECT_PHYSICAL);
11339 11341
11340 11342
11341 if (checkTerrain) 11343 if (World.SupportsRayCastFiltered())
11342 { 11344 {
11343 ContactResult? groundContact = GroundIntersection(rayStart, rayEnd); 11345 if (dist == 0)
11344 if (groundContact != null) 11346 return list;
11345 results.Add((ContactResult)groundContact); 11347
11346 } 11348 RayFilterFlags rayfilter = RayFilterFlags.ClosestAndBackCull;
11349 if (checkTerrain)
11350 rayfilter |= RayFilterFlags.land;
11351// if (checkAgents)
11352// rayfilter |= RayFilterFlags.agent;
11353 if (checkPhysical)
11354 rayfilter |= RayFilterFlags.physical;
11355 if (checkNonPhysical)
11356 rayfilter |= RayFilterFlags.nonphysical;
11357 if (detectPhantom)
11358 rayfilter |= RayFilterFlags.LSLPhanton;
11359
11360 Vector3 direction = dir * ( 1/dist);
11361
11362 if(rayfilter == 0)
11363 {
11364 list.Add(new LSL_Integer(0));
11365 return list;
11366 }
11367
11368 // get some more contacts to sort ???
11369 int physcount = 4 * count;
11370 if (physcount > 20)
11371 physcount = 20;
11372
11373 object physresults;
11374 physresults = World.RayCastFiltered(rayStart, direction, dist, physcount, rayfilter);
11375
11376 if (physresults == null)
11377 {
11378 list.Add(new LSL_Integer(-3)); // timeout error
11379 return list;
11380 }
11381
11382 results = (List<ContactResult>)physresults;
11347 11383
11348 if (checkAgents) 11384 // for now physics doesn't detect sitted avatars so do it outside physics
11385 if (checkAgents)
11386 {
11387 ContactResult[] agentHits = AvatarIntersection(rayStart, rayEnd);
11388 foreach (ContactResult r in agentHits)
11389 results.Add(r);
11390 }
11391
11392 // TODO: Replace this with a better solution. ObjectIntersection can only
11393 // detect nonphysical phantoms. They are detected by virtue of being
11394 // nonphysical (e.g. no PhysActor) so will not conflict with detecting
11395 // physicsl phantoms as done by the physics scene
11396 // We don't want anything else but phantoms here.
11397 if (detectPhantom)
11398 {
11399 ContactResult[] objectHits = ObjectIntersection(rayStart, rayEnd, false, false, true);
11400 foreach (ContactResult r in objectHits)
11401 results.Add(r);
11402 }
11403 }
11404 else
11349 { 11405 {
11350 ContactResult[] agentHits = AvatarIntersection(rayStart, rayEnd); 11406 if (checkAgents)
11351 foreach (ContactResult r in agentHits) 11407 {
11352 results.Add(r); 11408 ContactResult[] agentHits = AvatarIntersection(rayStart, rayEnd);
11409 foreach (ContactResult r in agentHits)
11410 results.Add(r);
11411 }
11412
11413 if (checkPhysical || checkNonPhysical || detectPhantom)
11414 {
11415 ContactResult[] objectHits = ObjectIntersection(rayStart, rayEnd, checkPhysical, checkNonPhysical, detectPhantom);
11416 foreach (ContactResult r in objectHits)
11417 results.Add(r);
11418 }
11353 } 11419 }
11354 11420
11355 if (checkPhysical || checkNonPhysical || detectPhantom) 11421 if (checkTerrain)
11356 { 11422 {
11357 ContactResult[] objectHits = ObjectIntersection(rayStart, rayEnd, checkPhysical, checkNonPhysical, detectPhantom); 11423 ContactResult? groundContact = GroundIntersection(rayStart, rayEnd);
11358 foreach (ContactResult r in objectHits) 11424 if (groundContact != null)
11359 results.Add(r); 11425 results.Add((ContactResult)groundContact);
11360 } 11426 }
11361 11427
11362 results.Sort(delegate(ContactResult a, ContactResult b) 11428 results.Sort(delegate(ContactResult a, ContactResult b)
@@ -11554,6 +11620,79 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
11554 NotImplemented("llGodLikeRezObject"); 11620 NotImplemented("llGodLikeRezObject");
11555 } 11621 }
11556 11622
11623 public LSL_String llTransferLindenDollars(string destination, int amount)
11624 {
11625 UUID txn = UUID.Random();
11626
11627 Util.FireAndForget(delegate(object x)
11628 {
11629 int replycode = 0;
11630 string replydata = destination + "," + amount.ToString();
11631
11632 try
11633 {
11634 TaskInventoryItem item = m_item;
11635 if (item == null)
11636 {
11637 replydata = "SERVICE_ERROR";
11638 return;
11639 }
11640
11641 m_host.AddScriptLPS(1);
11642
11643 if (item.PermsGranter == UUID.Zero)
11644 {
11645 replydata = "MISSING_PERMISSION_DEBIT";
11646 return;
11647 }
11648
11649 if ((item.PermsMask & ScriptBaseClass.PERMISSION_DEBIT) == 0)
11650 {
11651 replydata = "MISSING_PERMISSION_DEBIT";
11652 return;
11653 }
11654
11655 UUID toID = new UUID();
11656
11657 if (!UUID.TryParse(destination, out toID))
11658 {
11659 replydata = "INVALID_AGENT";
11660 return;
11661 }
11662
11663 IMoneyModule money = World.RequestModuleInterface<IMoneyModule>();
11664
11665 if (money == null)
11666 {
11667 replydata = "TRANSFERS_DISABLED";
11668 return;
11669 }
11670
11671 bool result = money.ObjectGiveMoney(
11672 m_host.ParentGroup.RootPart.UUID, m_host.ParentGroup.RootPart.OwnerID, toID, amount);
11673
11674 if (result)
11675 {
11676 replycode = 1;
11677 return;
11678 }
11679
11680 replydata = "LINDENDOLLAR_INSUFFICIENTFUNDS";
11681 }
11682 finally
11683 {
11684 m_ScriptEngine.PostScriptEvent(m_item.ItemID, new EventParams(
11685 "transaction_result", new Object[] {
11686 new LSL_String(txn.ToString()),
11687 new LSL_Integer(replycode),
11688 new LSL_String(replydata) },
11689 new DetectParams[0]));
11690 }
11691 });
11692
11693 return txn.ToString();
11694 }
11695
11557 #endregion 11696 #endregion
11558 } 11697 }
11559 11698
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs
index 98f8be7..4ac179a 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs
@@ -207,7 +207,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
207 LSL_Float llGetWallclock(); 207 LSL_Float llGetWallclock();
208 void llGiveInventory(string destination, string inventory); 208 void llGiveInventory(string destination, string inventory);
209 void llGiveInventoryList(string destination, string category, LSL_List inventory); 209 void llGiveInventoryList(string destination, string category, LSL_List inventory);
210 LSL_Integer llGiveMoney(string destination, int amount); 210 void llGiveMoney(string destination, int amount);
211 LSL_String llTransferLindenDollars(string destination, int amount);
211 void llGodLikeRezObject(string inventory, LSL_Vector pos); 212 void llGodLikeRezObject(string inventory, LSL_Vector pos);
212 LSL_Float llGround(LSL_Vector offset); 213 LSL_Float llGround(LSL_Vector offset);
213 LSL_Vector llGroundContour(LSL_Vector offset); 214 LSL_Vector llGroundContour(LSL_Vector offset);
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs
index 36803a4..c7a7cf6 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs
@@ -869,9 +869,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
869 m_LSL_Functions.llGiveInventoryList(destination, category, inventory); 869 m_LSL_Functions.llGiveInventoryList(destination, category, inventory);
870 } 870 }
871 871
872 public LSL_Integer llGiveMoney(string destination, int amount) 872 public void llGiveMoney(string destination, int amount)
873 { 873 {
874 return m_LSL_Functions.llGiveMoney(destination, amount); 874 m_LSL_Functions.llGiveMoney(destination, amount);
875 }
876
877 public LSL_String llTransferLindenDollars(string destination, int amount)
878 {
879 return m_LSL_Functions.llTransferLindenDollars(destination, amount);
875 } 880 }
876 881
877 public void llGodLikeRezObject(string inventory, LSL_Vector pos) 882 public void llGodLikeRezObject(string inventory, LSL_Vector pos)
diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
index a17a018..72646f6 100644
--- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
+++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
@@ -1486,7 +1486,8 @@ namespace OpenSim.Region.ScriptEngine.XEngine
1486 m_MaxScriptQueue = maxScriptQueue; 1486 m_MaxScriptQueue = maxScriptQueue;
1487 1487
1488 STPStartInfo startInfo = new STPStartInfo(); 1488 STPStartInfo startInfo = new STPStartInfo();
1489 startInfo.IdleTimeout = idleTimeout*1000; // convert to seconds as stated in .ini 1489 startInfo.ThreadPoolName = "XEngine";
1490 startInfo.IdleTimeout = idleTimeout * 1000; // convert to seconds as stated in .ini
1490 startInfo.MaxWorkerThreads = maxThreads; 1491 startInfo.MaxWorkerThreads = maxThreads;
1491 startInfo.MinWorkerThreads = minThreads; 1492 startInfo.MinWorkerThreads = minThreads;
1492 startInfo.ThreadPriority = threadPriority;; 1493 startInfo.ThreadPriority = threadPriority;;
@@ -1494,7 +1495,6 @@ namespace OpenSim.Region.ScriptEngine.XEngine
1494 startInfo.StartSuspended = true; 1495 startInfo.StartSuspended = true;
1495 1496
1496 m_ThreadPool = new SmartThreadPool(startInfo); 1497 m_ThreadPool = new SmartThreadPool(startInfo);
1497 m_ThreadPool.Name = "XEngine";
1498 } 1498 }
1499 1499
1500 // 1500 //