Skip to content

Commit f209b11

Browse files
committed
Prevent duplicate monolith generation in multifaction
Due to changes in rwmt#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 2b5b4ef commit f209b11

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
@@ -673,6 +673,22 @@ private static int MakeIdPositive(int id)
673673
}
674674
}
675675

676+
#region Map generation
677+
678+
[HarmonyPatch(typeof(GenStep_Monolith), nameof(GenStep_Monolith.GenerateMonolith))]
679+
public static class GenStepMonolithPatch
680+
{
681+
static bool Prefix()
682+
{
683+
if (Multiplayer.Client == null)
684+
return true;
685+
686+
var anomalyComp = Current.Game.components.OfType<GameComponent_Anomaly>().FirstOrDefault();
687+
688+
return anomalyComp?.monolith == null;
689+
}
690+
}
691+
676692
[HarmonyPatch(typeof(ScenPart_ScatterThings), nameof(ScenPart_ScatterThings.GenerateIntoMap))]
677693
static class ScenPartScatterThingsPatch
678694
{
@@ -691,6 +707,8 @@ static bool Prefix()
691707
}
692708
}
693709

710+
#endregion
711+
694712
[HarmonyPatch(typeof(CharacterCardUtility), nameof(CharacterCardUtility.DoTopStack))]
695713
static class CharacterCardUtilityDontDrawIdeoPlate
696714
{

0 commit comments

Comments
 (0)