added more tomes

This commit is contained in:
2026-01-25 00:59:34 +01:00
parent 9ab4a13244
commit a95e22d2fa
79 changed files with 2429 additions and 337 deletions

View File

@@ -73,6 +73,9 @@ func _ready():
shadow.modulate = Color(0, 0, 0, 0.5)
shadow.z_index = -1
# Group for sync lookup when collected (multiplayer)
add_to_group("attack_bomb")
# Defer area/shape setup and fuse start may run during physics (e.g. trap damage → throw)
call_deferred("_deferred_ready")
@@ -338,12 +341,12 @@ func _deal_explosion_damage():
if body.is_in_group("player") and body.has_method("rpc_take_damage"):
var attacker_pos = player_owner.global_position if player_owner else global_position
var player_peer_id = body.get_multiplayer_authority()
if player_peer_id != 0:
if multiplayer.is_server() and player_peer_id == multiplayer.get_unique_id():
body.rpc_take_damage(final_damage, attacker_pos)
else:
body.rpc_take_damage.rpc_id(player_peer_id, final_damage, attacker_pos)
# Avoid "RPC on yourself": call take_damage directly when victim is local peer
if player_peer_id != 0 and player_peer_id == multiplayer.get_unique_id():
if body.has_method("take_damage"):
body.take_damage(final_damage, attacker_pos)
elif player_peer_id != 0:
body.rpc_take_damage.rpc_id(player_peer_id, final_damage, attacker_pos)
else:
body.rpc_take_damage.rpc(final_damage, attacker_pos)
@@ -353,12 +356,12 @@ func _deal_explosion_damage():
elif body.is_in_group("enemy") and body.has_method("rpc_take_damage"):
var attacker_pos = player_owner.global_position if player_owner else global_position
var enemy_peer_id = body.get_multiplayer_authority()
if enemy_peer_id != 0:
if multiplayer.is_server() and enemy_peer_id == multiplayer.get_unique_id():
body.rpc_take_damage(final_damage, attacker_pos, false, false, false)
else:
body.rpc_take_damage.rpc_id(enemy_peer_id, final_damage, attacker_pos, false, false, false)
# Avoid "RPC on yourself": call take_damage directly when enemy authority is local peer
if enemy_peer_id != 0 and enemy_peer_id == multiplayer.get_unique_id():
if body.has_method("take_damage"):
body.take_damage(final_damage, attacker_pos, false, false, false)
elif enemy_peer_id != 0:
body.rpc_take_damage.rpc_id(enemy_peer_id, final_damage, attacker_pos, false, false, false)
else:
body.rpc_take_damage.rpc(final_damage, attacker_pos, false, false, false)
@@ -530,6 +533,11 @@ func on_grabbed(by_player):
print(by_player.name, " collected bomb!")
# Sync removal to other clients so bomb doesn't keep exploding on their sessions
if multiplayer.has_multiplayer_peer() and by_player and is_instance_valid(by_player):
if by_player.has_method("_rpc_to_ready_peers") and by_player.is_inside_tree():
by_player._rpc_to_ready_peers("_sync_bomb_collected", [name])
# Remove bomb immediately
queue_free()