diff options
Diffstat (limited to 'OpenSim/Client/MXP/MXPModule.cs')
-rw-r--r-- | OpenSim/Client/MXP/MXPModule.cs | 174 |
1 files changed, 87 insertions, 87 deletions
diff --git a/OpenSim/Client/MXP/MXPModule.cs b/OpenSim/Client/MXP/MXPModule.cs index 345e4fb..f2b2f66 100644 --- a/OpenSim/Client/MXP/MXPModule.cs +++ b/OpenSim/Client/MXP/MXPModule.cs | |||
@@ -1,87 +1,87 @@ | |||
1 | using System; | 1 | using System; |
2 | using System.Collections.Generic; | 2 | using System.Collections.Generic; |
3 | using System.Text; | 3 | using System.Text; |
4 | using System.Timers; | 4 | using System.Timers; |
5 | using MXP; | 5 | using MXP; |
6 | using Nini.Config; | 6 | using Nini.Config; |
7 | using OpenMetaverse; | 7 | using OpenMetaverse; |
8 | using OpenSim.Client.MXP.PacketHandler; | 8 | using OpenSim.Client.MXP.PacketHandler; |
9 | using OpenSim.Region.Framework.Interfaces; | 9 | using OpenSim.Region.Framework.Interfaces; |
10 | using OpenSim.Region.Framework.Scenes; | 10 | using OpenSim.Region.Framework.Scenes; |
11 | 11 | ||
12 | namespace OpenSim.Client.MXP | 12 | namespace OpenSim.Client.MXP |
13 | { | 13 | { |
14 | public class MXPModule : IRegionModule | 14 | public class MXPModule : IRegionModule |
15 | { | 15 | { |
16 | private int mxp_Port = 1253; | 16 | private int mxp_Port = 1253; |
17 | private double mxp_BubbleRadius = 181.01933598375616624661615669884; // Radius of a sphere big enough to encapsulate a 256x256 square | 17 | private double mxp_BubbleRadius = 181.01933598375616624661615669884; // Radius of a sphere big enough to encapsulate a 256x256 square |
18 | 18 | ||
19 | private readonly Timer ticker = new Timer(100); | 19 | private readonly Timer ticker = new Timer(100); |
20 | 20 | ||
21 | private int ticks; | 21 | private int ticks; |
22 | private bool shutdown = false; | 22 | private bool shutdown = false; |
23 | 23 | ||
24 | private IConfigSource config; | 24 | private IConfigSource config; |
25 | 25 | ||
26 | private readonly Dictionary<UUID,Scene> m_scenes = new Dictionary<UUID, Scene>(); | 26 | private readonly Dictionary<UUID,Scene> m_scenes = new Dictionary<UUID, Scene>(); |
27 | 27 | ||
28 | private MXPPacketServer server; | 28 | private MXPPacketServer server; |
29 | 29 | ||
30 | 30 | ||
31 | public void Initialise(Scene scene, IConfigSource source) | 31 | public void Initialise(Scene scene, IConfigSource source) |
32 | { | 32 | { |
33 | m_scenes.Add(scene.RegionInfo.RegionID, scene); | 33 | m_scenes.Add(scene.RegionInfo.RegionID, scene); |
34 | config = source; | 34 | config = source; |
35 | } | 35 | } |
36 | 36 | ||
37 | public void PostInitialise() | 37 | public void PostInitialise() |
38 | { | 38 | { |
39 | if (config.Configs["MXP"] != null) | 39 | if (config.Configs["MXP"] != null) |
40 | { | 40 | { |
41 | IConfig con = config.Configs["MXP"]; | 41 | IConfig con = config.Configs["MXP"]; |
42 | 42 | ||
43 | if(!con.GetBoolean("Enabled",false)) | 43 | if(!con.GetBoolean("Enabled",false)) |
44 | return; | 44 | return; |
45 | 45 | ||
46 | mxp_Port = con.GetInt("Port", mxp_Port); | 46 | mxp_Port = con.GetInt("Port", mxp_Port); |
47 | 47 | ||
48 | 48 | ||
49 | server = new MXPPacketServer("http://null", mxp_Port, m_scenes); | 49 | server = new MXPPacketServer("http://null", mxp_Port, m_scenes); |
50 | 50 | ||
51 | ticker.AutoReset = false; | 51 | ticker.AutoReset = false; |
52 | ticker.Elapsed += ticker_Elapsed; | 52 | ticker.Elapsed += ticker_Elapsed; |
53 | 53 | ||
54 | ticker.Start(); | 54 | ticker.Start(); |
55 | } | 55 | } |
56 | } | 56 | } |
57 | 57 | ||
58 | void ticker_Elapsed(object sender, ElapsedEventArgs e) | 58 | void ticker_Elapsed(object sender, ElapsedEventArgs e) |
59 | { | 59 | { |
60 | server.Process(); | 60 | server.Process(); |
61 | 61 | ||
62 | if (!shutdown) | 62 | if (!shutdown) |
63 | ticker.Start(); | 63 | ticker.Start(); |
64 | 64 | ||
65 | if(++ticks % 100 == 0) | 65 | if(++ticks % 100 == 0) |
66 | { | 66 | { |
67 | server.PrintDebugInformation(); | 67 | server.PrintDebugInformation(); |
68 | } | 68 | } |
69 | } | 69 | } |
70 | 70 | ||
71 | public void Close() | 71 | public void Close() |
72 | { | 72 | { |
73 | shutdown = true; | 73 | shutdown = true; |
74 | ticker.Stop(); | 74 | ticker.Stop(); |
75 | } | 75 | } |
76 | 76 | ||
77 | public string Name | 77 | public string Name |
78 | { | 78 | { |
79 | get { return "MXP ClientStack Module"; } | 79 | get { return "MXP ClientStack Module"; } |
80 | } | 80 | } |
81 | 81 | ||
82 | public bool IsSharedModule | 82 | public bool IsSharedModule |
83 | { | 83 | { |
84 | get { return true; } | 84 | get { return true; } |
85 | } | 85 | } |
86 | } | 86 | } |
87 | } | 87 | } |