Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions Source/1.5/HarmonyPatches.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4006,11 +4006,16 @@ public static class NoRoyaltyEndingForSpaceMap
{
public static bool Prefix(IncidentWorker_GiveQuest __instance, IncidentParms parms, ref bool __result)
{
QuestScriptDef quest = __instance.def.questScriptDef ?? parms.questScriptDef;
// Just nulletproof null checks, in case in modded situation things are set up strangely at this point
QuestScriptDef quest = __instance?.def?.questScriptDef ?? parms?.questScriptDef;
if (quest == null)
{
return true;
}
Map spaceHome = ShipInteriorMod2.FindPlayerShipMap();
if (quest.defName == "EndGame_RoyalAscent")
{
IEnumerable<Map> surfacePlayerMaps = Find.Maps.Where((Map x) => (x.IsPlayerHome && x != spaceHome));
IEnumerable<Map> surfacePlayerMaps = Find.Maps.Where((Map x) => (x != null && x.IsPlayerHome && x != spaceHome));
if (!surfacePlayerMaps.Any())
{
__result = false;
Expand Down