public override void DoEditInterface(Listing_ScenEdit listing)
        {
            var scenPartRect = listing.GetScenPartRect(this, RowHeight * 4);

            // Faction selection
            var selectionRect = new Rect(scenPartRect.x, scenPartRect.y, scenPartRect.width, scenPartRect.height / 4);

            if (Widgets.ButtonText(selectionRect, LabelText))
            {
                var floatMenuOptions = new List <FloatMenuOption>();
                floatMenuOptions.Add(new FloatMenuOption("VanillaFactionsExpanded.AllFactions".Translate(), () => factionDef = null));
                var eligibleFactions = EligibleFactionDefs.ToList();
                for (int i = 0; i < eligibleFactions.Count; i++)
                {
                    var faction = eligibleFactions[i];
                    floatMenuOptions.Add(new FloatMenuOption(faction.LabelCap, () => factionDef = faction));
                }
                Find.WindowStack.Add(new FloatMenu(floatMenuOptions));
            }

            // Faction options
            var optionsRect = new Rect(scenPartRect.x, scenPartRect.y + (scenPartRect.height / 4), scenPartRect.width, scenPartRect.height / 4);

            Widgets.CheckboxLabeled(optionsRect.LeftPart(OptionRectPartWidth), "VanillaFactionsExpanded.AlwaysHostile".Translate(), ref alwaysHostile);
            Widgets.CheckboxLabeled(optionsRect.RightPart(OptionRectPartWidth), "VanillaFactionsExpanded.AffectHiddenFactions".Translate(), ref affectHiddenFactions);

            // No point showing these if the faction is set to always be hostile
            if (!alwaysHostile)
            {
                // Starting goodwill range
                var startingRangeRect     = new Rect(scenPartRect.x, scenPartRect.y + (scenPartRect.height * 2 / 4), scenPartRect.width, scenPartRect.height / 4);
                var startingRangeLeftPart = startingRangeRect.LeftPart(1 - GoodwillRangeSliderWidth);
                Widgets.CheckboxLabeled(startingRangeLeftPart, "VanillaFactionsExpanded.StartingGoodwill".Translate().Truncate(startingRangeLeftPart.width), ref affectStartingGoodwill);
                if (affectStartingGoodwill)
                {
                    Widgets.IntRange(startingRangeRect.RightPart(GoodwillRangeSliderWidth), 76823, ref startingGoodwillRange, DiplomacyTuning.MinGoodwill, DiplomacyTuning.MaxGoodwill);
                }

                // Natural goodwill range
                var naturalRangeRect     = new Rect(scenPartRect.x, scenPartRect.y + (scenPartRect.height * 3 / 4), scenPartRect.width, scenPartRect.height / 4);
                var naturalRangeLeftPart = naturalRangeRect.LeftPart(1 - GoodwillRangeSliderWidth);
                Widgets.CheckboxLabeled(naturalRangeLeftPart, "VanillaFactionsExpanded.NaturalGoodwill".Translate().Truncate(naturalRangeLeftPart.width), ref affectNaturalGoodwill);
                if (affectNaturalGoodwill)
                {
                    Widgets.IntRange(naturalRangeRect.RightPart(GoodwillRangeSliderWidth), -238948923, ref naturalGoodwillRange, DiplomacyTuning.MinGoodwill, DiplomacyTuning.MaxGoodwill);
                }
            }
        }
        public override void Randomize()
        {
            affectHiddenFactions = Rand.Bool;
            alwaysHostile        = Rand.Bool;
            factionDef           = Rand.Bool ? null : EligibleFactionDefs.RandomElement();

            // Starting goodwill
            affectStartingGoodwill = Rand.Bool;
            int minStartingGoodwill = Rand.RangeInclusive(DiplomacyTuning.MinGoodwill, DiplomacyTuning.MaxGoodwill);
            int maxStartingGoodwill = Rand.RangeInclusive(minStartingGoodwill, DiplomacyTuning.MaxGoodwill);

            startingGoodwillRange = new IntRange(minStartingGoodwill, maxStartingGoodwill);

            // Natural goodwill
            affectNaturalGoodwill = Rand.Bool;
            int minNaturalGoodwill = Rand.RangeInclusive(DiplomacyTuning.MinGoodwill, DiplomacyTuning.MaxGoodwill);
            int maxNaturalGoodwill = Rand.RangeInclusive(minNaturalGoodwill, DiplomacyTuning.MaxGoodwill);

            naturalGoodwillRange = new IntRange(minNaturalGoodwill, maxNaturalGoodwill);
        }