Fix some control issues

This commit is contained in:
2026-02-04 02:34:23 -08:00
parent b9a1888bfc
commit 13ebe54474
3 changed files with 8 additions and 15 deletions

View File

@@ -102,6 +102,8 @@ public partial class Player : CharacterBody3D, IPlayer, IProvide<IPlayer>
private bool _healthTimerActive = true;
private bool _debugSprint = false;
private float _knockbackStrength = 0.0f;
private Vector3 _knockbackDirection = Vector3.Zero;
@@ -242,9 +244,9 @@ public partial class Player : CharacterBody3D, IPlayer, IProvide<IPlayer>
if (@event.IsActionPressed(GameInputs.Attack))
Attack();
if (@event.IsActionPressed(GameInputs.Sprint))
Settings.MoveSpeed *= 2;
if (@event.IsActionReleased(GameInputs.Sprint))
Settings.MoveSpeed /= 2;
_debugSprint = true;
else if (@event.IsActionReleased(GameInputs.Sprint))
_debugSprint = false;
}
public void PlayTestAnimation()
@@ -350,6 +352,8 @@ public partial class Player : CharacterBody3D, IPlayer, IProvide<IPlayer>
transform.Basis = new Basis(Vector3.Up, Settings.RotationSpeed * -rawInput.X * delta) * transform.Basis;
var moveDirection = new Vector3(strafeRightInput - strafeLeftInput, 0, rawInput.Z).Normalized();
var velocity = Basis * moveDirection * Settings.MoveSpeed * Settings.Acceleration;
if (_debugSprint)
velocity *= 2;
_knockbackStrength *= 0.9f;
Transform = Transform with { Basis = transform.Basis };
Velocity = velocity + (_knockbackDirection * _knockbackStrength);

View File

@@ -60,12 +60,6 @@ public partial class InventoryMenu : Control, IInventoryMenu
private IItemSlot _currentlySelectedItem = null;
private bool _enableMenuSound = false;
public override void _EnterTree()
{
SetProcessInput(false);
SetProcessUnhandledInput(false);
}
public void OnResolved()
{
ItemSlots = [ItemSlot1, ItemSlot2, ItemSlot3, ItemSlot4, ItemSlot5, ItemSlot6, ItemSlot7, ItemSlot8, ItemSlot9, ItemSlot10, ItemSlot11, ItemSlot12, ItemSlot13, ItemSlot14, ItemSlot15, ItemSlot16, ItemSlot17, ItemSlot18, ItemSlot19, ItemSlot20];
@@ -93,6 +87,7 @@ public partial class InventoryMenu : Control, IInventoryMenu
DropButton.FocusEntered += ActionButtonFocusChanged;
VisibilityChanged += InventoryMenu_VisibilityChanged;
SetProcessUnhandledInput(false);
}
private void ActionButtonFocusChanged()

View File

@@ -62,12 +62,6 @@ public partial class LoadNextLevel : Control, IFloorClearMenu
ExitButton.Pressed += ExitButton_Pressed;
}
public override void _Input(InputEvent @event)
{
if (_fadingIn)
GetViewport().SetInputAsHandled();
}
private void CurrentFloorNumber_Sync(int _) => FloorNumber.Text = _map.CurrentFloorNumber.Value.ToString("D2");
private void EquipmentComponent_EquipmentChanged(EquipableItem obj)