mirror of
https://github.com/misternebula/quantum-space-buddies.git
synced 2025-02-21 18:40:03 +00:00
qsb api
This commit is contained in:
parent
8a51fe74a3
commit
256e058462
8
QSB/QSBApi.cs
Normal file
8
QSB/QSBApi.cs
Normal file
@ -0,0 +1,8 @@
|
||||
using OWML.Common;
|
||||
|
||||
namespace QSB;
|
||||
|
||||
public class QSBApi
|
||||
{
|
||||
public void RegisterAddon(IModBehaviour addon) => QSBCore.Addons.Add(addon);
|
||||
}
|
@ -8,6 +8,7 @@ using QSB.QuantumSync;
|
||||
using QSB.Utility;
|
||||
using QSB.WorldSync;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
@ -163,6 +164,9 @@ public class QSBCore : ModBehaviour
|
||||
DebugLog.ToConsole($"DEBUG MODE = {DebugSettings.DebugMode}");
|
||||
}
|
||||
}
|
||||
|
||||
public static readonly List<IModBehaviour> Addons = new();
|
||||
public override object GetApi() => new QSBApi();
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -175,8 +175,13 @@ public static class Extensions
|
||||
multiDelegate.GetInvocationList().ForEach(dl => dl.DynamicInvoke(args));
|
||||
}
|
||||
|
||||
public static IEnumerable<Type> GetDerivedTypes(this Type type) => type.Assembly.GetTypes()
|
||||
.Where(x => !x.IsInterface && !x.IsAbstract && type.IsAssignableFrom(x));
|
||||
public static IEnumerable<Type> GetDerivedTypes(this Type type) =>
|
||||
QSBCore.Addons
|
||||
.Select(x => x.GetType().Assembly)
|
||||
.Append(type.Assembly)
|
||||
.SelectMany(x => x.GetTypes())
|
||||
.Where(x => !x.IsInterface && !x.IsAbstract && type.IsAssignableFrom(x))
|
||||
.OrderBy(x => x.AssemblyQualifiedName);
|
||||
|
||||
public static Guid ToGuid(this int value)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user