fix: prevent multiple attack/smash SFX spam by clearing charged strike state immediately
This commit is contained in:
@@ -358,23 +358,27 @@ func try_push(target_pos: Vector2i, direction: Vector2i) -> bool:
|
||||
# Consume all available boost to force a full recharge cycle
|
||||
player.powerup_manager.consume_boost(100.0)
|
||||
|
||||
# SCORING: 200 Points for successful attack (ONLY in Free Mode)
|
||||
if player.is_multiplayer_authority():
|
||||
var is_sng = LobbyManager.is_game_mode(GameMode.Mode.STOP_N_GO)
|
||||
if not is_sng:
|
||||
var main_score = player.get_tree().get_root().get_node_or_null("Main")
|
||||
if main_score:
|
||||
var gcm = main_score.get_node_or_null("GoalsCycleManager")
|
||||
if gcm:
|
||||
if multiplayer.is_server():
|
||||
# Server/Bot: Directly add score to specific player ID
|
||||
gcm.add_score(player.name.to_int(), 200)
|
||||
else:
|
||||
# Client: Request score add (sender ID used)
|
||||
gcm.rpc("request_add_score", 200)
|
||||
NotificationManager.send_message(player, "Successful Attack! +200 Pts", NotificationManager.MessageType.GOAL)
|
||||
else:
|
||||
NotificationManager.send_message(player, "Successful Attack!", NotificationManager.MessageType.GOAL)
|
||||
# NEW: Always clear charged strike state to prevent multi-hit spam
|
||||
if player.get("is_charged_strike"):
|
||||
player.set("is_charged_strike", false)
|
||||
|
||||
# SCORING: 200 Points for successful attack (ONLY in Free Mode)
|
||||
if player.is_multiplayer_authority():
|
||||
var is_sng = LobbyManager.is_game_mode(GameMode.Mode.STOP_N_GO)
|
||||
if not is_sng:
|
||||
var main_score = player.get_tree().get_root().get_node_or_null("Main")
|
||||
if main_score:
|
||||
var gcm = main_score.get_node_or_null("GoalsCycleManager")
|
||||
if gcm:
|
||||
if multiplayer.is_server():
|
||||
# Server/Bot: Directly add score to specific player ID
|
||||
gcm.add_score(player.name.to_int(), 200)
|
||||
else:
|
||||
# Client: Request score add (sender ID used)
|
||||
gcm.rpc("request_add_score", 200)
|
||||
NotificationManager.send_message(player, "Successful Attack! +200 Pts", NotificationManager.MessageType.GOAL)
|
||||
else:
|
||||
NotificationManager.send_message(player, "Successful Attack!", NotificationManager.MessageType.GOAL)
|
||||
|
||||
# 5. Block the attacker from moving into the victim's space to prevent overlapping
|
||||
return false
|
||||
|
||||
Reference in New Issue
Block a user