Allow fix-phantoms command to appear even if CombineContiguousRegions = false, since this allows one to go back from a megaregion to normal regions.

Adapted from a patch by Garmin Kawaguichi in http://opensimulator.org/mantis/view.php?id=6027
Garmin says that fix-phantoms allows one to reset objects when going back from megaregion to normal regions as well as the othe rway around.
Thanks!
0.7.4.1
Justin Clark-Casey (justincc) 2012-06-05 01:33:58 +01:00
parent 008c6a4610
commit 42179578fc
1 changed files with 11 additions and 13 deletions

View File

@ -61,7 +61,7 @@ namespace OpenSim.Region.RegionCombinerModule
/// <summary> /// <summary>
/// Is this module enabled? /// Is this module enabled?
/// </summary> /// </summary>
private bool enabledYN = false; private bool m_combineContiguousRegions = false;
/// <summary> /// <summary>
/// This holds the root regions for the megaregions. /// This holds the root regions for the megaregions.
@ -79,14 +79,12 @@ namespace OpenSim.Region.RegionCombinerModule
public void Initialise(IConfigSource source) public void Initialise(IConfigSource source)
{ {
IConfig myConfig = source.Configs["Startup"]; IConfig myConfig = source.Configs["Startup"];
enabledYN = myConfig.GetBoolean("CombineContiguousRegions", false); m_combineContiguousRegions = myConfig.GetBoolean("CombineContiguousRegions", false);
if (enabledYN) MainConsole.Instance.Commands.AddCommand(
{ "RegionCombinerModule", false, "fix-phantoms", "fix-phantoms",
MainConsole.Instance.Commands.AddCommand( "Fixes phantom objects after an import to a megaregion or a change from a megaregion back to normal regions",
"RegionCombinerModule", false, "fix-phantoms", "fix-phantoms", FixPhantoms);
"Fixes phantom objects after an import to megaregions", FixPhantoms);
}
} }
public void Close() public void Close()
@ -95,7 +93,7 @@ namespace OpenSim.Region.RegionCombinerModule
public void AddRegion(Scene scene) public void AddRegion(Scene scene)
{ {
if (enabledYN) if (m_combineContiguousRegions)
scene.RegisterModuleInterface<IRegionCombinerModule>(this); scene.RegisterModuleInterface<IRegionCombinerModule>(this);
} }
@ -105,7 +103,10 @@ namespace OpenSim.Region.RegionCombinerModule
public void RegionLoaded(Scene scene) public void RegionLoaded(Scene scene)
{ {
if (enabledYN) lock (m_startingScenes)
m_startingScenes.Add(scene.RegionInfo.originRegionID, scene);
if (m_combineContiguousRegions)
{ {
RegionLoadedDoWork(scene); RegionLoadedDoWork(scene);
@ -208,7 +209,6 @@ namespace OpenSim.Region.RegionCombinerModule
{ {
return; return;
} }
} }
} }
@ -220,8 +220,6 @@ namespace OpenSim.Region.RegionCombinerModule
return; return;
// //
*/ */
lock (m_startingScenes)
m_startingScenes.Add(scene.RegionInfo.originRegionID, scene);
// Give each region a standard set of non-infinite borders // Give each region a standard set of non-infinite borders
Border northBorder = new Border(); Border northBorder = new Border();