lots of doc

This commit is contained in:
JohnCorby 2025-03-01 15:45:58 -08:00
parent e2c8fa53ca
commit 18d57b9892
4 changed files with 11 additions and 4 deletions

View File

@ -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<QSBSlideReelItem, SlideReelItem>();
QSBWorldSync.Init<QSBWarpCoreItem, WarpCoreItem>();
// 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<Type>(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<OWItem>()
.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<QSBItem<OWItem>, OWItem>(otherItemlistToInitFrom);
// Sockets
@ -50,7 +53,6 @@ public class ItemManager : WorldObjectManager
/// <summary>
/// Gets all types that extend QSBItem and returns the list of OWItem types that are already handled by dedicated classes
/// </summary>
/// <returns></returns>
private static IEnumerable<Type> GetHandledItemTypes()
{
var assemblies = QSBCore.Addons.Values

View File

@ -12,6 +12,8 @@ using UnityEngine;
namespace QSB.ItemSync.WorldObjects.Items;
// not abstract so modded items can use this QSBItem<OWItem>
// could use QSBOtherItem subclass but i dont feel like it
public class QSBItem<T> : WorldObject<T>, IQSBItem
where T : OWItem
{

View File

@ -0,0 +1,3 @@
namespace QSB.ItemSync.WorldObjects.Items;
public class QSBOtherItem : QSBItem<OWItem> { }

View File

@ -3,4 +3,4 @@
public class QSBWarpCoreItem : QSBItem<WarpCoreItem>
{
public bool IsVesselCoreType() => AttachedObject.IsVesselCoreType();
}
}