mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-01 11:15:33 +00:00
43 lines
956 B
C#
43 lines
956 B
C#
using Godot;
|
|
using System;
|
|
using System.Diagnostics;
|
|
using System.Linq;
|
|
using Cirno.Scripts.Resources;
|
|
using Godot.Collections;
|
|
|
|
public partial class Interactable : Area2D
|
|
{
|
|
[Export] public Array<LootItem> Requirements = new Array<LootItem>();
|
|
|
|
protected InventoryManager _inventoryManager;
|
|
|
|
public override void _Ready()
|
|
{
|
|
_inventoryManager = GetNode<InventoryManager>("/root/GameScene/InventoryManager");
|
|
}
|
|
|
|
protected bool MeetsRequirements()
|
|
{
|
|
if (Requirements.Any())
|
|
{
|
|
if (_inventoryManager.HasItems(Requirements.Select(x => x.Item).ToList()))
|
|
{
|
|
GD.Print($"Requirements for activation of {this.Name} successfully met: {string.Join(",", Requirements.Select(x => x.Item))} ");
|
|
return true;
|
|
}
|
|
else
|
|
{
|
|
GD.Print($"Requirements for activation of {this.Name} not met: {string.Join(",", Requirements.Select(x => x.Item))} ");
|
|
return false;
|
|
}
|
|
|
|
}
|
|
|
|
return true;
|
|
}
|
|
|
|
public virtual void Activate()
|
|
{
|
|
|
|
}
|
|
}
|