Equipment: slots, gear traits, archetype limits and stat bonuses, equip actions and schema
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
commit
f834d1e914
28 files changed
+1065
No files matched your search
@@ -0,0 +1,29 @@
|
||||
namespace Cthangover.Mods.Equipment
|
||||
{
|
||||
using Cthangover.Core.Mods;
|
||||
using Cthangover.Core.Settings;
|
||||
using Cthangover.Mods.Stats;
|
||||
|
||||
/// <summary>Saves what everyone wears in the equipment slot.</summary>
|
||||
public class EquipmentSaveable : IModSaveable
|
||||
{
|
||||
private const string BlobKey = "Worn";
|
||||
|
||||
/// <inheritdoc />
|
||||
public void OnSave(ModSlot slot)
|
||||
{
|
||||
slot.Data[BlobKey] = new DataBlob(1, EquipmentService.Data);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public bool OnLoad(ModSlot slot, out string errorMessage)
|
||||
{
|
||||
errorMessage = null;
|
||||
EquipmentService.Data = new EquipmentStateData();
|
||||
if (slot?.Data != null && slot.Data.TryGetValue(BlobKey, out var blob))
|
||||
EquipmentService.Data = blob.ReadJson<EquipmentStateData>() ?? new EquipmentStateData();
|
||||
StatsService.ClearCache();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user