aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/Shared/Api/Implementation
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs88
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs91
2 files changed, 133 insertions, 46 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 3c5f2d0..30fb252 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -6287,16 +6287,25 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6287 { 6287 {
6288 m_host.AddScriptLPS(1); 6288 m_host.AddScriptLPS(1);
6289 UUID key; 6289 UUID key;
6290 LandData land = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y).LandData; 6290 ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y);
6291 if (land.OwnerID == m_host.OwnerID) 6291 if (World.Permissions.CanEditParcelProperties(m_host.OwnerID, land, GroupPowers.LandManageAllowed))
6292 { 6292 {
6293 ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry(); 6293 ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry();
6294 if (UUID.TryParse(avatar, out key)) 6294 if (UUID.TryParse(avatar, out key))
6295 { 6295 {
6296 entry.AgentID = key; 6296 if (land.LandData.ParcelAccessList.FindIndex(
6297 entry.Flags = AccessList.Access; 6297 delegate(ParcelManager.ParcelAccessEntry e)
6298 entry.Time = DateTime.Now.AddHours(hours); 6298 {
6299 land.ParcelAccessList.Add(entry); 6299 if (e.AgentID == key && e.Flags == AccessList.Access)
6300 return true;
6301 return false;
6302 }) == -1)
6303 {
6304 entry.AgentID = key;
6305 entry.Flags = AccessList.Access;
6306 entry.Time = DateTime.Now.AddHours(hours);
6307 land.LandData.ParcelAccessList.Add(entry);
6308 }
6300 } 6309 }
6301 } 6310 }
6302 ScriptSleep(100); 6311 ScriptSleep(100);
@@ -9023,7 +9032,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
9023 // according to the docs, this command only works if script owner and land owner are the same 9032 // according to the docs, this command only works if script owner and land owner are the same
9024 // lets add estate owners and gods, too, and use the generic permission check. 9033 // lets add estate owners and gods, too, and use the generic permission check.
9025 ILandObject landObject = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y); 9034 ILandObject landObject = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y);
9026 if (!World.Permissions.CanEditParcel(m_host.OwnerID, landObject)) return; 9035 if (!World.Permissions.CanEditParcelProperties(m_host.OwnerID, landObject, GroupPowers.ChangeMedia)) return;
9027 9036
9028 bool update = false; // send a ParcelMediaUpdate (and possibly change the land's media URL)? 9037 bool update = false; // send a ParcelMediaUpdate (and possibly change the land's media URL)?
9029 byte loop = 0; 9038 byte loop = 0;
@@ -9466,16 +9475,25 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
9466 { 9475 {
9467 m_host.AddScriptLPS(1); 9476 m_host.AddScriptLPS(1);
9468 UUID key; 9477 UUID key;
9469 LandData land = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y).LandData; 9478 ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y);
9470 if (land.OwnerID == m_host.OwnerID) 9479 if (World.Permissions.CanEditParcelProperties(m_host.OwnerID, land, GroupPowers.LandManageBanned))
9471 { 9480 {
9472 ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry(); 9481 ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry();
9473 if (UUID.TryParse(avatar, out key)) 9482 if (UUID.TryParse(avatar, out key))
9474 { 9483 {
9475 entry.AgentID = key; 9484 if (land.LandData.ParcelAccessList.FindIndex(
9476 entry.Flags = AccessList.Ban; 9485 delegate(ParcelManager.ParcelAccessEntry e)
9477 entry.Time = DateTime.Now.AddHours(hours); 9486 {
9478 land.ParcelAccessList.Add(entry); 9487 if (e.AgentID == key && e.Flags == AccessList.Ban)
9488 return true;
9489 return false;
9490 }) == -1)
9491 {
9492 entry.AgentID = key;
9493 entry.Flags = AccessList.Ban;
9494 entry.Time = DateTime.Now.AddHours(hours);
9495 land.LandData.ParcelAccessList.Add(entry);
9496 }
9479 } 9497 }
9480 } 9498 }
9481 ScriptSleep(100); 9499 ScriptSleep(100);
@@ -9485,19 +9503,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
9485 { 9503 {
9486 m_host.AddScriptLPS(1); 9504 m_host.AddScriptLPS(1);
9487 UUID key; 9505 UUID key;
9488 LandData land = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y).LandData; 9506 ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y);
9489 if (land.OwnerID == m_host.OwnerID) 9507 if (World.Permissions.CanEditParcelProperties(m_host.OwnerID, land, GroupPowers.LandManageAllowed))
9490 { 9508 {
9491 if (UUID.TryParse(avatar, out key)) 9509 if (UUID.TryParse(avatar, out key))
9492 { 9510 {
9493 foreach (ParcelManager.ParcelAccessEntry entry in land.ParcelAccessList) 9511 int idx = land.LandData.ParcelAccessList.FindIndex(
9494 { 9512 delegate(ParcelManager.ParcelAccessEntry e)
9495 if (entry.AgentID == key && entry.Flags == AccessList.Access) 9513 {
9496 { 9514 if (e.AgentID == key && e.Flags == AccessList.Access)
9497 land.ParcelAccessList.Remove(entry); 9515 return true;
9498 break; 9516 return false;
9499 } 9517 });
9500 } 9518
9519 if (idx != -1)
9520 land.LandData.ParcelAccessList.RemoveAt(idx);
9501 } 9521 }
9502 } 9522 }
9503 ScriptSleep(100); 9523 ScriptSleep(100);
@@ -9507,19 +9527,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
9507 { 9527 {
9508 m_host.AddScriptLPS(1); 9528 m_host.AddScriptLPS(1);
9509 UUID key; 9529 UUID key;
9510 LandData land = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y).LandData; 9530 ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y);
9511 if (land.OwnerID == m_host.OwnerID) 9531 if (World.Permissions.CanEditParcelProperties(m_host.OwnerID, land, GroupPowers.LandManageBanned))
9512 { 9532 {
9513 if (UUID.TryParse(avatar, out key)) 9533 if (UUID.TryParse(avatar, out key))
9514 { 9534 {
9515 foreach (ParcelManager.ParcelAccessEntry entry in land.ParcelAccessList) 9535 int idx = land.LandData.ParcelAccessList.FindIndex(
9516 { 9536 delegate(ParcelManager.ParcelAccessEntry e)
9517 if (entry.AgentID == key && entry.Flags == AccessList.Ban) 9537 {
9518 { 9538 if (e.AgentID == key && e.Flags == AccessList.Ban)
9519 land.ParcelAccessList.Remove(entry); 9539 return true;
9520 break; 9540 return false;
9521 } 9541 });
9522 } 9542
9543 if (idx != -1)
9544 land.LandData.ParcelAccessList.RemoveAt(idx);
9523 } 9545 }
9524 } 9546 }
9525 ScriptSleep(100); 9547 ScriptSleep(100);
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
index 827626f..5a796b8 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -336,6 +336,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
336 } 336 }
337 } 337 }
338 338
339 internal void OSSLDeprecated(string function, string replacement)
340 {
341 OSSLShoutError(string.Format("Use of function {0} is deprecated. Use {1} instead.", function, replacement));
342 }
343
339 protected void ScriptSleep(int delay) 344 protected void ScriptSleep(int delay)
340 { 345 {
341 delay = (int)((float)delay * m_ScriptDelayFactor); 346 delay = (int)((float)delay * m_ScriptDelayFactor);
@@ -347,13 +352,22 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
347 // 352 //
348 // OpenSim functions 353 // OpenSim functions
349 // 354 //
355 public LSL_Integer osSetTerrainHeight(int x, int y, double val)
356 {
357 CheckThreatLevel(ThreatLevel.High, "osSetTerrainHeight");
358 return SetTerrainHeight(x, y, val);
359 }
350 public LSL_Integer osTerrainSetHeight(int x, int y, double val) 360 public LSL_Integer osTerrainSetHeight(int x, int y, double val)
351 { 361 {
352 CheckThreatLevel(ThreatLevel.High, "osTerrainSetHeight"); 362 CheckThreatLevel(ThreatLevel.High, "osTerrainSetHeight");
353 363 OSSLDeprecated("osTerrainSetHeight", "osSetTerrainHeight");
364 return SetTerrainHeight(x, y, val);
365 }
366 private LSL_Integer SetTerrainHeight(int x, int y, double val)
367 {
354 m_host.AddScriptLPS(1); 368 m_host.AddScriptLPS(1);
355 if (x > ((int)Constants.RegionSize - 1) || x < 0 || y > ((int)Constants.RegionSize - 1) || y < 0) 369 if (x > ((int)Constants.RegionSize - 1) || x < 0 || y > ((int)Constants.RegionSize - 1) || y < 0)
356 OSSLError("osTerrainSetHeight: Coordinate out of bounds"); 370 OSSLError("osSetTerrainHeight: Coordinate out of bounds");
357 371
358 if (World.Permissions.CanTerraformLand(m_host.OwnerID, new Vector3(x, y, 0))) 372 if (World.Permissions.CanTerraformLand(m_host.OwnerID, new Vector3(x, y, 0)))
359 { 373 {
@@ -366,13 +380,22 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
366 } 380 }
367 } 381 }
368 382
383 public LSL_Float osGetTerrainHeight(int x, int y)
384 {
385 CheckThreatLevel(ThreatLevel.None, "osGetTerrainHeight");
386 return GetTerrainHeight(x, y);
387 }
369 public LSL_Float osTerrainGetHeight(int x, int y) 388 public LSL_Float osTerrainGetHeight(int x, int y)
370 { 389 {
371 CheckThreatLevel(ThreatLevel.None, "osTerrainGetHeight"); 390 CheckThreatLevel(ThreatLevel.None, "osTerrainGetHeight");
372 391 OSSLDeprecated("osTerrainGetHeight", "osGetTerrainHeight");
392 return GetTerrainHeight(x, y);
393 }
394 private LSL_Float GetTerrainHeight(int x, int y)
395 {
373 m_host.AddScriptLPS(1); 396 m_host.AddScriptLPS(1);
374 if (x > ((int)Constants.RegionSize - 1) || x < 0 || y > ((int)Constants.RegionSize - 1) || y < 0) 397 if (x > ((int)Constants.RegionSize - 1) || x < 0 || y > ((int)Constants.RegionSize - 1) || y < 0)
375 OSSLError("osTerrainGetHeight: Coordinate out of bounds"); 398 OSSLError("osGetTerrainHeight: Coordinate out of bounds");
376 399
377 return World.Heightmap[x, y]; 400 return World.Heightmap[x, y];
378 } 401 }
@@ -1001,9 +1024,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1001 return drawList; 1024 return drawList;
1002 } 1025 }
1003 1026
1027 public string osSetPenColor(string drawList, string color)
1028 {
1029 CheckThreatLevel(ThreatLevel.None, "osSetPenColor");
1030
1031 m_host.AddScriptLPS(1);
1032 drawList += "PenColor " + color + "; ";
1033 return drawList;
1034 }
1035 // Deprecated
1004 public string osSetPenColour(string drawList, string colour) 1036 public string osSetPenColour(string drawList, string colour)
1005 { 1037 {
1006 CheckThreatLevel(ThreatLevel.None, "osSetPenColour"); 1038 CheckThreatLevel(ThreatLevel.None, "osSetPenColour");
1039 OSSLDeprecated("osSetPenColour", "osSetPenColor");
1007 1040
1008 m_host.AddScriptLPS(1); 1041 m_host.AddScriptLPS(1);
1009 drawList += "PenColour " + colour + "; "; 1042 drawList += "PenColour " + colour + "; ";
@@ -1012,7 +1045,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1012 1045
1013 public string osSetPenCap(string drawList, string direction, string type) 1046 public string osSetPenCap(string drawList, string direction, string type)
1014 { 1047 {
1015 CheckThreatLevel(ThreatLevel.None, "osSetPenColour"); 1048 CheckThreatLevel(ThreatLevel.None, "osSetPenCap");
1016 1049
1017 m_host.AddScriptLPS(1); 1050 m_host.AddScriptLPS(1);
1018 drawList += "PenCap " + direction + "," + type + "; "; 1051 drawList += "PenCap " + direction + "," + type + "; ";
@@ -1157,6 +1190,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1157 public double osSunGetParam(string param) 1190 public double osSunGetParam(string param)
1158 { 1191 {
1159 CheckThreatLevel(ThreatLevel.None, "osSunGetParam"); 1192 CheckThreatLevel(ThreatLevel.None, "osSunGetParam");
1193 OSSLDeprecated("osSunGetParam", "osGetSunParam");
1194 return GetSunParam(param);
1195 }
1196 public double osGetSunParam(string param)
1197 {
1198 CheckThreatLevel(ThreatLevel.None, "osGetSunParam");
1199 return GetSunParam(param);
1200 }
1201 private double GetSunParam(string param)
1202 {
1160 m_host.AddScriptLPS(1); 1203 m_host.AddScriptLPS(1);
1161 1204
1162 double value = 0.0; 1205 double value = 0.0;
@@ -1173,6 +1216,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1173 public void osSunSetParam(string param, double value) 1216 public void osSunSetParam(string param, double value)
1174 { 1217 {
1175 CheckThreatLevel(ThreatLevel.None, "osSunSetParam"); 1218 CheckThreatLevel(ThreatLevel.None, "osSunSetParam");
1219 OSSLDeprecated("osSunSetParam", "osSetSunParam");
1220 SetSunParam(param, value);
1221 }
1222 public void osSetSunParam(string param, double value)
1223 {
1224 CheckThreatLevel(ThreatLevel.None, "osSetSunParam");
1225 SetSunParam(param, value);
1226 }
1227 private void SetSunParam(string param, double value)
1228 {
1176 m_host.AddScriptLPS(1); 1229 m_host.AddScriptLPS(1);
1177 1230
1178 ISunModule module = World.RequestModuleInterface<ISunModule>(); 1231 ISunModule module = World.RequestModuleInterface<ISunModule>();
@@ -1198,9 +1251,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1198 return String.Empty; 1251 return String.Empty;
1199 } 1252 }
1200 1253
1201 public void osWindParamSet(string plugin, string param, float value) 1254 public void osSetWindParam(string plugin, string param, float value)
1202 { 1255 {
1203 CheckThreatLevel(ThreatLevel.VeryLow, "osWindParamSet"); 1256 CheckThreatLevel(ThreatLevel.VeryLow, "osSetWindParam");
1204 m_host.AddScriptLPS(1); 1257 m_host.AddScriptLPS(1);
1205 1258
1206 IWindModule module = World.RequestModuleInterface<IWindModule>(); 1259 IWindModule module = World.RequestModuleInterface<IWindModule>();
@@ -1214,9 +1267,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1214 } 1267 }
1215 } 1268 }
1216 1269
1217 public float osWindParamGet(string plugin, string param) 1270 public float osGetWindParam(string plugin, string param)
1218 { 1271 {
1219 CheckThreatLevel(ThreatLevel.VeryLow, "osWindParamGet"); 1272 CheckThreatLevel(ThreatLevel.VeryLow, "osGetWindParam");
1220 m_host.AddScriptLPS(1); 1273 m_host.AddScriptLPS(1);
1221 1274
1222 IWindModule module = World.RequestModuleInterface<IWindModule>(); 1275 IWindModule module = World.RequestModuleInterface<IWindModule>();
@@ -1257,7 +1310,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1257 1310
1258 public void osParcelSetDetails(LSL_Vector pos, LSL_List rules) 1311 public void osParcelSetDetails(LSL_Vector pos, LSL_List rules)
1259 { 1312 {
1260 CheckThreatLevel(ThreatLevel.High, "osParcelSetDetails"); 1313 const string functionName = "osParcelSetDetails";
1314 CheckThreatLevel(ThreatLevel.High, functionName);
1315 OSSLDeprecated(functionName, "osSetParcelDetails");
1316 SetParcelDetails(pos, rules, functionName);
1317 }
1318 public void osSetParcelDetails(LSL_Vector pos, LSL_List rules)
1319 {
1320 const string functionName = "osSetParcelDetails";
1321 CheckThreatLevel(ThreatLevel.High, functionName);
1322 SetParcelDetails(pos, rules, functionName);
1323 }
1324 private void SetParcelDetails(LSL_Vector pos, LSL_List rules, string functionName)
1325 {
1261 m_host.AddScriptLPS(1); 1326 m_host.AddScriptLPS(1);
1262 1327
1263 // Get a reference to the land data and make sure the owner of the script 1328 // Get a reference to the land data and make sure the owner of the script
@@ -1270,7 +1335,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1270 return; 1335 return;
1271 } 1336 }
1272 1337
1273 if (! World.Permissions.CanEditParcel(m_host.OwnerID, startLandObject)) 1338 if (!World.Permissions.CanEditParcelProperties(m_host.OwnerID, startLandObject, GroupPowers.LandOptions))
1274 { 1339 {
1275 OSSLShoutError("You do not have permission to modify the parcel"); 1340 OSSLShoutError("You do not have permission to modify the parcel");
1276 return; 1341 return;
@@ -1296,13 +1361,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1296 break; 1361 break;
1297 1362
1298 case 2: 1363 case 2:
1299 CheckThreatLevel(ThreatLevel.VeryHigh, "osParcelSetDetails"); 1364 CheckThreatLevel(ThreatLevel.VeryHigh, functionName);
1300 if (UUID.TryParse(arg , out uuid)) 1365 if (UUID.TryParse(arg , out uuid))
1301 newLand.OwnerID = uuid; 1366 newLand.OwnerID = uuid;
1302 break; 1367 break;
1303 1368
1304 case 3: 1369 case 3:
1305 CheckThreatLevel(ThreatLevel.VeryHigh, "osParcelSetDetails"); 1370 CheckThreatLevel(ThreatLevel.VeryHigh, functionName);
1306 if (UUID.TryParse(arg , out uuid)) 1371 if (UUID.TryParse(arg , out uuid))
1307 newLand.GroupID = uuid; 1372 newLand.GroupID = uuid;
1308 break; 1373 break;