mirror of
https://github.com/opensim/opensim.git
synced 2026-08-01 06:06:06 +08:00
Merge branch 'master' into cooptermination
This commit is contained in:
@@ -2748,42 +2748,40 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
return src.ToLower();
|
||||
}
|
||||
|
||||
public LSL_Integer llGiveMoney(string destination, int amount)
|
||||
public void llGiveMoney(string destination, int amount)
|
||||
{
|
||||
m_host.AddScriptLPS(1);
|
||||
|
||||
if (m_item.PermsGranter == UUID.Zero)
|
||||
return 0;
|
||||
|
||||
if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_DEBIT) == 0)
|
||||
Util.FireAndForget(x =>
|
||||
{
|
||||
LSLError("No permissions to give money");
|
||||
return 0;
|
||||
}
|
||||
m_host.AddScriptLPS(1);
|
||||
|
||||
UUID toID = new UUID();
|
||||
if (m_item.PermsGranter == UUID.Zero)
|
||||
return;
|
||||
|
||||
if (!UUID.TryParse(destination, out toID))
|
||||
{
|
||||
LSLError("Bad key in llGiveMoney");
|
||||
return 0;
|
||||
}
|
||||
if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_DEBIT) == 0)
|
||||
{
|
||||
LSLError("No permissions to give money");
|
||||
return;
|
||||
}
|
||||
|
||||
IMoneyModule money = World.RequestModuleInterface<IMoneyModule>();
|
||||
UUID toID = new UUID();
|
||||
|
||||
if (money == null)
|
||||
{
|
||||
NotImplemented("llGiveMoney");
|
||||
return 0;
|
||||
}
|
||||
if (!UUID.TryParse(destination, out toID))
|
||||
{
|
||||
LSLError("Bad key in llGiveMoney");
|
||||
return;
|
||||
}
|
||||
|
||||
bool result = money.ObjectGiveMoney(
|
||||
m_host.ParentGroup.RootPart.UUID, m_host.ParentGroup.RootPart.OwnerID, toID, amount);
|
||||
IMoneyModule money = World.RequestModuleInterface<IMoneyModule>();
|
||||
|
||||
if (result)
|
||||
return 1;
|
||||
if (money == null)
|
||||
{
|
||||
NotImplemented("llGiveMoney");
|
||||
return;
|
||||
}
|
||||
|
||||
return 0;
|
||||
money.ObjectGiveMoney(
|
||||
m_host.ParentGroup.RootPart.UUID, m_host.ParentGroup.RootPart.OwnerID, toID, amount);
|
||||
});
|
||||
}
|
||||
|
||||
public void llMakeExplosion(int particles, double scale, double vel, double lifetime, double arc, string texture, LSL_Vector offset)
|
||||
@@ -3374,7 +3372,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
if (animID == UUID.Zero)
|
||||
presence.Animator.RemoveAnimation(anim);
|
||||
else
|
||||
presence.Animator.RemoveAnimation(animID);
|
||||
presence.Animator.RemoveAnimation(animID, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4933,7 +4931,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
public LSL_Vector llGetCenterOfMass()
|
||||
{
|
||||
m_host.AddScriptLPS(1);
|
||||
Vector3 center = m_host.GetGeometricCenter();
|
||||
Vector3 center = m_host.GetCenterOfMass();
|
||||
return new LSL_Vector(center.X,center.Y,center.Z);
|
||||
}
|
||||
|
||||
@@ -5803,13 +5801,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
if (parcelOwned && land.LandData.OwnerID == id ||
|
||||
parcel && land.LandData.GlobalID == id)
|
||||
{
|
||||
result.Add(ssp.UUID.ToString());
|
||||
result.Add(new LSL_Key(ssp.UUID.ToString()));
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
result.Add(ssp.UUID.ToString());
|
||||
result.Add(new LSL_Key(ssp.UUID.ToString()));
|
||||
}
|
||||
}
|
||||
// Maximum of 100 results
|
||||
@@ -6849,7 +6847,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
{
|
||||
m_host.AddScriptLPS(1);
|
||||
IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface<IXMLRPC>();
|
||||
if (xmlrpcMod.IsEnabled())
|
||||
if (xmlrpcMod != null && xmlrpcMod.IsEnabled())
|
||||
{
|
||||
UUID channelID = xmlrpcMod.OpenXMLRPCChannel(m_host.LocalId, m_item.ItemID, UUID.Zero);
|
||||
IXmlRpcRouter xmlRpcRouter = m_ScriptEngine.World.RequestModuleInterface<IXmlRpcRouter>();
|
||||
@@ -6881,6 +6879,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
m_host.AddScriptLPS(1);
|
||||
IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface<IXMLRPC>();
|
||||
ScriptSleep(3000);
|
||||
if (xmlrpcMod == null)
|
||||
return "";
|
||||
return (xmlrpcMod.SendRemoteData(m_host.LocalId, m_item.ItemID, channel, dest, idata, sdata)).ToString();
|
||||
}
|
||||
|
||||
@@ -6888,7 +6888,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
{
|
||||
m_host.AddScriptLPS(1);
|
||||
IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface<IXMLRPC>();
|
||||
xmlrpcMod.RemoteDataReply(channel, message_id, sdata, idata);
|
||||
if (xmlrpcMod != null)
|
||||
xmlrpcMod.RemoteDataReply(channel, message_id, sdata, idata);
|
||||
ScriptSleep(3000);
|
||||
}
|
||||
|
||||
@@ -6903,7 +6904,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
}
|
||||
|
||||
IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface<IXMLRPC>();
|
||||
xmlrpcMod.CloseXMLRPCChannel((UUID)channel);
|
||||
if (xmlrpcMod != null)
|
||||
xmlrpcMod.CloseXMLRPCChannel((UUID)channel);
|
||||
ScriptSleep(1000);
|
||||
}
|
||||
|
||||
@@ -10600,6 +10602,35 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
case ScriptBaseClass.OBJECT_PHYSICS_COST:
|
||||
ret.Add(new LSL_Float(0));
|
||||
break;
|
||||
case ScriptBaseClass.OBJECT_CHARACTER_TIME: // Pathfinding
|
||||
ret.Add(new LSL_Float(0));
|
||||
break;
|
||||
case ScriptBaseClass.OBJECT_ROOT:
|
||||
SceneObjectPart p = av.ParentPart;
|
||||
if (p != null)
|
||||
{
|
||||
ret.Add(new LSL_String(p.ParentGroup.RootPart.UUID.ToString()));
|
||||
}
|
||||
else
|
||||
{
|
||||
ret.Add(new LSL_String(id));
|
||||
}
|
||||
break;
|
||||
case ScriptBaseClass.OBJECT_ATTACHED_POINT:
|
||||
ret.Add(new LSL_Integer(0));
|
||||
break;
|
||||
case ScriptBaseClass.OBJECT_PATHFINDING_TYPE: // Pathfinding
|
||||
ret.Add(new LSL_Integer(ScriptBaseClass.OPT_AVATAR));
|
||||
break;
|
||||
case ScriptBaseClass.OBJECT_PHYSICS:
|
||||
ret.Add(new LSL_Integer(0));
|
||||
break;
|
||||
case ScriptBaseClass.OBJECT_PHANTOM:
|
||||
ret.Add(new LSL_Integer(0));
|
||||
break;
|
||||
case ScriptBaseClass.OBJECT_TEMP_ON_REZ:
|
||||
ret.Add(new LSL_Integer(0));
|
||||
break;
|
||||
default:
|
||||
// Invalid or unhandled constant.
|
||||
ret.Add(new LSL_Integer(ScriptBaseClass.OBJECT_UNKNOWN_DETAIL));
|
||||
@@ -10695,6 +10726,52 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
// The value returned in SL for normal prims looks like the prim count
|
||||
ret.Add(new LSL_Float(0));
|
||||
break;
|
||||
case ScriptBaseClass.OBJECT_CHARACTER_TIME: // Pathfinding
|
||||
ret.Add(new LSL_Float(0));
|
||||
break;
|
||||
case ScriptBaseClass.OBJECT_ROOT:
|
||||
ret.Add(new LSL_String(obj.ParentGroup.RootPart.UUID.ToString()));
|
||||
break;
|
||||
case ScriptBaseClass.OBJECT_ATTACHED_POINT:
|
||||
ret.Add(new LSL_Integer(obj.ParentGroup.AttachmentPoint));
|
||||
break;
|
||||
case ScriptBaseClass.OBJECT_PATHFINDING_TYPE:
|
||||
byte pcode = obj.Shape.PCode;
|
||||
if (obj.ParentGroup.AttachmentPoint != 0
|
||||
|| pcode == (byte)PCode.Grass
|
||||
|| pcode == (byte)PCode.Tree
|
||||
|| pcode == (byte)PCode.NewTree)
|
||||
{
|
||||
ret.Add(new LSL_Integer(ScriptBaseClass.OPT_OTHER));
|
||||
}
|
||||
else
|
||||
{
|
||||
ret.Add(new LSL_Integer(ScriptBaseClass.OPT_LEGACY_LINKSET));
|
||||
}
|
||||
break;
|
||||
case ScriptBaseClass.OBJECT_PHYSICS:
|
||||
if (obj.ParentGroup.AttachmentPoint != 0)
|
||||
{
|
||||
ret.Add(new LSL_Integer(0)); // Always false if attached
|
||||
}
|
||||
else
|
||||
{
|
||||
ret.Add(new LSL_Integer(obj.ParentGroup.UsesPhysics ? 1 : 0));
|
||||
}
|
||||
break;
|
||||
case ScriptBaseClass.OBJECT_PHANTOM:
|
||||
if (obj.ParentGroup.AttachmentPoint != 0)
|
||||
{
|
||||
ret.Add(new LSL_Integer(0)); // Always false if attached
|
||||
}
|
||||
else
|
||||
{
|
||||
ret.Add(new LSL_Integer(obj.ParentGroup.IsPhantom ? 1 : 0));
|
||||
}
|
||||
break;
|
||||
case ScriptBaseClass.OBJECT_TEMP_ON_REZ:
|
||||
ret.Add(new LSL_Integer(obj.ParentGroup.IsTemporary ? 1 : 0));
|
||||
break;
|
||||
default:
|
||||
// Invalid or unhandled constant.
|
||||
ret.Add(new LSL_Integer(ScriptBaseClass.OBJECT_UNKNOWN_DETAIL));
|
||||
@@ -11273,6 +11350,84 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
bool checkPhysical = !((rejectTypes & ScriptBaseClass.RC_REJECT_PHYSICAL) == ScriptBaseClass.RC_REJECT_PHYSICAL);
|
||||
|
||||
|
||||
if (World.SupportsRayCastFiltered())
|
||||
{
|
||||
if (dist == 0)
|
||||
return list;
|
||||
|
||||
RayFilterFlags rayfilter = RayFilterFlags.ClosestAndBackCull;
|
||||
if (checkTerrain)
|
||||
rayfilter |= RayFilterFlags.land;
|
||||
// if (checkAgents)
|
||||
// rayfilter |= RayFilterFlags.agent;
|
||||
if (checkPhysical)
|
||||
rayfilter |= RayFilterFlags.physical;
|
||||
if (checkNonPhysical)
|
||||
rayfilter |= RayFilterFlags.nonphysical;
|
||||
if (detectPhantom)
|
||||
rayfilter |= RayFilterFlags.LSLPhanton;
|
||||
|
||||
Vector3 direction = dir * ( 1/dist);
|
||||
|
||||
if(rayfilter == 0)
|
||||
{
|
||||
list.Add(new LSL_Integer(0));
|
||||
return list;
|
||||
}
|
||||
|
||||
// get some more contacts to sort ???
|
||||
int physcount = 4 * count;
|
||||
if (physcount > 20)
|
||||
physcount = 20;
|
||||
|
||||
object physresults;
|
||||
physresults = World.RayCastFiltered(rayStart, direction, dist, physcount, rayfilter);
|
||||
|
||||
if (physresults == null)
|
||||
{
|
||||
list.Add(new LSL_Integer(-3)); // timeout error
|
||||
return list;
|
||||
}
|
||||
|
||||
results = (List<ContactResult>)physresults;
|
||||
|
||||
// for now physics doesn't detect sitted avatars so do it outside physics
|
||||
if (checkAgents)
|
||||
{
|
||||
ContactResult[] agentHits = AvatarIntersection(rayStart, rayEnd);
|
||||
foreach (ContactResult r in agentHits)
|
||||
results.Add(r);
|
||||
}
|
||||
|
||||
// TODO: Replace this with a better solution. ObjectIntersection can only
|
||||
// detect nonphysical phantoms. They are detected by virtue of being
|
||||
// nonphysical (e.g. no PhysActor) so will not conflict with detecting
|
||||
// physicsl phantoms as done by the physics scene
|
||||
// We don't want anything else but phantoms here.
|
||||
if (detectPhantom)
|
||||
{
|
||||
ContactResult[] objectHits = ObjectIntersection(rayStart, rayEnd, false, false, true);
|
||||
foreach (ContactResult r in objectHits)
|
||||
results.Add(r);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (checkAgents)
|
||||
{
|
||||
ContactResult[] agentHits = AvatarIntersection(rayStart, rayEnd);
|
||||
foreach (ContactResult r in agentHits)
|
||||
results.Add(r);
|
||||
}
|
||||
|
||||
if (checkPhysical || checkNonPhysical || detectPhantom)
|
||||
{
|
||||
ContactResult[] objectHits = ObjectIntersection(rayStart, rayEnd, checkPhysical, checkNonPhysical, detectPhantom);
|
||||
foreach (ContactResult r in objectHits)
|
||||
results.Add(r);
|
||||
}
|
||||
}
|
||||
|
||||
if (checkTerrain)
|
||||
{
|
||||
ContactResult? groundContact = GroundIntersection(rayStart, rayEnd);
|
||||
@@ -11280,20 +11435,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
results.Add((ContactResult)groundContact);
|
||||
}
|
||||
|
||||
if (checkAgents)
|
||||
{
|
||||
ContactResult[] agentHits = AvatarIntersection(rayStart, rayEnd);
|
||||
foreach (ContactResult r in agentHits)
|
||||
results.Add(r);
|
||||
}
|
||||
|
||||
if (checkPhysical || checkNonPhysical || detectPhantom)
|
||||
{
|
||||
ContactResult[] objectHits = ObjectIntersection(rayStart, rayEnd, checkPhysical, checkNonPhysical, detectPhantom);
|
||||
foreach (ContactResult r in objectHits)
|
||||
results.Add(r);
|
||||
}
|
||||
|
||||
results.Sort(delegate(ContactResult a, ContactResult b)
|
||||
{
|
||||
return a.Depth.CompareTo(b.Depth);
|
||||
@@ -11489,6 +11630,79 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
NotImplemented("llGodLikeRezObject");
|
||||
}
|
||||
|
||||
public LSL_String llTransferLindenDollars(string destination, int amount)
|
||||
{
|
||||
UUID txn = UUID.Random();
|
||||
|
||||
Util.FireAndForget(delegate(object x)
|
||||
{
|
||||
int replycode = 0;
|
||||
string replydata = destination + "," + amount.ToString();
|
||||
|
||||
try
|
||||
{
|
||||
TaskInventoryItem item = m_item;
|
||||
if (item == null)
|
||||
{
|
||||
replydata = "SERVICE_ERROR";
|
||||
return;
|
||||
}
|
||||
|
||||
m_host.AddScriptLPS(1);
|
||||
|
||||
if (item.PermsGranter == UUID.Zero)
|
||||
{
|
||||
replydata = "MISSING_PERMISSION_DEBIT";
|
||||
return;
|
||||
}
|
||||
|
||||
if ((item.PermsMask & ScriptBaseClass.PERMISSION_DEBIT) == 0)
|
||||
{
|
||||
replydata = "MISSING_PERMISSION_DEBIT";
|
||||
return;
|
||||
}
|
||||
|
||||
UUID toID = new UUID();
|
||||
|
||||
if (!UUID.TryParse(destination, out toID))
|
||||
{
|
||||
replydata = "INVALID_AGENT";
|
||||
return;
|
||||
}
|
||||
|
||||
IMoneyModule money = World.RequestModuleInterface<IMoneyModule>();
|
||||
|
||||
if (money == null)
|
||||
{
|
||||
replydata = "TRANSFERS_DISABLED";
|
||||
return;
|
||||
}
|
||||
|
||||
bool result = money.ObjectGiveMoney(
|
||||
m_host.ParentGroup.RootPart.UUID, m_host.ParentGroup.RootPart.OwnerID, toID, amount);
|
||||
|
||||
if (result)
|
||||
{
|
||||
replycode = 1;
|
||||
return;
|
||||
}
|
||||
|
||||
replydata = "LINDENDOLLAR_INSUFFICIENTFUNDS";
|
||||
}
|
||||
finally
|
||||
{
|
||||
m_ScriptEngine.PostScriptEvent(m_item.ItemID, new EventParams(
|
||||
"transaction_result", new Object[] {
|
||||
new LSL_String(txn.ToString()),
|
||||
new LSL_Integer(replycode),
|
||||
new LSL_String(replydata) },
|
||||
new DetectParams[0]));
|
||||
}
|
||||
});
|
||||
|
||||
return txn.ToString();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
|
||||
@@ -986,7 +986,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
if (animID == UUID.Zero)
|
||||
target.Animator.RemoveAnimation(animation);
|
||||
else
|
||||
target.Animator.RemoveAnimation(animID);
|
||||
target.Animator.RemoveAnimation(animID, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -207,7 +207,8 @@ 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);
|
||||
LSL_Vector llGroundContour(LSL_Vector offset);
|
||||
|
||||
@@ -556,6 +556,23 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
|
||||
public const int OBJECT_SERVER_COST = 14;
|
||||
public const int OBJECT_STREAMING_COST = 15;
|
||||
public const int OBJECT_PHYSICS_COST = 16;
|
||||
public const int OBJECT_CHARACTER_TIME = 17;
|
||||
public const int OBJECT_ROOT = 18;
|
||||
public const int OBJECT_ATTACHED_POINT = 19;
|
||||
public const int OBJECT_PATHFINDING_TYPE = 20;
|
||||
public const int OBJECT_PHYSICS = 21;
|
||||
public const int OBJECT_PHANTOM = 22;
|
||||
public const int OBJECT_TEMP_ON_REZ = 23;
|
||||
|
||||
// Pathfinding types
|
||||
public const int OPT_OTHER = -1;
|
||||
public const int OPT_LEGACY_LINKSET = 0;
|
||||
public const int OPT_AVATAR = 1;
|
||||
public const int OPT_CHARACTER = 2;
|
||||
public const int OPT_WALKABLE = 3;
|
||||
public const int OPT_STATIC_OBSTACLE = 4;
|
||||
public const int OPT_MATERIAL_VOLUME = 5;
|
||||
public const int OPT_EXCLUSION_VOLUME = 6;
|
||||
|
||||
// for llGetAgentList
|
||||
public const int AGENT_LIST_PARCEL = 1;
|
||||
|
||||
@@ -869,9 +869,14 @@ 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)
|
||||
{
|
||||
return m_LSL_Functions.llTransferLindenDollars(destination, amount);
|
||||
}
|
||||
|
||||
public void llGodLikeRezObject(string inventory, LSL_Vector pos)
|
||||
|
||||
@@ -1514,7 +1514,8 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||
m_MaxScriptQueue = maxScriptQueue;
|
||||
|
||||
STPStartInfo startInfo = new STPStartInfo();
|
||||
startInfo.IdleTimeout = idleTimeout*1000; // convert to seconds as stated in .ini
|
||||
startInfo.ThreadPoolName = "XEngine";
|
||||
startInfo.IdleTimeout = idleTimeout * 1000; // convert to seconds as stated in .ini
|
||||
startInfo.MaxWorkerThreads = maxThreads;
|
||||
startInfo.MinWorkerThreads = minThreads;
|
||||
startInfo.ThreadPriority = threadPriority;;
|
||||
@@ -1522,7 +1523,6 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||
startInfo.StartSuspended = true;
|
||||
|
||||
m_ThreadPool = new SmartThreadPool(startInfo);
|
||||
m_ThreadPool.Name = "XEngine";
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
Reference in New Issue
Block a user