public override void InitializeStates(out BaseState default_state) { base.serializable = false; default_state = unoperational; unoperational.EventTransition(GameHashes.OperationalChanged, operational, (Instance smi) => smi.GetComponent <Operational>().IsOperational).Enter(delegate(Instance smi) { Assignable component4 = smi.master.GetComponent <Assignable>(); component4.Unassign(); }); operational.DefaultState(operational.idle).EventTransition(GameHashes.OperationalChanged, unoperational, (Instance smi) => !smi.master.GetComponent <Operational>().IsOperational).EventTransition(GameHashes.AssigneeChanged, unoperational, null) .ToggleRecurringChore((Instance smi) => smi.master.CreateWorkChore(Db.Get().ChoreTypes.Heal, false, true, PriorityScreen.PriorityClass.personalNeeds, false), (Instance smi) => !string.IsNullOrEmpty(smi.master.healthEffect)) .ToggleRecurringChore((Instance smi) => smi.master.CreateWorkChore(Db.Get().ChoreTypes.HealCritical, false, true, PriorityScreen.PriorityClass.personalNeeds, false), (Instance smi) => !string.IsNullOrEmpty(smi.master.healthEffect)) .ToggleRecurringChore((Instance smi) => smi.master.CreateWorkChore(Db.Get().ChoreTypes.RestDueToDisease, false, true, PriorityScreen.PriorityClass.personalNeeds, true), (Instance smi) => !string.IsNullOrEmpty(smi.master.diseaseEffect)) .ToggleRecurringChore((Instance smi) => smi.master.CreateWorkChore(Db.Get().ChoreTypes.SleepDueToDisease, false, true, PriorityScreen.PriorityClass.personalNeeds, true), (Instance smi) => !string.IsNullOrEmpty(smi.master.diseaseEffect)); operational.idle.WorkableStartTransition((Instance smi) => smi.master, operational.healing); operational.healing.DefaultState(operational.healing.undoctored).WorkableStopTransition((Instance smi) => smi.GetComponent <Clinic>(), operational.idle).Enter(delegate(Instance smi) { smi.master.GetComponent <Operational>().SetActive(true, false); }) .Exit(delegate(Instance smi) { smi.master.GetComponent <Operational>().SetActive(false, false); }); operational.healing.undoctored.Enter(delegate(Instance smi) { smi.StartEffect(smi.master.healthEffect, false); smi.StartEffect(smi.master.diseaseEffect, false); bool flag = false; Worker worker2 = smi.master.worker; if ((UnityEngine.Object)worker2 != (UnityEngine.Object)null) { flag = (smi.HasEffect(smi.master.doctoredHealthEffect) || smi.HasEffect(smi.master.doctoredDiseaseEffect) || smi.HasEffect(smi.master.doctoredPlaceholderEffect)); } if (smi.master.AllowDoctoring()) { if (flag) { smi.GoTo(operational.healing.doctored); } else { smi.StartDoctorChore(); } } }).Exit(delegate(Instance smi) { smi.StopEffect(smi.master.healthEffect); smi.StopEffect(smi.master.diseaseEffect); smi.StopDoctorChore(); }); operational.healing.newlyDoctored.Enter(delegate(Instance smi) { smi.StartEffect(smi.master.doctoredDiseaseEffect, true); smi.StartEffect(smi.master.doctoredHealthEffect, true); smi.GoTo(operational.healing.doctored); }); operational.healing.doctored.Enter(delegate(Instance smi) { Effects component3 = smi.master.worker.GetComponent <Effects>(); if (smi.HasEffect(smi.master.doctoredPlaceholderEffect)) { EffectInstance effectInstance4 = component3.Get(smi.master.doctoredPlaceholderEffect); EffectInstance effectInstance5 = smi.StartEffect(smi.master.doctoredDiseaseEffect, true); if (effectInstance5 != null) { float num2 = effectInstance4.effect.duration - effectInstance4.timeRemaining; effectInstance5.timeRemaining = effectInstance5.effect.duration - num2; } EffectInstance effectInstance6 = smi.StartEffect(smi.master.doctoredHealthEffect, true); if (effectInstance6 != null) { float num3 = effectInstance4.effect.duration - effectInstance4.timeRemaining; effectInstance6.timeRemaining = effectInstance6.effect.duration - num3; } component3.Remove(smi.master.doctoredPlaceholderEffect); } }).ScheduleGoTo(delegate(Instance smi) { Worker worker = smi.master.worker; Effects component2 = worker.GetComponent <Effects>(); float num = smi.master.doctorVisitInterval; if (smi.HasEffect(smi.master.doctoredHealthEffect)) { EffectInstance effectInstance3 = component2.Get(smi.master.doctoredHealthEffect); num = Mathf.Min(num, effectInstance3.GetTimeRemaining()); } if (smi.HasEffect(smi.master.doctoredDiseaseEffect)) { EffectInstance effectInstance3 = component2.Get(smi.master.doctoredDiseaseEffect); num = Mathf.Min(num, effectInstance3.GetTimeRemaining()); } return(num); }, operational.healing.undoctored).Exit(delegate(Instance smi) { Effects component = smi.master.worker.GetComponent <Effects>(); if (smi.HasEffect(smi.master.doctoredDiseaseEffect) || smi.HasEffect(smi.master.doctoredHealthEffect)) { EffectInstance effectInstance = component.Get(smi.master.doctoredDiseaseEffect); if (effectInstance == null) { effectInstance = component.Get(smi.master.doctoredHealthEffect); } EffectInstance effectInstance2 = smi.StartEffect(smi.master.doctoredPlaceholderEffect, true); effectInstance2.timeRemaining = effectInstance2.effect.duration - (effectInstance.effect.duration - effectInstance.timeRemaining); component.Remove(smi.master.doctoredDiseaseEffect); component.Remove(smi.master.doctoredHealthEffect); } }); }