@amxts/menu-core 0.2.1 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/src/types.ts CHANGED
@@ -155,10 +155,10 @@ export interface Requirement {
155
155
 
156
156
  /** A condition's test, as `addCondition()` registers it. In a list menu `player` is the row's player and `viewer` whoever looks. */
157
157
  export type ConditionTest = (player: Player, viewer: Player, name: string) => boolean;
158
- /** An action, as `addAction()` registers it: run with the context of the item chosen, and the action's name. */
159
- export type ActionHandler = (context: NamedContext) => void;
160
- /** A placeholder's value: the text `%name%` stands for, given the context of the text it is in. */
161
- export type PlaceholderValue = (context: NamedContext) => string;
158
+ /** An action, as `addAction()` registers it: run with the context of the item chosen and the action's name - `({ player, menu }) => ...` - or with the player who chose it, `(player) => ...`. */
159
+ export type ActionHandler = (context: NamedContext & Player) => void;
160
+ /** A placeholder's value: the text `%name%` stands for, given the context of the text it is in - `({ player, target }) => ...` - or the player who reads it, `(player) => ...`. */
161
+ export type PlaceholderValue = (context: NamedContext & Player) => string;
162
162
  /** A restriction's test, as `addRestriction()` registers it; `name` is the whole token, `"NAME:param"` included. */
163
163
  export type RestrictionTest = (context: NamedContext) => boolean;
164
164
  /** A test of an item's action, as `addActionCheck()` registers it: `name` is the action, and `false` greys the item out. */