diff options
Diffstat (limited to 'OpenSim/Region/Application/OpenSim.cs')
-rw-r--r-- | OpenSim/Region/Application/OpenSim.cs | 641 |
1 files changed, 498 insertions, 143 deletions
diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs index c4731a3..5af8194 100644 --- a/OpenSim/Region/Application/OpenSim.cs +++ b/OpenSim/Region/Application/OpenSim.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.IO; | 32 | using System.IO; |
33 | using System.Linq; | ||
33 | using System.Reflection; | 34 | using System.Reflection; |
34 | using System.Text; | 35 | using System.Text; |
35 | using System.Text.RegularExpressions; | 36 | using System.Text.RegularExpressions; |
@@ -44,6 +45,7 @@ using OpenSim.Framework.Servers; | |||
44 | using OpenSim.Framework.Monitoring; | 45 | using OpenSim.Framework.Monitoring; |
45 | using OpenSim.Region.Framework.Interfaces; | 46 | using OpenSim.Region.Framework.Interfaces; |
46 | using OpenSim.Region.Framework.Scenes; | 47 | using OpenSim.Region.Framework.Scenes; |
48 | using OpenSim.Services.Interfaces; | ||
47 | 49 | ||
48 | namespace OpenSim | 50 | namespace OpenSim |
49 | { | 51 | { |
@@ -85,6 +87,7 @@ namespace OpenSim | |||
85 | IConfig startupConfig = Config.Configs["Startup"]; | 87 | IConfig startupConfig = Config.Configs["Startup"]; |
86 | IConfig networkConfig = Config.Configs["Network"]; | 88 | IConfig networkConfig = Config.Configs["Network"]; |
87 | 89 | ||
90 | int stpMinThreads = 2; | ||
88 | int stpMaxThreads = 15; | 91 | int stpMaxThreads = 15; |
89 | 92 | ||
90 | if (startupConfig != null) | 93 | if (startupConfig != null) |
@@ -111,12 +114,13 @@ namespace OpenSim | |||
111 | if (!String.IsNullOrEmpty(asyncCallMethodStr) && Utils.EnumTryParse<FireAndForgetMethod>(asyncCallMethodStr, out asyncCallMethod)) | 114 | if (!String.IsNullOrEmpty(asyncCallMethodStr) && Utils.EnumTryParse<FireAndForgetMethod>(asyncCallMethodStr, out asyncCallMethod)) |
112 | Util.FireAndForgetMethod = asyncCallMethod; | 115 | Util.FireAndForgetMethod = asyncCallMethod; |
113 | 116 | ||
114 | stpMaxThreads = startupConfig.GetInt("MaxPoolThreads", 15); | 117 | stpMinThreads = startupConfig.GetInt("MinPoolThreads", 15); |
118 | stpMaxThreads = startupConfig.GetInt("MaxPoolThreads", 300); | ||
115 | m_consolePrompt = startupConfig.GetString("ConsolePrompt", @"Region (\R) "); | 119 | m_consolePrompt = startupConfig.GetString("ConsolePrompt", @"Region (\R) "); |
116 | } | 120 | } |
117 | 121 | ||
118 | if (Util.FireAndForgetMethod == FireAndForgetMethod.SmartThreadPool) | 122 | if (Util.FireAndForgetMethod == FireAndForgetMethod.SmartThreadPool) |
119 | Util.InitThreadPool(stpMaxThreads); | 123 | Util.InitThreadPool(stpMinThreads, stpMaxThreads); |
120 | 124 | ||
121 | m_log.Info("[OPENSIM MAIN]: Using async_call_method " + Util.FireAndForgetMethod); | 125 | m_log.Info("[OPENSIM MAIN]: Using async_call_method " + Util.FireAndForgetMethod); |
122 | } | 126 | } |
@@ -151,13 +155,14 @@ namespace OpenSim | |||
151 | ((RemoteConsole)m_console).ReadConfig(Config); | 155 | ((RemoteConsole)m_console).ReadConfig(Config); |
152 | break; | 156 | break; |
153 | default: | 157 | default: |
154 | m_console = new LocalConsole("Region"); | 158 | m_console = new LocalConsole("Region", Config.Configs["Startup"]); |
155 | break; | 159 | break; |
156 | } | 160 | } |
157 | } | 161 | } |
158 | 162 | ||
159 | MainConsole.Instance = m_console; | 163 | MainConsole.Instance = m_console; |
160 | 164 | ||
165 | LogEnvironmentInformation(); | ||
161 | RegisterCommonAppenders(Config.Configs["Startup"]); | 166 | RegisterCommonAppenders(Config.Configs["Startup"]); |
162 | RegisterConsoleCommands(); | 167 | RegisterConsoleCommands(); |
163 | 168 | ||
@@ -168,6 +173,13 @@ namespace OpenSim | |||
168 | if (userStatsURI != String.Empty) | 173 | if (userStatsURI != String.Empty) |
169 | MainServer.Instance.AddStreamHandler(new OpenSim.UXSimStatusHandler(this)); | 174 | MainServer.Instance.AddStreamHandler(new OpenSim.UXSimStatusHandler(this)); |
170 | 175 | ||
176 | if (managedStatsURI != String.Empty) | ||
177 | { | ||
178 | string urlBase = String.Format("/{0}/", managedStatsURI); | ||
179 | MainServer.Instance.AddHTTPHandler(urlBase, StatsManager.HandleStatsRequest); | ||
180 | m_log.InfoFormat("[OPENSIM] Enabling remote managed stats fetch. URL = {0}", urlBase); | ||
181 | } | ||
182 | |||
171 | if (m_console is RemoteConsole) | 183 | if (m_console is RemoteConsole) |
172 | { | 184 | { |
173 | if (m_consolePort == 0) | 185 | if (m_consolePort == 0) |
@@ -224,49 +236,56 @@ namespace OpenSim | |||
224 | "Force the update of all objects on clients", | 236 | "Force the update of all objects on clients", |
225 | HandleForceUpdate); | 237 | HandleForceUpdate); |
226 | 238 | ||
227 | m_console.Commands.AddCommand("Debug", false, "debug packet", | ||
228 | "debug packet <level> [<avatar-first-name> <avatar-last-name>]", | ||
229 | "Turn on packet debugging", | ||
230 | "If level > 255 then all incoming and outgoing packets are logged.\n" | ||
231 | + "If level <= 255 then incoming AgentUpdate and outgoing SimStats and SimulatorViewerTimeMessage packets are not logged.\n" | ||
232 | + "If level <= 200 then incoming RequestImage and outgoing ImagePacket, ImageData, LayerData and CoarseLocationUpdate packets are not logged.\n" | ||
233 | + "If level <= 100 then incoming ViewerEffect and AgentAnimation and outgoing ViewerEffect and AvatarAnimation packets are not logged.\n" | ||
234 | + "If level <= 50 then outgoing ImprovedTerseObjectUpdate packets are not logged.\n" | ||
235 | + "If level <= 0 then no packets are logged.\n" | ||
236 | + "If an avatar name is given then only packets from that avatar are logged", | ||
237 | Debug); | ||
238 | |||
239 | m_console.Commands.AddCommand("General", false, "change region", | 239 | m_console.Commands.AddCommand("General", false, "change region", |
240 | "change region <region name>", | 240 | "change region <region name>", |
241 | "Change current console region", ChangeSelectedRegion); | 241 | "Change current console region", |
242 | ChangeSelectedRegion); | ||
242 | 243 | ||
243 | m_console.Commands.AddCommand("Archiving", false, "save xml", | 244 | m_console.Commands.AddCommand("Archiving", false, "save xml", |
244 | "save xml", | 245 | "save xml", |
245 | "Save a region's data in XML format", SaveXml); | 246 | "Save a region's data in XML format", |
247 | SaveXml); | ||
246 | 248 | ||
247 | m_console.Commands.AddCommand("Archiving", false, "save xml2", | 249 | m_console.Commands.AddCommand("Archiving", false, "save xml2", |
248 | "save xml2", | 250 | "save xml2", |
249 | "Save a region's data in XML2 format", SaveXml2); | 251 | "Save a region's data in XML2 format", |
252 | SaveXml2); | ||
250 | 253 | ||
251 | m_console.Commands.AddCommand("Archiving", false, "load xml", | 254 | m_console.Commands.AddCommand("Archiving", false, "load xml", |
252 | "load xml [-newIDs [<x> <y> <z>]]", | 255 | "load xml [-newIDs [<x> <y> <z>]]", |
253 | "Load a region's data from XML format", LoadXml); | 256 | "Load a region's data from XML format", |
257 | LoadXml); | ||
254 | 258 | ||
255 | m_console.Commands.AddCommand("Archiving", false, "load xml2", | 259 | m_console.Commands.AddCommand("Archiving", false, "load xml2", |
256 | "load xml2", | 260 | "load xml2", |
257 | "Load a region's data from XML2 format", LoadXml2); | 261 | "Load a region's data from XML2 format", |
262 | LoadXml2); | ||
258 | 263 | ||
259 | m_console.Commands.AddCommand("Archiving", false, "save prims xml2", | 264 | m_console.Commands.AddCommand("Archiving", false, "save prims xml2", |
260 | "save prims xml2 [<prim name> <file name>]", | 265 | "save prims xml2 [<prim name> <file name>]", |
261 | "Save named prim to XML2", SavePrimsXml2); | 266 | "Save named prim to XML2", |
267 | SavePrimsXml2); | ||
262 | 268 | ||
263 | m_console.Commands.AddCommand("Archiving", false, "load oar", | 269 | m_console.Commands.AddCommand("Archiving", false, "load oar", |
264 | "load oar [--merge] [--skip-assets] [<OAR path>]", | 270 | "load oar [--merge] [--skip-assets]" |
271 | + " [--default-user \"User Name\"]" | ||
272 | + " [--force-terrain] [--force-parcels]" | ||
273 | + " [--no-objects]" | ||
274 | + " [--rotation degrees] [--rotation-center \"<x,y,z>\"]" | ||
275 | + " [--displacement \"<x,y,z>\"]" | ||
276 | + " [<OAR path>]", | ||
265 | "Load a region's data from an OAR archive.", | 277 | "Load a region's data from an OAR archive.", |
266 | "--merge will merge the OAR with the existing scene." + Environment.NewLine | 278 | "--merge will merge the OAR with the existing scene (suppresses terrain and parcel info loading).\n" |
267 | + "--skip-assets will load the OAR but ignore the assets it contains." + Environment.NewLine | 279 | + "--default-user will use this user for any objects with an owner whose UUID is not found in the grid.\n" |
268 | + "The path can be either a filesystem location or a URI." | 280 | + "--displacement will add this value to the position of every object loaded.\n" |
269 | + " If this is not given then the command looks for an OAR named region.oar in the current directory.", | 281 | + "--force-terrain forces the loading of terrain from the oar (undoes suppression done by --merge).\n" |
282 | + "--force-parcels forces the loading of parcels from the oar (undoes suppression done by --merge).\n" | ||
283 | + "--no-objects suppresses the addition of any objects (good for loading only the terrain).\n" | ||
284 | + "--rotation specified rotation to be applied to the oar. Specified in degrees.\n" | ||
285 | + "--rotation-center Location (relative to original OAR) to apply rotation. Default is <128,128,0>.\n" | ||
286 | + "--skip-assets will load the OAR but ignore the assets it contains.\n\n" | ||
287 | + "The path can be either a filesystem location or a URI.\n" | ||
288 | + " If this is not given then the command looks for an OAR named region.oar in the current directory.", | ||
270 | LoadOar); | 289 | LoadOar); |
271 | 290 | ||
272 | m_console.Commands.AddCommand("Archiving", false, "save oar", | 291 | m_console.Commands.AddCommand("Archiving", false, "save oar", |
@@ -288,7 +307,23 @@ namespace OpenSim | |||
288 | 307 | ||
289 | m_console.Commands.AddCommand("Objects", false, "edit scale", | 308 | m_console.Commands.AddCommand("Objects", false, "edit scale", |
290 | "edit scale <name> <x> <y> <z>", | 309 | "edit scale <name> <x> <y> <z>", |
291 | "Change the scale of a named prim", HandleEditScale); | 310 | "Change the scale of a named prim", |
311 | HandleEditScale); | ||
312 | |||
313 | m_console.Commands.AddCommand("Objects", false, "rotate scene", | ||
314 | "rotate scene <degrees> [centerX, centerY]", | ||
315 | "Rotates all scene objects around centerX, centerY (defailt 128, 128) (please back up your region before using)", | ||
316 | HandleRotateScene); | ||
317 | |||
318 | m_console.Commands.AddCommand("Objects", false, "scale scene", | ||
319 | "scale scene <factor>", | ||
320 | "Scales the scene objects (please back up your region before using)", | ||
321 | HandleScaleScene); | ||
322 | |||
323 | m_console.Commands.AddCommand("Objects", false, "translate scene", | ||
324 | "translate scene xOffset yOffset zOffset", | ||
325 | "translates the scene objects (please back up your region before using)", | ||
326 | HandleTranslateScene); | ||
292 | 327 | ||
293 | m_console.Commands.AddCommand("Users", false, "kick user", | 328 | m_console.Commands.AddCommand("Users", false, "kick user", |
294 | "kick user <first> <last> [--force] [message]", | 329 | "kick user <first> <last> [--force] [message]", |
@@ -306,31 +341,38 @@ namespace OpenSim | |||
306 | 341 | ||
307 | m_console.Commands.AddCommand("Comms", false, "show connections", | 342 | m_console.Commands.AddCommand("Comms", false, "show connections", |
308 | "show connections", | 343 | "show connections", |
309 | "Show connection data", HandleShow); | 344 | "Show connection data", |
345 | HandleShow); | ||
310 | 346 | ||
311 | m_console.Commands.AddCommand("Comms", false, "show circuits", | 347 | m_console.Commands.AddCommand("Comms", false, "show circuits", |
312 | "show circuits", | 348 | "show circuits", |
313 | "Show agent circuit data", HandleShow); | 349 | "Show agent circuit data", |
350 | HandleShow); | ||
314 | 351 | ||
315 | m_console.Commands.AddCommand("Comms", false, "show pending-objects", | 352 | m_console.Commands.AddCommand("Comms", false, "show pending-objects", |
316 | "show pending-objects", | 353 | "show pending-objects", |
317 | "Show # of objects on the pending queues of all scene viewers", HandleShow); | 354 | "Show # of objects on the pending queues of all scene viewers", |
355 | HandleShow); | ||
318 | 356 | ||
319 | m_console.Commands.AddCommand("General", false, "show modules", | 357 | m_console.Commands.AddCommand("General", false, "show modules", |
320 | "show modules", | 358 | "show modules", |
321 | "Show module data", HandleShow); | 359 | "Show module data", |
360 | HandleShow); | ||
322 | 361 | ||
323 | m_console.Commands.AddCommand("Regions", false, "show regions", | 362 | m_console.Commands.AddCommand("Regions", false, "show regions", |
324 | "show regions", | 363 | "show regions", |
325 | "Show region data", HandleShow); | 364 | "Show region data", |
365 | HandleShow); | ||
326 | 366 | ||
327 | m_console.Commands.AddCommand("Regions", false, "show ratings", | 367 | m_console.Commands.AddCommand("Regions", false, "show ratings", |
328 | "show ratings", | 368 | "show ratings", |
329 | "Show rating data", HandleShow); | 369 | "Show rating data", |
370 | HandleShow); | ||
330 | 371 | ||
331 | m_console.Commands.AddCommand("Objects", false, "backup", | 372 | m_console.Commands.AddCommand("Objects", false, "backup", |
332 | "backup", | 373 | "backup", |
333 | "Persist currently unsaved object changes immediately instead of waiting for the normal persistence call.", RunCommand); | 374 | "Persist currently unsaved object changes immediately instead of waiting for the normal persistence call.", |
375 | RunCommand); | ||
334 | 376 | ||
335 | m_console.Commands.AddCommand("Regions", false, "create region", | 377 | m_console.Commands.AddCommand("Regions", false, "create region", |
336 | "create region [\"region name\"] <region_file.ini>", | 378 | "create region [\"region name\"] <region_file.ini>", |
@@ -343,34 +385,47 @@ namespace OpenSim | |||
343 | 385 | ||
344 | m_console.Commands.AddCommand("Regions", false, "restart", | 386 | m_console.Commands.AddCommand("Regions", false, "restart", |
345 | "restart", | 387 | "restart", |
346 | "Restart all sims in this instance", RunCommand); | 388 | "Restart the currently selected region(s) in this instance", |
389 | RunCommand); | ||
347 | 390 | ||
348 | m_console.Commands.AddCommand("General", false, "command-script", | 391 | m_console.Commands.AddCommand("General", false, "command-script", |
349 | "command-script <script>", | 392 | "command-script <script>", |
350 | "Run a command script from file", RunCommand); | 393 | "Run a command script from file", |
394 | RunCommand); | ||
351 | 395 | ||
352 | m_console.Commands.AddCommand("Regions", false, "remove-region", | 396 | m_console.Commands.AddCommand("Regions", false, "remove-region", |
353 | "remove-region <name>", | 397 | "remove-region <name>", |
354 | "Remove a region from this simulator", RunCommand); | 398 | "Remove a region from this simulator", |
399 | RunCommand); | ||
355 | 400 | ||
356 | m_console.Commands.AddCommand("Regions", false, "delete-region", | 401 | m_console.Commands.AddCommand("Regions", false, "delete-region", |
357 | "delete-region <name>", | 402 | "delete-region <name>", |
358 | "Delete a region from disk", RunCommand); | 403 | "Delete a region from disk", |
359 | 404 | RunCommand); | |
360 | m_console.Commands.AddCommand("General", false, "modules list", | 405 | |
361 | "modules list", | 406 | m_console.Commands.AddCommand("Estates", false, "estate create", |
362 | "List modules", HandleModules); | 407 | "estate create <owner UUID> <estate name>", |
363 | 408 | "Creates a new estate with the specified name, owned by the specified user." | |
364 | m_console.Commands.AddCommand("General", false, "modules load", | 409 | + " Estate name must be unique.", |
365 | "modules load <name>", | 410 | CreateEstateCommand); |
366 | "Load a module", HandleModules); | 411 | |
367 | 412 | m_console.Commands.AddCommand("Estates", false, "estate set owner", | |
368 | m_console.Commands.AddCommand("General", false, "modules unload", | 413 | "estate set owner <estate-id>[ <UUID> | <Firstname> <Lastname> ]", |
369 | "modules unload <name>", | 414 | "Sets the owner of the specified estate to the specified UUID or user. ", |
370 | "Unload a module", HandleModules); | 415 | SetEstateOwnerCommand); |
416 | |||
417 | m_console.Commands.AddCommand("Estates", false, "estate set name", | ||
418 | "estate set name <estate-id> <new name>", | ||
419 | "Sets the name of the specified estate to the specified value. New name must be unique.", | ||
420 | SetEstateNameCommand); | ||
421 | |||
422 | m_console.Commands.AddCommand("Estates", false, "estate link region", | ||
423 | "estate link region <estate ID> <region ID>", | ||
424 | "Attaches the specified region to the specified estate.", | ||
425 | EstateLinkRegionCommand); | ||
371 | } | 426 | } |
372 | 427 | ||
373 | public override void ShutdownSpecific() | 428 | protected override void ShutdownSpecific() |
374 | { | 429 | { |
375 | if (m_shutdownCommandsFile != String.Empty) | 430 | if (m_shutdownCommandsFile != String.Empty) |
376 | { | 431 | { |
@@ -433,8 +488,8 @@ namespace OpenSim | |||
433 | { | 488 | { |
434 | RegionInfo regionInfo = presence.Scene.RegionInfo; | 489 | RegionInfo regionInfo = presence.Scene.RegionInfo; |
435 | 490 | ||
436 | if (presence.Firstname.ToLower().Contains(mainParams[2].ToLower()) && | 491 | if (presence.Firstname.ToLower().Equals(mainParams[2].ToLower()) && |
437 | presence.Lastname.ToLower().Contains(mainParams[3].ToLower())) | 492 | presence.Lastname.ToLower().Equals(mainParams[3].ToLower())) |
438 | { | 493 | { |
439 | MainConsole.Instance.Output( | 494 | MainConsole.Instance.Output( |
440 | String.Format( | 495 | String.Format( |
@@ -447,7 +502,8 @@ namespace OpenSim | |||
447 | else | 502 | else |
448 | presence.ControllingClient.Kick("\nThe OpenSim manager kicked you out.\n"); | 503 | presence.ControllingClient.Kick("\nThe OpenSim manager kicked you out.\n"); |
449 | 504 | ||
450 | presence.Scene.IncomingCloseAgent(presence.UUID, force); | 505 | presence.Scene.CloseAgent(presence.UUID, force); |
506 | break; | ||
451 | } | 507 | } |
452 | } | 508 | } |
453 | 509 | ||
@@ -499,6 +555,121 @@ namespace OpenSim | |||
499 | } | 555 | } |
500 | } | 556 | } |
501 | 557 | ||
558 | private void HandleRotateScene(string module, string[] args) | ||
559 | { | ||
560 | string usage = "Usage: rotate scene <angle in degrees> [centerX centerY] (centerX and centerY are optional and default to Constants.RegionSize / 2"; | ||
561 | |||
562 | float centerX = Constants.RegionSize * 0.5f; | ||
563 | float centerY = Constants.RegionSize * 0.5f; | ||
564 | |||
565 | if (args.Length < 3 || args.Length == 4) | ||
566 | { | ||
567 | MainConsole.Instance.Output(usage); | ||
568 | return; | ||
569 | } | ||
570 | |||
571 | float angle = (float)(Convert.ToSingle(args[2]) / 180.0 * Math.PI); | ||
572 | OpenMetaverse.Quaternion rot = OpenMetaverse.Quaternion.CreateFromAxisAngle(0, 0, 1, angle); | ||
573 | |||
574 | if (args.Length > 4) | ||
575 | { | ||
576 | centerX = Convert.ToSingle(args[3]); | ||
577 | centerY = Convert.ToSingle(args[4]); | ||
578 | } | ||
579 | |||
580 | Vector3 center = new Vector3(centerX, centerY, 0.0f); | ||
581 | |||
582 | SceneManager.ForEachSelectedScene(delegate(Scene scene) | ||
583 | { | ||
584 | scene.ForEachSOG(delegate(SceneObjectGroup sog) | ||
585 | { | ||
586 | if (!sog.IsAttachment) | ||
587 | { | ||
588 | sog.RootPart.UpdateRotation(rot * sog.GroupRotation); | ||
589 | Vector3 offset = sog.AbsolutePosition - center; | ||
590 | offset *= rot; | ||
591 | sog.UpdateGroupPosition(center + offset); | ||
592 | } | ||
593 | }); | ||
594 | }); | ||
595 | } | ||
596 | |||
597 | private void HandleScaleScene(string module, string[] args) | ||
598 | { | ||
599 | string usage = "Usage: scale scene <factor>"; | ||
600 | |||
601 | if (args.Length < 3) | ||
602 | { | ||
603 | MainConsole.Instance.Output(usage); | ||
604 | return; | ||
605 | } | ||
606 | |||
607 | float factor = (float)(Convert.ToSingle(args[2])); | ||
608 | |||
609 | float minZ = float.MaxValue; | ||
610 | |||
611 | SceneManager.ForEachSelectedScene(delegate(Scene scene) | ||
612 | { | ||
613 | scene.ForEachSOG(delegate(SceneObjectGroup sog) | ||
614 | { | ||
615 | if (!sog.IsAttachment) | ||
616 | { | ||
617 | if (sog.RootPart.AbsolutePosition.Z < minZ) | ||
618 | minZ = sog.RootPart.AbsolutePosition.Z; | ||
619 | } | ||
620 | }); | ||
621 | }); | ||
622 | |||
623 | SceneManager.ForEachSelectedScene(delegate(Scene scene) | ||
624 | { | ||
625 | scene.ForEachSOG(delegate(SceneObjectGroup sog) | ||
626 | { | ||
627 | if (!sog.IsAttachment) | ||
628 | { | ||
629 | Vector3 tmpRootPos = sog.RootPart.AbsolutePosition; | ||
630 | tmpRootPos.Z -= minZ; | ||
631 | tmpRootPos *= factor; | ||
632 | tmpRootPos.Z += minZ; | ||
633 | |||
634 | foreach (SceneObjectPart sop in sog.Parts) | ||
635 | { | ||
636 | if (sop.ParentID != 0) | ||
637 | sop.OffsetPosition *= factor; | ||
638 | sop.Scale *= factor; | ||
639 | } | ||
640 | |||
641 | sog.UpdateGroupPosition(tmpRootPos); | ||
642 | } | ||
643 | }); | ||
644 | }); | ||
645 | } | ||
646 | |||
647 | private void HandleTranslateScene(string module, string[] args) | ||
648 | { | ||
649 | string usage = "Usage: translate scene <xOffset, yOffset, zOffset>"; | ||
650 | |||
651 | if (args.Length < 5) | ||
652 | { | ||
653 | MainConsole.Instance.Output(usage); | ||
654 | return; | ||
655 | } | ||
656 | |||
657 | float xOFfset = (float)Convert.ToSingle(args[2]); | ||
658 | float yOffset = (float)Convert.ToSingle(args[3]); | ||
659 | float zOffset = (float)Convert.ToSingle(args[4]); | ||
660 | |||
661 | Vector3 offset = new Vector3(xOFfset, yOffset, zOffset); | ||
662 | |||
663 | SceneManager.ForEachSelectedScene(delegate(Scene scene) | ||
664 | { | ||
665 | scene.ForEachSOG(delegate(SceneObjectGroup sog) | ||
666 | { | ||
667 | if (!sog.IsAttachment) | ||
668 | sog.UpdateGroupPosition(sog.AbsolutePosition + offset); | ||
669 | }); | ||
670 | }); | ||
671 | } | ||
672 | |||
502 | /// <summary> | 673 | /// <summary> |
503 | /// Creates a new region based on the parameters specified. This will ask the user questions on the console | 674 | /// Creates a new region based on the parameters specified. This will ask the user questions on the console |
504 | /// </summary> | 675 | /// </summary> |
@@ -560,35 +731,9 @@ namespace OpenSim | |||
560 | CreateRegion(regInfo, true, out scene); | 731 | CreateRegion(regInfo, true, out scene); |
561 | 732 | ||
562 | if (changed) | 733 | if (changed) |
563 | regInfo.EstateSettings.Save(); | 734 | m_estateDataService.StoreEstateSettings(regInfo.EstateSettings); |
564 | } | 735 | |
565 | 736 | scene.Start(); | |
566 | /// <summary> | ||
567 | /// Load, Unload, and list Region modules in use | ||
568 | /// </summary> | ||
569 | /// <param name="module"></param> | ||
570 | /// <param name="cmd"></param> | ||
571 | private void HandleModules(string module, string[] cmd) | ||
572 | { | ||
573 | List<string> args = new List<string>(cmd); | ||
574 | args.RemoveAt(0); | ||
575 | string[] cmdparams = args.ToArray(); | ||
576 | |||
577 | if (cmdparams.Length > 0) | ||
578 | { | ||
579 | switch (cmdparams[0].ToLower()) | ||
580 | { | ||
581 | case "list": | ||
582 | //TODO: Convert to new region modules | ||
583 | break; | ||
584 | case "unload": | ||
585 | //TODO: Convert to new region modules | ||
586 | break; | ||
587 | case "load": | ||
588 | //TODO: Convert to new region modules | ||
589 | break; | ||
590 | } | ||
591 | } | ||
592 | } | 737 | } |
593 | 738 | ||
594 | /// <summary> | 739 | /// <summary> |
@@ -699,45 +844,6 @@ namespace OpenSim | |||
699 | RefreshPrompt(); | 844 | RefreshPrompt(); |
700 | } | 845 | } |
701 | 846 | ||
702 | /// <summary> | ||
703 | /// Turn on some debugging values for OpenSim. | ||
704 | /// </summary> | ||
705 | /// <param name="args"></param> | ||
706 | protected void Debug(string module, string[] args) | ||
707 | { | ||
708 | if (args.Length == 1) | ||
709 | return; | ||
710 | |||
711 | switch (args[1]) | ||
712 | { | ||
713 | case "packet": | ||
714 | string name = null; | ||
715 | if (args.Length == 5) | ||
716 | name = string.Format("{0} {1}", args[3], args[4]); | ||
717 | |||
718 | if (args.Length > 2) | ||
719 | { | ||
720 | int newDebug; | ||
721 | if (int.TryParse(args[2], out newDebug)) | ||
722 | { | ||
723 | SceneManager.SetDebugPacketLevelOnCurrentScene(newDebug, name); | ||
724 | // We provide user information elsewhere if any clients had their debug level set. | ||
725 | // MainConsole.Instance.OutputFormat("Debug packet level set to {0}", newDebug); | ||
726 | } | ||
727 | else | ||
728 | { | ||
729 | MainConsole.Instance.Output("Usage: debug packet 0..255"); | ||
730 | } | ||
731 | } | ||
732 | |||
733 | break; | ||
734 | |||
735 | default: | ||
736 | MainConsole.Instance.Output("Unknown debug command"); | ||
737 | break; | ||
738 | } | ||
739 | } | ||
740 | |||
741 | // see BaseOpenSimServer | 847 | // see BaseOpenSimServer |
742 | /// <summary> | 848 | /// <summary> |
743 | /// Many commands list objects for debugging. Some of the types are listed here | 849 | /// Many commands list objects for debugging. Some of the types are listed here |
@@ -808,33 +914,58 @@ namespace OpenSim | |||
808 | break; | 914 | break; |
809 | 915 | ||
810 | case "modules": | 916 | case "modules": |
811 | SceneManager.ForEachScene( | 917 | SceneManager.ForEachSelectedScene( |
812 | delegate(Scene scene) { | 918 | scene => |
813 | MainConsole.Instance.Output("Loaded region modules in" + scene.RegionInfo.RegionName + " are:"); | ||
814 | foreach (IRegionModuleBase module in scene.RegionModules.Values) | ||
815 | { | 919 | { |
816 | Type type = module.GetType().GetInterface("ISharedRegionModule"); | 920 | MainConsole.Instance.OutputFormat("Loaded region modules in {0} are:", scene.Name); |
817 | string module_type = type != null ? "Shared" : "Non-Shared"; | 921 | |
818 | MainConsole.Instance.OutputFormat("New Region Module ({0}): {1}", module_type, module.Name); | 922 | List<IRegionModuleBase> sharedModules = new List<IRegionModuleBase>(); |
923 | List<IRegionModuleBase> nonSharedModules = new List<IRegionModuleBase>(); | ||
924 | |||
925 | foreach (IRegionModuleBase module in scene.RegionModules.Values) | ||
926 | { | ||
927 | if (module.GetType().GetInterface("ISharedRegionModule") == null) | ||
928 | nonSharedModules.Add(module); | ||
929 | else | ||
930 | sharedModules.Add(module); | ||
931 | } | ||
932 | |||
933 | foreach (IRegionModuleBase module in sharedModules.OrderBy(m => m.Name)) | ||
934 | MainConsole.Instance.OutputFormat("New Region Module (Shared): {0}", module.Name); | ||
935 | |||
936 | foreach (IRegionModuleBase module in nonSharedModules.OrderBy(m => m.Name)) | ||
937 | MainConsole.Instance.OutputFormat("New Region Module (Non-Shared): {0}", module.Name); | ||
819 | } | 938 | } |
820 | } | ||
821 | ); | 939 | ); |
822 | 940 | ||
823 | MainConsole.Instance.Output(""); | 941 | MainConsole.Instance.Output(""); |
824 | break; | 942 | break; |
825 | 943 | ||
826 | case "regions": | 944 | case "regions": |
945 | ConsoleDisplayTable cdt = new ConsoleDisplayTable(); | ||
946 | cdt.AddColumn("Name", ConsoleDisplayUtil.RegionNameSize); | ||
947 | cdt.AddColumn("ID", ConsoleDisplayUtil.UuidSize); | ||
948 | cdt.AddColumn("Position", ConsoleDisplayUtil.CoordTupleSize); | ||
949 | cdt.AddColumn("Size", 11); | ||
950 | cdt.AddColumn("Port", ConsoleDisplayUtil.PortSize); | ||
951 | cdt.AddColumn("Ready?", 6); | ||
952 | cdt.AddColumn("Estate", ConsoleDisplayUtil.EstateNameSize); | ||
827 | SceneManager.ForEachScene( | 953 | SceneManager.ForEachScene( |
828 | delegate(Scene scene) | 954 | scene => |
829 | { | 955 | { |
830 | MainConsole.Instance.Output(String.Format( | 956 | RegionInfo ri = scene.RegionInfo; |
831 | "Region Name: {0}, Region XLoc: {1}, Region YLoc: {2}, Region Port: {3}, Estate Name: {4}", | 957 | cdt.AddRow( |
832 | scene.RegionInfo.RegionName, | 958 | ri.RegionName, |
833 | scene.RegionInfo.RegionLocX, | 959 | ri.RegionID, |
834 | scene.RegionInfo.RegionLocY, | 960 | string.Format("{0},{1}", ri.RegionLocX, ri.RegionLocY), |
835 | scene.RegionInfo.InternalEndPoint.Port, | 961 | string.Format("{0}x{1}", ri.RegionSizeX, ri.RegionSizeY), |
836 | scene.RegionInfo.EstateSettings.EstateName)); | 962 | ri.InternalEndPoint.Port, |
837 | }); | 963 | scene.Ready ? "Yes" : "No", |
964 | ri.EstateSettings.EstateName); | ||
965 | } | ||
966 | ); | ||
967 | |||
968 | MainConsole.Instance.Output(cdt.ToString()); | ||
838 | break; | 969 | break; |
839 | 970 | ||
840 | case "ratings": | 971 | case "ratings": |
@@ -883,7 +1014,7 @@ namespace OpenSim | |||
883 | aCircuit.child ? "child" : "root", | 1014 | aCircuit.child ? "child" : "root", |
884 | aCircuit.circuitcode.ToString(), | 1015 | aCircuit.circuitcode.ToString(), |
885 | aCircuit.IPAddress != null ? aCircuit.IPAddress.ToString() : "not set", | 1016 | aCircuit.IPAddress != null ? aCircuit.IPAddress.ToString() : "not set", |
886 | aCircuit.Viewer); | 1017 | Util.GetViewerName(aCircuit)); |
887 | }); | 1018 | }); |
888 | 1019 | ||
889 | MainConsole.Instance.Output(cdt.ToString()); | 1020 | MainConsole.Instance.Output(cdt.ToString()); |
@@ -1066,6 +1197,232 @@ namespace OpenSim | |||
1066 | SceneManager.SaveCurrentSceneToArchive(cmdparams); | 1197 | SceneManager.SaveCurrentSceneToArchive(cmdparams); |
1067 | } | 1198 | } |
1068 | 1199 | ||
1200 | protected void CreateEstateCommand(string module, string[] args) | ||
1201 | { | ||
1202 | string response = null; | ||
1203 | UUID userID; | ||
1204 | |||
1205 | if (args.Length == 2) | ||
1206 | { | ||
1207 | response = "No user specified."; | ||
1208 | } | ||
1209 | else if (!UUID.TryParse(args[2], out userID)) | ||
1210 | { | ||
1211 | response = String.Format("{0} is not a valid UUID", args[2]); | ||
1212 | } | ||
1213 | else if (args.Length == 3) | ||
1214 | { | ||
1215 | response = "No estate name specified."; | ||
1216 | } | ||
1217 | else | ||
1218 | { | ||
1219 | Scene scene = SceneManager.CurrentOrFirstScene; | ||
1220 | |||
1221 | // TODO: Is there a better choice here? | ||
1222 | UUID scopeID = UUID.Zero; | ||
1223 | UserAccount account = scene.UserAccountService.GetUserAccount(scopeID, userID); | ||
1224 | if (account == null) | ||
1225 | { | ||
1226 | response = String.Format("Could not find user {0}", userID); | ||
1227 | } | ||
1228 | else | ||
1229 | { | ||
1230 | // concatenate it all to "name" | ||
1231 | StringBuilder sb = new StringBuilder(args[3]); | ||
1232 | for (int i = 4; i < args.Length; i++) | ||
1233 | sb.Append (" " + args[i]); | ||
1234 | string estateName = sb.ToString().Trim(); | ||
1235 | |||
1236 | // send it off for processing. | ||
1237 | IEstateModule estateModule = scene.RequestModuleInterface<IEstateModule>(); | ||
1238 | response = estateModule.CreateEstate(estateName, userID); | ||
1239 | if (response == String.Empty) | ||
1240 | { | ||
1241 | List<int> estates = scene.EstateDataService.GetEstates(estateName); | ||
1242 | response = String.Format("Estate {0} created as \"{1}\"", estates.ElementAt(0), estateName); | ||
1243 | } | ||
1244 | } | ||
1245 | } | ||
1246 | |||
1247 | // give the user some feedback | ||
1248 | if (response != null) | ||
1249 | MainConsole.Instance.Output(response); | ||
1250 | } | ||
1251 | |||
1252 | protected void SetEstateOwnerCommand(string module, string[] args) | ||
1253 | { | ||
1254 | string response = null; | ||
1255 | |||
1256 | Scene scene = SceneManager.CurrentOrFirstScene; | ||
1257 | IEstateModule estateModule = scene.RequestModuleInterface<IEstateModule>(); | ||
1258 | |||
1259 | if (args.Length == 3) | ||
1260 | { | ||
1261 | response = "No estate specified."; | ||
1262 | } | ||
1263 | else | ||
1264 | { | ||
1265 | int estateId; | ||
1266 | if (!int.TryParse(args[3], out estateId)) | ||
1267 | { | ||
1268 | response = String.Format("\"{0}\" is not a valid ID for an Estate", args[3]); | ||
1269 | } | ||
1270 | else | ||
1271 | { | ||
1272 | if (args.Length == 4) | ||
1273 | { | ||
1274 | response = "No user specified."; | ||
1275 | } | ||
1276 | else | ||
1277 | { | ||
1278 | UserAccount account = null; | ||
1279 | |||
1280 | // TODO: Is there a better choice here? | ||
1281 | UUID scopeID = UUID.Zero; | ||
1282 | |||
1283 | string s1 = args[4]; | ||
1284 | if (args.Length == 5) | ||
1285 | { | ||
1286 | // attempt to get account by UUID | ||
1287 | UUID u; | ||
1288 | if (UUID.TryParse(s1, out u)) | ||
1289 | { | ||
1290 | account = scene.UserAccountService.GetUserAccount(scopeID, u); | ||
1291 | if (account == null) | ||
1292 | response = String.Format("Could not find user {0}", s1); | ||
1293 | } | ||
1294 | else | ||
1295 | { | ||
1296 | response = String.Format("Invalid UUID {0}", s1); | ||
1297 | } | ||
1298 | } | ||
1299 | else | ||
1300 | { | ||
1301 | // attempt to get account by Firstname, Lastname | ||
1302 | string s2 = args[5]; | ||
1303 | account = scene.UserAccountService.GetUserAccount(scopeID, s1, s2); | ||
1304 | if (account == null) | ||
1305 | response = String.Format("Could not find user {0} {1}", s1, s2); | ||
1306 | } | ||
1307 | |||
1308 | // If it's valid, send it off for processing. | ||
1309 | if (account != null) | ||
1310 | response = estateModule.SetEstateOwner(estateId, account); | ||
1311 | |||
1312 | if (response == String.Empty) | ||
1313 | { | ||
1314 | response = String.Format("Estate owner changed to {0} ({1} {2})", account.PrincipalID, account.FirstName, account.LastName); | ||
1315 | } | ||
1316 | } | ||
1317 | } | ||
1318 | } | ||
1319 | |||
1320 | // give the user some feedback | ||
1321 | if (response != null) | ||
1322 | MainConsole.Instance.Output(response); | ||
1323 | } | ||
1324 | |||
1325 | protected void SetEstateNameCommand(string module, string[] args) | ||
1326 | { | ||
1327 | string response = null; | ||
1328 | |||
1329 | Scene scene = SceneManager.CurrentOrFirstScene; | ||
1330 | IEstateModule estateModule = scene.RequestModuleInterface<IEstateModule>(); | ||
1331 | |||
1332 | if (args.Length == 3) | ||
1333 | { | ||
1334 | response = "No estate specified."; | ||
1335 | } | ||
1336 | else | ||
1337 | { | ||
1338 | int estateId; | ||
1339 | if (!int.TryParse(args[3], out estateId)) | ||
1340 | { | ||
1341 | response = String.Format("\"{0}\" is not a valid ID for an Estate", args[3]); | ||
1342 | } | ||
1343 | else | ||
1344 | { | ||
1345 | if (args.Length == 4) | ||
1346 | { | ||
1347 | response = "No name specified."; | ||
1348 | } | ||
1349 | else | ||
1350 | { | ||
1351 | // everything after the estate ID is "name" | ||
1352 | StringBuilder sb = new StringBuilder(args[4]); | ||
1353 | for (int i = 5; i < args.Length; i++) | ||
1354 | sb.Append (" " + args[i]); | ||
1355 | |||
1356 | string estateName = sb.ToString(); | ||
1357 | |||
1358 | // send it off for processing. | ||
1359 | response = estateModule.SetEstateName(estateId, estateName); | ||
1360 | |||
1361 | if (response == String.Empty) | ||
1362 | { | ||
1363 | response = String.Format("Estate {0} renamed to \"{1}\"", estateId, estateName); | ||
1364 | } | ||
1365 | } | ||
1366 | } | ||
1367 | } | ||
1368 | |||
1369 | // give the user some feedback | ||
1370 | if (response != null) | ||
1371 | MainConsole.Instance.Output(response); | ||
1372 | } | ||
1373 | |||
1374 | private void EstateLinkRegionCommand(string module, string[] args) | ||
1375 | { | ||
1376 | int estateId =-1; | ||
1377 | UUID regionId = UUID.Zero; | ||
1378 | Scene scene = null; | ||
1379 | string response = null; | ||
1380 | |||
1381 | if (args.Length == 3) | ||
1382 | { | ||
1383 | response = "No estate specified."; | ||
1384 | } | ||
1385 | else if (!int.TryParse(args [3], out estateId)) | ||
1386 | { | ||
1387 | response = String.Format("\"{0}\" is not a valid ID for an Estate", args [3]); | ||
1388 | } | ||
1389 | else if (args.Length == 4) | ||
1390 | { | ||
1391 | response = "No region specified."; | ||
1392 | } | ||
1393 | else if (!UUID.TryParse(args[4], out regionId)) | ||
1394 | { | ||
1395 | response = String.Format("\"{0}\" is not a valid UUID for a Region", args [4]); | ||
1396 | } | ||
1397 | else if (!SceneManager.TryGetScene(regionId, out scene)) | ||
1398 | { | ||
1399 | // region may exist, but on a different sim. | ||
1400 | response = String.Format("No access to Region \"{0}\"", args [4]); | ||
1401 | } | ||
1402 | |||
1403 | if (response != null) | ||
1404 | { | ||
1405 | MainConsole.Instance.Output(response); | ||
1406 | return; | ||
1407 | } | ||
1408 | |||
1409 | // send it off for processing. | ||
1410 | IEstateModule estateModule = scene.RequestModuleInterface<IEstateModule>(); | ||
1411 | response = estateModule.SetRegionEstate(scene.RegionInfo, estateId); | ||
1412 | if (response == String.Empty) | ||
1413 | { | ||
1414 | estateModule.TriggerRegionInfoChange(); | ||
1415 | estateModule.sendRegionHandshakeToAll(); | ||
1416 | response = String.Format ("Region {0} is now attached to estate {1}", regionId, estateId); | ||
1417 | } | ||
1418 | |||
1419 | // give the user some feedback | ||
1420 | if (response != null) | ||
1421 | MainConsole.Instance.Output (response); | ||
1422 | } | ||
1423 | |||
1424 | #endregion | ||
1425 | |||
1069 | private static string CombineParams(string[] commandParams, int pos) | 1426 | private static string CombineParams(string[] commandParams, int pos) |
1070 | { | 1427 | { |
1071 | string result = String.Empty; | 1428 | string result = String.Empty; |
@@ -1076,7 +1433,5 @@ namespace OpenSim | |||
1076 | result = result.TrimEnd(' '); | 1433 | result = result.TrimEnd(' '); |
1077 | return result; | 1434 | return result; |
1078 | } | 1435 | } |
1079 | |||
1080 | #endregion | ||
1081 | } | 1436 | } |
1082 | } | 1437 | } |