diff options
Taken the old scripting engine out of Region.Environment and moved it into a separate module: OpenSim.Region.ExtensionsScriptModule (named as such because the purpose of it is to script server extensions, rather than "user scripting" like Tedd's engine.)
Diffstat (limited to 'OpenSim/Region/ExtensionsScriptModule/Engines/CSharp/Examples')
-rw-r--r-- | OpenSim/Region/ExtensionsScriptModule/Engines/CSharp/Examples/ExportRegionToLSL.cs | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/OpenSim/Region/ExtensionsScriptModule/Engines/CSharp/Examples/ExportRegionToLSL.cs b/OpenSim/Region/ExtensionsScriptModule/Engines/CSharp/Examples/ExportRegionToLSL.cs new file mode 100644 index 0000000..90d3438 --- /dev/null +++ b/OpenSim/Region/ExtensionsScriptModule/Engines/CSharp/Examples/ExportRegionToLSL.cs | |||
@@ -0,0 +1,72 @@ | |||
1 | using OpenSim.Framework.Console; | ||
2 | using OpenSim.Framework; | ||
3 | using OpenSim.Region.Environment; | ||
4 | using OpenSim.Region.Environment.Scenes; | ||
5 | |||
6 | using System.Collections.Generic; | ||
7 | using libsecondlife; | ||
8 | |||
9 | namespace OpenSim.Region.ExtensionsScriptModule.CSharp.Examples | ||
10 | { | ||
11 | public class LSLExportScript : IScript | ||
12 | { | ||
13 | ScriptInfo script; | ||
14 | |||
15 | public string Name | ||
16 | { | ||
17 | get { return "LSL Export Script 0.1"; } | ||
18 | } | ||
19 | |||
20 | public void Initialise(ScriptInfo scriptInfo) | ||
21 | { | ||
22 | script = scriptInfo; | ||
23 | |||
24 | script.events.OnScriptConsole += new EventManager.OnScriptConsoleDelegate(ProcessConsoleMsg); | ||
25 | } | ||
26 | |||
27 | void ProcessConsoleMsg(string[] args) | ||
28 | { | ||
29 | /*if (args[0].ToLower() == "lslexport") | ||
30 | { | ||
31 | string sequence = ""; | ||
32 | |||
33 | foreach (KeyValuePair<LLUUID, SceneObject> obj in script.world.Objects) | ||
34 | { | ||
35 | SceneObject root = obj.Value; | ||
36 | |||
37 | sequence += "NEWOBJ::" + obj.Key.ToStringHyphenated() + "\n"; | ||
38 | |||
39 | string rootPrim = processPrimitiveToString(root.rootPrimitive); | ||
40 | |||
41 | sequence += "ROOT:" + rootPrim; | ||
42 | |||
43 | foreach (KeyValuePair<LLUUID, OpenSim.Region.Environment.Scenes.Primitive> prim in root.Children) | ||
44 | { | ||
45 | string child = processPrimitiveToString(prim.Value); | ||
46 | sequence += "CHILD:" + child; | ||
47 | } | ||
48 | } | ||
49 | |||
50 | System.Console.WriteLine(sequence); | ||
51 | }*/ | ||
52 | } | ||
53 | |||
54 | string processPrimitiveToString(OpenSim.Region.Environment.Scenes.SceneObjectPart prim) | ||
55 | { | ||
56 | /*string desc = prim.Description; | ||
57 | string name = prim.Name; | ||
58 | LLVector3 pos = prim.Pos; | ||
59 | LLQuaternion rot = new LLQuaternion(prim.Rotation.x, prim.Rotation.y, prim.Rotation.z, prim.Rotation.w); | ||
60 | LLVector3 scale = prim.Scale; | ||
61 | LLVector3 rootPos = prim.WorldPos; | ||
62 | |||
63 | string setPrimParams = ""; | ||
64 | |||
65 | setPrimParams += "[PRIM_SCALE, " + scale.ToString() + ", PRIM_POS, " + rootPos.ToString() + ", PRIM_ROTATION, " + rot.ToString() + "]\n"; | ||
66 | |||
67 | return setPrimParams; | ||
68 | */ | ||
69 | return ""; | ||
70 | } | ||
71 | } | ||
72 | } \ No newline at end of file | ||