コード例 #1
0
        static void Postfix(HospitalEventTraineeCompletedCourse.Config __instance, Staff staff, QualificationDefinition qualification, Staff teacher)
        {
            if (!Main.enabled || !Main.settings.AssignJobsOnTrainingComplete)
            {
                return;
            }

            try
            {
                if (staff.Definition._type != StaffDefinition.Type.Doctor && staff.Definition._type != StaffDefinition.Type.Nurse)
                {
                    return;
                }

                var recommended = staff.GetRecommendedJobRooms();
                var jobs        = RoomAlgorithms.GetAllJobs(staff.Level.Metagame, staff.Level.WorldState, staff.Definition._type);
                for (int i = jobs.Count - 1; i >= 0; i--)
                {
                    if (jobs[i] is JobRoomDescription job && recommended.Exists(x => x == job.Room._type))
                    {
                        jobs.RemoveAt(i);
                    }
                }

                staff.JobExclusions.Clear();
                staff.JobExclusions.AddRange(jobs);
            }
            catch (Exception e)
            {
                Main.Logger.Error(e.ToString());
            }
        }
コード例 #2
0
        static void Postfix(HospitalEventStaffHired.Config __instance, Staff staff, JobApplicant applicant)
        {
            if (!Main.enabled || !Main.settings.UnassignJobsOnHire)
            {
                return;
            }

            if (staff.Definition._type != StaffDefinition.Type.Doctor && staff.Definition._type != StaffDefinition.Type.Nurse)
            {
                return;
            }

            var jobs = RoomAlgorithms.GetAllJobs(staff.Level.Metagame, staff.Level.WorldState, staff.Definition._type);

            staff.JobExclusions.Clear();
            staff.JobExclusions.AddRange(jobs);
        }