aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler
diff options
context:
space:
mode:
authorlbsa712007-08-16 18:40:44 +0000
committerlbsa712007-08-16 18:40:44 +0000
commite53d680d4154ddd730f7b7d4779ab9a95de78fae (patch)
treebad9dee96fdb17ca675bbbc594dc877c67f3cea4 /OpenSim/Region/ScriptEngine/DotNetEngine/Compiler
parentHad to rename Rotation in SceneObjectGroup to GroupRotation to stop conflict ... (diff)
downloadopensim-SC_OLD-e53d680d4154ddd730f7b7d4779ab9a95de78fae.zip
opensim-SC_OLD-e53d680d4154ddd730f7b7d4779ab9a95de78fae.tar.gz
opensim-SC_OLD-e53d680d4154ddd730f7b7d4779ab9a95de78fae.tar.bz2
opensim-SC_OLD-e53d680d4154ddd730f7b7d4779ab9a95de78fae.tar.xz
* Now sending manager, host and root host to Script in constructor.
* Changed how Script accesses World * Implemented llSay, llWhisper and llShout * Added SetText() to IScriptHost, implemented llText * Minor renamings to conform with code conventions
Diffstat (limited to 'OpenSim/Region/ScriptEngine/DotNetEngine/Compiler')
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL2CSConverter.cs6
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL_BaseClass.cs74
2 files changed, 56 insertions, 24 deletions
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL2CSConverter.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL2CSConverter.cs
index eea2094..d15701c 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL2CSConverter.cs
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL2CSConverter.cs
@@ -229,7 +229,11 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
229 // Add namespace, class name and inheritance 229 // Add namespace, class name and inheritance
230 Return = "namespace SecondLife {\r\n"; 230 Return = "namespace SecondLife {\r\n";
231 Return += "public class Script : OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL.LSL_BaseClass {\r\n"; 231 Return += "public class Script : OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL.LSL_BaseClass {\r\n";
232 Return += "public Script( OpenSim.Region.Environment.Scenes.Scripting.IScriptHost host ) : base( host ) { }\r\n"; 232 Return += @"
233 public Script(
234 OpenSim.Region.ScriptEngine.DotNetEngine.ScriptManager manager,
235 OpenSim.Region.Environment.Scenes.Scripting.IScriptHost host,
236 OpenSim.Region.Environment.Scenes.Scripting.IScriptHost root ) : base( manager, host, root ) { }"+"\r\n";
233 Return += Script; 237 Return += Script;
234 Return += "} }\r\n"; 238 Return += "} }\r\n";
235 239
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL_BaseClass.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL_BaseClass.cs
index 565bfb7..aa199d5 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL_BaseClass.cs
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL_BaseClass.cs
@@ -12,20 +12,27 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
12 public class LSL_BaseClass : LSL_BuiltIn_Commands_Interface 12 public class LSL_BaseClass : LSL_BuiltIn_Commands_Interface
13 { 13 {
14 public string State = "default"; 14 public string State = "default";
15 internal OpenSim.Region.Environment.Scenes.Scene World;
16 private System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding(); 15 private System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding();
17 16
18 IScriptHost m_host; 17 protected ScriptManager m_manager;
19 18 protected IScriptHost m_host;
20 public LSL_BaseClass( IScriptHost host ) 19 protected IScriptHost m_root;
20
21 public LSL_BaseClass(ScriptManager manager, IScriptHost host, IScriptHost root)
21 { 22 {
23 m_manager = manager;
22 m_host = host; 24 m_host = host;
25 m_root = root;
23 } 26 }
24 27
25 public void Start(OpenSim.Region.Environment.Scenes.Scene _World, string FullScriptID) 28 public Scene World
26 { 29 {
27 World = _World; 30 get { return m_manager.World; }
28 MainLog.Instance.Notice( "ScriptEngine", "LSL_BaseClass.Start() called. FullScriptID: " + FullScriptID + ": Hosted by [" + m_host.Name + ":" + m_host.UUID + "@"+m_host.AbsolutePosition +"]"); 31 }
32
33 public void Start(string FullScriptID)
34 {
35 MainLog.Instance.Notice("ScriptEngine", "LSL_BaseClass.Start() called. FullScriptID: " + FullScriptID + ": Hosted by [" + m_host.Name + ":" + m_host.UUID + "@" + m_host.AbsolutePosition + "]");
29 36
30 return; 37 return;
31 } 38 }
@@ -54,12 +61,15 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
54 public Axiom.Math.Vector3 llRot2Left(Axiom.Math.Quaternion r) { return new Axiom.Math.Vector3(); } 61 public Axiom.Math.Vector3 llRot2Left(Axiom.Math.Quaternion r) { return new Axiom.Math.Vector3(); }
55 public Axiom.Math.Vector3 llRot2Up(Axiom.Math.Quaternion r) { return new Axiom.Math.Vector3(); } 62 public Axiom.Math.Vector3 llRot2Up(Axiom.Math.Quaternion r) { return new Axiom.Math.Vector3(); }
56 public Axiom.Math.Quaternion llRotBetween(Axiom.Math.Vector3 start, Axiom.Math.Vector3 end) { return new Axiom.Math.Quaternion(); } 63 public Axiom.Math.Quaternion llRotBetween(Axiom.Math.Vector3 start, Axiom.Math.Vector3 end) { return new Axiom.Math.Quaternion(); }
64
57 public void llWhisper(int channelID, string text) 65 public void llWhisper(int channelID, string text)
58 { 66 {
59 //Common.SendToDebug("INTERNAL FUNCTION llWhisper(" + channelID + ", \"" + text + "\");"); 67 //Common.SendToDebug("INTERNAL FUNCTION llWhisper(" + channelID + ", \"" + text + "\");");
60 Console.WriteLine("llWhisper Channel " + channelID + ", Text: \"" + text + "\""); 68 Console.WriteLine("llWhisper Channel " + channelID + ", Text: \"" + text + "\"");
61 //type for whisper is 0 69 //type for whisper is 0
62 //World.SimChat(enc.GetBytes(text), 0, World.Objects[World.ConvertLocalIDToFullID(MY_OBJECT_ID)], MY_OBJECT_NAME, World.Objects[World.ConvertLocalIDToFullID(MY_OBJECT_ID)]); 70 World.SimChat(Helpers.StringToField(text),
71 0, m_host.AbsolutePosition, m_host.Name, m_host.UUID);
72
63 73
64 } 74 }
65 //public void llSay(int channelID, string text) 75 //public void llSay(int channelID, string text)
@@ -69,22 +79,20 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
69 //Common.SendToDebug("INTERNAL FUNCTION llSay(" + (int)channelID + ", \"" + (string)text + "\");"); 79 //Common.SendToDebug("INTERNAL FUNCTION llSay(" + (int)channelID + ", \"" + (string)text + "\");");
70 Console.WriteLine("llSay Channel " + channelID + ", Text: \"" + text + "\""); 80 Console.WriteLine("llSay Channel " + channelID + ", Text: \"" + text + "\"");
71 //type for say is 1 81 //type for say is 1
72
73 LLVector3 fromPos = m_host.AbsolutePosition; // Position of parent
74 string fromName = m_host.Name; // Name of script parent
75 LLUUID fromUUID = m_host.UUID; // UUID of parent
76 82
77 World.SimChat( Helpers.StringToField( text ), 1, fromPos, fromName, fromUUID ); 83 World.SimChat(Helpers.StringToField(text),
84 1, m_host.AbsolutePosition, m_host.Name, m_host.UUID);
78 } 85 }
79 86
80 public void llShout(int channelID, string text) 87 public void llShout(int channelID, string text)
81 { 88 {
82 Console.WriteLine("llShout Channel " + channelID + ", Text: \"" + text + "\""); 89 Console.WriteLine("llShout Channel " + channelID + ", Text: \"" + text + "\"");
83 //type for shout is 2 90 //type for shout is 2
84 //World.SimChat(enc.GetBytes(text), 2, World.Objects[World.ConvertLocalIDToFullID(MY_OBJECT_ID)], MY_OBJECT_NAME, World.Objects[World.ConvertLocalIDToFullID(MY_OBJECT_ID)]); 91 World.SimChat(Helpers.StringToField(text),
92 2, m_host.AbsolutePosition, m_host.Name, m_host.UUID);
85 93
86 } 94 }
87 95
88 public int llListen(int channelID, string name, string ID, string msg) { return 0; } 96 public int llListen(int channelID, string name, string ID, string msg) { return 0; }
89 public void llListenControl(int number, int active) { return; } 97 public void llListenControl(int number, int active) { return; }
90 public void llListenRemove(int number) { return; } 98 public void llListenRemove(int number) { return; }
@@ -120,8 +128,12 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
120 public string llGetTexture(int face) { return ""; } 128 public string llGetTexture(int face) { return ""; }
121 public void llSetPos(Axiom.Math.Vector3 pos) { return; } 129 public void llSetPos(Axiom.Math.Vector3 pos) { return; }
122 130
123 131 public Axiom.Math.Vector3 llGetPos()
124 public Axiom.Math.Vector3 llGetPos() { return new Axiom.Math.Vector3(); } 132 {
133 throw new NotImplementedException("llGetPos");
134 // return m_host.AbsolutePosition;
135 }
136
125 public Axiom.Math.Vector3 llGetLocalPos() { return new Axiom.Math.Vector3(); } 137 public Axiom.Math.Vector3 llGetLocalPos() { return new Axiom.Math.Vector3(); }
126 public void llSetRot(Axiom.Math.Quaternion rot) { } 138 public void llSetRot(Axiom.Math.Quaternion rot) { }
127 public Axiom.Math.Quaternion llGetRot() { return new Axiom.Math.Quaternion(); } 139 public Axiom.Math.Quaternion llGetRot() { return new Axiom.Math.Quaternion(); }
@@ -214,7 +226,12 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
214 public double llGetEnergy() { return 1.0f; } 226 public double llGetEnergy() { return 1.0f; }
215 public void llGiveInventory(string destination, string inventory) { } 227 public void llGiveInventory(string destination, string inventory) { }
216 public void llRemoveInventory(string item) { } 228 public void llRemoveInventory(string item) { }
217 public void llSetText(string text, Axiom.Math.Vector3 color, double alpha) { } 229
230 public void llSetText(string text, Axiom.Math.Vector3 color, double alpha)
231 {
232 m_host.SetText(text, color, alpha );
233 }
234
218 public double llWater(Axiom.Math.Vector3 offset) { return 0; } 235 public double llWater(Axiom.Math.Vector3 offset) { return 0; }
219 public void llPassTouches(int pass) { } 236 public void llPassTouches(int pass) { }
220 public string llRequestAgentData(string id, int data) { return ""; } 237 public string llRequestAgentData(string id, int data) { return ""; }
@@ -298,7 +315,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
298 public Axiom.Math.Vector3 llGroundContour(Axiom.Math.Vector3 offset) { return new Axiom.Math.Vector3(); } 315 public Axiom.Math.Vector3 llGroundContour(Axiom.Math.Vector3 offset) { return new Axiom.Math.Vector3(); }
299 public int llGetAttached() { return 0; } 316 public int llGetAttached() { return 0; }
300 public int llGetFreeMemory() { return 0; } 317 public int llGetFreeMemory() { return 0; }
301 public string llGetRegionName() { return World.RegionInfo.RegionName; } 318 public string llGetRegionName() { return m_manager.RegionName; }
302 public double llGetRegionTimeDilation() { return 1.0f; } 319 public double llGetRegionTimeDilation() { return 1.0f; }
303 public double llGetRegionFPS() { return 10.0f; } 320 public double llGetRegionFPS() { return 10.0f; }
304 public void llParticleSystem(List<Object> rules) { } 321 public void llParticleSystem(List<Object> rules) { }
@@ -316,6 +333,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
316 public void llSetTouchText(string text) 333 public void llSetTouchText(string text)
317 { 334 {
318 } 335 }
336
319 public void llSetSitText(string text) 337 public void llSetSitText(string text)
320 { 338 {
321 } 339 }
@@ -347,8 +365,18 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
347 public double llLog(double val) { return (double)Math.Log(val); } 365 public double llLog(double val) { return (double)Math.Log(val); }
348 public List<string> llGetAnimationList(string id) { return new List<string>(); } 366 public List<string> llGetAnimationList(string id) { return new List<string>(); }
349 public void llSetParcelMusicURL(string url) { } 367 public void llSetParcelMusicURL(string url) { }
350 public Axiom.Math.Vector3 llGetRootPosition() { return new Axiom.Math.Vector3(); } 368
351 public Axiom.Math.Quaternion llGetRootRotation() { return new Axiom.Math.Quaternion(); } 369 public Axiom.Math.Vector3 llGetRootPosition()
370 {
371 throw new NotImplementedException("llGetRootPosition");
372 //return m_root.AbsolutePosition;
373 }
374
375 public Axiom.Math.Quaternion llGetRootRotation()
376 {
377 return new Axiom.Math.Quaternion();
378 }
379
352 public string llGetObjectDesc() { return ""; } 380 public string llGetObjectDesc() { return ""; }
353 public void llSetObjectDesc(string desc) { } 381 public void llSetObjectDesc(string desc) { }
354 public string llGetCreator() { return ""; } 382 public string llGetCreator() { return ""; }