Big fix of inventory system, add accessory item type
This commit is contained in:
30
src/items/accessory/Accessory.cs
Normal file
30
src/items/accessory/Accessory.cs
Normal file
@@ -0,0 +1,30 @@
|
||||
using Chickensoft.AutoInject;
|
||||
using Chickensoft.Introspection;
|
||||
using GameJamDungeon;
|
||||
using Godot;
|
||||
using System;
|
||||
using System.Linq;
|
||||
|
||||
[Meta(typeof(IAutoNode))]
|
||||
public partial class Accessory : InventoryItem
|
||||
{
|
||||
public override void _Notification(int what) => this.Notify(what);
|
||||
|
||||
public AccessoryInfo AccessoryInfo { get => (AccessoryInfo)Info; }
|
||||
|
||||
[Export]
|
||||
internal override InventoryItemInfo Info { get; set; }
|
||||
|
||||
public void OnReady()
|
||||
{
|
||||
Pickup.BodyEntered += OnEntered;
|
||||
}
|
||||
|
||||
public void OnEntered(Node3D body)
|
||||
{
|
||||
var inventoryList = GameRepo.InventoryItems.Value.Append(this).ToList();
|
||||
GameRepo.InventoryItems.OnNext(inventoryList);
|
||||
QueueFree();
|
||||
}
|
||||
|
||||
}
|
||||
31
src/items/accessory/Accessory.tscn
Normal file
31
src/items/accessory/Accessory.tscn
Normal file
@@ -0,0 +1,31 @@
|
||||
[gd_scene load_steps=6 format=3 uid="uid://1bbmod6680c2"]
|
||||
|
||||
[ext_resource type="Script" path="res://src/items/accessory/Accessory.cs" id="1_jq0hu"]
|
||||
[ext_resource type="Texture2D" uid="uid://d0yqm7ars827b" path="res://src/items/accessory/accessory.png" id="1_sfkuo"]
|
||||
[ext_resource type="Script" path="res://src/items/accessory/AccessoryInfo.cs" id="2_kejmw"]
|
||||
|
||||
[sub_resource type="Resource" id="Resource_lu6du"]
|
||||
script = ExtResource("2_kejmw")
|
||||
Name = "Basic Accessory"
|
||||
Description = ""
|
||||
|
||||
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_uavx4"]
|
||||
radius = 0.470016
|
||||
height = 0.940032
|
||||
|
||||
[node name="Accessory" type="Node3D"]
|
||||
script = ExtResource("1_jq0hu")
|
||||
Info = SubResource("Resource_lu6du")
|
||||
|
||||
[node name="Sprite3D" type="Sprite3D" parent="."]
|
||||
billboard = 2
|
||||
texture_filter = 0
|
||||
texture = ExtResource("1_sfkuo")
|
||||
|
||||
[node name="Pickup" type="Area3D" parent="."]
|
||||
unique_name_in_owner = true
|
||||
collision_layer = 4
|
||||
collision_mask = 4
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="Pickup"]
|
||||
shape = SubResource("CapsuleShape3D_uavx4")
|
||||
10
src/items/accessory/AccessoryInfo.cs
Normal file
10
src/items/accessory/AccessoryInfo.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
using Godot;
|
||||
using System;
|
||||
|
||||
namespace GameJamDungeon;
|
||||
|
||||
[GlobalClass]
|
||||
public partial class AccessoryInfo : InventoryItemInfo
|
||||
{
|
||||
// TODO: List all possible status effects here
|
||||
}
|
||||
BIN
src/items/accessory/accessory.png
Normal file
BIN
src/items/accessory/accessory.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.2 KiB |
35
src/items/accessory/accessory.png.import
Normal file
35
src/items/accessory/accessory.png.import
Normal file
@@ -0,0 +1,35 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://d0yqm7ars827b"
|
||||
path.s3tc="res://.godot/imported/accessory.png-04ec32093cb21658c9558ccc9e7c09b2.s3tc.ctex"
|
||||
metadata={
|
||||
"imported_formats": ["s3tc_bptc"],
|
||||
"vram_texture": true
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://src/items/accessory/accessory.png"
|
||||
dest_files=["res://.godot/imported/accessory.png-04ec32093cb21658c9558ccc9e7c09b2.s3tc.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=2
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=true
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=0
|
||||
Reference in New Issue
Block a user