Fix Power Up Inventory

feat: Add player input handling for movement, actions, and skill targeting, and implement special tile effect management.
This commit is contained in:
Yogi Wiguna
2026-02-04 14:53:03 +08:00
parent 77b8542896
commit 4b39a4cfcb
3 changed files with 59 additions and 20 deletions
+37 -2
View File
@@ -46,7 +46,42 @@ func _process(delta):
if target_position != player.current_position:
movement_manager.simple_move_to(target_position)
# Targeting Inputs (1, 2, 3, 4)
# === KEYBOARD SHORTCUTS (User Request) ===
# Numpad 1: Speed (Enum 0)
if Input.is_key_pressed(KEY_KP_1):
player.attempt_target_action(0) # FASTER_SPEED
# Numpad 2: Wall (Enum 2)
elif Input.is_key_pressed(KEY_KP_2):
player.attempt_target_action(2) # BLOCK_FLOOR
# Numpad 3: Freeze (Enum 1)
elif Input.is_key_pressed(KEY_KP_3):
player.attempt_target_action(1) # AREA_FREEZE
# Numpad 4: Ghost (Enum 3)
elif Input.is_key_pressed(KEY_KP_4):
player.attempt_target_action(3) # INVISIBLE_MODE
# C: Special Attack (Attack Mode) - Boost
elif Input.is_key_pressed(KEY_C):
if player.powerup_manager:
player.powerup_manager.use_special_effect()
# V: Spawn Boost Item
elif Input.is_key_pressed(KEY_V):
if player.powerup_manager:
# Verify the method exists first (it was added recently/confirmed available)
if player.powerup_manager.has_method("spawn_boost_reward"):
player.powerup_manager.spawn_boost_reward()
else:
# Fallback if method missing
player.powerup_manager.use_special_effect()
# Original 1-4 keys (Succession order 0-3) - Keeping as fallback?
# User didn't ask to remove them, but new Numpad bindings are specific.
# We can leave them for now unless they conflict.
if Input.is_key_pressed(KEY_1):
player.attempt_target_action(0)
elif Input.is_key_pressed(KEY_2):
@@ -82,7 +117,7 @@ func _process(delta):
player.highlight_cells_if_authorized(area, highlight_id)
func handle_unhandled_input(event):
# Early return if not authorized human player
# Early return if not authorized human playersa
if not player.is_multiplayer_authority() or player.is_bot or player.is_in_group("Bots"):
player.set_process_unhandled_input(false)
return