summaryrefslogtreecommitdiff
path: root/scripts/entities/actions
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/actions
parent1e248d3dd18f7c6bfaf8066c4662facbbb89e8f9 (diff)
INVENTÁRIO PEGÁVEL AAAAAAAAAAAAAAAAAAAAAAAAAAAA
Diffstat (limited to 'scripts/entities/actions')
-rw-r--r--scripts/entities/actions/PickUpAction.cs34
-rw-r--r--scripts/entities/actions/PickUpAction.cs.uid1
2 files changed, 35 insertions, 0 deletions
diff --git a/scripts/entities/actions/PickUpAction.cs b/scripts/entities/actions/PickUpAction.cs
new file mode 100644
index 0000000..b772bb7
--- /dev/null
+++ b/scripts/entities/actions/PickUpAction.cs
@@ -0,0 +1,34 @@
+using Godot;
+
+public partial class PickupAction : DirectionalAction
+{
+ protected Player player;
+
+ public PickupAction(Player player, Vector2I offset) : base(player, offset)
+ {
+ this.player = player;
+ // Pegar itens requer um tempo menor.
+ cost = 2;
+ }
+
+ public override bool Perform()
+ {
+ ConsumableItem item = Map_Data.GetFirstItemAtPosition(Destination);
+
+ if (item == null) {
+ MessageLogData.Instance.AddMessage("Não tem item aqui.");
+ return false;
+ }
+
+ if (player.inventory.Items.Count >= player.inventory.Capacity) {
+ MessageLogData.Instance.AddMessage("Seu inventário está cheio");
+ return false;
+ }
+
+ Map_Data.RemoveEntity(item);
+ player.inventory.Add(item);
+
+ player.Energy -= cost;
+ return true;
+ }
+} \ No newline at end of file
diff --git a/scripts/entities/actions/PickUpAction.cs.uid b/scripts/entities/actions/PickUpAction.cs.uid
new file mode 100644
index 0000000..7ca9c72
--- /dev/null
+++ b/scripts/entities/actions/PickUpAction.cs.uid
@@ -0,0 +1 @@
+uid://dydpoqnwxwbq6