Esempio n. 1
0
 public static bool IsDisabledByLabor(IntVec3 pos, Pawn pawn, WorkTypeDef workType)
 {
     if (pos != null && pawn.Map.areaManager.Get <Area_Labor>() != null &&
         !WorkSettings.WorkDisabled(workType))
     {
         return(pawn.Map.areaManager.Get <Area_Labor>()[pos]);
     }
     return(false);
 }
 public static bool canWorkHere(IntVec3 pos, Pawn pawn, WorkTypeDef workType)
 {
     if (!pawn.IsPrisonerOfColony && pos != null && pawn.Map.areaManager.Get <Area_Labor>() != null &&
         !WorkSettings.WorkDisabled(workType))
     {
         return(!pawn.Map.areaManager.Get <Area_Labor>()[pos]);
     }
     return(true);
 }
Esempio n. 3
0
        private static void CalculateDifficulty()
        {
            var value = 1000;

            if (!enableMotivationMechanics)
            {
                value -= 300;
            }
            if (advancedGrowing)
            {
                value -= 50;
            }
            value -= 500;
            if (!allowAllWorktypes)
            {
                var delta = 500 + 7 * 50 + (DefDatabase <WorkTypeDef> .DefCount - 20) * 25;
                foreach (var wtd in WorkSettings.AvailableWorkTypes)
                {
                    if (!WorkSettings.WorkDisabled(wtd))
                    {
                        delta -= 50;
                    }
                }
                if (delta > 0)
                {
                    value += delta;
                }
            }

            if (value >= 1000)
            {
                difficulty = value / 10 + " (" + "PrisonLabor_DifficultyNormal".Translate() + ")";
            }
            else if (value >= 800)
            {
                difficulty = value / 10 + " (" + "PrisonLabor_DifficultyCasual".Translate() + ")";
            }
            else if (value >= 500)
            {
                difficulty = value / 10 + " (" + "PrisonLabor_DifficultyEasy".Translate() + ")";
            }
            else if (value >= 300)
            {
                difficulty = value / 10 + " (" + "PrisonLabor_DifficultyPeaceful".Translate() + ")";
            }
            else
            {
                difficulty = value / 10 + " (" + "PrisonLabor_DifficultyJoke".Translate() + ")";
            }
        }
Esempio n. 4
0
 public static bool CanWorkHere(IntVec3 pos, Pawn pawn, WorkTypeDef workType)
 {
     if (!pawn.IsPrisonerOfColony && pos != null && pawn.Map.areaManager.Get <Area_Labor>() != null &&
         !WorkSettings.WorkDisabled(workType))
     {
         bool result = true;
         try
         {
             result = !pawn.Map.areaManager.Get <Area_Labor>()[pos];
         }
         catch (IndexOutOfRangeException e)
         {
             Log.Message($"IndexOutOfRangeException for {workType.label} calling pos {pos}");
         }
         return(result);
     }
     return(true);
 }
Esempio n. 5
0
        public SelectWorkTypesDialog()
        {
            absorbInputAroundWindow = true;
            doCloseX      = true;
            doCloseButton = true;

            workTypes = new Dictionary <WorkTypeDef, bool>();

            foreach (var workType in WorkSettings.AvailableWorkTypes)
            {
                if (!WorkSettings.WorkDisabled(workType))
                {
                    workTypes.Add(workType, true);
                }
                else
                {
                    workTypes.Add(workType, false);
                }
            }
        }