Implements three new OSSL functions for parcel management: osParcelJoin joins parcels in an area, osParcelSubdivide splits parcels in an area, osParcelSetDetails sets parcel name, description, owner and group owner. Join and Subdivide methods in LandChannel are exposed.

This commit is contained in:
OpenSim Master
2010-04-29 11:57:30 -07:00
committed by unknown
parent 5d8638ed88
commit 4c740e1717
8 changed files with 144 additions and 0 deletions

View File

@@ -1129,7 +1129,89 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return 0.0f;
}
// Routines for creating and managing parcels programmatically
public void osParcelJoin(LSL_Vector pos1, LSL_Vector pos2)
{
CheckThreatLevel(ThreatLevel.High, "osParcelJoin");
m_host.AddScriptLPS(1);
int startx = (int)(pos1.x < pos2.x ? pos1.x : pos2.x);
int starty = (int)(pos1.y < pos2.y ? pos1.y : pos2.y);
int endx = (int)(pos1.x > pos2.x ? pos1.x : pos2.x);
int endy = (int)(pos1.y > pos2.y ? pos1.y : pos2.y);
World.LandChannel.Join(startx,starty,endx,endy,m_host.OwnerID);
}
public void osParcelSubdivide(LSL_Vector pos1, LSL_Vector pos2)
{
CheckThreatLevel(ThreatLevel.High, "osParcelSubdivide");
m_host.AddScriptLPS(1);
int startx = (int)(pos1.x < pos2.x ? pos1.x : pos2.x);
int starty = (int)(pos1.y < pos2.y ? pos1.y : pos2.y);
int endx = (int)(pos1.x > pos2.x ? pos1.x : pos2.x);
int endy = (int)(pos1.y > pos2.y ? pos1.y : pos2.y);
World.LandChannel.Subdivide(startx,starty,endx,endy,m_host.OwnerID);
}
public void osParcelSetDetails(LSL_Vector pos, LSL_List rules)
{
CheckThreatLevel(ThreatLevel.High, "osParcelSetDetails");
m_host.AddScriptLPS(1);
// Get a reference to the land data and make sure the owner of the script
// can modify it
ILandObject startLandObject = World.LandChannel.GetLandObject((int)pos.x, (int)pos.y);
if (startLandObject == null)
{
OSSLShoutError("There is no land at that location");
return;
}
if (! World.Permissions.CanEditParcel(m_host.OwnerID, startLandObject))
{
OSSLShoutError("You do not have permission to modify the parcel");
return;
}
// Create a new land data object we can modify
LandData newLand = startLandObject.LandData.Copy();
UUID uuid;
// Process the rules, not sure what the impact would be of changing owner or group
for (int idx = 0; idx < rules.Length; )
{
int code = rules.GetLSLIntegerItem(idx++);
string arg = rules.GetLSLStringItem(idx++);
switch (code)
{
case 0:
newLand.Name = arg;
break;
case 1:
newLand.Description = arg;
break;
case 2:
CheckThreatLevel(ThreatLevel.VeryHigh, "osParcelSetDetails");
if (UUID.TryParse(arg , out uuid))
newLand.OwnerID = uuid;
break;
case 3:
CheckThreatLevel(ThreatLevel.VeryHigh, "osParcelSetDetails");
if (UUID.TryParse(arg , out uuid))
newLand.GroupID = uuid;
break;
}
}
World.LandChannel.UpdateLandObject(newLand.LocalID,newLand);
}
public double osList2Double(LSL_Types.list src, int index)
{