diff --git a/gun-bonsai/CHANGELOG.md b/gun-bonsai/CHANGELOG.md index 90ae1dd..1c2f369 100644 --- a/gun-bonsai/CHANGELOG.md +++ b/gun-bonsai/CHANGELOG.md @@ -4,6 +4,12 @@ - A `Service` is now included to make it easier to write integrations with other mods. It supports RPCs for adding XP or upgrades to players and weapons. See `MODDING.md` for details. + - You can now change the effective level of an upgrade by pressing left and + right on the status screen, to any level between 1 and its max level. (You + cannot set an upgrade to level 0; to turn it off, press enter). The tooltip + will update to show the current effects of the upgrade. The level change may + not take effect immediately for all upgrades, e.g. new elemental debuffs you + inflict will use the new level but existing ones will use the old level. - Change: - `Indestructable` integration updated to support Indestructable 0.3.x. If you use the integration, you must update both mods for it to function properly. diff --git a/gun-bonsai/LANGUAGE.en-menu b/gun-bonsai/LANGUAGE.en-menu index 28bf6c1..63965f7 100644 --- a/gun-bonsai/LANGUAGE.en-menu +++ b/gun-bonsai/LANGUAGE.en-menu @@ -25,6 +25,8 @@ TFLV_MENU_STATUS_TITLE = "Status"; TFLV_MENU_HEADER_PLAYER_STATUS = "Player Status"; TFLV_MENU_HEADER_WEAPON_STATUS = "Weapon Status"; TFLV_MENU_HEADER_WEAPON_LD_EFFECTS = "LegenDoom Effects"; +// Displayed at the bottom of the status menu. +TFLV_MENU_UPGRADE_CONTROLS_HELP = "↵ Toggle upgrade\n⬅➡ Adjust upgrade level"; // headers for player/weapon levelup menus TFLV_MENU_PLAYER_LEVELUP_TITLE = "Player Level Up!"; TFLV_MENU_WEAPON_LEVELUP_TITLE = "Weapon Level Up!"; diff --git a/gun-bonsai/ca.ancilla.bonsai/menu/GenericMenu.zs b/gun-bonsai/ca.ancilla.bonsai/menu/GenericMenu.zs index 43362b3..9057e6e 100644 --- a/gun-bonsai/ca.ancilla.bonsai/menu/GenericMenu.zs +++ b/gun-bonsai/ca.ancilla.bonsai/menu/GenericMenu.zs @@ -24,8 +24,9 @@ class ::GenericMenu : TFLV::TooltipOptionMenu { } void PushUpgradeToggle(TFLV::Upgrade::BaseUpgrade upgrade, uint bag_index, uint index) { - mDesc.mItems.Push(new("::UpgradeToggle").Init(upgrade, bag_index, index)); - PushTooltip(upgrade.GetTooltip(upgrade.level)); + let toggle = new("::UpgradeToggle").Init(upgrade, bag_index, index); + mDesc.mItems.Push(toggle); + toggle.tt = PushTooltip(upgrade.GetTooltip(upgrade.level)); } override bool MenuEvent(int key, bool fromController) { @@ -84,6 +85,7 @@ class ::UpgradeToggle : ::KeyValueText { TFLV::Upgrade::BaseUpgrade upgrade; uint bag_index; uint index; + TFLV::Tooltip tt; ::UpgradeToggle Init(TFLV::Upgrade::BaseUpgrade upgrade, uint bag_index, uint index) { self.upgrade = upgrade; @@ -96,26 +98,47 @@ class ::UpgradeToggle : ::KeyValueText { return self; } + string GetLabel() { + if (upgrade.level == upgrade.max_level) { + return string.format("%s (%d)", upgrade.GetName(), upgrade.level); + } else { + return string.format("%s \c[DARKGREY](%d/%d)\c-", + upgrade.GetName(), upgrade.level, upgrade.max_level); + } + } + override bool Selectable() { return true; } override int Draw(OptionMenuDescriptor d, int y, int indent, bool selected) { - if (upgrade.enabled) { - drawLabel(indent, y, font.CR_DARKRED); - drawValue(indent, y, selected ? font.CR_RED : font.CR_DARKRED, self.value); - } else { + // Update the tooltip, since it's going to change if the user has wiggled + // the effective upgrade level. + tt.text = upgrade.GetTooltip(upgrade.level); + self.mLabel = GetLabel(); + + if (!upgrade.enabled) { drawLabel(indent, y, font.CR_DARKRED); drawValue(indent, y, selected ? font.CR_DARKGRAY : font.CR_BLACK, string.format("\c[BLACK][OFF]\c- %s", self.value)); + } else { + drawLabel(indent, y, font.CR_DARKRED); + drawValue(indent, y, selected ? font.CR_RED : font.CR_DARKRED, self.value); } return indent; } override bool MenuEvent(int key, bool fromController) { - if (key != Menu.MKey_Enter) + if (key == Menu.MKey_Left) { + Menu.MenuSound("menu/change"); + EventHandler.SendNetworkEvent("bonsai-tune-upgrade", bag_index, index, -1); + } else if (key == Menu.MKey_Right) { + Menu.MenuSound("menu/change"); + EventHandler.SendNetworkEvent("bonsai-tune-upgrade", bag_index, index, 1); + } else if (key == Menu.MKey_Enter) { + Menu.MenuSound("menu/choose"); + EventHandler.SendNetworkEvent("bonsai-toggle-upgrade", bag_index, index); + } else { return super.MenuEvent(key, fromController); - - Menu.MenuSound("menu/choose"); - EventHandler.SendNetworkEvent("bonsai-toggle-upgrade", bag_index, index); + } return true; } } diff --git a/gun-bonsai/ca.ancilla.bonsai/menu/StatusDisplay.zs b/gun-bonsai/ca.ancilla.bonsai/menu/StatusDisplay.zs index a1a6d9a..9d2f6ed 100644 --- a/gun-bonsai/ca.ancilla.bonsai/menu/StatusDisplay.zs +++ b/gun-bonsai/ca.ancilla.bonsai/menu/StatusDisplay.zs @@ -31,6 +31,9 @@ class ::StatusDisplay : ::GenericMenu { string.format(StringTable.Localize("$TFLV_MENU_LEVEL"), stats.wlvl), string.format(StringTable.Localize("$TFLV_MENU_XP"), stats.wxp, stats.wmax)); stats.wupgrades.DumpInteractableToMenu(self, 1); + PushText(" ", Font.CR_RED); + PushText("―――――", Font.CR_WHITE); + PushText("$TFLV_MENU_UPGRADE_CONTROLS_HELP", Font.CR_WHITE); mDesc.mSelectedItem = -1; let ld_info = stats.winfo.ld_info;