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.
0.6.5-rc1
Homer Horwitz 2009-04-19 13:34:28 +00:00
parent 9c3ec87b97
commit 33e1316ced
3 changed files with 56 additions and 36 deletions

View File

@ -270,7 +270,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
// //
// OpenSim functions // OpenSim functions
// //
public int osTerrainSetHeight(int x, int y, double val) public LSL_Integer osTerrainSetHeight(int x, int y, double val)
{ {
CheckThreatLevel(ThreatLevel.High, "osTerrainSetHeight"); CheckThreatLevel(ThreatLevel.High, "osTerrainSetHeight");
@ -289,7 +289,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
} }
} }
public double osTerrainGetHeight(int x, int y) public LSL_Float osTerrainGetHeight(int x, int y)
{ {
CheckThreatLevel(ThreatLevel.None, "osTerrainGetHeight"); CheckThreatLevel(ThreatLevel.None, "osTerrainGetHeight");
@ -300,6 +300,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return World.Heightmap[x, y]; return World.Heightmap[x, y];
} }
public void osTerrainFlush()
{
CheckThreatLevel(ThreatLevel.VeryLow, "osTerrainFlush");
ITerrainModule terrainModule = World.RequestModuleInterface<ITerrainModule>();
if (terrainModule != null) terrainModule.TaintTerrain();
}
public int osRegionRestart(double seconds) public int osRegionRestart(double seconds)
{ {
// This is High here because region restart is not reliable // This is High here because region restart is not reliable

View File

@ -33,6 +33,8 @@ using rotation = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Quaternion;
using vector = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Vector3; using vector = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Vector3;
using LSL_List = OpenSim.Region.ScriptEngine.Shared.LSL_Types.list; using LSL_List = OpenSim.Region.ScriptEngine.Shared.LSL_Types.list;
using LSL_String = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString; using LSL_String = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString;
using LSL_Integer = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLInteger;
using LSL_Float = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLFloat;
namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
{ {
@ -59,8 +61,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
string osSetDynamicTextureData(string dynamicID, string contentType, string data, string extraParams, int timer); string osSetDynamicTextureData(string dynamicID, string contentType, string data, string extraParams, int timer);
string osSetDynamicTextureDataBlend(string dynamicID, string contentType, string data, string extraParams, string osSetDynamicTextureDataBlend(string dynamicID, string contentType, string data, string extraParams,
int timer, int alpha); int timer, int alpha);
double osTerrainGetHeight(int x, int y);
int osTerrainSetHeight(int x, int y, double val); LSL_Float osTerrainGetHeight(int x, int y);
LSL_Integer osTerrainSetHeight(int x, int y, double val);
void osTerrainFlush();
int osRegionRestart(double seconds); int osRegionRestart(double seconds);
void osRegionNotice(string msg); void osRegionNotice(string msg);
bool osConsoleCommand(string Command); bool osConsoleCommand(string Command);

View File

@ -40,6 +40,8 @@ using rotation = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Quaternion;
using key = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString; using key = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString;
using LSL_List = OpenSim.Region.ScriptEngine.Shared.LSL_Types.list; using LSL_List = OpenSim.Region.ScriptEngine.Shared.LSL_Types.list;
using LSL_String = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString; using LSL_String = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString;
using LSL_Float = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLFloat;
using LSL_Integer = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLInteger;
namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
{ {
@ -132,16 +134,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
return m_OSSL_Functions.osSetDynamicTextureDataBlend(dynamicID, contentType, data, extraParams, timer, alpha); return m_OSSL_Functions.osSetDynamicTextureDataBlend(dynamicID, contentType, data, extraParams, timer, alpha);
} }
public double osTerrainGetHeight(int x, int y) public LSL_Float osTerrainGetHeight(int x, int y)
{ {
return m_OSSL_Functions.osTerrainGetHeight(x, y); return m_OSSL_Functions.osTerrainGetHeight(x, y);
} }
public int osTerrainSetHeight(int x, int y, double val) public LSL_Integer osTerrainSetHeight(int x, int y, double val)
{ {
return m_OSSL_Functions.osTerrainSetHeight(x, y, val); return m_OSSL_Functions.osTerrainSetHeight(x, y, val);
} }
public void osTerrainFlush()
{
m_OSSL_Functions.osTerrainFlush();
}
public int osRegionRestart(double seconds) public int osRegionRestart(double seconds)
{ {
return m_OSSL_Functions.osRegionRestart(seconds); return m_OSSL_Functions.osRegionRestart(seconds);