diff --git a/QSB/ItemSync/ItemManager.cs b/QSB/ItemSync/ItemManager.cs index b329b557..a6dd2133 100644 --- a/QSB/ItemSync/ItemManager.cs +++ b/QSB/ItemSync/ItemManager.cs @@ -1,4 +1,5 @@ using Cysharp.Threading.Tasks; +using HarmonyLib; using OWML.Common; using QSB.ItemSync.WorldObjects; using QSB.ItemSync.WorldObjects.Items; @@ -26,14 +27,16 @@ public class ItemManager : WorldObjectManager QSBWorldSync.Init(); QSBWorldSync.Init(); // dream lantern and vision torch are set up in their own managers + // the rest can just use the generic thing below because they dont have special things using them // Use the basic QSBItem class for any items that do not require custom code through a derived class (mod compatibility) // QSB addons can still define their own QSBItem derived classes and they will just get skipped here - var handledItemTypes = GetHandledItemTypes(); - DebugLog.DebugWrite($"Handled OWItem types (the rest will get generic QSBItem support) are: {string.Join(", ", handledItemTypes)}"); + var handledItemTypes = new HashSet(GetHandledItemTypes()); // set cuz we do Contains below + DebugLog.DebugWrite($"Handled OWItem types (the rest will get generic QSBItem support) are: {handledItemTypes.Join()}"); var otherItemlistToInitFrom = QSBWorldSync.GetUnityObjects() .Where(x => !handledItemTypes.Contains(x.GetType())) .SortDeterministic(); + // could make a subclass for this but i dont care, and would have to filter out from reflection thing below QSBWorldSync.Init, OWItem>(otherItemlistToInitFrom); // Sockets @@ -50,7 +53,6 @@ public class ItemManager : WorldObjectManager /// /// Gets all types that extend QSBItem and returns the list of OWItem types that are already handled by dedicated classes /// - /// private static IEnumerable GetHandledItemTypes() { var assemblies = QSBCore.Addons.Values diff --git a/QSB/ItemSync/WorldObjects/Items/QSBItem.cs b/QSB/ItemSync/WorldObjects/Items/QSBItem.cs index c1417b32..b76cf7b7 100644 --- a/QSB/ItemSync/WorldObjects/Items/QSBItem.cs +++ b/QSB/ItemSync/WorldObjects/Items/QSBItem.cs @@ -12,6 +12,8 @@ using UnityEngine; namespace QSB.ItemSync.WorldObjects.Items; +// not abstract so modded items can use this QSBItem +// could use QSBOtherItem subclass but i dont feel like it public class QSBItem : WorldObject, IQSBItem where T : OWItem { diff --git a/QSB/ItemSync/WorldObjects/Items/QSBOtherItem.cs b/QSB/ItemSync/WorldObjects/Items/QSBOtherItem.cs new file mode 100644 index 00000000..c0206376 --- /dev/null +++ b/QSB/ItemSync/WorldObjects/Items/QSBOtherItem.cs @@ -0,0 +1,3 @@ +namespace QSB.ItemSync.WorldObjects.Items; + +public class QSBOtherItem : QSBItem { } diff --git a/QSB/ItemSync/WorldObjects/Items/QSBWarpCoreItem.cs b/QSB/ItemSync/WorldObjects/Items/QSBWarpCoreItem.cs index 476df5a7..18f5625e 100644 --- a/QSB/ItemSync/WorldObjects/Items/QSBWarpCoreItem.cs +++ b/QSB/ItemSync/WorldObjects/Items/QSBWarpCoreItem.cs @@ -3,4 +3,4 @@ public class QSBWarpCoreItem : QSBItem { public bool IsVesselCoreType() => AttachedObject.IsVesselCoreType(); -} \ No newline at end of file +}