forked from jkoritzinsky/Extensive-Engineer-Report
/
LabsHaveScientistsAboard.cs
38 lines (33 loc) · 1.3 KB
/
LabsHaveScientistsAboard.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
using PreFlightTests;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace JKorTech.Extensive_Engineer_Report
{
public class LabsHaveScientistsAboard : SectionDesignConcernBase
{
public override string GetConcernDescription()
{
return "There is a lab on this ship, but no scientists aboard. Add a scientist to the crew to increase processing.";
}
public override string GetConcernTitle()
{
return "Science Lab; No Scientists";
}
public override DesignConcernSeverity GetSeverity()
{
return DesignConcernSeverity.WARNING;
}
public override List<Part> GetAffectedParts(IEnumerable<Part> sectionParts)
{
return sectionParts.Where(part => part.HasModule<ModuleScienceConverter>() && part.HasModule<ModuleScienceLab>()).ToList();
}
public override bool TestCondition(IEnumerable<Part> sectionParts)
{
var hasLab = sectionParts.AnyHasModule<ModuleScienceConverter>() && sectionParts.AnyHasModule<ModuleScienceLab>();
var hasScientist = CrewInSection(sectionParts).Keys.Any(crew => crew.experienceTrait.TypeName == "Scientist");
return !hasLab || hasScientist;
}
}
}