diff options
author | ubit | 2013-01-26 04:40:48 +0100 |
---|---|---|
committer | ubit | 2013-01-26 04:40:48 +0100 |
commit | 2eab339b87cd842f5dda43d00ec744d631fbab14 (patch) | |
tree | 834fcaa6404fd4e2c491ac858fe0a82e3265a158 /OpenSim/Region/ScriptEngine | |
parent | Merge branch 'ubitwork' of ssh://3dhosting.de/var/git/careminster into ubitwork (diff) | |
parent | Merge branch 'avination' into ubitwork (diff) | |
download | opensim-SC-2eab339b87cd842f5dda43d00ec744d631fbab14.zip opensim-SC-2eab339b87cd842f5dda43d00ec744d631fbab14.tar.gz opensim-SC-2eab339b87cd842f5dda43d00ec744d631fbab14.tar.bz2 opensim-SC-2eab339b87cd842f5dda43d00ec744d631fbab14.tar.xz |
Merge branch 'ubitwork' of ssh://3dhosting.de/var/git/careminster into ubitwork
Diffstat (limited to 'OpenSim/Region/ScriptEngine')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 92 | ||||
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 46 |
2 files changed, 88 insertions, 50 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 617f382..53c6e5c 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -3019,38 +3019,38 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3019 | 3019 | ||
3020 | public LSL_Integer llGiveMoney(string destination, int amount) | 3020 | public LSL_Integer llGiveMoney(string destination, int amount) |
3021 | { | 3021 | { |
3022 | m_host.AddScriptLPS(1); | 3022 | Util.FireAndForget(x => |
3023 | |||
3024 | if (m_item.PermsGranter == UUID.Zero) | ||
3025 | return 0; | ||
3026 | |||
3027 | if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_DEBIT) == 0) | ||
3028 | { | 3023 | { |
3029 | LSLError("No permissions to give money"); | 3024 | m_host.AddScriptLPS(1); |
3030 | return 0; | ||
3031 | } | ||
3032 | 3025 | ||
3033 | UUID toID = new UUID(); | 3026 | if (m_item.PermsGranter == UUID.Zero) |
3027 | return; | ||
3034 | 3028 | ||
3035 | if (!UUID.TryParse(destination, out toID)) | 3029 | if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_DEBIT) == 0) |
3036 | { | 3030 | { |
3037 | LSLError("Bad key in llGiveMoney"); | 3031 | LSLError("No permissions to give money"); |
3038 | return 0; | 3032 | return; |
3039 | } | 3033 | } |
3040 | 3034 | ||
3041 | IMoneyModule money = World.RequestModuleInterface<IMoneyModule>(); | 3035 | UUID toID = new UUID(); |
3042 | 3036 | ||
3043 | if (money == null) | 3037 | if (!UUID.TryParse(destination, out toID)) |
3044 | { | 3038 | { |
3045 | NotImplemented("llGiveMoney"); | 3039 | LSLError("Bad key in llGiveMoney"); |
3046 | return 0; | 3040 | return; |
3047 | } | 3041 | } |
3048 | 3042 | ||
3049 | bool result = money.ObjectGiveMoney( | 3043 | IMoneyModule money = World.RequestModuleInterface<IMoneyModule>(); |
3050 | m_host.ParentGroup.RootPart.UUID, m_host.ParentGroup.RootPart.OwnerID, toID, amount,UUID.Zero); | ||
3051 | 3044 | ||
3052 | if (result) | 3045 | if (money == null) |
3053 | return 1; | 3046 | { |
3047 | NotImplemented("llGiveMoney"); | ||
3048 | return; | ||
3049 | } | ||
3050 | |||
3051 | money.ObjectGiveMoney( | ||
3052 | m_host.ParentGroup.RootPart.UUID, m_host.ParentGroup.RootPart.OwnerID, toID, amount,UUID.Zero); | ||
3053 | }); | ||
3054 | 3054 | ||
3055 | return 0; | 3055 | return 0; |
3056 | } | 3056 | } |
@@ -7322,7 +7322,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
7322 | { | 7322 | { |
7323 | m_host.AddScriptLPS(1); | 7323 | m_host.AddScriptLPS(1); |
7324 | IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface<IXMLRPC>(); | 7324 | IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface<IXMLRPC>(); |
7325 | if (xmlrpcMod.IsEnabled()) | 7325 | if (xmlrpcMod != null && xmlrpcMod.IsEnabled()) |
7326 | { | 7326 | { |
7327 | UUID channelID = xmlrpcMod.OpenXMLRPCChannel(m_host.LocalId, m_item.ItemID, UUID.Zero); | 7327 | UUID channelID = xmlrpcMod.OpenXMLRPCChannel(m_host.LocalId, m_item.ItemID, UUID.Zero); |
7328 | IXmlRpcRouter xmlRpcRouter = m_ScriptEngine.World.RequestModuleInterface<IXmlRpcRouter>(); | 7328 | IXmlRpcRouter xmlRpcRouter = m_ScriptEngine.World.RequestModuleInterface<IXmlRpcRouter>(); |
@@ -7354,6 +7354,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
7354 | m_host.AddScriptLPS(1); | 7354 | m_host.AddScriptLPS(1); |
7355 | IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface<IXMLRPC>(); | 7355 | IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface<IXMLRPC>(); |
7356 | ScriptSleep(3000); | 7356 | ScriptSleep(3000); |
7357 | if (xmlrpcMod == null) | ||
7358 | return ""; | ||
7357 | return (xmlrpcMod.SendRemoteData(m_host.LocalId, m_item.ItemID, channel, dest, idata, sdata)).ToString(); | 7359 | return (xmlrpcMod.SendRemoteData(m_host.LocalId, m_item.ItemID, channel, dest, idata, sdata)).ToString(); |
7358 | } | 7360 | } |
7359 | 7361 | ||
@@ -7361,7 +7363,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
7361 | { | 7363 | { |
7362 | m_host.AddScriptLPS(1); | 7364 | m_host.AddScriptLPS(1); |
7363 | IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface<IXMLRPC>(); | 7365 | IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface<IXMLRPC>(); |
7364 | xmlrpcMod.RemoteDataReply(channel, message_id, sdata, idata); | 7366 | if (xmlrpcMod != null) |
7367 | xmlrpcMod.RemoteDataReply(channel, message_id, sdata, idata); | ||
7365 | ScriptSleep(3000); | 7368 | ScriptSleep(3000); |
7366 | } | 7369 | } |
7367 | 7370 | ||
@@ -7369,7 +7372,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
7369 | { | 7372 | { |
7370 | m_host.AddScriptLPS(1); | 7373 | m_host.AddScriptLPS(1); |
7371 | IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface<IXMLRPC>(); | 7374 | IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface<IXMLRPC>(); |
7372 | xmlrpcMod.CloseXMLRPCChannel((UUID)channel); | 7375 | if (xmlrpcMod != null) |
7376 | xmlrpcMod.CloseXMLRPCChannel((UUID)channel); | ||
7373 | ScriptSleep(1000); | 7377 | ScriptSleep(1000); |
7374 | } | 7378 | } |
7375 | 7379 | ||
@@ -7782,8 +7786,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
7782 | m_host.AddScriptLPS(1); | 7786 | m_host.AddScriptLPS(1); |
7783 | 7787 | ||
7784 | setLinkPrimParams(linknumber, rules, "llSetLinkPrimitiveParamsFast"); | 7788 | setLinkPrimParams(linknumber, rules, "llSetLinkPrimitiveParamsFast"); |
7785 | |||
7786 | ScriptSleep(200); | ||
7787 | } | 7789 | } |
7788 | 7790 | ||
7789 | private void setLinkPrimParams(int linknumber, LSL_List rules, string originFunc) | 7791 | private void setLinkPrimParams(int linknumber, LSL_List rules, string originFunc) |
@@ -12209,7 +12211,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
12209 | bool checkPhysical = !((rejectTypes & ScriptBaseClass.RC_REJECT_PHYSICAL) == ScriptBaseClass.RC_REJECT_PHYSICAL); | 12211 | bool checkPhysical = !((rejectTypes & ScriptBaseClass.RC_REJECT_PHYSICAL) == ScriptBaseClass.RC_REJECT_PHYSICAL); |
12210 | 12212 | ||
12211 | 12213 | ||
12212 | if (World.SuportsRayCastFiltered()) | 12214 | if (World.SupportsRayCastFiltered()) |
12213 | { | 12215 | { |
12214 | if (dist == 0) | 12216 | if (dist == 0) |
12215 | return list; | 12217 | return list; |
@@ -12272,13 +12274,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
12272 | } | 12274 | } |
12273 | else | 12275 | else |
12274 | { | 12276 | { |
12275 | if (checkTerrain) | ||
12276 | { | ||
12277 | ContactResult? groundContact = GroundIntersection(rayStart, rayEnd); | ||
12278 | if (groundContact != null) | ||
12279 | results.Add((ContactResult)groundContact); | ||
12280 | } | ||
12281 | |||
12282 | if (checkAgents) | 12277 | if (checkAgents) |
12283 | { | 12278 | { |
12284 | ContactResult[] agentHits = AvatarIntersection(rayStart, rayEnd); | 12279 | ContactResult[] agentHits = AvatarIntersection(rayStart, rayEnd); |
@@ -12294,6 +12289,25 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
12294 | } | 12289 | } |
12295 | } | 12290 | } |
12296 | 12291 | ||
12292 | // Double check this | ||
12293 | if (checkTerrain) | ||
12294 | { | ||
12295 | bool skipGroundCheck = false; | ||
12296 | |||
12297 | foreach (ContactResult c in results) | ||
12298 | { | ||
12299 | if (c.ConsumerID == 0) // Physics gave us a ground collision | ||
12300 | skipGroundCheck = true; | ||
12301 | } | ||
12302 | |||
12303 | if (!skipGroundCheck) | ||
12304 | { | ||
12305 | ContactResult? groundContact = GroundIntersection(rayStart, rayEnd); | ||
12306 | if (groundContact != null) | ||
12307 | results.Add((ContactResult)groundContact); | ||
12308 | } | ||
12309 | } | ||
12310 | |||
12297 | results.Sort(delegate(ContactResult a, ContactResult b) | 12311 | results.Sort(delegate(ContactResult a, ContactResult b) |
12298 | { | 12312 | { |
12299 | return a.Depth.CompareTo(b.Depth); | 12313 | return a.Depth.CompareTo(b.Depth); |
@@ -12587,7 +12601,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
12587 | } | 12601 | } |
12588 | 12602 | ||
12589 | bool result = money.ObjectGiveMoney( | 12603 | bool result = money.ObjectGiveMoney( |
12590 | m_host.ParentGroup.RootPart.UUID, m_host.ParentGroup.RootPart.OwnerID, toID, amount,UUID.Zero); | 12604 | m_host.ParentGroup.RootPart.UUID, m_host.ParentGroup.RootPart.OwnerID, toID, amount, txn); |
12591 | 12605 | ||
12592 | if (result) | 12606 | if (result) |
12593 | { | 12607 | { |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 51c8c7e..7c2f8ed 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | |||
@@ -1821,17 +1821,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1821 | { | 1821 | { |
1822 | UUID assetID = UUID.Zero; | 1822 | UUID assetID = UUID.Zero; |
1823 | 1823 | ||
1824 | if (!UUID.TryParse(notecardNameOrUuid, out assetID)) | 1824 | bool notecardNameIsUUID = UUID.TryParse(notecardNameOrUuid, out assetID); |
1825 | |||
1826 | if (!notecardNameIsUUID) | ||
1825 | { | 1827 | { |
1826 | m_host.TaskInventory.LockItemsForRead(true); | 1828 | assetID = SearchTaskInventoryForAssetId(notecardNameOrUuid); |
1827 | foreach (TaskInventoryItem item in m_host.TaskInventory.Values) | ||
1828 | { | ||
1829 | if (item.Type == 7 && item.Name == notecardNameOrUuid) | ||
1830 | { | ||
1831 | assetID = item.AssetID; | ||
1832 | } | ||
1833 | } | ||
1834 | m_host.TaskInventory.LockItemsForRead(false); | ||
1835 | } | 1829 | } |
1836 | 1830 | ||
1837 | if (assetID == UUID.Zero) | 1831 | if (assetID == UUID.Zero) |
@@ -1842,7 +1836,23 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1842 | AssetBase a = World.AssetService.Get(assetID.ToString()); | 1836 | AssetBase a = World.AssetService.Get(assetID.ToString()); |
1843 | 1837 | ||
1844 | if (a == null) | 1838 | if (a == null) |
1845 | return UUID.Zero; | 1839 | { |
1840 | // Whoops, it's still possible here that the notecard name was properly | ||
1841 | // formatted like a UUID but isn't an asset UUID so lets look it up by name after all | ||
1842 | assetID = SearchTaskInventoryForAssetId(notecardNameOrUuid); | ||
1843 | if (assetID == UUID.Zero) | ||
1844 | return UUID.Zero; | ||
1845 | |||
1846 | if (!NotecardCache.IsCached(assetID)) | ||
1847 | { | ||
1848 | a = World.AssetService.Get(assetID.ToString()); | ||
1849 | |||
1850 | if (a == null) | ||
1851 | { | ||
1852 | return UUID.Zero; | ||
1853 | } | ||
1854 | } | ||
1855 | } | ||
1846 | 1856 | ||
1847 | string data = Encoding.UTF8.GetString(a.Data); | 1857 | string data = Encoding.UTF8.GetString(a.Data); |
1848 | NotecardCache.Cache(assetID, data); | 1858 | NotecardCache.Cache(assetID, data); |
@@ -1850,6 +1860,20 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1850 | 1860 | ||
1851 | return assetID; | 1861 | return assetID; |
1852 | } | 1862 | } |
1863 | protected UUID SearchTaskInventoryForAssetId(string name) | ||
1864 | { | ||
1865 | UUID assetId = UUID.Zero; | ||
1866 | m_host.TaskInventory.LockItemsForRead(true); | ||
1867 | foreach (TaskInventoryItem item in m_host.TaskInventory.Values) | ||
1868 | { | ||
1869 | if (item.Type == 7 && item.Name == name) | ||
1870 | { | ||
1871 | assetId = item.AssetID; | ||
1872 | } | ||
1873 | } | ||
1874 | m_host.TaskInventory.LockItemsForRead(false); | ||
1875 | return assetId; | ||
1876 | } | ||
1853 | 1877 | ||
1854 | /// <summary> | 1878 | /// <summary> |
1855 | /// Directly get an entire notecard at once. | 1879 | /// Directly get an entire notecard at once. |