Repository navigation
Releases: amxts/menu-core
Release list
menu-core v0.2.1
Summary
Built for @amxts/core 0.2.2: the package's prebuilt plugin is compiled with that core, so a project on 0.2.2 takes it as it is instead of compiling the module on its first build. The module's API does not change.
⬆️ Upgrade guide
npx amxts upgrade in the project takes it with the core.
📦 Dependencies
| Package | Range |
|---|---|
@amxts/core |
^0.2.0, prebuilt for 0.2.2 |
❤️ Contributors
- Ernest Manukyan (@kukson777)
menu-core v0.2.0
Summary
menu-core for amxts 0.2.0: every menu function takes the menu's context, items take one options object as the core's Menu does, and a menu stays open while its plugin reloads.
✨ Highlights
The menu's context
A title, visible, enabled and onSelect take one object, { player, target, row, menu }:
const shop = menus.create("SHOP", { title: ({ player }) => `Shop - $${player.money}` });
shop.addItem({
title: ({ player }) => `Heal (${player.health} HP)`,
visible: ({ player }) => player.health < 100,
onSelect: ({ player }) => {
player.health = 100;
},
});In a list of players, target is the player of the row.
A menu kept through a reload
When the plugin that made a menu reloads - a save under amxts dev, amxts_reload - a player looking at the menu keeps it, on the same page, drawn from the new code. When the plugin is unloaded, its menus, items, placeholders and conditions go with it.
⚠️ Breaking changes
- Every function a menu takes gets the context object:
({ player }) => ..., not(player) => .... addItemtakes one options object:addItem({ title, onSelect }), notaddItem("Title", { onSelect }).- Conditions registered by name keep their
(player, viewer, name)arguments.
⬆️ Upgrade guide
npx amxts upgrade rewrites both: the functions to the context and addItem to its options. Files of menus (INI, YAML, JSON) do not change.
📦 Dependencies
| Package | From | To |
|---|---|---|
@amxts/core |
^0.1.0 |
^0.2.0 |
@amxts/config-core |
^0.1.0 |
^0.1.1 |
🚀 Enhancements
⚠️ Every menu function takes the menu's context (496431b)- Keep a menu open through its plugin's reload (1a3ab54)
🩹 Fixes
💅 Refactors
- Import the core's API by its package name (d838de0)
- Command handlers take one object (c6aa029)
server.playersoverPlayer.all(0a8c748)- Admin right by its
lowerCamelCasename (13b2645) - Hear
putInServerby its new name (ac6243e)
📖 Documentation
- The player's money is
player.money(0e0f3ca) - The Pawn natives without a plugin the reader never met (d320b06)
- The menu's context in the README (ffe1920)
- The README without a status note (ee841d7)
⚠️ Breaking Changes
⚠️ Every menu function takes the menu's context (496431b)
❤️ Contributors
- Ernest Manukyan (@kukson777)