private bool checkTransitionAndWallUpOtherTransitions(Vector2 position) { Level level = SceneAs <Level>(); if (ExtendedVariantsModule.Settings.AllowLeavingTheoBehind) { // don't wall up other transitions. return(level.Session.MapData.CanTransitionTo(level, position)); } if (level.Session.MapData.CanTransitionTo(level, position)) { Rectangle currentBounds = level.Session.LevelData.Bounds; LevelData target = level.Session.MapData.GetTransitionTarget(level, position); // left side int start = int.MinValue; for (int i = currentBounds.Top; i <= currentBounds.Bottom + 1; i++) { if (i != currentBounds.Bottom + 1 && !target.Check(new Vector2(currentBounds.Left - 8, i))) { if (start == int.MinValue) { start = i; } } else if (start != int.MinValue) { level.Add(new InvisibleBarrier(new Vector2(currentBounds.Left - 8, start), 9f, i - 1 - start)); start = int.MinValue; } } // right side start = int.MinValue; for (int i = currentBounds.Top; i <= currentBounds.Bottom + 1; i++) { if (i != currentBounds.Bottom + 1 && !target.Check(new Vector2(currentBounds.Right + 8, i))) { if (start == int.MinValue) { start = i; } } else if (start != int.MinValue) { level.Add(new InvisibleBarrier(new Vector2(currentBounds.Right - 1f, start), 9f, i - 1 - start)); start = int.MinValue; } } // up side start = int.MinValue; for (int i = currentBounds.Left; i <= currentBounds.Right + 1; i++) { if (i != currentBounds.Right + 1 && !target.Check(new Vector2(i, currentBounds.Top - 8))) { if (start == int.MinValue) { start = i; } } else if (start != int.MinValue) { level.Add(new InvisibleBarrier(new Vector2(start, currentBounds.Top - 8), i - 1 - start, 9f)); start = int.MinValue; } } // down side start = int.MinValue; for (int i = currentBounds.Left; i <= currentBounds.Right + 1; i++) { if (i != currentBounds.Right + 1 && !target.Check(new Vector2(i, currentBounds.Bottom + 8))) { if (start == int.MinValue) { start = i; } } else if (start != int.MinValue) { level.Add(new BottomDeathTrigger(new Vector2(start, currentBounds.Bottom - 1), i - 1 - start, 9)); start = int.MinValue; } } return(true); } return(false); }