1
0
Fork 0

[server] Allow RippleSpaceManagers to create new planes.

This commit is contained in:
Starbeamrainbowlabs 2017-04-16 15:24:37 +01:00
parent 48c2011500
commit fa7fbfd0ac
1 changed files with 17 additions and 0 deletions

View File

@ -22,6 +22,8 @@ namespace Nibriboard.RippleSpace
/// </summary>
public long LastMaintenanceDuration = 0;
public int DefaultChunkSize { get; set; } = 512;
public RippleSpaceManager()
{
Log.WriteLine("[RippleSpace] New blank ripplespace initialised.");
@ -53,6 +55,21 @@ namespace Nibriboard.RippleSpace
return null;
}
/// <summary>
/// Creates a new plane, adds it to this RippleSpaceManager, and then returns it.
/// </summary>
/// <param name="newPlaneName">The name of the new plane to create.</param>
/// <returns>The newly created plane.</returns>
protected Plane CreatePlane(string newPlaneName)
{
if(this[newPlaneName] != null)
throw new InvalidOperationException($"Error: A plane with the name '{newPlaneName}' already exists in this RippleSpaceManager.");
Plane newPlane = new Plane(newPlaneName, DefaultChunkSize);
Planes.Add(newPlane);
return newPlane;
}
public async Task StartMaintenanceMonkey()
{
Log.WriteLine("[RippleSpace/Maintenance] Automated maintenance monkey created.");