mirror of
https://github.com/opensim/opensim.git
synced 2026-08-07 17:55:48 +08:00
Merge branch 'master' into diva-textures
This commit is contained in:
@@ -91,7 +91,7 @@ namespace OpenSim
|
||||
m_log.Info("[OPENSIM MAIN]: configured log4net using default OpenSim.exe.config");
|
||||
}
|
||||
|
||||
// Check if the system is compatible with OpenSimulator.
|
||||
// Check if the system is compatible with OpenSimulator.
|
||||
// Ensures that the minimum system requirements are met
|
||||
m_log.Info("Performing compatibility checks... ");
|
||||
string supported = String.Empty;
|
||||
|
||||
@@ -43,16 +43,11 @@ namespace OpenSim
|
||||
public class HGCommands
|
||||
{
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
public static IHyperlink HGServices = null;
|
||||
|
||||
private static uint m_autoMappingX = 0;
|
||||
private static uint m_autoMappingY = 0;
|
||||
private static bool m_enableAutoMapping = false;
|
||||
|
||||
public static Scene CreateScene(RegionInfo regionInfo, AgentCircuitManager circuitManager, CommunicationsManager m_commsManager,
|
||||
StorageManager storageManager, ModuleLoader m_moduleLoader, ConfigSettings m_configSettings, OpenSimConfigSource m_config, string m_version)
|
||||
{
|
||||
HGSceneCommunicationService sceneGridService = new HGSceneCommunicationService(m_commsManager, HGServices);
|
||||
HGSceneCommunicationService sceneGridService = new HGSceneCommunicationService(m_commsManager);
|
||||
|
||||
return
|
||||
new HGScene(
|
||||
@@ -61,213 +56,5 @@ namespace OpenSim
|
||||
m_configSettings.See_into_region_from_neighbor, m_config.Source, m_version);
|
||||
}
|
||||
|
||||
public static void RunHGCommand(string command, string[] cmdparams, Scene scene)
|
||||
{
|
||||
if (command.Equals("link-mapping"))
|
||||
{
|
||||
if (cmdparams.Length == 2)
|
||||
{
|
||||
try
|
||||
{
|
||||
m_autoMappingX = Convert.ToUInt32(cmdparams[0]);
|
||||
m_autoMappingY = Convert.ToUInt32(cmdparams[1]);
|
||||
m_enableAutoMapping = true;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
m_autoMappingX = 0;
|
||||
m_autoMappingY = 0;
|
||||
m_enableAutoMapping = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (command.Equals("link-region"))
|
||||
{
|
||||
if (cmdparams.Length < 3)
|
||||
{
|
||||
if ((cmdparams.Length == 1) || (cmdparams.Length == 2))
|
||||
{
|
||||
LoadXmlLinkFile(cmdparams, scene);
|
||||
}
|
||||
else
|
||||
{
|
||||
LinkRegionCmdUsage();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (cmdparams[2].Contains(":"))
|
||||
{
|
||||
// New format
|
||||
uint xloc, yloc;
|
||||
string mapName;
|
||||
try
|
||||
{
|
||||
xloc = Convert.ToUInt32(cmdparams[0]);
|
||||
yloc = Convert.ToUInt32(cmdparams[1]);
|
||||
mapName = cmdparams[2];
|
||||
if (cmdparams.Length > 3)
|
||||
for (int i = 3; i < cmdparams.Length; i++)
|
||||
mapName += " " + cmdparams[i];
|
||||
|
||||
m_log.Info(">> MapName: " + mapName);
|
||||
//internalPort = Convert.ToUInt32(cmdparams[4]);
|
||||
//remotingPort = Convert.ToUInt32(cmdparams[5]);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.Warn("[HGrid] Wrong format for link-region command: " + e.Message);
|
||||
LinkRegionCmdUsage();
|
||||
return;
|
||||
}
|
||||
|
||||
HGHyperlink.TryLinkRegionToCoords(scene, null, mapName, xloc, yloc);
|
||||
}
|
||||
else
|
||||
{
|
||||
// old format
|
||||
RegionInfo regInfo;
|
||||
uint xloc, yloc;
|
||||
uint externalPort;
|
||||
string externalHostName;
|
||||
try
|
||||
{
|
||||
xloc = Convert.ToUInt32(cmdparams[0]);
|
||||
yloc = Convert.ToUInt32(cmdparams[1]);
|
||||
externalPort = Convert.ToUInt32(cmdparams[3]);
|
||||
externalHostName = cmdparams[2];
|
||||
//internalPort = Convert.ToUInt32(cmdparams[4]);
|
||||
//remotingPort = Convert.ToUInt32(cmdparams[5]);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.Warn("[HGrid] Wrong format for link-region command: " + e.Message);
|
||||
LinkRegionCmdUsage();
|
||||
return;
|
||||
}
|
||||
|
||||
//if (TryCreateLink(xloc, yloc, externalPort, externalHostName, out regInfo))
|
||||
if (HGHyperlink.TryCreateLink(scene, null, xloc, yloc, "", externalPort, externalHostName, out regInfo))
|
||||
{
|
||||
if (cmdparams.Length >= 5)
|
||||
{
|
||||
regInfo.RegionName = "";
|
||||
for (int i = 4; i < cmdparams.Length; i++)
|
||||
regInfo.RegionName += cmdparams[i] + " ";
|
||||
}
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
else if (command.Equals("unlink-region"))
|
||||
{
|
||||
if (cmdparams.Length < 1)
|
||||
{
|
||||
UnlinkRegionCmdUsage();
|
||||
return;
|
||||
}
|
||||
if (HGHyperlink.TryUnlinkRegion(scene, cmdparams[0]))
|
||||
m_log.InfoFormat("[HGrid]: Successfully unlinked {0}", cmdparams[0]);
|
||||
else
|
||||
m_log.InfoFormat("[HGrid]: Unable to unlink {0}, region not found", cmdparams[0]);
|
||||
}
|
||||
}
|
||||
|
||||
private static void LoadXmlLinkFile(string[] cmdparams, Scene scene)
|
||||
{
|
||||
//use http://www.hgurl.com/hypergrid.xml for test
|
||||
try
|
||||
{
|
||||
XmlReader r = XmlReader.Create(cmdparams[0]);
|
||||
XmlConfigSource cs = new XmlConfigSource(r);
|
||||
string[] excludeSections = null;
|
||||
|
||||
if (cmdparams.Length == 2)
|
||||
{
|
||||
if (cmdparams[1].ToLower().StartsWith("excludelist:"))
|
||||
{
|
||||
string excludeString = cmdparams[1].ToLower();
|
||||
excludeString = excludeString.Remove(0, 12);
|
||||
char[] splitter = {';'};
|
||||
|
||||
excludeSections = excludeString.Split(splitter);
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < cs.Configs.Count; i++)
|
||||
{
|
||||
bool skip = false;
|
||||
if ((excludeSections != null) && (excludeSections.Length > 0))
|
||||
{
|
||||
for (int n = 0; n < excludeSections.Length; n++)
|
||||
{
|
||||
if (excludeSections[n] == cs.Configs[i].Name.ToLower())
|
||||
{
|
||||
skip = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!skip)
|
||||
{
|
||||
ReadLinkFromConfig(cs.Configs[i], scene);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.Error(e.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private static void ReadLinkFromConfig(IConfig config, Scene scene)
|
||||
{
|
||||
RegionInfo regInfo;
|
||||
uint xloc, yloc;
|
||||
uint externalPort;
|
||||
string externalHostName;
|
||||
uint realXLoc, realYLoc;
|
||||
|
||||
xloc = Convert.ToUInt32(config.GetString("xloc", "0"));
|
||||
yloc = Convert.ToUInt32(config.GetString("yloc", "0"));
|
||||
externalPort = Convert.ToUInt32(config.GetString("externalPort", "0"));
|
||||
externalHostName = config.GetString("externalHostName", "");
|
||||
realXLoc = Convert.ToUInt32(config.GetString("real-xloc", "0"));
|
||||
realYLoc = Convert.ToUInt32(config.GetString("real-yloc", "0"));
|
||||
|
||||
if (m_enableAutoMapping)
|
||||
{
|
||||
xloc = (uint) ((xloc%100) + m_autoMappingX);
|
||||
yloc = (uint) ((yloc%100) + m_autoMappingY);
|
||||
}
|
||||
|
||||
if (((realXLoc == 0) && (realYLoc == 0)) ||
|
||||
(((realXLoc - xloc < 3896) || (xloc - realXLoc < 3896)) &&
|
||||
((realYLoc - yloc < 3896) || (yloc - realYLoc < 3896))))
|
||||
{
|
||||
if (
|
||||
HGHyperlink.TryCreateLink(scene, null, xloc, yloc, "", externalPort,
|
||||
externalHostName, out regInfo))
|
||||
{
|
||||
regInfo.RegionName = config.GetString("localName", "");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private static void LinkRegionCmdUsage()
|
||||
{
|
||||
m_log.Info("Usage: link-region <Xloc> <Yloc> <HostName>:<HttpPort>[:<RemoteRegionName>]");
|
||||
m_log.Info("Usage: link-region <Xloc> <Yloc> <HostName> <HttpPort> [<LocalName>]");
|
||||
m_log.Info("Usage: link-region <URI_of_xml> [<exclude>]");
|
||||
}
|
||||
|
||||
private static void UnlinkRegionCmdUsage()
|
||||
{
|
||||
m_log.Info("Usage: unlink-region <HostName>:<HttpPort>");
|
||||
m_log.Info("Usage: unlink-region <LocalName>");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -493,7 +493,7 @@ namespace OpenSim
|
||||
{
|
||||
if (cmd.Length < 4)
|
||||
{
|
||||
m_log.Error("Usage: create region <region name> <region_file.xml>");
|
||||
m_log.Error("Usage: create region <region name> <region_file.ini>");
|
||||
return;
|
||||
}
|
||||
if (cmd[3].EndsWith(".xml"))
|
||||
@@ -520,7 +520,7 @@ namespace OpenSim
|
||||
}
|
||||
else
|
||||
{
|
||||
m_log.Error("Usage: create region <region name> <region_file.xml>");
|
||||
m_log.Error("Usage: create region <region name> <region_file.ini>");
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -553,7 +553,7 @@ namespace OpenSim
|
||||
/// <param name="cmd"></param>
|
||||
private void HandleLoginStatus(string module, string[] cmd)
|
||||
{
|
||||
if (m_commsManager.GridService.RegionLoginsEnabled == false)
|
||||
if (m_sceneManager.CurrentOrFirstScene.SceneGridService.RegionLoginsEnabled == false)
|
||||
|
||||
m_log.Info("[ Login ] Login are disabled ");
|
||||
else
|
||||
@@ -1230,20 +1230,20 @@ namespace OpenSim
|
||||
protected void LoadOar(string module, string[] cmdparams)
|
||||
{
|
||||
try
|
||||
{
|
||||
{
|
||||
if (cmdparams.Length > 2)
|
||||
{
|
||||
m_sceneManager.LoadArchiveToCurrentScene(cmdparams[2]);
|
||||
m_sceneManager.LoadArchiveToCurrentScene(cmdparams[2]);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_sceneManager.LoadArchiveToCurrentScene(DEFAULT_OAR_BACKUP_FILENAME);
|
||||
m_sceneManager.LoadArchiveToCurrentScene(DEFAULT_OAR_BACKUP_FILENAME);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.Error(e.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -98,7 +98,7 @@ namespace OpenSim
|
||||
|
||||
/// <value>
|
||||
/// The config information passed into the OpenSimulator region server.
|
||||
/// </value>
|
||||
/// </value>
|
||||
public OpenSimConfigSource ConfigSource
|
||||
{
|
||||
get { return m_config; }
|
||||
@@ -209,9 +209,9 @@ namespace OpenSim
|
||||
}
|
||||
|
||||
// Only enable logins to the regions once we have completely finished starting up (apart from scripts)
|
||||
if ((m_commsManager != null) && (m_commsManager.GridService != null))
|
||||
if ((SceneManager.CurrentOrFirstScene != null) && (SceneManager.CurrentOrFirstScene.SceneGridService != null))
|
||||
{
|
||||
m_commsManager.GridService.RegionLoginsEnabled = true;
|
||||
SceneManager.CurrentOrFirstScene.SceneGridService.RegionLoginsEnabled = true;
|
||||
}
|
||||
|
||||
AddPluginCommands();
|
||||
@@ -299,12 +299,12 @@ namespace OpenSim
|
||||
if (LoginEnabled)
|
||||
{
|
||||
m_log.Info("[LOGIN]: Login is now enabled.");
|
||||
m_commsManager.GridService.RegionLoginsEnabled = true;
|
||||
SceneManager.CurrentOrFirstScene.SceneGridService.RegionLoginsEnabled = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_log.Info("[LOGIN]: Login is now disabled.");
|
||||
m_commsManager.GridService.RegionLoginsEnabled = false;
|
||||
SceneManager.CurrentOrFirstScene.SceneGridService.RegionLoginsEnabled = false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -383,14 +383,14 @@ namespace OpenSim
|
||||
|
||||
scene.SetModuleInterfaces();
|
||||
|
||||
// Prims have to be loaded after module configuration since some modules may be invoked during the load
|
||||
// Prims have to be loaded after module configuration since some modules may be invoked during the load
|
||||
scene.LoadPrimsFromStorage(regionInfo.originRegionID);
|
||||
|
||||
// moved these here as the terrain texture has to be created after the modules are initialized
|
||||
// and has to happen before the region is registered with the grid.
|
||||
scene.CreateTerrainTexture(false);
|
||||
|
||||
// TODO : Try setting resource for region xstats here on scene
|
||||
// TODO : Try setting resource for region xstats here on scene
|
||||
MainServer.Instance.AddStreamHandler(new Region.Framework.Scenes.RegionStatsHandler(regionInfo));
|
||||
|
||||
try
|
||||
@@ -399,7 +399,7 @@ namespace OpenSim
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.ErrorFormat("[STARTUP]: Registration of region with grid failed, aborting startup - {0}", e);
|
||||
m_log.ErrorFormat("[STARTUP]: Registration of region with grid failed, aborting startup - {0}", e.StackTrace);
|
||||
|
||||
// Carrying on now causes a lot of confusion down the
|
||||
// line - we need to get the user's attention
|
||||
@@ -507,7 +507,7 @@ namespace OpenSim
|
||||
/// Remove a region from the simulator without deleting it permanently.
|
||||
/// </summary>
|
||||
/// <param name="scene"></param>
|
||||
/// <returns></returns>
|
||||
/// <returns></returns>
|
||||
public void CloseRegion(Scene scene)
|
||||
{
|
||||
// only need to check this if we are not at the
|
||||
@@ -526,7 +526,7 @@ namespace OpenSim
|
||||
/// Remove a region from the simulator without deleting it permanently.
|
||||
/// </summary>
|
||||
/// <param name="name"></param>
|
||||
/// <returns></returns>
|
||||
/// <returns></returns>
|
||||
public void CloseRegion(string name)
|
||||
{
|
||||
Scene target;
|
||||
@@ -539,7 +539,7 @@ namespace OpenSim
|
||||
/// </summary>
|
||||
/// <param name="regionInfo"></param>
|
||||
/// <param name="clientServer"> </param>
|
||||
/// <returns></returns>
|
||||
/// <returns></returns>
|
||||
protected Scene SetupScene(RegionInfo regionInfo, out IClientNetworkServer clientServer)
|
||||
{
|
||||
return SetupScene(regionInfo, 0, null, out clientServer);
|
||||
@@ -750,7 +750,7 @@ namespace OpenSim
|
||||
}
|
||||
|
||||
public string Path
|
||||
{
|
||||
{
|
||||
// This is for the OpenSimulator instance and is the osSecret hashed
|
||||
get { return "/" + osXStatsURI + "/"; }
|
||||
}
|
||||
@@ -791,7 +791,7 @@ namespace OpenSim
|
||||
}
|
||||
|
||||
public string Path
|
||||
{
|
||||
{
|
||||
// This is for the OpenSimulator instance and is the user provided URI
|
||||
get { return "/" + osUXStatsURI + "/"; }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user