diff options
author | Melanie | 2011-01-27 05:18:28 +0000 |
---|---|---|
committer | Melanie | 2011-01-27 05:18:28 +0000 |
commit | 42c22f41ddfac9777484be136f80de4251ef6d00 (patch) | |
tree | b13c6e256bcc3fb02a4f3f14ec487b6565c08d28 /OpenSim | |
parent | Add a TeleportFlags member to SP so we can tell how we got there. (diff) | |
parent | Merge branch 'master' of ssh://opensimulator.org/var/git/opensim (diff) | |
download | opensim-SC_OLD-42c22f41ddfac9777484be136f80de4251ef6d00.zip opensim-SC_OLD-42c22f41ddfac9777484be136f80de4251ef6d00.tar.gz opensim-SC_OLD-42c22f41ddfac9777484be136f80de4251ef6d00.tar.bz2 opensim-SC_OLD-42c22f41ddfac9777484be136f80de4251ef6d00.tar.xz |
Merge branch 'master' into careminster-presence-refactor
Diffstat (limited to 'OpenSim')
10 files changed, 178 insertions, 106 deletions
diff --git a/OpenSim/Framework/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs index be15e1b..c0bc47e 100644 --- a/OpenSim/Framework/AvatarAppearance.cs +++ b/OpenSim/Framework/AvatarAppearance.cs | |||
@@ -451,22 +451,33 @@ namespace OpenSim.Framework | |||
451 | /// 0x80 bit set then we assume this is an append | 451 | /// 0x80 bit set then we assume this is an append |
452 | /// operation otherwise we replace whatever is | 452 | /// operation otherwise we replace whatever is |
453 | /// currently attached at the attachpoint | 453 | /// currently attached at the attachpoint |
454 | /// return true if something actually changed | ||
454 | /// </summary> | 455 | /// </summary> |
455 | public void SetAttachment(int attachpoint, UUID item, UUID asset) | 456 | public bool SetAttachment(int attachpoint, UUID item, UUID asset) |
456 | { | 457 | { |
457 | if (attachpoint == 0) | 458 | if (attachpoint == 0) |
458 | return; | 459 | return false; |
459 | 460 | ||
460 | if (item == UUID.Zero) | 461 | if (item == UUID.Zero) |
461 | { | 462 | { |
462 | lock (m_attachments) | 463 | lock (m_attachments) |
463 | { | 464 | { |
464 | if (m_attachments.ContainsKey(attachpoint)) | 465 | if (m_attachments.ContainsKey(attachpoint)) |
466 | { | ||
465 | m_attachments.Remove(attachpoint); | 467 | m_attachments.Remove(attachpoint); |
466 | return; | 468 | return true; |
469 | } | ||
470 | return false; | ||
467 | } | 471 | } |
468 | } | 472 | } |
469 | 473 | ||
474 | // check if the item is already attached at this point | ||
475 | if (GetAttachpoint(item) == (attachpoint & 0x7F)) | ||
476 | { | ||
477 | // m_log.DebugFormat("[AVATAR APPEARANCE] attempt to attach an already attached item {0}",item); | ||
478 | return false; | ||
479 | } | ||
480 | |||
470 | // check if this is an append or a replace, 0x80 marks it as an append | 481 | // check if this is an append or a replace, 0x80 marks it as an append |
471 | if ((attachpoint & 0x80) > 0) | 482 | if ((attachpoint & 0x80) > 0) |
472 | { | 483 | { |
@@ -478,6 +489,7 @@ namespace OpenSim.Framework | |||
478 | { | 489 | { |
479 | ReplaceAttachment(new AvatarAttachment(attachpoint,item,asset)); | 490 | ReplaceAttachment(new AvatarAttachment(attachpoint,item,asset)); |
480 | } | 491 | } |
492 | return true; | ||
481 | } | 493 | } |
482 | 494 | ||
483 | public int GetAttachpoint(UUID itemID) | 495 | public int GetAttachpoint(UUID itemID) |
@@ -495,7 +507,7 @@ namespace OpenSim.Framework | |||
495 | } | 507 | } |
496 | } | 508 | } |
497 | 509 | ||
498 | public void DetachAttachment(UUID itemID) | 510 | public bool DetachAttachment(UUID itemID) |
499 | { | 511 | { |
500 | lock (m_attachments) | 512 | lock (m_attachments) |
501 | { | 513 | { |
@@ -510,10 +522,11 @@ namespace OpenSim.Framework | |||
510 | // And remove the list if there are no more attachments here | 522 | // And remove the list if there are no more attachments here |
511 | if (m_attachments[kvp.Key].Count == 0) | 523 | if (m_attachments[kvp.Key].Count == 0) |
512 | m_attachments.Remove(kvp.Key); | 524 | m_attachments.Remove(kvp.Key); |
513 | return; | 525 | return true; |
514 | } | 526 | } |
515 | } | 527 | } |
516 | } | 528 | } |
529 | return false; | ||
517 | } | 530 | } |
518 | 531 | ||
519 | public void ClearAttachments() | 532 | public void ClearAttachments() |
diff --git a/OpenSim/Framework/Console/ConsoleBase.cs b/OpenSim/Framework/Console/ConsoleBase.cs index 3ef76cf..c59fbca 100755 --- a/OpenSim/Framework/Console/ConsoleBase.cs +++ b/OpenSim/Framework/Console/ConsoleBase.cs | |||
@@ -76,7 +76,7 @@ namespace OpenSim.Framework.Console | |||
76 | System.Console.WriteLine(text); | 76 | System.Console.WriteLine(text); |
77 | } | 77 | } |
78 | 78 | ||
79 | public virtual void OutputFormat(string format, params string[] components) | 79 | public virtual void OutputFormat(string format, params object[] components) |
80 | { | 80 | { |
81 | Output(string.Format(format, components)); | 81 | Output(string.Format(format, components)); |
82 | } | 82 | } |
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index 25d4f21..8c92588 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs | |||
@@ -133,8 +133,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
133 | "[ATTACHMENTS MODULE]: Saving avatar attachment. AgentID: " + remoteClient.AgentId | 133 | "[ATTACHMENTS MODULE]: Saving avatar attachment. AgentID: " + remoteClient.AgentId |
134 | + ", AttachmentPoint: " + AttachmentPt); | 134 | + ", AttachmentPoint: " + AttachmentPt); |
135 | 135 | ||
136 | if (m_scene.AvatarFactory != null) | ||
137 | m_scene.AvatarFactory.QueueAppearanceSave(remoteClient.AgentId); | ||
138 | } | 136 | } |
139 | } | 137 | } |
140 | catch (Exception e) | 138 | catch (Exception e) |
@@ -346,8 +344,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
346 | if (m_scene.InventoryService != null) | 344 | if (m_scene.InventoryService != null) |
347 | item = m_scene.InventoryService.GetItem(item); | 345 | item = m_scene.InventoryService.GetItem(item); |
348 | 346 | ||
349 | if (presence.Appearance != null) | 347 | bool changed = presence.Appearance.SetAttachment((int)AttachmentPt, itemID, item.AssetID); |
350 | presence.Appearance.SetAttachment((int)AttachmentPt, itemID, item.AssetID /*att.UUID*/); | 348 | if (changed && m_scene.AvatarFactory != null) |
349 | m_scene.AvatarFactory.QueueAppearanceSave(remoteClient.AgentId); | ||
351 | } | 350 | } |
352 | 351 | ||
353 | return att.UUID; | 352 | return att.UUID; |
@@ -397,9 +396,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
397 | if (m_scene.InventoryService == null) | 396 | if (m_scene.InventoryService == null) |
398 | m_log.Error("[ATTACHMENT]: m_scene.InventoryService == null"); | 397 | m_log.Error("[ATTACHMENT]: m_scene.InventoryService == null"); |
399 | item = m_scene.InventoryService.GetItem(item); | 398 | item = m_scene.InventoryService.GetItem(item); |
400 | presence.Appearance.SetAttachment((int)AttachmentPt, itemID, item.AssetID /* att.UUID */); | 399 | bool changed = presence.Appearance.SetAttachment((int)AttachmentPt, itemID, item.AssetID); |
401 | 400 | if (changed && m_scene.AvatarFactory != null) | |
402 | if (m_scene.AvatarFactory != null) | ||
403 | m_scene.AvatarFactory.QueueAppearanceSave(remoteClient.AgentId); | 401 | m_scene.AvatarFactory.QueueAppearanceSave(remoteClient.AgentId); |
404 | } | 402 | } |
405 | } | 403 | } |
@@ -419,11 +417,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
419 | ScenePresence presence; | 417 | ScenePresence presence; |
420 | if (m_scene.TryGetScenePresence(remoteClient.AgentId, out presence)) | 418 | if (m_scene.TryGetScenePresence(remoteClient.AgentId, out presence)) |
421 | { | 419 | { |
422 | presence.Appearance.DetachAttachment(itemID); | ||
423 | |||
424 | // Save avatar attachment information | 420 | // Save avatar attachment information |
425 | m_log.Debug("[ATTACHMENTS MODULE]: Detaching from UserID: " + remoteClient.AgentId + ", ItemID: " + itemID); | 421 | m_log.Debug("[ATTACHMENTS MODULE]: Detaching from UserID: " + remoteClient.AgentId + ", ItemID: " + itemID); |
426 | if (m_scene.AvatarFactory != null) | 422 | |
423 | bool changed = presence.Appearance.DetachAttachment(itemID); | ||
424 | if (changed && m_scene.AvatarFactory != null) | ||
427 | m_scene.AvatarFactory.QueueAppearanceSave(remoteClient.AgentId); | 425 | m_scene.AvatarFactory.QueueAppearanceSave(remoteClient.AgentId); |
428 | } | 426 | } |
429 | 427 | ||
@@ -448,9 +446,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
448 | part.ParentGroup.PrimCount, remoteClient.AgentId, presence.AbsolutePosition)) | 446 | part.ParentGroup.PrimCount, remoteClient.AgentId, presence.AbsolutePosition)) |
449 | return; | 447 | return; |
450 | 448 | ||
451 | presence.Appearance.DetachAttachment(itemID); | 449 | bool changed = presence.Appearance.DetachAttachment(itemID); |
452 | 450 | if (changed && m_scene.AvatarFactory != null) | |
453 | if (m_scene.AvatarFactory != null) | ||
454 | m_scene.AvatarFactory.QueueAppearanceSave(remoteClient.AgentId); | 451 | m_scene.AvatarFactory.QueueAppearanceSave(remoteClient.AgentId); |
455 | 452 | ||
456 | part.ParentGroup.DetachToGround(); | 453 | part.ParentGroup.DetachToGround(); |
diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs index ed0a290..f8ce444 100644 --- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs | |||
@@ -217,7 +217,9 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory | |||
217 | // update transaction. In theory, we should be able to do an immediate | 217 | // update transaction. In theory, we should be able to do an immediate |
218 | // appearance send and save here. | 218 | // appearance send and save here. |
219 | 219 | ||
220 | QueueAppearanceSave(client.AgentId); | 220 | // save only if there were changes, send no matter what (doesn't hurt to send twice) |
221 | if (changed) | ||
222 | QueueAppearanceSave(client.AgentId); | ||
221 | QueueAppearanceSend(client.AgentId); | 223 | QueueAppearanceSend(client.AgentId); |
222 | } | 224 | } |
223 | 225 | ||
diff --git a/OpenSim/Region/CoreModules/World/Land/LandChannel.cs b/OpenSim/Region/CoreModules/World/Land/LandChannel.cs index 1ad4db2..9e27ef0 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandChannel.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandChannel.cs | |||
@@ -64,7 +64,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
64 | #endregion | 64 | #endregion |
65 | 65 | ||
66 | private readonly Scene m_scene; | 66 | private readonly Scene m_scene; |
67 | private readonly LandManagementModule m_landManagementModule; | 67 | private readonly LandManagementModule m_landManagementModule; |
68 | 68 | ||
69 | public LandChannel(Scene scene, LandManagementModule landManagementMod) | 69 | public LandChannel(Scene scene, LandManagementModule landManagementMod) |
70 | { | 70 | { |
diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs index d9812df..cb8c5de 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs | |||
@@ -30,6 +30,7 @@ using System.Collections; | |||
30 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
31 | using System.Diagnostics; | 31 | using System.Diagnostics; |
32 | using System.Reflection; | 32 | using System.Reflection; |
33 | using System.Text; | ||
33 | using log4net; | 34 | using log4net; |
34 | using Nini.Config; | 35 | using Nini.Config; |
35 | using OpenMetaverse; | 36 | using OpenMetaverse; |
@@ -37,19 +38,22 @@ using OpenMetaverse.StructuredData; | |||
37 | using OpenMetaverse.Messages.Linden; | 38 | using OpenMetaverse.Messages.Linden; |
38 | using OpenSim.Framework; | 39 | using OpenSim.Framework; |
39 | using OpenSim.Framework.Capabilities; | 40 | using OpenSim.Framework.Capabilities; |
41 | using OpenSim.Framework.Console; | ||
40 | using OpenSim.Framework.Servers; | 42 | using OpenSim.Framework.Servers; |
41 | using OpenSim.Framework.Servers.HttpServer; | 43 | using OpenSim.Framework.Servers.HttpServer; |
42 | using OpenSim.Services.Interfaces; | 44 | using OpenSim.Region.CoreModules.Framework.InterfaceCommander; |
43 | using OpenSim.Region.Framework.Interfaces; | 45 | using OpenSim.Region.Framework.Interfaces; |
44 | using OpenSim.Region.Framework.Scenes; | 46 | using OpenSim.Region.Framework.Scenes; |
45 | using OpenSim.Region.Physics.Manager; | 47 | using OpenSim.Region.Physics.Manager; |
46 | using Caps=OpenSim.Framework.Capabilities.Caps; | 48 | using OpenSim.Services.Interfaces; |
49 | using Caps = OpenSim.Framework.Capabilities.Caps; | ||
47 | using GridRegion = OpenSim.Services.Interfaces.GridRegion; | 50 | using GridRegion = OpenSim.Services.Interfaces.GridRegion; |
48 | 51 | ||
49 | namespace OpenSim.Region.CoreModules.World.Land | 52 | namespace OpenSim.Region.CoreModules.World.Land |
50 | { | 53 | { |
51 | // used for caching | 54 | // used for caching |
52 | internal class ExtendedLandData { | 55 | internal class ExtendedLandData |
56 | { | ||
53 | public LandData LandData; | 57 | public LandData LandData; |
54 | public ulong RegionHandle; | 58 | public ulong RegionHandle; |
55 | public uint X, Y; | 59 | public uint X, Y; |
@@ -65,6 +69,9 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
65 | 69 | ||
66 | private LandChannel landChannel; | 70 | private LandChannel landChannel; |
67 | private Scene m_scene; | 71 | private Scene m_scene; |
72 | protected Commander m_commander = new Commander("land"); | ||
73 | |||
74 | protected IUserManagement m_userManager; | ||
68 | 75 | ||
69 | // Minimum for parcels to work is 64m even if we don't actually use them. | 76 | // Minimum for parcels to work is 64m even if we don't actually use them. |
70 | #pragma warning disable 0429 | 77 | #pragma warning disable 0429 |
@@ -135,19 +142,27 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
135 | m_scene.EventManager.OnRequestParcelPrimCountUpdate += EventManagerOnRequestParcelPrimCountUpdate; | 142 | m_scene.EventManager.OnRequestParcelPrimCountUpdate += EventManagerOnRequestParcelPrimCountUpdate; |
136 | m_scene.EventManager.OnParcelPrimCountTainted += EventManagerOnParcelPrimCountTainted; | 143 | m_scene.EventManager.OnParcelPrimCountTainted += EventManagerOnParcelPrimCountTainted; |
137 | m_scene.EventManager.OnRegisterCaps += EventManagerOnRegisterCaps; | 144 | m_scene.EventManager.OnRegisterCaps += EventManagerOnRegisterCaps; |
145 | m_scene.EventManager.OnPluginConsole += EventManagerOnPluginConsole; | ||
138 | 146 | ||
139 | lock (m_scene) | 147 | lock (m_scene) |
140 | { | 148 | { |
141 | m_scene.LandChannel = (ILandChannel)landChannel; | 149 | m_scene.LandChannel = (ILandChannel)landChannel; |
142 | } | 150 | } |
151 | |||
152 | InstallInterfaces(); | ||
143 | } | 153 | } |
144 | 154 | ||
145 | public void RegionLoaded(Scene scene) | 155 | public void RegionLoaded(Scene scene) |
146 | { | 156 | { |
157 | m_userManager = m_scene.RequestModuleInterface<IUserManagement>(); | ||
147 | } | 158 | } |
148 | 159 | ||
149 | public void RemoveRegion(Scene scene) | 160 | public void RemoveRegion(Scene scene) |
150 | { | 161 | { |
162 | // TODO: Also release other event manager listeners here | ||
163 | |||
164 | m_scene.EventManager.OnPluginConsole -= EventManagerOnPluginConsole; | ||
165 | m_scene.UnregisterModuleCommander(m_commander.Name); | ||
151 | } | 166 | } |
152 | 167 | ||
153 | // private bool OnVerifyUserConnection(ScenePresence scenePresence, out string reason) | 168 | // private bool OnVerifyUserConnection(ScenePresence scenePresence, out string reason) |
@@ -156,6 +171,29 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
156 | // reason = "You are not allowed to enter this sim."; | 171 | // reason = "You are not allowed to enter this sim."; |
157 | // return nearestParcel != null; | 172 | // return nearestParcel != null; |
158 | // } | 173 | // } |
174 | |||
175 | /// <summary> | ||
176 | /// Processes commandline input. Do not call directly. | ||
177 | /// </summary> | ||
178 | /// <param name="args">Commandline arguments</param> | ||
179 | protected void EventManagerOnPluginConsole(string[] args) | ||
180 | { | ||
181 | if (args[0] == "land") | ||
182 | { | ||
183 | if (args.Length == 1) | ||
184 | { | ||
185 | m_commander.ProcessConsoleCommand("help", new string[0]); | ||
186 | return; | ||
187 | } | ||
188 | |||
189 | string[] tmpArgs = new string[args.Length - 2]; | ||
190 | int i; | ||
191 | for (i = 2; i < args.Length; i++) | ||
192 | tmpArgs[i - 2] = args[i]; | ||
193 | |||
194 | m_commander.ProcessConsoleCommand(args[1], tmpArgs); | ||
195 | } | ||
196 | } | ||
159 | 197 | ||
160 | void EventManagerOnNewClient(IClientAPI client) | 198 | void EventManagerOnNewClient(IClientAPI client) |
161 | { | 199 | { |
@@ -217,11 +255,6 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
217 | } | 255 | } |
218 | } | 256 | } |
219 | 257 | ||
220 | |||
221 | public void PostInitialise() | ||
222 | { | ||
223 | } | ||
224 | |||
225 | public void Close() | 258 | public void Close() |
226 | { | 259 | { |
227 | } | 260 | } |
@@ -231,11 +264,6 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
231 | get { return "LandManagementModule"; } | 264 | get { return "LandManagementModule"; } |
232 | } | 265 | } |
233 | 266 | ||
234 | public bool IsSharedModule | ||
235 | { | ||
236 | get { return false; } | ||
237 | } | ||
238 | |||
239 | #endregion | 267 | #endregion |
240 | 268 | ||
241 | #region Parcel Add/Remove/Get/Create | 269 | #region Parcel Add/Remove/Get/Create |
@@ -1932,5 +1960,44 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1932 | } | 1960 | } |
1933 | } | 1961 | } |
1934 | } | 1962 | } |
1963 | |||
1964 | protected void InstallInterfaces() | ||
1965 | { | ||
1966 | Command showCommand = | ||
1967 | new Command("show", CommandIntentions.COMMAND_STATISTICAL, ShowParcelsCommand, "Shows all parcels on the current region."); | ||
1968 | |||
1969 | m_commander.RegisterCommand("show", showCommand); | ||
1970 | |||
1971 | // Add this to our scene so scripts can call these functions | ||
1972 | m_scene.RegisterModuleCommander(m_commander); | ||
1973 | } | ||
1974 | |||
1975 | protected void ShowParcelsCommand(Object[] args) | ||
1976 | { | ||
1977 | StringBuilder report = new StringBuilder(); | ||
1978 | |||
1979 | report.AppendFormat("Land information for {0}\n", m_scene.RegionInfo.RegionName); | ||
1980 | report.AppendFormat( | ||
1981 | "{0,-20} {1,-9} {2,-18} {3,-18} {4,-20}\n", | ||
1982 | "Parcel Name", | ||
1983 | "Area", | ||
1984 | "Starts", | ||
1985 | "Ends", | ||
1986 | "Owner"); | ||
1987 | |||
1988 | lock (m_landList) | ||
1989 | { | ||
1990 | foreach (ILandObject lo in m_landList.Values) | ||
1991 | { | ||
1992 | LandData ld = lo.LandData; | ||
1993 | |||
1994 | report.AppendFormat( | ||
1995 | "{0,-20} {1,-9} {2,-18} {3,-18} {4,-20}\n", | ||
1996 | ld.Name, ld.Area, lo.StartPoint, lo.EndPoint, m_userManager.GetUserName(ld.OwnerID)); | ||
1997 | } | ||
1998 | } | ||
1999 | |||
2000 | MainConsole.Instance.Output(report.ToString()); | ||
2001 | } | ||
1935 | } | 2002 | } |
1936 | } | 2003 | } |
diff --git a/OpenSim/Region/CoreModules/World/Land/LandObject.cs b/OpenSim/Region/CoreModules/World/Land/LandObject.cs index a00b6b2..7723eb4 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandObject.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandObject.cs | |||
@@ -77,7 +77,43 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
77 | { | 77 | { |
78 | get { return m_scene.RegionInfo.RegionID; } | 78 | get { return m_scene.RegionInfo.RegionID; } |
79 | } | 79 | } |
80 | 80 | ||
81 | public Vector3 StartPoint | ||
82 | { | ||
83 | get | ||
84 | { | ||
85 | for (int y = 0; y < landArrayMax; y++) | ||
86 | { | ||
87 | for (int x = 0; x < landArrayMax; x++) | ||
88 | { | ||
89 | if (LandBitmap[x, y]) | ||
90 | return new Vector3(x * 4, y * 4, 0); | ||
91 | } | ||
92 | } | ||
93 | |||
94 | return new Vector3(-1, -1, -1); | ||
95 | } | ||
96 | } | ||
97 | |||
98 | public Vector3 EndPoint | ||
99 | { | ||
100 | get | ||
101 | { | ||
102 | for (int y = landArrayMax - 1; y >= 0; y--) | ||
103 | { | ||
104 | for (int x = landArrayMax - 1; x >= 0; x--) | ||
105 | { | ||
106 | if (LandBitmap[x, y]) | ||
107 | { | ||
108 | return new Vector3(x * 4, y * 4, 0); | ||
109 | } | ||
110 | } | ||
111 | } | ||
112 | |||
113 | return new Vector3(-1, -1, -1); | ||
114 | } | ||
115 | } | ||
116 | |||
81 | #region Constructors | 117 | #region Constructors |
82 | 118 | ||
83 | public LandObject(UUID owner_id, bool is_group_owned, Scene scene) | 119 | public LandObject(UUID owner_id, bool is_group_owned, Scene scene) |
@@ -96,7 +132,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
96 | #region Member Functions | 132 | #region Member Functions |
97 | 133 | ||
98 | #region General Functions | 134 | #region General Functions |
99 | 135 | ||
100 | /// <summary> | 136 | /// <summary> |
101 | /// Checks to see if this land object contains a point | 137 | /// Checks to see if this land object contains a point |
102 | /// </summary> | 138 | /// </summary> |
diff --git a/OpenSim/Region/Framework/Interfaces/ILandObject.cs b/OpenSim/Region/Framework/Interfaces/ILandObject.cs index 585eb00..576b645 100644 --- a/OpenSim/Region/Framework/Interfaces/ILandObject.cs +++ b/OpenSim/Region/Framework/Interfaces/ILandObject.cs | |||
@@ -43,7 +43,21 @@ namespace OpenSim.Region.Framework.Interfaces | |||
43 | LandData LandData { get; set; } | 43 | LandData LandData { get; set; } |
44 | bool[,] LandBitmap { get; set; } | 44 | bool[,] LandBitmap { get; set; } |
45 | UUID RegionUUID { get; } | 45 | UUID RegionUUID { get; } |
46 | |||
47 | /// <summary> | ||
48 | /// The start point for the land object. This is the western-most point as one scans land working from | ||
49 | /// north to south. | ||
50 | /// </summary> | ||
51 | Vector3 StartPoint { get; } | ||
52 | |||
53 | /// <summary> | ||
54 | /// The end point for the land object. This is the eastern-most point as one scans land working from | ||
55 | /// south to north. | ||
56 | /// </summary> | ||
57 | Vector3 EndPoint { get; } | ||
58 | |||
46 | bool ContainsPoint(int x, int y); | 59 | bool ContainsPoint(int x, int y); |
60 | |||
47 | ILandObject Copy(); | 61 | ILandObject Copy(); |
48 | 62 | ||
49 | void SendLandUpdateToAvatarsOverMe(); | 63 | void SendLandUpdateToAvatarsOverMe(); |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 9bad644..56eaf06 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -516,12 +516,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
516 | get { return m_sceneGraph.Entities; } | 516 | get { return m_sceneGraph.Entities; } |
517 | } | 517 | } |
518 | 518 | ||
519 | public Dictionary<UUID, ScenePresence> m_restorePresences | ||
520 | { | ||
521 | get { return m_sceneGraph.RestorePresences; } | ||
522 | set { m_sceneGraph.RestorePresences = value; } | ||
523 | } | ||
524 | |||
525 | #endregion Properties | 519 | #endregion Properties |
526 | 520 | ||
527 | #region Constructors | 521 | #region Constructors |
@@ -2584,56 +2578,24 @@ namespace OpenSim.Region.Framework.Scenes | |||
2584 | (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaLogin) != 0; | 2578 | (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaLogin) != 0; |
2585 | 2579 | ||
2586 | CheckHeartbeat(); | 2580 | CheckHeartbeat(); |
2587 | ScenePresence presence; | ||
2588 | 2581 | ||
2589 | if (m_restorePresences.ContainsKey(client.AgentId)) | 2582 | if (GetScenePresence(client.AgentId) == null) // ensure there is no SP here |
2590 | { | 2583 | { |
2591 | m_log.DebugFormat("[SCENE]: Restoring agent {0} {1} in {2}", client.Name, client.AgentId, RegionInfo.RegionName); | 2584 | m_log.Debug("[SCENE]: Adding new agent " + client.Name + " to scene " + RegionInfo.RegionName); |
2592 | 2585 | ||
2593 | m_clientManager.Add(client); | 2586 | m_clientManager.Add(client); |
2594 | SubscribeToClientEvents(client); | 2587 | SubscribeToClientEvents(client); |
2595 | 2588 | ||
2596 | presence = m_restorePresences[client.AgentId]; | 2589 | ScenePresence sp = m_sceneGraph.CreateAndAddChildScenePresence(client, aCircuit.Appearance); |
2597 | m_restorePresences.Remove(client.AgentId); | 2590 | m_eventManager.TriggerOnNewPresence(sp); |
2598 | |||
2599 | // This is one of two paths to create avatars that are | ||
2600 | // used. This tends to get called more in standalone | ||
2601 | // than grid, not really sure why, but as such needs | ||
2602 | // an explicity appearance lookup here. | ||
2603 | AvatarAppearance appearance = null; | ||
2604 | GetAvatarAppearance(client, out appearance); | ||
2605 | presence.Appearance = appearance; | ||
2606 | |||
2607 | presence.initializeScenePresence(client, RegionInfo, this); | ||
2608 | |||
2609 | m_sceneGraph.AddScenePresence(presence); | ||
2610 | 2591 | ||
2611 | lock (m_restorePresences) | 2592 | // HERE!!! Do the initial attachments right here |
2593 | // first agent upon login is a root agent by design. | ||
2594 | // All other AddNewClient calls find aCircuit.child to be true | ||
2595 | if (aCircuit.child == false) | ||
2612 | { | 2596 | { |
2613 | Monitor.PulseAll(m_restorePresences); | 2597 | sp.IsChildAgent = false; |
2614 | } | 2598 | Util.FireAndForget(delegate(object o) { sp.RezAttachments(); }); |
2615 | } | ||
2616 | else | ||
2617 | { | ||
2618 | if (GetScenePresence(client.AgentId) == null) // ensure there is no SP here | ||
2619 | { | ||
2620 | m_log.Debug("[SCENE]: Adding new agent " + client.Name + " to scene " + RegionInfo.RegionName); | ||
2621 | |||
2622 | m_clientManager.Add(client); | ||
2623 | SubscribeToClientEvents(client); | ||
2624 | |||
2625 | ScenePresence sp = CreateAndAddScenePresence(client); | ||
2626 | if (aCircuit != null) | ||
2627 | sp.Appearance = aCircuit.Appearance; | ||
2628 | |||
2629 | // HERE!!! Do the initial attachments right here | ||
2630 | // first agent upon login is a root agent by design. | ||
2631 | // All other AddNewClient calls find aCircuit.child to be true | ||
2632 | if (aCircuit == null || (aCircuit != null && aCircuit.child == false)) | ||
2633 | { | ||
2634 | sp.IsChildAgent = false; | ||
2635 | Util.FireAndForget(delegate(object o) { sp.RezAttachments(); }); | ||
2636 | } | ||
2637 | } | 2599 | } |
2638 | } | 2600 | } |
2639 | 2601 | ||
@@ -3110,25 +3072,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
3110 | } | 3072 | } |
3111 | 3073 | ||
3112 | /// <summary> | 3074 | /// <summary> |
3113 | /// Create a child agent scene presence and add it to this scene. | ||
3114 | /// </summary> | ||
3115 | /// <param name="client"></param> | ||
3116 | /// <returns></returns> | ||
3117 | protected virtual ScenePresence CreateAndAddScenePresence(IClientAPI client) | ||
3118 | { | ||
3119 | CheckHeartbeat(); | ||
3120 | AvatarAppearance appearance = null; | ||
3121 | GetAvatarAppearance(client, out appearance); | ||
3122 | |||
3123 | ScenePresence avatar = m_sceneGraph.CreateAndAddChildScenePresence(client, appearance); | ||
3124 | //avatar.KnownRegions = GetChildrenSeeds(avatar.UUID); | ||
3125 | |||
3126 | m_eventManager.TriggerOnNewPresence(avatar); | ||
3127 | |||
3128 | return avatar; | ||
3129 | } | ||
3130 | |||
3131 | /// <summary> | ||
3132 | /// Get the avatar apperance for the given client. | 3075 | /// Get the avatar apperance for the given client. |
3133 | /// </summary> | 3076 | /// </summary> |
3134 | /// <param name="client"></param> | 3077 | /// <param name="client"></param> |
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index 7eebb99..92fe2ab 100644 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs | |||
@@ -82,7 +82,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
82 | protected List<ScenePresence> m_scenePresenceArray = new List<ScenePresence>(); | 82 | protected List<ScenePresence> m_scenePresenceArray = new List<ScenePresence>(); |
83 | 83 | ||
84 | protected internal EntityManager Entities = new EntityManager(); | 84 | protected internal EntityManager Entities = new EntityManager(); |
85 | protected internal Dictionary<UUID, ScenePresence> RestorePresences = new Dictionary<UUID, ScenePresence>(); | ||
86 | 85 | ||
87 | protected RegionInfo m_regInfo; | 86 | protected RegionInfo m_regInfo; |
88 | protected Scene m_parentScene; | 87 | protected Scene m_parentScene; |
@@ -629,8 +628,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
629 | { | 628 | { |
630 | ScenePresence newAvatar = null; | 629 | ScenePresence newAvatar = null; |
631 | 630 | ||
631 | // ScenePresence always defaults to child agent | ||
632 | newAvatar = new ScenePresence(client, m_parentScene, m_regInfo, appearance); | 632 | newAvatar = new ScenePresence(client, m_parentScene, m_regInfo, appearance); |
633 | newAvatar.IsChildAgent = true; | ||
634 | 633 | ||
635 | AddScenePresence(newAvatar); | 634 | AddScenePresence(newAvatar); |
636 | 635 | ||
@@ -643,6 +642,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
643 | /// <param name="presence"></param> | 642 | /// <param name="presence"></param> |
644 | protected internal void AddScenePresence(ScenePresence presence) | 643 | protected internal void AddScenePresence(ScenePresence presence) |
645 | { | 644 | { |
645 | // Always a child when added to the scene | ||
646 | bool child = presence.IsChildAgent; | 646 | bool child = presence.IsChildAgent; |
647 | 647 | ||
648 | if (child) | 648 | if (child) |