private static void DreamBlock_Added(On.Celeste.DreamBlock.orig_Added orig, DreamBlock self, Scene scene) { if (MadelinePartyModule.IsSIDMadelineParty((scene as Level).Session.Area.GetSID()) && (scene as Level).Session.LevelData.Entities.Any((data) => data.Name.Equals("madelineparty/dreamBlockRNGSyncer"))) { DynData <Scene> sceneData = new DynData <Scene>(); var seed = sceneData.Get <int?>("madelinePartyRandomSeed"); if (seed == null) { seed = Calc.Random.Next(); sceneData["madelinePartyRandomSeed"] = seed; } DynData <DreamBlock> selfData = new DynData <DreamBlock>(self); selfData["madelinePartyRandom"] = new Random(seed.Value); Random oldRand = Calc.Random; Calc.Random = selfData.Get <Random>("madelinePartyRandom"); orig(self, scene); Calc.Random = oldRand; } else { orig(self, scene); } }
private static void DreamBlock_Update(On.Celeste.DreamBlock.orig_Update orig, DreamBlock self) { Scene scene = self.Scene; if (MadelinePartyModule.IsSIDMadelineParty((scene as Level).Session.Area.GetSID()) && scene.Entities.FindFirst <DreamBlockRNGSyncer>() != null) { DynData <DreamBlock> selfData = new DynData <DreamBlock>(self); Random oldRand = Calc.Random; Calc.Random = selfData.Get <Random>("madelinePartyRandom"); orig(self); Calc.Random = oldRand; } else { orig(self); } }
private static void TouchSwitch_TurnOn(On.Celeste.TouchSwitch.orig_TurnOn orig, TouchSwitch self) { if (MadelinePartyModule.IsSIDMadelineParty(self.SceneAs <Level>().Session.Area.SID)) { MinigameSwitchGatherer gatherer; if ((gatherer = self.Scene.Tracker.GetEntity <MinigameSwitchGatherer>()) != null) { if (switchesOn.Contains(self.Position)) { gatherer.CollectSwitch(self.Position); } else { throw new Exception("Hit switch that shouldn't be on"); } return; } } orig(self); }
public MadelinePartyModule() { Instance = this; }