Fix texture stuff

This commit is contained in:
2025-03-09 12:24:30 -07:00
parent b93630756c
commit d8c5bc8f78
112 changed files with 671 additions and 355 deletions

View File

@@ -1,25 +1,13 @@
using Chickensoft.AutoInject;
using Chickensoft.GodotNodeInterfaces;
using Chickensoft.Introspection;
using Chickensoft.Serialization;
using Godot;
using System.Collections.Generic;
using System.Linq;
using Zennysoft.Game.Abstractions;
using Zennysoft.Ma.Adapter;
namespace Zennysoft.Game.Ma;
public interface IInventory : INode
{
public List<IInventoryItem> Items { get; }
public bool TryAdd(IInventoryItem inventoryItem);
public void Remove(IInventoryItem inventoryItem);
public void Sort();
}
[Meta(typeof(IAutoNode)), Id("inventory")]
public partial class Inventory : Node, IInventory
{
@@ -34,9 +22,9 @@ public partial class Inventory : Node, IInventory
}
[Save("inventory_items")]
public List<IInventoryItem> Items { get; private set; }
public List<InventoryItem> Items { get; private set; }
public bool TryAdd(IInventoryItem inventoryItem)
public bool TryAdd(InventoryItem inventoryItem)
{
if (Items.Count >= _maxInventorySize)
return false;
@@ -45,15 +33,15 @@ public partial class Inventory : Node, IInventory
return true;
}
public void Remove(IInventoryItem inventoryItem) => Items.Remove(inventoryItem);
public void Remove(InventoryItem inventoryItem) => Items.Remove(inventoryItem);
public void Sort()
{
var equippedWeapon = Items.OfType<Weapon>().Where(x => x.IsEquipped).Cast<IInventoryItem>();
var equippedArmor = Items.OfType<Armor>().Where(x => x.IsEquipped).Cast<IInventoryItem>();
var equippedAccessory = Items.OfType<Accessory>().Where(x => x.IsEquipped).Cast<IInventoryItem>();
var equippedItems = new List<IInventoryItem>();
var equippedWeapon = Items.OfType<Weapon>().Where(x => x.IsEquipped);
var equippedArmor = Items.OfType<Armor>().Where(x => x.IsEquipped);
var equippedAccessory = Items.OfType<Accessory>().Where(x => x.IsEquipped);
var equippedItems = new List<InventoryItem>();
equippedItems.AddRange(equippedWeapon);
equippedItems.AddRange(equippedArmor);
equippedItems.AddRange(equippedAccessory);