added some amazing changes

This commit is contained in:
2026-01-25 21:31:33 +01:00
parent e7204b92d2
commit def35dd64b
69 changed files with 2586 additions and 113 deletions

View File

@@ -613,6 +613,7 @@ func _process_pickup_on_server(player: Node):
sfx_loot_collect.play()
# Handle item pickup based on type
var was_encumbered = player.character_stats.is_over_encumbered() if player.character_stats else false
if item.item_type == Item.ItemType.Equippable:
# Equippable item - add to inventory
if player.character_stats:
@@ -623,6 +624,9 @@ func _process_pickup_on_server(player: Node):
if player.character_stats:
player.character_stats.add_item(item)
print(name, " picked up item: ", item.item_name, " (added to inventory)")
if player.character_stats and not was_encumbered and player.character_stats.is_over_encumbered():
if player.has_method("show_floating_status"):
player.show_floating_status("Encumbered!", Color(1.0, 0.5, 0.2))
# Sync inventory+equipment to joiner (server added to their copy; joiner's client must apply)
if multiplayer.has_multiplayer_peer() and multiplayer.is_server():
@@ -649,7 +653,7 @@ func _process_pickup_on_server(player: Node):
elif item.item_type == Item.ItemType.Restoration:
text_color = Color.GREEN # Green for consumables
_show_floating_text(player, display_text, text_color, 0.5, 0.5, items_texture, item.spriteFrames.x, item.spriteFrames.y, item.spriteFrame)
_show_floating_text(player, display_text, text_color, 0.5, 0.5, items_texture, item.spriteFrames.x, item.spriteFrames.y, item.spriteFrame, item)
# Sync floating text to client via GameWorld to avoid loot node path RPCs
if multiplayer.has_multiplayer_peer() and player.get_multiplayer_authority() != 1:
@@ -812,7 +816,7 @@ func _sync_show_floating_text(loot_type_value: int, text: String, color_value: C
# Show floating text on client
_show_floating_text(player, text, color_value, 0.5, 0.5, item_texture, sprite_hframes, sprite_vframes, sprite_frame_value)
func _show_floating_text(player: Node, text: String, color: Color, show_time: float = 0.5, fade_time: float = 0.5, item_texture: Texture2D = null, sprite_hframes: int = 1, sprite_vframes: int = 1, sprite_frame: int = 0):
func _show_floating_text(player: Node, text: String, color: Color, show_time: float = 0.5, fade_time: float = 0.5, item_texture: Texture2D = null, sprite_hframes: int = 1, sprite_vframes: int = 1, sprite_frame: int = 0, item = null):
# Create floating text and item graphic above player's head
# Shows for show_time seconds, then fades out over fade_time seconds
var floating_text_scene = preload("res://scenes/floating_text.tscn")
@@ -822,4 +826,4 @@ func _show_floating_text(player: Node, text: String, color: Color, show_time: fl
if parent:
parent.add_child(floating_text)
floating_text.global_position = Vector2(player.global_position.x, player.global_position.y - 20)
floating_text.setup(text, color, show_time, fade_time, item_texture, sprite_hframes, sprite_vframes, sprite_frame)
floating_text.setup(text, color, show_time, fade_time, item_texture, sprite_hframes, sprite_vframes, sprite_frame, item)