public Scene(RegionInfo regInfo, AgentCircuitManager authen,
SceneCommunicationService sceneGridService,
ISimulationDataService simDataService, IEstateDataService estateDataService,
ModuleLoader moduleLoader, bool dumpAssetsToFile, bool physicalPrim,
bool SeeIntoRegionFromNeighbor, IConfigSource config, string simulatorVersion)
{
m_config = config;
Random random = new Random();
BordersLocked = true;
Border northBorder = new Border();
northBorder.BorderLine = new Vector3(float.MinValue, float.MaxValue, (int)Constants.RegionSize); //<---
northBorder.CrossDirection = Cardinals.N;
NorthBorders.Add(northBorder);
Border southBorder = new Border();
southBorder.BorderLine = new Vector3(float.MinValue, float.MaxValue, 0); //--->
southBorder.CrossDirection = Cardinals.S;
SouthBorders.Add(southBorder);
Border eastBorder = new Border();
eastBorder.BorderLine = new Vector3(float.MinValue, float.MaxValue, (int)Constants.RegionSize); //<---
eastBorder.CrossDirection = Cardinals.E;
EastBorders.Add(eastBorder);
Border westBorder = new Border();
westBorder.BorderLine = new Vector3(float.MinValue, float.MaxValue, 0); //--->
westBorder.CrossDirection = Cardinals.W;
WestBorders.Add(westBorder);
BordersLocked = false;
m_lastAllocatedLocalId = (uint)(random.NextDouble() * (double)(uint.MaxValue/2))+(uint)(uint.MaxValue/4);
m_moduleLoader = moduleLoader;
m_authenticateHandler = authen;
m_sceneGridService = sceneGridService;
m_SimulationDataService = simDataService;
m_EstateDataService = estateDataService;
m_regInfo = regInfo;
m_regionHandle = m_regInfo.RegionHandle;
m_regionName = m_regInfo.RegionName;
m_datastore = m_regInfo.DataStore;
m_lastUpdate = Util.EnvironmentTickCount();
m_physicalPrim = physicalPrim;
m_seeIntoRegionFromNeighbor = SeeIntoRegionFromNeighbor;
m_eventManager = new EventManager();
m_permissions = new ScenePermissions(this);
m_asyncSceneObjectDeleter = new AsyncSceneObjectGroupDeleter(this);
m_asyncSceneObjectDeleter.Enabled = true;
#region Region Settings
// Load region settings
m_regInfo.RegionSettings = simDataService.LoadRegionSettings(m_regInfo.RegionID);
if (estateDataService != null)
m_regInfo.EstateSettings = estateDataService.LoadEstateSettings(m_regInfo.RegionID, false);
#endregion Region Settings
MainConsole.Instance.Commands.AddCommand("region", false, "reload estate",
"reload estate",
"Reload the estate data", HandleReloadEstate);
//Bind Storage Manager functions to some land manager functions for this scene
EventManager.OnLandObjectAdded +=
new EventManager.LandObjectAdded(simDataService.StoreLandObject);
EventManager.OnLandObjectRemoved +=
new EventManager.LandObjectRemoved(simDataService.RemoveLandObject);
m_sceneGraph = new SceneGraph(this, m_regInfo);
// If the scene graph has an Unrecoverable error, restart this sim.
// Currently the only thing that causes it to happen is two kinds of specific
// Physics based crashes.
//
// Out of memory
// Operating system has killed the plugin
m_sceneGraph.UnRecoverableError += RestartNow;
RegisterDefaultSceneEvents();
DumpAssetsToFile = dumpAssetsToFile;
m_scripts_enabled = !RegionInfo.RegionSettings.DisableScripts;
m_physics_enabled = !RegionInfo.RegionSettings.DisablePhysics;
StatsReporter = new SimStatsReporter(this);
StatsReporter.OnSendStatsResult += SendSimStatsPackets;
StatsReporter.OnStatsIncorrect += m_sceneGraph.RecalculateStats;
// Old
/*
m_simulatorVersion = simulatorVersion
+ " (OS " + Util.GetOperatingSystemInformation() + ")"
+ " ChilTasks:" + m_seeIntoRegionFromNeighbor.ToString()
+ " PhysPrim:" + m_physicalPrim.ToString();
*/
m_simulatorVersion = simulatorVersion + " (" + Util.GetRuntimeInformation() + ")";
#region Region Config
try
{
// Region config overrides global config
//
IConfig startupConfig = m_config.Configs["Startup"];
//Animation states
m_useFlySlow = startupConfig.GetBoolean("enableflyslow", false);
// TODO: Change default to true once the feature is supported
m_usePreJump = startupConfig.GetBoolean("enableprejump", false);
m_maxNonphys = startupConfig.GetFloat("NonPhysicalPrimMax", m_maxNonphys);
if (RegionInfo.NonphysPrimMax > 0)
{
m_maxNonphys = RegionInfo.NonphysPrimMax;
}
m_maxPhys = startupConfig.GetFloat("PhysicalPrimMax", m_maxPhys);
if (RegionInfo.PhysPrimMax > 0)
{
m_maxPhys = RegionInfo.PhysPrimMax;
}
// Here, if clamping is requested in either global or
// local config, it will be used
//
m_clampPrimSize = startupConfig.GetBoolean("ClampPrimSize", m_clampPrimSize);
if (RegionInfo.ClampPrimSize)
{
m_clampPrimSize = true;
}
m_trustBinaries = startupConfig.GetBoolean("TrustBinaries", m_trustBinaries);
m_allowScriptCrossings = startupConfig.GetBoolean("AllowScriptCrossing", m_allowScriptCrossings);
m_dontPersistBefore =
startupConfig.GetLong("MinimumTimeBeforePersistenceConsidered", DEFAULT_MIN_TIME_FOR_PERSISTENCE);
m_dontPersistBefore *= 10000000;
m_persistAfter =
startupConfig.GetLong("MaximumTimeBeforePersistenceConsidered", DEFAULT_MAX_TIME_FOR_PERSISTENCE);
m_persistAfter *= 10000000;
m_defaultScriptEngine = startupConfig.GetString("DefaultScriptEngine", "XEngine");
IConfig packetConfig = m_config.Configs["PacketPool"];
if (packetConfig != null)
{
PacketPool.Instance.RecyclePackets = packetConfig.GetBoolean("RecyclePackets", true);
PacketPool.Instance.RecycleDataBlocks = packetConfig.GetBoolean("RecycleDataBlocks", true);
}
m_strictAccessControl = startupConfig.GetBoolean("StrictAccessControl", m_strictAccessControl);
m_generateMaptiles = startupConfig.GetBoolean("GenerateMaptiles", true);
if (m_generateMaptiles)
{
int maptileRefresh = startupConfig.GetInt("MaptileRefresh", 0);
if (maptileRefresh != 0)
{
m_mapGenerationTimer.Interval = maptileRefresh * 1000;
m_mapGenerationTimer.Elapsed += RegenerateMaptile;
m_mapGenerationTimer.AutoReset = true;
m_mapGenerationTimer.Start();
}
}
else
{
string tile = startupConfig.GetString("MaptileStaticUUID", UUID.Zero.ToString());
UUID tileID;
if (UUID.TryParse(tile, out tileID))
{
RegionInfo.RegionSettings.TerrainImageID = tileID;
}
}
Random rnd = new Random();
GenerationSeed = startupConfig.GetLong("TerragenSeed", (long)rnd.Next());
}
catch
{
m_log.Warn("[SCENE]: Failed to load StartupConfig");
}
#endregion Region Config
#region Interest Management
if (m_config != null)
{
IConfig interestConfig = m_config.Configs["InterestManagement"];
if (interestConfig != null)
{
string update_prioritization_scheme = interestConfig.GetString("UpdatePrioritizationScheme", "Time").Trim().ToLower();
try
{
m_priorityScheme = (UpdatePrioritizationSchemes)Enum.Parse(typeof(UpdatePrioritizationSchemes), update_prioritization_scheme, true);
}
catch (Exception)
{
m_log.Warn("[PRIORITIZER]: UpdatePrioritizationScheme was not recognized, setting to default prioritizer Time");
m_priorityScheme = UpdatePrioritizationSchemes.Time;
}
m_reprioritizationEnabled = interestConfig.GetBoolean("ReprioritizationEnabled", true);
m_reprioritizationInterval = interestConfig.GetDouble("ReprioritizationInterval", 5000.0);
m_rootReprioritizationDistance = interestConfig.GetDouble("RootReprioritizationDistance", 10.0);
m_childReprioritizationDistance = interestConfig.GetDouble("ChildReprioritizationDistance", 20.0);
}
}
m_log.Info("[SCENE]: Using the " + m_priorityScheme + " prioritization scheme");
#endregion Interest Management
}