1
0
Fork 0
mirror of https://github.com/sbrl/Nibriboard.git synced 2018-01-10 21:33:49 +00:00

[server] Update ChunkReference

This commit is contained in:
Starbeamrainbowlabs 2017-03-20 18:47:21 +00:00
parent 535c0436de
commit e193220846
2 changed files with 19 additions and 3 deletions

View file

@ -237,7 +237,9 @@ namespace Nibriboard.Client
/// <returns>Whether this client can see the chunk located at the specified chunk reference</returns> /// <returns>Whether this client can see the chunk located at the specified chunk reference</returns>
public bool CanSee(ChunkReference chunkRef) public bool CanSee(ChunkReference chunkRef)
{ {
LocationReference chunkLocation = chunkRef.InPlanespace();
Rectangle chunkArea = chunkRef.InPlanespaceRectangle();
} }
#region Message Handlers #region Message Handlers

View file

@ -1,6 +1,7 @@
using System; using System;
using System.Security.Policy; using System.Security.Policy;
using System.IO; using System.IO;
using SBRL.Utilities;
namespace Nibriboard.RippleSpace namespace Nibriboard.RippleSpace
{ {
@ -27,8 +28,21 @@ namespace Nibriboard.RippleSpace
{ {
return new LocationReference( return new LocationReference(
Plane, Plane,
X / Plane.ChunkSize, X * Plane.ChunkSize,
Y / Plane.ChunkSize Y * Plane.ChunkSize
);
}
/// <summary>
/// Returns a rectangle representing the area of the chunk that this ChunkReference references.
/// </summary>
/// <returns>A Rectangle representing this ChunkReference's chunk's area.</returns>
public Rectangle InPlanespaceRectangle()
{
return new Rectangle(
X * Plane.ChunkSize,
Y * Plane.ChunkSize,
(X * Plane.ChunkSize) + Plane.ChunkSize,
(Y * Plane.ChunkSize) + Plane.ChunkSize
); );
} }