From 4b2afd3e2144e42bfa7f11a870584b9255052cf7 Mon Sep 17 00:00:00 2001 From: Matheus Date: Thu, 4 Sep 2025 21:08:57 -0300 Subject: INVENTÁRIO PEGÁVEL AAAAAAAAAAAAAAAAAAAAAAAAAAAA MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/entities/actors/Inventory.cs | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 scripts/entities/actors/Inventory.cs (limited to 'scripts/entities/actors/Inventory.cs') diff --git a/scripts/entities/actors/Inventory.cs b/scripts/entities/actors/Inventory.cs new file mode 100644 index 0000000..ea9569f --- /dev/null +++ b/scripts/entities/actors/Inventory.cs @@ -0,0 +1,35 @@ +using Godot; + +public partial class Inventory : Node { + private Player player; + + public Godot.Collections.Array Items { get; private set; } = []; + + public int Capacity { get; private set; } + + public Inventory(int capacity) { + Capacity = capacity; + } + + public override void _Ready() { + base._Ready(); + player = GetParent(); + } + + public void Drop(ConsumableItem item) { + Items.Remove(item); + MapData data = player.Map_Data; + data.InsertEntity(item); + data.EmitSignal(MapData.SignalName.EntityPlaced, item); + item.Map_Data = data; + item.GridPosition = player.GridPosition; + + MessageLogData.Instance.AddMessage($"Você descarta {item.DisplayName}."); + } + + public void Add(ConsumableItem item) { + if (Items.Count >= Capacity) return; + + Items.Add(item); + } +} \ No newline at end of file -- cgit v1.2.3