diff options
Diffstat (limited to 'OpenSim')
-rw-r--r-- | OpenSim/Region/Application/OpenSimMain.cs | 273 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/Scene.cs | 78 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/SceneManager.cs | 29 |
3 files changed, 163 insertions, 217 deletions
diff --git a/OpenSim/Region/Application/OpenSimMain.cs b/OpenSim/Region/Application/OpenSimMain.cs index fa37bf1..92e3025 100644 --- a/OpenSim/Region/Application/OpenSimMain.cs +++ b/OpenSim/Region/Application/OpenSimMain.cs | |||
@@ -376,162 +376,155 @@ namespace OpenSim | |||
376 | { | 376 | { |
377 | string result = ""; | 377 | string result = ""; |
378 | 378 | ||
379 | if ((m_consoleRegion == null) || (command == "change-region") || (command == "shutdown")) | 379 | switch (command) |
380 | { | 380 | { |
381 | switch (command) | 381 | case "set-time": |
382 | { | 382 | m_localScenes.SetTimePhase(Convert.ToInt32(cmdparams[0])); |
383 | case "debug": | 383 | break; |
384 | if (cmdparams.Length > 0) | ||
385 | { | ||
386 | Debug(cmdparams); | ||
387 | } | ||
388 | break; | ||
389 | |||
390 | case "help": | ||
391 | m_log.Error("alert - send alert to a designated user or all users."); | ||
392 | m_log.Error(" alert [First] [Last] [Message] - send an alert to a user. Case sensitive."); | ||
393 | m_log.Error(" alert general [Message] - send an alert to all users."); | ||
394 | m_log.Error("backup - trigger a simulator backup"); | ||
395 | m_log.Error("debug - debugging commands"); | ||
396 | m_log.Error(" packet 0..255 - print incoming/outgoing packets (0=off)"); | ||
397 | m_log.Error("load-xml [filename] - load prims from XML"); | ||
398 | m_log.Error("save-xml [filename] - save prims to XML"); | ||
399 | m_log.Error("script - manually trigger scripts? or script commands?"); | ||
400 | m_log.Error("show uptime - show simulator startup and uptime."); | ||
401 | m_log.Error("show users - show info about connected users."); | ||
402 | m_log.Error("shutdown - disconnect all clients and shutdown."); | ||
403 | m_log.Error("terrain help - show help for terrain commands."); | ||
404 | m_log.Error("quit - equivalent to shutdown."); | ||
405 | break; | ||
406 | |||
407 | case "show": | ||
408 | if (cmdparams.Length > 0) | ||
409 | { | ||
410 | Show(cmdparams[0]); | ||
411 | } | ||
412 | break; | ||
413 | 384 | ||
414 | case "save-xml": | 385 | case "force-update": |
415 | if (cmdparams.Length > 0) | 386 | Console.WriteLine("Updating all clients"); |
416 | { | 387 | m_localScenes.ForceClientUpdate(); |
417 | m_localScenes.SavePrimsToXml(cmdparams[0]); | 388 | break; |
418 | } | ||
419 | else | ||
420 | { | ||
421 | m_localScenes.SavePrimsToXml(DEFAULT_PRIM_BACKUP_FILENAME); | ||
422 | } | ||
423 | break; | ||
424 | 389 | ||
425 | case "load-xml": | ||
426 | if (cmdparams.Length > 0) | ||
427 | { | ||
428 | m_localScenes.LoadPrimsFromXml(cmdparams[0]); | ||
429 | } | ||
430 | else | ||
431 | { | ||
432 | m_localScenes.LoadPrimsFromXml(DEFAULT_PRIM_BACKUP_FILENAME); | ||
433 | } | ||
434 | break; | ||
435 | 390 | ||
436 | case "terrain": | 391 | case "edit-scale": |
437 | if (!m_localScenes.RunTerrainCmd(cmdparams, ref result)) | 392 | if (cmdparams.Length == 4) |
438 | { | 393 | { |
439 | m_log.Error(result); | 394 | m_localScenes.HandleEditCommand(cmdparams); |
440 | } | 395 | } |
441 | break; | 396 | break; |
442 | |||
443 | // terrain-sim now obsolete: do change-region first, then terrain as usual | ||
444 | //case "terrain-sim": | ||
445 | // foreach (Scene scene in m_localScenes) | ||
446 | // { | ||
447 | // if (scene.RegionInfo.RegionName.ToLower() == cmdparams[0].ToLower()) | ||
448 | // { | ||
449 | // string[] tmpCmdparams = new string[cmdparams.Length - 1]; | ||
450 | // cmdparams.CopyTo(tmpCmdparams, 1); | ||
451 | |||
452 | // if (!scene.Terrain.RunTerrainCmd(tmpCmdparams, ref result, scene.RegionInfo.RegionName)) | ||
453 | // { | ||
454 | // m_log.Error(result); | ||
455 | // } | ||
456 | // } | ||
457 | // } | ||
458 | // break; | ||
459 | |||
460 | case "script": | ||
461 | m_localScenes.SendCommandToScripts(cmdparams); | ||
462 | break; | ||
463 | |||
464 | case "command-script": | ||
465 | if (cmdparams.Length > 0) | ||
466 | { | ||
467 | RunCommandScript(cmdparams[0]); | ||
468 | } | ||
469 | break; | ||
470 | 397 | ||
471 | case "permissions": | 398 | case "debug": |
472 | // Treats each user as a super-admin when disabled | 399 | if (cmdparams.Length > 0) |
473 | bool permissions = Convert.ToBoolean(cmdparams[0]); | 400 | { |
401 | Debug(cmdparams); | ||
402 | } | ||
403 | break; | ||
474 | 404 | ||
475 | m_localScenes.BypassPermissions(!permissions); | 405 | case "help": |
406 | m_log.Error("alert - send alert to a designated user or all users."); | ||
407 | m_log.Error(" alert [First] [Last] [Message] - send an alert to a user. Case sensitive."); | ||
408 | m_log.Error(" alert general [Message] - send an alert to all users."); | ||
409 | m_log.Error("backup - trigger a simulator backup"); | ||
410 | m_log.Error("debug - debugging commands"); | ||
411 | m_log.Error(" packet 0..255 - print incoming/outgoing packets (0=off)"); | ||
412 | m_log.Error("load-xml [filename] - load prims from XML"); | ||
413 | m_log.Error("save-xml [filename] - save prims to XML"); | ||
414 | m_log.Error("script - manually trigger scripts? or script commands?"); | ||
415 | m_log.Error("show uptime - show simulator startup and uptime."); | ||
416 | m_log.Error("show users - show info about connected users."); | ||
417 | m_log.Error("shutdown - disconnect all clients and shutdown."); | ||
418 | m_log.Error("terrain help - show help for terrain commands."); | ||
419 | m_log.Error("quit - equivalent to shutdown."); | ||
420 | break; | ||
476 | 421 | ||
477 | break; | 422 | case "show": |
423 | if (cmdparams.Length > 0) | ||
424 | { | ||
425 | Show(cmdparams[0]); | ||
426 | } | ||
427 | break; | ||
478 | 428 | ||
479 | case "backup": | 429 | case "save-xml": |
480 | m_localScenes.Backup(); | 430 | if (cmdparams.Length > 0) |
481 | break; | 431 | { |
432 | m_localScenes.SavePrimsToXml(cmdparams[0]); | ||
433 | } | ||
434 | else | ||
435 | { | ||
436 | m_localScenes.SavePrimsToXml(DEFAULT_PRIM_BACKUP_FILENAME); | ||
437 | } | ||
438 | break; | ||
482 | 439 | ||
483 | case "alert": | 440 | case "load-xml": |
484 | m_localScenes.HandleAlertCommand(cmdparams); | 441 | if (cmdparams.Length > 0) |
485 | break; | 442 | { |
443 | m_localScenes.LoadPrimsFromXml(cmdparams[0]); | ||
444 | } | ||
445 | else | ||
446 | { | ||
447 | m_localScenes.LoadPrimsFromXml(DEFAULT_PRIM_BACKUP_FILENAME); | ||
448 | } | ||
449 | break; | ||
486 | 450 | ||
487 | case "create": | 451 | case "terrain": |
488 | if (CreateAccount != null) | 452 | if (!m_localScenes.RunTerrainCmd(cmdparams, ref result)) |
489 | { | 453 | { |
490 | CreateAccount(cmdparams); | 454 | m_log.Error(result); |
491 | } | 455 | } |
492 | break; | 456 | break; |
493 | 457 | ||
494 | case "quit": | 458 | case "script": |
495 | case "shutdown": | 459 | m_localScenes.SendCommandToScripts(cmdparams); |
496 | Shutdown(); | 460 | break; |
497 | break; | ||
498 | 461 | ||
499 | case "change-region": | 462 | case "command-script": |
500 | if (cmdparams.Length > 0) | 463 | if (cmdparams.Length > 0) |
501 | { | 464 | { |
502 | string regionName = this.CombineParams(cmdparams, 0); | 465 | RunCommandScript(cmdparams[0]); |
503 | 466 | } | |
504 | if( m_localScenes.TrySetCurrentRegion( regionName ) ) | 467 | break; |
505 | { | 468 | |
506 | 469 | case "permissions": | |
507 | } | 470 | // Treats each user as a super-admin when disabled |
508 | else | 471 | bool permissions = Convert.ToBoolean(cmdparams[0]); |
509 | { | 472 | |
510 | MainLog.Instance.Error("Couldn't set current region to: " + regionName); | 473 | m_localScenes.BypassPermissions(!permissions); |
511 | } | 474 | |
512 | } | 475 | break; |
476 | |||
477 | case "backup": | ||
478 | m_localScenes.Backup(); | ||
479 | break; | ||
480 | |||
481 | case "alert": | ||
482 | m_localScenes.HandleAlertCommand(cmdparams); | ||
483 | break; | ||
484 | |||
485 | case "create": | ||
486 | if (CreateAccount != null) | ||
487 | { | ||
488 | CreateAccount(cmdparams); | ||
489 | } | ||
490 | break; | ||
491 | |||
492 | case "quit": | ||
493 | case "shutdown": | ||
494 | Shutdown(); | ||
495 | break; | ||
513 | 496 | ||
514 | if (m_localScenes.CurrentScene == null) | 497 | case "change-region": |
498 | if (cmdparams.Length > 0) | ||
499 | { | ||
500 | string regionName = this.CombineParams(cmdparams, 0); | ||
501 | |||
502 | if (m_localScenes.TrySetCurrentRegion(regionName)) | ||
515 | { | 503 | { |
516 | MainLog.Instance.Verbose("Currently at Root level. To change region please use 'change-region <regioname>'"); | 504 | |
517 | } | 505 | } |
518 | else | 506 | else |
519 | { | 507 | { |
520 | MainLog.Instance.Verbose("Current Region: " + m_localScenes.CurrentScene.RegionInfo.RegionName + ". To change region please use 'change-region <regioname>'"); | 508 | MainLog.Instance.Error("Couldn't set current region to: " + regionName); |
521 | } | 509 | } |
510 | } | ||
522 | 511 | ||
523 | break; | 512 | if (m_localScenes.CurrentScene == null) |
513 | { | ||
514 | MainLog.Instance.Verbose("Currently at Root level. To change region please use 'change-region <regioname>'"); | ||
515 | } | ||
516 | else | ||
517 | { | ||
518 | MainLog.Instance.Verbose("Current Region: " + m_localScenes.CurrentScene.RegionInfo.RegionName + ". To change region please use 'change-region <regioname>'"); | ||
519 | } | ||
524 | 520 | ||
525 | default: | 521 | break; |
526 | m_log.Error("Unknown command"); | 522 | |
527 | break; | 523 | default: |
528 | } | 524 | m_log.Error("Unknown command"); |
529 | } | 525 | break; |
530 | else | ||
531 | { | ||
532 | //let the scene/region handle the command directly. | ||
533 | m_consoleRegion.ProcessConsoleCmd(command, cmdparams); | ||
534 | } | 526 | } |
527 | |||
535 | } | 528 | } |
536 | 529 | ||
537 | public void Debug(string[] args) | 530 | public void Debug(string[] args) |
@@ -579,12 +572,12 @@ namespace OpenSim | |||
579 | 572 | ||
580 | List<ScenePresence> avatars = m_localScenes.GetAvatars(); | 573 | List<ScenePresence> avatars = m_localScenes.GetAvatars(); |
581 | 574 | ||
582 | foreach( ScenePresence avatar in avatars ) | 575 | foreach (ScenePresence avatar in avatars) |
583 | { | 576 | { |
584 | RegionInfo regionInfo = m_localScenes.GetRegionInfo( avatar.RegionHandle ); | 577 | RegionInfo regionInfo = m_localScenes.GetRegionInfo(avatar.RegionHandle); |
585 | string regionName; | 578 | string regionName; |
586 | 579 | ||
587 | if( regionInfo == null ) | 580 | if (regionInfo == null) |
588 | { | 581 | { |
589 | regionName = "Unresolvable"; | 582 | regionName = "Unresolvable"; |
590 | } | 583 | } |
@@ -601,7 +594,7 @@ namespace OpenSim | |||
601 | avatar.ControllingClient.AgentId, | 594 | avatar.ControllingClient.AgentId, |
602 | "Unknown", | 595 | "Unknown", |
603 | "Unknown", | 596 | "Unknown", |
604 | regionName )); | 597 | regionName)); |
605 | } | 598 | } |
606 | 599 | ||
607 | break; | 600 | break; |
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index f02160a..f69aabf 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs | |||
@@ -1246,7 +1246,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1246 | } | 1246 | } |
1247 | #endregion | 1247 | #endregion |
1248 | 1248 | ||
1249 | private void forceClientUpdate() | 1249 | public void ForceClientUpdate() |
1250 | { | 1250 | { |
1251 | foreach (EntityBase ent in this.Entities.Values) | 1251 | foreach (EntityBase ent in this.Entities.Values) |
1252 | { | 1252 | { |
@@ -1256,81 +1256,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1256 | } | 1256 | } |
1257 | } | 1257 | } |
1258 | } | 1258 | } |
1259 | 1259 | ||
1260 | public void ProcessConsoleCmd(string command, string[] cmdparams) | ||
1261 | { | ||
1262 | switch (command) | ||
1263 | { | ||
1264 | case "help": | ||
1265 | MainLog.Instance.Error("alert - send alert to a designated user or all users."); | ||
1266 | MainLog.Instance.Error(" alert [First] [Last] [Message] - send an alert to a user. Case sensitive."); | ||
1267 | MainLog.Instance.Error(" alert general [Message] - send an alert to all users."); | ||
1268 | MainLog.Instance.Error("backup - trigger a region backup"); | ||
1269 | MainLog.Instance.Error("load-xml [filename] - load prims from a XML file into current region"); | ||
1270 | MainLog.Instance.Error("save-xml [filename] - save prims from current region to a XML file"); | ||
1271 | MainLog.Instance.Error("show users - show info about connected users in the current region."); | ||
1272 | MainLog.Instance.Error("shutdown - disconnect all clients and shutdown."); | ||
1273 | break; | ||
1274 | |||
1275 | case "show": | ||
1276 | if (cmdparams.Length > 0) | ||
1277 | { | ||
1278 | Show(cmdparams[0]); | ||
1279 | } | ||
1280 | break; | ||
1281 | |||
1282 | case "save-xml": | ||
1283 | if (cmdparams.Length > 0) | ||
1284 | { | ||
1285 | SavePrimsToXml(cmdparams[0]); | ||
1286 | } | ||
1287 | else | ||
1288 | { | ||
1289 | SavePrimsToXml("test.xml"); | ||
1290 | } | ||
1291 | break; | ||
1292 | |||
1293 | case "load-xml": | ||
1294 | if (cmdparams.Length > 0) | ||
1295 | { | ||
1296 | LoadPrimsFromXml(cmdparams[0]); | ||
1297 | } | ||
1298 | else | ||
1299 | { | ||
1300 | LoadPrimsFromXml("test.xml"); | ||
1301 | } | ||
1302 | break; | ||
1303 | |||
1304 | case "set-time": | ||
1305 | this.SetTimePhase(Convert.ToInt32(cmdparams[0])); | ||
1306 | break; | ||
1307 | |||
1308 | case "force-update": | ||
1309 | Console.WriteLine("Updating all clients"); | ||
1310 | this.forceClientUpdate(); | ||
1311 | break; | ||
1312 | |||
1313 | case "backup": | ||
1314 | Backup(); | ||
1315 | break; | ||
1316 | |||
1317 | case "alert": | ||
1318 | HandleAlertCommand(cmdparams); | ||
1319 | break; | ||
1320 | |||
1321 | case "edit-scale": | ||
1322 | if (cmdparams.Length == 4) | ||
1323 | { | ||
1324 | HandleEditCommand(cmdparams); | ||
1325 | } | ||
1326 | break; | ||
1327 | |||
1328 | default: | ||
1329 | MainLog.Instance.Error("Unknown command: " + command); | ||
1330 | break; | ||
1331 | } | ||
1332 | } | ||
1333 | |||
1334 | public void HandleEditCommand(string[] cmmdparams) | 1260 | public void HandleEditCommand(string[] cmmdparams) |
1335 | { | 1261 | { |
1336 | Console.WriteLine("Searching for Primitive: '" + cmmdparams[0] + "'"); | 1262 | Console.WriteLine("Searching for Primitive: '" + cmmdparams[0] + "'"); |
diff --git a/OpenSim/Region/Environment/Scenes/SceneManager.cs b/OpenSim/Region/Environment/Scenes/SceneManager.cs index 9773407..dfac406 100644 --- a/OpenSim/Region/Environment/Scenes/SceneManager.cs +++ b/OpenSim/Region/Environment/Scenes/SceneManager.cs | |||
@@ -198,7 +198,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
198 | { | 198 | { |
199 | foreach (Scene scene in m_localScenes) | 199 | foreach (Scene scene in m_localScenes) |
200 | { | 200 | { |
201 | if( scene.RegionInfo.RegionHandle == regionHandle ) | 201 | if (scene.RegionInfo.RegionHandle == regionHandle) |
202 | { | 202 | { |
203 | return scene.RegionInfo; | 203 | return scene.RegionInfo; |
204 | } | 204 | } |
@@ -206,5 +206,32 @@ namespace OpenSim.Region.Environment.Scenes | |||
206 | 206 | ||
207 | return null; | 207 | return null; |
208 | } | 208 | } |
209 | |||
210 | public void SetTimePhase(int timePhase) | ||
211 | { | ||
212 | ForEach(delegate(Scene scene) | ||
213 | { | ||
214 | scene.SetTimePhase( | ||
215 | timePhase) | ||
216 | ; | ||
217 | }); | ||
218 | } | ||
219 | |||
220 | |||
221 | public void ForceClientUpdate() | ||
222 | { | ||
223 | ForEach(delegate(Scene scene) | ||
224 | { | ||
225 | scene.ForceClientUpdate(); | ||
226 | }); | ||
227 | } | ||
228 | |||
229 | public void HandleEditCommand(string[] cmdparams) | ||
230 | { | ||
231 | ForEach(delegate(Scene scene) | ||
232 | { | ||
233 | scene.HandleEditCommand(cmdparams); | ||
234 | }); | ||
235 | } | ||
209 | } | 236 | } |
210 | } | 237 | } |