aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorHomer Horwitz2009-04-19 13:34:28 +0000
committerHomer Horwitz2009-04-19 13:34:28 +0000
commit33e1316cede4f902a97464e521b7522990528cbc (patch)
treea8ff0a94e731b8f6715c96e0afbb928a715434d8
parentMoved ITerrainModule and ITerainEffect to OpenSim.Region.Framework.Interfaces... (diff)
downloadopensim-SC_OLD-33e1316cede4f902a97464e521b7522990528cbc.zip
opensim-SC_OLD-33e1316cede4f902a97464e521b7522990528cbc.tar.gz
opensim-SC_OLD-33e1316cede4f902a97464e521b7522990528cbc.tar.bz2
opensim-SC_OLD-33e1316cede4f902a97464e521b7522990528cbc.tar.xz
Terrain changes done via osTerrainSetHeight aren't shown immediately to the clients in
that region. I decided against sending the terrain on every call to osTerrainSetHeight (which makes it abysmally slow), and added a osTerrainFlush instead, which should be called after all the terrain-changes have been done. Changed some return types to LSL types, too, and removed some end-of-line spaces.
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs72
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs9
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs11
3 files changed, 56 insertions, 36 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
index 30e457e..275969a 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -270,7 +270,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
270 // 270 //
271 // OpenSim functions 271 // OpenSim functions
272 // 272 //
273 public int osTerrainSetHeight(int x, int y, double val) 273 public LSL_Integer osTerrainSetHeight(int x, int y, double val)
274 { 274 {
275 CheckThreatLevel(ThreatLevel.High, "osTerrainSetHeight"); 275 CheckThreatLevel(ThreatLevel.High, "osTerrainSetHeight");
276 276
@@ -289,7 +289,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
289 } 289 }
290 } 290 }
291 291
292 public double osTerrainGetHeight(int x, int y) 292 public LSL_Float osTerrainGetHeight(int x, int y)
293 { 293 {
294 CheckThreatLevel(ThreatLevel.None, "osTerrainGetHeight"); 294 CheckThreatLevel(ThreatLevel.None, "osTerrainGetHeight");
295 295
@@ -300,6 +300,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
300 return World.Heightmap[x, y]; 300 return World.Heightmap[x, y];
301 } 301 }
302 302
303 public void osTerrainFlush()
304 {
305 CheckThreatLevel(ThreatLevel.VeryLow, "osTerrainFlush");
306
307 ITerrainModule terrainModule = World.RequestModuleInterface<ITerrainModule>();
308 if (terrainModule != null) terrainModule.TaintTerrain();
309 }
310
303 public int osRegionRestart(double seconds) 311 public int osRegionRestart(double seconds)
304 { 312 {
305 // This is High here because region restart is not reliable 313 // This is High here because region restart is not reliable
@@ -504,23 +512,23 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
504 if (presence != null) 512 if (presence != null)
505 { 513 {
506 // agent must be over owners land to avoid abuse 514 // agent must be over owners land to avoid abuse
507 if (m_host.OwnerID 515 if (m_host.OwnerID
508 == World.LandChannel.GetLandObject( 516 == World.LandChannel.GetLandObject(
509 presence.AbsolutePosition.X, presence.AbsolutePosition.Y).landData.OwnerID) 517 presence.AbsolutePosition.X, presence.AbsolutePosition.Y).landData.OwnerID)
510 { 518 {
511 519
512 // Check for hostname , attempt to make a hglink 520 // Check for hostname , attempt to make a hglink
513 // and convert the regionName to the target region 521 // and convert the regionName to the target region
514 if ( regionName.Contains(".") && regionName.Contains(":")) 522 if ( regionName.Contains(".") && regionName.Contains(":"))
515 { 523 {
516 // Try to link the region 524 // Try to link the region
517 RegionInfo regInfo = HGHyperlink.TryLinkRegion(World, 525 RegionInfo regInfo = HGHyperlink.TryLinkRegion(World,
518 presence.ControllingClient, 526 presence.ControllingClient,
519 regionName); 527 regionName);
520 // Get the region name 528 // Get the region name
521 if (regInfo != null) 529 if (regInfo != null)
522 { 530 {
523 regionName = regInfo.RegionName; 531 regionName = regInfo.RegionName;
524 } 532 }
525 else 533 else
526 { 534 {
@@ -531,7 +539,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
531 World.RequestTeleportLocation(presence.ControllingClient, regionName, 539 World.RequestTeleportLocation(presence.ControllingClient, regionName,
532 new Vector3((float)position.x, (float)position.y, (float)position.z), 540 new Vector3((float)position.x, (float)position.y, (float)position.z),
533 new Vector3((float)lookat.x, (float)lookat.y, (float)lookat.z), (uint)TPFlags.ViaLocation); 541 new Vector3((float)lookat.x, (float)lookat.y, (float)lookat.z), (uint)TPFlags.ViaLocation);
534 542
535 ScriptSleep(5000); 543 ScriptSleep(5000);
536 } 544 }
537 } 545 }
@@ -555,9 +563,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
555 if (presence != null) 563 if (presence != null)
556 { 564 {
557 // agent must be over owners land to avoid abuse 565 // agent must be over owners land to avoid abuse
558 if (m_host.OwnerID 566 if (m_host.OwnerID
559 == World.LandChannel.GetLandObject( 567 == World.LandChannel.GetLandObject(
560 presence.AbsolutePosition.X, presence.AbsolutePosition.Y).landData.OwnerID) 568 presence.AbsolutePosition.X, presence.AbsolutePosition.Y).landData.OwnerID)
561 { 569 {
562 presence.ControllingClient.SendTeleportLocationStart(); 570 presence.ControllingClient.SendTeleportLocationStart();
563 World.RequestTeleportLocation(presence.ControllingClient, regionHandle, 571 World.RequestTeleportLocation(presence.ControllingClient, regionHandle,
@@ -592,7 +600,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
592 { 600 {
593 ScenePresence target = (ScenePresence)World.Entities[avatarID]; 601 ScenePresence target = (ScenePresence)World.Entities[avatarID];
594 EndPoint ep = target.ControllingClient.GetClientInfo().userEP; 602 EndPoint ep = target.ControllingClient.GetClientInfo().userEP;
595 if (ep is IPEndPoint) 603 if (ep is IPEndPoint)
596 { 604 {
597 IPEndPoint ip = (IPEndPoint)ep; 605 IPEndPoint ip = (IPEndPoint)ep;
598 return ip.Address.ToString(); 606 return ip.Address.ToString();
@@ -610,12 +618,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
610 CheckThreatLevel(ThreatLevel.None, "osGetAgents"); 618 CheckThreatLevel(ThreatLevel.None, "osGetAgents");
611 619
612 LSL_List result = new LSL_List(); 620 LSL_List result = new LSL_List();
613 foreach (ScenePresence avatar in World.GetAvatars()) 621 foreach (ScenePresence avatar in World.GetAvatars())
614 { 622 {
615 result.Add(avatar.Name); 623 result.Add(avatar.Name);
616 } 624 }
617 return result; 625 return result;
618 } 626 }
619 627
620 // Adam's super super custom animation functions 628 // Adam's super super custom animation functions
621 public void osAvatarPlayAnimation(string avatar, string animation) 629 public void osAvatarPlayAnimation(string avatar, string animation)
@@ -791,7 +799,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
791 799
792 LSL_Vector vec = new LSL_Vector(0,0,0); 800 LSL_Vector vec = new LSL_Vector(0,0,0);
793 IDynamicTextureManager textureManager = World.RequestModuleInterface<IDynamicTextureManager>(); 801 IDynamicTextureManager textureManager = World.RequestModuleInterface<IDynamicTextureManager>();
794 if (textureManager != null) 802 if (textureManager != null)
795 { 803 {
796 double xSize, ySize; 804 double xSize, ySize;
797 textureManager.GetDrawStringSize(contentType, text, fontName, fontSize, 805 textureManager.GetDrawStringSize(contentType, text, fontName, fontSize,
@@ -847,7 +855,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
847 855
848 while (sunHour < 0) 856 while (sunHour < 0)
849 sunHour += 24.0; 857 sunHour += 24.0;
850 858
851 859
852 World.RegionInfo.RegionSettings.UseEstateSun = useEstateSun; 860 World.RegionInfo.RegionSettings.UseEstateSun = useEstateSun;
853 World.RegionInfo.RegionSettings.SunPosition = sunHour + 6; // LL Region Sun Hour is 6 to 30 861 World.RegionInfo.RegionSettings.SunPosition = sunHour + 6; // LL Region Sun Hour is 6 to 30
@@ -1014,8 +1022,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1014 CheckThreatLevel(ThreatLevel.VeryLow, "osSetParcelMediaURL"); 1022 CheckThreatLevel(ThreatLevel.VeryLow, "osSetParcelMediaURL");
1015 1023
1016 m_host.AddScriptLPS(1); 1024 m_host.AddScriptLPS(1);
1017 1025
1018 ILandObject land 1026 ILandObject land
1019 = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y); 1027 = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y);
1020 1028
1021 if (land.landData.OwnerID != m_host.ObjectOwner) 1029 if (land.landData.OwnerID != m_host.ObjectOwner)
@@ -1350,12 +1358,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1350 CheckThreatLevel(ThreatLevel.Low, "osAvatarName2Key"); 1358 CheckThreatLevel(ThreatLevel.Low, "osAvatarName2Key");
1351 1359
1352 CachedUserInfo userInfo = World.CommsManager.UserProfileCacheService.GetUserDetails(firstname, lastname); 1360 CachedUserInfo userInfo = World.CommsManager.UserProfileCacheService.GetUserDetails(firstname, lastname);
1353 1361
1354 if (null == userInfo) 1362 if (null == userInfo)
1355 { 1363 {
1356 return UUID.Zero.ToString(); 1364 return UUID.Zero.ToString();
1357 } 1365 }
1358 else 1366 else
1359 { 1367 {
1360 return userInfo.UserProfile.ID.ToString(); 1368 return userInfo.UserProfile.ID.ToString();
1361 } 1369 }
@@ -1370,15 +1378,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1370 { 1378 {
1371 CachedUserInfo userInfo = World.CommsManager.UserProfileCacheService.GetUserDetails(key); 1379 CachedUserInfo userInfo = World.CommsManager.UserProfileCacheService.GetUserDetails(key);
1372 1380
1373 if (null == userInfo) 1381 if (null == userInfo)
1374 { 1382 {
1375 return ""; 1383 return "";
1376 } 1384 }
1377 else 1385 else
1378 { 1386 {
1379 return userInfo.UserProfile.Name; 1387 return userInfo.UserProfile.Name;
1380 } 1388 }
1381 } 1389 }
1382 else 1390 else
1383 { 1391 {
1384 return ""; 1392 return "";
@@ -1391,7 +1399,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1391 /// for instance in a HG scenario, are a distinct possibility. 1399 /// for instance in a HG scenario, are a distinct possibility.
1392 /// 1400 ///
1393 /// Use value from the config file and return it. 1401 /// Use value from the config file and return it.
1394 /// 1402 ///
1395 public string osGetGridNick() 1403 public string osGetGridNick()
1396 { 1404 {
1397 CheckThreatLevel(ThreatLevel.Moderate, "osGetGridNick"); 1405 CheckThreatLevel(ThreatLevel.Moderate, "osGetGridNick");
@@ -1454,15 +1462,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1454 { 1462 {
1455 return result; // empty list 1463 return result; // empty list
1456 } 1464 }
1457 1465
1458 // Find matches beginning at start position 1466 // Find matches beginning at start position
1459 Regex matcher = new Regex(pattern); 1467 Regex matcher = new Regex(pattern);
1460 Match match = matcher.Match(src, start); 1468 Match match = matcher.Match(src, start);
1461 if (match.Success) 1469 if (match.Success)
1462 { 1470 {
1463 foreach (System.Text.RegularExpressions.Group g in match.Groups) 1471 foreach (System.Text.RegularExpressions.Group g in match.Groups)
1464 { 1472 {
1465 if (g.Success) 1473 if (g.Success)
1466 { 1474 {
1467 result.Add(g.Value); 1475 result.Add(g.Value);
1468 result.Add(g.Index); 1476 result.Add(g.Index);
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
index cf4e107..de94224 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
@@ -33,6 +33,8 @@ using rotation = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Quaternion;
33using vector = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Vector3; 33using vector = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Vector3;
34using LSL_List = OpenSim.Region.ScriptEngine.Shared.LSL_Types.list; 34using LSL_List = OpenSim.Region.ScriptEngine.Shared.LSL_Types.list;
35using LSL_String = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString; 35using LSL_String = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString;
36using LSL_Integer = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLInteger;
37using LSL_Float = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLFloat;
36 38
37namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces 39namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
38{ 40{
@@ -59,8 +61,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
59 string osSetDynamicTextureData(string dynamicID, string contentType, string data, string extraParams, int timer); 61 string osSetDynamicTextureData(string dynamicID, string contentType, string data, string extraParams, int timer);
60 string osSetDynamicTextureDataBlend(string dynamicID, string contentType, string data, string extraParams, 62 string osSetDynamicTextureDataBlend(string dynamicID, string contentType, string data, string extraParams,
61 int timer, int alpha); 63 int timer, int alpha);
62 double osTerrainGetHeight(int x, int y); 64
63 int osTerrainSetHeight(int x, int y, double val); 65 LSL_Float osTerrainGetHeight(int x, int y);
66 LSL_Integer osTerrainSetHeight(int x, int y, double val);
67 void osTerrainFlush();
68
64 int osRegionRestart(double seconds); 69 int osRegionRestart(double seconds);
65 void osRegionNotice(string msg); 70 void osRegionNotice(string msg);
66 bool osConsoleCommand(string Command); 71 bool osConsoleCommand(string Command);
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
index b42505f..625fc97 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
@@ -40,6 +40,8 @@ using rotation = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Quaternion;
40using key = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString; 40using key = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString;
41using LSL_List = OpenSim.Region.ScriptEngine.Shared.LSL_Types.list; 41using LSL_List = OpenSim.Region.ScriptEngine.Shared.LSL_Types.list;
42using LSL_String = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString; 42using LSL_String = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString;
43using LSL_Float = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLFloat;
44using LSL_Integer = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLInteger;
43 45
44namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase 46namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
45{ 47{
@@ -132,16 +134,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
132 return m_OSSL_Functions.osSetDynamicTextureDataBlend(dynamicID, contentType, data, extraParams, timer, alpha); 134 return m_OSSL_Functions.osSetDynamicTextureDataBlend(dynamicID, contentType, data, extraParams, timer, alpha);
133 } 135 }
134 136
135 public double osTerrainGetHeight(int x, int y) 137 public LSL_Float osTerrainGetHeight(int x, int y)
136 { 138 {
137 return m_OSSL_Functions.osTerrainGetHeight(x, y); 139 return m_OSSL_Functions.osTerrainGetHeight(x, y);
138 } 140 }
139 141
140 public int osTerrainSetHeight(int x, int y, double val) 142 public LSL_Integer osTerrainSetHeight(int x, int y, double val)
141 { 143 {
142 return m_OSSL_Functions.osTerrainSetHeight(x, y, val); 144 return m_OSSL_Functions.osTerrainSetHeight(x, y, val);
143 } 145 }
144 146
147 public void osTerrainFlush()
148 {
149 m_OSSL_Functions.osTerrainFlush();
150 }
151
145 public int osRegionRestart(double seconds) 152 public int osRegionRestart(double seconds)
146 { 153 {
147 return m_OSSL_Functions.osRegionRestart(seconds); 154 return m_OSSL_Functions.osRegionRestart(seconds);