public static void ToggleDoors(this Mod mod, IMenuCheckBox checkbox) { try { var room = mod?.GameInstance?.Simulation?.Zone?.CurrentRoom; if (room == null) { return; } if (room.DoorState == Room.DoorStateType.Open) { room.CloseDoors(); checkbox.Value = false; } else { room.OpenDoors(); checkbox.Value = true; } } catch (Exception ex) { mod.Logger.Error("Error ocurred while attempting to open doors: " + ex); } }
public static void MakeGod(this Mod mod, IMenuCheckBox checkbox) { try { if (mod.Player == null) { return; } mod.Player.Invulnerable = !mod.Player.Invulnerable; checkbox.Value = mod.Player.Invulnerable; } catch (Exception ex) { mod.Logger.Error("Error occurred while toggling player invulnerability: " + ex); } }
public IMenu AddCheckBox(string label, Action <bool, IMenuCheckBox> onChange, out IMenuCheckBox control, bool starting = false) { var item = new MenuCheckBox(label, starting); item.OnChange = (v) => onChange((bool)v, item); _items.Add(item); control = item; return(this); }