From a0aa9c88c8199373d4a154b017634880df3146b4 Mon Sep 17 00:00:00 2001
From: Metious <71298690+Metious@users.noreply.github.com>
Date: Sat, 2 Sep 2023 16:35:06 +0330
Subject: [PATCH] Fixed a bug where you could register None enums
---
Nautilus/Assets/Gadgets/EquipmentGadget.cs | 18 +++++++++++++-----
1 file changed, 13 insertions(+), 5 deletions(-)
diff --git a/Nautilus/Assets/Gadgets/EquipmentGadget.cs b/Nautilus/Assets/Gadgets/EquipmentGadget.cs
index a50d524f..2f62a354 100644
--- a/Nautilus/Assets/Gadgets/EquipmentGadget.cs
+++ b/Nautilus/Assets/Gadgets/EquipmentGadget.cs
@@ -39,7 +39,6 @@ public EquipmentGadget(ICustomPrefab prefab, EquipmentType equipmentType) : base
}
-
///
/// Sets the way the game should treat this item as when in a quick slot.
///
@@ -51,8 +50,6 @@ public EquipmentGadget WithQuickSlotType(QuickSlotType quickSlotType)
return this;
}
-
-
///
protected internal override void Build()
{
@@ -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);
+ }
}
}
\ No newline at end of file