aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
diff options
context:
space:
mode:
authorMarck2010-12-10 22:13:05 +0100
committerMarck2010-12-10 22:20:35 +0100
commitb512ecd1dc538f029e6772f526db78eb6687d938 (patch)
tree4796be07591156845a0cb94f4bcc77b27a4fcee2 /OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
parentRevert "A stab at mantis #5256. Separate ScenePresence updates from SceneObje... (diff)
downloadopensim-SC_OLD-b512ecd1dc538f029e6772f526db78eb6687d938.zip
opensim-SC_OLD-b512ecd1dc538f029e6772f526db78eb6687d938.tar.gz
opensim-SC_OLD-b512ecd1dc538f029e6772f526db78eb6687d938.tar.bz2
opensim-SC_OLD-b512ecd1dc538f029e6772f526db78eb6687d938.tar.xz
Normalization of OSSL function names.
Added the following replacement functions for compliance to the OSSL standards stated on the wiki: osGetTerrainHeight osSetTerrainHeight osGetSunParam osSetSunParam osSetPenColor The functions that do not comply to the standard give a warning when used but work normally otherwise. The graphics primitive drawing command "PenColor" has also been added as well as dynamic texture parameter "bgcolor" as an alternative to "bgcolour". The following two functions have been renamed because they are not enabled yet aynway: osWindParamSet => osSetWindParam osWindParamGet => osGetWindParam
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs71
1 files changed, 62 insertions, 9 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
index 827626f..691b67f 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>();