public static void Postfix(Building_Bed __instance)
            {
                if (!__instance.ForPrisoners)
                {
                    return;
                }

                if (__instance is Building_GuestBed)
                {
                    Building_GuestBed.Swap(__instance);
                }
            }
Example #2
0
 private static IEnumerable <Gizmo> Process(Building_Bed __instance, IEnumerable <Gizmo> __result)
 {
     foreach (var gizmo in __result)
     {
         yield return(gizmo);
     }
     if (!__instance.ForPrisoners && !__instance.Medical && __instance.def.building.bed_humanlike)
     {
         yield return
             (new Command_Toggle
         {
             defaultLabel = "CommandBedSetAsGuestLabel".Translate(),
             defaultDesc = "CommandBedSetAsGuestDesc".Translate(),
             icon = ContentFinder <Texture2D> .Get("UI/Commands/AsGuest"),
             isActive = () => false,
             toggleAction = () => Building_GuestBed.Swap(__instance),
             hotKey = KeyBindingDefOf.Misc4
         });
     }
 }
            private static IEnumerable <Gizmo> Process(Building_Bed __instance, IEnumerable <Gizmo> __result)
            {
                var isPrisonCell = __instance.GetRoom()?.isPrisonCell == true;

                if (!__instance.ForPrisoners && !__instance.Medical && __instance.def.building.bed_humanlike && !isPrisonCell)
                {
                    yield return
                        (new Command_Toggle
                    {
                        defaultLabel = "CommandBedSetAsGuestLabel".Translate(),
                        defaultDesc = "CommandBedSetAsGuestDesc".Translate(),
                        icon = ContentFinder <Texture2D> .Get("UI/Commands/AsGuest"),
                        isActive = __instance.IsGuestBed,
                        toggleAction = () => Building_GuestBed.Swap(__instance),
                        hotKey = KeyBindingDefOf.Misc4,
                        disabled = __instance.GetComp <CompAssignableToPawn_Bed>() == null,
                        disabledReason = "This bed type is not assignable to pawns."
                    });
                }
                foreach (var gizmo in __result)
                {
                    yield return(gizmo);
                }
            }