aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorAdam Frisby2007-07-15 22:36:35 +0000
committerAdam Frisby2007-07-15 22:36:35 +0000
commit571bd78e587c409a3fcba4a8ec48c0187843997d (patch)
tree8f66e1c33871c4ab7063d531f26ee6e53adb4597
parentIt wasn't me who messed up flying when adding a test NPC class. (honestly!) (diff)
downloadopensim-SC-571bd78e587c409a3fcba4a8ec48c0187843997d.zip
opensim-SC-571bd78e587c409a3fcba4a8ec48c0187843997d.tar.gz
opensim-SC-571bd78e587c409a3fcba4a8ec48c0187843997d.tar.bz2
opensim-SC-571bd78e587c409a3fcba4a8ec48c0187843997d.tar.xz
* More scripting enhancemnents and properties.
-rw-r--r--OpenSim/Region/Environment/Scenes/Primitive.cs8
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.cs5
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneObject.cs8
-rw-r--r--OpenSim/Region/Environment/Scenes/scripting/Engines/CSharpEngine/Examples/ExportRegionToLSL.cs44
4 files changed, 62 insertions, 3 deletions
diff --git a/OpenSim/Region/Environment/Scenes/Primitive.cs b/OpenSim/Region/Environment/Scenes/Primitive.cs
index 23dcf6e..0e5b083 100644
--- a/OpenSim/Region/Environment/Scenes/Primitive.cs
+++ b/OpenSim/Region/Environment/Scenes/Primitive.cs
@@ -81,6 +81,14 @@ namespace OpenSim.Region.Environment.Scenes
81 81
82 } 82 }
83 83
84 public PrimitiveBaseShape Shape
85 {
86 get
87 {
88 return this.m_Shape;
89 }
90 }
91
84 public LLVector3 WorldPos 92 public LLVector3 WorldPos
85 { 93 {
86 get 94 get
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs
index aa08172..5e2e494 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.cs
@@ -112,6 +112,11 @@ namespace OpenSim.Region.Environment.Scenes
112 get { return m_scriptManager; } 112 get { return m_scriptManager; }
113 } 113 }
114 114
115 public Dictionary<LLUUID, SceneObject> Objects
116 {
117 get { return Prims; }
118 }
119
115 #endregion 120 #endregion
116 121
117 #region Constructors 122 #region Constructors
diff --git a/OpenSim/Region/Environment/Scenes/SceneObject.cs b/OpenSim/Region/Environment/Scenes/SceneObject.cs
index c925584..8de7cdb 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObject.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObject.cs
@@ -75,6 +75,14 @@ namespace OpenSim.Region.Environment.Scenes
75 } 75 }
76 } 76 }
77 77
78 public Dictionary<LLUUID, Primitive> Children
79 {
80 get
81 {
82 return this.ChildPrimitives;
83 }
84 }
85
78 /// <summary> 86 /// <summary>
79 /// 87 ///
80 /// </summary> 88 /// </summary>
diff --git a/OpenSim/Region/Environment/Scenes/scripting/Engines/CSharpEngine/Examples/ExportRegionToLSL.cs b/OpenSim/Region/Environment/Scenes/scripting/Engines/CSharpEngine/Examples/ExportRegionToLSL.cs
index 4cc2c96..d9f1f0a 100644
--- a/OpenSim/Region/Environment/Scenes/scripting/Engines/CSharpEngine/Examples/ExportRegionToLSL.cs
+++ b/OpenSim/Region/Environment/Scenes/scripting/Engines/CSharpEngine/Examples/ExportRegionToLSL.cs
@@ -3,6 +3,9 @@ using OpenSim.Framework;
3using OpenSim.Region.Environment; 3using OpenSim.Region.Environment;
4using OpenSim.Region.Environment.Scenes; 4using OpenSim.Region.Environment.Scenes;
5 5
6using System.Collections.Generic;
7using libsecondlife;
8
6namespace OpenSim.Region.Scripting.Examples 9namespace OpenSim.Region.Scripting.Examples
7{ 10{
8 public class LSLExportScript : IScript 11 public class LSLExportScript : IScript
@@ -18,15 +21,50 @@ namespace OpenSim.Region.Scripting.Examples
18 { 21 {
19 script = scriptInfo; 22 script = scriptInfo;
20 23
21 script.events.OnScriptConsole += new EventManager.OnScriptConsoleDelegate(events_OnScriptConsole); 24 script.events.OnScriptConsole += new EventManager.OnScriptConsoleDelegate(ProcessConsoleMsg);
22 } 25 }
23 26
24 void events_OnScriptConsole(string[] args) 27 void ProcessConsoleMsg(string[] args)
25 { 28 {
26 if (args[0].ToLower() == "lslexport") 29 if (args[0].ToLower() == "lslexport")
27 { 30 {
28 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);
29 } 51 }
30 } 52 }
53
54 string processPrimitiveToString(OpenSim.Region.Environment.Scenes.Primitive prim)
55 {
56 string desc = prim.Description;
57 string name = prim.Name;
58 LLVector3 pos = prim.Pos;
59 LLVector3 rot = new LLVector3();
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 }
31 } 69 }
32} \ No newline at end of file 70} \ No newline at end of file