This commit is contained in:
cblech
2025-07-25 20:20:34 +02:00
parent b6373e6a2b
commit f6e9a6f9b5
22 changed files with 193 additions and 30 deletions
@@ -0,0 +1,33 @@
using Godot;
using System;
using System.Collections.Generic;
using System.Linq;
using Babushka.scripts.CSharp.Common.Inventory;
using Babushka.scripts.CSharp.Common.Quest;
public partial class DetectInventoryContains : QuestFulfillmentBase
{
[Export(PropertyHint.ArrayType)] private ItemInstance[] _itemsToContain;
public override void _Ready()
{
QuestManager.Instance!.QuestsChanged += Update;
InventoryManager.Instance.playerInventory.InventoryContentsChanged += Update;
Update();
}
public override void _ExitTree()
{
QuestManager.Instance!.QuestsChanged -= Update;
InventoryManager.Instance.playerInventory.InventoryContentsChanged -= Update;
}
private void Update()
{
if (IsQuestActive() && InventoryManager.Instance.playerInventory.HasItems(_itemsToContain))
{
Fulfill();
}
}
}