feat: update

This commit is contained in:
2026-07-07 18:15:47 +08:00
parent 286d0ce069
commit 950b1969d8
97 changed files with 388 additions and 3755 deletions
+21 -13
View File
@@ -168,12 +168,8 @@ func simple_move_to(grid_position: Vector2i) -> bool:
if gm and gm.active and gm.has_method("try_deliver"):
var dist = abs(grid_position.x - 8) + abs(grid_position.y - 8)
if dist <= 2:
var pid = player.get("peer_id") if "peer_id" in player else player.name.to_int()
if multiplayer.is_server():
gm.try_deliver(pid)
else:
gm.rpc_id(1, "try_deliver", pid)
pass # Delivery must be triggered by 'action_interact' input
rotate_towards_target(grid_position)
rotate_towards_target(grid_position)
@@ -214,7 +210,7 @@ func try_push(target_pos: Vector2i, direction: Vector2i) -> bool:
# === INVULNERABILITY CHECK ===
if other_player.get("is_carrying_tekton"):
print("[Move] Push blocked: Target is carrying a Tekton and is invulnerable.")
Engine.get_main_loop().root.get_node_or_null("NotificationManager").send_message(player, "Target is Immune!", Engine.get_main_loop().root.get_node_or_null("NotificationManager").MessageType.WARNING)
NotificationManager.send_message(player, "Target is Immune!", NotificationManager.MessageType.WARNING)
return false
# Candy Survival: check if attacker has knock charges
@@ -241,13 +237,13 @@ func try_push(target_pos: Vector2i, direction: Vector2i) -> bool:
# 1. Prevent attacker from attacking IF THEY ARE in a Safe Zone
if player.current_position.x in safe_columns:
print(" - Attack BLOCKED: Attacker is in Safe Zone!")
Engine.get_main_loop().root.get_node_or_null("NotificationManager").send_message(player, "Cannot Attack while in Safe Zone!", Engine.get_main_loop().root.get_node_or_null("NotificationManager").MessageType.WARNING)
NotificationManager.send_message(player, "Cannot Attack while in Safe Zone!", NotificationManager.MessageType.WARNING)
return false
# 2. Prevent attacking players WHO ARE in a Safe Zone (existing logic)
if target_pos.x in safe_columns:
print(" - Attack BLOCKED: Target is in Safe Zone!")
Engine.get_main_loop().root.get_node_or_null("NotificationManager").send_message(player, "Target is in Safe Zone!", Engine.get_main_loop().root.get_node_or_null("NotificationManager").MessageType.WARNING)
NotificationManager.send_message(player, "Target is in Safe Zone!", NotificationManager.MessageType.WARNING)
return false
@@ -359,9 +355,9 @@ func try_push(target_pos: Vector2i, direction: Vector2i) -> bool:
else:
# Client: Request score add (sender ID used)
gcm.rpc("request_add_score", 200)
Engine.get_main_loop().root.get_node_or_null("NotificationManager").send_message(player, "Successful Attack! +200 Pts", Engine.get_main_loop().root.get_node_or_null("NotificationManager").MessageType.GOAL)
NotificationManager.send_message(player, "Successful Attack! +200 Pts", NotificationManager.MessageType.GOAL)
else:
Engine.get_main_loop().root.get_node_or_null("NotificationManager").send_message(player, "Successful Attack!", Engine.get_main_loop().root.get_node_or_null("NotificationManager").MessageType.GOAL)
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
@@ -382,8 +378,20 @@ func _on_movement_finished():
if Engine.get_main_loop().root.get_node_or_null("LobbyManager").game_mode == "Candy Survival":
if player.has_method("grab_item"):
# Check if there is an item at current_position and if the board has space
if player.playerboard_manager and player.playerboard_manager.has_empty_slot():
player.grab_item(player.current_position)
var current_cell = Vector3i(player.current_position.x, 1, player.current_position.y)
var item = player.playerboard_manager.enhanced_gridmap.get_cell_item(current_cell) if player.playerboard_manager and player.playerboard_manager.enhanced_gridmap else -1
if item != -1:
# Normalize item to match goals logic
var normalized_item = player.playerboard_manager._normalize_tile(item)
if normalized_item in player.goals:
var empty_slot = -1
for i in range(player.playerboard.size()):
if player.playerboard[i] == -1 and not (i in player.playerboard_manager.HIDDEN_SLOTS):
empty_slot = i
break
if player.playerboard_manager and empty_slot != -1:
player.grab_item(player.current_position)
if not movement_queue.is_empty():
var next_target = movement_queue.pop_front()