protected void DecrementJobPriority(WorkTypeDef work, bool toggle) { bool min = Pawns.All(p => (p.workSettings.GetPriority(work) == 0 || (p.story == null || p.story.WorkTypeIsDisabled(work)))); foreach (Pawn p in Pawns) { if (!(p.story == null || p.story.WorkTypeIsDisabled(work))) { int cur = p.workSettings.GetPriority(work); if (!toggle && cur > 0 && cur < 4) { p.workSettings.SetPriority(work, cur + 1); } if (cur == 4 || (toggle && cur == 1)) { p.workSettings.SetPriority(work, 0); if (toggle) { SoundDefOf.CheckboxTurnedOff.PlayOneShotOnCamera(); } } if (min && toggle) { p.workSettings.SetPriority(work, 3); SoundDefOf.CheckboxTurnedOn.PlayOneShotOnCamera(); } } } }
protected void IncrementJobPriority(WorkTypeDef work, bool toggle) { int start = toggle ? 3 : 4; bool max = Pawns.All(p => (p.workSettings.GetPriority(work) == 1 || (p.story == null || p.story.WorkTypeIsDisabled(work)))); foreach (Pawn t in Pawns) { if (!(t.story == null || t.story.WorkTypeIsDisabled(work))) { int cur = t.workSettings.GetPriority(work); if (cur > 1) { t.workSettings.SetPriority(work, cur - 1); } if (cur == 0) { if (toggle) { SoundDefOf.CheckboxTurnedOn.PlayOneShotOnCamera(); } t.workSettings.SetPriority(work, start); } if (toggle && max) { SoundDefOf.CheckboxTurnedOff.PlayOneShotOnCamera(); t.workSettings.SetPriority(work, 0); } } } }