diff options
Diffstat (limited to 'OpenSim/Region/OptionalModules/Scripting/RegionReady')
-rw-r--r-- | OpenSim/Region/OptionalModules/Scripting/RegionReady/RegionReady.cs | 150 |
1 files changed, 0 insertions, 150 deletions
diff --git a/OpenSim/Region/OptionalModules/Scripting/RegionReady/RegionReady.cs b/OpenSim/Region/OptionalModules/Scripting/RegionReady/RegionReady.cs deleted file mode 100644 index f2c6db1..0000000 --- a/OpenSim/Region/OptionalModules/Scripting/RegionReady/RegionReady.cs +++ /dev/null | |||
@@ -1,150 +0,0 @@ | |||
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 OpenSimulator 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.Reflection; | ||
31 | |||
32 | using log4net; | ||
33 | using Nini.Config; | ||
34 | using OpenMetaverse; | ||
35 | |||
36 | using OpenSim.Framework; | ||
37 | using OpenSim.Region.Framework.Interfaces; | ||
38 | using OpenSim.Region.Framework.Scenes; | ||
39 | |||
40 | namespace OpenSim.Region.CoreModules.Scripting.RegionReady | ||
41 | { | ||
42 | public class RegionReady : IRegionModule | ||
43 | { | ||
44 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
45 | private IConfig m_config = null; | ||
46 | private bool m_firstEmptyCompileQueue; | ||
47 | private bool m_oarFileLoading; | ||
48 | private bool m_lastOarLoadedOk; | ||
49 | private int m_channelNotify = -1000; | ||
50 | private bool m_enabled = false; | ||
51 | |||
52 | Scene m_scene = null; | ||
53 | |||
54 | #region IRegionModule interface | ||
55 | |||
56 | public void Initialise(Scene scene, IConfigSource config) | ||
57 | { | ||
58 | m_log.Info("[RegionReady] Initialising"); | ||
59 | m_scene = scene; | ||
60 | m_firstEmptyCompileQueue = true; | ||
61 | m_oarFileLoading = false; | ||
62 | m_lastOarLoadedOk = true; | ||
63 | m_config = config.Configs["RegionReady"]; | ||
64 | |||
65 | if (m_config != null) | ||
66 | { | ||
67 | m_enabled = m_config.GetBoolean("enabled", false); | ||
68 | if (m_enabled) | ||
69 | { | ||
70 | m_channelNotify = m_config.GetInt("channel_notify", m_channelNotify); | ||
71 | } | ||
72 | } | ||
73 | } | ||
74 | |||
75 | public void PostInitialise() | ||
76 | { | ||
77 | if (m_enabled) | ||
78 | { | ||
79 | m_log.Info("[RegionReady]: Enabled"); | ||
80 | m_scene.EventManager.OnEmptyScriptCompileQueue += new EventManager.EmptyScriptCompileQueue(OnEmptyScriptCompileQueue); | ||
81 | m_scene.EventManager.OnOarFileLoaded += new EventManager.OarFileLoaded(OnOarFileLoaded); | ||
82 | } | ||
83 | else | ||
84 | { | ||
85 | m_log.Info("[RegionReady]: Disabled"); | ||
86 | } | ||
87 | } | ||
88 | |||
89 | public void Close() | ||
90 | { | ||
91 | } | ||
92 | |||
93 | public string Name | ||
94 | { | ||
95 | get { return "RegionReadyModule"; } | ||
96 | } | ||
97 | |||
98 | public bool IsSharedModule | ||
99 | { | ||
100 | get { return false; } | ||
101 | } | ||
102 | |||
103 | #endregion | ||
104 | |||
105 | |||
106 | void OnEmptyScriptCompileQueue(int numScriptsFailed, string message) | ||
107 | { | ||
108 | if (m_firstEmptyCompileQueue || m_oarFileLoading) | ||
109 | { | ||
110 | OSChatMessage c = new OSChatMessage(); | ||
111 | if (m_firstEmptyCompileQueue) | ||
112 | c.Message = "server_startup,"; | ||
113 | else | ||
114 | c.Message = "oar_file_load,"; | ||
115 | m_firstEmptyCompileQueue = false; | ||
116 | m_oarFileLoading = false; | ||
117 | |||
118 | m_scene.Backup(); | ||
119 | |||
120 | c.From = "RegionReady"; | ||
121 | if (m_lastOarLoadedOk) | ||
122 | c.Message += "1,"; | ||
123 | else | ||
124 | c.Message += "0,"; | ||
125 | c.Channel = m_channelNotify; | ||
126 | c.Message += numScriptsFailed.ToString() + "," + message; | ||
127 | c.Type = ChatTypeEnum.Region; | ||
128 | c.Position = new Vector3(((int)Constants.RegionSize * 0.5f), ((int)Constants.RegionSize * 0.5f), 30); | ||
129 | c.Sender = null; | ||
130 | c.SenderUUID = UUID.Zero; | ||
131 | |||
132 | m_log.InfoFormat("[RegionReady]: Region \"{0}\" is ready: \"{1}\" on channel {2}", | ||
133 | m_scene.RegionInfo.RegionName, c.Message, m_channelNotify); | ||
134 | m_scene.EventManager.TriggerOnChatBroadcast(this, c); | ||
135 | } | ||
136 | } | ||
137 | |||
138 | void OnOarFileLoaded(Guid requestId, string message) | ||
139 | { | ||
140 | m_oarFileLoading = true; | ||
141 | if (message==String.Empty) | ||
142 | { | ||
143 | m_lastOarLoadedOk = true; | ||
144 | } else { | ||
145 | m_log.InfoFormat("[RegionReady]: Oar file load errors: {0}", message); | ||
146 | m_lastOarLoadedOk = false; | ||
147 | } | ||
148 | } | ||
149 | } | ||
150 | } | ||