fix candy_survival ghost and knock input mapping, hook ghost into player transparency, fix hud layout missing UI nodes

This commit is contained in:
god
2026-07-06 02:14:22 +08:00
parent 25231859b8
commit 783b3b5894
2 changed files with 62 additions and 0 deletions
+31
View File
@@ -101,6 +101,26 @@ func handle_unhandled_input(event):
# 2. Action Buttons (Remappable via InputMap)
if event.is_action_pressed("action_knock_tekton"):
if LobbyManager.game_mode == "Candy Survival":
var gm = player.get_node_or_null("/root/Main/CandySurvivalManager")
if gm and gm.is_active:
# Find a target to knock (first adjacent player)
var p_pos = player.current_position
var all_players = get_tree().get_nodes_in_group("Players")
for other in all_players:
if other == player: continue
var other_pos = other.current_position
if abs(p_pos.x - other_pos.x) + abs(p_pos.y - other_pos.y) == 1:
# Adjacent
var att_id = player.get("peer_id") if "peer_id" in player else player.name.to_int()
var tgt_id = other.get("peer_id") if "peer_id" in other else other.name.to_int()
if multiplayer.is_server():
gm.try_knock(att_id, tgt_id)
else:
gm.rpc_id(1, "try_knock", att_id, tgt_id)
get_viewport().set_input_as_handled()
return
if player.powerup_manager:
player.powerup_manager.use_special_effect()
if player.get("is_attack_mode") and player.has_method("enter_attack_mode"):
@@ -108,6 +128,17 @@ func handle_unhandled_input(event):
get_viewport().set_input_as_handled()
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.is_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)
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"):
player.grab_tekton()