public void SetAnim() { Sleepable sleepable = base.sm.bed.Get <Sleepable>(base.smi); if ((UnityEngine.Object)sleepable.GetComponent <Building>() == (UnityEngine.Object)null) { string s; switch (base.sm.sleeper.Get <Navigator>(base.smi).CurrentNavType) { case NavType.Ladder: s = "anim_sleep_ladder_kanim"; break; case NavType.Pole: s = "anim_sleep_pole_kanim"; break; default: s = "anim_sleep_floor_kanim"; break; } sleepable.overrideAnims = new KAnimFile[1] { Assets.GetAnim(s) }; } }
public static void Prefix(Bed __instance) { if (!Settings.Instance.PrivateBedroom.IncludeRoom) { return; } if (!RoomTypes_AllModded.IsInTheRoom(__instance, RoomTypePrivateRoomData.RoomId)) { return; } Sleepable sleepable = Traverse.Create(__instance).Field("sleepable").GetValue <Sleepable>(); if (sleepable == null) { return; } if (__instance.gameObject.name == "BedComplete") { sleepable.worker.GetComponent <Effects>().Add(RoomTypePrivateRoomData.BasicEffectId, true); } else if (__instance.gameObject.name == "LuxuryBedComplete") { sleepable.worker.GetComponent <Effects>().Add(RoomTypePrivateRoomData.LuxuryEffectId, true); } else { Debug.Log($"RoomsExpanded: invalid bed name in Private Bedroom: {__instance.gameObject.name}"); } }
protected override void OnSpawn() { base.OnSpawn(); sleepable = GetComponent <Sleepable>(); Sleepable obj = sleepable; obj.OnWorkableEventCB = (Action <WorkableEvent>)Delegate.Combine(obj.OnWorkableEventCB, new Action <WorkableEvent>(OnWorkableEvent)); }
public GameObject CreateFloorLocator() { Sleepable safeFloorLocator = SleepChore.GetSafeFloorLocator(base.master.gameObject); safeFloorLocator.effectName = "NarcolepticSleep"; safeFloorLocator.stretchOnWake = false; return(safeFloorLocator.gameObject); }
protected override void OnCleanUp() { base.OnCleanUp(); if ((UnityEngine.Object)sleepable != (UnityEngine.Object)null) { Sleepable obj = sleepable; obj.OnWorkableEventCB = (Action <WorkableEvent>)Delegate.Remove(obj.OnWorkableEventCB, new Action <WorkableEvent>(OnWorkableEvent)); } }
public GameObject CreateFloorLocator() { Sleepable safeFloorLocator = SleepChore.GetSafeFloorLocator(base.master.gameObject); safeFloorLocator.effectName = "FloorSleep"; safeFloorLocator.wakeEffects = new List <string> { "SoreBack" }; safeFloorLocator.stretchOnWake = false; return(safeFloorLocator.gameObject); }
static bool Sleepable_RequestSleepableRoom_Pre(Sleepable __instance) { #region quit if (!_twoPersonBeds || Global.Lobby.PlayersInLobbyCount <= 1) { return(true); } #endregion __instance.Capacity = 2; __instance.CharAnimOffset.SetX(BED_DISTANCE_BETWEEN_PLAYERS / 2f * (__instance.m_occupants.Count == 0 ? -1f : +1f)); return(true); }
public override void DoPostConfigureComplete(GameObject go) { go.GetComponent <KAnimControllerBase>().initialAnim = "off"; go.GetComponent <KPrefabID>().AddTag(TagManager.Create("Bed"), false); Clinic clinic = go.AddOrGet <Clinic>(); clinic.doctorVisitInterval = 300f; clinic.workerInjuredAnims = new KAnimFile[1] { Assets.GetAnim("anim_healing_bed_kanim") }; clinic.workerDiseasedAnims = new KAnimFile[1] { Assets.GetAnim("anim_interacts_med_cot_sick_kanim") }; clinic.workLayer = Grid.SceneLayer.BuildingFront; string text = "MedicalCot"; string text2 = "MedicalCotDoctored"; clinic.healthEffect = text; clinic.doctoredHealthEffect = text2; clinic.diseaseEffect = text; clinic.doctoredDiseaseEffect = text2; clinic.doctoredPlaceholderEffect = "DoctoredOffCotEffect"; RoomTracker roomTracker = go.AddOrGet <RoomTracker>(); roomTracker.requiredRoomType = Db.Get().RoomTypes.Hospital.Id; roomTracker.requirement = RoomTracker.Requirement.CustomRecommended; roomTracker.customStatusItemID = Db.Get().BuildingStatusItems.ClinicOutsideHospital.Id; Sleepable sleepable = go.AddOrGet <Sleepable>(); sleepable.overrideAnims = new KAnimFile[1] { Assets.GetAnim("anim_interacts_med_cot_sick_kanim") }; DoctorChoreWorkable doctorChoreWorkable = go.AddOrGet <DoctorChoreWorkable>(); doctorChoreWorkable.overrideAnims = new KAnimFile[1] { Assets.GetAnim("anim_interacts_med_cot_doctor_kanim") }; doctorChoreWorkable.workTime = 45f; Ownable ownable = go.AddOrGet <Ownable>(); ownable.slotID = Db.Get().AssignableSlots.Clinic.Id; }
public override void DoPostConfigureComplete(GameObject go) { go.GetComponent <KAnimControllerBase>().initialAnim = "off"; Bed bed = go.AddOrGet <Bed>(); bed.effects = new string[2] { "LuxuryBedStamina", "BedHealth" }; bed.workLayer = Grid.SceneLayer.BuildingFront; Sleepable sleepable = go.AddOrGet <Sleepable>(); sleepable.overrideAnims = new KAnimFile[1] { Assets.GetAnim("anim_sleep_bed_kanim") }; sleepable.workLayer = Grid.SceneLayer.BuildingFront; Ownable ownable = go.AddOrGet <Ownable>(); ownable.slotID = Db.Get().AssignableSlots.Bed.Id; }
static bool Sleepable_OnReceiveSleepRequestResult_Pre(Sleepable __instance, Character _character) => __instance.IsInnsBed || IsCampingAllowed(_character, __instance.transform.position);