aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules
diff options
context:
space:
mode:
authorMelanie2011-01-27 05:18:28 +0000
committerMelanie2011-01-27 05:18:28 +0000
commit42c22f41ddfac9777484be136f80de4251ef6d00 (patch)
treeb13c6e256bcc3fb02a4f3f14ec487b6565c08d28 /OpenSim/Region/CoreModules
parentAdd a TeleportFlags member to SP so we can tell how we got there. (diff)
parentMerge branch 'master' of ssh://opensimulator.org/var/git/opensim (diff)
downloadopensim-SC-42c22f41ddfac9777484be136f80de4251ef6d00.zip
opensim-SC-42c22f41ddfac9777484be136f80de4251ef6d00.tar.gz
opensim-SC-42c22f41ddfac9777484be136f80de4251ef6d00.tar.bz2
opensim-SC-42c22f41ddfac9777484be136f80de4251ef6d00.tar.xz
Merge branch 'master' into careminster-presence-refactor
Diffstat (limited to 'OpenSim/Region/CoreModules')
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs23
-rw-r--r--OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs4
-rw-r--r--OpenSim/Region/CoreModules/World/Land/LandChannel.cs2
-rw-r--r--OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs95
-rw-r--r--OpenSim/Region/CoreModules/World/Land/LandObject.cs40
5 files changed, 133 insertions, 31 deletions
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;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using System.Diagnostics; 31using System.Diagnostics;
32using System.Reflection; 32using System.Reflection;
33using System.Text;
33using log4net; 34using log4net;
34using Nini.Config; 35using Nini.Config;
35using OpenMetaverse; 36using OpenMetaverse;
@@ -37,19 +38,22 @@ using OpenMetaverse.StructuredData;
37using OpenMetaverse.Messages.Linden; 38using OpenMetaverse.Messages.Linden;
38using OpenSim.Framework; 39using OpenSim.Framework;
39using OpenSim.Framework.Capabilities; 40using OpenSim.Framework.Capabilities;
41using OpenSim.Framework.Console;
40using OpenSim.Framework.Servers; 42using OpenSim.Framework.Servers;
41using OpenSim.Framework.Servers.HttpServer; 43using OpenSim.Framework.Servers.HttpServer;
42using OpenSim.Services.Interfaces; 44using OpenSim.Region.CoreModules.Framework.InterfaceCommander;
43using OpenSim.Region.Framework.Interfaces; 45using OpenSim.Region.Framework.Interfaces;
44using OpenSim.Region.Framework.Scenes; 46using OpenSim.Region.Framework.Scenes;
45using OpenSim.Region.Physics.Manager; 47using OpenSim.Region.Physics.Manager;
46using Caps=OpenSim.Framework.Capabilities.Caps; 48using OpenSim.Services.Interfaces;
49using Caps = OpenSim.Framework.Capabilities.Caps;
47using GridRegion = OpenSim.Services.Interfaces.GridRegion; 50using GridRegion = OpenSim.Services.Interfaces.GridRegion;
48 51
49namespace OpenSim.Region.CoreModules.World.Land 52namespace 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>