Skip to content

Commit 5954270

Browse files
Tick-gitnotfood
authored andcommitted
Prevent duplicate monolith generation in multifaction (#563)
Due to changes in #508, an Exorider is now spawned on every newly generated multifaction map. However, this also caused a Monolith to be generated each time, resulting in multiple Monoliths appearing and causing issues. This update adds a Harmony patch to GenStep_Monolith.GenerateMonolith to skip Monolith generation if one already exists.
1 parent a1359fa commit 5954270

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

Source/Client/Factions/MultifactionPatches.cs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -408,6 +408,22 @@ private static int MakeIdPositive(int id)
408408
}
409409
}
410410

411+
#region Map generation
412+
413+
[HarmonyPatch(typeof(GenStep_Monolith), nameof(GenStep_Monolith.GenerateMonolith))]
414+
public static class GenStepMonolithPatch
415+
{
416+
static bool Prefix()
417+
{
418+
if (Multiplayer.Client == null)
419+
return true;
420+
421+
var anomalyComp = Current.Game.components.OfType<GameComponent_Anomaly>().FirstOrDefault();
422+
423+
return anomalyComp?.monolith == null;
424+
}
425+
}
426+
411427
[HarmonyPatch(typeof(ScenPart_ScatterThings), nameof(ScenPart_ScatterThings.GenerateIntoMap))]
412428
static class ScenPartScatterThingsPatch
413429
{
@@ -426,6 +442,8 @@ static bool Prefix()
426442
}
427443
}
428444

445+
#endregion
446+
429447
[HarmonyPatch(typeof(CharacterCardUtility), nameof(CharacterCardUtility.DoTopStack))]
430448
static class CharacterCardUtilityDontDrawIdeoPlate
431449
{

0 commit comments

Comments
 (0)