mirror of
https://github.com/kwsch/NHSE.git
synced 2026-10-01 14:26:38 -05:00
Add snap to grid for field items, upgrade handle extensions: delete tile
Setting a field item with the snap active will align it to the major gridlines. This will prevent the user from setting un-interactable objects (rocks, trees) unintentionally. Having the auto-handle extension tiles will now delete all associated tiles when issuing a delete command on an extension tile, rather than just deleting the extension tile.
This commit is contained in:
@@ -320,6 +320,15 @@ private void SetTile(Item tile, int x, int y)
|
||||
var l = Map.CurrentLayer;
|
||||
var pgt = new Item();
|
||||
ItemEdit.SetItem(pgt);
|
||||
|
||||
if (pgt.IsFieldItem && CHK_FieldItemSnap.Checked)
|
||||
{
|
||||
// coordinates must be even (not odd-half)
|
||||
x &= 0xFFFE;
|
||||
y &= 0xFFFE;
|
||||
tile = l.GetTile(x, y);
|
||||
}
|
||||
|
||||
var permission = l.IsOccupied(pgt, x, y);
|
||||
switch (permission)
|
||||
{
|
||||
@@ -351,8 +360,17 @@ private void SetTile(TerrainTile tile)
|
||||
|
||||
private void DeleteTile(Item tile, int x, int y)
|
||||
{
|
||||
if (tile.IsRoot && CHK_AutoExtension.Checked)
|
||||
if (CHK_AutoExtension.Checked)
|
||||
{
|
||||
if (!tile.IsRoot)
|
||||
{
|
||||
x -= tile.ExtensionX;
|
||||
y -= tile.ExtensionY;
|
||||
tile = Map.CurrentLayer.GetTile(x, y);
|
||||
}
|
||||
Map.CurrentLayer.DeleteExtensionTiles(tile, x, y);
|
||||
}
|
||||
|
||||
tile.Delete();
|
||||
ReloadItems();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user