summaryrefslogtreecommitdiff
path: root/scripts/entities/actors/Inventory.cs
diff options
context:
space:
mode:
authorMatheus <matheus.guedes.mg.m@gmail.com>2025-09-04 21:08:57 -0300
committerMatheus <matheus.guedes.mg.m@gmail.com>2025-09-04 21:08:57 -0300
commit4b2afd3e2144e42bfa7f11a870584b9255052cf7 (patch)
tree11bcb45e3c93532d2aeaea69b4387ccda365bc22 /scripts/entities/actors/Inventory.cs
parent1e248d3dd18f7c6bfaf8066c4662facbbb89e8f9 (diff)
INVENTÁRIO PEGÁVEL AAAAAAAAAAAAAAAAAAAAAAAAAAAA
Diffstat (limited to 'scripts/entities/actors/Inventory.cs')
-rw-r--r--scripts/entities/actors/Inventory.cs35
1 files changed, 35 insertions, 0 deletions
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<ConsumableItem> Items { get; private set; } = [];
+
+ public int Capacity { get; private set; }
+
+ public Inventory(int capacity) {
+ Capacity = capacity;
+ }
+
+ public override void _Ready() {
+ base._Ready();
+ player = GetParent<Player>();
+ }
+
+ 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