Scale lesson skill gain by the teacher's subject skill.

Hiring a 78-math applicant already cost more than a 41; the class now actually learns faster when that teacher is in the room.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Leonid Pershin
2026-08-20 08:54:13 +03:00
co-authored by Cursor
parent 6dcbb3303c
commit c2579d6767
5 changed files with 207 additions and 20 deletions
+10 -3
View File
@@ -14,7 +14,7 @@ namespace HSchool.Simulation;
internal static class LessonLearningSystem
{
private static readonly QueryDescription Places =
new QueryDescription().WithAll<PersonIdentity, Presence>();
new QueryDescription().WithAll<PersonIdentity, Presence, PersonSkills>();
private static readonly QueryDescription People =
new QueryDescription().WithAll<PersonIdentity, PersonSkills, PersonTraits, PersonNeeds, PersonRoles, Presence, PersonActivity>();
@@ -43,11 +43,13 @@ internal static class LessonLearningSystem
var catalog = school.Catalog;
var world = school.World;
var places = new Dictionary<string, Presence>(StringComparer.Ordinal);
var teacherSkills = new Dictionary<string, Dictionary<string, float>>(StringComparer.Ordinal);
world.Query(
in Places,
(ref PersonIdentity identity, ref Presence presence) =>
(ref PersonIdentity identity, ref Presence presence, ref PersonSkills personSkills) =>
{
places[identity.Id] = presence;
teacherSkills[identity.Id] = personSkills.Values;
});
world.Query(
@@ -82,6 +84,10 @@ internal static class LessonLearningSystem
}
var hunger = needs.Values.GetValueOrDefault("Hunger", 1f);
IReadOnlyDictionary<string, float> taught = teacherSkills.TryGetValue(lesson.TeacherId, out var found)
? found
: new Dictionary<string, float>(StringComparer.Ordinal);
var teacherSkill = LessonLearning.AverageTeacherSkill(subject, taught, catalog);
foreach (var share in subject.Skills)
{
if (!catalog.Skills.TryGetValue(share.Skill, out var skill) || skill.Abstract)
@@ -101,7 +107,8 @@ internal static class LessonLearningSystem
rules.LessonSkillPerHour,
hours,
hunger,
TraitOffset(catalog, traits, share.Skill));
TraitOffset(catalog, traits, share.Skill),
teacherSkill);
}
});
}