Skip to content

Commit

Permalink
fix: EquipmentGadget allowed None enum values (#456)
Browse files Browse the repository at this point in the history
Fixed a bug where you could register None enums
  • Loading branch information
Metious committed Sep 3, 2023
1 parent 901061a commit 3e8bd59
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions Nautilus/Assets/Gadgets/EquipmentGadget.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ public EquipmentGadget(ICustomPrefab prefab, EquipmentType equipmentType) : base
}



/// <summary>
/// Sets the way the game should treat this item as when in a quick slot.
/// </summary>
Expand All @@ -51,8 +50,6 @@ public EquipmentGadget WithQuickSlotType(QuickSlotType quickSlotType)
return this;
}



/// <inheritdoc/>
protected internal override void Build()
{
Expand All @@ -61,8 +58,19 @@ protected internal override void Build()
InternalLogger.Error($"Prefab '{prefab.Info}' does not contain a TechType. Skipping {nameof(EquipmentGadget)} build.");
return;
}

if (EquipmentType != EquipmentType.None)
{
CraftDataHandler.SetEquipmentType(prefab.Info.TechType, EquipmentType);
}
else
{
InternalLogger.Error($"Prefab '{prefab.Info}' cannot have an {nameof(EquipmentGadget)} where the EquipmentType is set to None.");
}

CraftDataHandler.SetEquipmentType(prefab.Info.TechType, EquipmentType);
CraftDataHandler.SetQuickSlotType(prefab.Info.TechType, QuickSlotType);
if (QuickSlotType != QuickSlotType.None)
{
CraftDataHandler.SetQuickSlotType(prefab.Info.TechType, QuickSlotType);
}
}
}

0 comments on commit 3e8bd59

Please sign in to comment.