Files
tbd-station-14/Content.Client/Placement/Modes/WallmountLight.cs
Acruid ca4fd649fe Massive Namespace Cleanup (#3120)
* Engine namespace changes.

* Automated remove redundant using statements.

* Simplified Graphics namespace.

* Apparently the container system stores full type names in the map file.😞 This updates those names.

* API Changes to LocalizationManager.LoadCulture.

* Update submodule to v0.3.2
2021-02-11 01:13:03 -08:00

64 lines
1.7 KiB
C#

#nullable enable
using Robust.Client.Placement;
using Robust.Shared.Map;
using Robust.Shared.Maths;
namespace Content.Client.Placement.Modes
{
public class WallmountLight : PlacementMode
{
public WallmountLight(PlacementManager pMan) : base(pMan)
{
}
public override void AlignPlacementMode(ScreenCoordinates mouseScreen)
{
MouseCoords = ScreenToCursorGrid(mouseScreen);
CurrentTile = GetTileRef(MouseCoords);
if (pManager.CurrentPermission!.IsTile)
{
return;
}
var tileCoordinates = new EntityCoordinates(MouseCoords.EntityId, CurrentTile.GridIndices);
Vector2 offset;
switch (pManager.Direction)
{
case Direction.North:
offset = new Vector2(0.5f, 1f);
break;
case Direction.South:
offset = new Vector2(0.5f, 0f);
break;
case Direction.East:
offset = new Vector2(1f, 0.5f);
break;
case Direction.West:
offset = new Vector2(0f, 0.5f);
break;
default:
return;
}
tileCoordinates = tileCoordinates.Offset(offset);
MouseCoords = tileCoordinates;
}
public override bool IsValidPosition(EntityCoordinates position)
{
if (pManager.CurrentPermission!.IsTile)
{
return false;
}
else if (!RangeCheck(position))
{
return false;
}
return true;
}
}
}