mirror of
https://github.com/Outer-Wilds-New-Horizons/new-horizons.git
synced 2025-12-11 20:15:44 +01:00
Merge branch 'dev' into enum
This commit is contained in:
commit
13025f2e48
@ -1,4 +1,5 @@
|
||||
{
|
||||
"$schema": "https://raw.githubusercontent.com/Outer-Wilds-New-Horizons/new-horizons/main/NewHorizons/Schemas/addon_manifest_schema.json",
|
||||
"credits": [
|
||||
"xen#Mod Director\n#Programmer",
|
||||
"Bwc9876#Mod Manager\n#Programmer\n#Dev Ops",
|
||||
|
||||
@ -101,11 +101,6 @@ namespace NewHorizons.Builder.Props
|
||||
|
||||
prop.transform.localScale = detail.stretch ?? (detail.scale != 0 ? Vector3.one * detail.scale : prefab.transform.localScale);
|
||||
|
||||
if (!detail.keepLoaded) GroupsBuilder.Make(prop, sector);
|
||||
prop.SetActive(true);
|
||||
|
||||
if (prop == null) return null;
|
||||
|
||||
if (detail.removeChildren != null)
|
||||
{
|
||||
var detailPath = prop.transform.GetPath();
|
||||
@ -161,6 +156,9 @@ namespace NewHorizons.Builder.Props
|
||||
}
|
||||
}
|
||||
|
||||
if (!detail.keepLoaded) GroupsBuilder.Make(prop, sector);
|
||||
prop.SetActive(true);
|
||||
|
||||
return prop;
|
||||
}
|
||||
|
||||
|
||||
@ -50,7 +50,11 @@ namespace NewHorizons.Builder.Props
|
||||
private static void InitPrefabs()
|
||||
{
|
||||
// Just take every scroll and get the first arc
|
||||
var existingArcs = GameObject.FindObjectsOfType<ScrollItem>().Select(x => x?._nomaiWallText?.gameObject?.transform?.Find("Arc 1")?.gameObject).Where(x => x != null).ToArray();
|
||||
var existingArcs = GameObject.FindObjectsOfType<ScrollItem>()
|
||||
.Select(x => x?._nomaiWallText?.gameObject?.transform?.Find("Arc 1")?.gameObject)
|
||||
.Where(x => x != null)
|
||||
.OrderBy(x => x.transform.GetPath()) // order by path so game updates dont break things
|
||||
.ToArray();
|
||||
_arcPrefabs = new List<GameObject>();
|
||||
_childArcPrefabs = new List<GameObject>();
|
||||
foreach (var existingArc in existingArcs)
|
||||
@ -69,7 +73,11 @@ namespace NewHorizons.Builder.Props
|
||||
}
|
||||
}
|
||||
|
||||
var existingGhostArcs = GameObject.FindObjectsOfType<GhostWallText>().Select(x => x?._textLine?.gameObject).Where(x => x != null).ToArray();
|
||||
var existingGhostArcs = GameObject.FindObjectsOfType<GhostWallText>()
|
||||
.Select(x => x?._textLine?.gameObject)
|
||||
.Where(x => x != null)
|
||||
.OrderBy(x => x.transform.GetPath()) // order by path so game updates dont break things
|
||||
.ToArray();
|
||||
_ghostArcPrefabs = new List<GameObject>();
|
||||
foreach (var existingArc in existingGhostArcs)
|
||||
{
|
||||
|
||||
@ -21,8 +21,8 @@ namespace NewHorizons.Builder.Props
|
||||
|
||||
public static int NumberOfFrequencies;
|
||||
|
||||
public static List<SignalName> QMSignals { get; private set; }
|
||||
public static List<SignalName> CloakedSignals { get; private set; }
|
||||
private static List<SignalName> _qmSignals;
|
||||
private static List<SignalName> _cloakedSignals;
|
||||
|
||||
public static bool Initialized;
|
||||
|
||||
@ -37,12 +37,22 @@ namespace NewHorizons.Builder.Props
|
||||
};
|
||||
NumberOfFrequencies = EnumUtils.GetValues<SignalFrequency>().Length;
|
||||
|
||||
QMSignals = new List<SignalName>() { SignalName.Quantum_QM };
|
||||
CloakedSignals = new List<SignalName>();
|
||||
_qmSignals = new List<SignalName>() { SignalName.Quantum_QM };
|
||||
_cloakedSignals = new List<SignalName>();
|
||||
|
||||
Initialized = true;
|
||||
}
|
||||
|
||||
public static bool IsCloaked(this SignalName signalName)
|
||||
{
|
||||
return _cloakedSignals.Contains(signalName);
|
||||
}
|
||||
|
||||
public static bool IsOnQuantumMoon(this SignalName signalName)
|
||||
{
|
||||
return _qmSignals.Contains(signalName);
|
||||
}
|
||||
|
||||
public static SignalFrequency AddFrequency(string str)
|
||||
{
|
||||
var freq = CollectionUtilities.KeyByValue(_customFrequencyNames, str);
|
||||
@ -177,8 +187,8 @@ namespace NewHorizons.Builder.Props
|
||||
signalGO.SetActive(true);
|
||||
|
||||
// Track certain special signal things
|
||||
if (planetGO.GetComponent<AstroObject>()?.GetAstroObjectName() == AstroObject.Name.QuantumMoon) QMSignals.Add(name);
|
||||
if (info.insideCloak) CloakedSignals.Add(name);
|
||||
if (planetGO.GetComponent<AstroObject>()?.GetAstroObjectName() == AstroObject.Name.QuantumMoon) _qmSignals.Add(name);
|
||||
if (info.insideCloak) _cloakedSignals.Add(name);
|
||||
|
||||
return signalGO;
|
||||
}
|
||||
|
||||
@ -204,7 +204,7 @@ namespace NewHorizons.Builder.ShipLog
|
||||
|
||||
private static Sprite GetEntrySprite(string entryId, NewHorizonsBody body, bool logError)
|
||||
{
|
||||
string relativePath = body.Config.ShipLog.spriteFolder + "/" + entryId + ".png";
|
||||
string relativePath = Path.Combine(body.Config.ShipLog.spriteFolder, entryId + ".png");
|
||||
try
|
||||
{
|
||||
Texture2D newTexture = ImageUtilities.GetTexture(body.Mod, relativePath);
|
||||
|
||||
5
NewHorizons/External/Configs/PlanetConfig.cs
vendored
5
NewHorizons/External/Configs/PlanetConfig.cs
vendored
@ -47,11 +47,6 @@ namespace NewHorizons.External.Configs
|
||||
/// </summary>
|
||||
public BrambleModule Bramble;
|
||||
|
||||
/// <summary>
|
||||
/// Set to a higher number if you wish for this body to be built sooner
|
||||
/// </summary>
|
||||
[DefaultValue(-1)] public int buildPriority = -1;
|
||||
|
||||
/// <summary>
|
||||
/// Should this planet ever be shown on the title screen?
|
||||
/// </summary>
|
||||
|
||||
@ -573,11 +573,11 @@ namespace NewHorizons
|
||||
}
|
||||
}
|
||||
// Has to go before translations for achievements
|
||||
if (File.Exists(folder + "addon-manifest.json"))
|
||||
if (File.Exists(Path.Combine(folder, "addon-manifest.json")))
|
||||
{
|
||||
LoadAddonManifest("addon-manifest.json", mod);
|
||||
}
|
||||
if (Directory.Exists(folder + @"translations\"))
|
||||
if (Directory.Exists(Path.Combine(folder, "translations")))
|
||||
{
|
||||
LoadTranslations(folder, mod);
|
||||
}
|
||||
@ -595,9 +595,19 @@ namespace NewHorizons
|
||||
|
||||
var addonConfig = mod.ModHelper.Storage.Load<AddonConfig>(file);
|
||||
|
||||
if (addonConfig.achievements != null) AchievementHandler.RegisterAddon(addonConfig, mod as ModBehaviour);
|
||||
if (addonConfig.credits != null) CreditsHandler.RegisterCredits(mod.ModHelper.Manifest.Name, addonConfig.credits);
|
||||
if (!string.IsNullOrEmpty(addonConfig.popupMessage)) MenuHandler.RegisterOneTimePopup(mod, addonConfig.popupMessage);
|
||||
if (addonConfig.achievements != null)
|
||||
{
|
||||
AchievementHandler.RegisterAddon(addonConfig, mod as ModBehaviour);
|
||||
}
|
||||
if (addonConfig.credits != null)
|
||||
{
|
||||
var translatedCredits = addonConfig.credits.Select(x => TranslationHandler.GetTranslation(x, TranslationHandler.TextType.UI)).ToArray();
|
||||
CreditsHandler.RegisterCredits(mod.ModHelper.Manifest.Name, translatedCredits);
|
||||
}
|
||||
if (!string.IsNullOrEmpty(addonConfig.popupMessage))
|
||||
{
|
||||
MenuHandler.RegisterOneTimePopup(mod, TranslationHandler.GetTranslation(addonConfig.popupMessage, TranslationHandler.TextType.UI));
|
||||
}
|
||||
}
|
||||
|
||||
private void LoadTranslations(string folder, IModBehaviour mod)
|
||||
@ -605,15 +615,15 @@ namespace NewHorizons
|
||||
var foundFile = false;
|
||||
foreach (TextTranslation.Language language in EnumUtils.GetValues<TextTranslation.Language>())
|
||||
{
|
||||
if (language == TextTranslation.Language.UNKNOWN || language == TextTranslation.Language.TOTAL) continue;
|
||||
if (language is TextTranslation.Language.UNKNOWN or TextTranslation.Language.TOTAL) continue;
|
||||
|
||||
var relativeFile = $"translations/{language.ToString().ToLower()}.json";
|
||||
var relativeFile = Path.Combine("translations", language.ToString().ToLower() + ".json");
|
||||
|
||||
if (File.Exists($"{folder}{relativeFile}"))
|
||||
if (File.Exists(Path.Combine(folder, relativeFile)))
|
||||
{
|
||||
Logger.LogVerbose($"Registering {language} translation from {mod.ModHelper.Manifest.Name} from {relativeFile}");
|
||||
|
||||
var config = new TranslationConfig($"{folder}{relativeFile}");
|
||||
var config = new TranslationConfig(Path.Combine(folder, relativeFile));
|
||||
|
||||
foundFile = true;
|
||||
|
||||
|
||||
@ -15,8 +15,7 @@
|
||||
<DebugType>none</DebugType>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="HarmonyX" Version="2.10.0" />
|
||||
<PackageReference Include="OWML" Version="2.7.0" />
|
||||
<PackageReference Include="OWML" Version="2.7.2" />
|
||||
<PackageReference Include="OuterWildsGameLibs" Version="1.1.13.393" />
|
||||
<Reference Include="../Lib/System.ComponentModel.Annotations.dll" />
|
||||
</ItemGroup>
|
||||
|
||||
@ -119,7 +119,10 @@ namespace NewHorizons.Patches
|
||||
{
|
||||
if (!SignalBuilder.Initialized) return true;
|
||||
|
||||
if (!SignalBuilder.CloakedSignals.Contains(__instance._name) && !SignalBuilder.QMSignals.Contains(__instance._name)) return true;
|
||||
var isCloaked = SignalBuilder.IsCloaked(__instance._name);
|
||||
var isOnQuantumMoon = SignalBuilder.IsOnQuantumMoon(__instance._name);
|
||||
|
||||
if (!isCloaked && !isOnQuantumMoon) return true;
|
||||
|
||||
__instance._canBePickedUpByScope = false;
|
||||
if (__instance._sunController != null && __instance._sunController.IsPointInsideSupernova(__instance.transform.position))
|
||||
@ -130,7 +133,7 @@ namespace NewHorizons.Patches
|
||||
}
|
||||
|
||||
// This part is modified from the original to include all QM signals
|
||||
if (Locator.GetQuantumMoon() != null && Locator.GetQuantumMoon().IsPlayerInside() && !SignalBuilder.QMSignals.Contains(__instance._name))
|
||||
if (Locator.GetQuantumMoon() != null && Locator.GetQuantumMoon().IsPlayerInside() && !isOnQuantumMoon)
|
||||
{
|
||||
__instance._signalStrength = 0f;
|
||||
__instance._degreesFromScope = 180f;
|
||||
@ -167,7 +170,7 @@ namespace NewHorizons.Patches
|
||||
}
|
||||
|
||||
// If it's a cloaked signal we don't want to hear it outside the cloak field
|
||||
if (SignalBuilder.CloakedSignals.Contains(__instance._name))
|
||||
if (isCloaked)
|
||||
{
|
||||
if (!PlayerState.InCloakingField())
|
||||
{
|
||||
|
||||
@ -19,24 +19,31 @@ namespace NewHorizons.Utility.DebugUtilities
|
||||
|
||||
private ScreenPrompt _raycastPrompt;
|
||||
|
||||
private void Awake()
|
||||
private void Start()
|
||||
{
|
||||
_rb = this.GetRequiredComponent<OWRigidbody>();
|
||||
|
||||
if (_raycastPrompt == null)
|
||||
{
|
||||
_raycastPrompt = new ScreenPrompt(TranslationHandler.GetTranslation("DEBUG_RAYCAST", TranslationHandler.TextType.UI) + " <CMD>", ImageUtilities.GetButtonSprite(KeyCode.P));
|
||||
|
||||
Locator.GetPromptManager().AddScreenPrompt(_raycastPrompt, PromptPosition.UpperRight, false);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnDestroy()
|
||||
{
|
||||
if (_raycastPrompt != null)
|
||||
{
|
||||
Locator.GetPromptManager()?.RemoveScreenPrompt(_raycastPrompt, PromptPosition.UpperRight);
|
||||
}
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
UpdatePromptVisibility();
|
||||
|
||||
if (!Main.Debug) return;
|
||||
|
||||
if (Keyboard.current == null) return;
|
||||
|
||||
if (Keyboard.current[Key.P].wasReleasedThisFrame)
|
||||
@ -47,9 +54,12 @@ namespace NewHorizons.Utility.DebugUtilities
|
||||
|
||||
|
||||
public void UpdatePromptVisibility()
|
||||
{
|
||||
if (_raycastPrompt != null)
|
||||
{
|
||||
_raycastPrompt.SetVisibility(!OWTime.IsPaused() && Main.Debug);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
internal void PrintRaycast()
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
using NewHorizons.External.Configs;
|
||||
using NewHorizons.External.Configs;
|
||||
using OWML.Common;
|
||||
using System.Linq;
|
||||
using UnityEngine;
|
||||
namespace NewHorizons.Utility
|
||||
{
|
||||
@ -10,6 +11,8 @@ namespace NewHorizons.Utility
|
||||
Config = config;
|
||||
Mod = mod;
|
||||
RelativePath = relativePath;
|
||||
|
||||
Migrate();
|
||||
}
|
||||
|
||||
public PlanetConfig Config;
|
||||
@ -17,5 +20,31 @@ namespace NewHorizons.Utility
|
||||
public string RelativePath;
|
||||
|
||||
public GameObject Object;
|
||||
|
||||
#region Migration
|
||||
private static readonly string[] _keepLoadedModsList = new string[]
|
||||
{
|
||||
"CreativeNameTxt.theirhomeworld",
|
||||
"Roggsy.enterthewarioverse",
|
||||
"Jammer.jammerlore",
|
||||
"ErroneousCreationist.solarneighbourhood",
|
||||
"ErroneousCreationist.incursionfinaldawn"
|
||||
};
|
||||
|
||||
private void Migrate()
|
||||
{
|
||||
// Some old mods get really broken by this change in 1.6.1
|
||||
if (_keepLoadedModsList.Contains(Mod.ModHelper.Manifest.UniqueName))
|
||||
{
|
||||
if (Config?.Props?.details != null)
|
||||
{
|
||||
foreach (var detail in Config.Props.details)
|
||||
{
|
||||
detail.keepLoaded = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
@ -119,7 +119,7 @@ namespace NewHorizons.Utility
|
||||
|
||||
var name = names.Last();
|
||||
if (warn) Logger.LogWarning($"Couldn't find object in path {path}, will look for potential matches for name {name}");
|
||||
// 3: find resource to include inactive objects (but skip prefabs
|
||||
// 3: find resource to include inactive objects (but skip prefabs)
|
||||
go = Resources.FindObjectsOfTypeAll<GameObject>()
|
||||
.FirstOrDefault(x => x.name == name && x.scene.name != null);
|
||||
if (go)
|
||||
|
||||
@ -4,8 +4,8 @@
|
||||
"author": "xen, Bwc9876, clay, MegaPiggy, John, Hawkbar, Trifid, Book",
|
||||
"name": "New Horizons",
|
||||
"uniqueName": "xen.NewHorizons",
|
||||
"version": "1.6.1",
|
||||
"owmlVersion": "2.6.0",
|
||||
"version": "1.6.2",
|
||||
"owmlVersion": "2.7.2",
|
||||
"dependencies": [ "JohnCorby.VanillaFix", "_nebula.MenuFramework", "xen.CommonCameraUtility" ],
|
||||
"conflicts": [ "Raicuparta.QuantumSpaceBuddies", "PacificEngine.OW_Randomizer" ],
|
||||
"pathsToPreserve": [ "planets", "systems", "translations" ]
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user