Beispiel #1
0
        public static bool CustomDrawer_MatchingWeapons_passive(Rect wholeRect, SettingHandle <WeaponListKind> setting, float weightLimit, string label, Color background)
        {
            drawBackground(wholeRect, background);
            Rect offsetRect = new Rect(wholeRect);

            offsetRect.height   = wholeRect.height - TextMargin + BottomMargin;
            offsetRect.position = new Vector2(offsetRect.position.x, offsetRect.position.y);

            DrawLabel(label, offsetRect, TextMargin);

            offsetRect.position = new Vector2(offsetRect.position.x, offsetRect.position.y + TextMargin);

            IEnumerable <ThingDefStuffDefPair> validSidearms = GettersFilters.getValidSidearms();

            List <ThingDefStuffDefPair> matchingSidearms = GettersFilters.filterForWeaponKind(validSidearms, MiscUtils.LimitTypeToListType(setting.Value)).ToList();

            matchingSidearms = matchingSidearms.OrderBy(t => t.thing.GetStatValueAbstract(StatDefOf.Mass, t.stuff)).ToList();

            List <ThingDefStuffDefPair> matchingSidearmsUnderLimit = new List <ThingDefStuffDefPair>();

            for (int i = 0; i < matchingSidearms.Count; i++)
            {
                float mass = matchingSidearms[i].thing.GetStatValueAbstract(StatDefOf.Mass);
                if (mass > weightLimit)
                {
                    break;
                }
                else
                {
                    matchingSidearmsUnderLimit.Add(matchingSidearms[i]);
                }
            }

            int iconsPerRow = (int)(offsetRect.width / (IconGap + IconSize));

            int biggerRows = ((matchingSidearmsUnderLimit.Count - 1) / iconsPerRow) + 1;

            setting.CustomDrawerHeight = (biggerRows * IconSize) + ((biggerRows) * IconGap) + TextMargin;

            for (int i = 0; i < matchingSidearmsUnderLimit.Count; i++)
            {
                int  collum     = (i % iconsPerRow);
                int  row        = (i / iconsPerRow);
                bool interacted = DrawIconForWeapon(matchingSidearmsUnderLimit[i], offsetRect, new Vector2(IconSize * collum + collum * IconGap, IconSize * row + row * IconGap), i);
                if (interacted)
                {
                    //nothing, since this is the passive list
                }
            }
            return(false);
        }
        public void ApplyBaseSettings()
        {
            ToolAutoSwitch         = true;
            OptimalMelee           = true;
            CQCAutoSwitch          = true;
            CQCTargetOnly          = false;
            RangedCombatAutoSwitch = true;

            RangedCombatAutoSwitchMaxWarmup = 0.75f;

            SpeedSelectionBiasMelee  = 1f;
            SpeedSelectionBiasRanged = 1.1f;

            SeparateModes   = false;
            LimitModeSingle = LimitModeSingleSidearm.None;
            LimitModeAmount = LimitModeAmountOfSidearms.None;

            LimitModeSingleMelee  = LimitModeSingleSidearm.None;
            LimitModeAmountMelee  = LimitModeAmountOfSidearms.None;
            LimitModeSingleRanged = LimitModeSingleSidearm.None;
            LimitModeAmountRanged = LimitModeAmountOfSidearms.None;
            LimitModeAmountTotal  = LimitModeAmountOfSidearms.None;

            #region LimitModeSingle
            LimitModeSingle_AbsoluteMass = 1.9f;
            LimitModeSingle_RelativeMass = 0.25f;
            LimitModeSingle_Selection    = GettersFilters.getValidWeaponsThingDefsOnly().Where(w => w.GetStatValueAbstract(StatDefOf.Mass) <= LimitModeSingle_AbsoluteMass).ToHashSet();
            #endregion
            #region LimitModeAmount
            LimitModeAmount_AbsoluteMass = 10f;
            LimitModeAmount_RelativeMass = 0.5f;
            LimitModeAmount_Slots        = 2;
            #endregion

            #region LimitModeSingleMelee
            LimitModeSingleMelee_AbsoluteMass = 1.9f;
            LimitModeSingleMelee_RelativeMass = 0.25f;
            LimitModeSingleMelee_Selection    = GettersFilters.filterForWeaponKind(GettersFilters.getValidWeaponsThingDefsOnly(), WeaponSearchType.Melee).Where(w => w.GetStatValueAbstract(StatDefOf.Mass) <= LimitModeSingleMelee_AbsoluteMass).ToHashSet();
            #endregion
            #region LimitModeAmountMelee
            LimitModeAmountMelee_AbsoluteMass = 10f;
            LimitModeAmountMelee_RelativeMass = 0.5f;
            LimitModeAmountMelee_Slots        = 2;
            #endregion

            #region LimitModeSingleRanged
            LimitModeSingleRanged_AbsoluteMass = 2.55f;
            LimitModeSingleRanged_RelativeMass = 0.25f;
            LimitModeSingleRanged_Selection    = GettersFilters.filterForWeaponKind(GettersFilters.getValidWeaponsThingDefsOnly(), WeaponSearchType.Ranged).Where(w => w.GetStatValueAbstract(StatDefOf.Mass) <= LimitModeSingleRanged_AbsoluteMass).ToHashSet();
            #endregion
            #region LimitModeAmountRanged
            LimitModeAmountRanged_AbsoluteMass = 10f;
            LimitModeAmountRanged_RelativeMass = 0.5f;
            LimitModeAmountRanged_Slots        = 2;
            #endregion

            #region LimitModeAmountTotal
            LimitModeAmountTotal_AbsoluteMass = 10f;
            LimitModeAmountTotal_RelativeMass = 0.5f;
            LimitModeAmountTotal_Slots        = 4;
            #endregion

            SidearmSpawnChance        = 0.5f;
            SidearmSpawnChanceDropoff = 0.25f;
            SidearmBudgetMultiplier   = 0.5f;
            SidearmBudgetDropoff      = 0.25f;

            ColonistDefaultWeaponMode = PrimaryWeaponMode.BySkill;
            NPCDefaultWeaponMode      = PrimaryWeaponMode.ByGenerated;

            FumbleMode           = FumbleModeOptionsEnum.InDistress;
            FumbleRecoveryChance = new SimpleCurve(defaultFumbleRecoveryChancePoints);
            ReEquipOutOfCombat   = true;
            ReEquipBest          = true;
            ReEquipInCombat      = true;

            PreserveInventoryInCaravans  = true;
            HideSidearmsInCaravanDialogs = true;
        }