Files
dusk/types/item/item.d.ts
T
2026-06-07 19:51:54 -05:00

40 lines
1.0 KiB
TypeScript

/**
* Copyright (c) 2026 Dominic Masters
*
* This software is released under the MIT License.
* https://opensource.org/licenses/MIT
*/
/** Opaque type alias for item identifier constants. */
type ItemId = number;
/** Opaque type alias for item type constants. */
type ItemType = number;
/** Item data lookup. */
interface ItemNamespace {
/**
* Returns the string name for the given item ID.
* @param itemId - An `ITEM_ID_*` constant.
*/
getName(itemId: ItemId): string;
/**
* Returns the type constant for the given item ID.
* @param itemId - An `ITEM_ID_*` constant.
* @returns An `ITEM_TYPE_*` constant.
*/
getType(itemId: ItemId): ItemType;
}
declare var Item: ItemNamespace;
// Item ID constants — injected as globals by the engine at startup.
declare var ITEM_ID_POTION: ItemId;
declare var ITEM_ID_POTATO: ItemId;
declare var ITEM_ID_APPLE: ItemId;
// Item type constants — injected as globals by the engine at startup.
declare var ITEM_TYPE_MEDICINE: ItemType;
declare var ITEM_TYPE_FOOD: ItemType;