lots of changeru

This commit is contained in:
2026-01-25 16:27:19 +01:00
parent a95e22d2fa
commit 7abadb92a9
14 changed files with 855 additions and 106 deletions

View File

@@ -430,6 +430,25 @@ func take_fire_damage(amount: float, _attacker_position: Vector2) -> void:
else:
_break_into_pieces()
func take_damage(amount: float, _from_position: Vector2) -> void:
"""Generic damage from bomb, frost spike, etc. Any destroyable object."""
if not is_destroyable or is_broken:
return
health -= amount
if health > 0:
return
var game_world = get_tree().get_first_node_in_group("game_world")
if multiplayer.has_multiplayer_peer():
if multiplayer.is_server():
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()
else:
if game_world and game_world.has_method("_sync_object_break"):
game_world._sync_object_break.rpc_id(1, name)
else:
_break_into_pieces()
func on_grabbed(by_player):
# Special handling for chests - open instead of grab
if object_type == "Chest" and not is_chest_opened: