Fix some boxes and global positioning
This commit is contained in:
@@ -93,7 +93,8 @@ public partial class Inventory : Node, IInventory
|
||||
var effectItems = listToSort.Where(x => x is EffectItem).OrderBy(x => x as EffectItem, new EffectComparer());
|
||||
var jewelItems = listToSort.Where(x => x is Jewel).OrderBy(x => x as Jewel, new JewelComparer());
|
||||
var setItems = listToSort.Where(x => x is Plastique).OrderBy(x => x as Plastique, new SetItemComparer());
|
||||
Items = [.. equippedItems, .. weapons, .. armor, .. accessories, .. ammo, .. consumables, .. throwables, .. effectItems, .. jewelItems, .. setItems];
|
||||
var boxItems = listToSort.Where(x => x is BoxItem).OrderBy(x => x as BoxItem, new BoxItemComparer());
|
||||
Items = [.. equippedItems, .. weapons, .. armor, .. accessories, .. ammo, .. consumables, .. throwables, .. effectItems, .. jewelItems, ..boxItems, .. setItems];
|
||||
|
||||
var stackableItems = Items.OfType<IStackable>();
|
||||
var itemsToStack = stackableItems.GroupBy(x => ((IBaseInventoryItem)x).ItemName).Where(x => x.Count() > 1);
|
||||
@@ -163,6 +164,14 @@ public partial class Inventory : Node, IInventory
|
||||
}
|
||||
}
|
||||
|
||||
public class BoxItemComparer : IComparer<BoxItem>
|
||||
{
|
||||
public int Compare(BoxItem x, BoxItem y)
|
||||
{
|
||||
return x.ItemName.CompareTo(y.ItemName);
|
||||
}
|
||||
}
|
||||
|
||||
public class ConsumableComparer : IComparer<ConsumableItem>
|
||||
{
|
||||
public int Compare(ConsumableItem x, ConsumableItem y)
|
||||
|
||||
@@ -21,7 +21,6 @@ public partial class Ammo : Node3D, IEquipableItem, IStackable
|
||||
_sprite.Texture = Stats.Texture;
|
||||
}
|
||||
|
||||
|
||||
public string ItemName => Stats.Name;
|
||||
|
||||
public string FlavorText => Stats.FlavorText;
|
||||
@@ -39,7 +38,7 @@ public partial class Ammo : Node3D, IEquipableItem, IStackable
|
||||
public Texture2D GetTexture() => Stats.Texture;
|
||||
|
||||
[Save("ammo_item_count")]
|
||||
public AutoProp<int> Count { get; private set; }
|
||||
public AutoProp<int> Count { get; private set; } = new AutoProp<int>(3);
|
||||
|
||||
public void SetCount(int count) => Count.OnNext(count);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user