#738 fix spawn override, #728 warning popup for dlc mods

This commit is contained in:
Nick 2024-02-03 14:52:23 -05:00
parent 43e58bc987
commit f56d97fcf4
4 changed files with 32 additions and 4 deletions

View File

@ -22,7 +22,8 @@
"DEBUG_PLACE_TEXT": "Place Nomai Text", "DEBUG_PLACE_TEXT": "Place Nomai Text",
"DEBUG_UNDO": "Undo", "DEBUG_UNDO": "Undo",
"DEBUG_REDO": "Redo", "DEBUG_REDO": "Redo",
"Vessel": "Vessel" "Vessel": "Vessel",
"DLC_REQUIRED": "WARNING\n\nYou have addons (like {0}) installed which require the DLC but it is not enabled.\n\nYour mods may not function as intended."
}, },
"OtherDictionary": { "OtherDictionary": {
"NOMAI_SHUTTLE_COMPUTER": "The <![CDATA[<color=orange>shuttle</color>]]> is currently resting at <![CDATA[<color=lightblue>{0}</color>]]>." "NOMAI_SHUTTLE_COMPUTER": "The <![CDATA[<color=orange>shuttle</color>]]> is currently resting at <![CDATA[<color=lightblue>{0}</color>]]>."

View File

@ -17,7 +17,8 @@
"RICH_PRESENCE_WARPING": "En route vers {0}.", "RICH_PRESENCE_WARPING": "En route vers {0}.",
"OUTDATED_VERSION_WARNING": "AVERTISSEMENT\n\nNew Horizons fonctionne seulement sur la version {0} ou plus récente. Vous êtes sur la version {1}.\n\nVeuillez mettre à jour votre jeu ou désinstaller NH.", "OUTDATED_VERSION_WARNING": "AVERTISSEMENT\n\nNew Horizons fonctionne seulement sur la version {0} ou plus récente. Vous êtes sur la version {1}.\n\nVeuillez mettre à jour votre jeu ou désinstaller NH.",
"JSON_FAILED_TO_LOAD": "Fichier(s) invalide(s): {0}", "JSON_FAILED_TO_LOAD": "Fichier(s) invalide(s): {0}",
"Vessel": "Vaisseau" "Vessel": "Vaisseau",
"DLC_REQUIRED": "AVERTISSEMENT\n\nVous avez installé des addons (par exemple, {0}) qui nécessitent le DLC mais il n'est pas activé.\n\nVos mods peuvent ne pas fonctionner."
}, },
"AchievementTranslations": { "AchievementTranslations": {
"NH_EATEN_OUTSIDE_BRAMBLE": { "NH_EATEN_OUTSIDE_BRAMBLE": {

View File

@ -26,6 +26,15 @@ namespace NewHorizons.External
public GameObject Object; public GameObject Object;
public bool RequiresDLC()
{
var detailPaths = Config.Props.details.Select(x => x.path);
return Config.Cloak != null
|| Config.Props?.rafts != null
|| Config.Props?.slideShows != null
|| detailPaths.Any(x => x.StartsWith("Ringworld") || x.StartsWith("Dreamworld"));
}
#region Cache #region Cache
public void LoadCache() public void LoadCache()
{ {

View File

@ -99,6 +99,8 @@ namespace NewHorizons
public bool PlayerSpawned { get; set; } public bool PlayerSpawned { get; set; }
public bool ForceClearCaches { get; set; } // for reloading configs public bool ForceClearCaches { get; set; } // for reloading configs
public bool FlagDLCRequired { get; set; }
public ShipWarpController ShipWarpController { get; private set; } public ShipWarpController ShipWarpController { get; private set; }
// API events // API events
@ -690,6 +692,14 @@ namespace NewHorizons
var relativeDirectory = file.Replace(folder, ""); var relativeDirectory = file.Replace(folder, "");
var body = LoadConfig(mod, relativeDirectory); var body = LoadConfig(mod, relativeDirectory);
// Only bother checking if they need the DLC if they don't have it
if (!HasDLC && !FlagDLCRequired && body.RequiresDLC())
{
FlagDLCRequired = true;
var popupText = TranslationHandler.GetTranslation("DLC_REQUIRED", TranslationHandler.TextType.UI).Replace("{0}", mod.ModHelper.Manifest.Name);
MenuHandler.RegisterOneTimePopup(this, popupText, true);
}
if (body != null) if (body != null)
{ {
// Wanna track the spawn point of each system // Wanna track the spawn point of each system
@ -921,8 +931,15 @@ namespace NewHorizons
{ {
CurrentStarSystem = _defaultSystemOverride; CurrentStarSystem = _defaultSystemOverride;
// Sometimes the override will not support spawning regularly, so always warp in if (BodyDict.TryGetValue(_defaultSystemOverride, out var bodies) && bodies.Any(x => x.Config?.Spawn?.shipSpawn != null))
IsWarpingFromShip = true; {
// #738 - Sometimes the override will not support spawning regularly, so always warp in if possible
IsWarpingFromShip = true;
}
else
{
IsWarpingFromShip = false;
}
} }
else else
{ {