fix candy_survival ghost and knock input mapping, hook ghost into player transparency, fix hud layout missing UI nodes
This commit is contained in:
@@ -193,6 +193,20 @@ func _process(delta: float) -> void:
|
||||
if player_ghost_timer[pid] <= 0:
|
||||
player_ghost_active[pid] = false
|
||||
player_ghost_timer[pid] = 0.0
|
||||
rpc("sync_ghost_active", pid, false)
|
||||
|
||||
# Turn off ghost visual/state
|
||||
var all_players = get_tree().get_nodes_in_group("Players")
|
||||
for player in all_players:
|
||||
var curr_pid = player.get("peer_id") if "peer_id" in player else player.name.to_int()
|
||||
if curr_pid == pid:
|
||||
player.set("is_invisible", false)
|
||||
if player.has_method("sync_modulate"):
|
||||
if multiplayer.is_server() and player.has_method("can_rpc") and player.can_rpc():
|
||||
player.rpc("sync_modulate", Color.WHITE)
|
||||
else:
|
||||
player.sync_modulate(Color.WHITE)
|
||||
break
|
||||
|
||||
# Candy stack: points per second per candy
|
||||
for pid in player_candies.keys():
|
||||
@@ -277,7 +291,10 @@ func _restore_time_scale() -> void:
|
||||
|
||||
# ── Knock / Ghost ──
|
||||
|
||||
@rpc("any_peer", "call_local", "reliable")
|
||||
func try_knock(attacker: int, target: int) -> bool:
|
||||
if not multiplayer.is_server():
|
||||
return false
|
||||
if player_ghost_active.get(target, false):
|
||||
return false
|
||||
if player_knocks.get(attacker, 0) <= 0:
|
||||
@@ -318,6 +335,20 @@ func try_activate_ghost(pid: int) -> bool:
|
||||
player_ghost_active[pid] = true
|
||||
player_ghost_timer[pid] = GHOST_DURATION
|
||||
rpc("sync_ghost_active", pid, true)
|
||||
|
||||
# Core powerup integration: set is_invisible on the player node
|
||||
var all_players = get_tree().get_nodes_in_group("Players")
|
||||
for player in all_players:
|
||||
var curr_pid = player.get("peer_id") if "peer_id" in player else player.name.to_int()
|
||||
if curr_pid == pid:
|
||||
player.set("is_invisible", true)
|
||||
if player.has_method("sync_modulate"):
|
||||
if multiplayer.is_server() and player.has_method("can_rpc") and player.can_rpc():
|
||||
player.rpc("sync_modulate", Color(1.0, 1.0, 1.0, 0.4))
|
||||
else:
|
||||
player.sync_modulate(Color(1.0, 1.0, 1.0, 0.4))
|
||||
break
|
||||
|
||||
return true
|
||||
|
||||
func is_ghost_active(pid: int) -> bool:
|
||||
|
||||
Reference in New Issue
Block a user