diff options
author | Adam Frisby | 2008-02-14 12:16:33 +0000 |
---|---|---|
committer | Adam Frisby | 2008-02-14 12:16:33 +0000 |
commit | f3afa68a2af6ad5999e6efe3e4725cb17293108d (patch) | |
tree | 4253a44bee39976d6b3dd6813439f5966cf12632 /OpenSim/Region/ScriptEngine | |
parent | * Exposed AddHandlers in response to mantis #534. Thanks, kmeisthax! (diff) | |
download | opensim-SC-f3afa68a2af6ad5999e6efe3e4725cb17293108d.zip opensim-SC-f3afa68a2af6ad5999e6efe3e4725cb17293108d.tar.gz opensim-SC-f3afa68a2af6ad5999e6efe3e4725cb17293108d.tar.bz2 opensim-SC-f3afa68a2af6ad5999e6efe3e4725cb17293108d.tar.xz |
* Made new Framework.Constants class, added RegionSize member.
* Converted all instances of "256" spotted to use RegionSize instead. Some approximations used for border crossings (ie 255.9f) are still using that value, but should be updated to use something based on RegionSize.
* Moving Terrain to a RegionModule, implemented ITerrainChannel and TerrainModule - nonfunctional, but will be soon.
Diffstat (limited to 'OpenSim/Region/ScriptEngine')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs | 2 | ||||
-rw-r--r-- | OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/Compiler.cs | 64 |
2 files changed, 42 insertions, 24 deletions
diff --git a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs index 2fc610a..c350301 100644 --- a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs +++ b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs | |||
@@ -2232,7 +2232,7 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
2232 | public LSL_Types.Vector3 llGetRegionCorner() | 2232 | public LSL_Types.Vector3 llGetRegionCorner() |
2233 | { | 2233 | { |
2234 | m_host.AddScriptLPS(1); | 2234 | m_host.AddScriptLPS(1); |
2235 | return new LSL_Types.Vector3(World.RegionInfo.RegionLocX * 256, World.RegionInfo.RegionLocY * 256, 0); | 2235 | return new LSL_Types.Vector3(World.RegionInfo.RegionLocX * Constants.RegionSize, World.RegionInfo.RegionLocY * Constants.RegionSize, 0); |
2236 | } | 2236 | } |
2237 | 2237 | ||
2238 | public LSL_Types.list llListInsertList(LSL_Types.list dest, LSL_Types.list src, int start) | 2238 | public LSL_Types.list llListInsertList(LSL_Types.list dest, LSL_Types.list src, int start) |
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/Compiler.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/Compiler.cs index 5c8b4b5..58586c0 100644 --- a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/Compiler.cs +++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/Compiler.cs | |||
@@ -272,41 +272,59 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL | |||
272 | switch (l) | 272 | switch (l) |
273 | { | 273 | { |
274 | case enumCompileType.cs: | 274 | case enumCompileType.cs: |
275 | compileScript = String.Empty + | 275 | compileScript = CreateCSCompilerScript(compileScript); |
276 | "using OpenSim.Region.ScriptEngine.Common; using System.Collections.Generic;\r\n" + | ||
277 | String.Empty + "namespace SecondLife { " + | ||
278 | String.Empty + "public class Script : OpenSim.Region.ScriptEngine.Common.LSL_BaseClass { \r\n" + | ||
279 | @"public Script() { } " + | ||
280 | compileScript + | ||
281 | "} }\r\n"; | ||
282 | break; | 276 | break; |
283 | case enumCompileType.vb: | 277 | case enumCompileType.vb: |
284 | compileScript = String.Empty + | 278 | compileScript = CreateVBCompilerScript(compileScript); |
285 | "Imports OpenSim.Region.ScriptEngine.Common: Imports System.Collections.Generic: " + | ||
286 | String.Empty + "NameSpace SecondLife:" + | ||
287 | String.Empty + "Public Class Script: Inherits OpenSim.Region.ScriptEngine.Common.LSL_BaseClass: " + | ||
288 | "\r\nPublic Sub New()\r\nEnd Sub: " + | ||
289 | compileScript + | ||
290 | ":End Class :End Namespace\r\n"; | ||
291 | break; | 279 | break; |
292 | case enumCompileType.js: | 280 | case enumCompileType.js: |
293 | compileScript = String.Empty + | 281 | compileScript = CreateJSCompilerScript(compileScript); |
294 | "import OpenSim.Region.ScriptEngine.Common; import System.Collections.Generic;\r\n" + | ||
295 | "package SecondLife {\r\n" + | ||
296 | "class Script extends OpenSim.Region.ScriptEngine.Common.LSL_BaseClass { \r\n" + | ||
297 | compileScript + | ||
298 | "} }\r\n"; | ||
299 | break; | 282 | break; |
300 | } | 283 | } |
301 | return CompileFromCSorVBText(compileScript, l); | 284 | return CompileFromDotNetText(compileScript, l); |
285 | } | ||
286 | |||
287 | private static string CreateJSCompilerScript(string compileScript) | ||
288 | { | ||
289 | compileScript = String.Empty + | ||
290 | "import OpenSim.Region.ScriptEngine.Common; import System.Collections.Generic;\r\n" + | ||
291 | "package SecondLife {\r\n" + | ||
292 | "class Script extends OpenSim.Region.ScriptEngine.Common.LSL_BaseClass { \r\n" + | ||
293 | compileScript + | ||
294 | "} }\r\n"; | ||
295 | return compileScript; | ||
296 | } | ||
297 | |||
298 | private static string CreateCSCompilerScript(string compileScript) | ||
299 | { | ||
300 | compileScript = String.Empty + | ||
301 | "using OpenSim.Region.ScriptEngine.Common; using System.Collections.Generic;\r\n" + | ||
302 | String.Empty + "namespace SecondLife { " + | ||
303 | String.Empty + "public class Script : OpenSim.Region.ScriptEngine.Common.LSL_BaseClass { \r\n" + | ||
304 | @"public Script() { } " + | ||
305 | compileScript + | ||
306 | "} }\r\n"; | ||
307 | return compileScript; | ||
308 | } | ||
309 | |||
310 | private static string CreateVBCompilerScript(string compileScript) | ||
311 | { | ||
312 | compileScript = String.Empty + | ||
313 | "Imports OpenSim.Region.ScriptEngine.Common: Imports System.Collections.Generic: " + | ||
314 | String.Empty + "NameSpace SecondLife:" + | ||
315 | String.Empty + "Public Class Script: Inherits OpenSim.Region.ScriptEngine.Common.LSL_BaseClass: " + | ||
316 | "\r\nPublic Sub New()\r\nEnd Sub: " + | ||
317 | compileScript + | ||
318 | ":End Class :End Namespace\r\n"; | ||
319 | return compileScript; | ||
302 | } | 320 | } |
303 | 321 | ||
304 | /// <summary> | 322 | /// <summary> |
305 | /// Compile CS script to .Net assembly (.dll) | 323 | /// Compile .NET script to .Net assembly (.dll) |
306 | /// </summary> | 324 | /// </summary> |
307 | /// <param name="Script">CS script</param> | 325 | /// <param name="Script">CS script</param> |
308 | /// <returns>Filename to .dll assembly</returns> | 326 | /// <returns>Filename to .dll assembly</returns> |
309 | internal string CompileFromCSorVBText(string Script, enumCompileType lang) | 327 | internal string CompileFromDotNetText(string Script, enumCompileType lang) |
310 | { | 328 | { |
311 | string ext = "." + lang.ToString(); | 329 | string ext = "." + lang.ToString(); |
312 | 330 | ||