void AddTankTypeMenu(Block block) { MMenu tankTypeMenu = block.InternalObject.AddMenu(new MMenu("tankTypeMenu", 5, Enum.GetNames(typeof(TankType)).ToList(), false)); tankTypeMenu.ValueChanged += tankTypeInt => { if (!StatMaster.levelSimulating) { if (block.Machine == PlayerMachine.GetLocal()) { MachineInspector.Instance.SetTankType((TankType)tankTypeInt); StartCoroutine(this.SetTankTypeCoroutine(block.Machine, tankTypeInt)); } } }; MachineInspector.Instance.OnTypeChangeFromGUI += x => { if (block.Machine == PlayerMachine.GetLocal()) { tankTypeMenu.SetValue(x); tankTypeMenu.ApplyValue(); block.InternalObject.OnSave(new XDataHolder()); } }; }