diff options
Merge branch 'master' into careminster-presence-refactor
Diffstat (limited to 'OpenSim/Region/CoreModules')
19 files changed, 564 insertions, 99 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Combat/CombatModule.cs b/OpenSim/Region/CoreModules/Avatar/Combat/CombatModule.cs index a895d6e..032e55a 100644 --- a/OpenSim/Region/CoreModules/Avatar/Combat/CombatModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Combat/CombatModule.cs | |||
@@ -93,7 +93,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Combat.CombatModule | |||
93 | { | 93 | { |
94 | string deadAvatarMessage; | 94 | string deadAvatarMessage; |
95 | ScenePresence killingAvatar = null; | 95 | ScenePresence killingAvatar = null; |
96 | string killingAvatarMessage; | 96 | // string killingAvatarMessage; |
97 | 97 | ||
98 | if (killerObjectLocalID == 0) | 98 | if (killerObjectLocalID == 0) |
99 | deadAvatarMessage = "You committed suicide!"; | 99 | deadAvatarMessage = "You committed suicide!"; |
@@ -118,14 +118,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Combat.CombatModule | |||
118 | deadAvatarMessage = String.Format("You impaled yourself on {0} owned by {1}!", part.Name, deadAvatar.Scene.GetUserName(part.OwnerID)); | 118 | deadAvatarMessage = String.Format("You impaled yourself on {0} owned by {1}!", part.Name, deadAvatar.Scene.GetUserName(part.OwnerID)); |
119 | else | 119 | else |
120 | { | 120 | { |
121 | killingAvatarMessage = String.Format("You fragged {0}!", deadAvatar.Name); | 121 | // killingAvatarMessage = String.Format("You fragged {0}!", deadAvatar.Name); |
122 | deadAvatarMessage = String.Format("You got killed by {0}!", killingAvatar.Name); | 122 | deadAvatarMessage = String.Format("You got killed by {0}!", killingAvatar.Name); |
123 | } | 123 | } |
124 | } | 124 | } |
125 | } | 125 | } |
126 | else | 126 | else |
127 | { | 127 | { |
128 | killingAvatarMessage = String.Format("You fragged {0}!", deadAvatar.Name); | 128 | // killingAvatarMessage = String.Format("You fragged {0}!", deadAvatar.Name); |
129 | deadAvatarMessage = String.Format("You got killed by {0}!", killingAvatar.Name); | 129 | deadAvatarMessage = String.Format("You got killed by {0}!", killingAvatar.Name); |
130 | } | 130 | } |
131 | } | 131 | } |
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs index 98545f9..4465e8a 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs | |||
@@ -82,6 +82,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer | |||
82 | scene.EventManager.OnNewClient += OnNewClient; | 82 | scene.EventManager.OnNewClient += OnNewClient; |
83 | scene.EventManager.OnClientClosed += ClientLoggedOut; | 83 | scene.EventManager.OnClientClosed += ClientLoggedOut; |
84 | scene.EventManager.OnIncomingInstantMessage += OnGridInstantMessage; | 84 | scene.EventManager.OnIncomingInstantMessage += OnGridInstantMessage; |
85 | scene.EventManager.OnSetRootAgentScene += OnSetRootAgentScene; | ||
85 | } | 86 | } |
86 | 87 | ||
87 | public void RegionLoaded(Scene scene) | 88 | public void RegionLoaded(Scene scene) |
@@ -98,9 +99,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer | |||
98 | scene.EventManager.OnNewClient -= OnNewClient; | 99 | scene.EventManager.OnNewClient -= OnNewClient; |
99 | scene.EventManager.OnClientClosed -= ClientLoggedOut; | 100 | scene.EventManager.OnClientClosed -= ClientLoggedOut; |
100 | scene.EventManager.OnIncomingInstantMessage -= OnGridInstantMessage; | 101 | scene.EventManager.OnIncomingInstantMessage -= OnGridInstantMessage; |
102 | scene.EventManager.OnSetRootAgentScene -= OnSetRootAgentScene; | ||
101 | } | 103 | } |
102 | } | 104 | } |
103 | |||
104 | } | 105 | } |
105 | 106 | ||
106 | public void RemoveRegion(Scene scene) | 107 | public void RemoveRegion(Scene scene) |
@@ -108,6 +109,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer | |||
108 | scene.EventManager.OnNewClient -= OnNewClient; | 109 | scene.EventManager.OnNewClient -= OnNewClient; |
109 | scene.EventManager.OnClientClosed -= ClientLoggedOut; | 110 | scene.EventManager.OnClientClosed -= ClientLoggedOut; |
110 | scene.EventManager.OnIncomingInstantMessage -= OnGridInstantMessage; | 111 | scene.EventManager.OnIncomingInstantMessage -= OnGridInstantMessage; |
112 | scene.EventManager.OnSetRootAgentScene -= OnSetRootAgentScene; | ||
111 | m_Scenelist.Remove(scene); | 113 | m_Scenelist.Remove(scene); |
112 | } | 114 | } |
113 | 115 | ||
@@ -136,6 +138,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer | |||
136 | // Inventory giving is conducted via instant message | 138 | // Inventory giving is conducted via instant message |
137 | client.OnInstantMessage += OnInstantMessage; | 139 | client.OnInstantMessage += OnInstantMessage; |
138 | } | 140 | } |
141 | |||
142 | protected void OnSetRootAgentScene(UUID id, Scene scene) | ||
143 | { | ||
144 | m_AgentRegions[id] = scene; | ||
145 | } | ||
139 | 146 | ||
140 | private Scene FindClientScene(UUID agentId) | 147 | private Scene FindClientScene(UUID agentId) |
141 | { | 148 | { |
@@ -160,7 +167,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer | |||
160 | if (scene == null) // Something seriously wrong here. | 167 | if (scene == null) // Something seriously wrong here. |
161 | return; | 168 | return; |
162 | 169 | ||
163 | |||
164 | if (im.dialog == (byte) InstantMessageDialog.InventoryOffered) | 170 | if (im.dialog == (byte) InstantMessageDialog.InventoryOffered) |
165 | { | 171 | { |
166 | //m_log.DebugFormat("Asset type {0}", ((AssetType)im.binaryBucket[0])); | 172 | //m_log.DebugFormat("Asset type {0}", ((AssetType)im.binaryBucket[0])); |
@@ -348,11 +354,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer | |||
348 | } | 354 | } |
349 | } | 355 | } |
350 | 356 | ||
351 | public void SetRootAgentScene(UUID agentID, Scene scene) | ||
352 | { | ||
353 | m_AgentRegions[agentID] = scene; | ||
354 | } | ||
355 | |||
356 | public bool NeedSceneCacheClear(UUID agentID, Scene scene) | 357 | public bool NeedSceneCacheClear(UUID agentID, Scene scene) |
357 | { | 358 | { |
358 | if (!m_AgentRegions.ContainsKey(agentID)) | 359 | if (!m_AgentRegions.ContainsKey(agentID)) |
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index 1d1a0a1..0ba67d3 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs | |||
@@ -1,4 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://opensimulator.org/ | 2 | * Copyright (c) Contributors, http://opensimulator.org/ |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
@@ -174,9 +174,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
174 | position.Z = newPosZ; | 174 | position.Z = newPosZ; |
175 | } | 175 | } |
176 | 176 | ||
177 | // Only send this if the event queue is null | 177 | sp.ControllingClient.SendTeleportStart(teleportFlags); |
178 | if (eq == null) | ||
179 | sp.ControllingClient.SendTeleportLocationStart(); | ||
180 | 178 | ||
181 | sp.ControllingClient.SendLocalTeleport(position, lookAt, teleportFlags); | 179 | sp.ControllingClient.SendLocalTeleport(position, lookAt, teleportFlags); |
182 | sp.Teleport(position); | 180 | sp.Teleport(position); |
@@ -257,9 +255,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
257 | 255 | ||
258 | ulong destinationHandle = finalDestination.RegionHandle; | 256 | ulong destinationHandle = finalDestination.RegionHandle; |
259 | 257 | ||
260 | if (eq == null) | ||
261 | sp.ControllingClient.SendTeleportLocationStart(); | ||
262 | |||
263 | // Let's do DNS resolution only once in this process, please! | 258 | // Let's do DNS resolution only once in this process, please! |
264 | // This may be a costly operation. The reg.ExternalEndPoint field is not a passive field, | 259 | // This may be a costly operation. The reg.ExternalEndPoint field is not a passive field, |
265 | // it's actually doing a lot of work. | 260 | // it's actually doing a lot of work. |
@@ -277,6 +272,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
277 | return; | 272 | return; |
278 | } | 273 | } |
279 | 274 | ||
275 | sp.ControllingClient.SendTeleportStart(teleportFlags); | ||
276 | |||
280 | // the avatar.Close below will clear the child region list. We need this below for (possibly) | 277 | // the avatar.Close below will clear the child region list. We need this below for (possibly) |
281 | // closing the child agents, so save it here (we need a copy as it is Clear()-ed). | 278 | // closing the child agents, so save it here (we need a copy as it is Clear()-ed). |
282 | //List<ulong> childRegions = new List<ulong>(avatar.GetKnownRegionList()); | 279 | //List<ulong> childRegions = new List<ulong>(avatar.GetKnownRegionList()); |
@@ -307,7 +304,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
307 | string reason = String.Empty; | 304 | string reason = String.Empty; |
308 | 305 | ||
309 | // Let's create an agent there if one doesn't exist yet. | 306 | // Let's create an agent there if one doesn't exist yet. |
310 | if (!CreateAgent(sp, reg, finalDestination, agentCircuit, teleportFlags, out reason)) | 307 | bool logout = false; |
308 | if (!CreateAgent(sp, reg, finalDestination, agentCircuit, teleportFlags, out reason, out logout)) | ||
311 | { | 309 | { |
312 | sp.ControllingClient.SendTeleportFailed(String.Format("Destination refused: {0}", | 310 | sp.ControllingClient.SendTeleportFailed(String.Format("Destination refused: {0}", |
313 | reason)); | 311 | reason)); |
@@ -319,6 +317,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
319 | 317 | ||
320 | if (NeedsNewAgent(oldRegionX, newRegionX, oldRegionY, newRegionY)) | 318 | if (NeedsNewAgent(oldRegionX, newRegionX, oldRegionY, newRegionY)) |
321 | { | 319 | { |
320 | //sp.ControllingClient.SendTeleportProgress(teleportFlags, "Creating agent..."); | ||
321 | |||
322 | #region IP Translation for NAT | 322 | #region IP Translation for NAT |
323 | IClientIPEndpoint ipepClient; | 323 | IClientIPEndpoint ipepClient; |
324 | if (sp.ClientView.TryGet(out ipepClient)) | 324 | if (sp.ClientView.TryGet(out ipepClient)) |
@@ -396,6 +396,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
396 | agent.Position = position; | 396 | agent.Position = position; |
397 | SetCallbackURL(agent, sp.Scene.RegionInfo); | 397 | SetCallbackURL(agent, sp.Scene.RegionInfo); |
398 | 398 | ||
399 | //sp.ControllingClient.SendTeleportProgress(teleportFlags, "Updating agent..."); | ||
400 | |||
399 | if (!UpdateAgent(reg, finalDestination, agent)) | 401 | if (!UpdateAgent(reg, finalDestination, agent)) |
400 | { | 402 | { |
401 | // Region doesn't take it | 403 | // Region doesn't take it |
@@ -434,8 +436,13 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
434 | // CrossAttachmentsIntoNewRegion is a synchronous call. We shouldn't need to wait after it | 436 | // CrossAttachmentsIntoNewRegion is a synchronous call. We shouldn't need to wait after it |
435 | CrossAttachmentsIntoNewRegion(finalDestination, sp, true); | 437 | CrossAttachmentsIntoNewRegion(finalDestination, sp, true); |
436 | 438 | ||
439 | // Well, this is it. The agent is over there. | ||
440 | |||
437 | KillEntity(sp.Scene, sp.LocalId); | 441 | KillEntity(sp.Scene, sp.LocalId); |
438 | 442 | ||
443 | // May need to logout or other cleanup | ||
444 | AgentHasMovedAway(sp.ControllingClient.SessionId, logout); | ||
445 | |||
439 | // Now let's make it officially a child agent | 446 | // Now let's make it officially a child agent |
440 | sp.MakeChildAgent(); | 447 | sp.MakeChildAgent(); |
441 | 448 | ||
@@ -483,8 +490,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
483 | 490 | ||
484 | } | 491 | } |
485 | 492 | ||
486 | protected virtual bool CreateAgent(ScenePresence sp, GridRegion reg, GridRegion finalDestination, AgentCircuitData agentCircuit, uint teleportFlags, out string reason) | 493 | protected virtual bool CreateAgent(ScenePresence sp, GridRegion reg, GridRegion finalDestination, AgentCircuitData agentCircuit, uint teleportFlags, out string reason, out bool logout) |
487 | { | 494 | { |
495 | logout = false; | ||
488 | return m_aScene.SimulationService.CreateAgent(finalDestination, agentCircuit, teleportFlags, out reason); | 496 | return m_aScene.SimulationService.CreateAgent(finalDestination, agentCircuit, teleportFlags, out reason); |
489 | } | 497 | } |
490 | 498 | ||
@@ -500,6 +508,10 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
500 | 508 | ||
501 | } | 509 | } |
502 | 510 | ||
511 | protected virtual void AgentHasMovedAway(UUID sessionID, bool logout) | ||
512 | { | ||
513 | } | ||
514 | |||
503 | protected void KillEntity(Scene scene, uint localID) | 515 | protected void KillEntity(Scene scene, uint localID) |
504 | { | 516 | { |
505 | scene.SendKillObject(localID); | 517 | scene.SendKillObject(localID); |
@@ -1286,18 +1298,18 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1286 | return handles; | 1298 | return handles; |
1287 | } | 1299 | } |
1288 | 1300 | ||
1289 | private void Dump(string msg, List<ulong> handles) | 1301 | // private void Dump(string msg, List<ulong> handles) |
1290 | { | 1302 | // { |
1291 | m_log.InfoFormat("-------------- HANDLE DUMP ({0}) ---------", msg); | 1303 | // m_log.InfoFormat("-------------- HANDLE DUMP ({0}) ---------", msg); |
1292 | foreach (ulong handle in handles) | 1304 | // foreach (ulong handle in handles) |
1293 | { | 1305 | // { |
1294 | uint x, y; | 1306 | // uint x, y; |
1295 | Utils.LongToUInts(handle, out x, out y); | 1307 | // Utils.LongToUInts(handle, out x, out y); |
1296 | x = x / Constants.RegionSize; | 1308 | // x = x / Constants.RegionSize; |
1297 | y = y / Constants.RegionSize; | 1309 | // y = y / Constants.RegionSize; |
1298 | m_log.InfoFormat("({0}, {1})", x, y); | 1310 | // m_log.InfoFormat("({0}, {1})", x, y); |
1299 | } | 1311 | // } |
1300 | } | 1312 | // } |
1301 | 1313 | ||
1302 | #endregion | 1314 | #endregion |
1303 | 1315 | ||
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs index 7d26e3f..1ac7508 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs | |||
@@ -140,9 +140,17 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
140 | return false; | 140 | return false; |
141 | } | 141 | } |
142 | 142 | ||
143 | protected override bool CreateAgent(ScenePresence sp, GridRegion reg, GridRegion finalDestination, AgentCircuitData agentCircuit, uint teleportFlags, out string reason) | 143 | protected override void AgentHasMovedAway(UUID sessionID, bool logout) |
144 | { | ||
145 | if (logout) | ||
146 | // Log them out of this grid | ||
147 | m_aScene.PresenceService.LogoutAgent(sessionID); | ||
148 | } | ||
149 | |||
150 | protected override bool CreateAgent(ScenePresence sp, GridRegion reg, GridRegion finalDestination, AgentCircuitData agentCircuit, uint teleportFlags, out string reason, out bool logout) | ||
144 | { | 151 | { |
145 | reason = string.Empty; | 152 | reason = string.Empty; |
153 | logout = false; | ||
146 | int flags = m_aScene.GridService.GetRegionFlags(m_aScene.RegionInfo.ScopeID, reg.RegionID); | 154 | int flags = m_aScene.GridService.GetRegionFlags(m_aScene.RegionInfo.ScopeID, reg.RegionID); |
147 | if (flags == -1 /* no region in DB */ || (flags & (int)OpenSim.Data.RegionFlags.Hyperlink) != 0) | 155 | if (flags == -1 /* no region in DB */ || (flags & (int)OpenSim.Data.RegionFlags.Hyperlink) != 0) |
148 | { | 156 | { |
@@ -152,9 +160,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
152 | string userAgentDriver = agentCircuit.ServiceURLs["HomeURI"].ToString(); | 160 | string userAgentDriver = agentCircuit.ServiceURLs["HomeURI"].ToString(); |
153 | IUserAgentService connector = new UserAgentServiceConnector(userAgentDriver); | 161 | IUserAgentService connector = new UserAgentServiceConnector(userAgentDriver); |
154 | bool success = connector.LoginAgentToGrid(agentCircuit, reg, finalDestination, out reason); | 162 | bool success = connector.LoginAgentToGrid(agentCircuit, reg, finalDestination, out reason); |
155 | if (success) | 163 | logout = success; // flag for later logout from this grid; this is an HG TP |
156 | // Log them out of this grid | ||
157 | m_aScene.PresenceService.LogoutAgent(agentCircuit.SessionID); | ||
158 | 164 | ||
159 | return success; | 165 | return success; |
160 | } | 166 | } |
diff --git a/OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueHelper.cs b/OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueHelper.cs index efa60bb..e9bcae3 100644 --- a/OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueHelper.cs +++ b/OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueHelper.cs | |||
@@ -54,12 +54,10 @@ namespace OpenSim.Region.CoreModules.Framework.EventQueue | |||
54 | } | 54 | } |
55 | 55 | ||
56 | private static byte[] uintToByteArray(uint uIntValue) | 56 | private static byte[] uintToByteArray(uint uIntValue) |
57 | { | 57 | { |
58 | byte[] resultbytes = Utils.UIntToBytes(uIntValue); | 58 | byte[] result = new byte[4]; |
59 | if (BitConverter.IsLittleEndian) | 59 | Utils.UIntToBytesBig(uIntValue, result, 0); |
60 | Array.Reverse(resultbytes); | 60 | return result; |
61 | |||
62 | return resultbytes; | ||
63 | } | 61 | } |
64 | 62 | ||
65 | public static OSD buildEvent(string eventName, OSD eventBody) | 63 | public static OSD buildEvent(string eventName, OSD eventBody) |
@@ -160,7 +158,7 @@ namespace OpenSim.Region.CoreModules.Framework.EventQueue | |||
160 | info.Add("SimAccess", OSD.FromInteger(simAccess)); | 158 | info.Add("SimAccess", OSD.FromInteger(simAccess)); |
161 | info.Add("SimIP", OSD.FromBinary(regionExternalEndPoint.Address.GetAddressBytes())); | 159 | info.Add("SimIP", OSD.FromBinary(regionExternalEndPoint.Address.GetAddressBytes())); |
162 | info.Add("SimPort", OSD.FromInteger(regionExternalEndPoint.Port)); | 160 | info.Add("SimPort", OSD.FromInteger(regionExternalEndPoint.Port)); |
163 | info.Add("TeleportFlags", OSD.FromBinary(1L << 4)); // AgentManager.TeleportFlags.ViaLocation | 161 | info.Add("TeleportFlags", OSD.FromULong(1L << 4)); // AgentManager.TeleportFlags.ViaLocation |
164 | 162 | ||
165 | OSDArray infoArr = new OSDArray(); | 163 | OSDArray infoArr = new OSDArray(); |
166 | infoArr.Add(info); | 164 | infoArr.Add(info); |
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGAssetMapper.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGAssetMapper.cs index b13b9d8..ccb892e 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGAssetMapper.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGAssetMapper.cs | |||
@@ -95,7 +95,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
95 | try | 95 | try |
96 | { | 96 | { |
97 | asset1.ID = url + "/" + asset.ID; | 97 | asset1.ID = url + "/" + asset.ID; |
98 | UUID temp = UUID.Zero; | 98 | // UUID temp = UUID.Zero; |
99 | // TODO: if the creator is local, stick this grid's URL in front | 99 | // TODO: if the creator is local, stick this grid's URL in front |
100 | //if (UUID.TryParse(asset.Metadata.CreatorID, out temp)) | 100 | //if (UUID.TryParse(asset.Metadata.CreatorID, out temp)) |
101 | // asset1.Metadata.CreatorID = ??? + "/" + asset.Metadata.CreatorID; | 101 | // asset1.Metadata.CreatorID = ??? + "/" + asset.Metadata.CreatorID; |
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs index 8ccc941..c673b31 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs | |||
@@ -1,4 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://opensimulator.org/ | 2 | * Copyright (c) Contributors, http://opensimulator.org/ |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
@@ -54,7 +54,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
54 | get { return m_assMapper; } | 54 | get { return m_assMapper; } |
55 | } | 55 | } |
56 | 56 | ||
57 | private bool m_Initialized = false; | 57 | // private bool m_Initialized = false; |
58 | 58 | ||
59 | #region INonSharedRegionModule | 59 | #region INonSharedRegionModule |
60 | 60 | ||
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs index 2517a23..cc12df0 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs | |||
@@ -1,4 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://opensimulator.org/ | 2 | * Copyright (c) Contributors, http://opensimulator.org/ |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
@@ -572,7 +572,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
572 | } | 572 | } |
573 | if (attachment) | 573 | if (attachment) |
574 | { | 574 | { |
575 | group.RootPart.ObjectFlags |= (uint)PrimFlags.Phantom; | 575 | group.RootPart.Flags |= PrimFlags.Phantom; |
576 | group.RootPart.IsAttachment = true; | 576 | group.RootPart.IsAttachment = true; |
577 | } | 577 | } |
578 | 578 | ||
diff --git a/OpenSim/Region/CoreModules/Framework/Library/LibraryModule.cs b/OpenSim/Region/CoreModules/Framework/Library/LibraryModule.cs index 9c20d68..d570608 100644 --- a/OpenSim/Region/CoreModules/Framework/Library/LibraryModule.cs +++ b/OpenSim/Region/CoreModules/Framework/Library/LibraryModule.cs | |||
@@ -51,7 +51,7 @@ namespace OpenSim.Region.CoreModules.Framework.Library | |||
51 | private static bool m_HasRunOnce = false; | 51 | private static bool m_HasRunOnce = false; |
52 | 52 | ||
53 | private bool m_Enabled = false; | 53 | private bool m_Enabled = false; |
54 | private string m_LibraryName = "OpenSim Library"; | 54 | // private string m_LibraryName = "OpenSim Library"; |
55 | private Scene m_Scene; | 55 | private Scene m_Scene; |
56 | 56 | ||
57 | private ILibraryService m_Library; | 57 | private ILibraryService m_Library; |
@@ -212,13 +212,13 @@ namespace OpenSim.Region.CoreModules.Framework.Library | |||
212 | } | 212 | } |
213 | } | 213 | } |
214 | 214 | ||
215 | private void DumpLibrary() | 215 | // private void DumpLibrary() |
216 | { | 216 | // { |
217 | InventoryFolderImpl lib = m_Library.LibraryRootFolder; | 217 | // InventoryFolderImpl lib = m_Library.LibraryRootFolder; |
218 | 218 | // | |
219 | m_log.DebugFormat(" - folder {0}", lib.Name); | 219 | // m_log.DebugFormat(" - folder {0}", lib.Name); |
220 | DumpFolder(lib); | 220 | // DumpFolder(lib); |
221 | } | 221 | // } |
222 | // | 222 | // |
223 | // private void DumpLibrary() | 223 | // private void DumpLibrary() |
224 | // { | 224 | // { |
diff --git a/OpenSim/Region/CoreModules/Framework/Statistics/Logging/BinaryLoggingModule.cs b/OpenSim/Region/CoreModules/Framework/Statistics/Logging/BinaryLoggingModule.cs new file mode 100644 index 0000000..b75a700 --- /dev/null +++ b/OpenSim/Region/CoreModules/Framework/Statistics/Logging/BinaryLoggingModule.cs | |||
@@ -0,0 +1,169 @@ | |||
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.IO; | ||
31 | using System.Reflection; | ||
32 | using log4net; | ||
33 | using Mono.Addins; | ||
34 | using Nini.Config; | ||
35 | using OpenMetaverse; | ||
36 | using OpenMetaverse.Packets; | ||
37 | using OpenSim.Framework; | ||
38 | using OpenSim.Region.Framework; | ||
39 | using OpenSim.Region.Framework.Interfaces; | ||
40 | using OpenSim.Region.Framework.Scenes; | ||
41 | |||
42 | namespace OpenSim.Region.CoreModules.Avatar.Attachments | ||
43 | { | ||
44 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "BinaryLoggingModule")] | ||
45 | public class BinaryLoggingModule : INonSharedRegionModule | ||
46 | { | ||
47 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
48 | |||
49 | protected bool m_collectStats; | ||
50 | protected Scene m_scene = null; | ||
51 | |||
52 | public string Name { get { return "Binary Statistics Logging Module"; } } | ||
53 | public Type ReplaceableInterface { get { return null; } } | ||
54 | |||
55 | public void Initialise(IConfigSource source) | ||
56 | { | ||
57 | try | ||
58 | { | ||
59 | IConfig statConfig = source.Configs["Statistics.Binary"]; | ||
60 | if (statConfig.Contains("enabled") && statConfig.GetBoolean("enabled")) | ||
61 | { | ||
62 | if (statConfig.Contains("collect_region_stats")) | ||
63 | { | ||
64 | if (statConfig.GetBoolean("collect_region_stats")) | ||
65 | { | ||
66 | m_collectStats = true; | ||
67 | } | ||
68 | } | ||
69 | if (statConfig.Contains("region_stats_period_seconds")) | ||
70 | { | ||
71 | m_statLogPeriod = TimeSpan.FromSeconds(statConfig.GetInt("region_stats_period_seconds")); | ||
72 | } | ||
73 | if (statConfig.Contains("stats_dir")) | ||
74 | { | ||
75 | m_statsDir = statConfig.GetString("stats_dir"); | ||
76 | } | ||
77 | } | ||
78 | } | ||
79 | catch | ||
80 | { | ||
81 | // if it doesn't work, we don't collect anything | ||
82 | } | ||
83 | } | ||
84 | |||
85 | public void AddRegion(Scene scene) | ||
86 | { | ||
87 | m_scene = scene; | ||
88 | } | ||
89 | |||
90 | public void RemoveRegion(Scene scene) | ||
91 | { | ||
92 | } | ||
93 | |||
94 | public void RegionLoaded(Scene scene) | ||
95 | { | ||
96 | if (m_collectStats) | ||
97 | m_scene.StatsReporter.OnSendStatsResult += LogSimStats; | ||
98 | } | ||
99 | |||
100 | public void Close() | ||
101 | { | ||
102 | } | ||
103 | |||
104 | public class StatLogger | ||
105 | { | ||
106 | public DateTime StartTime; | ||
107 | public string Path; | ||
108 | public System.IO.BinaryWriter Log; | ||
109 | } | ||
110 | |||
111 | static StatLogger m_statLog = null; | ||
112 | static TimeSpan m_statLogPeriod = TimeSpan.FromSeconds(300); | ||
113 | static string m_statsDir = String.Empty; | ||
114 | static Object m_statLockObject = new Object(); | ||
115 | |||
116 | private void LogSimStats(SimStats stats) | ||
117 | { | ||
118 | SimStatsPacket pack = new SimStatsPacket(); | ||
119 | pack.Region = new SimStatsPacket.RegionBlock(); | ||
120 | pack.Region.RegionX = stats.RegionX; | ||
121 | pack.Region.RegionY = stats.RegionY; | ||
122 | pack.Region.RegionFlags = stats.RegionFlags; | ||
123 | pack.Region.ObjectCapacity = stats.ObjectCapacity; | ||
124 | //pack.Region = //stats.RegionBlock; | ||
125 | pack.Stat = stats.StatsBlock; | ||
126 | pack.Header.Reliable = false; | ||
127 | |||
128 | // note that we are inside the reporter lock when called | ||
129 | DateTime now = DateTime.Now; | ||
130 | |||
131 | // hide some time information into the packet | ||
132 | pack.Header.Sequence = (uint)now.Ticks; | ||
133 | |||
134 | lock (m_statLockObject) // m_statLog is shared so make sure there is only executer here | ||
135 | { | ||
136 | try | ||
137 | { | ||
138 | if (m_statLog == null || now > m_statLog.StartTime + m_statLogPeriod) | ||
139 | { | ||
140 | // First log file or time has expired, start writing to a new log file | ||
141 | if (m_statLog != null && m_statLog.Log != null) | ||
142 | { | ||
143 | m_statLog.Log.Close(); | ||
144 | } | ||
145 | m_statLog = new StatLogger(); | ||
146 | m_statLog.StartTime = now; | ||
147 | m_statLog.Path = (m_statsDir.Length > 0 ? m_statsDir + System.IO.Path.DirectorySeparatorChar.ToString() : "") | ||
148 | + String.Format("stats-{0}.log", now.ToString("yyyyMMddHHmmss")); | ||
149 | m_statLog.Log = new BinaryWriter(File.Open(m_statLog.Path, FileMode.Append, FileAccess.Write)); | ||
150 | } | ||
151 | |||
152 | // Write the serialized data to disk | ||
153 | if (m_statLog != null && m_statLog.Log != null) | ||
154 | m_statLog.Log.Write(pack.ToBytes()); | ||
155 | } | ||
156 | catch (Exception ex) | ||
157 | { | ||
158 | m_log.Error("statistics gathering failed: " + ex.Message, ex); | ||
159 | if (m_statLog != null && m_statLog.Log != null) | ||
160 | { | ||
161 | m_statLog.Log.Close(); | ||
162 | } | ||
163 | m_statLog = null; | ||
164 | } | ||
165 | } | ||
166 | return; | ||
167 | } | ||
168 | } | ||
169 | } | ||
diff --git a/OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs b/OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs index e95d2f8..87a0a8d 100644 --- a/OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs +++ b/OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs | |||
@@ -91,7 +91,7 @@ namespace OpenSim.Region.CoreModules.InterGrid | |||
91 | private string httpsCN = ""; | 91 | private string httpsCN = ""; |
92 | private bool httpSSL = false; | 92 | private bool httpSSL = false; |
93 | private uint httpsslport = 0; | 93 | private uint httpsslport = 0; |
94 | private bool GridMode = false; | 94 | // private bool GridMode = false; |
95 | 95 | ||
96 | #region IRegionModule Members | 96 | #region IRegionModule Members |
97 | 97 | ||
@@ -126,10 +126,10 @@ namespace OpenSim.Region.CoreModules.InterGrid | |||
126 | 126 | ||
127 | } | 127 | } |
128 | 128 | ||
129 | if (startupcfg != null) | 129 | // if (startupcfg != null) |
130 | { | 130 | // { |
131 | GridMode = enabled = startupcfg.GetBoolean("gridmode", false); | 131 | // GridMode = enabled = startupcfg.GetBoolean("gridmode", false); |
132 | } | 132 | // } |
133 | 133 | ||
134 | if (cfg != null) | 134 | if (cfg != null) |
135 | { | 135 | { |
@@ -1213,18 +1213,19 @@ namespace OpenSim.Region.CoreModules.InterGrid | |||
1213 | } | 1213 | } |
1214 | } | 1214 | } |
1215 | 1215 | ||
1216 | private string CreateRandomStr(int len) | 1216 | // private string CreateRandomStr(int len) |
1217 | { | 1217 | // { |
1218 | Random rnd = new Random(Environment.TickCount); | 1218 | // Random rnd = new Random(Environment.TickCount); |
1219 | string returnstring = ""; | 1219 | // string returnstring = ""; |
1220 | string chars = "abcdefghijklmnopqrstuvwxyz0123456789"; | 1220 | // string chars = "abcdefghijklmnopqrstuvwxyz0123456789"; |
1221 | 1221 | // | |
1222 | for (int i = 0; i < len; i++) | 1222 | // for (int i = 0; i < len; i++) |
1223 | { | 1223 | // { |
1224 | returnstring += chars.Substring(rnd.Next(chars.Length), 1); | 1224 | // returnstring += chars.Substring(rnd.Next(chars.Length), 1); |
1225 | } | 1225 | // } |
1226 | return returnstring; | 1226 | // return returnstring; |
1227 | } | 1227 | // } |
1228 | |||
1228 | // Temporary hack to allow teleporting to and from Vaak | 1229 | // Temporary hack to allow teleporting to and from Vaak |
1229 | private static bool customXertificateValidation(object sender, X509Certificate cert, X509Chain chain, SslPolicyErrors error) | 1230 | private static bool customXertificateValidation(object sender, X509Certificate cert, X509Chain chain, SslPolicyErrors error) |
1230 | { | 1231 | { |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteInventoryServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteInventoryServiceConnector.cs index aa3b30d..153aeec 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteInventoryServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteInventoryServiceConnector.cs | |||
@@ -32,7 +32,6 @@ using System.Reflection; | |||
32 | using Nini.Config; | 32 | using Nini.Config; |
33 | using OpenSim.Framework; | 33 | using OpenSim.Framework; |
34 | using OpenSim.Framework.Statistics; | 34 | using OpenSim.Framework.Statistics; |
35 | |||
36 | using OpenSim.Services.Connectors; | 35 | using OpenSim.Services.Connectors; |
37 | using OpenSim.Region.Framework.Interfaces; | 36 | using OpenSim.Region.Framework.Interfaces; |
38 | using OpenSim.Region.Framework.Scenes; | 37 | using OpenSim.Region.Framework.Scenes; |
@@ -48,7 +47,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory | |||
48 | 47 | ||
49 | private bool m_Enabled = false; | 48 | private bool m_Enabled = false; |
50 | private bool m_Initialized = false; | 49 | private bool m_Initialized = false; |
51 | private Scene m_Scene; | 50 | // private Scene m_Scene; |
52 | private InventoryServicesConnector m_RemoteConnector; | 51 | private InventoryServicesConnector m_RemoteConnector; |
53 | 52 | ||
54 | public Type ReplaceableInterface | 53 | public Type ReplaceableInterface |
@@ -105,7 +104,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory | |||
105 | 104 | ||
106 | public void AddRegion(Scene scene) | 105 | public void AddRegion(Scene scene) |
107 | { | 106 | { |
108 | m_Scene = scene; | 107 | // m_Scene = scene; |
109 | //m_log.Debug("[XXXX] Adding scene " + m_Scene.RegionInfo.RegionName); | 108 | //m_log.Debug("[XXXX] Adding scene " + m_Scene.RegionInfo.RegionName); |
110 | 109 | ||
111 | if (!m_Enabled) | 110 | if (!m_Enabled) |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs index 277060d..ada26cc 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs | |||
@@ -32,7 +32,6 @@ using System.Reflection; | |||
32 | using Nini.Config; | 32 | using Nini.Config; |
33 | using OpenSim.Framework; | 33 | using OpenSim.Framework; |
34 | using OpenSim.Framework.Statistics; | 34 | using OpenSim.Framework.Statistics; |
35 | |||
36 | using OpenSim.Services.Connectors; | 35 | using OpenSim.Services.Connectors; |
37 | using OpenSim.Region.Framework.Interfaces; | 36 | using OpenSim.Region.Framework.Interfaces; |
38 | using OpenSim.Region.Framework.Scenes; | 37 | using OpenSim.Region.Framework.Scenes; |
@@ -48,7 +47,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory | |||
48 | 47 | ||
49 | private bool m_Enabled = false; | 48 | private bool m_Enabled = false; |
50 | private bool m_Initialized = false; | 49 | private bool m_Initialized = false; |
51 | private Scene m_Scene; | 50 | // private Scene m_Scene; |
52 | private XInventoryServicesConnector m_RemoteConnector; | 51 | private XInventoryServicesConnector m_RemoteConnector; |
53 | 52 | ||
54 | public Type ReplaceableInterface | 53 | public Type ReplaceableInterface |
@@ -109,7 +108,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory | |||
109 | 108 | ||
110 | public void AddRegion(Scene scene) | 109 | public void AddRegion(Scene scene) |
111 | { | 110 | { |
112 | m_Scene = scene; | 111 | // m_Scene = scene; |
113 | //m_log.Debug("[XXXX] Adding scene " + m_Scene.RegionInfo.RegionName); | 112 | //m_log.Debug("[XXXX] Adding scene " + m_Scene.RegionInfo.RegionName); |
114 | 113 | ||
115 | if (!m_Enabled) | 114 | if (!m_Enabled) |
diff --git a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs index 27e492b..171e0b9 100644 --- a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs | |||
@@ -345,7 +345,6 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
345 | { | 345 | { |
346 | if (!s.IsChildAgent) | 346 | if (!s.IsChildAgent) |
347 | { | 347 | { |
348 | s.ControllingClient.SendTeleportLocationStart(); | ||
349 | m_scene.TeleportClientHome(user, s.ControllingClient); | 348 | m_scene.TeleportClientHome(user, s.ControllingClient); |
350 | } | 349 | } |
351 | } | 350 | } |
@@ -480,7 +479,6 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
480 | ScenePresence s = m_scene.GetScenePresence(prey); | 479 | ScenePresence s = m_scene.GetScenePresence(prey); |
481 | if (s != null) | 480 | if (s != null) |
482 | { | 481 | { |
483 | s.ControllingClient.SendTeleportLocationStart(); | ||
484 | m_scene.TeleportClientHome(prey, s.ControllingClient); | 482 | m_scene.TeleportClientHome(prey, s.ControllingClient); |
485 | } | 483 | } |
486 | } | 484 | } |
@@ -500,7 +498,6 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
500 | // Also make sure they are actually in the region | 498 | // Also make sure they are actually in the region |
501 | if (p != null && !p.IsChildAgent) | 499 | if (p != null && !p.IsChildAgent) |
502 | { | 500 | { |
503 | p.ControllingClient.SendTeleportLocationStart(); | ||
504 | m_scene.TeleportClientHome(p.UUID, p.ControllingClient); | 501 | m_scene.TeleportClientHome(p.UUID, p.ControllingClient); |
505 | } | 502 | } |
506 | } | 503 | } |
diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs index 7e29a56..d00cb07 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs | |||
@@ -147,12 +147,12 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
147 | { | 147 | { |
148 | } | 148 | } |
149 | 149 | ||
150 | private bool OnVerifyUserConnection(ScenePresence scenePresence, out string reason) | 150 | // private bool OnVerifyUserConnection(ScenePresence scenePresence, out string reason) |
151 | { | 151 | // { |
152 | ILandObject nearestParcel = m_scene.GetNearestAllowedParcel(scenePresence.UUID, scenePresence.AbsolutePosition.X, scenePresence.AbsolutePosition.Y); | 152 | // ILandObject nearestParcel = m_scene.GetNearestAllowedParcel(scenePresence.UUID, scenePresence.AbsolutePosition.X, scenePresence.AbsolutePosition.Y); |
153 | reason = "You are not allowed to enter this sim."; | 153 | // reason = "You are not allowed to enter this sim."; |
154 | return nearestParcel != null; | 154 | // return nearestParcel != null; |
155 | } | 155 | // } |
156 | 156 | ||
157 | void EventManagerOnNewClient(IClientAPI client) | 157 | void EventManagerOnNewClient(IClientAPI client) |
158 | { | 158 | { |
diff --git a/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs b/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs new file mode 100644 index 0000000..62abd4c --- /dev/null +++ b/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs | |||
@@ -0,0 +1,263 @@ | |||
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 log4net; | ||
32 | using Mono.Addins; | ||
33 | using Nini.Config; | ||
34 | using OpenMetaverse; | ||
35 | using OpenMetaverse.Packets; | ||
36 | using OpenSim.Framework; | ||
37 | using OpenSim.Region.Framework; | ||
38 | using OpenSim.Region.Framework.Interfaces; | ||
39 | using OpenSim.Region.Framework.Scenes; | ||
40 | using OpenSim.Region.Framework.Scenes.Serialization; | ||
41 | |||
42 | namespace OpenSim.Region.CoreModules.World.Objects.BuySell | ||
43 | { | ||
44 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "BuySellModule")] | ||
45 | public class BuySellModule : IBuySellModule, INonSharedRegionModule | ||
46 | { | ||
47 | // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
48 | |||
49 | protected Scene m_scene = null; | ||
50 | protected IDialogModule m_dialogModule; | ||
51 | |||
52 | public string Name { get { return "Object BuySell Module"; } } | ||
53 | public Type ReplaceableInterface { get { return null; } } | ||
54 | |||
55 | public void Initialise(IConfigSource source) {} | ||
56 | |||
57 | public void AddRegion(Scene scene) | ||
58 | { | ||
59 | m_scene = scene; | ||
60 | m_scene.RegisterModuleInterface<IBuySellModule>(this); | ||
61 | m_scene.EventManager.OnNewClient += SubscribeToClientEvents; | ||
62 | } | ||
63 | |||
64 | public void RemoveRegion(Scene scene) | ||
65 | { | ||
66 | m_scene.EventManager.OnNewClient -= SubscribeToClientEvents; | ||
67 | } | ||
68 | |||
69 | public void RegionLoaded(Scene scene) | ||
70 | { | ||
71 | m_dialogModule = scene.RequestModuleInterface<IDialogModule>(); | ||
72 | } | ||
73 | |||
74 | public void Close() | ||
75 | { | ||
76 | RemoveRegion(m_scene); | ||
77 | } | ||
78 | |||
79 | public void SubscribeToClientEvents(IClientAPI client) | ||
80 | { | ||
81 | client.OnObjectSaleInfo += ObjectSaleInfo; | ||
82 | } | ||
83 | |||
84 | protected void ObjectSaleInfo( | ||
85 | IClientAPI client, UUID agentID, UUID sessionID, uint localID, byte saleType, int salePrice) | ||
86 | { | ||
87 | SceneObjectPart part = m_scene.GetSceneObjectPart(localID); | ||
88 | if (part == null || part.ParentGroup == null) | ||
89 | return; | ||
90 | |||
91 | if (part.ParentGroup.IsDeleted) | ||
92 | return; | ||
93 | |||
94 | part = part.ParentGroup.RootPart; | ||
95 | |||
96 | part.ObjectSaleType = saleType; | ||
97 | part.SalePrice = salePrice; | ||
98 | |||
99 | part.ParentGroup.HasGroupChanged = true; | ||
100 | |||
101 | part.GetProperties(client); | ||
102 | } | ||
103 | |||
104 | public bool BuyObject(IClientAPI remoteClient, UUID categoryID, uint localID, byte saleType) | ||
105 | { | ||
106 | SceneObjectPart part = m_scene.GetSceneObjectPart(localID); | ||
107 | |||
108 | if (part == null) | ||
109 | return false; | ||
110 | |||
111 | if (part.ParentGroup == null) | ||
112 | return false; | ||
113 | |||
114 | SceneObjectGroup group = part.ParentGroup; | ||
115 | |||
116 | switch (saleType) | ||
117 | { | ||
118 | case 1: // Sell as original (in-place sale) | ||
119 | uint effectivePerms = group.GetEffectivePermissions(); | ||
120 | |||
121 | if ((effectivePerms & (uint)PermissionMask.Transfer) == 0) | ||
122 | { | ||
123 | if (m_dialogModule != null) | ||
124 | m_dialogModule.SendAlertToUser(remoteClient, "This item doesn't appear to be for sale"); | ||
125 | return false; | ||
126 | } | ||
127 | |||
128 | group.SetOwnerId(remoteClient.AgentId); | ||
129 | group.SetRootPartOwner(part, remoteClient.AgentId, remoteClient.ActiveGroupId); | ||
130 | |||
131 | List<SceneObjectPart> partList = new List<SceneObjectPart>(group.Children.Values); | ||
132 | |||
133 | if (m_scene.Permissions.PropagatePermissions()) | ||
134 | { | ||
135 | foreach (SceneObjectPart child in partList) | ||
136 | { | ||
137 | child.Inventory.ChangeInventoryOwner(remoteClient.AgentId); | ||
138 | child.TriggerScriptChangedEvent(Changed.OWNER); | ||
139 | child.ApplyNextOwnerPermissions(); | ||
140 | } | ||
141 | } | ||
142 | |||
143 | part.ObjectSaleType = 0; | ||
144 | part.SalePrice = 10; | ||
145 | |||
146 | group.HasGroupChanged = true; | ||
147 | part.GetProperties(remoteClient); | ||
148 | part.TriggerScriptChangedEvent(Changed.OWNER); | ||
149 | group.ResumeScripts(); | ||
150 | part.ScheduleFullUpdate(); | ||
151 | |||
152 | break; | ||
153 | |||
154 | case 2: // Sell a copy | ||
155 | Vector3 inventoryStoredPosition = new Vector3 | ||
156 | (((group.AbsolutePosition.X > (int)Constants.RegionSize) | ||
157 | ? 250 | ||
158 | : group.AbsolutePosition.X) | ||
159 | , | ||
160 | (group.AbsolutePosition.X > (int)Constants.RegionSize) | ||
161 | ? 250 | ||
162 | : group.AbsolutePosition.X, | ||
163 | group.AbsolutePosition.Z); | ||
164 | |||
165 | Vector3 originalPosition = group.AbsolutePosition; | ||
166 | |||
167 | group.AbsolutePosition = inventoryStoredPosition; | ||
168 | |||
169 | string sceneObjectXml = SceneObjectSerializer.ToOriginalXmlFormat(group); | ||
170 | group.AbsolutePosition = originalPosition; | ||
171 | |||
172 | uint perms = group.GetEffectivePermissions(); | ||
173 | |||
174 | if ((perms & (uint)PermissionMask.Transfer) == 0) | ||
175 | { | ||
176 | if (m_dialogModule != null) | ||
177 | m_dialogModule.SendAlertToUser(remoteClient, "This item doesn't appear to be for sale"); | ||
178 | return false; | ||
179 | } | ||
180 | |||
181 | AssetBase asset = m_scene.CreateAsset( | ||
182 | group.GetPartName(localID), | ||
183 | group.GetPartDescription(localID), | ||
184 | (sbyte)AssetType.Object, | ||
185 | Utils.StringToBytes(sceneObjectXml), | ||
186 | group.OwnerID); | ||
187 | m_scene.AssetService.Store(asset); | ||
188 | |||
189 | InventoryItemBase item = new InventoryItemBase(); | ||
190 | item.CreatorId = part.CreatorID.ToString(); | ||
191 | |||
192 | item.ID = UUID.Random(); | ||
193 | item.Owner = remoteClient.AgentId; | ||
194 | item.AssetID = asset.FullID; | ||
195 | item.Description = asset.Description; | ||
196 | item.Name = asset.Name; | ||
197 | item.AssetType = asset.Type; | ||
198 | item.InvType = (int)InventoryType.Object; | ||
199 | item.Folder = categoryID; | ||
200 | |||
201 | uint nextPerms=(perms & 7) << 13; | ||
202 | if ((nextPerms & (uint)PermissionMask.Copy) == 0) | ||
203 | perms &= ~(uint)PermissionMask.Copy; | ||
204 | if ((nextPerms & (uint)PermissionMask.Transfer) == 0) | ||
205 | perms &= ~(uint)PermissionMask.Transfer; | ||
206 | if ((nextPerms & (uint)PermissionMask.Modify) == 0) | ||
207 | perms &= ~(uint)PermissionMask.Modify; | ||
208 | |||
209 | item.BasePermissions = perms & part.NextOwnerMask; | ||
210 | item.CurrentPermissions = perms & part.NextOwnerMask; | ||
211 | item.NextPermissions = part.NextOwnerMask; | ||
212 | item.EveryOnePermissions = part.EveryoneMask & | ||
213 | part.NextOwnerMask; | ||
214 | item.GroupPermissions = part.GroupMask & | ||
215 | part.NextOwnerMask; | ||
216 | item.CurrentPermissions |= 16; // Slam! | ||
217 | item.CreationDate = Util.UnixTimeSinceEpoch(); | ||
218 | |||
219 | if (m_scene.InventoryService.AddItem(item)) | ||
220 | { | ||
221 | remoteClient.SendInventoryItemCreateUpdate(item, 0); | ||
222 | } | ||
223 | else | ||
224 | { | ||
225 | if (m_dialogModule != null) | ||
226 | m_dialogModule.SendAlertToUser(remoteClient, "Cannot buy now. Your inventory is unavailable"); | ||
227 | return false; | ||
228 | } | ||
229 | break; | ||
230 | |||
231 | case 3: // Sell contents | ||
232 | List<UUID> invList = part.Inventory.GetInventoryList(); | ||
233 | |||
234 | bool okToSell = true; | ||
235 | |||
236 | foreach (UUID invID in invList) | ||
237 | { | ||
238 | TaskInventoryItem item1 = part.Inventory.GetInventoryItem(invID); | ||
239 | if ((item1.CurrentPermissions & | ||
240 | (uint)PermissionMask.Transfer) == 0) | ||
241 | { | ||
242 | okToSell = false; | ||
243 | break; | ||
244 | } | ||
245 | } | ||
246 | |||
247 | if (!okToSell) | ||
248 | { | ||
249 | if (m_dialogModule != null) | ||
250 | m_dialogModule.SendAlertToUser( | ||
251 | remoteClient, "This item's inventory doesn't appear to be for sale"); | ||
252 | return false; | ||
253 | } | ||
254 | |||
255 | if (invList.Count > 0) | ||
256 | m_scene.MoveTaskInventoryItems(remoteClient.AgentId, part.Name, part, invList); | ||
257 | break; | ||
258 | } | ||
259 | |||
260 | return true; | ||
261 | } | ||
262 | } | ||
263 | } \ No newline at end of file | ||
diff --git a/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs b/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs index 2817477..d4166d0 100644 --- a/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs +++ b/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs | |||
@@ -588,8 +588,9 @@ namespace OpenSim.Region.CoreModules.World.Terrain | |||
588 | client.OnModifyTerrain += client_OnModifyTerrain; | 588 | client.OnModifyTerrain += client_OnModifyTerrain; |
589 | client.OnBakeTerrain += client_OnBakeTerrain; | 589 | client.OnBakeTerrain += client_OnBakeTerrain; |
590 | client.OnLandUndo += client_OnLandUndo; | 590 | client.OnLandUndo += client_OnLandUndo; |
591 | client.OnUnackedTerrain += client_OnUnackedTerrain; | ||
591 | } | 592 | } |
592 | 593 | ||
593 | /// <summary> | 594 | /// <summary> |
594 | /// Checks to see if the terrain has been modified since last check | 595 | /// Checks to see if the terrain has been modified since last check |
595 | /// but won't attempt to limit those changes to the limits specified in the estate settings | 596 | /// but won't attempt to limit those changes to the limits specified in the estate settings |
@@ -810,6 +811,12 @@ namespace OpenSim.Region.CoreModules.World.Terrain | |||
810 | InterfaceBakeTerrain(null); //bake terrain does not use the passed in parameter | 811 | InterfaceBakeTerrain(null); //bake terrain does not use the passed in parameter |
811 | } | 812 | } |
812 | } | 813 | } |
814 | |||
815 | protected void client_OnUnackedTerrain(IClientAPI client, int patchX, int patchY) | ||
816 | { | ||
817 | //m_log.Debug("Terrain packet unacked, resending patch: " + patchX + " , " + patchY); | ||
818 | client.SendLayerData(patchX, patchY, m_scene.Heightmap.GetFloatsSerialised()); | ||
819 | } | ||
813 | 820 | ||
814 | private void StoreUndoState() | 821 | private void StoreUndoState() |
815 | { | 822 | { |
diff --git a/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs index a1a4f9e..9f88517 100644 --- a/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs +++ b/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs | |||
@@ -138,14 +138,14 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
138 | remoteClient.SendMapBlock(blocks, 2); | 138 | remoteClient.SendMapBlock(blocks, 2); |
139 | } | 139 | } |
140 | 140 | ||
141 | private Scene GetClientScene(IClientAPI client) | 141 | // private Scene GetClientScene(IClientAPI client) |
142 | { | 142 | // { |
143 | foreach (Scene s in m_scenes) | 143 | // foreach (Scene s in m_scenes) |
144 | { | 144 | // { |
145 | if (client.Scene.RegionInfo.RegionHandle == s.RegionInfo.RegionHandle) | 145 | // if (client.Scene.RegionInfo.RegionHandle == s.RegionInfo.RegionHandle) |
146 | return s; | 146 | // return s; |
147 | } | 147 | // } |
148 | return m_scene; | 148 | // return m_scene; |
149 | } | 149 | // } |
150 | } | 150 | } |
151 | } | 151 | } |
diff --git a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs index 9d9967a..f036d85 100644 --- a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs +++ b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs | |||
@@ -1000,11 +1000,24 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
1000 | return responsemap; | 1000 | return responsemap; |
1001 | } | 1001 | } |
1002 | 1002 | ||
1003 | public void RegenerateMaptile(byte[] data) | 1003 | public void GenerateMaptile() |
1004 | { | 1004 | { |
1005 | // Cannot create a map for a nonexistant heightmap | ||
1006 | if (m_scene.Heightmap == null) | ||
1007 | return; | ||
1008 | |||
1009 | //create a texture asset of the terrain | ||
1010 | IMapImageGenerator terrain = m_scene.RequestModuleInterface<IMapImageGenerator>(); | ||
1011 | if (terrain == null) | ||
1012 | return; | ||
1013 | |||
1014 | byte[] data = terrain.WriteJpeg2000Image("defaultstripe.png"); | ||
1015 | if (data == null) | ||
1016 | return; | ||
1017 | |||
1005 | UUID lastMapRegionUUID = m_scene.RegionInfo.RegionSettings.TerrainImageID; | 1018 | UUID lastMapRegionUUID = m_scene.RegionInfo.RegionSettings.TerrainImageID; |
1006 | 1019 | ||
1007 | m_log.Debug("[MAPTILE]: STORING MAPTILE IMAGE"); | 1020 | m_log.Debug("[WORLDMAP]: STORING MAPTILE IMAGE"); |
1008 | 1021 | ||
1009 | m_scene.RegionInfo.RegionSettings.TerrainImageID = UUID.Random(); | 1022 | m_scene.RegionInfo.RegionSettings.TerrainImageID = UUID.Random(); |
1010 | 1023 | ||