diff options
author | Tedd Hansen | 2008-01-12 14:30:22 +0000 |
---|---|---|
committer | Tedd Hansen | 2008-01-12 14:30:22 +0000 |
commit | bacbade369a5244f9bcc611488b59f3bd4c8a564 (patch) | |
tree | 2cd909eff401066a69dba96615cbf736fdd73be5 /OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/ScriptEngine.cs | |
parent | * Trying something to see if it helps teleports and border crossings (diff) | |
download | opensim-SC_OLD-bacbade369a5244f9bcc611488b59f3bd4c8a564.zip opensim-SC_OLD-bacbade369a5244f9bcc611488b59f3bd4c8a564.tar.gz opensim-SC_OLD-bacbade369a5244f9bcc611488b59f3bd4c8a564.tar.bz2 opensim-SC_OLD-bacbade369a5244f9bcc611488b59f3bd4c8a564.tar.xz |
Major reorganizing of DotNetEngine. Moved common script engine parts to ScriptEngine.Common, only .Net-specific code in DotNetEngine. AppDomains, event handling, event execution queue and multithreading, script load/unload queue, etc has been moved to ScriptEngine.Common.
Loads of things has been put into interfaces instead of the specific class.
We are now one step closer to ScriptServer, and its very easy to implement new script languages. Just a few lines required to make them a OpenSim script module with all its glory.
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/ScriptEngine.cs')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/ScriptEngine.cs | 131 |
1 files changed, 131 insertions, 0 deletions
diff --git a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/ScriptEngine.cs b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/ScriptEngine.cs new file mode 100644 index 0000000..9637252 --- /dev/null +++ b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/ScriptEngine.cs | |||
@@ -0,0 +1,131 @@ | |||
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 | /* Original code: Tedd Hansen */ | ||
29 | using System; | ||
30 | using Nini.Config; | ||
31 | using OpenSim.Framework.Console; | ||
32 | using OpenSim.Region.Environment.Interfaces; | ||
33 | using OpenSim.Region.Environment.Scenes; | ||
34 | using OpenSim.Region.ScriptEngine.Common; | ||
35 | using OpenSim.Region.ScriptEngine.Common.ScriptEngineBase; | ||
36 | |||
37 | namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase | ||
38 | { | ||
39 | /// <summary> | ||
40 | /// This is the root object for ScriptEngine. Objects access each other trough this class. | ||
41 | /// </summary> | ||
42 | /// | ||
43 | [Serializable] | ||
44 | public abstract class ScriptEngine : IRegionModule, OpenSim.Region.ScriptEngine.Common.ScriptServerInterfaces.ScriptEngine | ||
45 | { | ||
46 | public Scene World; | ||
47 | public EventManager m_EventManager; // Handles and queues incoming events from OpenSim | ||
48 | public EventQueueManager m_EventQueueManager; // Executes events | ||
49 | public ScriptManager m_ScriptManager; // Load, unload and execute scripts | ||
50 | public AppDomainManager m_AppDomainManager; | ||
51 | public LSLLongCmdHandler m_LSLLongCmdHandler; | ||
52 | |||
53 | public ScriptManager GetScriptManager() | ||
54 | { | ||
55 | return _GetScriptManager(); | ||
56 | } | ||
57 | public abstract ScriptManager _GetScriptManager(); | ||
58 | |||
59 | private LogBase m_log; | ||
60 | |||
61 | public ScriptEngine() | ||
62 | { | ||
63 | //Common.SendToDebug("ScriptEngine Object Initialized"); | ||
64 | Common.mySE = this; | ||
65 | } | ||
66 | |||
67 | public LogBase Log | ||
68 | { | ||
69 | get { return m_log; } | ||
70 | } | ||
71 | |||
72 | public void InitializeEngine(Scene Sceneworld, LogBase logger, bool HookUpToServer, ScriptManager newScriptManager) | ||
73 | { | ||
74 | World = Sceneworld; | ||
75 | m_log = logger; | ||
76 | |||
77 | Log.Verbose("ScriptEngine", "DotNet & LSL ScriptEngine initializing"); | ||
78 | |||
79 | //m_logger.Status("ScriptEngine", "InitializeEngine"); | ||
80 | |||
81 | // Create all objects we'll be using | ||
82 | m_EventQueueManager = new EventQueueManager(this); | ||
83 | m_EventManager = new EventManager(this, HookUpToServer); | ||
84 | m_ScriptManager = newScriptManager; | ||
85 | //m_ScriptManager = new ScriptManager(this); | ||
86 | m_AppDomainManager = new AppDomainManager(); | ||
87 | m_LSLLongCmdHandler = new LSLLongCmdHandler(this); | ||
88 | |||
89 | // Should we iterate the region for scripts that needs starting? | ||
90 | // Or can we assume we are loaded before anything else so we can use proper events? | ||
91 | } | ||
92 | |||
93 | public void Shutdown() | ||
94 | { | ||
95 | // We are shutting down | ||
96 | } | ||
97 | |||
98 | ScriptServerInterfaces.RemoteEvents ScriptServerInterfaces.ScriptEngine.EventManager() | ||
99 | { | ||
100 | return this.m_EventManager; | ||
101 | } | ||
102 | |||
103 | |||
104 | #region IRegionModule | ||
105 | |||
106 | public abstract void Initialise(Scene scene, IConfigSource config); | ||
107 | |||
108 | public void PostInitialise() | ||
109 | { | ||
110 | } | ||
111 | |||
112 | public void Close() | ||
113 | { | ||
114 | } | ||
115 | |||
116 | public string Name | ||
117 | { | ||
118 | get { return "DotNetEngine"; } | ||
119 | } | ||
120 | |||
121 | public bool IsSharedModule | ||
122 | { | ||
123 | get { return false; } | ||
124 | } | ||
125 | |||
126 | |||
127 | |||
128 | #endregion | ||
129 | |||
130 | } | ||
131 | } \ No newline at end of file | ||