Exemple #1
0
 static bool HasJobOnThingPrefix(ref bool __result, Pawn pawn, Thing t, bool forced)
 {
     if (pawn.IsPrisonerOfColony)
     {
         __result = ConstructionUtils.HasJobOnThingFixed(pawn, t, forced);
         return(false);
     }
     return(true);
 }
        private void constructionFixedUpdate()
        {
            if (cState != ConstructionState.CONSTRUCTING)
            {
                return;
            }
            if (ConstructedMass >= SegmentMass)
            {
                StopConstruction("Segment construction finished");
            }
            if (constructionRecipe == null)
            {
                StopConstruction("No construction blueprints are present");
                return;
            }
            if (Workforce <= 0)
            {
                StopConstruction("No qualified workers are present");
                return;
            }
            var dT = ConstructionUtils.GetDeltaTime(ref lastConstructionUT);

            if (dT <= 0)
            {
                return;
            }
            while (dT > 0 && ConstructedMass < SegmentMass)
            {
                var chunk       = Math.Min(dT, maxTimeStep);
                var work        = Math.Min(Workforce * chunk, constructionRecipe.RequiredWork(SegmentMass - ConstructedMass));
                var constructed = constructionRecipe.ProduceMass(part, work, out var trash);
                trashMass += trash;
                if (constructed <= 0)
                {
                    StopConstruction("Segment construction paused.\nNo enough resources.");
                    break;
                }
                ConstructedMass += constructed;
                dT -= chunk;
            }
        }
 private void updateWorkforce() =>
 Workforce = vessel != null
         ? ConstructionUtils.VesselWorkforce <ConstructionSkill>(vessel, SpecialistMinWorkforce)
         : 0;