Ejemplo n.º 1
0
        /// <summary>
        /// Gets the errors for Template fitness
        /// </summary>
        /// <returns>a bunch of text saying how awful your Template is</returns>
        public override IList <string> FitnessReport()
        {
            IList <string> TemplateProblems = base.FitnessReport();

            //Gotta keep most of these in due to the tuple thing
            if (Arms == null || Arms.Item == null || Arms.Amount < 0)
            {
                TemplateProblems.Add("Arms are invalid.");
            }

            if (Legs == null || Legs.Item == null || Legs.Amount < 0)
            {
                TemplateProblems.Add("Legs are invalid.");
            }

            if (BodyParts != null && BodyParts.Any(a => a.Part == null || a.Part.Amount == 0 || string.IsNullOrWhiteSpace(a.Name)))
            {
                TemplateProblems.Add("BodyParts are invalid.");
            }

            if (VisionRange == null || VisionRange.Low >= VisionRange.High)
            {
                TemplateProblems.Add("Vision range is invalid.");
            }

            if (TemperatureTolerance == null || TemperatureTolerance.Low >= TemperatureTolerance.High)
            {
                TemplateProblems.Add("Temperature tolerance is invalid.");
            }

            return(TemplateProblems);
        }
Ejemplo n.º 2
0
 private void LocateSurgery()
 {
     Surgery = Data.Surgeries.Where(r => r.Surgery.IsIngredient(ThingDef))
               .Where(r => r.CanScheduleFor(Patient))
               .Where(r => r.Surgery.Worker.GetPartsToApplyOn(Patient, r.Surgery).Any(p => BodyParts?.Any(b => b.def.defName.Equals(p.def.defName)) ?? true))
               .Select(s => s.Surgery)
               .FirstOrFallback();
 }