Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function Workplace:OnChangeWorkshift(old, new)
- if old then
- local martianborn_resilience = self.city:IsTechResearched("MartianbornResilience")
- local dark_penalty = IsDarkHour(self.city.hour - 4) and -g_Consts.WorkDarkHoursSanityDecrease
- local overtime = self.overtime[old]
- local outside_sanity_decrease = -g_Consts.OutsideWorkplaceSanityDecrease
- local is_outside_building = self:IsKindOf("OutsideHumanBuilding")
- for _, worker in ipairs(self.workers[old]) do
- -- begin modifications
- local traits = worker.traits
- if dark_penalty then
- if traits.Nightowl then
- dark_penalty = dark_penalty / 4
- end
- worker:ChangeSanity(dark_penalty, "work in dark hours")
- end
- -- end modifications
- if overtime and worker:IsWorking() and not traits.Workaholic then
- worker:ChangeHealth(-g_Consts.WorkOvertimeHealth, "overtime")
- worker:ChangeSanity(-g_Consts.WorkOvertimeSanityDecrease, "overtime")
- end
- if is_outside_building and (not martianborn_resilience or not traits.Martianborn) then
- worker:ChangeSanity(outside_sanity_decrease, "outside workplace")
- end
- worker:InterruptVisit()
- end
- end
- RebuildInfopanel(self)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement