2025-01-30 17:24:40 +01:00
|
|
|
|
using Cirno.Scripts.Resources;
|
|
|
|
|
|
using Godot;
|
|
|
|
|
|
using Godot.Collections;
|
2025-01-28 14:05:38 +01:00
|
|
|
|
|
2025-01-30 17:24:40 +01:00
|
|
|
|
namespace Cirno.Scripts;
|
|
|
|
|
|
|
|
|
|
|
|
public partial class Chest : Interactable
|
2025-01-28 14:05:38 +01:00
|
|
|
|
{
|
|
|
|
|
|
|
2025-01-30 17:24:40 +01:00
|
|
|
|
[Export] public Array<LootItem> LootTable = new Array<LootItem>();
|
2025-01-28 14:05:38 +01:00
|
|
|
|
|
2025-01-30 17:24:40 +01:00
|
|
|
|
public override void Activate()
|
2025-01-28 14:05:38 +01:00
|
|
|
|
{
|
2025-01-30 17:24:40 +01:00
|
|
|
|
if (!MeetsRequirements()) return;
|
|
|
|
|
|
foreach (var item in LootTable)
|
|
|
|
|
|
{
|
|
|
|
|
|
_inventoryManager.AddItem(item.Item, item.Amount);
|
|
|
|
|
|
}
|
2025-01-28 14:05:38 +01:00
|
|
|
|
}
|
2025-01-30 17:24:40 +01:00
|
|
|
|
|
|
|
|
|
|
public override void _Ready()
|
2025-01-28 14:05:38 +01:00
|
|
|
|
{
|
2025-01-30 17:24:40 +01:00
|
|
|
|
base._Ready();
|
2025-01-28 14:05:38 +01:00
|
|
|
|
}
|
2025-01-30 17:24:40 +01:00
|
|
|
|
|
2025-01-28 14:05:38 +01:00
|
|
|
|
}
|