aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs137
1 files changed, 137 insertions, 0 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs
new file mode 100644
index 0000000..5d88311
--- /dev/null
+++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs
@@ -0,0 +1,137 @@
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
28using System;
29using System.Collections.Generic;
30using System.Reflection;
31
32using OpenSim.Region.Framework.Interfaces;
33using OpenSim.Region.Framework.Scenes;
34using OpenSim.Services.Connectors.Hypergrid;
35using OpenSim.Services.Interfaces;
36
37using GridRegion = OpenSim.Services.Interfaces.GridRegion;
38
39using OpenMetaverse;
40using log4net;
41using Nini.Config;
42
43namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
44{
45 public class HGEntityTransferModule : EntityTransferModule, ISharedRegionModule, IEntityTransferModule
46 {
47 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
48
49 private bool m_Enabled = false;
50 private IHypergridService m_HypergridService;
51 private IHypergridService HyperGridService
52 {
53 get
54 {
55 if (m_HypergridService == null)
56 m_HypergridService = m_aScene.RequestModuleInterface<IHypergridService>();
57 return m_HypergridService;
58 }
59 }
60
61 #region ISharedRegionModule
62
63 public override string Name
64 {
65 get { return "HGEntityTransferModule"; }
66 }
67
68 public override void Initialise(IConfigSource source)
69 {
70 IConfig moduleConfig = source.Configs["Modules"];
71 if (moduleConfig != null)
72 {
73 string name = moduleConfig.GetString("EntityTransferModule", "");
74 if (name == Name)
75 {
76 m_agentsInTransit = new List<UUID>();
77 m_Enabled = true;
78 m_log.InfoFormat("[HG ENTITY TRANSFER MODULE]: {0} enabled.", Name);
79 }
80 }
81 }
82
83 public override void PostInitialise()
84 {
85 }
86
87 public override void AddRegion(Scene scene)
88 {
89 if (!m_Enabled)
90 return;
91
92 if (m_aScene == null)
93 m_aScene = scene;
94
95 scene.RegisterModuleInterface<IEntityTransferModule>(this);
96 }
97
98 public override void Close()
99 {
100 if (!m_Enabled)
101 return;
102 }
103
104
105 public override void RemoveRegion(Scene scene)
106 {
107 if (!m_Enabled)
108 return;
109 if (scene == m_aScene)
110 m_aScene = null;
111 }
112
113 public override void RegionLoaded(Scene scene)
114 {
115 if (!m_Enabled)
116 return;
117
118 }
119
120 #endregion
121
122 #region HG overrides
123
124 protected override GridRegion GetFinalDestination(GridRegion region)
125 {
126 return HyperGridService.GetHyperlinkRegion(region, region.RegionID);
127 }
128
129 protected override bool NeedsClosing(uint oldRegionX, uint newRegionX, uint oldRegionY, uint newRegionY, GridRegion reg)
130 {
131 return true;
132 }
133
134
135 #endregion
136 }
137}