Fix a few bugs, add esc to exit table

This commit is contained in:
Sofia 2024-08-20 15:28:35 +03:00
parent 08dc84b343
commit e20c07cf84
3 changed files with 17 additions and 8 deletions

View File

@ -91,7 +91,8 @@ material = SubResource("ShaderMaterial_u26td")
[node name="HUD" parent="." node_paths=PackedStringArray("Player") instance=ExtResource("7_g7tfv")] [node name="HUD" parent="." node_paths=PackedStringArray("Player") instance=ExtResource("7_g7tfv")]
Player = NodePath("../Player") Player = NodePath("../Player")
[node name="PauseMenu" parent="." instance=ExtResource("11_lav3p")] [node name="PauseMenu" parent="." node_paths=PackedStringArray("Table") instance=ExtResource("11_lav3p")]
Table = NodePath("../table")
[node name="BlueprintRenderingViewport" type="SubViewport" parent="."] [node name="BlueprintRenderingViewport" type="SubViewport" parent="."]
msaa_3d = 3 msaa_3d = 3

View File

@ -52,6 +52,11 @@ namespace Gmtk24 {
if (!IsEnabled) if (!IsEnabled)
return; return;
if (@event.IsAction("toggle_pause_menu")) {
SetEnabled(false);
GetViewport().SetInputAsHandled();
}
if (@event.IsActionPressed("drag_orbit")) if (@event.IsActionPressed("drag_orbit"))
Input.MouseMode = Input.MouseModeEnum.Captured; Input.MouseMode = Input.MouseModeEnum.Captured;
if (@event.IsActionReleased("drag_orbit")) if (@event.IsActionReleased("drag_orbit"))
@ -75,7 +80,6 @@ namespace Gmtk24 {
EmitSignal(SignalName.BlockRelease, HeldBlock, (uint)BlockReleaseType.Place); EmitSignal(SignalName.BlockRelease, HeldBlock, (uint)BlockReleaseType.Place);
HeldBlock = null; HeldBlock = null;
} }
}
if (@event.IsActionPressed("rotate_block_right")) { if (@event.IsActionPressed("rotate_block_right")) {
HeldBlock.RotateY(RotateAmt); HeldBlock.RotateY(RotateAmt);
@ -84,6 +88,7 @@ namespace Gmtk24 {
HeldBlock.RotateY(-RotateAmt); HeldBlock.RotateY(-RotateAmt);
} }
} }
}
public bool HoldBlock(BuildingBlock block) { public bool HoldBlock(BuildingBlock block) {
if (HeldBlock != null) if (HeldBlock != null)

View File

@ -16,6 +16,9 @@ namespace Gmtk24 {
[Export] [Export]
public BaseButton CameraInvertY; public BaseButton CameraInvertY;
[Export]
public Table Table;
private bool Opened = false; private bool Opened = false;
public override void _Ready() { public override void _Ready() {
@ -34,7 +37,7 @@ namespace Gmtk24 {
} }
public override void _Input(InputEvent @event) { public override void _Input(InputEvent @event) {
if (@event.IsActionPressed("toggle_pause_menu")) { if (@event.IsActionPressed("toggle_pause_menu") && (!Table.Orbit?.IsEnabled ?? true)) {
if (Opened) { if (Opened) {
Close(); Close();
} else { } else {