mirror of
https://github.com/misternebula/quantum-space-buddies.git
synced 2025-02-27 18:41:03 +00:00
add basic NH stuff
This commit is contained in:
parent
975c4bdca5
commit
41f38369d0
29
QSB-NH/QSB-NH.csproj
Normal file
29
QSB-NH/QSB-NH.csproj
Normal file
@ -0,0 +1,29 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net48</TargetFramework>
|
||||
<RootNamespace>QSBNH</RootNamespace>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<OutputPath Condition="Exists('$(OwmlDir)')">$(OwmlDir)\Mods\Raicuparta.QuantumSpaceBuddies</OutputPath>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="lib\" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\QSB\QSB.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Reference Include="NewHorizons">
|
||||
<HintPath>lib\NewHorizons.dll</HintPath>
|
||||
<Private>false</Private>
|
||||
</Reference>
|
||||
<Reference Include="UniTask">
|
||||
<HintPath>..\Lib\UniTask.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
14
QSB-NH/QSBNH.cs
Normal file
14
QSB-NH/QSBNH.cs
Normal file
@ -0,0 +1,14 @@
|
||||
using OWML.Common;
|
||||
using QSB.Utility;
|
||||
using UnityEngine;
|
||||
|
||||
namespace QSBNH
|
||||
{
|
||||
public class QSBNH : MonoBehaviour
|
||||
{
|
||||
private void Start()
|
||||
{
|
||||
DebugLog.DebugWrite($"Start of QSB-NH compatibility code.", MessageType.Success);
|
||||
}
|
||||
}
|
||||
}
|
13
QSB-NH/QuantumPlanet/QuantumPlanetManager.cs
Normal file
13
QSB-NH/QuantumPlanet/QuantumPlanetManager.cs
Normal file
@ -0,0 +1,13 @@
|
||||
using Cysharp.Threading.Tasks;
|
||||
using QSB.WorldSync;
|
||||
using QSBNH.QuantumPlanet.WorldObjects;
|
||||
|
||||
namespace QSBNH.QuantumPlanet;
|
||||
public class QuantumPlanetManager : WorldObjectManager
|
||||
{
|
||||
public override WorldObjectScene WorldObjectScene => WorldObjectScene.Both;
|
||||
public override bool DlcOnly => false;
|
||||
|
||||
public override async UniTask BuildWorldObjects(OWScene scene, CancellationToken ct) =>
|
||||
QSBWorldSync.Init<QSBQuantumPlanet, NewHorizons.Components.Quantum.QuantumPlanet>();
|
||||
}
|
7
QSB-NH/QuantumPlanet/WorldObjects/QSBQuantumPlanet.cs
Normal file
7
QSB-NH/QuantumPlanet/WorldObjects/QSBQuantumPlanet.cs
Normal file
@ -0,0 +1,7 @@
|
||||
using QSB.QuantumSync.WorldObjects;
|
||||
|
||||
namespace QSBNH.QuantumPlanet.WorldObjects;
|
||||
|
||||
public class QSBQuantumPlanet : QSBQuantumObject<NewHorizons.Components.Quantum.QuantumPlanet>
|
||||
{
|
||||
}
|
BIN
QSB-NH/lib/NewHorizons.dll
Normal file
BIN
QSB-NH/lib/NewHorizons.dll
Normal file
Binary file not shown.
6
QSB.sln
6
QSB.sln
@ -34,6 +34,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "APITestMod", "APITestMod\AP
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "QSBPatcher", "QSBPatcher\QSBPatcher.csproj", "{CA4CBA2B-54D5-4C4B-9B51-957BC6D77D6B}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "QSB-NH", "QSB-NH\QSB-NH.csproj", "{74F84A39-1C9D-4EF7-889A-485D33B7B324}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
@ -64,6 +66,10 @@ Global
|
||||
{CA4CBA2B-54D5-4C4B-9B51-957BC6D77D6B}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{CA4CBA2B-54D5-4C4B-9B51-957BC6D77D6B}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{CA4CBA2B-54D5-4C4B-9B51-957BC6D77D6B}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{74F84A39-1C9D-4EF7-889A-485D33B7B324}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{74F84A39-1C9D-4EF7-889A-485D33B7B324}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{74F84A39-1C9D-4EF7-889A-485D33B7B324}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{74F84A39-1C9D-4EF7-889A-485D33B7B324}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
@ -1,6 +1,7 @@
|
||||
using Cysharp.Threading.Tasks;
|
||||
using QSB.MeteorSync.WorldObjects;
|
||||
using QSB.WorldSync;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
|
||||
namespace QSB.MeteorSync;
|
||||
@ -16,7 +17,9 @@ public class MeteorManager : WorldObjectManager
|
||||
// wait for all late initializers (which includes meteor launchers) to finish
|
||||
await UniTask.WaitUntil(() => LateInitializerManager.isDoneInitializing, cancellationToken: ct);
|
||||
|
||||
WhiteHoleVolume = QSBWorldSync.GetUnityObject<WhiteHoleVolume>();
|
||||
// NH can make multiple so ensure its the stock whitehole
|
||||
var whiteHole = QSBWorldSync.GetUnityObjects<AstroObject>().First(x => x.GetAstroObjectName() == AstroObject.Name.WhiteHole);
|
||||
WhiteHoleVolume = whiteHole?.GetComponentInChildren<WhiteHoleVolume>();
|
||||
QSBWorldSync.Init<QSBFragment, FragmentIntegrity>();
|
||||
QSBWorldSync.Init<QSBMeteorLauncher, MeteorLauncher>();
|
||||
QSBWorldSync.Init<QSBMeteor, MeteorController>();
|
||||
|
@ -37,6 +37,13 @@ public class ModelShipManager : WorldObjectManager
|
||||
|
||||
public override async UniTask BuildWorldObjects(OWScene scene, CancellationToken ct)
|
||||
{
|
||||
// NH can remove this
|
||||
var modelShip = QSBWorldSync.GetUnityObject<RemoteFlightConsole>()._modelShipBody;
|
||||
if (!modelShip)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (QSBCore.IsHost)
|
||||
{
|
||||
Instantiate(QSBNetworkManager.singleton.ModelShipPrefab).SpawnWithServerOwnership();
|
||||
|
@ -84,6 +84,7 @@ public class QSBCore : ModBehaviour
|
||||
private static string randomSkinType;
|
||||
private static string randomJetpackType;
|
||||
|
||||
public static Assembly QSBNHAssembly = null;
|
||||
|
||||
public static readonly string[] IncompatibleMods =
|
||||
{
|
||||
@ -227,7 +228,7 @@ public class QSBCore : ModBehaviour
|
||||
Helper = ModHelper;
|
||||
DebugLog.ToConsole($"* Start of QSB version {QSBVersion} - authored by {Helper.Manifest.Author}", MessageType.Info);
|
||||
|
||||
CheckCompatibilityMods();
|
||||
CheckNewHorizons();
|
||||
|
||||
DebugSettings = Helper.Storage.Load<DebugSettings>("debugsettings.json") ?? new DebugSettings();
|
||||
|
||||
@ -463,23 +464,12 @@ public class QSBCore : ModBehaviour
|
||||
}
|
||||
}
|
||||
|
||||
private void CheckCompatibilityMods()
|
||||
private void CheckNewHorizons()
|
||||
{
|
||||
var mainMod = "";
|
||||
var compatMod = "";
|
||||
var missingCompat = false;
|
||||
|
||||
/*if (Helper.Interaction.ModExists(NEW_HORIZONS) && !Helper.Interaction.ModExists(NEW_HORIZONS_COMPAT))
|
||||
if (ModHelper.Interaction.ModExists("xen.NewHorizons"))
|
||||
{
|
||||
mainMod = NEW_HORIZONS;
|
||||
compatMod = NEW_HORIZONS_COMPAT;
|
||||
missingCompat = true;
|
||||
}*/
|
||||
|
||||
if (missingCompat)
|
||||
{
|
||||
DebugLog.ToConsole($"FATAL - You have mod \"{mainMod}\" installed, which is not compatible with QSB without the compatibility mod \"{compatMod}\". " +
|
||||
$"Either disable the mod, or install/enable the compatibility mod.", MessageType.Fatal);
|
||||
QSBNHAssembly = Assembly.LoadFrom(Path.Combine(ModHelper.Manifest.ModFolderPath, "QSB-NH.dll"));
|
||||
gameObject.AddComponent(QSBNHAssembly.GetType("QSBNH.QSBNH", true));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -91,11 +91,16 @@ public class QSBSectorManager : WorldObjectManager
|
||||
|
||||
// time loop spinning ring
|
||||
{
|
||||
// NH can remove this
|
||||
var TimeLoopRing_Body = GameObject.Find("TimeLoopRing_Body");
|
||||
var Sector_TimeLoopInterior = GameObject.Find("Sector_TimeLoopInterior").GetComponent<Sector>();
|
||||
// use the same trigger as the parent sector
|
||||
FakeSector.Create(TimeLoopRing_Body, Sector_TimeLoopInterior,
|
||||
x => x._triggerRoot = Sector_TimeLoopInterior._triggerRoot);
|
||||
|
||||
if (TimeLoopRing_Body)
|
||||
{
|
||||
var Sector_TimeLoopInterior = GameObject.Find("Sector_TimeLoopInterior").GetComponent<Sector>();
|
||||
// use the same trigger as the parent sector
|
||||
FakeSector.Create(TimeLoopRing_Body, Sector_TimeLoopInterior,
|
||||
x => x._triggerRoot = Sector_TimeLoopInterior._triggerRoot);
|
||||
}
|
||||
}
|
||||
|
||||
// TH elevators
|
||||
|
@ -23,6 +23,12 @@ public class OccasionalManager : WorldObjectManager
|
||||
|
||||
foreach (var proxy in cannon._realDebrisSectorProxies)
|
||||
{
|
||||
// NH can remove these
|
||||
if (!proxy)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
SpawnOccasional(proxy.transform.root.GetAttachedOWRigidbody(), gdBody);
|
||||
}
|
||||
|
||||
|
@ -205,6 +205,8 @@ public class DebugGUI : MonoBehaviour, IAddComponentOnStart
|
||||
|
||||
WriteLine(2, $" - Ref. Sector : {(referenceSector == null ? "NULL" : referenceSector.Name)}", referenceSector == null ? Color.red : Color.white);
|
||||
WriteLine(2, $" - Ref. Transform : {(referenceTransform == null ? "NULL" : referenceTransform.name)}", referenceTransform == null ? Color.red : Color.white);
|
||||
WriteLine(2, $" - Local Position : {player.Body.transform.localPosition}");
|
||||
WriteLine(2, $" - Position : {player.Body.transform.position}");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -182,13 +182,21 @@ public static class Extensions
|
||||
multiDelegate.SafeInvoke(args);
|
||||
}
|
||||
|
||||
public static IEnumerable<Type> GetDerivedTypes(this Type type) =>
|
||||
QSBCore.Addons.Values
|
||||
public static IEnumerable<Type> GetDerivedTypes(this Type type)
|
||||
{
|
||||
var assemblies = QSBCore.Addons.Values
|
||||
.Select(x => x.GetType().Assembly)
|
||||
.Append(type.Assembly)
|
||||
.SelectMany(x => x.GetTypes())
|
||||
.Append(type.Assembly);
|
||||
|
||||
if (QSBCore.QSBNHAssembly != null)
|
||||
{
|
||||
assemblies = assemblies.Append(QSBCore.QSBNHAssembly);
|
||||
}
|
||||
|
||||
return assemblies.SelectMany(x => x.GetTypes())
|
||||
.Where(x => !x.IsInterface && !x.IsAbstract && type.IsAssignableFrom(x))
|
||||
.OrderBy(x => x.FullName);
|
||||
}
|
||||
|
||||
public static Guid ToGuid(this int value)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user