Remove the return value from llGiveMoney (it was a LSL extension of OpenSim) and

make the function async so the script thread is not held up waiting for comms
to an external server.
avinationmerge
Melanie 2013-01-23 18:58:29 +01:00
parent 997d53e532
commit 47f18caa22
3 changed files with 29 additions and 31 deletions

View File

@ -3017,17 +3017,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return src.ToLower();
}
public LSL_Integer llGiveMoney(string destination, int amount)
public void llGiveMoney(string destination, int amount)
{
Util.FireAndForget(x =>
{
m_host.AddScriptLPS(1);
if (m_item.PermsGranter == UUID.Zero)
return 0;
return;
if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_DEBIT) == 0)
{
LSLError("No permissions to give money");
return 0;
return;
}
UUID toID = new UUID();
@ -3035,7 +3037,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (!UUID.TryParse(destination, out toID))
{
LSLError("Bad key in llGiveMoney");
return 0;
return;
}
IMoneyModule money = World.RequestModuleInterface<IMoneyModule>();
@ -3043,16 +3045,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (money == null)
{
NotImplemented("llGiveMoney");
return 0;
return;
}
bool result = money.ObjectGiveMoney(
money.ObjectGiveMoney(
m_host.ParentGroup.RootPart.UUID, m_host.ParentGroup.RootPart.OwnerID, toID, amount,UUID.Zero);
if (result)
return 1;
return 0;
});
}
public void llMakeExplosion(int particles, double scale, double vel, double lifetime, double arc, string texture, LSL_Vector offset)
@ -12589,7 +12587,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
}
bool result = money.ObjectGiveMoney(
m_host.ParentGroup.RootPart.UUID, m_host.ParentGroup.RootPart.OwnerID, toID, amount,UUID.Zero);
m_host.ParentGroup.RootPart.UUID, m_host.ParentGroup.RootPart.OwnerID, toID, amount, txn);
if (result)
{

View File

@ -208,7 +208,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
LSL_Float llGetWallclock();
void llGiveInventory(string destination, string inventory);
void llGiveInventoryList(string destination, string category, LSL_List inventory);
LSL_Integer llGiveMoney(string destination, int amount);
void llGiveMoney(string destination, int amount);
LSL_String llTransferLindenDollars(string destination, int amount);
void llGodLikeRezObject(string inventory, LSL_Vector pos);
LSL_Float llGround(LSL_Vector offset);

View File

@ -876,9 +876,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
m_LSL_Functions.llGiveInventoryList(destination, category, inventory);
}
public LSL_Integer llGiveMoney(string destination, int amount)
public void llGiveMoney(string destination, int amount)
{
return m_LSL_Functions.llGiveMoney(destination, amount);
m_LSL_Functions.llGiveMoney(destination, amount);
}
public LSL_String llTransferLindenDollars(string destination, int amount)