private void OnSlotSubmit(string s) { if (!interactable) { return; } int slot; s = s.Trim(); if (s.Length == 1 && int.TryParse(s, out slot) && slot >= 1 && slot <= 9) { tool.ClearSlot(); tool.Slot = slot - 1; config.ToolEdited(tool); config.Save(); slotInput.Text = "Slot - " + s; SetCategoryText(); } }
public void Do(ToolGroups config) { Tool t; ToolGroup tg; int index; if (config.ModEnabled && config.TryGetTool(id, out t, out index, out tg) && t.Enabled) { if (tg.IsSlot(page, slot)) { if (MyAPIGateway.Session.CreativeMode) { t.EquipIndex = index; } t.Equip(); } else { if (MyAPIGateway.Session.CreativeMode) { t.EquipIndex = index; } t.ClearSlot(); t.Page = page; t.Slot = slot; if (t.Menu != null) { t.Menu.SlotUpdated(); } config.ToolEdited(t, true); config.Save(); } } }