cancel build right mouse button
This commit is contained in:
@@ -73,10 +73,13 @@ public partial class BuildGhost : Node2D
|
||||
{
|
||||
using (@event)
|
||||
{
|
||||
if (@event is InputEventMouseButton { Pressed: true, ButtonIndex: MouseButton.Right })
|
||||
{
|
||||
CleanupBuildMode();
|
||||
}
|
||||
|
||||
if (@event is InputEventMouseButton { Pressed: false, ButtonIndex: MouseButton.Left })
|
||||
{
|
||||
NoduleManager.Instance.Building = false;
|
||||
|
||||
var nodule = Instantiator.Instantiate<Nodule>();
|
||||
|
||||
nodule.Position = Position;
|
||||
@@ -86,16 +89,22 @@ public partial class BuildGhost : Node2D
|
||||
|
||||
GetParent()?.AddChild(nodule);
|
||||
|
||||
foreach (var (_, tube) in _connectedTubes)
|
||||
{
|
||||
tube.QueueFree();
|
||||
}
|
||||
|
||||
_connectedTubes.Clear();
|
||||
QueueFree();
|
||||
|
||||
GetViewport().SetInputAsHandled();
|
||||
CleanupBuildMode();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void CleanupBuildMode()
|
||||
{
|
||||
NoduleManager.Instance.Building = false;
|
||||
foreach (var (_, tube) in _connectedTubes)
|
||||
{
|
||||
tube.QueueFree();
|
||||
}
|
||||
|
||||
_connectedTubes.Clear();
|
||||
QueueFree();
|
||||
|
||||
GetViewport().SetInputAsHandled();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user