Fix spacing

This commit is contained in:
xen-42 2025-03-01 14:53:39 -05:00
parent 4e8f9be510
commit accd958dc1
2 changed files with 31 additions and 29 deletions

2
.editorconfig Normal file
View File

@ -0,0 +1,2 @@
[*.cs]
indent_style = tab

View File

@ -29,19 +29,19 @@ public class ItemManager : WorldObjectManager
QSBWorldSync.Init<QSBSimpleLanternItem, SimpleLanternItem>();
QSBWorldSync.Init<QSBSlideReelItem, SlideReelItem>();
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
// 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 otherItemlistToInitFrom = QSBWorldSync.GetUnityObjects<OWItem>()
.Where(x => !handledItemTypes.Contains(x.GetType()))
.SortDeterministic();
QSBWorldSync.Init<QSBItem<OWItem>, OWItem>(otherItemlistToInitFrom);
// 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 otherItemlistToInitFrom = QSBWorldSync.GetUnityObjects<OWItem>()
.Where(x => !handledItemTypes.Contains(x.GetType()))
.SortDeterministic();
QSBWorldSync.Init<QSBItem<OWItem>, OWItem>(otherItemlistToInitFrom);
// Sockets
QSBWorldSync.Init<QSBItemSocket, OWItemSocket>();
// Sockets
QSBWorldSync.Init<QSBItemSocket, OWItemSocket>();
// other drop targets that don't already have world objects
var listToInitFrom = QSBWorldSync.GetUnityObjects<MonoBehaviour>()
@ -50,24 +50,24 @@ public class ItemManager : WorldObjectManager
QSBWorldSync.Init<QSBOtherDropTarget, MonoBehaviour>(listToInitFrom);
}
/// <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
.Select(x => x.GetType().Assembly)
.Append(typeof(QSBCore).Assembly);
/// <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
.Select(x => x.GetType().Assembly)
.Append(typeof(QSBCore).Assembly);
if (QSBCore.QSBNHAssembly != null)
{
assemblies = assemblies.Append(QSBCore.QSBNHAssembly);
}
if (QSBCore.QSBNHAssembly != null)
{
assemblies = assemblies.Append(QSBCore.QSBNHAssembly);
}
return assemblies.SelectMany(x => x.GetTypes())
.Where(x => !x.IsInterface && !x.IsAbstract && x.BaseType != null && x.BaseType.IsGenericType && x.BaseType.GetGenericTypeDefinition() == typeof(QSBItem<>))
.Select(x => x.BaseType.GetGenericArguments()[0])
.OrderBy(x => x.FullName);
}
return assemblies.SelectMany(x => x.GetTypes())
.Where(x => !x.IsInterface && !x.IsAbstract && x.BaseType != null && x.BaseType.IsGenericType && x.BaseType.GetGenericTypeDefinition() == typeof(QSBItem<>))
.Select(x => x.BaseType.GetGenericArguments()[0])
.OrderBy(x => x.FullName);
}
}