Release 2.4.4: Candy Survival Knock and backfire fixes
Release / Build & Release (push) Successful in 7m54s
Release / Build & Release (push) Successful in 7m54s
This commit is contained in:
@@ -111,7 +111,7 @@ func handle_unhandled_input(event):
|
||||
# 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) or event.is_action_pressed("action_knock_tekton")
|
||||
is_knock = (event is InputEventKey and event.pressed and not event.echo and (event.keycode == KEY_Q or event.physical_keycode == KEY_Q)) or event.is_action_pressed("action_knock_tekton")
|
||||
else:
|
||||
is_knock = event.is_action_pressed("action_knock_tekton")
|
||||
|
||||
@@ -120,21 +120,25 @@ func handle_unhandled_input(event):
|
||||
var gm = player.get_node_or_null("/root/Main/CandySurvivalManager")
|
||||
if gm and gm.active:
|
||||
var att_id = player.get("peer_id") if "peer_id" in player else player.name.to_int()
|
||||
if gm.player_knocks.get(att_id, 0) <= 0:
|
||||
if gm.player_knocks.get(att_id, 5) <= 0:
|
||||
NotificationManager.send_message(player, "No Knock charges left!", NotificationManager.MessageType.WARNING)
|
||||
get_viewport().set_input_as_handled()
|
||||
return
|
||||
|
||||
# Find a target to knock (first adjacent player)
|
||||
# Find a target to knock (adjacent player: cardinal or diagonal distance <= 1)
|
||||
var p_pos = player.current_position
|
||||
var all_players = get_tree().get_nodes_in_group("Players")
|
||||
var target_found = null
|
||||
var min_dist = 999
|
||||
for other in all_players:
|
||||
if other == player: continue
|
||||
if other == player or not is_instance_valid(other): continue
|
||||
var other_pos = other.current_position
|
||||
if abs(p_pos.x - other_pos.x) + abs(p_pos.y - other_pos.y) == 1:
|
||||
var dist = max(abs(p_pos.x - other_pos.x), abs(p_pos.y - other_pos.y))
|
||||
if dist <= 1 and dist < min_dist:
|
||||
target_found = other
|
||||
break
|
||||
min_dist = dist
|
||||
if dist == 1:
|
||||
break
|
||||
|
||||
if target_found:
|
||||
var tgt_id = target_found.get("peer_id") if "peer_id" in target_found else target_found.name.to_int()
|
||||
|
||||
Reference in New Issue
Block a user