diff options
Diffstat (limited to 'OpenSim/Region/Framework')
27 files changed, 435 insertions, 3249 deletions
diff --git a/OpenSim/Region/Framework/Interfaces/ITeleportModule.cs b/OpenSim/Region/Framework/Interfaces/IEntityTransferModule.cs index 5f9129d..e8738c4 100644 --- a/OpenSim/Region/Framework/Interfaces/ITeleportModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IEntityTransferModule.cs | |||
@@ -26,16 +26,35 @@ | |||
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | 29 | using OpenSim.Services.Interfaces; |
30 | using System.Text; | 30 | using GridRegion = OpenSim.Services.Interfaces.GridRegion; |
31 | |||
31 | using OpenMetaverse; | 32 | using OpenMetaverse; |
33 | using OpenSim.Framework; | ||
32 | using OpenSim.Region.Framework.Scenes; | 34 | using OpenSim.Region.Framework.Scenes; |
33 | 35 | ||
34 | namespace OpenSim.Region.Framework.Interfaces | 36 | namespace OpenSim.Region.Framework.Interfaces |
35 | { | 37 | { |
36 | public interface ITeleportModule | 38 | public interface IEntityTransferModule |
37 | { | 39 | { |
38 | void RequestTeleportToLocation(ScenePresence avatar, ulong regionHandle, Vector3 position, | 40 | void Teleport(ScenePresence agent, ulong regionHandle, Vector3 position, |
39 | Vector3 lookAt, uint teleportFlags); | 41 | Vector3 lookAt, uint teleportFlags); |
42 | |||
43 | void TeleportHome(UUID id, IClientAPI client); | ||
44 | |||
45 | void Cross(ScenePresence agent, bool isFlying); | ||
46 | |||
47 | void AgentArrivedAtDestination(UUID agent); | ||
48 | |||
49 | void EnableChildAgents(ScenePresence agent); | ||
50 | |||
51 | void EnableChildAgent(ScenePresence agent, GridRegion region); | ||
52 | |||
53 | void Cross(SceneObjectGroup sog, Vector3 position, bool silent); | ||
54 | } | ||
55 | |||
56 | public interface IUserAgentVerificationModule | ||
57 | { | ||
58 | bool VerifyClient(AgentCircuitData aCircuit, string token); | ||
40 | } | 59 | } |
41 | } | 60 | } |
diff --git a/OpenSim/Region/Framework/Interfaces/IFriendsModule.cs b/OpenSim/Region/Framework/Interfaces/IFriendsModule.cs index 8386030..239a2ba 100644 --- a/OpenSim/Region/Framework/Interfaces/IFriendsModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IFriendsModule.cs | |||
@@ -46,6 +46,6 @@ namespace OpenSim.Region.Framework.Interfaces | |||
46 | /// </param> | 46 | /// </param> |
47 | /// <param name="offerMessage"></param> | 47 | /// <param name="offerMessage"></param> |
48 | void OfferFriendship(UUID fromUserId, IClientAPI toUserClient, string offerMessage); | 48 | void OfferFriendship(UUID fromUserId, IClientAPI toUserClient, string offerMessage); |
49 | List<FriendListItem> GetUserFriends(UUID agentID); | 49 | uint GetFriendPerms(UUID PrincipalID, UUID FriendID); |
50 | } | 50 | } |
51 | } | 51 | } |
diff --git a/OpenSim/Region/Framework/Interfaces/IInventoryAccessModule.cs b/OpenSim/Region/Framework/Interfaces/IInventoryAccessModule.cs new file mode 100644 index 0000000..2401402 --- /dev/null +++ b/OpenSim/Region/Framework/Interfaces/IInventoryAccessModule.cs | |||
@@ -0,0 +1,20 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | |||
4 | using OpenSim.Framework; | ||
5 | using OpenSim.Region.Framework.Scenes; | ||
6 | |||
7 | using OpenMetaverse; | ||
8 | |||
9 | namespace OpenSim.Region.Framework.Interfaces | ||
10 | { | ||
11 | public interface IInventoryAccessModule | ||
12 | { | ||
13 | UUID CapsUpdateInventoryItemAsset(IClientAPI remoteClient, UUID itemID, byte[] data); | ||
14 | UUID DeleteToInventory(DeRezAction action, UUID folderID, SceneObjectGroup objectGroup, IClientAPI remoteClient); | ||
15 | SceneObjectGroup RezObject(IClientAPI remoteClient, UUID itemID, Vector3 RayEnd, Vector3 RayStart, | ||
16 | UUID RayTargetID, byte BypassRayCast, bool RayEndIsIntersection, | ||
17 | bool RezSelected, bool RemoveItem, UUID fromTaskID, bool attachment); | ||
18 | void TransferInventoryAssets(InventoryItemBase item, UUID sender, UUID receiver); | ||
19 | } | ||
20 | } | ||
diff --git a/OpenSim/Region/Framework/Interfaces/IInventoryArchiverModule.cs b/OpenSim/Region/Framework/Interfaces/IInventoryArchiverModule.cs index 2d038ce..fbadd91 100644 --- a/OpenSim/Region/Framework/Interfaces/IInventoryArchiverModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IInventoryArchiverModule.cs | |||
@@ -27,7 +27,7 @@ | |||
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.IO; | 29 | using System.IO; |
30 | using OpenSim.Framework.Communications.Cache; | 30 | using OpenSim.Services.Interfaces; |
31 | 31 | ||
32 | namespace OpenSim.Region.Framework.Interfaces | 32 | namespace OpenSim.Region.Framework.Interfaces |
33 | { | 33 | { |
@@ -41,7 +41,7 @@ namespace OpenSim.Region.Framework.Interfaces | |||
41 | /// <param name="savePath">The stream to which the archive was saved</param> | 41 | /// <param name="savePath">The stream to which the archive was saved</param> |
42 | /// <param name="reportedException">Contains the exception generated if the save did not succeed</param> | 42 | /// <param name="reportedException">Contains the exception generated if the save did not succeed</param> |
43 | public delegate void InventoryArchiveSaved( | 43 | public delegate void InventoryArchiveSaved( |
44 | Guid id, bool succeeded, CachedUserInfo userInfo, string invPath, Stream saveStream, Exception reportedException); | 44 | Guid id, bool succeeded, UserAccount userInfo, string invPath, Stream saveStream, Exception reportedException); |
45 | 45 | ||
46 | public interface IInventoryArchiverModule | 46 | public interface IInventoryArchiverModule |
47 | { | 47 | { |
diff --git a/OpenSim/Region/Framework/Interfaces/IPresenceModule.cs b/OpenSim/Region/Framework/Interfaces/IPresenceModule.cs index 630c6a3..d44c1e1 100644 --- a/OpenSim/Region/Framework/Interfaces/IPresenceModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IPresenceModule.cs | |||
@@ -31,13 +31,13 @@ namespace OpenSim.Region.Framework.Interfaces | |||
31 | { | 31 | { |
32 | public struct PresenceInfo | 32 | public struct PresenceInfo |
33 | { | 33 | { |
34 | public UUID userID; | 34 | public string UserID; |
35 | public UUID regionID; | 35 | public UUID RegionID; |
36 | 36 | ||
37 | public PresenceInfo(UUID userID, UUID regionID) | 37 | public PresenceInfo(string userID, UUID regionID) |
38 | { | 38 | { |
39 | this.userID = userID; | 39 | UserID = userID; |
40 | this.regionID = regionID; | 40 | RegionID = regionID; |
41 | } | 41 | } |
42 | } | 42 | } |
43 | 43 | ||
diff --git a/OpenSim/Region/Framework/Scenes/AsyncSceneObjectGroupDeleter.cs b/OpenSim/Region/Framework/Scenes/AsyncSceneObjectGroupDeleter.cs index 9a7863b..c08b961 100644 --- a/OpenSim/Region/Framework/Scenes/AsyncSceneObjectGroupDeleter.cs +++ b/OpenSim/Region/Framework/Scenes/AsyncSceneObjectGroupDeleter.cs | |||
@@ -32,6 +32,7 @@ using System.Timers; | |||
32 | using log4net; | 32 | using log4net; |
33 | using OpenMetaverse; | 33 | using OpenMetaverse; |
34 | using OpenSim.Framework; | 34 | using OpenSim.Framework; |
35 | using OpenSim.Region.Framework.Interfaces; | ||
35 | 36 | ||
36 | namespace OpenSim.Region.Framework.Scenes | 37 | namespace OpenSim.Region.Framework.Scenes |
37 | { | 38 | { |
@@ -137,7 +138,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
137 | 138 | ||
138 | try | 139 | try |
139 | { | 140 | { |
140 | m_scene.DeleteToInventory(x.action, x.folderID, x.objectGroup, x.remoteClient); | 141 | IInventoryAccessModule invAccess = m_scene.RequestModuleInterface<IInventoryAccessModule>(); |
142 | if (invAccess != null) | ||
143 | invAccess.DeleteToInventory(x.action, x.folderID, x.objectGroup, x.remoteClient); | ||
141 | if (x.permissionToDelete) | 144 | if (x.permissionToDelete) |
142 | m_scene.DeleteSceneObject(x.objectGroup, false); | 145 | m_scene.DeleteSceneObject(x.objectGroup, false); |
143 | } | 146 | } |
diff --git a/OpenSim/Region/Framework/Scenes/Hypergrid/HGAssetMapper.cs b/OpenSim/Region/Framework/Scenes/Hypergrid/HGAssetMapper.cs deleted file mode 100644 index ec50598..0000000 --- a/OpenSim/Region/Framework/Scenes/Hypergrid/HGAssetMapper.cs +++ /dev/null | |||
@@ -1,265 +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 | using System.Threading; | ||
32 | using log4net; | ||
33 | using OpenMetaverse; | ||
34 | using OpenSim.Framework; | ||
35 | using OpenSim.Framework.Communications.Cache; | ||
36 | using OpenSim.Framework.Communications.Clients; | ||
37 | using OpenSim.Region.Framework.Scenes.Serialization; | ||
38 | using OpenSim.Region.Framework.Interfaces; | ||
39 | using OpenSim.Services.Interfaces; | ||
40 | |||
41 | //using HyperGrid.Framework; | ||
42 | //using OpenSim.Region.Communications.Hypergrid; | ||
43 | |||
44 | namespace OpenSim.Region.Framework.Scenes.Hypergrid | ||
45 | { | ||
46 | public class HGAssetMapper | ||
47 | { | ||
48 | #region Fields | ||
49 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
50 | |||
51 | // This maps between inventory server urls and inventory server clients | ||
52 | // private Dictionary<string, InventoryClient> m_inventoryServers = new Dictionary<string, InventoryClient>(); | ||
53 | |||
54 | private Scene m_scene; | ||
55 | |||
56 | private IHyperAssetService m_hyper; | ||
57 | IHyperAssetService HyperlinkAssets | ||
58 | { | ||
59 | get | ||
60 | { | ||
61 | if (m_hyper == null) | ||
62 | m_hyper = m_scene.RequestModuleInterface<IHyperAssetService>(); | ||
63 | return m_hyper; | ||
64 | } | ||
65 | } | ||
66 | |||
67 | #endregion | ||
68 | |||
69 | #region Constructor | ||
70 | |||
71 | public HGAssetMapper(Scene scene) | ||
72 | { | ||
73 | m_scene = scene; | ||
74 | } | ||
75 | |||
76 | #endregion | ||
77 | |||
78 | #region Internal functions | ||
79 | |||
80 | // private string UserAssetURL(UUID userID) | ||
81 | // { | ||
82 | // CachedUserInfo uinfo = m_scene.CommsManager.UserProfileCacheService.GetUserDetails(userID); | ||
83 | // if (uinfo != null) | ||
84 | // return (uinfo.UserProfile.UserAssetURI == "") ? null : uinfo.UserProfile.UserAssetURI; | ||
85 | // return null; | ||
86 | // } | ||
87 | |||
88 | // private string UserInventoryURL(UUID userID) | ||
89 | // { | ||
90 | // CachedUserInfo uinfo = m_scene.CommsManager.UserProfileCacheService.GetUserDetails(userID); | ||
91 | // if (uinfo != null) | ||
92 | // return (uinfo.UserProfile.UserInventoryURI == "") ? null : uinfo.UserProfile.UserInventoryURI; | ||
93 | // return null; | ||
94 | // } | ||
95 | |||
96 | |||
97 | public AssetBase FetchAsset(string url, UUID assetID) | ||
98 | { | ||
99 | AssetBase asset = m_scene.AssetService.Get(url + "/" + assetID.ToString()); | ||
100 | |||
101 | if (asset != null) | ||
102 | { | ||
103 | m_log.DebugFormat("[HGScene]: Copied asset {0} from {1} to local asset server. ", asset.ID, url); | ||
104 | return asset; | ||
105 | } | ||
106 | return null; | ||
107 | } | ||
108 | |||
109 | public bool PostAsset(string url, AssetBase asset) | ||
110 | { | ||
111 | if (asset != null) | ||
112 | { | ||
113 | // See long comment in AssetCache.AddAsset | ||
114 | if (!asset.Temporary || asset.Local) | ||
115 | { | ||
116 | // We need to copy the asset into a new asset, because | ||
117 | // we need to set its ID to be URL+UUID, so that the | ||
118 | // HGAssetService dispatches it to the remote grid. | ||
119 | // It's not pretty, but the best that can be done while | ||
120 | // not having a global naming infrastructure | ||
121 | AssetBase asset1 = new AssetBase(asset.FullID, asset.Name, asset.Type); | ||
122 | Copy(asset, asset1); | ||
123 | try | ||
124 | { | ||
125 | asset1.ID = url + "/" + asset.ID; | ||
126 | } | ||
127 | catch | ||
128 | { | ||
129 | m_log.Warn("[HGScene]: Oops."); | ||
130 | } | ||
131 | |||
132 | m_scene.AssetService.Store(asset1); | ||
133 | m_log.DebugFormat("[HGScene]: Posted copy of asset {0} from local asset server to {1}", asset1.ID, url); | ||
134 | } | ||
135 | return true; | ||
136 | } | ||
137 | else | ||
138 | m_log.Warn("[HGScene]: Tried to post asset to remote server, but asset not in local cache."); | ||
139 | |||
140 | return false; | ||
141 | } | ||
142 | |||
143 | private void Copy(AssetBase from, AssetBase to) | ||
144 | { | ||
145 | to.Data = from.Data; | ||
146 | to.Description = from.Description; | ||
147 | to.FullID = from.FullID; | ||
148 | to.ID = from.ID; | ||
149 | to.Local = from.Local; | ||
150 | to.Name = from.Name; | ||
151 | to.Temporary = from.Temporary; | ||
152 | to.Type = from.Type; | ||
153 | |||
154 | } | ||
155 | |||
156 | // TODO: unused | ||
157 | // private void Dump(Dictionary<UUID, bool> lst) | ||
158 | // { | ||
159 | // m_log.Debug("XXX -------- UUID DUMP ------- XXX"); | ||
160 | // foreach (KeyValuePair<UUID, bool> kvp in lst) | ||
161 | // m_log.Debug(" >> " + kvp.Key + " (texture? " + kvp.Value + ")"); | ||
162 | // m_log.Debug("XXX -------- UUID DUMP ------- XXX"); | ||
163 | // } | ||
164 | |||
165 | #endregion | ||
166 | |||
167 | |||
168 | #region Public interface | ||
169 | |||
170 | public void Get(UUID assetID, UUID ownerID) | ||
171 | { | ||
172 | // Get the item from the remote asset server onto the local AssetCache | ||
173 | // and place an entry in m_assetMap | ||
174 | |||
175 | string userAssetURL = HyperlinkAssets.GetUserAssetServer(ownerID); | ||
176 | if ((userAssetURL != string.Empty) && (userAssetURL != HyperlinkAssets.GetSimAssetServer())) | ||
177 | { | ||
178 | m_log.Debug("[HGScene]: Fetching object " + assetID + " from asset server " + userAssetURL); | ||
179 | AssetBase asset = FetchAsset(userAssetURL, assetID); | ||
180 | |||
181 | if (asset != null) | ||
182 | { | ||
183 | // OK, now fetch the inside. | ||
184 | Dictionary<UUID, int> ids = new Dictionary<UUID, int>(); | ||
185 | HGUuidGatherer uuidGatherer = new HGUuidGatherer(this, m_scene.AssetService, userAssetURL); | ||
186 | uuidGatherer.GatherAssetUuids(asset.FullID, (AssetType)asset.Type, ids); | ||
187 | foreach (UUID uuid in ids.Keys) | ||
188 | FetchAsset(userAssetURL, uuid); | ||
189 | |||
190 | m_log.DebugFormat("[HGScene]: Successfully fetched asset {0} from asset server {1}", asset.ID, userAssetURL); | ||
191 | |||
192 | } | ||
193 | else | ||
194 | m_log.Warn("[HGScene]: Could not fetch asset from remote asset server " + userAssetURL); | ||
195 | } | ||
196 | else | ||
197 | m_log.Debug("[HGScene]: user's asset server is the local region's asset server"); | ||
198 | } | ||
199 | |||
200 | //public InventoryItemBase Get(InventoryItemBase item, UUID rootFolder, CachedUserInfo userInfo) | ||
201 | //{ | ||
202 | // InventoryClient invCli = null; | ||
203 | // string inventoryURL = UserInventoryURL(item.Owner); | ||
204 | // if (!m_inventoryServers.TryGetValue(inventoryURL, out invCli)) | ||
205 | // { | ||
206 | // m_log.Debug("[HGScene]: Starting new InventorytClient for " + inventoryURL); | ||
207 | // invCli = new InventoryClient(inventoryURL); | ||
208 | // m_inventoryServers.Add(inventoryURL, invCli); | ||
209 | // } | ||
210 | |||
211 | // item = invCli.GetInventoryItem(item); | ||
212 | // if (item != null) | ||
213 | // { | ||
214 | // // Change the folder, stick it in root folder, all items flattened out here in this region cache | ||
215 | // item.Folder = rootFolder; | ||
216 | // //userInfo.AddItem(item); don't use this, it calls back to the inventory server | ||
217 | // lock (userInfo.RootFolder.Items) | ||
218 | // { | ||
219 | // userInfo.RootFolder.Items[item.ID] = item; | ||
220 | // } | ||
221 | |||
222 | // } | ||
223 | // return item; | ||
224 | //} | ||
225 | |||
226 | public void Post(UUID assetID, UUID ownerID) | ||
227 | { | ||
228 | // Post the item from the local AssetCache onto the remote asset server | ||
229 | // and place an entry in m_assetMap | ||
230 | |||
231 | string userAssetURL = HyperlinkAssets.GetUserAssetServer(ownerID); | ||
232 | if ((userAssetURL != string.Empty) && (userAssetURL != HyperlinkAssets.GetSimAssetServer())) | ||
233 | { | ||
234 | m_log.Debug("[HGScene]: Posting object " + assetID + " to asset server " + userAssetURL); | ||
235 | AssetBase asset = m_scene.AssetService.Get(assetID.ToString()); | ||
236 | if (asset != null) | ||
237 | { | ||
238 | Dictionary<UUID, int> ids = new Dictionary<UUID, int>(); | ||
239 | HGUuidGatherer uuidGatherer = new HGUuidGatherer(this, m_scene.AssetService, string.Empty); | ||
240 | uuidGatherer.GatherAssetUuids(asset.FullID, (AssetType)asset.Type, ids); | ||
241 | foreach (UUID uuid in ids.Keys) | ||
242 | { | ||
243 | asset = m_scene.AssetService.Get(uuid.ToString()); | ||
244 | if (asset == null) | ||
245 | m_log.DebugFormat("[HGScene]: Could not find asset {0}", uuid); | ||
246 | else | ||
247 | PostAsset(userAssetURL, asset); | ||
248 | } | ||
249 | |||
250 | // maybe all pieces got there... | ||
251 | m_log.DebugFormat("[HGScene]: Successfully posted item {0} to asset server {1}", assetID, userAssetURL); | ||
252 | |||
253 | } | ||
254 | else | ||
255 | m_log.DebugFormat("[HGScene]: Something wrong with asset {0}, it could not be found", assetID); | ||
256 | } | ||
257 | else | ||
258 | m_log.Debug("[HGScene]: user's asset server is local region's asset server"); | ||
259 | |||
260 | } | ||
261 | |||
262 | #endregion | ||
263 | |||
264 | } | ||
265 | } | ||
diff --git a/OpenSim/Region/Framework/Scenes/Hypergrid/HGScene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Hypergrid/HGScene.Inventory.cs deleted file mode 100644 index 6f7f34f..0000000 --- a/OpenSim/Region/Framework/Scenes/Hypergrid/HGScene.Inventory.cs +++ /dev/null | |||
@@ -1,174 +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.Reflection; | ||
29 | using log4net; | ||
30 | using Nini.Config; | ||
31 | using OpenMetaverse; | ||
32 | using OpenSim.Framework; | ||
33 | using OpenSim.Framework.Communications; | ||
34 | using OpenSim.Framework.Communications.Cache; | ||
35 | using OpenSim.Region.Framework.Interfaces; | ||
36 | |||
37 | namespace OpenSim.Region.Framework.Scenes.Hypergrid | ||
38 | { | ||
39 | public partial class HGScene : Scene | ||
40 | { | ||
41 | #region Fields | ||
42 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
43 | |||
44 | private HGAssetMapper m_assMapper; | ||
45 | public HGAssetMapper AssetMapper | ||
46 | { | ||
47 | get { return m_assMapper; } | ||
48 | } | ||
49 | |||
50 | private IHyperAssetService m_hyper; | ||
51 | private IHyperAssetService HyperAssets | ||
52 | { | ||
53 | get | ||
54 | { | ||
55 | if (m_hyper == null) | ||
56 | m_hyper = RequestModuleInterface<IHyperAssetService>(); | ||
57 | return m_hyper; | ||
58 | } | ||
59 | } | ||
60 | |||
61 | #endregion | ||
62 | |||
63 | #region Constructors | ||
64 | |||
65 | public HGScene(RegionInfo regInfo, AgentCircuitManager authen, | ||
66 | CommunicationsManager commsMan, SceneCommunicationService sceneGridService, | ||
67 | StorageManager storeManager, | ||
68 | ModuleLoader moduleLoader, bool dumpAssetsToFile, bool physicalPrim, | ||
69 | bool SeeIntoRegionFromNeighbor, IConfigSource config, string simulatorVersion) | ||
70 | : base(regInfo, authen, commsMan, sceneGridService, storeManager, moduleLoader, | ||
71 | dumpAssetsToFile, physicalPrim, SeeIntoRegionFromNeighbor, config, simulatorVersion) | ||
72 | { | ||
73 | m_log.Info("[HGScene]: Starting HGScene."); | ||
74 | m_assMapper = new HGAssetMapper(this); | ||
75 | |||
76 | EventManager.OnNewInventoryItemUploadComplete += UploadInventoryItem; | ||
77 | } | ||
78 | |||
79 | #endregion | ||
80 | |||
81 | #region Event handlers | ||
82 | |||
83 | public void UploadInventoryItem(UUID avatarID, UUID assetID, string name, int userlevel) | ||
84 | { | ||
85 | CachedUserInfo userInfo = CommsManager.UserProfileCacheService.GetUserDetails(avatarID); | ||
86 | if (userInfo != null) | ||
87 | { | ||
88 | m_assMapper.Post(assetID, avatarID); | ||
89 | } | ||
90 | } | ||
91 | |||
92 | #endregion | ||
93 | |||
94 | #region Overrides of Scene.Inventory methods | ||
95 | |||
96 | /// | ||
97 | /// CapsUpdateInventoryItemAsset | ||
98 | /// | ||
99 | public override UUID CapsUpdateInventoryItemAsset(IClientAPI remoteClient, UUID itemID, byte[] data) | ||
100 | { | ||
101 | UUID newAssetID = base.CapsUpdateInventoryItemAsset(remoteClient, itemID, data); | ||
102 | |||
103 | UploadInventoryItem(remoteClient.AgentId, newAssetID, "", 0); | ||
104 | |||
105 | return newAssetID; | ||
106 | } | ||
107 | |||
108 | /// | ||
109 | /// DeleteToInventory | ||
110 | /// | ||
111 | public override UUID DeleteToInventory(DeRezAction action, UUID folderID, SceneObjectGroup objectGroup, IClientAPI remoteClient) | ||
112 | { | ||
113 | UUID assetID = base.DeleteToInventory(action, folderID, objectGroup, remoteClient); | ||
114 | |||
115 | if (!assetID.Equals(UUID.Zero)) | ||
116 | { | ||
117 | UploadInventoryItem(remoteClient.AgentId, assetID, "", 0); | ||
118 | } | ||
119 | else | ||
120 | m_log.Debug("[HGScene]: Scene.Inventory did not create asset"); | ||
121 | |||
122 | return assetID; | ||
123 | } | ||
124 | |||
125 | /// | ||
126 | /// RezObject | ||
127 | /// | ||
128 | public override SceneObjectGroup RezObject(IClientAPI remoteClient, UUID itemID, Vector3 RayEnd, Vector3 RayStart, | ||
129 | UUID RayTargetID, byte BypassRayCast, bool RayEndIsIntersection, | ||
130 | bool RezSelected, bool RemoveItem, UUID fromTaskID, bool attachment) | ||
131 | { | ||
132 | m_log.DebugFormat("[HGScene] RezObject itemID={0} fromTaskID={1}", itemID, fromTaskID); | ||
133 | |||
134 | //if (fromTaskID.Equals(UUID.Zero)) | ||
135 | //{ | ||
136 | InventoryItemBase item = new InventoryItemBase(itemID); | ||
137 | item.Owner = remoteClient.AgentId; | ||
138 | item = InventoryService.GetItem(item); | ||
139 | //if (item == null) | ||
140 | //{ // Fetch the item | ||
141 | // item = new InventoryItemBase(); | ||
142 | // item.Owner = remoteClient.AgentId; | ||
143 | // item.ID = itemID; | ||
144 | // item = m_assMapper.Get(item, userInfo.RootFolder.ID, userInfo); | ||
145 | //} | ||
146 | if (item != null) | ||
147 | { | ||
148 | m_assMapper.Get(item.AssetID, remoteClient.AgentId); | ||
149 | |||
150 | } | ||
151 | //} | ||
152 | |||
153 | // OK, we're done fetching. Pass it up to the default RezObject | ||
154 | return base.RezObject(remoteClient, itemID, RayEnd, RayStart, RayTargetID, BypassRayCast, RayEndIsIntersection, | ||
155 | RezSelected, RemoveItem, fromTaskID, attachment); | ||
156 | |||
157 | } | ||
158 | |||
159 | protected override void TransferInventoryAssets(InventoryItemBase item, UUID sender, UUID receiver) | ||
160 | { | ||
161 | string userAssetServer = HyperAssets.GetUserAssetServer(sender); | ||
162 | if ((userAssetServer != string.Empty) && (userAssetServer != HyperAssets.GetSimAssetServer())) | ||
163 | m_assMapper.Get(item.AssetID, sender); | ||
164 | |||
165 | userAssetServer = HyperAssets.GetUserAssetServer(receiver); | ||
166 | if ((userAssetServer != string.Empty) && (userAssetServer != HyperAssets.GetSimAssetServer())) | ||
167 | m_assMapper.Post(item.AssetID, receiver); | ||
168 | } | ||
169 | |||
170 | #endregion | ||
171 | |||
172 | } | ||
173 | |||
174 | } | ||
diff --git a/OpenSim/Region/Framework/Scenes/Hypergrid/HGScene.cs b/OpenSim/Region/Framework/Scenes/Hypergrid/HGScene.cs deleted file mode 100644 index b1981b6..0000000 --- a/OpenSim/Region/Framework/Scenes/Hypergrid/HGScene.cs +++ /dev/null | |||
@@ -1,77 +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 OpenMetaverse; | ||
29 | using OpenSim.Framework; | ||
30 | using OpenSim.Framework.Communications.Cache; | ||
31 | using TPFlags = OpenSim.Framework.Constants.TeleportFlags; | ||
32 | using GridRegion = OpenSim.Services.Interfaces.GridRegion; | ||
33 | |||
34 | namespace OpenSim.Region.Framework.Scenes.Hypergrid | ||
35 | { | ||
36 | public partial class HGScene : Scene | ||
37 | { | ||
38 | /// <summary> | ||
39 | /// Teleport an avatar to their home region | ||
40 | /// </summary> | ||
41 | /// <param name="agentId"></param> | ||
42 | /// <param name="client"></param> | ||
43 | public override void TeleportClientHome(UUID agentId, IClientAPI client) | ||
44 | { | ||
45 | m_log.Debug("[HGScene]: TeleportClientHome " + client.FirstName + " " + client.LastName); | ||
46 | |||
47 | CachedUserInfo uinfo = CommsManager.UserProfileCacheService.GetUserDetails(agentId); | ||
48 | if (uinfo != null) | ||
49 | { | ||
50 | UserProfileData UserProfile = uinfo.UserProfile; | ||
51 | |||
52 | if (UserProfile != null) | ||
53 | { | ||
54 | GridRegion regionInfo = GridService.GetRegionByUUID(UUID.Zero, UserProfile.HomeRegionID); | ||
55 | //if (regionInfo != null) | ||
56 | //{ | ||
57 | // UserProfile.HomeRegionID = regionInfo.RegionID; | ||
58 | // //CommsManager.UserService.UpdateUserProfile(UserProfile); | ||
59 | //} | ||
60 | if (regionInfo == null) | ||
61 | { | ||
62 | // can't find the Home region: Tell viewer and abort | ||
63 | client.SendTeleportFailed("Your home-region could not be found."); | ||
64 | return; | ||
65 | } | ||
66 | RequestTeleportLocation( | ||
67 | client, regionInfo.RegionHandle, UserProfile.HomeLocation, UserProfile.HomeLookAt, | ||
68 | (uint)(TPFlags.SetLastToTarget | TPFlags.ViaHome)); | ||
69 | } | ||
70 | } | ||
71 | else | ||
72 | client.SendTeleportFailed("Sorry! I lost your home-region information."); | ||
73 | |||
74 | } | ||
75 | |||
76 | } | ||
77 | } | ||
diff --git a/OpenSim/Region/Framework/Scenes/Hypergrid/HGSceneCommunicationService.cs b/OpenSim/Region/Framework/Scenes/Hypergrid/HGSceneCommunicationService.cs deleted file mode 100644 index 416826c..0000000 --- a/OpenSim/Region/Framework/Scenes/Hypergrid/HGSceneCommunicationService.cs +++ /dev/null | |||
@@ -1,391 +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.Net; | ||
31 | using System.Reflection; | ||
32 | using System.Threading; | ||
33 | using log4net; | ||
34 | using OpenMetaverse; | ||
35 | using OpenSim.Framework; | ||
36 | using OpenSim.Framework.Client; | ||
37 | using OpenSim.Framework.Communications; | ||
38 | using OpenSim.Framework.Communications.Cache; | ||
39 | using OpenSim.Framework.Capabilities; | ||
40 | using OpenSim.Region.Framework.Interfaces; | ||
41 | using OpenSim.Services.Interfaces; | ||
42 | using GridRegion = OpenSim.Services.Interfaces.GridRegion; | ||
43 | |||
44 | namespace OpenSim.Region.Framework.Scenes.Hypergrid | ||
45 | { | ||
46 | public class HGSceneCommunicationService : SceneCommunicationService | ||
47 | { | ||
48 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
49 | |||
50 | private IHyperlinkService m_hg; | ||
51 | IHyperlinkService HyperlinkService | ||
52 | { | ||
53 | get | ||
54 | { | ||
55 | if (m_hg == null) | ||
56 | m_hg = m_scene.RequestModuleInterface<IHyperlinkService>(); | ||
57 | return m_hg; | ||
58 | } | ||
59 | } | ||
60 | |||
61 | public HGSceneCommunicationService(CommunicationsManager commsMan) : base(commsMan) | ||
62 | { | ||
63 | } | ||
64 | |||
65 | |||
66 | /// <summary> | ||
67 | /// Try to teleport an agent to a new region. | ||
68 | /// </summary> | ||
69 | /// <param name="remoteClient"></param> | ||
70 | /// <param name="RegionHandle"></param> | ||
71 | /// <param name="position"></param> | ||
72 | /// <param name="lookAt"></param> | ||
73 | /// <param name="flags"></param> | ||
74 | public override void RequestTeleportToLocation(ScenePresence avatar, ulong regionHandle, Vector3 position, | ||
75 | Vector3 lookAt, uint teleportFlags) | ||
76 | { | ||
77 | if (!avatar.Scene.Permissions.CanTeleport(avatar.UUID)) | ||
78 | return; | ||
79 | |||
80 | bool destRegionUp = true; | ||
81 | |||
82 | IEventQueue eq = avatar.Scene.RequestModuleInterface<IEventQueue>(); | ||
83 | |||
84 | // Reset animations; the viewer does that in teleports. | ||
85 | avatar.Animator.ResetAnimations(); | ||
86 | |||
87 | if (regionHandle == m_regionInfo.RegionHandle) | ||
88 | { | ||
89 | // Teleport within the same region | ||
90 | if (IsOutsideRegion(avatar.Scene, position) || position.Z < 0) | ||
91 | { | ||
92 | Vector3 emergencyPos = new Vector3(128, 128, 128); | ||
93 | |||
94 | m_log.WarnFormat( | ||
95 | "[HGSceneCommService]: RequestTeleportToLocation() was given an illegal position of {0} for avatar {1}, {2}. Substituting {3}", | ||
96 | position, avatar.Name, avatar.UUID, emergencyPos); | ||
97 | position = emergencyPos; | ||
98 | } | ||
99 | // TODO: Get proper AVG Height | ||
100 | float localAVHeight = 1.56f; | ||
101 | |||
102 | float posZLimit = 22; | ||
103 | |||
104 | if (position.X > 0 && position.X <= (int)Constants.RegionSize && position.Y > 0 && position.Y <= (int)Constants.RegionSize) | ||
105 | { | ||
106 | posZLimit = (float) avatar.Scene.Heightmap[(int) position.X, (int) position.Y]; | ||
107 | } | ||
108 | |||
109 | float newPosZ = posZLimit + localAVHeight; | ||
110 | if (posZLimit >= (position.Z - (localAVHeight / 2)) && !(Single.IsInfinity(newPosZ) || Single.IsNaN(newPosZ))) | ||
111 | { | ||
112 | position.Z = newPosZ; | ||
113 | } | ||
114 | |||
115 | // Only send this if the event queue is null | ||
116 | if (eq == null) | ||
117 | avatar.ControllingClient.SendTeleportLocationStart(); | ||
118 | |||
119 | |||
120 | avatar.ControllingClient.SendLocalTeleport(position, lookAt, teleportFlags); | ||
121 | avatar.Teleport(position); | ||
122 | } | ||
123 | else | ||
124 | { | ||
125 | uint x = 0, y = 0; | ||
126 | Utils.LongToUInts(regionHandle, out x, out y); | ||
127 | GridRegion reg = m_scene.GridService.GetRegionByPosition(m_scene.RegionInfo.ScopeID, (int)x, (int)y); | ||
128 | |||
129 | if (reg != null) | ||
130 | { | ||
131 | |||
132 | uint newRegionX = (uint)(reg.RegionHandle >> 40); | ||
133 | uint newRegionY = (((uint)(reg.RegionHandle)) >> 8); | ||
134 | uint oldRegionX = (uint)(m_regionInfo.RegionHandle >> 40); | ||
135 | uint oldRegionY = (((uint)(m_regionInfo.RegionHandle)) >> 8); | ||
136 | |||
137 | /// | ||
138 | /// Hypergrid mod start | ||
139 | /// | ||
140 | /// | ||
141 | bool isHyperLink = (HyperlinkService.GetHyperlinkRegion(reg.RegionHandle) != null); | ||
142 | bool isHomeUser = true; | ||
143 | ulong realHandle = regionHandle; | ||
144 | CachedUserInfo uinfo = m_commsProvider.UserProfileCacheService.GetUserDetails(avatar.UUID); | ||
145 | if (uinfo != null) | ||
146 | { | ||
147 | isHomeUser = HyperlinkService.IsLocalUser(uinfo.UserProfile.ID); | ||
148 | realHandle = m_hg.FindRegionHandle(regionHandle); | ||
149 | m_log.Debug("XXX ---- home user? " + isHomeUser + " --- hyperlink? " + isHyperLink + " --- real handle: " + realHandle.ToString()); | ||
150 | } | ||
151 | /// | ||
152 | /// Hypergrid mod stop | ||
153 | /// | ||
154 | /// | ||
155 | |||
156 | if (eq == null) | ||
157 | avatar.ControllingClient.SendTeleportLocationStart(); | ||
158 | |||
159 | |||
160 | // Let's do DNS resolution only once in this process, please! | ||
161 | // This may be a costly operation. The reg.ExternalEndPoint field is not a passive field, | ||
162 | // it's actually doing a lot of work. | ||
163 | IPEndPoint endPoint = reg.ExternalEndPoint; | ||
164 | if (endPoint.Address == null) | ||
165 | { | ||
166 | // Couldn't resolve the name. Can't TP, because the viewer wants IP addresses. | ||
167 | destRegionUp = false; | ||
168 | } | ||
169 | |||
170 | if (destRegionUp) | ||
171 | { | ||
172 | // Fixing a bug where teleporting while sitting results in the avatar ending up removed from | ||
173 | // both regions | ||
174 | if (avatar.ParentID != (uint)0) | ||
175 | avatar.StandUp(); | ||
176 | |||
177 | if (!avatar.ValidateAttachments()) | ||
178 | { | ||
179 | avatar.ControllingClient.SendTeleportFailed("Inconsistent attachment state"); | ||
180 | return; | ||
181 | } | ||
182 | |||
183 | // the avatar.Close below will clear the child region list. We need this below for (possibly) | ||
184 | // closing the child agents, so save it here (we need a copy as it is Clear()-ed). | ||
185 | //List<ulong> childRegions = new List<ulong>(avatar.GetKnownRegionList()); | ||
186 | // Compared to ScenePresence.CrossToNewRegion(), there's no obvious code to handle a teleport | ||
187 | // failure at this point (unlike a border crossing failure). So perhaps this can never fail | ||
188 | // once we reach here... | ||
189 | //avatar.Scene.RemoveCapsHandler(avatar.UUID); | ||
190 | |||
191 | string capsPath = String.Empty; | ||
192 | AgentCircuitData agentCircuit = avatar.ControllingClient.RequestClientInfo(); | ||
193 | agentCircuit.BaseFolder = UUID.Zero; | ||
194 | agentCircuit.InventoryFolder = UUID.Zero; | ||
195 | agentCircuit.startpos = position; | ||
196 | agentCircuit.child = true; | ||
197 | if (Util.IsOutsideView(oldRegionX, newRegionX, oldRegionY, newRegionY)) | ||
198 | { | ||
199 | // brand new agent, let's create a new caps seed | ||
200 | agentCircuit.CapsPath = CapsUtil.GetRandomCapsObjectPath(); | ||
201 | } | ||
202 | |||
203 | string reason = String.Empty; | ||
204 | |||
205 | //if (!m_commsProvider.InterRegion.InformRegionOfChildAgent(reg.RegionHandle, agentCircuit)) | ||
206 | if (!m_interregionCommsOut.SendCreateChildAgent(reg.RegionHandle, agentCircuit, teleportFlags, out reason)) | ||
207 | { | ||
208 | avatar.ControllingClient.SendTeleportFailed(String.Format("Destination is not accepting teleports: {0}", | ||
209 | reason)); | ||
210 | return; | ||
211 | } | ||
212 | |||
213 | // Let's close some agents | ||
214 | if (isHyperLink) // close them all except this one | ||
215 | { | ||
216 | List<ulong> regions = new List<ulong>(avatar.KnownChildRegionHandles); | ||
217 | regions.Remove(avatar.Scene.RegionInfo.RegionHandle); | ||
218 | SendCloseChildAgentConnections(avatar.UUID, regions); | ||
219 | } | ||
220 | else // close just a few | ||
221 | avatar.CloseChildAgents(newRegionX, newRegionY); | ||
222 | |||
223 | if (Util.IsOutsideView(oldRegionX, newRegionX, oldRegionY, newRegionY) || isHyperLink) | ||
224 | { | ||
225 | capsPath | ||
226 | = "http://" | ||
227 | + reg.ExternalHostName | ||
228 | + ":" | ||
229 | + reg.HttpPort | ||
230 | + CapsUtil.GetCapsSeedPath(agentCircuit.CapsPath); | ||
231 | |||
232 | if (eq != null) | ||
233 | { | ||
234 | #region IP Translation for NAT | ||
235 | IClientIPEndpoint ipepClient; | ||
236 | if (avatar.ClientView.TryGet(out ipepClient)) | ||
237 | { | ||
238 | endPoint.Address = NetworkUtil.GetIPFor(ipepClient.EndPoint, endPoint.Address); | ||
239 | } | ||
240 | #endregion | ||
241 | |||
242 | eq.EnableSimulator(realHandle, endPoint, avatar.UUID); | ||
243 | |||
244 | // ES makes the client send a UseCircuitCode message to the destination, | ||
245 | // which triggers a bunch of things there. | ||
246 | // So let's wait | ||
247 | Thread.Sleep(2000); | ||
248 | |||
249 | eq.EstablishAgentCommunication(avatar.UUID, endPoint, capsPath); | ||
250 | } | ||
251 | else | ||
252 | { | ||
253 | avatar.ControllingClient.InformClientOfNeighbour(realHandle, endPoint); | ||
254 | // TODO: make Event Queue disablable! | ||
255 | } | ||
256 | } | ||
257 | else | ||
258 | { | ||
259 | // child agent already there | ||
260 | agentCircuit.CapsPath = avatar.Scene.CapsModule.GetChildSeed(avatar.UUID, reg.RegionHandle); | ||
261 | capsPath = "http://" + reg.ExternalHostName + ":" + reg.HttpPort | ||
262 | + "/CAPS/" + agentCircuit.CapsPath + "0000/"; | ||
263 | } | ||
264 | |||
265 | //m_commsProvider.InterRegion.ExpectAvatarCrossing(reg.RegionHandle, avatar.ControllingClient.AgentId, | ||
266 | // position, false); | ||
267 | |||
268 | //if (!m_commsProvider.InterRegion.ExpectAvatarCrossing(reg.RegionHandle, avatar.ControllingClient.AgentId, | ||
269 | // position, false)) | ||
270 | //{ | ||
271 | // avatar.ControllingClient.SendTeleportFailed("Problem with destination."); | ||
272 | // // We should close that agent we just created over at destination... | ||
273 | // List<ulong> lst = new List<ulong>(); | ||
274 | // lst.Add(realHandle); | ||
275 | // SendCloseChildAgentAsync(avatar.UUID, lst); | ||
276 | // return; | ||
277 | //} | ||
278 | |||
279 | SetInTransit(avatar.UUID); | ||
280 | // Let's send a full update of the agent. This is a synchronous call. | ||
281 | AgentData agent = new AgentData(); | ||
282 | avatar.CopyTo(agent); | ||
283 | agent.Position = position; | ||
284 | agent.CallbackURI = "http://" + m_regionInfo.ExternalHostName + ":" + m_regionInfo.HttpPort + | ||
285 | "/agent/" + avatar.UUID.ToString() + "/" + avatar.Scene.RegionInfo.RegionHandle.ToString() + "/release/"; | ||
286 | |||
287 | m_interregionCommsOut.SendChildAgentUpdate(reg.RegionHandle, agent); | ||
288 | |||
289 | m_log.DebugFormat( | ||
290 | "[CAPS]: Sending new CAPS seed url {0} to client {1}", agentCircuit.CapsPath, avatar.UUID); | ||
291 | |||
292 | |||
293 | /// | ||
294 | /// Hypergrid mod: realHandle instead of reg.RegionHandle | ||
295 | /// | ||
296 | /// | ||
297 | if (eq != null) | ||
298 | { | ||
299 | eq.TeleportFinishEvent(realHandle, 13, endPoint, | ||
300 | 4, teleportFlags, capsPath, avatar.UUID); | ||
301 | } | ||
302 | else | ||
303 | { | ||
304 | avatar.ControllingClient.SendRegionTeleport(realHandle, 13, endPoint, 4, | ||
305 | teleportFlags, capsPath); | ||
306 | } | ||
307 | /// | ||
308 | /// Hypergrid mod stop | ||
309 | /// | ||
310 | |||
311 | |||
312 | // TeleportFinish makes the client send CompleteMovementIntoRegion (at the destination), which | ||
313 | // trigers a whole shebang of things there, including MakeRoot. So let's wait for confirmation | ||
314 | // that the client contacted the destination before we send the attachments and close things here. | ||
315 | if (!WaitForCallback(avatar.UUID)) | ||
316 | { | ||
317 | // Client never contacted destination. Let's restore everything back | ||
318 | avatar.ControllingClient.SendTeleportFailed("Problems connecting to destination."); | ||
319 | |||
320 | ResetFromTransit(avatar.UUID); | ||
321 | // Yikes! We should just have a ref to scene here. | ||
322 | avatar.Scene.InformClientOfNeighbours(avatar); | ||
323 | |||
324 | // Finally, kill the agent we just created at the destination. | ||
325 | m_interregionCommsOut.SendCloseAgent(reg.RegionHandle, avatar.UUID); | ||
326 | |||
327 | return; | ||
328 | } | ||
329 | |||
330 | // Can't go back from here | ||
331 | if (KiPrimitive != null) | ||
332 | { | ||
333 | KiPrimitive(avatar.LocalId); | ||
334 | } | ||
335 | |||
336 | avatar.MakeChildAgent(); | ||
337 | |||
338 | // CrossAttachmentsIntoNewRegion is a synchronous call. We shouldn't need to wait after it | ||
339 | avatar.CrossAttachmentsIntoNewRegion(reg.RegionHandle, true); | ||
340 | |||
341 | |||
342 | // Finally, let's close this previously-known-as-root agent, when the jump is outside the view zone | ||
343 | /// | ||
344 | /// Hypergrid mod: extra check for isHyperLink | ||
345 | /// | ||
346 | if (Util.IsOutsideView(oldRegionX, newRegionX, oldRegionY, newRegionY) || isHyperLink) | ||
347 | { | ||
348 | Thread.Sleep(5000); | ||
349 | avatar.Close(); | ||
350 | CloseConnection(avatar.UUID); | ||
351 | } | ||
352 | // if (teleport success) // seems to be always success here | ||
353 | // the user may change their profile information in other region, | ||
354 | // so the userinfo in UserProfileCache is not reliable any more, delete it | ||
355 | if (avatar.Scene.NeedSceneCacheClear(avatar.UUID) || isHyperLink) | ||
356 | { | ||
357 | m_commsProvider.UserProfileCacheService.RemoveUser(avatar.UUID); | ||
358 | m_log.DebugFormat( | ||
359 | "[HGSceneCommService]: User {0} is going to another region, profile cache removed", | ||
360 | avatar.UUID); | ||
361 | } | ||
362 | } | ||
363 | else | ||
364 | { | ||
365 | avatar.ControllingClient.SendTeleportFailed("Remote Region appears to be down"); | ||
366 | } | ||
367 | } | ||
368 | else | ||
369 | { | ||
370 | // TP to a place that doesn't exist (anymore) | ||
371 | // Inform the viewer about that | ||
372 | avatar.ControllingClient.SendTeleportFailed("The region you tried to teleport to doesn't exist anymore"); | ||
373 | |||
374 | // and set the map-tile to '(Offline)' | ||
375 | uint regX, regY; | ||
376 | Utils.LongToUInts(regionHandle, out regX, out regY); | ||
377 | |||
378 | MapBlockData block = new MapBlockData(); | ||
379 | block.X = (ushort)(regX / Constants.RegionSize); | ||
380 | block.Y = (ushort)(regY / Constants.RegionSize); | ||
381 | block.Access = 254; // == not there | ||
382 | |||
383 | List<MapBlockData> blocks = new List<MapBlockData>(); | ||
384 | blocks.Add(block); | ||
385 | avatar.ControllingClient.SendMapBlock(blocks, 0); | ||
386 | } | ||
387 | } | ||
388 | } | ||
389 | |||
390 | } | ||
391 | } | ||
diff --git a/OpenSim/Region/Framework/Scenes/Hypergrid/HGUuidGatherer.cs b/OpenSim/Region/Framework/Scenes/Hypergrid/HGUuidGatherer.cs deleted file mode 100644 index 5d4e7ac..0000000 --- a/OpenSim/Region/Framework/Scenes/Hypergrid/HGUuidGatherer.cs +++ /dev/null | |||
@@ -1,56 +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 | |||
31 | using OpenSim.Framework; | ||
32 | using OpenSim.Services.Interfaces; | ||
33 | using OpenMetaverse; | ||
34 | |||
35 | namespace OpenSim.Region.Framework.Scenes.Hypergrid | ||
36 | { | ||
37 | public class HGUuidGatherer : UuidGatherer | ||
38 | { | ||
39 | protected string m_assetServerURL; | ||
40 | protected HGAssetMapper m_assetMapper; | ||
41 | |||
42 | public HGUuidGatherer(HGAssetMapper assMap, IAssetService assetCache, string assetServerURL) : base(assetCache) | ||
43 | { | ||
44 | m_assetMapper = assMap; | ||
45 | m_assetServerURL = assetServerURL; | ||
46 | } | ||
47 | |||
48 | protected override AssetBase GetAsset(UUID uuid) | ||
49 | { | ||
50 | if (string.Empty == m_assetServerURL) | ||
51 | return m_assetCache.Get(uuid.ToString()); | ||
52 | else | ||
53 | return m_assetMapper.FetchAsset(m_assetServerURL, uuid); | ||
54 | } | ||
55 | } | ||
56 | } | ||
diff --git a/OpenSim/Region/Framework/Scenes/RegionStatsHandler.cs b/OpenSim/Region/Framework/Scenes/RegionStatsHandler.cs index e9660b1..d25d5dd 100644 --- a/OpenSim/Region/Framework/Scenes/RegionStatsHandler.cs +++ b/OpenSim/Region/Framework/Scenes/RegionStatsHandler.cs | |||
@@ -36,8 +36,7 @@ using OpenMetaverse; | |||
36 | using OpenMetaverse.StructuredData; | 36 | using OpenMetaverse.StructuredData; |
37 | using OpenSim.Framework; | 37 | using OpenSim.Framework; |
38 | using OpenSim.Framework.Communications; | 38 | using OpenSim.Framework.Communications; |
39 | using OpenSim.Framework.Communications.Services; | 39 | |
40 | using OpenSim.Framework.Communications.Cache; | ||
41 | using OpenSim.Framework.Console; | 40 | using OpenSim.Framework.Console; |
42 | using OpenSim.Framework.Servers; | 41 | using OpenSim.Framework.Servers; |
43 | using OpenSim.Framework.Servers.HttpServer; | 42 | using OpenSim.Framework.Servers.HttpServer; |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index c6cee75..ded001b 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | |||
@@ -35,7 +35,7 @@ using OpenMetaverse; | |||
35 | using OpenMetaverse.Packets; | 35 | using OpenMetaverse.Packets; |
36 | using log4net; | 36 | using log4net; |
37 | using OpenSim.Framework; | 37 | using OpenSim.Framework; |
38 | using OpenSim.Framework.Communications.Cache; | 38 | |
39 | using OpenSim.Region.Framework; | 39 | using OpenSim.Region.Framework; |
40 | using OpenSim.Region.Framework.Interfaces; | 40 | using OpenSim.Region.Framework.Interfaces; |
41 | using OpenSim.Region.Framework.Scenes.Serialization; | 41 | using OpenSim.Region.Framework.Scenes.Serialization; |
@@ -101,12 +101,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
101 | { | 101 | { |
102 | userlevel = 1; | 102 | userlevel = 1; |
103 | } | 103 | } |
104 | // TODO: remove this cruft once MasterAvatar is fully deprecated | ||
105 | // | ||
106 | if (m_regInfo.MasterAvatarAssignedUUID == AgentID) | ||
107 | { | ||
108 | userlevel = 2; | ||
109 | } | ||
110 | EventManager.TriggerOnNewInventoryItemUploadComplete(AgentID, item.AssetID, item.Name, userlevel); | 104 | EventManager.TriggerOnNewInventoryItemUploadComplete(AgentID, item.AssetID, item.Name, userlevel); |
111 | } | 105 | } |
112 | else | 106 | else |
@@ -132,61 +126,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
132 | } | 126 | } |
133 | 127 | ||
134 | /// <summary> | 128 | /// <summary> |
135 | /// Capability originating call to update the asset of an item in an agent's inventory | ||
136 | /// </summary> | ||
137 | /// <param name="remoteClient"></param> | ||
138 | /// <param name="itemID"></param> | ||
139 | /// <param name="data"></param> | ||
140 | /// <returns></returns> | ||
141 | public virtual UUID CapsUpdateInventoryItemAsset(IClientAPI remoteClient, UUID itemID, byte[] data) | ||
142 | { | ||
143 | InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId); | ||
144 | item = InventoryService.GetItem(item); | ||
145 | |||
146 | if (item != null) | ||
147 | { | ||
148 | if ((InventoryType)item.InvType == InventoryType.Notecard) | ||
149 | { | ||
150 | if (!Permissions.CanEditNotecard(itemID, UUID.Zero, remoteClient.AgentId)) | ||
151 | { | ||
152 | remoteClient.SendAgentAlertMessage("Insufficient permissions to edit notecard", false); | ||
153 | return UUID.Zero; | ||
154 | } | ||
155 | |||
156 | remoteClient.SendAgentAlertMessage("Notecard saved", false); | ||
157 | } | ||
158 | else if ((InventoryType)item.InvType == InventoryType.LSL) | ||
159 | { | ||
160 | if (!Permissions.CanEditScript(itemID, UUID.Zero, remoteClient.AgentId)) | ||
161 | { | ||
162 | remoteClient.SendAgentAlertMessage("Insufficient permissions to edit script", false); | ||
163 | return UUID.Zero; | ||
164 | } | ||
165 | |||
166 | remoteClient.SendAgentAlertMessage("Script saved", false); | ||
167 | } | ||
168 | |||
169 | AssetBase asset = | ||
170 | CreateAsset(item.Name, item.Description, (sbyte)item.AssetType, data); | ||
171 | item.AssetID = asset.FullID; | ||
172 | AssetService.Store(asset); | ||
173 | |||
174 | InventoryService.UpdateItem(item); | ||
175 | |||
176 | // remoteClient.SendInventoryItemCreateUpdate(item); | ||
177 | return (asset.FullID); | ||
178 | } | ||
179 | else | ||
180 | { | ||
181 | m_log.ErrorFormat( | ||
182 | "[AGENT INVENTORY]: Could not find item {0} for caps inventory update", | ||
183 | itemID); | ||
184 | } | ||
185 | |||
186 | return UUID.Zero; | ||
187 | } | ||
188 | |||
189 | /// <summary> | ||
190 | /// <see>CapsUpdatedInventoryItemAsset(IClientAPI, UUID, byte[])</see> | 129 | /// <see>CapsUpdatedInventoryItemAsset(IClientAPI, UUID, byte[])</see> |
191 | /// </summary> | 130 | /// </summary> |
192 | public UUID CapsUpdateInventoryItemAsset(UUID avatarId, UUID itemID, byte[] data) | 131 | public UUID CapsUpdateInventoryItemAsset(UUID avatarId, UUID itemID, byte[] data) |
@@ -195,7 +134,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
195 | 134 | ||
196 | if (TryGetAvatar(avatarId, out avatar)) | 135 | if (TryGetAvatar(avatarId, out avatar)) |
197 | { | 136 | { |
198 | return CapsUpdateInventoryItemAsset(avatar.ControllingClient, itemID, data); | 137 | IInventoryAccessModule invAccess = RequestModuleInterface<IInventoryAccessModule>(); |
138 | if (invAccess != null) | ||
139 | return invAccess.CapsUpdateInventoryItemAsset(avatar.ControllingClient, itemID, data); | ||
199 | } | 140 | } |
200 | else | 141 | else |
201 | { | 142 | { |
@@ -478,7 +419,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
478 | itemCopy.SaleType = item.SaleType; | 419 | itemCopy.SaleType = item.SaleType; |
479 | 420 | ||
480 | if (InventoryService.AddItem(itemCopy)) | 421 | if (InventoryService.AddItem(itemCopy)) |
481 | TransferInventoryAssets(itemCopy, senderId, recipient); | 422 | { |
423 | IInventoryAccessModule invAccess = RequestModuleInterface<IInventoryAccessModule>(); | ||
424 | if (invAccess != null) | ||
425 | invAccess.TransferInventoryAssets(itemCopy, senderId, recipient); | ||
426 | } | ||
482 | 427 | ||
483 | if (!Permissions.BypassPermissions()) | 428 | if (!Permissions.BypassPermissions()) |
484 | { | 429 | { |
@@ -500,10 +445,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
500 | 445 | ||
501 | } | 446 | } |
502 | 447 | ||
503 | protected virtual void TransferInventoryAssets(InventoryItemBase item, UUID sender, UUID receiver) | ||
504 | { | ||
505 | } | ||
506 | |||
507 | /// <summary> | 448 | /// <summary> |
508 | /// Give an entire inventory folder from one user to another. The entire contents (including all descendent | 449 | /// Give an entire inventory folder from one user to another. The entire contents (including all descendent |
509 | /// folders) is given. | 450 | /// folders) is given. |
@@ -573,7 +514,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
573 | "[AGENT INVENTORY]: CopyInventoryItem received by {0} with oldAgentID {1}, oldItemID {2}, new FolderID {3}, newName {4}", | 514 | "[AGENT INVENTORY]: CopyInventoryItem received by {0} with oldAgentID {1}, oldItemID {2}, new FolderID {3}, newName {4}", |
574 | remoteClient.AgentId, oldAgentID, oldItemID, newFolderID, newName); | 515 | remoteClient.AgentId, oldAgentID, oldItemID, newFolderID, newName); |
575 | 516 | ||
576 | InventoryItemBase item = CommsManager.UserProfileCacheService.LibraryRoot.FindItem(oldItemID); | 517 | InventoryItemBase item = null; |
518 | if (LibraryService != null && LibraryService.LibraryRootFolder != null) | ||
519 | item = LibraryService.LibraryRootFolder.FindItem(oldItemID); | ||
577 | 520 | ||
578 | if (item == null) | 521 | if (item == null) |
579 | { | 522 | { |
@@ -745,13 +688,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
745 | 688 | ||
746 | if (transactionID == UUID.Zero) | 689 | if (transactionID == UUID.Zero) |
747 | { | 690 | { |
748 | CachedUserInfo userInfo | 691 | ScenePresence presence; |
749 | = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId); | 692 | if (TryGetAvatar(remoteClient.AgentId, out presence)) |
750 | |||
751 | if (userInfo != null) | ||
752 | { | 693 | { |
753 | ScenePresence presence; | ||
754 | TryGetAvatar(remoteClient.AgentId, out presence); | ||
755 | byte[] data = null; | 694 | byte[] data = null; |
756 | 695 | ||
757 | if (invType == (sbyte)InventoryType.Landmark && presence != null) | 696 | if (invType == (sbyte)InventoryType.Landmark && presence != null) |
@@ -773,7 +712,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
773 | else | 712 | else |
774 | { | 713 | { |
775 | m_log.ErrorFormat( | 714 | m_log.ErrorFormat( |
776 | "userInfo for agent uuid {0} unexpectedly null in CreateNewInventoryItem", | 715 | "ScenePresence for agent uuid {0} unexpectedly not found in CreateNewInventoryItem", |
777 | remoteClient.AgentId); | 716 | remoteClient.AgentId); |
778 | } | 717 | } |
779 | } | 718 | } |
@@ -1166,15 +1105,21 @@ namespace OpenSim.Region.Framework.Scenes | |||
1166 | 1105 | ||
1167 | private void SendInventoryUpdate(IClientAPI client, InventoryFolderBase folder, bool fetchFolders, bool fetchItems) | 1106 | private void SendInventoryUpdate(IClientAPI client, InventoryFolderBase folder, bool fetchFolders, bool fetchItems) |
1168 | { | 1107 | { |
1108 | if (folder == null) | ||
1109 | return; | ||
1110 | |||
1169 | m_log.DebugFormat("[AGENT INVENTORY]: Send Inventory Folder {0} Update to {1} {2}", folder.Name, client.FirstName, client.LastName); | 1111 | m_log.DebugFormat("[AGENT INVENTORY]: Send Inventory Folder {0} Update to {1} {2}", folder.Name, client.FirstName, client.LastName); |
1170 | InventoryCollection contents = InventoryService.GetFolderContent(client.AgentId, folder.ID); | 1112 | InventoryCollection contents = InventoryService.GetFolderContent(client.AgentId, folder.ID); |
1171 | InventoryFolderBase containingFolder = new InventoryFolderBase(); | 1113 | InventoryFolderBase containingFolder = new InventoryFolderBase(); |
1172 | containingFolder.ID = folder.ID; | 1114 | containingFolder.ID = folder.ID; |
1173 | containingFolder.Owner = client.AgentId; | 1115 | containingFolder.Owner = client.AgentId; |
1174 | containingFolder = InventoryService.GetFolder(containingFolder); | 1116 | containingFolder = InventoryService.GetFolder(containingFolder); |
1175 | int version = containingFolder.Version; | 1117 | if (containingFolder != null) |
1118 | { | ||
1119 | int version = containingFolder.Version; | ||
1176 | 1120 | ||
1177 | client.SendInventoryFolderDetails(client.AgentId, folder.ID, contents.Items, contents.Folders, version, fetchFolders, fetchItems); | 1121 | client.SendInventoryFolderDetails(client.AgentId, folder.ID, contents.Items, contents.Folders, version, fetchFolders, fetchItems); |
1122 | } | ||
1178 | } | 1123 | } |
1179 | 1124 | ||
1180 | /// <summary> | 1125 | /// <summary> |
@@ -1216,9 +1161,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
1216 | item = InventoryService.GetItem(item); | 1161 | item = InventoryService.GetItem(item); |
1217 | 1162 | ||
1218 | // Try library | 1163 | // Try library |
1219 | if (null == item) | 1164 | if (null == item && LibraryService != null && LibraryService.LibraryRootFolder != null) |
1220 | { | 1165 | { |
1221 | item = CommsManager.UserProfileCacheService.LibraryRoot.FindItem(itemID); | 1166 | item = LibraryService.LibraryRootFolder.FindItem(itemID); |
1222 | } | 1167 | } |
1223 | 1168 | ||
1224 | if (item != null) | 1169 | if (item != null) |
@@ -1285,9 +1230,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
1285 | 1230 | ||
1286 | // Try library | 1231 | // Try library |
1287 | // XXX clumsy, possibly should be one call | 1232 | // XXX clumsy, possibly should be one call |
1288 | if (null == item) | 1233 | if (null == item && LibraryService != null && LibraryService.LibraryRootFolder != null) |
1289 | { | 1234 | { |
1290 | item = CommsManager.UserProfileCacheService.LibraryRoot.FindItem(itemID); | 1235 | item = LibraryService.LibraryRootFolder.FindItem(itemID); |
1291 | } | 1236 | } |
1292 | 1237 | ||
1293 | if (item != null) | 1238 | if (item != null) |
@@ -1612,232 +1557,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
1612 | } | 1557 | } |
1613 | } | 1558 | } |
1614 | 1559 | ||
1615 | /// <summary> | ||
1616 | /// Delete a scene object from a scene and place in the given avatar's inventory. | ||
1617 | /// Returns the UUID of the newly created asset. | ||
1618 | /// </summary> | ||
1619 | /// <param name="action"></param> | ||
1620 | /// <param name="folderID"></param> | ||
1621 | /// <param name="objectGroup"></param> | ||
1622 | /// <param name="remoteClient"> </param> | ||
1623 | public virtual UUID DeleteToInventory(DeRezAction action, UUID folderID, | ||
1624 | SceneObjectGroup objectGroup, IClientAPI remoteClient) | ||
1625 | { | ||
1626 | UUID assetID = UUID.Zero; | ||
1627 | |||
1628 | Vector3 inventoryStoredPosition = new Vector3 | ||
1629 | (((objectGroup.AbsolutePosition.X > (int)Constants.RegionSize) | ||
1630 | ? 250 | ||
1631 | : objectGroup.AbsolutePosition.X) | ||
1632 | , | ||
1633 | (objectGroup.AbsolutePosition.X > (int)Constants.RegionSize) | ||
1634 | ? 250 | ||
1635 | : objectGroup.AbsolutePosition.X, | ||
1636 | objectGroup.AbsolutePosition.Z); | ||
1637 | |||
1638 | Vector3 originalPosition = objectGroup.AbsolutePosition; | ||
1639 | |||
1640 | objectGroup.AbsolutePosition = inventoryStoredPosition; | ||
1641 | |||
1642 | string sceneObjectXml = SceneObjectSerializer.ToOriginalXmlFormat(objectGroup); | ||
1643 | |||
1644 | objectGroup.AbsolutePosition = originalPosition; | ||
1645 | |||
1646 | // Get the user info of the item destination | ||
1647 | // | ||
1648 | UUID userID = UUID.Zero; | ||
1649 | |||
1650 | if (action == DeRezAction.Take || action == DeRezAction.TakeCopy || | ||
1651 | action == DeRezAction.SaveToExistingUserInventoryItem) | ||
1652 | { | ||
1653 | // Take or take copy require a taker | ||
1654 | // Saving changes requires a local user | ||
1655 | // | ||
1656 | if (remoteClient == null) | ||
1657 | return UUID.Zero; | ||
1658 | |||
1659 | userID = remoteClient.AgentId; | ||
1660 | } | ||
1661 | else | ||
1662 | { | ||
1663 | // All returns / deletes go to the object owner | ||
1664 | // | ||
1665 | |||
1666 | userID = objectGroup.RootPart.OwnerID; | ||
1667 | } | ||
1668 | |||
1669 | if (userID == UUID.Zero) // Can't proceed | ||
1670 | { | ||
1671 | return UUID.Zero; | ||
1672 | } | ||
1673 | |||
1674 | // If we're returning someone's item, it goes back to the | ||
1675 | // owner's Lost And Found folder. | ||
1676 | // Delete is treated like return in this case | ||
1677 | // Deleting your own items makes them go to trash | ||
1678 | // | ||
1679 | |||
1680 | InventoryFolderBase folder = null; | ||
1681 | InventoryItemBase item = null; | ||
1682 | |||
1683 | if (DeRezAction.SaveToExistingUserInventoryItem == action) | ||
1684 | { | ||
1685 | item = new InventoryItemBase(objectGroup.RootPart.FromUserInventoryItemID, userID); | ||
1686 | item = InventoryService.GetItem(item); | ||
1687 | |||
1688 | //item = userInfo.RootFolder.FindItem( | ||
1689 | // objectGroup.RootPart.FromUserInventoryItemID); | ||
1690 | |||
1691 | if (null == item) | ||
1692 | { | ||
1693 | m_log.DebugFormat( | ||
1694 | "[AGENT INVENTORY]: Object {0} {1} scheduled for save to inventory has already been deleted.", | ||
1695 | objectGroup.Name, objectGroup.UUID); | ||
1696 | return UUID.Zero; | ||
1697 | } | ||
1698 | } | ||
1699 | else | ||
1700 | { | ||
1701 | // Folder magic | ||
1702 | // | ||
1703 | if (action == DeRezAction.Delete) | ||
1704 | { | ||
1705 | // Deleting someone else's item | ||
1706 | // | ||
1707 | |||
1708 | |||
1709 | if (remoteClient == null || | ||
1710 | objectGroup.OwnerID != remoteClient.AgentId) | ||
1711 | { | ||
1712 | // Folder skeleton may not be loaded and we | ||
1713 | // have to wait for the inventory to find | ||
1714 | // the destination folder | ||
1715 | // | ||
1716 | folder = InventoryService.GetFolderForType(userID, AssetType.LostAndFoundFolder); | ||
1717 | } | ||
1718 | else | ||
1719 | { | ||
1720 | // Assume inventory skeleton was loaded during login | ||
1721 | // and all folders can be found | ||
1722 | // | ||
1723 | folder = InventoryService.GetFolderForType(userID, AssetType.TrashFolder); | ||
1724 | } | ||
1725 | } | ||
1726 | else if (action == DeRezAction.Return) | ||
1727 | { | ||
1728 | |||
1729 | // Dump to lost + found unconditionally | ||
1730 | // | ||
1731 | folder = InventoryService.GetFolderForType(userID, AssetType.LostAndFoundFolder); | ||
1732 | } | ||
1733 | |||
1734 | if (folderID == UUID.Zero && folder == null) | ||
1735 | { | ||
1736 | if (action == DeRezAction.Delete) | ||
1737 | { | ||
1738 | // Deletes go to trash by default | ||
1739 | // | ||
1740 | folder = InventoryService.GetFolderForType(userID, AssetType.TrashFolder); | ||
1741 | } | ||
1742 | else | ||
1743 | { | ||
1744 | // Catch all. Use lost & found | ||
1745 | // | ||
1746 | |||
1747 | folder = InventoryService.GetFolderForType(userID, AssetType.LostAndFoundFolder); | ||
1748 | } | ||
1749 | } | ||
1750 | |||
1751 | if (folder == null) // None of the above | ||
1752 | { | ||
1753 | //folder = userInfo.RootFolder.FindFolder(folderID); | ||
1754 | folder = new InventoryFolderBase(folderID); | ||
1755 | |||
1756 | if (folder == null) // Nowhere to put it | ||
1757 | { | ||
1758 | return UUID.Zero; | ||
1759 | } | ||
1760 | } | ||
1761 | |||
1762 | item = new InventoryItemBase(); | ||
1763 | item.CreatorId = objectGroup.RootPart.CreatorID.ToString(); | ||
1764 | item.ID = UUID.Random(); | ||
1765 | item.InvType = (int)InventoryType.Object; | ||
1766 | item.Folder = folder.ID; | ||
1767 | item.Owner = userID; | ||
1768 | } | ||
1769 | |||
1770 | AssetBase asset = CreateAsset( | ||
1771 | objectGroup.GetPartName(objectGroup.RootPart.LocalId), | ||
1772 | objectGroup.GetPartDescription(objectGroup.RootPart.LocalId), | ||
1773 | (sbyte)AssetType.Object, | ||
1774 | Utils.StringToBytes(sceneObjectXml)); | ||
1775 | AssetService.Store(asset); | ||
1776 | assetID = asset.FullID; | ||
1777 | |||
1778 | if (DeRezAction.SaveToExistingUserInventoryItem == action) | ||
1779 | { | ||
1780 | item.AssetID = asset.FullID; | ||
1781 | InventoryService.UpdateItem(item); | ||
1782 | } | ||
1783 | else | ||
1784 | { | ||
1785 | item.AssetID = asset.FullID; | ||
1786 | |||
1787 | if (remoteClient != null && (remoteClient.AgentId != objectGroup.RootPart.OwnerID) && Permissions.PropagatePermissions()) | ||
1788 | { | ||
1789 | uint perms=objectGroup.GetEffectivePermissions(); | ||
1790 | uint nextPerms=(perms & 7) << 13; | ||
1791 | if ((nextPerms & (uint)PermissionMask.Copy) == 0) | ||
1792 | perms &= ~(uint)PermissionMask.Copy; | ||
1793 | if ((nextPerms & (uint)PermissionMask.Transfer) == 0) | ||
1794 | perms &= ~(uint)PermissionMask.Transfer; | ||
1795 | if ((nextPerms & (uint)PermissionMask.Modify) == 0) | ||
1796 | perms &= ~(uint)PermissionMask.Modify; | ||
1797 | |||
1798 | item.BasePermissions = perms & objectGroup.RootPart.NextOwnerMask; | ||
1799 | item.CurrentPermissions = item.BasePermissions; | ||
1800 | item.NextPermissions = objectGroup.RootPart.NextOwnerMask; | ||
1801 | item.EveryOnePermissions = objectGroup.RootPart.EveryoneMask & objectGroup.RootPart.NextOwnerMask; | ||
1802 | item.GroupPermissions = objectGroup.RootPart.GroupMask & objectGroup.RootPart.NextOwnerMask; | ||
1803 | item.CurrentPermissions |= 8; // Slam! | ||
1804 | } | ||
1805 | else | ||
1806 | { | ||
1807 | item.BasePermissions = objectGroup.GetEffectivePermissions(); | ||
1808 | item.CurrentPermissions = objectGroup.GetEffectivePermissions(); | ||
1809 | item.NextPermissions = objectGroup.RootPart.NextOwnerMask; | ||
1810 | item.EveryOnePermissions = objectGroup.RootPart.EveryoneMask; | ||
1811 | item.GroupPermissions = objectGroup.RootPart.GroupMask; | ||
1812 | |||
1813 | item.CurrentPermissions |= 8; // Slam! | ||
1814 | } | ||
1815 | |||
1816 | // TODO: add the new fields (Flags, Sale info, etc) | ||
1817 | item.CreationDate = Util.UnixTimeSinceEpoch(); | ||
1818 | item.Description = asset.Description; | ||
1819 | item.Name = asset.Name; | ||
1820 | item.AssetType = asset.Type; | ||
1821 | |||
1822 | InventoryService.AddItem(item); | ||
1823 | |||
1824 | if (remoteClient != null && item.Owner == remoteClient.AgentId) | ||
1825 | { | ||
1826 | remoteClient.SendInventoryItemCreateUpdate(item, 0); | ||
1827 | } | ||
1828 | else | ||
1829 | { | ||
1830 | ScenePresence notifyUser = GetScenePresence(item.Owner); | ||
1831 | if (notifyUser != null) | ||
1832 | { | ||
1833 | notifyUser.ControllingClient.SendInventoryItemCreateUpdate(item, 0); | ||
1834 | } | ||
1835 | } | ||
1836 | } | ||
1837 | |||
1838 | return assetID; | ||
1839 | } | ||
1840 | |||
1841 | public void UpdateKnownItem(IClientAPI remoteClient, SceneObjectGroup grp, UUID itemID, UUID agentID) | 1560 | public void UpdateKnownItem(IClientAPI remoteClient, SceneObjectGroup grp, UUID itemID, UUID agentID) |
1842 | { | 1561 | { |
1843 | SceneObjectGroup objectGroup = grp; | 1562 | SceneObjectGroup objectGroup = grp; |
@@ -1978,225 +1697,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
1978 | UUID RayTargetID, byte BypassRayCast, bool RayEndIsIntersection, | 1697 | UUID RayTargetID, byte BypassRayCast, bool RayEndIsIntersection, |
1979 | bool RezSelected, bool RemoveItem, UUID fromTaskID) | 1698 | bool RezSelected, bool RemoveItem, UUID fromTaskID) |
1980 | { | 1699 | { |
1981 | RezObject( | 1700 | IInventoryAccessModule invAccess = RequestModuleInterface<IInventoryAccessModule>(); |
1982 | remoteClient, itemID, RayEnd, RayStart, RayTargetID, BypassRayCast, RayEndIsIntersection, | 1701 | if (invAccess != null) |
1983 | RezSelected, RemoveItem, fromTaskID, false); | 1702 | invAccess.RezObject( |
1984 | } | 1703 | remoteClient, itemID, RayEnd, RayStart, RayTargetID, BypassRayCast, RayEndIsIntersection, |
1985 | 1704 | RezSelected, RemoveItem, fromTaskID, false); | |
1986 | /// <summary> | ||
1987 | /// Rez an object into the scene from the user's inventory | ||
1988 | /// </summary> | ||
1989 | /// <param name="remoteClient"></param> | ||
1990 | /// <param name="itemID"></param> | ||
1991 | /// <param name="RayEnd"></param> | ||
1992 | /// <param name="RayStart"></param> | ||
1993 | /// <param name="RayTargetID"></param> | ||
1994 | /// <param name="BypassRayCast"></param> | ||
1995 | /// <param name="RayEndIsIntersection"></param> | ||
1996 | /// <param name="RezSelected"></param> | ||
1997 | /// <param name="RemoveItem"></param> | ||
1998 | /// <param name="fromTaskID"></param> | ||
1999 | /// <param name="attachment"></param> | ||
2000 | /// <returns>The SceneObjectGroup rezzed or null if rez was unsuccessful.</returns> | ||
2001 | public virtual SceneObjectGroup RezObject(IClientAPI remoteClient, UUID itemID, Vector3 RayEnd, Vector3 RayStart, | ||
2002 | UUID RayTargetID, byte BypassRayCast, bool RayEndIsIntersection, | ||
2003 | bool RezSelected, bool RemoveItem, UUID fromTaskID, bool attachment) | ||
2004 | { | ||
2005 | // Work out position details | ||
2006 | byte bRayEndIsIntersection = (byte)0; | ||
2007 | |||
2008 | if (RayEndIsIntersection) | ||
2009 | { | ||
2010 | bRayEndIsIntersection = (byte)1; | ||
2011 | } | ||
2012 | else | ||
2013 | { | ||
2014 | bRayEndIsIntersection = (byte)0; | ||
2015 | } | ||
2016 | |||
2017 | Vector3 scale = new Vector3(0.5f, 0.5f, 0.5f); | ||
2018 | |||
2019 | |||
2020 | Vector3 pos = GetNewRezLocation( | ||
2021 | RayStart, RayEnd, RayTargetID, Quaternion.Identity, | ||
2022 | BypassRayCast, bRayEndIsIntersection,true,scale, false); | ||
2023 | |||
2024 | // Rez object | ||
2025 | InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId); | ||
2026 | item = InventoryService.GetItem(item); | ||
2027 | |||
2028 | if (item != null) | ||
2029 | { | ||
2030 | AssetBase rezAsset = AssetService.Get(item.AssetID.ToString()); | ||
2031 | |||
2032 | if (rezAsset != null) | ||
2033 | { | ||
2034 | UUID itemId = UUID.Zero; | ||
2035 | |||
2036 | // If we have permission to copy then link the rezzed object back to the user inventory | ||
2037 | // item that it came from. This allows us to enable 'save object to inventory' | ||
2038 | if (!Permissions.BypassPermissions()) | ||
2039 | { | ||
2040 | if ((item.CurrentPermissions & (uint)PermissionMask.Copy) == (uint)PermissionMask.Copy) | ||
2041 | { | ||
2042 | itemId = item.ID; | ||
2043 | } | ||
2044 | } | ||
2045 | else | ||
2046 | { | ||
2047 | // Brave new fullperm world | ||
2048 | // | ||
2049 | itemId = item.ID; | ||
2050 | } | ||
2051 | |||
2052 | string xmlData = Utils.BytesToString(rezAsset.Data); | ||
2053 | SceneObjectGroup group | ||
2054 | = SceneObjectSerializer.FromOriginalXmlFormat(itemId, xmlData); | ||
2055 | |||
2056 | if (!Permissions.CanRezObject( | ||
2057 | group.Children.Count, remoteClient.AgentId, pos) | ||
2058 | && !attachment) | ||
2059 | { | ||
2060 | // The client operates in no fail mode. It will | ||
2061 | // have already removed the item from the folder | ||
2062 | // if it's no copy. | ||
2063 | // Put it back if it's not an attachment | ||
2064 | // | ||
2065 | if (((item.CurrentPermissions & (uint)PermissionMask.Copy) == 0) && (!attachment)) | ||
2066 | remoteClient.SendBulkUpdateInventory(item); | ||
2067 | return null; | ||
2068 | } | ||
2069 | |||
2070 | group.ResetIDs(); | ||
2071 | |||
2072 | if (attachment) | ||
2073 | { | ||
2074 | group.RootPart.ObjectFlags |= (uint)PrimFlags.Phantom; | ||
2075 | group.RootPart.IsAttachment = true; | ||
2076 | } | ||
2077 | |||
2078 | AddNewSceneObject(group, true); | ||
2079 | |||
2080 | // m_log.InfoFormat("ray end point for inventory rezz is {0} {1} {2} ", RayEnd.X, RayEnd.Y, RayEnd.Z); | ||
2081 | // if attachment we set it's asset id so object updates can reflect that | ||
2082 | // if not, we set it's position in world. | ||
2083 | if (!attachment) | ||
2084 | { | ||
2085 | float offsetHeight = 0; | ||
2086 | pos = GetNewRezLocation( | ||
2087 | RayStart, RayEnd, RayTargetID, Quaternion.Identity, | ||
2088 | BypassRayCast, bRayEndIsIntersection, true, group.GetAxisAlignedBoundingBox(out offsetHeight), false); | ||
2089 | pos.Z += offsetHeight; | ||
2090 | group.AbsolutePosition = pos; | ||
2091 | // m_log.InfoFormat("rezx point for inventory rezz is {0} {1} {2} and offsetheight was {3}", pos.X, pos.Y, pos.Z, offsetHeight); | ||
2092 | |||
2093 | } | ||
2094 | else | ||
2095 | { | ||
2096 | group.SetFromItemID(itemID); | ||
2097 | } | ||
2098 | |||
2099 | SceneObjectPart rootPart = null; | ||
2100 | try | ||
2101 | { | ||
2102 | rootPart = group.GetChildPart(group.UUID); | ||
2103 | } | ||
2104 | catch (NullReferenceException) | ||
2105 | { | ||
2106 | string isAttachment = ""; | ||
2107 | |||
2108 | if (attachment) | ||
2109 | isAttachment = " Object was an attachment"; | ||
2110 | |||
2111 | m_log.Error("[AGENT INVENTORY]: Error rezzing ItemID: " + itemID + " object has no rootpart." + isAttachment); | ||
2112 | } | ||
2113 | |||
2114 | // Since renaming the item in the inventory does not affect the name stored | ||
2115 | // in the serialization, transfer the correct name from the inventory to the | ||
2116 | // object itself before we rez. | ||
2117 | rootPart.Name = item.Name; | ||
2118 | rootPart.Description = item.Description; | ||
2119 | |||
2120 | List<SceneObjectPart> partList = new List<SceneObjectPart>(group.Children.Values); | ||
2121 | |||
2122 | group.SetGroup(remoteClient.ActiveGroupId, remoteClient); | ||
2123 | if (rootPart.OwnerID != item.Owner) | ||
2124 | { | ||
2125 | //Need to kill the for sale here | ||
2126 | rootPart.ObjectSaleType = 0; | ||
2127 | rootPart.SalePrice = 10; | ||
2128 | |||
2129 | if (Permissions.PropagatePermissions()) | ||
2130 | { | ||
2131 | if ((item.CurrentPermissions & 8) != 0) | ||
2132 | { | ||
2133 | foreach (SceneObjectPart part in partList) | ||
2134 | { | ||
2135 | part.EveryoneMask = item.EveryOnePermissions; | ||
2136 | part.NextOwnerMask = item.NextPermissions; | ||
2137 | part.GroupMask = 0; // DO NOT propagate here | ||
2138 | } | ||
2139 | } | ||
2140 | group.ApplyNextOwnerPermissions(); | ||
2141 | } | ||
2142 | } | ||
2143 | |||
2144 | foreach (SceneObjectPart part in partList) | ||
2145 | { | ||
2146 | if (part.OwnerID != item.Owner) | ||
2147 | { | ||
2148 | part.LastOwnerID = part.OwnerID; | ||
2149 | part.OwnerID = item.Owner; | ||
2150 | part.Inventory.ChangeInventoryOwner(item.Owner); | ||
2151 | } | ||
2152 | else if (((item.CurrentPermissions & 8) != 0) && (!attachment)) // Slam! | ||
2153 | { | ||
2154 | part.EveryoneMask = item.EveryOnePermissions; | ||
2155 | part.NextOwnerMask = item.NextPermissions; | ||
2156 | |||
2157 | part.GroupMask = 0; // DO NOT propagate here | ||
2158 | } | ||
2159 | } | ||
2160 | |||
2161 | rootPart.TrimPermissions(); | ||
2162 | |||
2163 | if (!attachment) | ||
2164 | { | ||
2165 | if (group.RootPart.Shape.PCode == (byte)PCode.Prim) | ||
2166 | { | ||
2167 | group.ClearPartAttachmentData(); | ||
2168 | } | ||
2169 | } | ||
2170 | |||
2171 | if (!attachment) | ||
2172 | { | ||
2173 | // Fire on_rez | ||
2174 | group.CreateScriptInstances(0, true, DefaultScriptEngine, 0); | ||
2175 | |||
2176 | rootPart.ScheduleFullUpdate(); | ||
2177 | } | ||
2178 | |||
2179 | if (!Permissions.BypassPermissions()) | ||
2180 | { | ||
2181 | if ((item.CurrentPermissions & (uint)PermissionMask.Copy) == 0) | ||
2182 | { | ||
2183 | // If this is done on attachments, no | ||
2184 | // copy ones will be lost, so avoid it | ||
2185 | // | ||
2186 | if (!attachment) | ||
2187 | { | ||
2188 | List<UUID> uuids = new List<UUID>(); | ||
2189 | uuids.Add(item.ID); | ||
2190 | InventoryService.DeleteItems(item.Owner, uuids); | ||
2191 | } | ||
2192 | } | ||
2193 | } | ||
2194 | |||
2195 | return rootPart.ParentGroup; | ||
2196 | } | ||
2197 | } | ||
2198 | |||
2199 | return null; | ||
2200 | } | 1705 | } |
2201 | 1706 | ||
2202 | /// <summary> | 1707 | /// <summary> |
@@ -2420,7 +1925,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2420 | // XXYY!! | 1925 | // XXYY!! |
2421 | InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId); | 1926 | InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId); |
2422 | item = InventoryService.GetItem(item); | 1927 | item = InventoryService.GetItem(item); |
2423 | presence.Appearance.SetAttachment((int)AttachmentPt, itemID, item.AssetID /*att.UUID*/); | 1928 | presence.Appearance.SetAttachment((int)AttachmentPt, itemID, item.AssetID /* att.UUID */); |
2424 | 1929 | ||
2425 | if (m_AvatarFactory != null) | 1930 | if (m_AvatarFactory != null) |
2426 | { | 1931 | { |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs index ac04dc7..bc10230 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs | |||
@@ -32,7 +32,7 @@ using OpenMetaverse; | |||
32 | using OpenMetaverse.Packets; | 32 | using OpenMetaverse.Packets; |
33 | using OpenSim.Framework; | 33 | using OpenSim.Framework; |
34 | using OpenSim.Framework.Communications; | 34 | using OpenSim.Framework.Communications; |
35 | using OpenSim.Framework.Communications.Cache; | 35 | using OpenSim.Services.Interfaces; |
36 | 36 | ||
37 | namespace OpenSim.Region.Framework.Scenes | 37 | namespace OpenSim.Region.Framework.Scenes |
38 | { | 38 | { |
@@ -371,14 +371,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
371 | { | 371 | { |
372 | //EventManager.TriggerAvatarPickerRequest(); | 372 | //EventManager.TriggerAvatarPickerRequest(); |
373 | 373 | ||
374 | List<AvatarPickerAvatar> AvatarResponses = new List<AvatarPickerAvatar>(); | 374 | List<UserAccount> accounts = UserAccountService.GetUserAccounts(RegionInfo.ScopeID, query); |
375 | AvatarResponses = m_sceneGridService.GenerateAgentPickerRequestResponse(RequestID, query); | 375 | |
376 | if (accounts == null) | ||
377 | return; | ||
376 | 378 | ||
377 | AvatarPickerReplyPacket replyPacket = (AvatarPickerReplyPacket) PacketPool.Instance.GetPacket(PacketType.AvatarPickerReply); | 379 | AvatarPickerReplyPacket replyPacket = (AvatarPickerReplyPacket) PacketPool.Instance.GetPacket(PacketType.AvatarPickerReply); |
378 | // TODO: don't create new blocks if recycling an old packet | 380 | // TODO: don't create new blocks if recycling an old packet |
379 | 381 | ||
380 | AvatarPickerReplyPacket.DataBlock[] searchData = | 382 | AvatarPickerReplyPacket.DataBlock[] searchData = |
381 | new AvatarPickerReplyPacket.DataBlock[AvatarResponses.Count]; | 383 | new AvatarPickerReplyPacket.DataBlock[accounts.Count]; |
382 | AvatarPickerReplyPacket.AgentDataBlock agentData = new AvatarPickerReplyPacket.AgentDataBlock(); | 384 | AvatarPickerReplyPacket.AgentDataBlock agentData = new AvatarPickerReplyPacket.AgentDataBlock(); |
383 | 385 | ||
384 | agentData.AgentID = avatarID; | 386 | agentData.AgentID = avatarID; |
@@ -387,16 +389,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
387 | //byte[] bytes = new byte[AvatarResponses.Count*32]; | 389 | //byte[] bytes = new byte[AvatarResponses.Count*32]; |
388 | 390 | ||
389 | int i = 0; | 391 | int i = 0; |
390 | foreach (AvatarPickerAvatar item in AvatarResponses) | 392 | foreach (UserAccount item in accounts) |
391 | { | 393 | { |
392 | UUID translatedIDtem = item.AvatarID; | 394 | UUID translatedIDtem = item.PrincipalID; |
393 | searchData[i] = new AvatarPickerReplyPacket.DataBlock(); | 395 | searchData[i] = new AvatarPickerReplyPacket.DataBlock(); |
394 | searchData[i].AvatarID = translatedIDtem; | 396 | searchData[i].AvatarID = translatedIDtem; |
395 | searchData[i].FirstName = Utils.StringToBytes((string) item.firstName); | 397 | searchData[i].FirstName = Utils.StringToBytes((string) item.FirstName); |
396 | searchData[i].LastName = Utils.StringToBytes((string) item.lastName); | 398 | searchData[i].LastName = Utils.StringToBytes((string) item.LastName); |
397 | i++; | 399 | i++; |
398 | } | 400 | } |
399 | if (AvatarResponses.Count == 0) | 401 | if (accounts.Count == 0) |
400 | { | 402 | { |
401 | searchData = new AvatarPickerReplyPacket.DataBlock[0]; | 403 | searchData = new AvatarPickerReplyPacket.DataBlock[0]; |
402 | } | 404 | } |
@@ -455,7 +457,24 @@ namespace OpenSim.Region.Framework.Scenes | |||
455 | } | 457 | } |
456 | ); | 458 | ); |
457 | } | 459 | } |
458 | 460 | ||
461 | public void HandleUUIDNameRequest(UUID uuid, IClientAPI remote_client) | ||
462 | { | ||
463 | if (LibraryService != null && (LibraryService.LibraryRootFolder.Owner == uuid)) | ||
464 | { | ||
465 | remote_client.SendNameReply(uuid, "Mr", "OpenSim"); | ||
466 | } | ||
467 | else | ||
468 | { | ||
469 | string[] names = GetUserNames(uuid); | ||
470 | if (names.Length == 2) | ||
471 | { | ||
472 | remote_client.SendNameReply(uuid, names[0], names[1]); | ||
473 | } | ||
474 | |||
475 | } | ||
476 | } | ||
477 | |||
459 | /// <summary> | 478 | /// <summary> |
460 | /// Handle a fetch inventory request from the client | 479 | /// Handle a fetch inventory request from the client |
461 | /// </summary> | 480 | /// </summary> |
@@ -464,7 +483,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
464 | /// <param name="ownerID"></param> | 483 | /// <param name="ownerID"></param> |
465 | public void HandleFetchInventory(IClientAPI remoteClient, UUID itemID, UUID ownerID) | 484 | public void HandleFetchInventory(IClientAPI remoteClient, UUID itemID, UUID ownerID) |
466 | { | 485 | { |
467 | if (ownerID == CommsManager.UserProfileCacheService.LibraryRoot.Owner) | 486 | if (LibraryService != null && LibraryService.LibraryRootFolder != null && ownerID == LibraryService.LibraryRootFolder.Owner) |
468 | { | 487 | { |
469 | //m_log.Debug("request info for library item"); | 488 | //m_log.Debug("request info for library item"); |
470 | return; | 489 | return; |
@@ -498,13 +517,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
498 | // CachedUserInfo so that this class doesn't have to know the details (and so that multiple libraries, etc. | 517 | // CachedUserInfo so that this class doesn't have to know the details (and so that multiple libraries, etc. |
499 | // can be handled transparently). | 518 | // can be handled transparently). |
500 | InventoryFolderImpl fold = null; | 519 | InventoryFolderImpl fold = null; |
501 | if ((fold = CommsManager.UserProfileCacheService.LibraryRoot.FindFolder(folderID)) != null) | 520 | if (LibraryService != null && LibraryService.LibraryRootFolder != null) |
502 | { | 521 | if ((fold = LibraryService.LibraryRootFolder.FindFolder(folderID)) != null) |
503 | remoteClient.SendInventoryFolderDetails( | 522 | { |
504 | fold.Owner, folderID, fold.RequestListOfItems(), | 523 | remoteClient.SendInventoryFolderDetails( |
505 | fold.RequestListOfFolders(), fold.Version, fetchFolders, fetchItems); | 524 | fold.Owner, folderID, fold.RequestListOfItems(), |
506 | return; | 525 | fold.RequestListOfFolders(), fold.Version, fetchFolders, fetchItems); |
507 | } | 526 | return; |
527 | } | ||
508 | 528 | ||
509 | // We're going to send the reply async, because there may be | 529 | // We're going to send the reply async, because there may be |
510 | // an enormous quantity of packets -- basically the entire inventory! | 530 | // an enormous quantity of packets -- basically the entire inventory! |
@@ -552,15 +572,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
552 | // CachedUserInfo so that this class doesn't have to know the details (and so that multiple libraries, etc. | 572 | // CachedUserInfo so that this class doesn't have to know the details (and so that multiple libraries, etc. |
553 | // can be handled transparently). | 573 | // can be handled transparently). |
554 | InventoryFolderImpl fold; | 574 | InventoryFolderImpl fold; |
555 | if ((fold = CommsManager.UserProfileCacheService.LibraryRoot.FindFolder(folderID)) != null) | 575 | if (LibraryService != null && LibraryService.LibraryRootFolder != null) |
556 | { | 576 | if ((fold = LibraryService.LibraryRootFolder.FindFolder(folderID)) != null) |
557 | version = 0; | 577 | { |
558 | InventoryCollection ret = new InventoryCollection(); | 578 | version = 0; |
559 | ret.Folders = new List<InventoryFolderBase>(); | 579 | InventoryCollection ret = new InventoryCollection(); |
560 | ret.Items = fold.RequestListOfItems(); | 580 | ret.Folders = new List<InventoryFolderBase>(); |
581 | ret.Items = fold.RequestListOfItems(); | ||
561 | 582 | ||
562 | return ret; | 583 | return ret; |
563 | } | 584 | } |
564 | 585 | ||
565 | InventoryCollection contents = new InventoryCollection(); | 586 | InventoryCollection contents = new InventoryCollection(); |
566 | 587 | ||
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 41fd1e1..66f7a1b 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -41,8 +41,7 @@ using OpenMetaverse.Imaging; | |||
41 | using OpenSim.Framework; | 41 | using OpenSim.Framework; |
42 | using OpenSim.Services.Interfaces; | 42 | using OpenSim.Services.Interfaces; |
43 | using OpenSim.Framework.Communications; | 43 | using OpenSim.Framework.Communications; |
44 | using OpenSim.Framework.Communications.Cache; | 44 | |
45 | using OpenSim.Framework.Communications.Clients; | ||
46 | using OpenSim.Framework.Console; | 45 | using OpenSim.Framework.Console; |
47 | using OpenSim.Region.Framework.Interfaces; | 46 | using OpenSim.Region.Framework.Interfaces; |
48 | using OpenSim.Region.Framework.Scenes.Scripting; | 47 | using OpenSim.Region.Framework.Scenes.Scripting; |
@@ -141,7 +140,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
141 | protected ModuleLoader m_moduleLoader; | 140 | protected ModuleLoader m_moduleLoader; |
142 | protected StorageManager m_storageManager; | 141 | protected StorageManager m_storageManager; |
143 | protected AgentCircuitManager m_authenticateHandler; | 142 | protected AgentCircuitManager m_authenticateHandler; |
144 | public CommunicationsManager CommsManager; | ||
145 | 143 | ||
146 | protected SceneCommunicationService m_sceneGridService; | 144 | protected SceneCommunicationService m_sceneGridService; |
147 | public bool LoginsDisabled = true; | 145 | public bool LoginsDisabled = true; |
@@ -189,11 +187,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
189 | { | 187 | { |
190 | m_AuthorizationService = RequestModuleInterface<IAuthorizationService>(); | 188 | m_AuthorizationService = RequestModuleInterface<IAuthorizationService>(); |
191 | 189 | ||
192 | if (m_AuthorizationService == null) | 190 | //if (m_AuthorizationService == null) |
193 | { | 191 | //{ |
194 | // don't throw an exception if no authorization service is set for the time being | 192 | // // don't throw an exception if no authorization service is set for the time being |
195 | m_log.InfoFormat("[SCENE]: No Authorization service is configured"); | 193 | // m_log.InfoFormat("[SCENE]: No Authorization service is configured"); |
196 | } | 194 | //} |
197 | } | 195 | } |
198 | 196 | ||
199 | return m_AuthorizationService; | 197 | return m_AuthorizationService; |
@@ -240,6 +238,73 @@ namespace OpenSim.Region.Framework.Scenes | |||
240 | } | 238 | } |
241 | } | 239 | } |
242 | 240 | ||
241 | protected ILibraryService m_LibraryService; | ||
242 | |||
243 | public ILibraryService LibraryService | ||
244 | { | ||
245 | get | ||
246 | { | ||
247 | if (m_LibraryService == null) | ||
248 | m_LibraryService = RequestModuleInterface<ILibraryService>(); | ||
249 | |||
250 | return m_LibraryService; | ||
251 | } | ||
252 | } | ||
253 | |||
254 | protected ISimulationService m_simulationService; | ||
255 | public ISimulationService SimulationService | ||
256 | { | ||
257 | get | ||
258 | { | ||
259 | if (m_simulationService == null) | ||
260 | m_simulationService = RequestModuleInterface<ISimulationService>(); | ||
261 | return m_simulationService; | ||
262 | } | ||
263 | } | ||
264 | |||
265 | protected IAuthenticationService m_AuthenticationService; | ||
266 | public IAuthenticationService AuthenticationService | ||
267 | { | ||
268 | get | ||
269 | { | ||
270 | if (m_AuthenticationService == null) | ||
271 | m_AuthenticationService = RequestModuleInterface<IAuthenticationService>(); | ||
272 | return m_AuthenticationService; | ||
273 | } | ||
274 | } | ||
275 | |||
276 | protected IPresenceService m_PresenceService; | ||
277 | public IPresenceService PresenceService | ||
278 | { | ||
279 | get | ||
280 | { | ||
281 | if (m_PresenceService == null) | ||
282 | m_PresenceService = RequestModuleInterface<IPresenceService>(); | ||
283 | return m_PresenceService; | ||
284 | } | ||
285 | } | ||
286 | protected IUserAccountService m_UserAccountService; | ||
287 | public IUserAccountService UserAccountService | ||
288 | { | ||
289 | get | ||
290 | { | ||
291 | if (m_UserAccountService == null) | ||
292 | m_UserAccountService = RequestModuleInterface<IUserAccountService>(); | ||
293 | return m_UserAccountService; | ||
294 | } | ||
295 | } | ||
296 | |||
297 | protected OpenSim.Services.Interfaces.IAvatarService m_AvatarService; | ||
298 | public OpenSim.Services.Interfaces.IAvatarService AvatarService | ||
299 | { | ||
300 | get | ||
301 | { | ||
302 | if (m_AvatarService == null) | ||
303 | m_AvatarService = RequestModuleInterface<IAvatarService>(); | ||
304 | return m_AvatarService; | ||
305 | } | ||
306 | } | ||
307 | |||
243 | protected IXMLRPC m_xmlrpcModule; | 308 | protected IXMLRPC m_xmlrpcModule; |
244 | protected IWorldComm m_worldCommModule; | 309 | protected IWorldComm m_worldCommModule; |
245 | protected IAvatarFactory m_AvatarFactory; | 310 | protected IAvatarFactory m_AvatarFactory; |
@@ -249,10 +314,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
249 | } | 314 | } |
250 | protected IConfigSource m_config; | 315 | protected IConfigSource m_config; |
251 | protected IRegionSerialiserModule m_serialiser; | 316 | protected IRegionSerialiserModule m_serialiser; |
252 | protected IInterregionCommsOut m_interregionCommsOut; | ||
253 | protected IInterregionCommsIn m_interregionCommsIn; | ||
254 | protected IDialogModule m_dialogModule; | 317 | protected IDialogModule m_dialogModule; |
255 | protected ITeleportModule m_teleportModule; | 318 | protected IEntityTransferModule m_teleportModule; |
256 | 319 | ||
257 | protected ICapabilitiesModule m_capsModule; | 320 | protected ICapabilitiesModule m_capsModule; |
258 | public ICapabilitiesModule CapsModule | 321 | public ICapabilitiesModule CapsModule |
@@ -483,7 +546,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
483 | #region Constructors | 546 | #region Constructors |
484 | 547 | ||
485 | public Scene(RegionInfo regInfo, AgentCircuitManager authen, | 548 | public Scene(RegionInfo regInfo, AgentCircuitManager authen, |
486 | CommunicationsManager commsMan, SceneCommunicationService sceneGridService, | 549 | SceneCommunicationService sceneGridService, |
487 | StorageManager storeManager, | 550 | StorageManager storeManager, |
488 | ModuleLoader moduleLoader, bool dumpAssetsToFile, bool physicalPrim, | 551 | ModuleLoader moduleLoader, bool dumpAssetsToFile, bool physicalPrim, |
489 | bool SeeIntoRegionFromNeighbor, IConfigSource config, string simulatorVersion) | 552 | bool SeeIntoRegionFromNeighbor, IConfigSource config, string simulatorVersion) |
@@ -519,7 +582,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
519 | m_lastAllocatedLocalId = (uint)(random.NextDouble() * (double)(uint.MaxValue/2))+(uint)(uint.MaxValue/4); | 582 | m_lastAllocatedLocalId = (uint)(random.NextDouble() * (double)(uint.MaxValue/2))+(uint)(uint.MaxValue/4); |
520 | m_moduleLoader = moduleLoader; | 583 | m_moduleLoader = moduleLoader; |
521 | m_authenticateHandler = authen; | 584 | m_authenticateHandler = authen; |
522 | CommsManager = commsMan; | ||
523 | m_sceneGridService = sceneGridService; | 585 | m_sceneGridService = sceneGridService; |
524 | m_storageManager = storeManager; | 586 | m_storageManager = storeManager; |
525 | m_regInfo = regInfo; | 587 | m_regInfo = regInfo; |
@@ -776,6 +838,36 @@ namespace OpenSim.Region.Framework.Scenes | |||
776 | return m_simulatorVersion; | 838 | return m_simulatorVersion; |
777 | } | 839 | } |
778 | 840 | ||
841 | public string[] GetUserNames(UUID uuid) | ||
842 | { | ||
843 | string[] returnstring = new string[0]; | ||
844 | |||
845 | UserAccount account = UserAccountService.GetUserAccount(RegionInfo.ScopeID, uuid); | ||
846 | |||
847 | if (account != null) | ||
848 | { | ||
849 | returnstring = new string[2]; | ||
850 | returnstring[0] = account.FirstName; | ||
851 | returnstring[1] = account.LastName; | ||
852 | } | ||
853 | |||
854 | return returnstring; | ||
855 | } | ||
856 | |||
857 | public string GetUserName(UUID uuid) | ||
858 | { | ||
859 | string[] names = GetUserNames(uuid); | ||
860 | if (names.Length == 2) | ||
861 | { | ||
862 | string firstname = names[0]; | ||
863 | string lastname = names[1]; | ||
864 | |||
865 | return firstname + " " + lastname; | ||
866 | |||
867 | } | ||
868 | return "(hippos)"; | ||
869 | } | ||
870 | |||
779 | /// <summary> | 871 | /// <summary> |
780 | /// Another region is up. | 872 | /// Another region is up. |
781 | /// | 873 | /// |
@@ -809,7 +901,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
809 | regInfo.RegionName = otherRegion.RegionName; | 901 | regInfo.RegionName = otherRegion.RegionName; |
810 | regInfo.ScopeID = otherRegion.ScopeID; | 902 | regInfo.ScopeID = otherRegion.ScopeID; |
811 | regInfo.ExternalHostName = otherRegion.ExternalHostName; | 903 | regInfo.ExternalHostName = otherRegion.ExternalHostName; |
812 | 904 | GridRegion r = new GridRegion(regInfo); | |
813 | try | 905 | try |
814 | { | 906 | { |
815 | ForEachScenePresence(delegate(ScenePresence agent) | 907 | ForEachScenePresence(delegate(ScenePresence agent) |
@@ -823,7 +915,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
823 | List<ulong> old = new List<ulong>(); | 915 | List<ulong> old = new List<ulong>(); |
824 | old.Add(otherRegion.RegionHandle); | 916 | old.Add(otherRegion.RegionHandle); |
825 | agent.DropOldNeighbours(old); | 917 | agent.DropOldNeighbours(old); |
826 | InformClientOfNeighbor(agent, regInfo); | 918 | if (m_teleportModule != null) |
919 | m_teleportModule.EnableChildAgent(agent, r); | ||
827 | } | 920 | } |
828 | } | 921 | } |
829 | ); | 922 | ); |
@@ -971,6 +1064,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
971 | { | 1064 | { |
972 | foreach (RegionInfo region in m_regionRestartNotifyList) | 1065 | foreach (RegionInfo region in m_regionRestartNotifyList) |
973 | { | 1066 | { |
1067 | GridRegion r = new GridRegion(region); | ||
974 | try | 1068 | try |
975 | { | 1069 | { |
976 | ForEachScenePresence(delegate(ScenePresence agent) | 1070 | ForEachScenePresence(delegate(ScenePresence agent) |
@@ -978,9 +1072,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
978 | // If agent is a root agent. | 1072 | // If agent is a root agent. |
979 | if (!agent.IsChildAgent) | 1073 | if (!agent.IsChildAgent) |
980 | { | 1074 | { |
981 | //agent.ControllingClient.new | 1075 | if (m_teleportModule != null) |
982 | //this.CommsManager.InterRegion.InformRegionOfChildAgent(otherRegion.RegionHandle, agent.ControllingClient.RequestClientInfo()); | 1076 | m_teleportModule.EnableChildAgent(agent, r); |
983 | InformClientOfNeighbor(agent, region); | ||
984 | } | 1077 | } |
985 | } | 1078 | } |
986 | ); | 1079 | ); |
@@ -1123,11 +1216,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
1123 | XferManager = RequestModuleInterface<IXfer>(); | 1216 | XferManager = RequestModuleInterface<IXfer>(); |
1124 | m_AvatarFactory = RequestModuleInterface<IAvatarFactory>(); | 1217 | m_AvatarFactory = RequestModuleInterface<IAvatarFactory>(); |
1125 | m_serialiser = RequestModuleInterface<IRegionSerialiserModule>(); | 1218 | m_serialiser = RequestModuleInterface<IRegionSerialiserModule>(); |
1126 | m_interregionCommsOut = RequestModuleInterface<IInterregionCommsOut>(); | ||
1127 | m_interregionCommsIn = RequestModuleInterface<IInterregionCommsIn>(); | ||
1128 | m_dialogModule = RequestModuleInterface<IDialogModule>(); | 1219 | m_dialogModule = RequestModuleInterface<IDialogModule>(); |
1129 | m_capsModule = RequestModuleInterface<ICapabilitiesModule>(); | 1220 | m_capsModule = RequestModuleInterface<ICapabilitiesModule>(); |
1130 | m_teleportModule = RequestModuleInterface<ITeleportModule>(); | 1221 | m_teleportModule = RequestModuleInterface<IEntityTransferModule>(); |
1131 | } | 1222 | } |
1132 | 1223 | ||
1133 | #endregion | 1224 | #endregion |
@@ -1564,7 +1655,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
1564 | GridRegion region = new GridRegion(RegionInfo); | 1655 | GridRegion region = new GridRegion(RegionInfo); |
1565 | string error = GridService.RegisterRegion(RegionInfo.ScopeID, region); | 1656 | string error = GridService.RegisterRegion(RegionInfo.ScopeID, region); |
1566 | if (error != String.Empty) | 1657 | if (error != String.Empty) |
1658 | { | ||
1567 | throw new Exception(error); | 1659 | throw new Exception(error); |
1660 | } | ||
1568 | 1661 | ||
1569 | m_sceneGridService.SetScene(this); | 1662 | m_sceneGridService.SetScene(this); |
1570 | m_sceneGridService.InformNeighborsThatRegionisUp(RequestModuleInterface<INeighbourService>(), RegionInfo); | 1663 | m_sceneGridService.InformNeighborsThatRegionisUp(RequestModuleInterface<INeighbourService>(), RegionInfo); |
@@ -1951,7 +2044,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
1951 | /// Move the given scene object into a new region depending on which region its absolute position has moved | 2044 | /// Move the given scene object into a new region depending on which region its absolute position has moved |
1952 | /// into. | 2045 | /// into. |
1953 | /// | 2046 | /// |
1954 | /// This method locates the new region handle and offsets the prim position for the new region | ||
1955 | /// </summary> | 2047 | /// </summary> |
1956 | /// <param name="attemptedPosition">the attempted out of region position of the scene object</param> | 2048 | /// <param name="attemptedPosition">the attempted out of region position of the scene object</param> |
1957 | /// <param name="grp">the scene object that we're crossing</param> | 2049 | /// <param name="grp">the scene object that we're crossing</param> |
@@ -1993,191 +2085,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
1993 | return; | 2085 | return; |
1994 | } | 2086 | } |
1995 | 2087 | ||
1996 | int thisx = (int)RegionInfo.RegionLocX; | 2088 | if (m_teleportModule != null) |
1997 | int thisy = (int)RegionInfo.RegionLocY; | 2089 | m_teleportModule.Cross(grp, attemptedPosition, silent); |
1998 | Vector3 EastCross = new Vector3(0.1f,0,0); | ||
1999 | Vector3 WestCross = new Vector3(-0.1f, 0, 0); | ||
2000 | Vector3 NorthCross = new Vector3(0, 0.1f, 0); | ||
2001 | Vector3 SouthCross = new Vector3(0, -0.1f, 0); | ||
2002 | |||
2003 | |||
2004 | // use this if no borders were crossed! | ||
2005 | ulong newRegionHandle | ||
2006 | = Util.UIntsToLong((uint)((thisx) * Constants.RegionSize), | ||
2007 | (uint)((thisy) * Constants.RegionSize)); | ||
2008 | |||
2009 | Vector3 pos = attemptedPosition; | ||
2010 | |||
2011 | int changeX = 1; | ||
2012 | int changeY = 1; | ||
2013 | |||
2014 | if (TestBorderCross(attemptedPosition + WestCross, Cardinals.W)) | ||
2015 | { | ||
2016 | if (TestBorderCross(attemptedPosition + SouthCross, Cardinals.S)) | ||
2017 | { | ||
2018 | |||
2019 | Border crossedBorderx = GetCrossedBorder(attemptedPosition + WestCross, Cardinals.W); | ||
2020 | |||
2021 | if (crossedBorderx.BorderLine.Z > 0) | ||
2022 | { | ||
2023 | pos.X = ((pos.X + crossedBorderx.BorderLine.Z)); | ||
2024 | changeX = (int)(crossedBorderx.BorderLine.Z /(int) Constants.RegionSize); | ||
2025 | } | ||
2026 | else | ||
2027 | pos.X = ((pos.X + Constants.RegionSize)); | ||
2028 | |||
2029 | Border crossedBordery = GetCrossedBorder(attemptedPosition + SouthCross, Cardinals.S); | ||
2030 | //(crossedBorderx.BorderLine.Z / (int)Constants.RegionSize) | ||
2031 | |||
2032 | if (crossedBordery.BorderLine.Z > 0) | ||
2033 | { | ||
2034 | pos.Y = ((pos.Y + crossedBordery.BorderLine.Z)); | ||
2035 | changeY = (int)(crossedBordery.BorderLine.Z / (int)Constants.RegionSize); | ||
2036 | } | ||
2037 | else | ||
2038 | pos.Y = ((pos.Y + Constants.RegionSize)); | ||
2039 | |||
2040 | |||
2041 | |||
2042 | newRegionHandle | ||
2043 | = Util.UIntsToLong((uint)((thisx - changeX) * Constants.RegionSize), | ||
2044 | (uint)((thisy - changeY) * Constants.RegionSize)); | ||
2045 | // x - 1 | ||
2046 | // y - 1 | ||
2047 | } | ||
2048 | else if (TestBorderCross(attemptedPosition + NorthCross, Cardinals.N)) | ||
2049 | { | ||
2050 | Border crossedBorderx = GetCrossedBorder(attemptedPosition + WestCross, Cardinals.W); | ||
2051 | |||
2052 | if (crossedBorderx.BorderLine.Z > 0) | ||
2053 | { | ||
2054 | pos.X = ((pos.X + crossedBorderx.BorderLine.Z)); | ||
2055 | changeX = (int)(crossedBorderx.BorderLine.Z / (int)Constants.RegionSize); | ||
2056 | } | ||
2057 | else | ||
2058 | pos.X = ((pos.X + Constants.RegionSize)); | ||
2059 | |||
2060 | |||
2061 | Border crossedBordery = GetCrossedBorder(attemptedPosition + SouthCross, Cardinals.S); | ||
2062 | //(crossedBorderx.BorderLine.Z / (int)Constants.RegionSize) | ||
2063 | |||
2064 | try | ||
2065 | { | ||
2066 | if (crossedBordery.BorderLine.Z > 0) | ||
2067 | { | ||
2068 | pos.Y = ((pos.Y + crossedBordery.BorderLine.Z)); | ||
2069 | changeY = (int)(crossedBordery.BorderLine.Z / (int)Constants.RegionSize); | ||
2070 | } | ||
2071 | else | ||
2072 | pos.Y = ((pos.Y + Constants.RegionSize)); | ||
2073 | |||
2074 | newRegionHandle | ||
2075 | = Util.UIntsToLong((uint)((thisx - changeX) * Constants.RegionSize), | ||
2076 | (uint)((thisy + changeY) * Constants.RegionSize)); | ||
2077 | // x - 1 | ||
2078 | // y + 1 | ||
2079 | } | ||
2080 | catch (Exception ex) | ||
2081 | { | ||
2082 | } | ||
2083 | } | ||
2084 | else | ||
2085 | { | ||
2086 | Border crossedBorderx = GetCrossedBorder(attemptedPosition + WestCross, Cardinals.W); | ||
2087 | |||
2088 | if (crossedBorderx.BorderLine.Z > 0) | ||
2089 | { | ||
2090 | pos.X = ((pos.X + crossedBorderx.BorderLine.Z)); | ||
2091 | changeX = (int)(crossedBorderx.BorderLine.Z / (int)Constants.RegionSize); | ||
2092 | } | ||
2093 | else | ||
2094 | pos.X = ((pos.X + Constants.RegionSize)); | ||
2095 | |||
2096 | newRegionHandle | ||
2097 | = Util.UIntsToLong((uint)((thisx - changeX) * Constants.RegionSize), | ||
2098 | (uint) (thisy*Constants.RegionSize)); | ||
2099 | // x - 1 | ||
2100 | } | ||
2101 | } | ||
2102 | else if (TestBorderCross(attemptedPosition + EastCross, Cardinals.E)) | ||
2103 | { | ||
2104 | if (TestBorderCross(attemptedPosition + SouthCross, Cardinals.S)) | ||
2105 | { | ||
2106 | |||
2107 | pos.X = ((pos.X - Constants.RegionSize)); | ||
2108 | Border crossedBordery = GetCrossedBorder(attemptedPosition + SouthCross, Cardinals.S); | ||
2109 | //(crossedBorderx.BorderLine.Z / (int)Constants.RegionSize) | ||
2110 | |||
2111 | if (crossedBordery.BorderLine.Z > 0) | ||
2112 | { | ||
2113 | pos.Y = ((pos.Y + crossedBordery.BorderLine.Z)); | ||
2114 | changeY = (int)(crossedBordery.BorderLine.Z / (int)Constants.RegionSize); | ||
2115 | } | ||
2116 | else | ||
2117 | pos.Y = ((pos.Y + Constants.RegionSize)); | ||
2118 | |||
2119 | |||
2120 | newRegionHandle | ||
2121 | = Util.UIntsToLong((uint)((thisx + changeX) * Constants.RegionSize), | ||
2122 | (uint)((thisy - changeY) * Constants.RegionSize)); | ||
2123 | // x + 1 | ||
2124 | // y - 1 | ||
2125 | } | ||
2126 | else if (TestBorderCross(attemptedPosition + NorthCross, Cardinals.N)) | ||
2127 | { | ||
2128 | pos.X = ((pos.X - Constants.RegionSize)); | ||
2129 | pos.Y = ((pos.Y - Constants.RegionSize)); | ||
2130 | newRegionHandle | ||
2131 | = Util.UIntsToLong((uint)((thisx + changeX) * Constants.RegionSize), | ||
2132 | (uint)((thisy + changeY) * Constants.RegionSize)); | ||
2133 | // x + 1 | ||
2134 | // y + 1 | ||
2135 | } | ||
2136 | else | ||
2137 | { | ||
2138 | pos.X = ((pos.X - Constants.RegionSize)); | ||
2139 | newRegionHandle | ||
2140 | = Util.UIntsToLong((uint)((thisx + changeX) * Constants.RegionSize), | ||
2141 | (uint) (thisy*Constants.RegionSize)); | ||
2142 | // x + 1 | ||
2143 | } | ||
2144 | } | ||
2145 | else if (TestBorderCross(attemptedPosition + SouthCross, Cardinals.S)) | ||
2146 | { | ||
2147 | Border crossedBordery = GetCrossedBorder(attemptedPosition + SouthCross, Cardinals.S); | ||
2148 | //(crossedBorderx.BorderLine.Z / (int)Constants.RegionSize) | ||
2149 | |||
2150 | if (crossedBordery.BorderLine.Z > 0) | ||
2151 | { | ||
2152 | pos.Y = ((pos.Y + crossedBordery.BorderLine.Z)); | ||
2153 | changeY = (int)(crossedBordery.BorderLine.Z / (int)Constants.RegionSize); | ||
2154 | } | ||
2155 | else | ||
2156 | pos.Y = ((pos.Y + Constants.RegionSize)); | ||
2157 | |||
2158 | newRegionHandle | ||
2159 | = Util.UIntsToLong((uint)(thisx * Constants.RegionSize), (uint)((thisy - changeY) * Constants.RegionSize)); | ||
2160 | // y - 1 | ||
2161 | } | ||
2162 | else if (TestBorderCross(attemptedPosition + NorthCross, Cardinals.N)) | ||
2163 | { | ||
2164 | |||
2165 | pos.Y = ((pos.Y - Constants.RegionSize)); | ||
2166 | newRegionHandle | ||
2167 | = Util.UIntsToLong((uint)(thisx * Constants.RegionSize), (uint)((thisy + changeY) * Constants.RegionSize)); | ||
2168 | // y + 1 | ||
2169 | } | ||
2170 | |||
2171 | // Offset the positions for the new region across the border | ||
2172 | Vector3 oldGroupPosition = grp.RootPart.GroupPosition; | ||
2173 | grp.OffsetForNewRegion(pos); | ||
2174 | |||
2175 | // If we fail to cross the border, then reset the position of the scene object on that border. | ||
2176 | if (!CrossPrimGroupIntoNewRegion(newRegionHandle, grp, silent)) | ||
2177 | { | ||
2178 | grp.OffsetForNewRegion(oldGroupPosition); | ||
2179 | grp.ScheduleGroupForFullUpdate(); | ||
2180 | } | ||
2181 | } | 2090 | } |
2182 | 2091 | ||
2183 | public Border GetCrossedBorder(Vector3 position, Cardinals gridline) | 2092 | public Border GetCrossedBorder(Vector3 position, Cardinals gridline) |
@@ -2361,75 +2270,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
2361 | 2270 | ||
2362 | 2271 | ||
2363 | /// <summary> | 2272 | /// <summary> |
2364 | /// Move the given scene object into a new region | ||
2365 | /// </summary> | ||
2366 | /// <param name="newRegionHandle"></param> | ||
2367 | /// <param name="grp">Scene Object Group that we're crossing</param> | ||
2368 | /// <returns> | ||
2369 | /// true if the crossing itself was successful, false on failure | ||
2370 | /// FIMXE: we still return true if the crossing object was not successfully deleted from the originating region | ||
2371 | /// </returns> | ||
2372 | public bool CrossPrimGroupIntoNewRegion(ulong newRegionHandle, SceneObjectGroup grp, bool silent) | ||
2373 | { | ||
2374 | //m_log.Debug(" >>> CrossPrimGroupIntoNewRegion <<<"); | ||
2375 | |||
2376 | bool successYN = false; | ||
2377 | grp.RootPart.UpdateFlag = 0; | ||
2378 | //int primcrossingXMLmethod = 0; | ||
2379 | |||
2380 | if (newRegionHandle != 0) | ||
2381 | { | ||
2382 | //string objectState = grp.GetStateSnapshot(); | ||
2383 | |||
2384 | //successYN | ||
2385 | // = m_sceneGridService.PrimCrossToNeighboringRegion( | ||
2386 | // newRegionHandle, grp.UUID, m_serialiser.SaveGroupToXml2(grp), primcrossingXMLmethod); | ||
2387 | //if (successYN && (objectState != "") && m_allowScriptCrossings) | ||
2388 | //{ | ||
2389 | // successYN = m_sceneGridService.PrimCrossToNeighboringRegion( | ||
2390 | // newRegionHandle, grp.UUID, objectState, 100); | ||
2391 | //} | ||
2392 | |||
2393 | // And the new channel... | ||
2394 | if (m_interregionCommsOut != null) | ||
2395 | successYN = m_interregionCommsOut.SendCreateObject(newRegionHandle, grp, true); | ||
2396 | |||
2397 | if (successYN) | ||
2398 | { | ||
2399 | // We remove the object here | ||
2400 | try | ||
2401 | { | ||
2402 | DeleteSceneObject(grp, silent); | ||
2403 | } | ||
2404 | catch (Exception e) | ||
2405 | { | ||
2406 | m_log.ErrorFormat( | ||
2407 | "[INTERREGION]: Exception deleting the old object left behind on a border crossing for {0}, {1}", | ||
2408 | grp, e); | ||
2409 | } | ||
2410 | } | ||
2411 | else | ||
2412 | { | ||
2413 | if (!grp.IsDeleted) | ||
2414 | { | ||
2415 | if (grp.RootPart.PhysActor != null) | ||
2416 | { | ||
2417 | grp.RootPart.PhysActor.CrossingFailure(); | ||
2418 | } | ||
2419 | } | ||
2420 | |||
2421 | m_log.ErrorFormat("[INTERREGION]: Prim crossing failed for {0}", grp); | ||
2422 | } | ||
2423 | } | ||
2424 | else | ||
2425 | { | ||
2426 | m_log.Error("[INTERREGION]: region handle was unexpectedly 0 in Scene.CrossPrimGroupIntoNewRegion()"); | ||
2427 | } | ||
2428 | |||
2429 | return successYN; | ||
2430 | } | ||
2431 | |||
2432 | /// <summary> | ||
2433 | /// Called when objects or attachments cross the border between regions. | 2273 | /// Called when objects or attachments cross the border between regions. |
2434 | /// </summary> | 2274 | /// </summary> |
2435 | /// <param name="sog"></param> | 2275 | /// <param name="sog"></param> |
@@ -2501,6 +2341,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
2501 | 2341 | ||
2502 | return false; | 2342 | return false; |
2503 | } | 2343 | } |
2344 | |||
2345 | sceneObject.SetScene(this); | ||
2346 | |||
2504 | // Force allocation of new LocalId | 2347 | // Force allocation of new LocalId |
2505 | // | 2348 | // |
2506 | foreach (SceneObjectPart p in sceneObject.Children.Values) | 2349 | foreach (SceneObjectPart p in sceneObject.Children.Values) |
@@ -2613,6 +2456,37 @@ namespace OpenSim.Region.Framework.Scenes | |||
2613 | { | 2456 | { |
2614 | AgentCircuitData aCircuit = m_authenticateHandler.GetAgentCircuitData(client.CircuitCode); | 2457 | AgentCircuitData aCircuit = m_authenticateHandler.GetAgentCircuitData(client.CircuitCode); |
2615 | 2458 | ||
2459 | // Do the verification here | ||
2460 | System.Net.EndPoint ep = client.GetClientEP(); | ||
2461 | if (aCircuit != null) | ||
2462 | { | ||
2463 | if ((aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaLogin) != 0) | ||
2464 | { | ||
2465 | m_log.DebugFormat("[Scene]: Incoming client {0} {1} in region {2} via Login", aCircuit.firstname, aCircuit.lastname, RegionInfo.RegionName); | ||
2466 | IUserAgentVerificationModule userVerification = RequestModuleInterface<IUserAgentVerificationModule>(); | ||
2467 | if (userVerification != null) | ||
2468 | { | ||
2469 | if (!userVerification.VerifyClient(aCircuit, ep.ToString())) | ||
2470 | { | ||
2471 | // uh-oh, this is fishy | ||
2472 | m_log.WarnFormat("[Scene]: Agent {0} with session {1} connecting with unidentified end point {2}. Refusing service.", | ||
2473 | client.AgentId, client.SessionId, ep.ToString()); | ||
2474 | try | ||
2475 | { | ||
2476 | client.Close(); | ||
2477 | } | ||
2478 | catch (Exception e) | ||
2479 | { | ||
2480 | m_log.DebugFormat("[Scene]: Exception while closing aborted client: {0}", e.StackTrace); | ||
2481 | } | ||
2482 | return; | ||
2483 | } | ||
2484 | else | ||
2485 | m_log.DebugFormat("[Scene]: User Client Verification for {0} {1} returned true", aCircuit.firstname, aCircuit.lastname); | ||
2486 | } | ||
2487 | } | ||
2488 | } | ||
2489 | |||
2616 | m_log.Debug("[Scene] Adding new agent " + client.Name + " to scene " + RegionInfo.RegionName); | 2490 | m_log.Debug("[Scene] Adding new agent " + client.Name + " to scene " + RegionInfo.RegionName); |
2617 | /* | 2491 | /* |
2618 | string logMsg = string.Format("[SCENE]: Adding new {0} agent for {1} in {2}", | 2492 | string logMsg = string.Format("[SCENE]: Adding new {0} agent for {1} in {2}", |
@@ -2622,9 +2496,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
2622 | m_log.Debug(logMsg); | 2496 | m_log.Debug(logMsg); |
2623 | */ | 2497 | */ |
2624 | 2498 | ||
2625 | CommsManager.UserProfileCacheService.AddNewUser(client.AgentId); | 2499 | //CommsManager.UserProfileCacheService.AddNewUser(client.AgentId); |
2626 | |||
2627 | ScenePresence sp = CreateAndAddScenePresence(client); | 2500 | ScenePresence sp = CreateAndAddScenePresence(client); |
2501 | sp.Appearance = aCircuit.Appearance; | ||
2628 | 2502 | ||
2629 | // HERE!!! Do the initial attachments right here | 2503 | // HERE!!! Do the initial attachments right here |
2630 | // first agent upon login is a root agent by design. | 2504 | // first agent upon login is a root agent by design. |
@@ -2638,6 +2512,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2638 | 2512 | ||
2639 | m_LastLogin = Util.EnvironmentTickCount(); | 2513 | m_LastLogin = Util.EnvironmentTickCount(); |
2640 | EventManager.TriggerOnNewClient(client); | 2514 | EventManager.TriggerOnNewClient(client); |
2515 | |||
2641 | } | 2516 | } |
2642 | 2517 | ||
2643 | 2518 | ||
@@ -2755,7 +2630,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
2755 | { | 2630 | { |
2756 | client.OnTeleportLocationRequest += RequestTeleportLocation; | 2631 | client.OnTeleportLocationRequest += RequestTeleportLocation; |
2757 | client.OnTeleportLandmarkRequest += RequestTeleportLandmark; | 2632 | client.OnTeleportLandmarkRequest += RequestTeleportLandmark; |
2758 | client.OnTeleportHomeRequest += TeleportClientHome; | ||
2759 | } | 2633 | } |
2760 | 2634 | ||
2761 | public virtual void SubscribeToClientScriptEvents(IClientAPI client) | 2635 | public virtual void SubscribeToClientScriptEvents(IClientAPI client) |
@@ -2775,7 +2649,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2775 | 2649 | ||
2776 | public virtual void SubscribeToClientGridEvents(IClientAPI client) | 2650 | public virtual void SubscribeToClientGridEvents(IClientAPI client) |
2777 | { | 2651 | { |
2778 | client.OnNameFromUUIDRequest += CommsManager.HandleUUIDNameRequest; | 2652 | client.OnNameFromUUIDRequest += HandleUUIDNameRequest; |
2779 | client.OnMoneyTransferRequest += ProcessMoneyTransferRequest; | 2653 | client.OnMoneyTransferRequest += ProcessMoneyTransferRequest; |
2780 | client.OnAvatarPickerRequest += ProcessAvatarPickerRequest; | 2654 | client.OnAvatarPickerRequest += ProcessAvatarPickerRequest; |
2781 | client.OnSetStartLocationRequest += SetHomeRezPoint; | 2655 | client.OnSetStartLocationRequest += SetHomeRezPoint; |
@@ -2911,7 +2785,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2911 | { | 2785 | { |
2912 | client.OnTeleportLocationRequest -= RequestTeleportLocation; | 2786 | client.OnTeleportLocationRequest -= RequestTeleportLocation; |
2913 | client.OnTeleportLandmarkRequest -= RequestTeleportLandmark; | 2787 | client.OnTeleportLandmarkRequest -= RequestTeleportLandmark; |
2914 | client.OnTeleportHomeRequest -= TeleportClientHome; | 2788 | //client.OnTeleportHomeRequest -= TeleportClientHome; |
2915 | } | 2789 | } |
2916 | 2790 | ||
2917 | public virtual void UnSubscribeToClientScriptEvents(IClientAPI client) | 2791 | public virtual void UnSubscribeToClientScriptEvents(IClientAPI client) |
@@ -2931,7 +2805,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2931 | 2805 | ||
2932 | public virtual void UnSubscribeToClientGridEvents(IClientAPI client) | 2806 | public virtual void UnSubscribeToClientGridEvents(IClientAPI client) |
2933 | { | 2807 | { |
2934 | client.OnNameFromUUIDRequest -= CommsManager.HandleUUIDNameRequest; | 2808 | client.OnNameFromUUIDRequest -= HandleUUIDNameRequest; |
2935 | client.OnMoneyTransferRequest -= ProcessMoneyTransferRequest; | 2809 | client.OnMoneyTransferRequest -= ProcessMoneyTransferRequest; |
2936 | client.OnAvatarPickerRequest -= ProcessAvatarPickerRequest; | 2810 | client.OnAvatarPickerRequest -= ProcessAvatarPickerRequest; |
2937 | client.OnSetStartLocationRequest -= SetHomeRezPoint; | 2811 | client.OnSetStartLocationRequest -= SetHomeRezPoint; |
@@ -2958,30 +2832,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
2958 | /// <param name="client">The IClientAPI for the client</param> | 2832 | /// <param name="client">The IClientAPI for the client</param> |
2959 | public virtual void TeleportClientHome(UUID agentId, IClientAPI client) | 2833 | public virtual void TeleportClientHome(UUID agentId, IClientAPI client) |
2960 | { | 2834 | { |
2961 | UserProfileData UserProfile = CommsManager.UserService.GetUserProfile(agentId); | 2835 | if (m_teleportModule != null) |
2962 | if (UserProfile != null) | 2836 | m_teleportModule.TeleportHome(agentId, client); |
2837 | else | ||
2963 | { | 2838 | { |
2964 | GridRegion regionInfo = GridService.GetRegionByUUID(UUID.Zero, UserProfile.HomeRegionID); | 2839 | m_log.DebugFormat("[SCENE]: Unable to teleport user home: no AgentTransferModule is active"); |
2965 | if (regionInfo == null) | 2840 | client.SendTeleportFailed("Unable to perform teleports on this simulator."); |
2966 | { | ||
2967 | uint x = 0, y = 0; | ||
2968 | Utils.LongToUInts(UserProfile.HomeRegion, out x, out y); | ||
2969 | regionInfo = GridService.GetRegionByPosition(UUID.Zero, (int)x, (int)y); | ||
2970 | if (regionInfo != null) // home region can be away temporarily, too | ||
2971 | { | ||
2972 | UserProfile.HomeRegionID = regionInfo.RegionID; | ||
2973 | CommsManager.UserService.UpdateUserProfile(UserProfile); | ||
2974 | } | ||
2975 | } | ||
2976 | if (regionInfo == null) | ||
2977 | { | ||
2978 | // can't find the Home region: Tell viewer and abort | ||
2979 | client.SendTeleportFailed("Your home-region could not be found."); | ||
2980 | return; | ||
2981 | } | ||
2982 | RequestTeleportLocation( | ||
2983 | client, regionInfo.RegionHandle, UserProfile.HomeLocation, UserProfile.HomeLookAt, | ||
2984 | (uint)(TPFlags.SetLastToTarget | TPFlags.ViaHome)); | ||
2985 | } | 2841 | } |
2986 | } | 2842 | } |
2987 | 2843 | ||
@@ -3072,7 +2928,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3072 | } | 2928 | } |
3073 | 2929 | ||
3074 | /// <summary> | 2930 | /// <summary> |
3075 | /// Sets the Home Point. The GridService uses this to know where to put a user when they log-in | 2931 | /// Sets the Home Point. The LoginService uses this to know where to put a user when they log-in |
3076 | /// </summary> | 2932 | /// </summary> |
3077 | /// <param name="remoteClient"></param> | 2933 | /// <param name="remoteClient"></param> |
3078 | /// <param name="regionHandle"></param> | 2934 | /// <param name="regionHandle"></param> |
@@ -3081,27 +2937,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
3081 | /// <param name="flags"></param> | 2937 | /// <param name="flags"></param> |
3082 | public virtual void SetHomeRezPoint(IClientAPI remoteClient, ulong regionHandle, Vector3 position, Vector3 lookAt, uint flags) | 2938 | public virtual void SetHomeRezPoint(IClientAPI remoteClient, ulong regionHandle, Vector3 position, Vector3 lookAt, uint flags) |
3083 | { | 2939 | { |
3084 | UserProfileData UserProfile = CommsManager.UserService.GetUserProfile(remoteClient.AgentId); | 2940 | if (PresenceService.SetHomeLocation(remoteClient.AgentId.ToString(), RegionInfo.RegionID, position, lookAt)) |
3085 | if (UserProfile != null) | ||
3086 | { | ||
3087 | // I know I'm ignoring the regionHandle provided by the teleport location request. | ||
3088 | // reusing the TeleportLocationRequest delegate, so regionHandle isn't valid | ||
3089 | UserProfile.HomeRegionID = RegionInfo.RegionID; | ||
3090 | // TODO: The next line can be removed, as soon as only homeRegionID based UserServers are around. | ||
3091 | // TODO: The HomeRegion property can be removed then, too | ||
3092 | UserProfile.HomeRegion = RegionInfo.RegionHandle; | ||
3093 | |||
3094 | UserProfile.HomeLocation = position; | ||
3095 | UserProfile.HomeLookAt = lookAt; | ||
3096 | CommsManager.UserService.UpdateUserProfile(UserProfile); | ||
3097 | |||
3098 | // FUBAR ALERT: this needs to be "Home position set." so the viewer saves a home-screenshot. | 2941 | // FUBAR ALERT: this needs to be "Home position set." so the viewer saves a home-screenshot. |
3099 | m_dialogModule.SendAlertToUser(remoteClient, "Home position set."); | 2942 | m_dialogModule.SendAlertToUser(remoteClient, "Home position set."); |
3100 | } | ||
3101 | else | 2943 | else |
3102 | { | ||
3103 | m_dialogModule.SendAlertToUser(remoteClient, "Set Home request Failed."); | 2944 | m_dialogModule.SendAlertToUser(remoteClient, "Set Home request Failed."); |
3104 | } | ||
3105 | } | 2945 | } |
3106 | 2946 | ||
3107 | /// <summary> | 2947 | /// <summary> |
@@ -3174,14 +3014,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
3174 | m_sceneGraph.removeUserCount(!childagentYN); | 3014 | m_sceneGraph.removeUserCount(!childagentYN); |
3175 | CapsModule.RemoveCapsHandler(agentID); | 3015 | CapsModule.RemoveCapsHandler(agentID); |
3176 | 3016 | ||
3177 | if (avatar.Scene.NeedSceneCacheClear(avatar.UUID)) | 3017 | // REFACTORING PROBLEM -- well not really a problem, but just to point out that whatever |
3178 | { | 3018 | // this method is doing is HORRIBLE!!! |
3179 | CommsManager.UserProfileCacheService.RemoveUser(agentID); | 3019 | avatar.Scene.NeedSceneCacheClear(avatar.UUID); |
3180 | } | ||
3181 | 3020 | ||
3182 | if (!avatar.IsChildAgent) | 3021 | if (!avatar.IsChildAgent) |
3183 | { | 3022 | { |
3184 | m_sceneGridService.LogOffUser(agentID, RegionInfo.RegionID, RegionInfo.RegionHandle, avatar.AbsolutePosition, avatar.Lookat); | ||
3185 | //List<ulong> childknownRegions = new List<ulong>(); | 3023 | //List<ulong> childknownRegions = new List<ulong>(); |
3186 | //List<ulong> ckn = avatar.KnownChildRegionHandles; | 3024 | //List<ulong> ckn = avatar.KnownChildRegionHandles; |
3187 | //for (int i = 0; i < ckn.Count; i++) | 3025 | //for (int i = 0; i < ckn.Count; i++) |
@@ -3236,12 +3074,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
3236 | m_log.Error("[SCENE] Scene.cs:RemoveClient exception: " + e.ToString()); | 3074 | m_log.Error("[SCENE] Scene.cs:RemoveClient exception: " + e.ToString()); |
3237 | } | 3075 | } |
3238 | 3076 | ||
3239 | // Remove client agent from profile, so new logins will work | ||
3240 | if (!childagentYN) | ||
3241 | { | ||
3242 | m_sceneGridService.ClearUserAgent(agentID); | ||
3243 | } | ||
3244 | |||
3245 | m_authenticateHandler.RemoveCircuit(avatar.ControllingClient.CircuitCode); | 3077 | m_authenticateHandler.RemoveCircuit(avatar.ControllingClient.CircuitCode); |
3246 | 3078 | ||
3247 | //m_log.InfoFormat("[SCENE] Memory pre GC {0}", System.GC.GetTotalMemory(false)); | 3079 | //m_log.InfoFormat("[SCENE] Memory pre GC {0}", System.GC.GetTotalMemory(false)); |
@@ -3315,14 +3147,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
3315 | m_sceneGridService.KiPrimitive += SendKillObject; | 3147 | m_sceneGridService.KiPrimitive += SendKillObject; |
3316 | m_sceneGridService.OnGetLandData += GetLandData; | 3148 | m_sceneGridService.OnGetLandData += GetLandData; |
3317 | 3149 | ||
3318 | if (m_interregionCommsIn != null) | ||
3319 | { | ||
3320 | m_log.Debug("[SCENE]: Registering with InterregionCommsIn"); | ||
3321 | m_interregionCommsIn.OnChildAgentUpdate += IncomingChildAgentDataUpdate; | ||
3322 | } | ||
3323 | else | ||
3324 | m_log.Debug("[SCENE]: Unable to register with InterregionCommsIn"); | ||
3325 | |||
3326 | } | 3150 | } |
3327 | 3151 | ||
3328 | /// <summary> | 3152 | /// <summary> |
@@ -3340,9 +3164,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
3340 | m_sceneGridService.OnCloseAgentConnection -= IncomingCloseAgent; | 3164 | m_sceneGridService.OnCloseAgentConnection -= IncomingCloseAgent; |
3341 | m_sceneGridService.OnGetLandData -= GetLandData; | 3165 | m_sceneGridService.OnGetLandData -= GetLandData; |
3342 | 3166 | ||
3343 | if (m_interregionCommsIn != null) | ||
3344 | m_interregionCommsIn.OnChildAgentUpdate -= IncomingChildAgentDataUpdate; | ||
3345 | |||
3346 | // this does nothing; should be removed | 3167 | // this does nothing; should be removed |
3347 | m_sceneGridService.Close(); | 3168 | m_sceneGridService.Close(); |
3348 | 3169 | ||
@@ -3399,7 +3220,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3399 | agent.AgentID, agent.circuitcode, teleportFlags); | 3220 | agent.AgentID, agent.circuitcode, teleportFlags); |
3400 | 3221 | ||
3401 | reason = String.Empty; | 3222 | reason = String.Empty; |
3402 | if (!AuthenticateUser(agent, out reason)) | 3223 | if (!VerifyUserPresence(agent, out reason)) |
3403 | return false; | 3224 | return false; |
3404 | 3225 | ||
3405 | if (!AuthorizeUser(agent, out reason)) | 3226 | if (!AuthorizeUser(agent, out reason)) |
@@ -3494,40 +3315,39 @@ namespace OpenSim.Region.Framework.Scenes | |||
3494 | } | 3315 | } |
3495 | } | 3316 | } |
3496 | 3317 | ||
3318 | agent.teleportFlags = teleportFlags; | ||
3497 | m_authenticateHandler.AddNewCircuit(agent.circuitcode, agent); | 3319 | m_authenticateHandler.AddNewCircuit(agent.circuitcode, agent); |
3498 | 3320 | ||
3499 | // rewrite session_id | ||
3500 | CachedUserInfo userinfo = CommsManager.UserProfileCacheService.GetUserDetails(agent.AgentID); | ||
3501 | if (userinfo != null) | ||
3502 | { | ||
3503 | userinfo.SessionID = agent.SessionID; | ||
3504 | } | ||
3505 | else | ||
3506 | { | ||
3507 | m_log.WarnFormat( | ||
3508 | "[CONNECTION BEGIN]: We couldn't find a User Info record for {0}. This is usually an indication that the UUID we're looking up is invalid", agent.AgentID); | ||
3509 | } | ||
3510 | |||
3511 | return true; | 3321 | return true; |
3512 | } | 3322 | } |
3513 | 3323 | ||
3514 | /// <summary> | 3324 | /// <summary> |
3515 | /// Verifies that the user has a session on the Grid | 3325 | /// Verifies that the user has a presence on the Grid |
3516 | /// </summary> | 3326 | /// </summary> |
3517 | /// <param name="agent">Circuit Data of the Agent we're verifying</param> | 3327 | /// <param name="agent">Circuit Data of the Agent we're verifying</param> |
3518 | /// <param name="reason">Outputs the reason for the false response on this string</param> | 3328 | /// <param name="reason">Outputs the reason for the false response on this string</param> |
3519 | /// <returns>True if the user has a session on the grid. False if it does not. False will | 3329 | /// <returns>True if the user has a session on the grid. False if it does not. False will |
3520 | /// also return a reason.</returns> | 3330 | /// also return a reason.</returns> |
3521 | public virtual bool AuthenticateUser(AgentCircuitData agent, out string reason) | 3331 | public virtual bool VerifyUserPresence(AgentCircuitData agent, out string reason) |
3522 | { | 3332 | { |
3523 | reason = String.Empty; | 3333 | reason = String.Empty; |
3524 | 3334 | ||
3525 | bool result = CommsManager.UserService.VerifySession(agent.AgentID, agent.SessionID); | 3335 | IPresenceService presence = RequestModuleInterface<IPresenceService>(); |
3526 | m_log.Debug("[CONNECTION BEGIN]: User authentication returned " + result); | 3336 | if (presence == null) |
3527 | if (!result) | 3337 | { |
3528 | reason = String.Format("Failed to authenticate user {0} {1}, access denied.", agent.firstname, agent.lastname); | 3338 | reason = String.Format("Failed to verify user {0} {1} in region {2}. Presence service does not exist.", agent.firstname, agent.lastname, RegionInfo.RegionName); |
3339 | return false; | ||
3340 | } | ||
3341 | |||
3342 | OpenSim.Services.Interfaces.PresenceInfo pinfo = presence.GetAgent(agent.SessionID); | ||
3529 | 3343 | ||
3530 | return result; | 3344 | if (pinfo == null || (pinfo != null && pinfo.Online == false)) |
3345 | { | ||
3346 | reason = String.Format("Failed to verify user {0} {1}, access denied to region {2}.", agent.firstname, agent.lastname, RegionInfo.RegionName); | ||
3347 | return false; | ||
3348 | } | ||
3349 | |||
3350 | return true; | ||
3531 | } | 3351 | } |
3532 | 3352 | ||
3533 | /// <summary> | 3353 | /// <summary> |
@@ -3728,8 +3548,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
3728 | /// <returns>true if we handled it.</returns> | 3548 | /// <returns>true if we handled it.</returns> |
3729 | public virtual bool IncomingChildAgentDataUpdate(AgentData cAgentData) | 3549 | public virtual bool IncomingChildAgentDataUpdate(AgentData cAgentData) |
3730 | { | 3550 | { |
3731 | // m_log.DebugFormat( | 3551 | m_log.DebugFormat( |
3732 | // "[SCENE]: Incoming child agent update for {0} in {1}", cAgentData.AgentID, RegionInfo.RegionName); | 3552 | "[SCENE]: Incoming child agent update for {0} in {1}", cAgentData.AgentID, RegionInfo.RegionName); |
3733 | 3553 | ||
3734 | // We have to wait until the viewer contacts this region after receiving EAC. | 3554 | // We have to wait until the viewer contacts this region after receiving EAC. |
3735 | // That calls AddNewClient, which finally creates the ScenePresence | 3555 | // That calls AddNewClient, which finally creates the ScenePresence |
@@ -3798,16 +3618,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
3798 | return false; | 3618 | return false; |
3799 | } | 3619 | } |
3800 | 3620 | ||
3801 | public virtual bool IncomingReleaseAgent(UUID id) | ||
3802 | { | ||
3803 | return m_sceneGridService.ReleaseAgent(id); | ||
3804 | } | ||
3805 | |||
3806 | public void SendReleaseAgent(ulong regionHandle, UUID id, string uri) | ||
3807 | { | ||
3808 | m_interregionCommsOut.SendReleaseAgent(regionHandle, id, uri); | ||
3809 | } | ||
3810 | |||
3811 | /// <summary> | 3621 | /// <summary> |
3812 | /// Tell a single agent to disconnect from the region. | 3622 | /// Tell a single agent to disconnect from the region. |
3813 | /// </summary> | 3623 | /// </summary> |
@@ -3852,30 +3662,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
3852 | } | 3662 | } |
3853 | 3663 | ||
3854 | /// <summary> | 3664 | /// <summary> |
3855 | /// Tell neighboring regions about this agent | ||
3856 | /// When the regions respond with a true value, | ||
3857 | /// tell the agents about the region. | ||
3858 | /// | ||
3859 | /// We have to tell the regions about the agents first otherwise it'll deny them access | ||
3860 | /// | ||
3861 | /// </summary> | ||
3862 | /// <param name="presence"></param> | ||
3863 | public void InformClientOfNeighbours(ScenePresence presence) | ||
3864 | { | ||
3865 | m_sceneGridService.EnableNeighbourChildAgents(presence, m_neighbours); | ||
3866 | } | ||
3867 | |||
3868 | /// <summary> | ||
3869 | /// Tell a neighboring region about this agent | ||
3870 | /// </summary> | ||
3871 | /// <param name="presence"></param> | ||
3872 | /// <param name="region"></param> | ||
3873 | public void InformClientOfNeighbor(ScenePresence presence, RegionInfo region) | ||
3874 | { | ||
3875 | m_sceneGridService.EnableNeighbourChildAgents(presence, m_neighbours); | ||
3876 | } | ||
3877 | |||
3878 | /// <summary> | ||
3879 | /// Tries to teleport agent to other region. | 3665 | /// Tries to teleport agent to other region. |
3880 | /// </summary> | 3666 | /// </summary> |
3881 | /// <param name="remoteClient"></param> | 3667 | /// <param name="remoteClient"></param> |
@@ -3950,16 +3736,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
3950 | } | 3736 | } |
3951 | 3737 | ||
3952 | if (m_teleportModule != null) | 3738 | if (m_teleportModule != null) |
3953 | { | 3739 | m_teleportModule.Teleport(sp, regionHandle, position, lookAt, teleportFlags); |
3954 | m_teleportModule.RequestTeleportToLocation(sp, regionHandle, | ||
3955 | position, lookAt, teleportFlags); | ||
3956 | } | ||
3957 | else | 3740 | else |
3958 | { | 3741 | { |
3959 | m_sceneGridService.RequestTeleportToLocation(sp, regionHandle, | 3742 | m_log.DebugFormat("[SCENE]: Unable to perform teleports: no AgentTransferModule is active"); |
3960 | position, lookAt, teleportFlags); | 3743 | sp.ControllingClient.SendTeleportFailed("Unable to perform teleports on this simulator."); |
3961 | } | 3744 | } |
3962 | |||
3963 | } | 3745 | } |
3964 | } | 3746 | } |
3965 | 3747 | ||
@@ -3985,7 +3767,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
3985 | 3767 | ||
3986 | public void CrossAgentToNewRegion(ScenePresence agent, bool isFlying) | 3768 | public void CrossAgentToNewRegion(ScenePresence agent, bool isFlying) |
3987 | { | 3769 | { |
3988 | m_sceneGridService.CrossAgentToNewRegion(this, agent, isFlying); | 3770 | if (m_teleportModule != null) |
3771 | m_teleportModule.Cross(agent, isFlying); | ||
3772 | else | ||
3773 | { | ||
3774 | m_log.DebugFormat("[SCENE]: Unable to cross agent to neighbouring region, because there is no AgentTransferModule"); | ||
3775 | } | ||
3989 | } | 3776 | } |
3990 | 3777 | ||
3991 | public void SendOutChildAgentUpdates(AgentPosition cadu, ScenePresence presence) | 3778 | public void SendOutChildAgentUpdates(AgentPosition cadu, ScenePresence presence) |
@@ -4011,35 +3798,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
4011 | objectCapacity = objects; | 3798 | objectCapacity = objects; |
4012 | } | 3799 | } |
4013 | 3800 | ||
4014 | public List<FriendListItem> GetFriendList(string id) | ||
4015 | { | ||
4016 | UUID avatarID; | ||
4017 | if (!UUID.TryParse(id, out avatarID)) | ||
4018 | return new List<FriendListItem>(); | ||
4019 | |||
4020 | return CommsManager.GetUserFriendList(avatarID); | ||
4021 | } | ||
4022 | |||
4023 | public Dictionary<UUID, FriendRegionInfo> GetFriendRegionInfos(List<UUID> uuids) | ||
4024 | { | ||
4025 | return CommsManager.GetFriendRegionInfos(uuids); | ||
4026 | } | ||
4027 | |||
4028 | public virtual void StoreAddFriendship(UUID ownerID, UUID friendID, uint perms) | ||
4029 | { | ||
4030 | m_sceneGridService.AddNewUserFriend(ownerID, friendID, perms); | ||
4031 | } | ||
4032 | |||
4033 | public virtual void StoreUpdateFriendship(UUID ownerID, UUID friendID, uint perms) | ||
4034 | { | ||
4035 | m_sceneGridService.UpdateUserFriendPerms(ownerID, friendID, perms); | ||
4036 | } | ||
4037 | |||
4038 | public virtual void StoreRemoveFriendship(UUID ownerID, UUID ExfriendID) | ||
4039 | { | ||
4040 | m_sceneGridService.RemoveUserFriend(ownerID, ExfriendID); | ||
4041 | } | ||
4042 | |||
4043 | #endregion | 3801 | #endregion |
4044 | 3802 | ||
4045 | public void HandleObjectPermissionsUpdate(IClientAPI controller, UUID agentID, UUID sessionID, byte field, uint localId, uint mask, byte set) | 3803 | public void HandleObjectPermissionsUpdate(IClientAPI controller, UUID agentID, UUID sessionID, byte field, uint localId, uint mask, byte set) |
@@ -4955,5 +4713,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
4955 | if (Util.EnvironmentTickCountSubtract(m_lastUpdate) > 2000) | 4713 | if (Util.EnvironmentTickCountSubtract(m_lastUpdate) > 2000) |
4956 | StartTimer(); | 4714 | StartTimer(); |
4957 | } | 4715 | } |
4716 | |||
4717 | public override ISceneObject DeserializeObject(string representation) | ||
4718 | { | ||
4719 | return SceneObjectSerializer.FromXml2Format(representation); | ||
4720 | } | ||
4721 | |||
4722 | public override bool AllowScriptCrossings | ||
4723 | { | ||
4724 | get { return m_allowScriptCrossings; } | ||
4725 | } | ||
4958 | } | 4726 | } |
4959 | } | 4727 | } |
diff --git a/OpenSim/Region/Framework/Scenes/SceneBase.cs b/OpenSim/Region/Framework/Scenes/SceneBase.cs index 5e798c0..4f6e824 100644 --- a/OpenSim/Region/Framework/Scenes/SceneBase.cs +++ b/OpenSim/Region/Framework/Scenes/SceneBase.cs | |||
@@ -34,7 +34,7 @@ using log4net; | |||
34 | using Nini.Config; | 34 | using Nini.Config; |
35 | using OpenSim.Framework; | 35 | using OpenSim.Framework; |
36 | using OpenSim.Framework.Console; | 36 | using OpenSim.Framework.Console; |
37 | using OpenSim.Framework.Communications.Cache; | 37 | |
38 | using OpenSim.Region.Framework.Interfaces; | 38 | using OpenSim.Region.Framework.Interfaces; |
39 | using GridRegion = OpenSim.Services.Interfaces.GridRegion; | 39 | using GridRegion = OpenSim.Services.Interfaces.GridRegion; |
40 | 40 | ||
@@ -510,5 +510,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
510 | 510 | ||
511 | MainConsole.Instance.Commands.AddCommand(modulename, shared, command, shorthelp, longhelp, callback); | 511 | MainConsole.Instance.Commands.AddCommand(modulename, shared, command, shorthelp, longhelp, callback); |
512 | } | 512 | } |
513 | |||
514 | public virtual ISceneObject DeserializeObject(string representation) | ||
515 | { | ||
516 | return null; | ||
517 | } | ||
518 | |||
519 | public virtual bool AllowScriptCrossings | ||
520 | { | ||
521 | get { return false; } | ||
522 | } | ||
523 | |||
513 | } | 524 | } |
514 | } | 525 | } |
diff --git a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs index 2f6a0db..f1813a5 100644 --- a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs +++ b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs | |||
@@ -36,7 +36,6 @@ using log4net; | |||
36 | using OpenSim.Framework; | 36 | using OpenSim.Framework; |
37 | using OpenSim.Framework.Client; | 37 | using OpenSim.Framework.Client; |
38 | using OpenSim.Framework.Communications; | 38 | using OpenSim.Framework.Communications; |
39 | using OpenSim.Framework.Communications.Cache; | ||
40 | using OpenSim.Framework.Capabilities; | 39 | using OpenSim.Framework.Capabilities; |
41 | using OpenSim.Region.Framework.Interfaces; | 40 | using OpenSim.Region.Framework.Interfaces; |
42 | using OpenSim.Services.Interfaces; | 41 | using OpenSim.Services.Interfaces; |
@@ -56,8 +55,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
56 | { | 55 | { |
57 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 56 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
58 | 57 | ||
59 | protected CommunicationsManager m_commsProvider; | ||
60 | protected IInterregionCommsOut m_interregionCommsOut; | ||
61 | protected RegionInfo m_regionInfo; | 58 | protected RegionInfo m_regionInfo; |
62 | protected Scene m_scene; | 59 | protected Scene m_scene; |
63 | 60 | ||
@@ -118,17 +115,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
118 | 115 | ||
119 | public KiPrimitiveDelegate KiPrimitive; | 116 | public KiPrimitiveDelegate KiPrimitive; |
120 | 117 | ||
121 | public SceneCommunicationService(CommunicationsManager commsMan) | 118 | public SceneCommunicationService() |
122 | { | 119 | { |
123 | m_commsProvider = commsMan; | ||
124 | m_agentsInTransit = new List<UUID>(); | ||
125 | } | 120 | } |
126 | 121 | ||
127 | public void SetScene(Scene s) | 122 | public void SetScene(Scene s) |
128 | { | 123 | { |
129 | m_scene = s; | 124 | m_scene = s; |
130 | m_regionInfo = s.RegionInfo; | 125 | m_regionInfo = s.RegionInfo; |
131 | m_interregionCommsOut = m_scene.RequestModuleInterface<IInterregionCommsOut>(); | ||
132 | } | 126 | } |
133 | 127 | ||
134 | /// <summary> | 128 | /// <summary> |
@@ -148,377 +142,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
148 | { | 142 | { |
149 | } | 143 | } |
150 | 144 | ||
151 | #region CommsManager Event handlers | ||
152 | |||
153 | /// <summary> | ||
154 | /// A New User will arrive shortly, Informs the scene that there's a new user on the way | ||
155 | /// </summary> | ||
156 | /// <param name="agent">Data we need to ensure that the agent can connect</param> | ||
157 | /// | ||
158 | protected void NewUserConnection(AgentCircuitData agent) | ||
159 | { | ||
160 | handlerExpectUser = OnExpectUser; | ||
161 | if (handlerExpectUser != null) | ||
162 | { | ||
163 | //m_log.Info("[INTER]: " + debugRegionName + ": SceneCommunicationService: OnExpectUser Fired for User:" + agent.firstname + " " + agent.lastname); | ||
164 | handlerExpectUser(agent); | ||
165 | } | ||
166 | } | ||
167 | |||
168 | /// <summary> | ||
169 | /// The Grid has requested us to log-off the user | ||
170 | /// </summary> | ||
171 | /// <param name="AgentID">Unique ID of agent to log-off</param> | ||
172 | /// <param name="RegionSecret">The secret string that the region establishes with the grid when registering</param> | ||
173 | /// <param name="message">The message to send to the user that tells them why they were logged off</param> | ||
174 | protected void GridLogOffUser(UUID AgentID, UUID RegionSecret, string message) | ||
175 | { | ||
176 | handlerLogOffUser = OnLogOffUser; | ||
177 | if (handlerLogOffUser != null) | ||
178 | { | ||
179 | handlerLogOffUser(AgentID, RegionSecret, message); | ||
180 | } | ||
181 | } | ||
182 | |||
183 | /// <summary> | ||
184 | /// Inform the scene that we've got an update about a child agent that we have | ||
185 | /// </summary> | ||
186 | /// <param name="cAgentData"></param> | ||
187 | /// <returns></returns> | ||
188 | protected bool ChildAgentUpdate(ChildAgentDataUpdate cAgentData) | ||
189 | { | ||
190 | handlerChildAgentUpdate = OnChildAgentUpdate; | ||
191 | if (handlerChildAgentUpdate != null) | ||
192 | handlerChildAgentUpdate(cAgentData); | ||
193 | |||
194 | return true; | ||
195 | } | ||
196 | |||
197 | |||
198 | protected void AgentCrossing(UUID agentID, Vector3 position, bool isFlying) | ||
199 | { | ||
200 | handlerAvatarCrossingIntoRegion = OnAvatarCrossingIntoRegion; | ||
201 | if (handlerAvatarCrossingIntoRegion != null) | ||
202 | { | ||
203 | handlerAvatarCrossingIntoRegion(agentID, position, isFlying); | ||
204 | } | ||
205 | } | ||
206 | |||
207 | protected void PrimCrossing(UUID primID, Vector3 position, bool isPhysical) | ||
208 | { | ||
209 | handlerPrimCrossingIntoRegion = OnPrimCrossingIntoRegion; | ||
210 | if (handlerPrimCrossingIntoRegion != null) | ||
211 | { | ||
212 | handlerPrimCrossingIntoRegion(primID, position, isPhysical); | ||
213 | } | ||
214 | } | ||
215 | |||
216 | protected bool CloseConnection(UUID agentID) | ||
217 | { | ||
218 | m_log.Debug("[INTERREGION]: Incoming Agent Close Request for agent: " + agentID); | ||
219 | |||
220 | handlerCloseAgentConnection = OnCloseAgentConnection; | ||
221 | if (handlerCloseAgentConnection != null) | ||
222 | { | ||
223 | return handlerCloseAgentConnection(agentID); | ||
224 | } | ||
225 | |||
226 | return false; | ||
227 | } | ||
228 | |||
229 | protected LandData FetchLandData(uint x, uint y) | ||
230 | { | ||
231 | handlerGetLandData = OnGetLandData; | ||
232 | if (handlerGetLandData != null) | ||
233 | { | ||
234 | return handlerGetLandData(x, y); | ||
235 | } | ||
236 | return null; | ||
237 | } | ||
238 | |||
239 | #endregion | ||
240 | |||
241 | #region Inform Client of Neighbours | ||
242 | |||
243 | private delegate void InformClientOfNeighbourDelegate( | ||
244 | ScenePresence avatar, AgentCircuitData a, GridRegion reg, IPEndPoint endPoint, bool newAgent); | ||
245 | |||
246 | private void InformClientOfNeighbourCompleted(IAsyncResult iar) | ||
247 | { | ||
248 | InformClientOfNeighbourDelegate icon = (InformClientOfNeighbourDelegate) iar.AsyncState; | ||
249 | icon.EndInvoke(iar); | ||
250 | } | ||
251 | |||
252 | /// <summary> | ||
253 | /// Async component for informing client of which neighbours exist | ||
254 | /// </summary> | ||
255 | /// <remarks> | ||
256 | /// This needs to run asynchronously, as a network timeout may block the thread for a long while | ||
257 | /// </remarks> | ||
258 | /// <param name="remoteClient"></param> | ||
259 | /// <param name="a"></param> | ||
260 | /// <param name="regionHandle"></param> | ||
261 | /// <param name="endPoint"></param> | ||
262 | private void InformClientOfNeighbourAsync(ScenePresence avatar, AgentCircuitData a, GridRegion reg, | ||
263 | IPEndPoint endPoint, bool newAgent) | ||
264 | { | ||
265 | // Let's wait just a little to give time to originating regions to catch up with closing child agents | ||
266 | // after a cross here | ||
267 | Thread.Sleep(500); | ||
268 | |||
269 | uint x, y; | ||
270 | Utils.LongToUInts(reg.RegionHandle, out x, out y); | ||
271 | x = x / Constants.RegionSize; | ||
272 | y = y / Constants.RegionSize; | ||
273 | m_log.Info("[INTERGRID]: Starting to inform client about neighbour " + x + ", " + y + "(" + endPoint.ToString() + ")"); | ||
274 | |||
275 | string capsPath = "http://" + reg.ExternalHostName + ":" + reg.HttpPort | ||
276 | + "/CAPS/" + a.CapsPath + "0000/"; | ||
277 | |||
278 | string reason = String.Empty; | ||
279 | |||
280 | |||
281 | bool regionAccepted = m_interregionCommsOut.SendCreateChildAgent(reg.RegionHandle, a, 0, out reason); | ||
282 | |||
283 | if (regionAccepted && newAgent) | ||
284 | { | ||
285 | IEventQueue eq = avatar.Scene.RequestModuleInterface<IEventQueue>(); | ||
286 | if (eq != null) | ||
287 | { | ||
288 | #region IP Translation for NAT | ||
289 | IClientIPEndpoint ipepClient; | ||
290 | if (avatar.ClientView.TryGet(out ipepClient)) | ||
291 | { | ||
292 | endPoint.Address = NetworkUtil.GetIPFor(ipepClient.EndPoint, endPoint.Address); | ||
293 | } | ||
294 | #endregion | ||
295 | |||
296 | eq.EnableSimulator(reg.RegionHandle, endPoint, avatar.UUID); | ||
297 | eq.EstablishAgentCommunication(avatar.UUID, endPoint, capsPath); | ||
298 | m_log.DebugFormat("[CAPS]: Sending new CAPS seed url {0} to client {1} in region {2}", | ||
299 | capsPath, avatar.UUID, avatar.Scene.RegionInfo.RegionName); | ||
300 | } | ||
301 | else | ||
302 | { | ||
303 | avatar.ControllingClient.InformClientOfNeighbour(reg.RegionHandle, endPoint); | ||
304 | // TODO: make Event Queue disablable! | ||
305 | } | ||
306 | |||
307 | m_log.Info("[INTERGRID]: Completed inform client about neighbour " + endPoint.ToString()); | ||
308 | |||
309 | } | ||
310 | |||
311 | } | ||
312 | |||
313 | public List<GridRegion> RequestNeighbours(Scene pScene, uint pRegionLocX, uint pRegionLocY) | ||
314 | { | ||
315 | Border[] northBorders = pScene.NorthBorders.ToArray(); | ||
316 | Border[] southBorders = pScene.SouthBorders.ToArray(); | ||
317 | Border[] eastBorders = pScene.EastBorders.ToArray(); | ||
318 | Border[] westBorders = pScene.WestBorders.ToArray(); | ||
319 | |||
320 | // Legacy one region. Provided for simplicity while testing the all inclusive method in the else statement. | ||
321 | if (northBorders.Length <= 1 && southBorders.Length <= 1 && eastBorders.Length <= 1 && westBorders.Length <= 1) | ||
322 | { | ||
323 | return m_scene.GridService.GetNeighbours(m_regionInfo.ScopeID, m_regionInfo.RegionID); | ||
324 | } | ||
325 | else | ||
326 | { | ||
327 | Vector2 extent = Vector2.Zero; | ||
328 | for (int i = 0; i < eastBorders.Length; i++) | ||
329 | { | ||
330 | extent.X = (eastBorders[i].BorderLine.Z > extent.X) ? eastBorders[i].BorderLine.Z : extent.X; | ||
331 | } | ||
332 | for (int i = 0; i < northBorders.Length; i++) | ||
333 | { | ||
334 | extent.Y = (northBorders[i].BorderLine.Z > extent.Y) ? northBorders[i].BorderLine.Z : extent.Y; | ||
335 | } | ||
336 | |||
337 | // Loss of fraction on purpose | ||
338 | extent.X = ((int)extent.X / (int)Constants.RegionSize) + 1; | ||
339 | extent.Y = ((int)extent.Y / (int)Constants.RegionSize) + 1; | ||
340 | |||
341 | int startX = (int)(pRegionLocX - 1) * (int)Constants.RegionSize; | ||
342 | int startY = (int)(pRegionLocY - 1) * (int)Constants.RegionSize; | ||
343 | |||
344 | int endX = ((int)pRegionLocX + (int)extent.X) * (int)Constants.RegionSize; | ||
345 | int endY = ((int)pRegionLocY + (int)extent.Y) * (int)Constants.RegionSize; | ||
346 | |||
347 | List<GridRegion> neighbours = m_scene.GridService.GetRegionRange(m_regionInfo.ScopeID, startX, endX, startY, endY); | ||
348 | neighbours.RemoveAll(delegate(GridRegion r) { return r.RegionID == m_regionInfo.RegionID; }); | ||
349 | |||
350 | return neighbours; | ||
351 | } | ||
352 | } | ||
353 | |||
354 | /// <summary> | ||
355 | /// This informs all neighboring regions about agent "avatar". | ||
356 | /// Calls an asynchronous method to do so.. so it doesn't lag the sim. | ||
357 | /// </summary> | ||
358 | public void EnableNeighbourChildAgents(ScenePresence avatar, List<RegionInfo> lstneighbours) | ||
359 | { | ||
360 | List<GridRegion> neighbours = new List<GridRegion>(); | ||
361 | |||
362 | if (m_regionInfo != null) | ||
363 | { | ||
364 | neighbours = RequestNeighbours(avatar.Scene,m_regionInfo.RegionLocX, m_regionInfo.RegionLocY); | ||
365 | } | ||
366 | else | ||
367 | { | ||
368 | m_log.Debug("[ENABLENEIGHBOURCHILDAGENTS]: m_regionInfo was null in EnableNeighbourChildAgents, is this a NPC?"); | ||
369 | } | ||
370 | |||
371 | /// We need to find the difference between the new regions where there are no child agents | ||
372 | /// and the regions where there are already child agents. We only send notification to the former. | ||
373 | List<ulong> neighbourHandles = NeighbourHandles(neighbours); // on this region | ||
374 | neighbourHandles.Add(avatar.Scene.RegionInfo.RegionHandle); // add this region too | ||
375 | List<ulong> previousRegionNeighbourHandles ; | ||
376 | |||
377 | if (avatar.Scene.CapsModule != null) | ||
378 | { | ||
379 | previousRegionNeighbourHandles = | ||
380 | new List<ulong>(avatar.Scene.CapsModule.GetChildrenSeeds(avatar.UUID).Keys); | ||
381 | } | ||
382 | else | ||
383 | { | ||
384 | previousRegionNeighbourHandles = new List<ulong>(); | ||
385 | } | ||
386 | |||
387 | List<ulong> newRegions = NewNeighbours(neighbourHandles, previousRegionNeighbourHandles); | ||
388 | List<ulong> oldRegions = OldNeighbours(neighbourHandles, previousRegionNeighbourHandles); | ||
389 | |||
390 | //Dump("Current Neighbors", neighbourHandles); | ||
391 | //Dump("Previous Neighbours", previousRegionNeighbourHandles); | ||
392 | //Dump("New Neighbours", newRegions); | ||
393 | //Dump("Old Neighbours", oldRegions); | ||
394 | |||
395 | /// Update the scene presence's known regions here on this region | ||
396 | avatar.DropOldNeighbours(oldRegions); | ||
397 | |||
398 | /// Collect as many seeds as possible | ||
399 | Dictionary<ulong, string> seeds; | ||
400 | if (avatar.Scene.CapsModule != null) | ||
401 | seeds | ||
402 | = new Dictionary<ulong, string>(avatar.Scene.CapsModule.GetChildrenSeeds(avatar.UUID)); | ||
403 | else | ||
404 | seeds = new Dictionary<ulong, string>(); | ||
405 | |||
406 | //m_log.Debug(" !!! No. of seeds: " + seeds.Count); | ||
407 | if (!seeds.ContainsKey(avatar.Scene.RegionInfo.RegionHandle)) | ||
408 | seeds.Add(avatar.Scene.RegionInfo.RegionHandle, avatar.ControllingClient.RequestClientInfo().CapsPath); | ||
409 | |||
410 | /// Create the necessary child agents | ||
411 | List<AgentCircuitData> cagents = new List<AgentCircuitData>(); | ||
412 | foreach (GridRegion neighbour in neighbours) | ||
413 | { | ||
414 | if (neighbour.RegionHandle != avatar.Scene.RegionInfo.RegionHandle) | ||
415 | { | ||
416 | |||
417 | AgentCircuitData agent = avatar.ControllingClient.RequestClientInfo(); | ||
418 | agent.BaseFolder = UUID.Zero; | ||
419 | agent.InventoryFolder = UUID.Zero; | ||
420 | agent.startpos = new Vector3(128, 128, 70); | ||
421 | agent.child = true; | ||
422 | |||
423 | if (newRegions.Contains(neighbour.RegionHandle)) | ||
424 | { | ||
425 | agent.CapsPath = CapsUtil.GetRandomCapsObjectPath(); | ||
426 | avatar.AddNeighbourRegion(neighbour.RegionHandle, agent.CapsPath); | ||
427 | seeds.Add(neighbour.RegionHandle, agent.CapsPath); | ||
428 | } | ||
429 | else | ||
430 | agent.CapsPath = avatar.Scene.CapsModule.GetChildSeed(avatar.UUID, neighbour.RegionHandle); | ||
431 | |||
432 | cagents.Add(agent); | ||
433 | } | ||
434 | } | ||
435 | |||
436 | /// Update all child agent with everyone's seeds | ||
437 | foreach (AgentCircuitData a in cagents) | ||
438 | { | ||
439 | a.ChildrenCapSeeds = new Dictionary<ulong, string>(seeds); | ||
440 | } | ||
441 | |||
442 | if (avatar.Scene.CapsModule != null) | ||
443 | { | ||
444 | // These two are the same thing! | ||
445 | avatar.Scene.CapsModule.SetChildrenSeed(avatar.UUID, seeds); | ||
446 | } | ||
447 | avatar.KnownRegions = seeds; | ||
448 | //avatar.Scene.DumpChildrenSeeds(avatar.UUID); | ||
449 | //avatar.DumpKnownRegions(); | ||
450 | |||
451 | bool newAgent = false; | ||
452 | int count = 0; | ||
453 | foreach (GridRegion neighbour in neighbours) | ||
454 | { | ||
455 | // Don't do it if there's already an agent in that region | ||
456 | if (newRegions.Contains(neighbour.RegionHandle)) | ||
457 | newAgent = true; | ||
458 | else | ||
459 | newAgent = false; | ||
460 | |||
461 | if (neighbour.RegionHandle != avatar.Scene.RegionInfo.RegionHandle) | ||
462 | { | ||
463 | InformClientOfNeighbourDelegate d = InformClientOfNeighbourAsync; | ||
464 | try | ||
465 | { | ||
466 | d.BeginInvoke(avatar, cagents[count], neighbour, neighbour.ExternalEndPoint, newAgent, | ||
467 | InformClientOfNeighbourCompleted, | ||
468 | d); | ||
469 | } | ||
470 | |||
471 | catch (ArgumentOutOfRangeException) | ||
472 | { | ||
473 | m_log.ErrorFormat( | ||
474 | "[REGIONINFO]: Neighbour Regions response included the current region in the neighbor list. The following region will not display to the client: {0} for region {1} ({2}, {3}).", | ||
475 | neighbour.ExternalHostName, | ||
476 | neighbour.RegionHandle, | ||
477 | neighbour.RegionLocX, | ||
478 | neighbour.RegionLocY); | ||
479 | } | ||
480 | catch (Exception e) | ||
481 | { | ||
482 | m_log.ErrorFormat( | ||
483 | "[REGIONINFO]: Could not resolve external hostname {0} for region {1} ({2}, {3}). {4}", | ||
484 | neighbour.ExternalHostName, | ||
485 | neighbour.RegionHandle, | ||
486 | neighbour.RegionLocX, | ||
487 | neighbour.RegionLocY, | ||
488 | e); | ||
489 | |||
490 | // FIXME: Okay, even though we've failed, we're still going to throw the exception on, | ||
491 | // since I don't know what will happen if we just let the client continue | ||
492 | |||
493 | // XXX: Well, decided to swallow the exception instead for now. Let us see how that goes. | ||
494 | // throw e; | ||
495 | |||
496 | } | ||
497 | } | ||
498 | count++; | ||
499 | } | ||
500 | } | ||
501 | |||
502 | /// <summary> | ||
503 | /// This informs a single neighboring region about agent "avatar". | ||
504 | /// Calls an asynchronous method to do so.. so it doesn't lag the sim. | ||
505 | /// </summary> | ||
506 | public void InformNeighborChildAgent(ScenePresence avatar, GridRegion region) | ||
507 | { | ||
508 | AgentCircuitData agent = avatar.ControllingClient.RequestClientInfo(); | ||
509 | agent.BaseFolder = UUID.Zero; | ||
510 | agent.InventoryFolder = UUID.Zero; | ||
511 | agent.startpos = new Vector3(128, 128, 70); | ||
512 | agent.child = true; | ||
513 | |||
514 | InformClientOfNeighbourDelegate d = InformClientOfNeighbourAsync; | ||
515 | d.BeginInvoke(avatar, agent, region, region.ExternalEndPoint, true, | ||
516 | InformClientOfNeighbourCompleted, | ||
517 | d); | ||
518 | } | ||
519 | |||
520 | #endregion | ||
521 | |||
522 | public delegate void InformNeighbourThatRegionUpDelegate(INeighbourService nService, RegionInfo region, ulong regionhandle); | 145 | public delegate void InformNeighbourThatRegionUpDelegate(INeighbourService nService, RegionInfo region, ulong regionhandle); |
523 | 146 | ||
524 | private void InformNeighborsThatRegionisUpCompleted(IAsyncResult iar) | 147 | private void InformNeighborsThatRegionisUpCompleted(IAsyncResult iar) |
@@ -592,7 +215,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
592 | try | 215 | try |
593 | { | 216 | { |
594 | //m_commsProvider.InterRegion.ChildAgentUpdate(regionHandle, cAgentData); | 217 | //m_commsProvider.InterRegion.ChildAgentUpdate(regionHandle, cAgentData); |
595 | m_interregionCommsOut.SendChildAgentUpdate(regionHandle, cAgentData); | 218 | uint x = 0, y = 0; |
219 | Utils.LongToUInts(regionHandle, out x, out y); | ||
220 | GridRegion destination = m_scene.GridService.GetRegionByPosition(UUID.Zero, (int)x, (int)y); | ||
221 | m_scene.SimulationService.UpdateAgent(destination, cAgentData); | ||
596 | } | 222 | } |
597 | catch | 223 | catch |
598 | { | 224 | { |
@@ -652,7 +278,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
652 | // let's do our best, but there's not much we can do if the neighbour doesn't accept. | 278 | // let's do our best, but there's not much we can do if the neighbour doesn't accept. |
653 | 279 | ||
654 | //m_commsProvider.InterRegion.TellRegionToCloseChildConnection(regionHandle, agentID); | 280 | //m_commsProvider.InterRegion.TellRegionToCloseChildConnection(regionHandle, agentID); |
655 | m_interregionCommsOut.SendCloseAgent(regionHandle, agentID); | 281 | uint x = 0, y = 0; |
282 | Utils.LongToUInts(regionHandle, out x, out y); | ||
283 | GridRegion destination = m_scene.GridService.GetRegionByPosition(UUID.Zero, (int)x, (int)y); | ||
284 | m_scene.SimulationService.CloseAgent(destination, agentID); | ||
656 | } | 285 | } |
657 | 286 | ||
658 | private void SendCloseChildAgentCompleted(IAsyncResult iar) | 287 | private void SendCloseChildAgentCompleted(IAsyncResult iar) |
@@ -671,822 +300,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
671 | d); | 300 | d); |
672 | } | 301 | } |
673 | } | 302 | } |
674 | 303 | ||
675 | |||
676 | /// <summary> | ||
677 | /// Try to teleport an agent to a new region. | ||
678 | /// </summary> | ||
679 | /// <param name="remoteClient"></param> | ||
680 | /// <param name="RegionHandle"></param> | ||
681 | /// <param name="position"></param> | ||
682 | /// <param name="lookAt"></param> | ||
683 | /// <param name="flags"></param> | ||
684 | public virtual void RequestTeleportToLocation(ScenePresence avatar, ulong regionHandle, Vector3 position, | ||
685 | Vector3 lookAt, uint teleportFlags) | ||
686 | { | ||
687 | if (!avatar.Scene.Permissions.CanTeleport(avatar.UUID)) | ||
688 | return; | ||
689 | |||
690 | bool destRegionUp = true; | ||
691 | |||
692 | IEventQueue eq = avatar.Scene.RequestModuleInterface<IEventQueue>(); | ||
693 | |||
694 | // Reset animations; the viewer does that in teleports. | ||
695 | avatar.Animator.ResetAnimations(); | ||
696 | |||
697 | if (regionHandle == m_regionInfo.RegionHandle) | ||
698 | { | ||
699 | m_log.DebugFormat( | ||
700 | "[SCENE COMMUNICATION SERVICE]: RequestTeleportToLocation {0} within {1}", | ||
701 | position, m_regionInfo.RegionName); | ||
702 | |||
703 | // Teleport within the same region | ||
704 | if (IsOutsideRegion(avatar.Scene, position) || position.Z < 0) | ||
705 | { | ||
706 | Vector3 emergencyPos = new Vector3(128, 128, 128); | ||
707 | |||
708 | m_log.WarnFormat( | ||
709 | "[SCENE COMMUNICATION SERVICE]: RequestTeleportToLocation() was given an illegal position of {0} for avatar {1}, {2}. Substituting {3}", | ||
710 | position, avatar.Name, avatar.UUID, emergencyPos); | ||
711 | position = emergencyPos; | ||
712 | } | ||
713 | |||
714 | // TODO: Get proper AVG Height | ||
715 | float localAVHeight = 1.56f; | ||
716 | float posZLimit = 22; | ||
717 | |||
718 | // TODO: Check other Scene HeightField | ||
719 | if (position.X > 0 && position.X <= (int)Constants.RegionSize && position.Y > 0 && position.Y <=(int)Constants.RegionSize) | ||
720 | { | ||
721 | posZLimit = (float) avatar.Scene.Heightmap[(int) position.X, (int) position.Y]; | ||
722 | } | ||
723 | |||
724 | float newPosZ = posZLimit + localAVHeight; | ||
725 | if (posZLimit >= (position.Z - (localAVHeight / 2)) && !(Single.IsInfinity(newPosZ) || Single.IsNaN(newPosZ))) | ||
726 | { | ||
727 | position.Z = newPosZ; | ||
728 | } | ||
729 | |||
730 | // Only send this if the event queue is null | ||
731 | if (eq == null) | ||
732 | avatar.ControllingClient.SendTeleportLocationStart(); | ||
733 | |||
734 | avatar.ControllingClient.SendLocalTeleport(position, lookAt, teleportFlags); | ||
735 | avatar.Teleport(position); | ||
736 | } | ||
737 | else | ||
738 | { | ||
739 | uint x = 0, y = 0; | ||
740 | Utils.LongToUInts(regionHandle, out x, out y); | ||
741 | GridRegion reg = m_scene.GridService.GetRegionByPosition(m_scene.RegionInfo.ScopeID, (int)x, (int)y); | ||
742 | |||
743 | if (reg != null) | ||
744 | { | ||
745 | m_log.DebugFormat( | ||
746 | "[SCENE COMMUNICATION SERVICE]: RequestTeleportToLocation to {0} in {1}", | ||
747 | position, reg.RegionName); | ||
748 | |||
749 | if (eq == null) | ||
750 | avatar.ControllingClient.SendTeleportLocationStart(); | ||
751 | |||
752 | // Let's do DNS resolution only once in this process, please! | ||
753 | // This may be a costly operation. The reg.ExternalEndPoint field is not a passive field, | ||
754 | // it's actually doing a lot of work. | ||
755 | IPEndPoint endPoint = reg.ExternalEndPoint; | ||
756 | if (endPoint.Address == null) | ||
757 | { | ||
758 | // Couldn't resolve the name. Can't TP, because the viewer wants IP addresses. | ||
759 | destRegionUp = false; | ||
760 | } | ||
761 | |||
762 | if (destRegionUp) | ||
763 | { | ||
764 | uint newRegionX = (uint)(reg.RegionHandle >> 40); | ||
765 | uint newRegionY = (((uint)(reg.RegionHandle)) >> 8); | ||
766 | uint oldRegionX = (uint)(m_regionInfo.RegionHandle >> 40); | ||
767 | uint oldRegionY = (((uint)(m_regionInfo.RegionHandle)) >> 8); | ||
768 | |||
769 | // Fixing a bug where teleporting while sitting results in the avatar ending up removed from | ||
770 | // both regions | ||
771 | if (avatar.ParentID != (uint)0) | ||
772 | avatar.StandUp(); | ||
773 | |||
774 | if (!avatar.ValidateAttachments()) | ||
775 | { | ||
776 | avatar.ControllingClient.SendTeleportFailed("Inconsistent attachment state"); | ||
777 | return; | ||
778 | } | ||
779 | |||
780 | // the avatar.Close below will clear the child region list. We need this below for (possibly) | ||
781 | // closing the child agents, so save it here (we need a copy as it is Clear()-ed). | ||
782 | //List<ulong> childRegions = new List<ulong>(avatar.GetKnownRegionList()); | ||
783 | // Compared to ScenePresence.CrossToNewRegion(), there's no obvious code to handle a teleport | ||
784 | // failure at this point (unlike a border crossing failure). So perhaps this can never fail | ||
785 | // once we reach here... | ||
786 | //avatar.Scene.RemoveCapsHandler(avatar.UUID); | ||
787 | |||
788 | string capsPath = String.Empty; | ||
789 | AgentCircuitData agentCircuit = avatar.ControllingClient.RequestClientInfo(); | ||
790 | agentCircuit.BaseFolder = UUID.Zero; | ||
791 | agentCircuit.InventoryFolder = UUID.Zero; | ||
792 | agentCircuit.startpos = position; | ||
793 | agentCircuit.child = true; | ||
794 | |||
795 | if (Util.IsOutsideView(oldRegionX, newRegionX, oldRegionY, newRegionY)) | ||
796 | { | ||
797 | // brand new agent, let's create a new caps seed | ||
798 | agentCircuit.CapsPath = CapsUtil.GetRandomCapsObjectPath(); | ||
799 | } | ||
800 | |||
801 | string reason = String.Empty; | ||
802 | |||
803 | // Let's create an agent there if one doesn't exist yet. | ||
804 | //if (!m_commsProvider.InterRegion.InformRegionOfChildAgent(reg.RegionHandle, agentCircuit)) | ||
805 | if (!m_interregionCommsOut.SendCreateChildAgent(reg.RegionHandle, agentCircuit, teleportFlags, out reason)) | ||
806 | { | ||
807 | avatar.ControllingClient.SendTeleportFailed(String.Format("Destination is not accepting teleports: {0}", | ||
808 | reason)); | ||
809 | return; | ||
810 | } | ||
811 | |||
812 | // OK, it got this agent. Let's close some child agents | ||
813 | avatar.CloseChildAgents(newRegionX, newRegionY); | ||
814 | |||
815 | if (Util.IsOutsideView(oldRegionX, newRegionX, oldRegionY, newRegionY)) | ||
816 | { | ||
817 | #region IP Translation for NAT | ||
818 | IClientIPEndpoint ipepClient; | ||
819 | if (avatar.ClientView.TryGet(out ipepClient)) | ||
820 | { | ||
821 | capsPath | ||
822 | = "http://" | ||
823 | + NetworkUtil.GetHostFor(ipepClient.EndPoint, reg.ExternalHostName) | ||
824 | + ":" | ||
825 | + reg.HttpPort | ||
826 | + CapsUtil.GetCapsSeedPath(agentCircuit.CapsPath); | ||
827 | } | ||
828 | else | ||
829 | { | ||
830 | capsPath | ||
831 | = "http://" | ||
832 | + reg.ExternalHostName | ||
833 | + ":" | ||
834 | + reg.HttpPort | ||
835 | + CapsUtil.GetCapsSeedPath(agentCircuit.CapsPath); | ||
836 | } | ||
837 | #endregion | ||
838 | |||
839 | if (eq != null) | ||
840 | { | ||
841 | #region IP Translation for NAT | ||
842 | // Uses ipepClient above | ||
843 | if (avatar.ClientView.TryGet(out ipepClient)) | ||
844 | { | ||
845 | endPoint.Address = NetworkUtil.GetIPFor(ipepClient.EndPoint, endPoint.Address); | ||
846 | } | ||
847 | #endregion | ||
848 | |||
849 | eq.EnableSimulator(reg.RegionHandle, endPoint, avatar.UUID); | ||
850 | |||
851 | // ES makes the client send a UseCircuitCode message to the destination, | ||
852 | // which triggers a bunch of things there. | ||
853 | // So let's wait | ||
854 | Thread.Sleep(2000); | ||
855 | |||
856 | eq.EstablishAgentCommunication(avatar.UUID, endPoint, capsPath); | ||
857 | } | ||
858 | else | ||
859 | { | ||
860 | avatar.ControllingClient.InformClientOfNeighbour(reg.RegionHandle, endPoint); | ||
861 | } | ||
862 | } | ||
863 | else | ||
864 | { | ||
865 | agentCircuit.CapsPath = avatar.Scene.CapsModule.GetChildSeed(avatar.UUID, reg.RegionHandle); | ||
866 | capsPath = "http://" + reg.ExternalHostName + ":" + reg.HttpPort | ||
867 | + "/CAPS/" + agentCircuit.CapsPath + "0000/"; | ||
868 | } | ||
869 | |||
870 | // Expect avatar crossing is a heavy-duty function at the destination. | ||
871 | // That is where MakeRoot is called, which fetches appearance and inventory. | ||
872 | // Plus triggers OnMakeRoot, which spawns a series of asynchronous updates. | ||
873 | //m_commsProvider.InterRegion.ExpectAvatarCrossing(reg.RegionHandle, avatar.ControllingClient.AgentId, | ||
874 | // position, false); | ||
875 | |||
876 | //{ | ||
877 | // avatar.ControllingClient.SendTeleportFailed("Problem with destination."); | ||
878 | // // We should close that agent we just created over at destination... | ||
879 | // List<ulong> lst = new List<ulong>(); | ||
880 | // lst.Add(reg.RegionHandle); | ||
881 | // SendCloseChildAgentAsync(avatar.UUID, lst); | ||
882 | // return; | ||
883 | //} | ||
884 | |||
885 | SetInTransit(avatar.UUID); | ||
886 | // Let's send a full update of the agent. This is a synchronous call. | ||
887 | AgentData agent = new AgentData(); | ||
888 | avatar.CopyTo(agent); | ||
889 | agent.Position = position; | ||
890 | agent.CallbackURI = "http://" + m_regionInfo.ExternalHostName + ":" + m_regionInfo.HttpPort + | ||
891 | "/agent/" + avatar.UUID.ToString() + "/" + avatar.Scene.RegionInfo.RegionHandle.ToString() + "/release/"; | ||
892 | |||
893 | m_interregionCommsOut.SendChildAgentUpdate(reg.RegionHandle, agent); | ||
894 | |||
895 | m_log.DebugFormat( | ||
896 | "[CAPS]: Sending new CAPS seed url {0} to client {1}", capsPath, avatar.UUID); | ||
897 | |||
898 | |||
899 | if (eq != null) | ||
900 | { | ||
901 | eq.TeleportFinishEvent(reg.RegionHandle, 13, endPoint, | ||
902 | 0, teleportFlags, capsPath, avatar.UUID); | ||
903 | } | ||
904 | else | ||
905 | { | ||
906 | avatar.ControllingClient.SendRegionTeleport(reg.RegionHandle, 13, endPoint, 4, | ||
907 | teleportFlags, capsPath); | ||
908 | } | ||
909 | |||
910 | // TeleportFinish makes the client send CompleteMovementIntoRegion (at the destination), which | ||
911 | // trigers a whole shebang of things there, including MakeRoot. So let's wait for confirmation | ||
912 | // that the client contacted the destination before we send the attachments and close things here. | ||
913 | if (!WaitForCallback(avatar.UUID)) | ||
914 | { | ||
915 | // Client never contacted destination. Let's restore everything back | ||
916 | avatar.ControllingClient.SendTeleportFailed("Problems connecting to destination."); | ||
917 | |||
918 | ResetFromTransit(avatar.UUID); | ||
919 | |||
920 | // Yikes! We should just have a ref to scene here. | ||
921 | avatar.Scene.InformClientOfNeighbours(avatar); | ||
922 | |||
923 | // Finally, kill the agent we just created at the destination. | ||
924 | m_interregionCommsOut.SendCloseAgent(reg.RegionHandle, avatar.UUID); | ||
925 | |||
926 | return; | ||
927 | } | ||
928 | |||
929 | // Can't go back from here | ||
930 | if (KiPrimitive != null) | ||
931 | { | ||
932 | KiPrimitive(avatar.LocalId); | ||
933 | } | ||
934 | |||
935 | avatar.MakeChildAgent(); | ||
936 | |||
937 | // CrossAttachmentsIntoNewRegion is a synchronous call. We shouldn't need to wait after it | ||
938 | avatar.CrossAttachmentsIntoNewRegion(reg.RegionHandle, true); | ||
939 | |||
940 | // Finally, let's close this previously-known-as-root agent, when the jump is outside the view zone | ||
941 | |||
942 | if (Util.IsOutsideView(oldRegionX, newRegionX, oldRegionY, newRegionY)) | ||
943 | { | ||
944 | Thread.Sleep(5000); | ||
945 | avatar.Close(); | ||
946 | CloseConnection(avatar.UUID); | ||
947 | } | ||
948 | else | ||
949 | // now we have a child agent in this region. | ||
950 | avatar.Reset(); | ||
951 | |||
952 | |||
953 | // if (teleport success) // seems to be always success here | ||
954 | // the user may change their profile information in other region, | ||
955 | // so the userinfo in UserProfileCache is not reliable any more, delete it | ||
956 | if (avatar.Scene.NeedSceneCacheClear(avatar.UUID)) | ||
957 | { | ||
958 | m_commsProvider.UserProfileCacheService.RemoveUser(avatar.UUID); | ||
959 | m_log.DebugFormat( | ||
960 | "[SCENE COMMUNICATION SERVICE]: User {0} is going to another region, profile cache removed", | ||
961 | avatar.UUID); | ||
962 | } | ||
963 | } | ||
964 | else | ||
965 | { | ||
966 | avatar.ControllingClient.SendTeleportFailed("Remote Region appears to be down"); | ||
967 | } | ||
968 | } | ||
969 | else | ||
970 | { | ||
971 | // TP to a place that doesn't exist (anymore) | ||
972 | // Inform the viewer about that | ||
973 | avatar.ControllingClient.SendTeleportFailed("The region you tried to teleport to doesn't exist anymore"); | ||
974 | |||
975 | // and set the map-tile to '(Offline)' | ||
976 | uint regX, regY; | ||
977 | Utils.LongToUInts(regionHandle, out regX, out regY); | ||
978 | |||
979 | MapBlockData block = new MapBlockData(); | ||
980 | block.X = (ushort)(regX / Constants.RegionSize); | ||
981 | block.Y = (ushort)(regY / Constants.RegionSize); | ||
982 | block.Access = 254; // == not there | ||
983 | |||
984 | List<MapBlockData> blocks = new List<MapBlockData>(); | ||
985 | blocks.Add(block); | ||
986 | avatar.ControllingClient.SendMapBlock(blocks, 0); | ||
987 | } | ||
988 | } | ||
989 | } | ||
990 | |||
991 | protected bool IsOutsideRegion(Scene s, Vector3 pos) | ||
992 | { | ||
993 | |||
994 | if (s.TestBorderCross(pos,Cardinals.N)) | ||
995 | return true; | ||
996 | if (s.TestBorderCross(pos, Cardinals.S)) | ||
997 | return true; | ||
998 | if (s.TestBorderCross(pos, Cardinals.E)) | ||
999 | return true; | ||
1000 | if (s.TestBorderCross(pos, Cardinals.W)) | ||
1001 | return true; | ||
1002 | |||
1003 | return false; | ||
1004 | } | ||
1005 | |||
1006 | public bool WaitForCallback(UUID id) | ||
1007 | { | ||
1008 | int count = 200; | ||
1009 | while (m_agentsInTransit.Contains(id) && count-- > 0) | ||
1010 | { | ||
1011 | //m_log.Debug(" >>> Waiting... " + count); | ||
1012 | Thread.Sleep(100); | ||
1013 | } | ||
1014 | |||
1015 | if (count > 0) | ||
1016 | return true; | ||
1017 | else | ||
1018 | return false; | ||
1019 | } | ||
1020 | |||
1021 | public bool ReleaseAgent(UUID id) | ||
1022 | { | ||
1023 | //m_log.Debug(" >>> ReleaseAgent called <<< "); | ||
1024 | return ResetFromTransit(id); | ||
1025 | } | ||
1026 | |||
1027 | public void SetInTransit(UUID id) | ||
1028 | { | ||
1029 | lock (m_agentsInTransit) | ||
1030 | { | ||
1031 | if (!m_agentsInTransit.Contains(id)) | ||
1032 | m_agentsInTransit.Add(id); | ||
1033 | } | ||
1034 | } | ||
1035 | |||
1036 | protected bool ResetFromTransit(UUID id) | ||
1037 | { | ||
1038 | lock (m_agentsInTransit) | ||
1039 | { | ||
1040 | if (m_agentsInTransit.Contains(id)) | ||
1041 | { | ||
1042 | m_agentsInTransit.Remove(id); | ||
1043 | return true; | ||
1044 | } | ||
1045 | } | ||
1046 | return false; | ||
1047 | } | ||
1048 | |||
1049 | private List<ulong> NeighbourHandles(List<GridRegion> neighbours) | ||
1050 | { | ||
1051 | List<ulong> handles = new List<ulong>(); | ||
1052 | foreach (GridRegion reg in neighbours) | ||
1053 | { | ||
1054 | handles.Add(reg.RegionHandle); | ||
1055 | } | ||
1056 | return handles; | ||
1057 | } | ||
1058 | |||
1059 | private List<ulong> NewNeighbours(List<ulong> currentNeighbours, List<ulong> previousNeighbours) | ||
1060 | { | ||
1061 | return currentNeighbours.FindAll(delegate(ulong handle) { return !previousNeighbours.Contains(handle); }); | ||
1062 | } | ||
1063 | |||
1064 | // private List<ulong> CommonNeighbours(List<ulong> currentNeighbours, List<ulong> previousNeighbours) | ||
1065 | // { | ||
1066 | // return currentNeighbours.FindAll(delegate(ulong handle) { return previousNeighbours.Contains(handle); }); | ||
1067 | // } | ||
1068 | |||
1069 | private List<ulong> OldNeighbours(List<ulong> currentNeighbours, List<ulong> previousNeighbours) | ||
1070 | { | ||
1071 | return previousNeighbours.FindAll(delegate(ulong handle) { return !currentNeighbours.Contains(handle); }); | ||
1072 | } | ||
1073 | |||
1074 | public void CrossAgentToNewRegion(Scene scene, ScenePresence agent, bool isFlying) | ||
1075 | { | ||
1076 | Vector3 pos = agent.AbsolutePosition; | ||
1077 | Vector3 newpos = new Vector3(pos.X, pos.Y, pos.Z); | ||
1078 | uint neighbourx = m_regionInfo.RegionLocX; | ||
1079 | uint neighboury = m_regionInfo.RegionLocY; | ||
1080 | const float boundaryDistance = 1.7f; | ||
1081 | Vector3 northCross = new Vector3(0,boundaryDistance, 0); | ||
1082 | Vector3 southCross = new Vector3(0, -1 * boundaryDistance, 0); | ||
1083 | Vector3 eastCross = new Vector3(boundaryDistance, 0, 0); | ||
1084 | Vector3 westCross = new Vector3(-1 * boundaryDistance, 0, 0); | ||
1085 | |||
1086 | // distance to edge that will trigger crossing | ||
1087 | |||
1088 | |||
1089 | // distance into new region to place avatar | ||
1090 | const float enterDistance = 0.5f; | ||
1091 | |||
1092 | if (scene.TestBorderCross(pos + westCross, Cardinals.W)) | ||
1093 | { | ||
1094 | if (scene.TestBorderCross(pos + northCross, Cardinals.N)) | ||
1095 | { | ||
1096 | Border b = scene.GetCrossedBorder(pos + northCross, Cardinals.N); | ||
1097 | neighboury += (uint)(int)(b.BorderLine.Z / (int)Constants.RegionSize); | ||
1098 | } | ||
1099 | else if (scene.TestBorderCross(pos + southCross, Cardinals.S)) | ||
1100 | { | ||
1101 | Border b = scene.GetCrossedBorder(pos + southCross, Cardinals.S); | ||
1102 | if (b.TriggerRegionX == 0 && b.TriggerRegionY == 0) | ||
1103 | { | ||
1104 | neighboury--; | ||
1105 | newpos.Y = Constants.RegionSize - enterDistance; | ||
1106 | } | ||
1107 | else | ||
1108 | { | ||
1109 | neighboury = b.TriggerRegionY; | ||
1110 | neighbourx = b.TriggerRegionX; | ||
1111 | |||
1112 | Vector3 newposition = pos; | ||
1113 | newposition.X += (scene.RegionInfo.RegionLocX - neighbourx) * Constants.RegionSize; | ||
1114 | newposition.Y += (scene.RegionInfo.RegionLocY - neighboury) * Constants.RegionSize; | ||
1115 | agent.ControllingClient.SendAgentAlertMessage( | ||
1116 | String.Format("Moving you to region {0},{1}", neighbourx, neighboury), false); | ||
1117 | InformClientToInitateTeleportToLocation(agent, neighbourx, neighboury, newposition, scene); | ||
1118 | return; | ||
1119 | } | ||
1120 | } | ||
1121 | |||
1122 | Border ba = scene.GetCrossedBorder(pos + westCross, Cardinals.W); | ||
1123 | if (ba.TriggerRegionX == 0 && ba.TriggerRegionY == 0) | ||
1124 | { | ||
1125 | neighbourx--; | ||
1126 | newpos.X = Constants.RegionSize - enterDistance; | ||
1127 | } | ||
1128 | else | ||
1129 | { | ||
1130 | neighboury = ba.TriggerRegionY; | ||
1131 | neighbourx = ba.TriggerRegionX; | ||
1132 | |||
1133 | |||
1134 | Vector3 newposition = pos; | ||
1135 | newposition.X += (scene.RegionInfo.RegionLocX - neighbourx) * Constants.RegionSize; | ||
1136 | newposition.Y += (scene.RegionInfo.RegionLocY - neighboury) * Constants.RegionSize; | ||
1137 | agent.ControllingClient.SendAgentAlertMessage( | ||
1138 | String.Format("Moving you to region {0},{1}", neighbourx, neighboury), false); | ||
1139 | InformClientToInitateTeleportToLocation(agent, neighbourx, neighboury, newposition, scene); | ||
1140 | |||
1141 | |||
1142 | return; | ||
1143 | } | ||
1144 | |||
1145 | } | ||
1146 | else if (scene.TestBorderCross(pos + eastCross, Cardinals.E)) | ||
1147 | { | ||
1148 | Border b = scene.GetCrossedBorder(pos + eastCross, Cardinals.E); | ||
1149 | neighbourx += (uint)(int)(b.BorderLine.Z / (int)Constants.RegionSize); | ||
1150 | newpos.X = enterDistance; | ||
1151 | |||
1152 | if (scene.TestBorderCross(pos + southCross, Cardinals.S)) | ||
1153 | { | ||
1154 | Border ba = scene.GetCrossedBorder(pos + southCross, Cardinals.S); | ||
1155 | if (ba.TriggerRegionX == 0 && ba.TriggerRegionY == 0) | ||
1156 | { | ||
1157 | neighboury--; | ||
1158 | newpos.Y = Constants.RegionSize - enterDistance; | ||
1159 | } | ||
1160 | else | ||
1161 | { | ||
1162 | neighboury = ba.TriggerRegionY; | ||
1163 | neighbourx = ba.TriggerRegionX; | ||
1164 | Vector3 newposition = pos; | ||
1165 | newposition.X += (scene.RegionInfo.RegionLocX - neighbourx) * Constants.RegionSize; | ||
1166 | newposition.Y += (scene.RegionInfo.RegionLocY - neighboury) * Constants.RegionSize; | ||
1167 | agent.ControllingClient.SendAgentAlertMessage( | ||
1168 | String.Format("Moving you to region {0},{1}", neighbourx, neighboury), false); | ||
1169 | InformClientToInitateTeleportToLocation(agent, neighbourx, neighboury, newposition, scene); | ||
1170 | return; | ||
1171 | } | ||
1172 | } | ||
1173 | else if (scene.TestBorderCross(pos + northCross, Cardinals.N)) | ||
1174 | { | ||
1175 | Border c = scene.GetCrossedBorder(pos + northCross, Cardinals.N); | ||
1176 | neighboury += (uint)(int)(c.BorderLine.Z / (int)Constants.RegionSize); | ||
1177 | newpos.Y = enterDistance; | ||
1178 | } | ||
1179 | |||
1180 | |||
1181 | } | ||
1182 | else if (scene.TestBorderCross(pos + southCross, Cardinals.S)) | ||
1183 | { | ||
1184 | Border b = scene.GetCrossedBorder(pos + southCross, Cardinals.S); | ||
1185 | if (b.TriggerRegionX == 0 && b.TriggerRegionY == 0) | ||
1186 | { | ||
1187 | neighboury--; | ||
1188 | newpos.Y = Constants.RegionSize - enterDistance; | ||
1189 | } | ||
1190 | else | ||
1191 | { | ||
1192 | neighboury = b.TriggerRegionY; | ||
1193 | neighbourx = b.TriggerRegionX; | ||
1194 | Vector3 newposition = pos; | ||
1195 | newposition.X += (scene.RegionInfo.RegionLocX - neighbourx) * Constants.RegionSize; | ||
1196 | newposition.Y += (scene.RegionInfo.RegionLocY - neighboury) * Constants.RegionSize; | ||
1197 | agent.ControllingClient.SendAgentAlertMessage( | ||
1198 | String.Format("Moving you to region {0},{1}", neighbourx, neighboury), false); | ||
1199 | InformClientToInitateTeleportToLocation(agent, neighbourx, neighboury, newposition, scene); | ||
1200 | return; | ||
1201 | } | ||
1202 | } | ||
1203 | else if (scene.TestBorderCross(pos + northCross, Cardinals.N)) | ||
1204 | { | ||
1205 | |||
1206 | Border b = scene.GetCrossedBorder(pos + northCross, Cardinals.N); | ||
1207 | neighboury += (uint)(int)(b.BorderLine.Z / (int)Constants.RegionSize); | ||
1208 | newpos.Y = enterDistance; | ||
1209 | } | ||
1210 | |||
1211 | /* | ||
1212 | |||
1213 | if (pos.X < boundaryDistance) //West | ||
1214 | { | ||
1215 | neighbourx--; | ||
1216 | newpos.X = Constants.RegionSize - enterDistance; | ||
1217 | } | ||
1218 | else if (pos.X > Constants.RegionSize - boundaryDistance) // East | ||
1219 | { | ||
1220 | neighbourx++; | ||
1221 | newpos.X = enterDistance; | ||
1222 | } | ||
1223 | |||
1224 | if (pos.Y < boundaryDistance) // South | ||
1225 | { | ||
1226 | neighboury--; | ||
1227 | newpos.Y = Constants.RegionSize - enterDistance; | ||
1228 | } | ||
1229 | else if (pos.Y > Constants.RegionSize - boundaryDistance) // North | ||
1230 | { | ||
1231 | neighboury++; | ||
1232 | newpos.Y = enterDistance; | ||
1233 | } | ||
1234 | */ | ||
1235 | |||
1236 | CrossAgentToNewRegionDelegate d = CrossAgentToNewRegionAsync; | ||
1237 | d.BeginInvoke(agent, newpos, neighbourx, neighboury, isFlying, CrossAgentToNewRegionCompleted, d); | ||
1238 | } | ||
1239 | |||
1240 | public delegate void InformClientToInitateTeleportToLocationDelegate(ScenePresence agent, uint regionX, uint regionY, | ||
1241 | Vector3 position, | ||
1242 | Scene initiatingScene); | ||
1243 | |||
1244 | public void InformClientToInitateTeleportToLocation(ScenePresence agent, uint regionX, uint regionY, Vector3 position, | ||
1245 | Scene initiatingScene) | ||
1246 | { | ||
1247 | |||
1248 | // This assumes that we know what our neighbors are. | ||
1249 | |||
1250 | InformClientToInitateTeleportToLocationDelegate d = InformClientToInitiateTeleportToLocationAsync; | ||
1251 | d.BeginInvoke(agent,regionX,regionY,position,initiatingScene, | ||
1252 | InformClientToInitiateTeleportToLocationCompleted, | ||
1253 | d); | ||
1254 | } | ||
1255 | |||
1256 | public void InformClientToInitiateTeleportToLocationAsync(ScenePresence agent, uint regionX, uint regionY, Vector3 position, | ||
1257 | Scene initiatingScene) | ||
1258 | { | ||
1259 | Thread.Sleep(10000); | ||
1260 | IMessageTransferModule im = initiatingScene.RequestModuleInterface<IMessageTransferModule>(); | ||
1261 | if (im != null) | ||
1262 | { | ||
1263 | UUID gotoLocation = Util.BuildFakeParcelID( | ||
1264 | Util.UIntsToLong( | ||
1265 | (regionX * | ||
1266 | (uint)Constants.RegionSize), | ||
1267 | (regionY * | ||
1268 | (uint)Constants.RegionSize)), | ||
1269 | (uint)(int)position.X, | ||
1270 | (uint)(int)position.Y, | ||
1271 | (uint)(int)position.Z); | ||
1272 | GridInstantMessage m = new GridInstantMessage(initiatingScene, UUID.Zero, | ||
1273 | "Region", agent.UUID, | ||
1274 | (byte)InstantMessageDialog.GodLikeRequestTeleport, false, | ||
1275 | "", gotoLocation, false, new Vector3(127, 0, 0), | ||
1276 | new Byte[0]); | ||
1277 | im.SendInstantMessage(m, delegate(bool success) | ||
1278 | { | ||
1279 | m_log.DebugFormat("[CLIENT]: Client Initiating Teleport sending IM success = {0}", success); | ||
1280 | }); | ||
1281 | |||
1282 | } | ||
1283 | } | ||
1284 | |||
1285 | private void InformClientToInitiateTeleportToLocationCompleted(IAsyncResult iar) | ||
1286 | { | ||
1287 | InformClientToInitateTeleportToLocationDelegate icon = | ||
1288 | (InformClientToInitateTeleportToLocationDelegate) iar.AsyncState; | ||
1289 | icon.EndInvoke(iar); | ||
1290 | } | ||
1291 | |||
1292 | public delegate ScenePresence CrossAgentToNewRegionDelegate(ScenePresence agent, Vector3 pos, uint neighbourx, uint neighboury, bool isFlying); | ||
1293 | |||
1294 | /// <summary> | ||
1295 | /// This Closes child agents on neighboring regions | ||
1296 | /// Calls an asynchronous method to do so.. so it doesn't lag the sim. | ||
1297 | /// </summary> | ||
1298 | protected ScenePresence CrossAgentToNewRegionAsync(ScenePresence agent, Vector3 pos, uint neighbourx, uint neighboury, bool isFlying) | ||
1299 | { | ||
1300 | m_log.DebugFormat("[SCENE COMM]: Crossing agent {0} {1} to {2}-{3}", agent.Firstname, agent.Lastname, neighbourx, neighboury); | ||
1301 | |||
1302 | ulong neighbourHandle = Utils.UIntsToLong((uint)(neighbourx * Constants.RegionSize), (uint)(neighboury * Constants.RegionSize)); | ||
1303 | |||
1304 | int x = (int)(neighbourx * Constants.RegionSize), y = (int)(neighboury * Constants.RegionSize); | ||
1305 | GridRegion neighbourRegion = m_scene.GridService.GetRegionByPosition(m_scene.RegionInfo.ScopeID, (int)x, (int)y); | ||
1306 | |||
1307 | if (neighbourRegion != null && agent.ValidateAttachments()) | ||
1308 | { | ||
1309 | pos = pos + (agent.Velocity); | ||
1310 | |||
1311 | //CachedUserInfo userInfo = m_commsProvider.UserProfileCacheService.GetUserDetails(agent.UUID); | ||
1312 | //if (userInfo != null) | ||
1313 | //{ | ||
1314 | // userInfo.DropInventory(); | ||
1315 | //} | ||
1316 | //else | ||
1317 | //{ | ||
1318 | // m_log.WarnFormat("[SCENE COMM]: No cached user info found for {0} {1} on leaving region {2}", | ||
1319 | // agent.Name, agent.UUID, agent.Scene.RegionInfo.RegionName); | ||
1320 | //} | ||
1321 | |||
1322 | //bool crossingSuccessful = | ||
1323 | // CrossToNeighbouringRegion(neighbourHandle, agent.ControllingClient.AgentId, pos, | ||
1324 | //isFlying); | ||
1325 | |||
1326 | SetInTransit(agent.UUID); | ||
1327 | AgentData cAgent = new AgentData(); | ||
1328 | agent.CopyTo(cAgent); | ||
1329 | cAgent.Position = pos; | ||
1330 | if (isFlying) | ||
1331 | cAgent.ControlFlags |= (uint)AgentManager.ControlFlags.AGENT_CONTROL_FLY; | ||
1332 | cAgent.CallbackURI = "http://" + m_regionInfo.ExternalHostName + ":" + m_regionInfo.HttpPort + | ||
1333 | "/agent/" + agent.UUID.ToString() + "/" + agent.Scene.RegionInfo.RegionHandle.ToString() + "/release/"; | ||
1334 | |||
1335 | m_interregionCommsOut.SendChildAgentUpdate(neighbourHandle, cAgent); | ||
1336 | |||
1337 | // Next, let's close the child agent connections that are too far away. | ||
1338 | agent.CloseChildAgents(neighbourx, neighboury); | ||
1339 | |||
1340 | //AgentCircuitData circuitdata = m_controllingClient.RequestClientInfo(); | ||
1341 | agent.ControllingClient.RequestClientInfo(); | ||
1342 | |||
1343 | //m_log.Debug("BEFORE CROSS"); | ||
1344 | //Scene.DumpChildrenSeeds(UUID); | ||
1345 | //DumpKnownRegions(); | ||
1346 | string agentcaps; | ||
1347 | if (!agent.KnownRegions.TryGetValue(neighbourRegion.RegionHandle, out agentcaps)) | ||
1348 | { | ||
1349 | m_log.ErrorFormat("[SCENE COMM]: No CAPS information for region handle {0}, exiting CrossToNewRegion.", | ||
1350 | neighbourRegion.RegionHandle); | ||
1351 | return agent; | ||
1352 | } | ||
1353 | // TODO Should construct this behind a method | ||
1354 | string capsPath = | ||
1355 | "http://" + neighbourRegion.ExternalHostName + ":" + neighbourRegion.HttpPort | ||
1356 | + "/CAPS/" + agentcaps /*circuitdata.CapsPath*/ + "0000/"; | ||
1357 | |||
1358 | m_log.DebugFormat("[CAPS]: Sending new CAPS seed url {0} to client {1}", capsPath, agent.UUID); | ||
1359 | |||
1360 | IEventQueue eq = agent.Scene.RequestModuleInterface<IEventQueue>(); | ||
1361 | if (eq != null) | ||
1362 | { | ||
1363 | eq.CrossRegion(neighbourHandle, pos, agent.Velocity, neighbourRegion.ExternalEndPoint, | ||
1364 | capsPath, agent.UUID, agent.ControllingClient.SessionId); | ||
1365 | } | ||
1366 | else | ||
1367 | { | ||
1368 | agent.ControllingClient.CrossRegion(neighbourHandle, pos, agent.Velocity, neighbourRegion.ExternalEndPoint, | ||
1369 | capsPath); | ||
1370 | } | ||
1371 | |||
1372 | if (!WaitForCallback(agent.UUID)) | ||
1373 | { | ||
1374 | ResetFromTransit(agent.UUID); | ||
1375 | |||
1376 | // Yikes! We should just have a ref to scene here. | ||
1377 | agent.Scene.InformClientOfNeighbours(agent); | ||
1378 | |||
1379 | return agent; | ||
1380 | } | ||
1381 | |||
1382 | agent.MakeChildAgent(); | ||
1383 | // now we have a child agent in this region. Request all interesting data about other (root) agents | ||
1384 | agent.SendInitialFullUpdateToAllClients(); | ||
1385 | |||
1386 | agent.CrossAttachmentsIntoNewRegion(neighbourHandle, true); | ||
1387 | |||
1388 | // m_scene.SendKillObject(m_localId); | ||
1389 | |||
1390 | agent.Scene.NotifyMyCoarseLocationChange(); | ||
1391 | // the user may change their profile information in other region, | ||
1392 | // so the userinfo in UserProfileCache is not reliable any more, delete it | ||
1393 | if (agent.Scene.NeedSceneCacheClear(agent.UUID)) | ||
1394 | { | ||
1395 | agent.Scene.CommsManager.UserProfileCacheService.RemoveUser(agent.UUID); | ||
1396 | m_log.DebugFormat( | ||
1397 | "[SCENE COMM]: User {0} is going to another region, profile cache removed", agent.UUID); | ||
1398 | } | ||
1399 | } | ||
1400 | |||
1401 | //m_log.Debug("AFTER CROSS"); | ||
1402 | //Scene.DumpChildrenSeeds(UUID); | ||
1403 | //DumpKnownRegions(); | ||
1404 | return agent; | ||
1405 | } | ||
1406 | |||
1407 | private void CrossAgentToNewRegionCompleted(IAsyncResult iar) | ||
1408 | { | ||
1409 | CrossAgentToNewRegionDelegate icon = (CrossAgentToNewRegionDelegate)iar.AsyncState; | ||
1410 | ScenePresence agent = icon.EndInvoke(iar); | ||
1411 | |||
1412 | // If the cross was successful, this agent is a child agent | ||
1413 | if (agent.IsChildAgent) | ||
1414 | { | ||
1415 | agent.Reset(); | ||
1416 | } | ||
1417 | else // Not successful | ||
1418 | { | ||
1419 | //CachedUserInfo userInfo = m_commsProvider.UserProfileCacheService.GetUserDetails(agent.UUID); | ||
1420 | //if (userInfo != null) | ||
1421 | //{ | ||
1422 | // userInfo.FetchInventory(); | ||
1423 | //} | ||
1424 | agent.RestoreInCurrentScene(); | ||
1425 | } | ||
1426 | // In any case | ||
1427 | agent.NotInTransit(); | ||
1428 | |||
1429 | //m_log.DebugFormat("[SCENE COMM]: Crossing agent {0} {1} completed.", agent.Firstname, agent.Lastname); | ||
1430 | } | ||
1431 | |||
1432 | |||
1433 | public void LogOffUser(UUID userid, UUID regionid, ulong regionhandle, Vector3 position, Vector3 lookat) | ||
1434 | { | ||
1435 | m_commsProvider.LogOffUser(userid, regionid, regionhandle, position, lookat); | ||
1436 | } | ||
1437 | |||
1438 | // deprecated as of 2008-08-27 | ||
1439 | public void LogOffUser(UUID userid, UUID regionid, ulong regionhandle, float posx, float posy, float posz) | ||
1440 | { | ||
1441 | m_commsProvider.LogOffUser(userid, regionid, regionhandle, posx, posy, posz); | ||
1442 | } | ||
1443 | |||
1444 | public void ClearUserAgent(UUID avatarID) | ||
1445 | { | ||
1446 | m_commsProvider.UserService.ClearUserAgent(avatarID); | ||
1447 | } | ||
1448 | |||
1449 | public void AddNewUserFriend(UUID friendlistowner, UUID friend, uint perms) | ||
1450 | { | ||
1451 | m_commsProvider.AddNewUserFriend(friendlistowner, friend, perms); | ||
1452 | } | ||
1453 | |||
1454 | public void UpdateUserFriendPerms(UUID friendlistowner, UUID friend, uint perms) | ||
1455 | { | ||
1456 | m_commsProvider.UpdateUserFriendPerms(friendlistowner, friend, perms); | ||
1457 | } | ||
1458 | |||
1459 | public void RemoveUserFriend(UUID friendlistowner, UUID friend) | ||
1460 | { | ||
1461 | m_commsProvider.RemoveUserFriend(friendlistowner, friend); | ||
1462 | } | ||
1463 | |||
1464 | public List<FriendListItem> GetUserFriendList(UUID friendlistowner) | ||
1465 | { | ||
1466 | return m_commsProvider.GetUserFriendList(friendlistowner); | ||
1467 | } | ||
1468 | |||
1469 | public List<AvatarPickerAvatar> GenerateAgentPickerRequestResponse(UUID queryID, string query) | ||
1470 | { | ||
1471 | return m_commsProvider.GenerateAgentPickerRequestResponse(queryID, query); | ||
1472 | } | ||
1473 | |||
1474 | public List<GridRegion> RequestNamedRegions(string name, int maxNumber) | 304 | public List<GridRegion> RequestNamedRegions(string name, int maxNumber) |
1475 | { | 305 | { |
1476 | return m_scene.GridService.GetRegionsByName(UUID.Zero, name, maxNumber); | 306 | return m_scene.GridService.GetRegionsByName(UUID.Zero, name, maxNumber); |
1477 | } | 307 | } |
1478 | 308 | ||
1479 | //private void Dump(string msg, List<ulong> handles) | ||
1480 | //{ | ||
1481 | // m_log.InfoFormat("-------------- HANDLE DUMP ({0}) ---------", msg); | ||
1482 | // foreach (ulong handle in handles) | ||
1483 | // { | ||
1484 | // uint x, y; | ||
1485 | // Utils.LongToUInts(handle, out x, out y); | ||
1486 | // x = x / Constants.RegionSize; | ||
1487 | // y = y / Constants.RegionSize; | ||
1488 | // m_log.InfoFormat("({0}, {1})", x, y); | ||
1489 | // } | ||
1490 | //} | ||
1491 | } | 309 | } |
1492 | } | 310 | } |
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index 321cc45..369552f 100644 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs | |||
@@ -35,6 +35,7 @@ using log4net; | |||
35 | using OpenSim.Framework; | 35 | using OpenSim.Framework; |
36 | using OpenSim.Region.Framework.Scenes.Types; | 36 | using OpenSim.Region.Framework.Scenes.Types; |
37 | using OpenSim.Region.Physics.Manager; | 37 | using OpenSim.Region.Physics.Manager; |
38 | using OpenSim.Region.Framework.Interfaces; | ||
38 | 39 | ||
39 | namespace OpenSim.Region.Framework.Scenes | 40 | namespace OpenSim.Region.Framework.Scenes |
40 | { | 41 | { |
@@ -517,33 +518,32 @@ namespace OpenSim.Region.Framework.Scenes | |||
517 | /// <returns>The scene object that was attached. Null if the scene object could not be found</returns> | 518 | /// <returns>The scene object that was attached. Null if the scene object could not be found</returns> |
518 | public SceneObjectGroup RezSingleAttachment(IClientAPI remoteClient, UUID itemID, uint AttachmentPt) | 519 | public SceneObjectGroup RezSingleAttachment(IClientAPI remoteClient, UUID itemID, uint AttachmentPt) |
519 | { | 520 | { |
520 | SceneObjectGroup objatt = m_parentScene.RezObject(remoteClient, | 521 | IInventoryAccessModule invAccess = m_parentScene.RequestModuleInterface<IInventoryAccessModule>(); |
521 | itemID, Vector3.Zero, Vector3.Zero, UUID.Zero, (byte)1, true, | 522 | if (invAccess != null) |
522 | false, false, remoteClient.AgentId, true); | ||
523 | |||
524 | if (objatt != null) | ||
525 | { | 523 | { |
526 | bool tainted = false; | 524 | SceneObjectGroup objatt = invAccess.RezObject(remoteClient, |
527 | if (AttachmentPt != 0 && AttachmentPt != objatt.GetAttachmentPoint()) | 525 | itemID, Vector3.Zero, Vector3.Zero, UUID.Zero, (byte)1, true, |
528 | tainted = true; | 526 | false, false, remoteClient.AgentId, true); |
527 | |||
529 | 528 | ||
530 | if (AttachObject( | 529 | if (objatt != null) |
531 | remoteClient, objatt.LocalId, AttachmentPt, Quaternion.Identity, objatt.AbsolutePosition, false)) | ||
532 | { | 530 | { |
531 | bool tainted = false; | ||
532 | if (AttachmentPt != 0 && AttachmentPt != objatt.GetAttachmentPoint()) | ||
533 | tainted = true; | ||
534 | |||
535 | AttachObject(remoteClient, objatt.LocalId, AttachmentPt, Quaternion.Identity, objatt.AbsolutePosition, false); | ||
533 | objatt.ScheduleGroupForFullUpdate(); | 536 | objatt.ScheduleGroupForFullUpdate(); |
534 | if (tainted) | 537 | if (tainted) |
535 | objatt.HasGroupChanged = true; | 538 | objatt.HasGroupChanged = true; |
536 | 539 | ||
537 | // Fire after attach, so we don't get messy perms dialogs | 540 | // Fire after attach, so we don't get messy perms dialogs |
538 | // 3 == AttachedRez | 541 | // 3 == AttachedRez |
539 | objatt.CreateScriptInstances(0, true, m_parentScene.DefaultScriptEngine, 3); | 542 | objatt.CreateScriptInstances(0, true, m_parentScene.DefaultScriptEngine, 3); |
540 | |||
541 | // Do this last so that event listeners have access to all the effects of the attachment | ||
542 | m_parentScene.EventManager.TriggerOnAttach(objatt.LocalId, itemID, remoteClient.AgentId); | ||
543 | } | 543 | } |
544 | return objatt; | ||
544 | } | 545 | } |
545 | 546 | return null; | |
546 | return objatt; | ||
547 | } | 547 | } |
548 | 548 | ||
549 | // What makes this method odd and unique is it tries to detach using an UUID.... Yay for standards. | 549 | // What makes this method odd and unique is it tries to detach using an UUID.... Yay for standards. |
diff --git a/OpenSim/Region/Framework/Scenes/SceneManager.cs b/OpenSim/Region/Framework/Scenes/SceneManager.cs index c2e3370..6395d98 100644 --- a/OpenSim/Region/Framework/Scenes/SceneManager.cs +++ b/OpenSim/Region/Framework/Scenes/SceneManager.cs | |||
@@ -468,11 +468,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
468 | return presences; | 468 | return presences; |
469 | } | 469 | } |
470 | 470 | ||
471 | public RegionInfo GetRegionInfo(ulong regionHandle) | 471 | public RegionInfo GetRegionInfo(UUID regionID) |
472 | { | 472 | { |
473 | foreach (Scene scene in m_localScenes) | 473 | foreach (Scene scene in m_localScenes) |
474 | { | 474 | { |
475 | if (scene.RegionInfo.RegionHandle == regionHandle) | 475 | if (scene.RegionInfo.RegionID == regionID) |
476 | { | 476 | { |
477 | return scene.RegionInfo; | 477 | return scene.RegionInfo; |
478 | } | 478 | } |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs index a555eae..04e3221 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs | |||
@@ -34,7 +34,6 @@ using System.Reflection; | |||
34 | using OpenMetaverse; | 34 | using OpenMetaverse; |
35 | using log4net; | 35 | using log4net; |
36 | using OpenSim.Framework; | 36 | using OpenSim.Framework; |
37 | using OpenSim.Framework.Communications.Cache; | ||
38 | using OpenSim.Region.Framework.Interfaces; | 37 | using OpenSim.Region.Framework.Interfaces; |
39 | using OpenSim.Region.Framework.Scenes.Scripting; | 38 | using OpenSim.Region.Framework.Scenes.Scripting; |
40 | 39 | ||
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 4973663..af9afa6 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -33,12 +33,12 @@ using OpenMetaverse; | |||
33 | using log4net; | 33 | using log4net; |
34 | using OpenSim.Framework; | 34 | using OpenSim.Framework; |
35 | using OpenSim.Framework.Client; | 35 | using OpenSim.Framework.Client; |
36 | using OpenSim.Framework.Communications.Cache; | ||
37 | using OpenSim.Region.Framework.Interfaces; | 36 | using OpenSim.Region.Framework.Interfaces; |
38 | using OpenSim.Region.Framework.Scenes.Animation; | 37 | using OpenSim.Region.Framework.Scenes.Animation; |
39 | using OpenSim.Region.Framework.Scenes.Types; | 38 | using OpenSim.Region.Framework.Scenes.Types; |
40 | using OpenSim.Region.Physics.Manager; | 39 | using OpenSim.Region.Physics.Manager; |
41 | using GridRegion = OpenSim.Services.Interfaces.GridRegion; | 40 | using GridRegion = OpenSim.Services.Interfaces.GridRegion; |
41 | using OpenSim.Services.Interfaces; | ||
42 | 42 | ||
43 | namespace OpenSim.Region.Framework.Scenes | 43 | namespace OpenSim.Region.Framework.Scenes |
44 | { | 44 | { |
@@ -256,6 +256,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
256 | 256 | ||
257 | // For teleports and crossings callbacks | 257 | // For teleports and crossings callbacks |
258 | string m_callbackURI; | 258 | string m_callbackURI; |
259 | UUID m_originRegionID; | ||
260 | |||
259 | ulong m_rootRegionHandle; | 261 | ulong m_rootRegionHandle; |
260 | 262 | ||
261 | /// <value> | 263 | /// <value> |
@@ -1114,6 +1116,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
1114 | /// </summary> | 1116 | /// </summary> |
1115 | public void CompleteMovement() | 1117 | public void CompleteMovement() |
1116 | { | 1118 | { |
1119 | //m_log.Debug("[SCENE PRESENCE]: CompleteMovement"); | ||
1120 | |||
1117 | Vector3 look = Velocity; | 1121 | Vector3 look = Velocity; |
1118 | if ((look.X == 0) && (look.Y == 0) && (look.Z == 0)) | 1122 | if ((look.X == 0) && (look.Y == 0) && (look.Z == 0)) |
1119 | { | 1123 | { |
@@ -1138,7 +1142,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1138 | if ((m_callbackURI != null) && !m_callbackURI.Equals("")) | 1142 | if ((m_callbackURI != null) && !m_callbackURI.Equals("")) |
1139 | { | 1143 | { |
1140 | m_log.DebugFormat("[SCENE PRESENCE]: Releasing agent in URI {0}", m_callbackURI); | 1144 | m_log.DebugFormat("[SCENE PRESENCE]: Releasing agent in URI {0}", m_callbackURI); |
1141 | Scene.SendReleaseAgent(m_rootRegionHandle, UUID, m_callbackURI); | 1145 | Scene.SimulationService.ReleaseAgent(m_originRegionID, UUID, m_callbackURI); |
1142 | m_callbackURI = null; | 1146 | m_callbackURI = null; |
1143 | } | 1147 | } |
1144 | 1148 | ||
@@ -1146,6 +1150,17 @@ namespace OpenSim.Region.Framework.Scenes | |||
1146 | 1150 | ||
1147 | m_controllingClient.MoveAgentIntoRegion(m_regionInfo, AbsolutePosition, look); | 1151 | m_controllingClient.MoveAgentIntoRegion(m_regionInfo, AbsolutePosition, look); |
1148 | SendInitialData(); | 1152 | SendInitialData(); |
1153 | |||
1154 | // Create child agents in neighbouring regions | ||
1155 | if (!m_isChildAgent) | ||
1156 | { | ||
1157 | IEntityTransferModule m_agentTransfer = m_scene.RequestModuleInterface<IEntityTransferModule>(); | ||
1158 | if (m_agentTransfer != null) | ||
1159 | m_agentTransfer.EnableChildAgents(this); | ||
1160 | else | ||
1161 | m_log.DebugFormat("[SCENE PRESENCE]: Unable to create child agents in neighbours, because AgentTransferModule is not active"); | ||
1162 | } | ||
1163 | |||
1149 | } | 1164 | } |
1150 | 1165 | ||
1151 | /// <summary> | 1166 | /// <summary> |
@@ -2204,6 +2219,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2204 | { | 2219 | { |
2205 | if (m_isChildAgent) | 2220 | if (m_isChildAgent) |
2206 | { | 2221 | { |
2222 | // WHAT??? | ||
2207 | m_log.Debug("[SCENEPRESENCE]: AddNewMovement() called on child agent, making root agent!"); | 2223 | m_log.Debug("[SCENEPRESENCE]: AddNewMovement() called on child agent, making root agent!"); |
2208 | 2224 | ||
2209 | // we have to reset the user's child agent connections. | 2225 | // we have to reset the user's child agent connections. |
@@ -2227,7 +2243,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
2227 | 2243 | ||
2228 | if (m_scene.SceneGridService != null) | 2244 | if (m_scene.SceneGridService != null) |
2229 | { | 2245 | { |
2230 | m_scene.SceneGridService.EnableNeighbourChildAgents(this, new List<RegionInfo>()); | 2246 | IEntityTransferModule m_agentTransfer = m_scene.RequestModuleInterface<IEntityTransferModule>(); |
2247 | if (m_agentTransfer != null) | ||
2248 | m_agentTransfer.EnableChildAgents(this); | ||
2231 | } | 2249 | } |
2232 | 2250 | ||
2233 | return; | 2251 | return; |
@@ -2524,14 +2542,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
2524 | m_controllingClient.SendAvatarData(new SendAvatarData(m_regionInfo.RegionHandle, m_firstname, m_lastname, m_grouptitle, m_uuid, LocalId, | 2542 | m_controllingClient.SendAvatarData(new SendAvatarData(m_regionInfo.RegionHandle, m_firstname, m_lastname, m_grouptitle, m_uuid, LocalId, |
2525 | pos, m_appearance.Texture.GetBytes(), m_parentID, m_bodyRot)); | 2543 | pos, m_appearance.Texture.GetBytes(), m_parentID, m_bodyRot)); |
2526 | 2544 | ||
2527 | if (!m_isChildAgent) | ||
2528 | { | ||
2529 | m_scene.InformClientOfNeighbours(this); | ||
2530 | } | ||
2531 | |||
2532 | SendInitialFullUpdateToAllClients(); | 2545 | SendInitialFullUpdateToAllClients(); |
2533 | SendAppearanceToAllOtherAgents(); | 2546 | SendAppearanceToAllOtherAgents(); |
2534 | } | 2547 | } |
2535 | 2548 | ||
2536 | /// <summary> | 2549 | /// <summary> |
2537 | /// Tell the client for this scene presence what items it should be wearing now | 2550 | /// Tell the client for this scene presence what items it should be wearing now |
@@ -2613,14 +2626,19 @@ namespace OpenSim.Region.Framework.Scenes | |||
2613 | } | 2626 | } |
2614 | } | 2627 | } |
2615 | } | 2628 | } |
2629 | |||
2616 | } | 2630 | } |
2617 | 2631 | ||
2632 | |||
2618 | #endregion Bake Cache Check | 2633 | #endregion Bake Cache Check |
2619 | 2634 | ||
2620 | m_appearance.SetAppearance(textureEntry, visualParams); | 2635 | m_appearance.SetAppearance(textureEntry, visualParams); |
2621 | if (m_appearance.AvatarHeight > 0) | 2636 | if (m_appearance.AvatarHeight > 0) |
2622 | SetHeight(m_appearance.AvatarHeight); | 2637 | SetHeight(m_appearance.AvatarHeight); |
2623 | m_scene.CommsManager.AvatarService.UpdateUserAppearance(m_controllingClient.AgentId, m_appearance); | 2638 | |
2639 | // This is not needed, because only the transient data changed | ||
2640 | //AvatarData adata = new AvatarData(m_appearance); | ||
2641 | //m_scene.AvatarService.SetAvatar(m_controllingClient.AgentId, adata); | ||
2624 | 2642 | ||
2625 | SendAppearanceToAllOtherAgents(); | 2643 | SendAppearanceToAllOtherAgents(); |
2626 | if (!m_startAnimationSet) | 2644 | if (!m_startAnimationSet) |
@@ -2640,7 +2658,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
2640 | public void SetWearable(int wearableId, AvatarWearable wearable) | 2658 | public void SetWearable(int wearableId, AvatarWearable wearable) |
2641 | { | 2659 | { |
2642 | m_appearance.SetWearable(wearableId, wearable); | 2660 | m_appearance.SetWearable(wearableId, wearable); |
2643 | m_scene.CommsManager.AvatarService.UpdateUserAppearance(m_controllingClient.AgentId, m_appearance); | 2661 | AvatarData adata = new AvatarData(m_appearance); |
2662 | m_scene.AvatarService.SetAvatar(m_controllingClient.AgentId, adata); | ||
2644 | m_controllingClient.SendWearables(m_appearance.Wearables, m_appearance.Serial++); | 2663 | m_controllingClient.SendWearables(m_appearance.Wearables, m_appearance.Serial++); |
2645 | } | 2664 | } |
2646 | 2665 | ||
@@ -2963,11 +2982,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
2963 | // For now, assign god level 200 to anyone | 2982 | // For now, assign god level 200 to anyone |
2964 | // who is granted god powers, but has no god level set. | 2983 | // who is granted god powers, but has no god level set. |
2965 | // | 2984 | // |
2966 | CachedUserInfo profile = m_scene.CommsManager.UserProfileCacheService.GetUserDetails(agentID); | 2985 | UserAccount account = m_scene.UserAccountService.GetUserAccount(m_scene.RegionInfo.ScopeID, agentID); |
2967 | if (profile.UserProfile.GodLevel > 0) | 2986 | if (account != null) |
2968 | m_godlevel = profile.UserProfile.GodLevel; | 2987 | { |
2969 | else | 2988 | if (account.UserLevel > 0) |
2970 | m_godlevel = 200; | 2989 | m_godlevel = account.UserLevel; |
2990 | else | ||
2991 | m_godlevel = 200; | ||
2992 | } | ||
2971 | } | 2993 | } |
2972 | else | 2994 | else |
2973 | { | 2995 | { |
@@ -3033,7 +3055,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3033 | public void CopyTo(AgentData cAgent) | 3055 | public void CopyTo(AgentData cAgent) |
3034 | { | 3056 | { |
3035 | cAgent.AgentID = UUID; | 3057 | cAgent.AgentID = UUID; |
3036 | cAgent.RegionHandle = m_rootRegionHandle; | 3058 | cAgent.RegionID = Scene.RegionInfo.RegionID; |
3037 | 3059 | ||
3038 | cAgent.Position = AbsolutePosition; | 3060 | cAgent.Position = AbsolutePosition; |
3039 | cAgent.Velocity = m_velocity; | 3061 | cAgent.Velocity = m_velocity; |
@@ -3132,7 +3154,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3132 | 3154 | ||
3133 | public void CopyFrom(AgentData cAgent) | 3155 | public void CopyFrom(AgentData cAgent) |
3134 | { | 3156 | { |
3135 | m_rootRegionHandle = cAgent.RegionHandle; | 3157 | m_originRegionID = cAgent.RegionID; |
3136 | 3158 | ||
3137 | m_callbackURI = cAgent.CallbackURI; | 3159 | m_callbackURI = cAgent.CallbackURI; |
3138 | 3160 | ||
@@ -3490,36 +3512,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
3490 | } | 3512 | } |
3491 | } | 3513 | } |
3492 | 3514 | ||
3493 | public bool CrossAttachmentsIntoNewRegion(ulong regionHandle, bool silent) | ||
3494 | { | ||
3495 | lock (m_attachments) | ||
3496 | { | ||
3497 | // Validate | ||
3498 | foreach (SceneObjectGroup gobj in m_attachments) | ||
3499 | { | ||
3500 | if (gobj == null || gobj.IsDeleted) | ||
3501 | return false; | ||
3502 | } | ||
3503 | |||
3504 | foreach (SceneObjectGroup gobj in m_attachments) | ||
3505 | { | ||
3506 | // If the prim group is null then something must have happened to it! | ||
3507 | if (gobj != null && gobj.RootPart != null) | ||
3508 | { | ||
3509 | // Set the parent localID to 0 so it transfers over properly. | ||
3510 | gobj.RootPart.SetParentLocalId(0); | ||
3511 | gobj.AbsolutePosition = gobj.RootPart.AttachedPos; | ||
3512 | gobj.RootPart.IsAttachment = false; | ||
3513 | //gobj.RootPart.LastOwnerID = gobj.GetFromAssetID(); | ||
3514 | m_log.DebugFormat("[ATTACHMENT]: Sending attachment {0} to region {1}", gobj.UUID, regionHandle); | ||
3515 | m_scene.CrossPrimGroupIntoNewRegion(regionHandle, gobj, silent); | ||
3516 | } | ||
3517 | } | ||
3518 | m_attachments.Clear(); | ||
3519 | |||
3520 | return true; | ||
3521 | } | ||
3522 | } | ||
3523 | 3515 | ||
3524 | public void initializeScenePresence(IClientAPI client, RegionInfo region, Scene scene) | 3516 | public void initializeScenePresence(IClientAPI client, RegionInfo region, Scene scene) |
3525 | { | 3517 | { |
diff --git a/OpenSim/Region/Framework/Scenes/SceneViewer.cs b/OpenSim/Region/Framework/Scenes/SceneViewer.cs index e4296ef..c6cf4cc 100644 --- a/OpenSim/Region/Framework/Scenes/SceneViewer.cs +++ b/OpenSim/Region/Framework/Scenes/SceneViewer.cs | |||
@@ -31,7 +31,6 @@ using OpenMetaverse; | |||
31 | using log4net; | 31 | using log4net; |
32 | using OpenSim.Framework; | 32 | using OpenSim.Framework; |
33 | using OpenSim.Framework.Client; | 33 | using OpenSim.Framework.Client; |
34 | using OpenSim.Framework.Communications.Cache; | ||
35 | using OpenSim.Region.Framework.Interfaces; | 34 | using OpenSim.Region.Framework.Interfaces; |
36 | using OpenSim.Region.Framework.Scenes.Types; | 35 | using OpenSim.Region.Framework.Scenes.Types; |
37 | 36 | ||
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs index 0ed00de..b775d27 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs | |||
@@ -32,8 +32,7 @@ using NUnit.Framework.SyntaxHelpers; | |||
32 | using OpenMetaverse; | 32 | using OpenMetaverse; |
33 | using OpenSim.Framework; | 33 | using OpenSim.Framework; |
34 | using OpenSim.Framework.Communications; | 34 | using OpenSim.Framework.Communications; |
35 | using OpenSim.Framework.Communications.Cache; | 35 | |
36 | using OpenSim.Region.Communications.Local; | ||
37 | using OpenSim.Region.Framework.Scenes; | 36 | using OpenSim.Region.Framework.Scenes; |
38 | using OpenSim.Tests.Common; | 37 | using OpenSim.Tests.Common; |
39 | using OpenSim.Tests.Common.Mock; | 38 | using OpenSim.Tests.Common.Mock; |
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs index 709cca2..0b7608d 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs | |||
@@ -32,8 +32,7 @@ using NUnit.Framework.SyntaxHelpers; | |||
32 | using OpenMetaverse; | 32 | using OpenMetaverse; |
33 | using OpenSim.Framework; | 33 | using OpenSim.Framework; |
34 | using OpenSim.Framework.Communications; | 34 | using OpenSim.Framework.Communications; |
35 | using OpenSim.Framework.Communications.Cache; | 35 | |
36 | using OpenSim.Region.Communications.Local; | ||
37 | using OpenSim.Region.Framework.Scenes; | 36 | using OpenSim.Region.Framework.Scenes; |
38 | using OpenSim.Tests.Common; | 37 | using OpenSim.Tests.Common; |
39 | using OpenSim.Tests.Common.Mock; | 38 | using OpenSim.Tests.Common.Mock; |
diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs index f00dd66..501207e 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs | |||
@@ -40,8 +40,8 @@ using OpenSim.Framework; | |||
40 | using OpenSim.Framework.Communications; | 40 | using OpenSim.Framework.Communications; |
41 | using OpenSim.Region.Framework.Scenes; | 41 | using OpenSim.Region.Framework.Scenes; |
42 | using OpenSim.Region.Framework.Interfaces; | 42 | using OpenSim.Region.Framework.Interfaces; |
43 | using OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion; | ||
44 | using OpenSim.Region.CoreModules.World.Serialiser; | 43 | using OpenSim.Region.CoreModules.World.Serialiser; |
44 | using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation; | ||
45 | using OpenSim.Tests.Common; | 45 | using OpenSim.Tests.Common; |
46 | using OpenSim.Tests.Common.Mock; | 46 | using OpenSim.Tests.Common.Mock; |
47 | using OpenSim.Tests.Common.Setup; | 47 | using OpenSim.Tests.Common.Setup; |
@@ -58,7 +58,6 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
58 | public UUID agent1, agent2, agent3; | 58 | public UUID agent1, agent2, agent3; |
59 | public static Random random; | 59 | public static Random random; |
60 | public ulong region1,region2,region3; | 60 | public ulong region1,region2,region3; |
61 | public TestCommunicationsManager cm; | ||
62 | public AgentCircuitData acd1; | 61 | public AgentCircuitData acd1; |
63 | public SceneObjectGroup sog1, sog2, sog3; | 62 | public SceneObjectGroup sog1, sog2, sog3; |
64 | public TestClient testclient; | 63 | public TestClient testclient; |
@@ -66,12 +65,11 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
66 | [TestFixtureSetUp] | 65 | [TestFixtureSetUp] |
67 | public void Init() | 66 | public void Init() |
68 | { | 67 | { |
69 | cm = new TestCommunicationsManager(); | 68 | scene = SceneSetupHelpers.SetupScene("Neighbour x", UUID.Random(), 1000, 1000); |
70 | scene = SceneSetupHelpers.SetupScene("Neighbour x", UUID.Random(), 1000, 1000, cm); | 69 | scene2 = SceneSetupHelpers.SetupScene("Neighbour x+1", UUID.Random(), 1001, 1000); |
71 | scene2 = SceneSetupHelpers.SetupScene("Neighbour x+1", UUID.Random(), 1001, 1000, cm); | 70 | scene3 = SceneSetupHelpers.SetupScene("Neighbour x-1", UUID.Random(), 999, 1000); |
72 | scene3 = SceneSetupHelpers.SetupScene("Neighbour x-1", UUID.Random(), 999, 1000, cm); | ||
73 | 71 | ||
74 | ISharedRegionModule interregionComms = new RESTInterregionComms(); | 72 | ISharedRegionModule interregionComms = new LocalSimulationConnectorModule(); |
75 | interregionComms.Initialise(new IniConfigSource()); | 73 | interregionComms.Initialise(new IniConfigSource()); |
76 | interregionComms.PostInitialise(); | 74 | interregionComms.PostInitialise(); |
77 | SceneSetupHelpers.SetupSceneModules(scene, new IniConfigSource(), interregionComms); | 75 | SceneSetupHelpers.SetupSceneModules(scene, new IniConfigSource(), interregionComms); |
@@ -373,7 +371,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
373 | 371 | ||
374 | Assert.That(presence.HasAttachments(), Is.False, "Presence has attachments before cross"); | 372 | Assert.That(presence.HasAttachments(), Is.False, "Presence has attachments before cross"); |
375 | 373 | ||
376 | Assert.That(presence2.CrossAttachmentsIntoNewRegion(region1, true), Is.True, "Cross was not successful"); | 374 | //Assert.That(presence2.CrossAttachmentsIntoNewRegion(region1, true), Is.True, "Cross was not successful"); |
377 | Assert.That(presence2.HasAttachments(), Is.False, "Presence2 objects were not deleted"); | 375 | Assert.That(presence2.HasAttachments(), Is.False, "Presence2 objects were not deleted"); |
378 | Assert.That(presence.HasAttachments(), Is.True, "Presence has not received new objects"); | 376 | Assert.That(presence.HasAttachments(), Is.True, "Presence has not received new objects"); |
379 | } | 377 | } |
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs index 8a27b7b..c77220c 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs | |||
@@ -132,7 +132,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
132 | RegionInfo regionInfo = new RegionInfo(0,0,null,null); | 132 | RegionInfo regionInfo = new RegionInfo(0,0,null,null); |
133 | FakeStorageManager storageManager = new FakeStorageManager(); | 133 | FakeStorageManager storageManager = new FakeStorageManager(); |
134 | 134 | ||
135 | new Scene(regionInfo, null, null, null, storageManager, null, false, false, false, null, null); | 135 | new Scene(regionInfo, null, null, storageManager, null, false, false, false, null, null); |
136 | } | 136 | } |
137 | } | 137 | } |
138 | } | 138 | } |
diff --git a/OpenSim/Region/Framework/Scenes/Tests/StandaloneTeleportTests.cs b/OpenSim/Region/Framework/Scenes/Tests/StandaloneTeleportTests.cs index b46eb8e..cafe48a 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/StandaloneTeleportTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/StandaloneTeleportTests.cs | |||
@@ -34,7 +34,7 @@ using OpenMetaverse; | |||
34 | using OpenSim.Framework; | 34 | using OpenSim.Framework; |
35 | using OpenSim.Framework.Communications; | 35 | using OpenSim.Framework.Communications; |
36 | using OpenSim.Region.Framework.Interfaces; | 36 | using OpenSim.Region.Framework.Interfaces; |
37 | using OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion; | 37 | using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation; |
38 | using OpenSim.Tests.Common; | 38 | using OpenSim.Tests.Common; |
39 | using OpenSim.Tests.Common.Mock; | 39 | using OpenSim.Tests.Common.Mock; |
40 | using OpenSim.Tests.Common.Setup; | 40 | using OpenSim.Tests.Common.Setup; |
@@ -113,17 +113,16 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
113 | 113 | ||
114 | UUID sceneAId = UUID.Parse("00000000-0000-0000-0000-000000000100"); | 114 | UUID sceneAId = UUID.Parse("00000000-0000-0000-0000-000000000100"); |
115 | UUID sceneBId = UUID.Parse("00000000-0000-0000-0000-000000000200"); | 115 | UUID sceneBId = UUID.Parse("00000000-0000-0000-0000-000000000200"); |
116 | TestCommunicationsManager cm = new TestCommunicationsManager(); | ||
117 | 116 | ||
118 | // shared module | 117 | // shared module |
119 | ISharedRegionModule interregionComms = new RESTInterregionComms(); | 118 | ISharedRegionModule interregionComms = new LocalSimulationConnectorModule(); |
120 | 119 | ||
121 | 120 | ||
122 | Scene sceneB = SceneSetupHelpers.SetupScene("sceneB", sceneBId, 1010, 1010, cm, "grid"); | 121 | Scene sceneB = SceneSetupHelpers.SetupScene("sceneB", sceneBId, 1010, 1010, "grid"); |
123 | SceneSetupHelpers.SetupSceneModules(sceneB, new IniConfigSource(), interregionComms); | 122 | SceneSetupHelpers.SetupSceneModules(sceneB, new IniConfigSource(), interregionComms); |
124 | sceneB.RegisterRegionWithGrid(); | 123 | sceneB.RegisterRegionWithGrid(); |
125 | 124 | ||
126 | Scene sceneA = SceneSetupHelpers.SetupScene("sceneA", sceneAId, 1000, 1000, cm, "grid"); | 125 | Scene sceneA = SceneSetupHelpers.SetupScene("sceneA", sceneAId, 1000, 1000, "grid"); |
127 | SceneSetupHelpers.SetupSceneModules(sceneA, new IniConfigSource(), interregionComms); | 126 | SceneSetupHelpers.SetupSceneModules(sceneA, new IniConfigSource(), interregionComms); |
128 | sceneA.RegisterRegionWithGrid(); | 127 | sceneA.RegisterRegionWithGrid(); |
129 | 128 | ||