before fog of war

This commit is contained in:
2026-01-17 11:12:32 +01:00
parent 189dc2042c
commit 454c065cf3
9 changed files with 130 additions and 36 deletions

View File

@@ -162,6 +162,19 @@ func _handle_air_collision():
var collision = get_slide_collision(i)
var collider = collision.get_collider()
# Pot special case: break on wall collision
if object_type == "Pot" and _is_wall_collider(collider):
# Only process on server to prevent duplicates
if not multiplayer.is_server():
continue
if is_destroyable:
if multiplayer.has_multiplayer_peer():
var game_world = get_tree().get_first_node_in_group("game_world")
if game_world and game_world.has_method("_rpc_to_ready_peers"):
game_world._rpc_to_ready_peers("_sync_object_break", [name])
_break_into_pieces()
return
# Hit an enemy! Damage them
if collider.is_in_group("enemy"):
# Only process collision on server to prevent duplicates
@@ -325,6 +338,17 @@ func _break_into_pieces(silent: bool = false):
# Remove self
queue_free()
func _is_wall_collider(collider) -> bool:
if not collider:
return false
# TileMapLayer collisions
if collider is TileMapLayer:
return true
# Any CollisionObject2D with wall layer (7) enabled
if collider is CollisionObject2D and collider.get_collision_layer_value(7):
return true
return false
func can_be_grabbed() -> bool:
return is_grabbable and not is_being_held