delete files in nickes

This commit is contained in:
2026-01-11 03:34:14 +01:00
parent b692b4f39d
commit 9b55af2e67
46 changed files with 2237 additions and 654 deletions

View File

@@ -270,7 +270,14 @@ func _break_into_pieces():
tp.angular_velocity = randf_range(-7, 7)
get_parent().call_deferred("add_child", tp)
play_destroy_sound()
self.set_deferred("collision_layer", 0)
self.visible = false
if ($SfxShatter.playing):
await $SfxShatter.finished
if ($SfxBreakCrate.playing):
await $SfxShatter.finished
# Remove self
queue_free()
@@ -294,13 +301,14 @@ func on_grabbed(by_player):
# In multiplayer, send RPC to server if client is opening
if multiplayer.has_multiplayer_peer() and not is_multiplayer_authority():
# Client - send request to server
if by_player and by_player.is_multiplayer_authority():
if by_player:
var player_peer_id = by_player.get_multiplayer_authority()
print("Chest: Client sending RPC to open chest, player_peer_id: ", player_peer_id)
_request_chest_open.rpc_id(1, player_peer_id)
else:
# Server or single player - open directly
_open_chest(by_player)
return
return # CRITICAL: Return early to prevent normal grab behavior
is_being_held = true
held_by_player = by_player
@@ -434,7 +442,20 @@ func setup_chest():
var chest_frames = [12, 31]
var opened_frames = [13, 32]
var index = randi() % chest_frames.size()
# Use deterministic randomness based on dungeon seed and position
# This ensures host and clients get the same chest variant
var chest_seed = 0
var game_world = get_tree().get_first_node_in_group("game_world")
if game_world and "dungeon_seed" in game_world:
chest_seed = game_world.dungeon_seed
# Add position to seed to make each chest unique but deterministic
chest_seed += int(global_position.x) * 1000 + int(global_position.y)
var rng = RandomNumberGenerator.new()
rng.seed = chest_seed
var index = rng.randi() % chest_frames.size()
chest_closed_frame = chest_frames[index]
chest_opened_frame = opened_frames[index]
@@ -478,7 +499,7 @@ func _open_chest(by_player: Node = null):
# Only process on server (authority)
if multiplayer.has_multiplayer_peer() and not is_multiplayer_authority():
return
$SfxOpenChest.play()
is_chest_opened = true
if sprite and chest_opened_frame >= 0:
sprite.frame = chest_opened_frame
@@ -502,34 +523,34 @@ func _open_chest(by_player: Node = null):
by_player.add_coins(1)
# Show pickup notification with coin graphic
var coin_texture = load("res://assets/gfx/pickups/gold_coin.png")
_show_item_pickup_notification(by_player, "+1 coin", selected_loot.color, coin_texture, 6, 1, 0)
_show_item_pickup_notification(by_player, "+1 COIN", selected_loot.color, coin_texture, 6, 1, 0)
"apple":
var heal_amount = 20.0
if by_player.has_method("heal"):
by_player.heal(heal_amount)
# Show pickup notification with apple graphic
var items_texture = load("res://assets/gfx/pickups/items_n_shit.png")
_show_item_pickup_notification(by_player, "+" + str(int(heal_amount)) + " hp", selected_loot.color, items_texture, 20, 14, (8 * 20) + 11)
_show_item_pickup_notification(by_player, "+" + str(int(heal_amount)) + " HP", selected_loot.color, items_texture, 20, 14, (8 * 20) + 11)
"banana":
var heal_amount = 20.0
if by_player.has_method("heal"):
by_player.heal(heal_amount)
# Show pickup notification with banana graphic
var items_texture = load("res://assets/gfx/pickups/items_n_shit.png")
_show_item_pickup_notification(by_player, "+" + str(int(heal_amount)) + " hp", selected_loot.color, items_texture, 20, 14, (8 * 20) + 12)
_show_item_pickup_notification(by_player, "+" + str(int(heal_amount)) + " HP", selected_loot.color, items_texture, 20, 14, (8 * 20) + 12)
"cherry":
var heal_amount = 20.0
if by_player.has_method("heal"):
by_player.heal(heal_amount)
# Show pickup notification with cherry graphic
var items_texture = load("res://assets/gfx/pickups/items_n_shit.png")
_show_item_pickup_notification(by_player, "+" + str(int(heal_amount)) + " hp", selected_loot.color, items_texture, 20, 14, (8 * 20) + 13)
_show_item_pickup_notification(by_player, "+" + str(int(heal_amount)) + " HP", selected_loot.color, items_texture, 20, 14, (8 * 20) + 13)
"key":
if by_player.has_method("add_key"):
by_player.add_key(1)
# Show pickup notification with key graphic
var items_texture = load("res://assets/gfx/pickups/items_n_shit.png")
_show_item_pickup_notification(by_player, "+1 key", selected_loot.color, items_texture, 20, 14, (13 * 20) + 10)
_show_item_pickup_notification(by_player, "+1 KEY", selected_loot.color, items_texture, 20, 14, (13 * 20) + 10)
# Play chest open sound
if has_node("SfxChestOpen"):
@@ -549,7 +570,10 @@ func _request_chest_open(player_peer_id: int):
if not multiplayer.is_server():
return
print("Chest: Server received RPC to open chest, player_peer_id: ", player_peer_id)
if is_chest_opened:
print("Chest: Chest already opened, ignoring request")
return
# Find the player by peer ID
@@ -564,6 +588,7 @@ func _request_chest_open(player_peer_id: int):
push_error("Chest: ERROR - Could not find player with peer_id ", player_peer_id, " for chest opening!")
return
print("Chest: Found player ", player.name, " for peer_id ", player_peer_id, ", opening chest")
# Open chest on server (this will give item to player)
_open_chest(player)
@@ -588,3 +613,24 @@ func _show_item_pickup_notification(player: Node, text: String, text_color: Colo
parent.add_child(floating_text)
floating_text.global_position = player.global_position + Vector2(0, -20)
floating_text.setup(text, text_color, 0.5, 0.5, item_texture, sprite_hframes, sprite_vframes, sprite_frame) # Show for 0.5s, fade over 0.5s
func play_destroy_sound():
if object_type == "Pot":
$SfxShatter.play()
else:
$SfxBreakCrate.play()
pass
func play_drag_sound():
if object_type == "Pot":
if !$SfxDrag.playing:
$SfxDrag.play()
else:
if !$SfxDragRock.playing:
$SfxDragRock.play()
pass
func stop_drag_sound():
$SfxDrag.stop()
$SfxDragRock.stop()
pass