Quaternius weapons, input fixes, sound & path fixes
- Added 6 Quaternius weapon models (Pistol, Revolver, Rifle, Shotgun, P90, SniperRifle) - Created weapon resource files with balanced stats - Wired Pistol + Rifle into player.tscn replacing Kenney blasters - Fixed WASD input (matched input map action names) - Fixed Escape key toggles mouse capture - Added Audio autoload singleton - Fixed broken sound asset paths across all scripts - Fixed all scene ext_resource text paths (nested under assets/kenney-fps/) - Fixed all .import source_file paths - Deleted stale .import files (will be regenerated by editor on open)
This commit is contained in:
@@ -21,6 +21,12 @@ var _slot_2_latch := false
|
||||
var _slot_3_latch := false
|
||||
var _slot_4_latch := false
|
||||
|
||||
# Direct keyboard state (bypasses Input.get_axis() for reliability)
|
||||
var _key_w := false
|
||||
var _key_s := false
|
||||
var _key_a := false
|
||||
var _key_d := false
|
||||
|
||||
# Input variables (frame-rate mouse accumulator)
|
||||
var mouse_rotation: Vector2 = Vector2.ZERO
|
||||
|
||||
@@ -43,6 +49,7 @@ func _notification(what):
|
||||
if what == NOTIFICATION_WM_WINDOW_FOCUS_IN:
|
||||
Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED)
|
||||
override_mouse = false
|
||||
print("[INPUT] Window focus gained — recaptured mouse")
|
||||
|
||||
func _input(event: InputEvent) -> void:
|
||||
if !is_multiplayer_authority(): return
|
||||
@@ -73,14 +80,36 @@ func _input(event: InputEvent) -> void:
|
||||
if event.is_action_pressed("weapon_slot_4"):
|
||||
_slot_4_latch = true
|
||||
|
||||
# Track WASD directly from key events (backup for Input.get_axis())
|
||||
if event is InputEventKey and event.keycode != 0:
|
||||
match event.keycode:
|
||||
KEY_W: _key_w = event.pressed
|
||||
KEY_S: _key_s = event.pressed
|
||||
KEY_A: _key_a = event.pressed
|
||||
KEY_D: _key_d = event.pressed
|
||||
# Also check physical keycode as fallback
|
||||
match event.physical_keycode:
|
||||
KEY_W: _key_w = event.pressed
|
||||
KEY_S: _key_s = event.pressed
|
||||
KEY_A: _key_a = event.pressed
|
||||
KEY_D: _key_d = event.pressed
|
||||
|
||||
func _gather():
|
||||
if !is_setup:
|
||||
print("[INPUT DEBUG] _gather first call - setting up")
|
||||
setup()
|
||||
|
||||
# Movement (continuous)
|
||||
|
||||
# Movement: try Input.get_axis() first, fall back to direct key tracking
|
||||
var mx = Input.get_axis("move_west", "move_east")
|
||||
var mz = Input.get_axis("move_north", "move_south")
|
||||
|
||||
# If Input.get_axis() returns 0 but keys are pressed via event tracking, use event tracking
|
||||
if mx == 0.0 and mz == 0.0:
|
||||
if _key_d: mx = 1.0
|
||||
elif _key_a: mx = -1.0
|
||||
if _key_s: mz = 1.0
|
||||
elif _key_w: mz = -1.0
|
||||
|
||||
var old_mv = movement
|
||||
movement = Vector3(mx, 0, mz)
|
||||
if movement != old_mv and (mx != 0 or mz != 0):
|
||||
@@ -131,3 +160,7 @@ func setup():
|
||||
big_gun.hide()
|
||||
hud.show()
|
||||
Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED)
|
||||
# Ensure window has keyboard focus for WASD
|
||||
get_window().call_deferred("grab_focus")
|
||||
DisplayServer.call_deferred("window_move_to_foreground")
|
||||
print("[INPUT] Setup complete — camera active, mouse captured, focus grabbed")
|
||||
|
||||
Reference in New Issue
Block a user