diff options
author | Tedd Hansen | 2008-02-24 15:45:20 +0000 |
---|---|---|
committer | Tedd Hansen | 2008-02-24 15:45:20 +0000 |
commit | 2cd85e15dce6628c613f280fdbd058dce4efd134 (patch) | |
tree | f0f9142e0ddf50c07f6397f3aa5527dd5886fc99 /OpenSim/Region/ScriptEngine | |
parent | * Adds unit test glue to the OdePlugin. (diff) | |
download | opensim-SC-2cd85e15dce6628c613f280fdbd058dce4efd134.zip opensim-SC-2cd85e15dce6628c613f280fdbd058dce4efd134.tar.gz opensim-SC-2cd85e15dce6628c613f280fdbd058dce4efd134.tar.bz2 opensim-SC-2cd85e15dce6628c613f280fdbd058dce4efd134.tar.xz |
Changed so "BuiltIn_Commands" given to scripts is easily extendable. Added new OSSL_BuilIn_Commands class where we can start adding our own modular commands.
Diffstat (limited to 'OpenSim/Region/ScriptEngine')
7 files changed, 170 insertions, 7 deletions
diff --git a/OpenSim/Region/ScriptEngine/Common/BuilIn_Commands.cs b/OpenSim/Region/ScriptEngine/Common/BuilIn_Commands.cs new file mode 100644 index 0000000..26aae9a --- /dev/null +++ b/OpenSim/Region/ScriptEngine/Common/BuilIn_Commands.cs | |||
@@ -0,0 +1,46 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | * | ||
27 | */ | ||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Text; | ||
31 | using libsecondlife; | ||
32 | using OpenSim.Region.Environment.Scenes; | ||
33 | |||
34 | namespace OpenSim.Region.ScriptEngine.Common | ||
35 | { | ||
36 | /// <summary> | ||
37 | /// This is the end of a chain of inherited builtin command implementations. This module will be instanced by script engines. | ||
38 | /// </summary> | ||
39 | public class BuilIn_Commands: OSSL_BuilIn_Commands | ||
40 | { | ||
41 | public BuilIn_Commands(ScriptEngineBase.ScriptEngine scriptEngine, SceneObjectPart host, uint localID, | ||
42 | LLUUID itemID) : base(scriptEngine, host, localID, itemID) | ||
43 | { | ||
44 | } | ||
45 | } | ||
46 | } | ||
diff --git a/OpenSim/Region/ScriptEngine/Common/IScript.cs b/OpenSim/Region/ScriptEngine/Common/IScript.cs index b6b978e..7ee10a6 100644 --- a/OpenSim/Region/ScriptEngine/Common/IScript.cs +++ b/OpenSim/Region/ScriptEngine/Common/IScript.cs | |||
@@ -35,7 +35,7 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
35 | string State { get; set; } | 35 | string State { get; set; } |
36 | ExecutorBase Exec { get; } | 36 | ExecutorBase Exec { get; } |
37 | string Source { get; set; } | 37 | string Source { get; set; } |
38 | void Start(LSL_BuiltIn_Commands_Interface BuiltIn_Commands); | 38 | void Start(BuilIn_Commands BuiltIn_Commands); |
39 | EventQueueManager.Queue_llDetectParams_Struct llDetectParams { get; set; } | 39 | EventQueueManager.Queue_llDetectParams_Struct llDetectParams { get; set; } |
40 | } | 40 | } |
41 | } \ No newline at end of file | 41 | } \ No newline at end of file |
diff --git a/OpenSim/Region/ScriptEngine/Common/LSL_BaseClass.cs b/OpenSim/Region/ScriptEngine/Common/LSL_BaseClass.cs index 870884c..58f58aa 100644 --- a/OpenSim/Region/ScriptEngine/Common/LSL_BaseClass.cs +++ b/OpenSim/Region/ScriptEngine/Common/LSL_BaseClass.cs | |||
@@ -86,7 +86,7 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
86 | } | 86 | } |
87 | 87 | ||
88 | 88 | ||
89 | public LSL_BuiltIn_Commands_Interface m_LSL_Functions; | 89 | public BuilIn_Commands m_LSL_Functions; |
90 | private string _Source = String.Empty; | 90 | private string _Source = String.Empty; |
91 | public string Source | 91 | public string Source |
92 | { | 92 | { |
@@ -110,7 +110,7 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
110 | 110 | ||
111 | 111 | ||
112 | 112 | ||
113 | public void Start(LSL_BuiltIn_Commands_Interface LSL_Functions) | 113 | public void Start(BuilIn_Commands LSL_Functions) |
114 | { | 114 | { |
115 | m_LSL_Functions = LSL_Functions; | 115 | m_LSL_Functions = LSL_Functions; |
116 | 116 | ||
diff --git a/OpenSim/Region/ScriptEngine/Common/OSSL_BuilIn_Commands.cs b/OpenSim/Region/ScriptEngine/Common/OSSL_BuilIn_Commands.cs new file mode 100644 index 0000000..dfa1a45 --- /dev/null +++ b/OpenSim/Region/ScriptEngine/Common/OSSL_BuilIn_Commands.cs | |||
@@ -0,0 +1,82 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | * | ||
27 | */ | ||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Text; | ||
31 | using libsecondlife; | ||
32 | using OpenSim.Region.Environment.Scenes; | ||
33 | |||
34 | namespace OpenSim.Region.ScriptEngine.Common | ||
35 | { | ||
36 | public class OSSL_BuilIn_Commands : LSL_BuiltIn_Commands, OSSL_BuilIn_Commands_Interface | ||
37 | { | ||
38 | public OSSL_BuilIn_Commands(ScriptEngineBase.ScriptEngine scriptEngine, SceneObjectPart host, uint localID, | ||
39 | LLUUID itemID) | ||
40 | : base(scriptEngine, host, localID, itemID) | ||
41 | { | ||
42 | } | ||
43 | |||
44 | private OSSLPrim Prim; | ||
45 | |||
46 | public class OSSLPrim | ||
47 | { | ||
48 | |||
49 | private LSL_Types.Vector3 _position; | ||
50 | public LSL_Types.Vector3 Position { | ||
51 | get { return _position; } | ||
52 | set { _position = value; } | ||
53 | } | ||
54 | private LSL_Types.Quaternion _rotation; | ||
55 | public LSL_Types.Quaternion Rotation { | ||
56 | get { return _rotation; } | ||
57 | set { _rotation = value; } | ||
58 | } | ||
59 | private string _text; | ||
60 | public string Text | ||
61 | { | ||
62 | get { return _text; } | ||
63 | set { _text = value; } | ||
64 | } | ||
65 | } | ||
66 | //public struct OSSLPrim_Position | ||
67 | //{ | ||
68 | // public int X; | ||
69 | // public int Y; | ||
70 | // public int Z; | ||
71 | //} | ||
72 | //public struct OSSLPrim_Rotation | ||
73 | //{ | ||
74 | // public double X; | ||
75 | // public double Y; | ||
76 | // public double Z; | ||
77 | // public double R; | ||
78 | //} | ||
79 | |||
80 | |||
81 | } | ||
82 | } | ||
diff --git a/OpenSim/Region/ScriptEngine/Common/OSSL_BuilIn_Commands_Interface.cs b/OpenSim/Region/ScriptEngine/Common/OSSL_BuilIn_Commands_Interface.cs new file mode 100644 index 0000000..2a2a3b7 --- /dev/null +++ b/OpenSim/Region/ScriptEngine/Common/OSSL_BuilIn_Commands_Interface.cs | |||
@@ -0,0 +1,37 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | * | ||
27 | */ | ||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Text; | ||
31 | |||
32 | namespace OpenSim.Region.ScriptEngine.Common | ||
33 | { | ||
34 | public interface OSSL_BuilIn_Commands_Interface | ||
35 | { | ||
36 | } | ||
37 | } | ||
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs index 68ac99c..b0ddf37 100644 --- a/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs +++ b/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs | |||
@@ -25,8 +25,6 @@ | |||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | /* Original code: Tedd Hansen */ | ||
29 | |||
30 | using System; | 28 | using System; |
31 | using libsecondlife; | 29 | using libsecondlife; |
32 | using OpenSim.Framework; | 30 | using OpenSim.Framework; |
@@ -97,7 +95,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine | |||
97 | // this private copy will contain Read-Only FullitemID so that it can bring that on to the server whenever needed. | 95 | // this private copy will contain Read-Only FullitemID so that it can bring that on to the server whenever needed. |
98 | 96 | ||
99 | 97 | ||
100 | LSL_BuiltIn_Commands LSLB = new LSL_BuiltIn_Commands(m_scriptEngine, m_host, localID, itemID); | 98 | BuilIn_Commands LSLB = (BuilIn_Commands)new OSSL_BuilIn_Commands(m_scriptEngine, m_host, localID, itemID); |
101 | 99 | ||
102 | // Start the script - giving it BuiltIns | 100 | // Start the script - giving it BuiltIns |
103 | CompiledScript.Start(LSLB); | 101 | CompiledScript.Start(LSLB); |
diff --git a/OpenSim/Region/ScriptEngine/LSOEngine/ScriptManager.cs b/OpenSim/Region/ScriptEngine/LSOEngine/ScriptManager.cs index 4657e5c..8a91550 100644 --- a/OpenSim/Region/ScriptEngine/LSOEngine/ScriptManager.cs +++ b/OpenSim/Region/ScriptEngine/LSOEngine/ScriptManager.cs | |||
@@ -91,7 +91,7 @@ namespace OpenSim.Region.ScriptEngine.LSOEngine | |||
91 | // this private copy will contain Read-Only FullitemID so that it can bring that on to the server whenever needed. | 91 | // this private copy will contain Read-Only FullitemID so that it can bring that on to the server whenever needed. |
92 | 92 | ||
93 | 93 | ||
94 | LSL_BuiltIn_Commands LSLB = new LSL_BuiltIn_Commands(m_scriptEngine, m_host, localID, itemID); | 94 | BuilIn_Commands LSLB = new BuilIn_Commands(m_scriptEngine, m_host, localID, itemID); |
95 | 95 | ||
96 | // Start the script - giving it BuiltIns | 96 | // Start the script - giving it BuiltIns |
97 | CompiledScript.Start(LSLB); | 97 | CompiledScript.Start(LSLB); |