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

View File

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