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