Big fix of inventory system, add accessory item type
This commit is contained in:
@@ -10,7 +10,9 @@ public partial class Armor : InventoryItem
|
||||
public override void _Notification(int what) => this.Notify(what);
|
||||
|
||||
[Export]
|
||||
public override InventoryItemInfo InventoryInfo { get; set; }
|
||||
internal override InventoryItemInfo Info { get; set; }
|
||||
|
||||
public ArmorInfo ArmorInfo { get => (ArmorInfo)Info; }
|
||||
|
||||
public void OnReady()
|
||||
{
|
||||
@@ -19,7 +21,7 @@ public partial class Armor : InventoryItem
|
||||
|
||||
public void OnEntered(Node3D body)
|
||||
{
|
||||
var inventoryList = GameRepo.InventoryItems.Value.Append(InventoryInfo).ToList();
|
||||
var inventoryList = GameRepo.InventoryItems.Value.Append(this).ToList();
|
||||
GameRepo.InventoryItems.OnNext(inventoryList);
|
||||
QueueFree();
|
||||
}
|
||||
|
||||
@@ -1,14 +1,8 @@
|
||||
[gd_scene load_steps=6 format=3 uid="uid://dorr7v1tkeiy0"]
|
||||
[gd_scene load_steps=5 format=3 uid="uid://dorr7v1tkeiy0"]
|
||||
|
||||
[ext_resource type="Script" path="res://src/items/armor/Armor.cs" id="1_cmjpq"]
|
||||
[ext_resource type="Texture2D" uid="uid://cgoubcl86pib4" path="res://src/items/armor/armor.png" id="1_vpnem"]
|
||||
[ext_resource type="Script" path="res://src/items/armor/ArmorInfo.cs" id="2_cuhrp"]
|
||||
|
||||
[sub_resource type="Resource" id="Resource_o1cok"]
|
||||
script = ExtResource("2_cuhrp")
|
||||
Defense = 2
|
||||
Name = "Pathetic"
|
||||
Description = "A pathetic coat."
|
||||
[ext_resource type="Resource" uid="uid://chjmkb3aiomvr" path="res://src/items/armor/resources/PatheticCoat.tres" id="2_eftit"]
|
||||
|
||||
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_1gpxo"]
|
||||
radius = 0.470016
|
||||
@@ -16,7 +10,7 @@ height = 0.940032
|
||||
|
||||
[node name="Armor" type="Node3D"]
|
||||
script = ExtResource("1_cmjpq")
|
||||
InventoryInfo = SubResource("Resource_o1cok")
|
||||
Info = ExtResource("2_eftit")
|
||||
|
||||
[node name="Sprite3D" type="Sprite3D" parent="."]
|
||||
billboard = 2
|
||||
|
||||
Reference in New Issue
Block a user