fix(candy-survival): implement Mekton delivery in grab_item and Ghost mode in grab_tekton for mobile touch controls and bot support

This commit is contained in:
2026-07-08 15:52:30 +08:00
parent 47ba6e2456
commit 8e15018e23
+22
View File
@@ -2083,6 +2083,18 @@ func bot_try_grab_item() -> bool:
#return true #return true
# ----------------------------------------------------------------- # -----------------------------------------------------------------
func grab_item(grid_position: Vector2i = current_position) -> bool: func grab_item(grid_position: Vector2i = current_position) -> bool:
if LobbyManager.game_mode == "Candy Survival":
# Check distance to Mekton NPC at (8, 8)
var dist = abs(current_position.x - 8) + abs(current_position.y - 8)
if dist <= 2:
var gm = get_node_or_null("/root/Main/CandySurvivalManager")
if gm and gm.active:
var pid = get("peer_id") if "peer_id" in self else name.to_int()
if multiplayer.is_server():
gm.try_deliver(pid)
else:
gm.rpc_id(1, "try_deliver", pid)
return true
return playerboard_manager.grab_item(grid_position) return playerboard_manager.grab_item(grid_position)
# ----------------------------------------------------------------- # -----------------------------------------------------------------
@@ -2445,6 +2457,16 @@ func grab_tekton():
if not is_multiplayer_authority() or is_carrying_tekton or is_frozen or is_stop_frozen: if not is_multiplayer_authority() or is_carrying_tekton or is_frozen or is_stop_frozen:
return return
if LobbyManager.game_mode == "Candy Survival":
var gm = get_node_or_null("/root/Main/CandySurvivalManager")
if gm and gm.active:
var pid = get("peer_id") if "peer_id" in self else name.to_int()
if multiplayer.is_server():
gm.try_activate_ghost(pid)
else:
gm.rpc_id(1, "try_activate_ghost", pid)
return
# 1. Check for nearby carrier to snatch from # 1. Check for nearby carrier to snatch from
var carrier = _find_nearby_carrier() var carrier = _find_nearby_carrier()
if carrier: if carrier: