diff --git a/scripts/managers/player_input_manager.gd b/scripts/managers/player_input_manager.gd index 958dfef..e939011 100644 --- a/scripts/managers/player_input_manager.gd +++ b/scripts/managers/player_input_manager.gd @@ -55,7 +55,7 @@ func _process(delta): # 3. Action inputs (momentary) - if Input.is_action_just_pressed("action_grab"): + if Input.is_action_just_pressed("action_grab") and LobbyManager.game_mode != "Candy Survival": player.grab_item(player.current_position) if move_vec != Vector2i.ZERO: @@ -93,14 +93,29 @@ func handle_unhandled_input(event): if not SettingsManager: return - # 1. Unified check for POWER-UP Activation + # 1. Unified check for POWER-UP / Ghost Activation if event.is_action_pressed("use_powerup"): - player.activate_held_powerup() + if LobbyManager.game_mode == "Candy Survival": + var gm = player.get_node_or_null("/root/Main/CandySurvivalManager") + if gm and gm.active: + var pid = player.get("peer_id") if "peer_id" in player else player.name.to_int() + if multiplayer.is_server(): + gm.try_activate_ghost(pid) + else: + gm.rpc_id(1, "try_activate_ghost", pid) + else: + player.activate_held_powerup() get_viewport().set_input_as_handled() return - # 2. Action Buttons (Remappable via InputMap) - if event.is_action_pressed("action_knock_tekton"): + # 2. Action Buttons (Remappable via InputMap / KEY_Q override for Candy Survival) + var is_knock = false + if LobbyManager.game_mode == "Candy Survival": + is_knock = (event is InputEventKey and event.pressed and not event.echo and event.keycode == KEY_Q) + else: + is_knock = event.is_action_pressed("action_knock_tekton") + + if is_knock: if LobbyManager.game_mode == "Candy Survival": var gm = player.get_node_or_null("/root/Main/CandySurvivalManager") if gm and gm.active: @@ -129,28 +144,13 @@ func handle_unhandled_input(event): elif event.is_action_pressed("action_grab"): if LobbyManager.game_mode == "Candy Survival": - var gm = player.get_node_or_null("/root/Main/CandySurvivalManager") - if gm and gm.active: - var pid = player.get("peer_id") if "peer_id" in player else player.name.to_int() - if multiplayer.is_server(): - gm.try_deliver(pid) - else: - gm.rpc_id(1, "try_deliver", pid) - get_viewport().set_input_as_handled() - return + get_viewport().set_input_as_handled() + return elif event.is_action_pressed("action_grab_tekton"): if LobbyManager.game_mode == "Candy Survival": - var gm = player.get_node_or_null("/root/Main/CandySurvivalManager") - if gm and gm.active: - var pid = player.get("peer_id") if "peer_id" in player else player.name.to_int() - # In Candy Survival, action_grab_tekton activates Ghost mode - if multiplayer.is_server(): - gm.try_activate_ghost(pid) - else: - gm.rpc_id(1, "try_activate_ghost", pid) - get_viewport().set_input_as_handled() - return + get_viewport().set_input_as_handled() + return if not player.is_carrying_tekton: if player.powerup_manager and player.powerup_manager.has_method("can_use_special"):