Phase 33: technician climate control and locker assignment.
This commit is contained in:
@@ -45,13 +45,36 @@ public static class PlaceClimate
|
||||
}
|
||||
|
||||
var offset = 8f;
|
||||
ClimatePresetDef? climate = null;
|
||||
if (school.ClimatePresetId is { } presetId
|
||||
&& catalog.ClimatePresets.TryGetValue(presetId, out var preset)
|
||||
&& !preset.Abstract)
|
||||
{
|
||||
offset = preset.IndoorOffset;
|
||||
climate = preset;
|
||||
}
|
||||
|
||||
return outdoor + offset;
|
||||
var indoor = outdoor + offset;
|
||||
if (HasTechnician(school) && climate is not null)
|
||||
{
|
||||
var min = climate.ComfortC - climate.ComfortHalfWidthC;
|
||||
var max = climate.ComfortC + climate.ComfortHalfWidthC;
|
||||
if (indoor < min)
|
||||
{
|
||||
return min;
|
||||
}
|
||||
|
||||
if (indoor > max)
|
||||
{
|
||||
return max;
|
||||
}
|
||||
}
|
||||
|
||||
return indoor;
|
||||
}
|
||||
|
||||
public static bool HasTechnician(School school) =>
|
||||
school.Roster?.People.Any(person =>
|
||||
person.IsStaff && person.Position is { } position
|
||||
&& position.Equals("Technician", StringComparison.Ordinal)) == true;
|
||||
}
|
||||
|
||||
@@ -367,6 +367,11 @@ public sealed class School : IDisposable
|
||||
foreach (var date in YearlyIntake.DatesBetween(before, after))
|
||||
{
|
||||
Roster = YearlyIntake.Apply(Catalog, Roster, PeopleSeed, CountryId, date, NativeLanguage);
|
||||
if (Map is not null)
|
||||
{
|
||||
Roster = LockerAssigner.Apply(Catalog, Map, Roster);
|
||||
}
|
||||
|
||||
changed = true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user