mirror of
https://github.com/misternebula/quantum-space-buddies.git
synced 2025-12-11 20:15:10 +01:00
lots of doc
This commit is contained in:
parent
e2c8fa53ca
commit
18d57b9892
@ -1,4 +1,5 @@
|
|||||||
using Cysharp.Threading.Tasks;
|
using Cysharp.Threading.Tasks;
|
||||||
|
using HarmonyLib;
|
||||||
using OWML.Common;
|
using OWML.Common;
|
||||||
using QSB.ItemSync.WorldObjects;
|
using QSB.ItemSync.WorldObjects;
|
||||||
using QSB.ItemSync.WorldObjects.Items;
|
using QSB.ItemSync.WorldObjects.Items;
|
||||||
@ -26,14 +27,16 @@ public class ItemManager : WorldObjectManager
|
|||||||
QSBWorldSync.Init<QSBSlideReelItem, SlideReelItem>();
|
QSBWorldSync.Init<QSBSlideReelItem, SlideReelItem>();
|
||||||
QSBWorldSync.Init<QSBWarpCoreItem, WarpCoreItem>();
|
QSBWorldSync.Init<QSBWarpCoreItem, WarpCoreItem>();
|
||||||
// dream lantern and vision torch are set up in their own managers
|
// 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)
|
// 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
|
// QSB addons can still define their own QSBItem derived classes and they will just get skipped here
|
||||||
var handledItemTypes = GetHandledItemTypes();
|
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: {string.Join(", ", handledItemTypes)}");
|
DebugLog.DebugWrite($"Handled OWItem types (the rest will get generic QSBItem support) are: {handledItemTypes.Join()}");
|
||||||
var otherItemlistToInitFrom = QSBWorldSync.GetUnityObjects<OWItem>()
|
var otherItemlistToInitFrom = QSBWorldSync.GetUnityObjects<OWItem>()
|
||||||
.Where(x => !handledItemTypes.Contains(x.GetType()))
|
.Where(x => !handledItemTypes.Contains(x.GetType()))
|
||||||
.SortDeterministic();
|
.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);
|
QSBWorldSync.Init<QSBItem<OWItem>, OWItem>(otherItemlistToInitFrom);
|
||||||
|
|
||||||
// Sockets
|
// Sockets
|
||||||
@ -50,7 +53,6 @@ public class ItemManager : WorldObjectManager
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets all types that extend QSBItem and returns the list of OWItem types that are already handled by dedicated classes
|
/// Gets all types that extend QSBItem and returns the list of OWItem types that are already handled by dedicated classes
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
|
||||||
private static IEnumerable<Type> GetHandledItemTypes()
|
private static IEnumerable<Type> GetHandledItemTypes()
|
||||||
{
|
{
|
||||||
var assemblies = QSBCore.Addons.Values
|
var assemblies = QSBCore.Addons.Values
|
||||||
|
|||||||
@ -12,6 +12,8 @@ using UnityEngine;
|
|||||||
|
|
||||||
namespace QSB.ItemSync.WorldObjects.Items;
|
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
|
public class QSBItem<T> : WorldObject<T>, IQSBItem
|
||||||
where T : OWItem
|
where T : OWItem
|
||||||
{
|
{
|
||||||
|
|||||||
3
QSB/ItemSync/WorldObjects/Items/QSBOtherItem.cs
Normal file
3
QSB/ItemSync/WorldObjects/Items/QSBOtherItem.cs
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
namespace QSB.ItemSync.WorldObjects.Items;
|
||||||
|
|
||||||
|
public class QSBOtherItem : QSBItem<OWItem> { }
|
||||||
@ -3,4 +3,4 @@
|
|||||||
public class QSBWarpCoreItem : QSBItem<WarpCoreItem>
|
public class QSBWarpCoreItem : QSBItem<WarpCoreItem>
|
||||||
{
|
{
|
||||||
public bool IsVesselCoreType() => AttachedObject.IsVesselCoreType();
|
public bool IsVesselCoreType() => AttachedObject.IsVesselCoreType();
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user