we ball I guess
This commit is contained in:
Vendored
+61
@@ -0,0 +1,61 @@
|
||||
/**
|
||||
* Copyright (c) 2026 Dominic Masters
|
||||
*
|
||||
* This software is released under the MIT License.
|
||||
* https://opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
/** A single keyframe descriptor passed to the Animation constructor. */
|
||||
interface AnimationKeyframe {
|
||||
/** Time offset in seconds. */
|
||||
time: number;
|
||||
/** Value at this keyframe. */
|
||||
value: number;
|
||||
/** Easing type (EASING_* constant). Defaults to EASING_LINEAR. */
|
||||
easing?: number;
|
||||
}
|
||||
|
||||
/** Keyframe-based float animation. */
|
||||
interface AnimationInstance {
|
||||
/**
|
||||
* Interpolates the animation at the given time.
|
||||
* @param time Time in seconds.
|
||||
* @returns Interpolated value.
|
||||
*/
|
||||
getValue(time: number): number;
|
||||
}
|
||||
|
||||
/** Constructs a new Animation from an array of keyframe descriptors. */
|
||||
declare var Animation: {
|
||||
new (keyframes: AnimationKeyframe[]): AnimationInstance;
|
||||
};
|
||||
|
||||
/** Easing function utilities. */
|
||||
interface EasingNamespace {
|
||||
/**
|
||||
* Applies the given easing function to normalized time t.
|
||||
* @param type An EASING_* constant.
|
||||
* @param t Normalized time in [0, 1].
|
||||
* @returns Eased value in [0, 1].
|
||||
*/
|
||||
apply(type: number, t: number): number;
|
||||
}
|
||||
|
||||
declare var Easing: EasingNamespace;
|
||||
|
||||
declare var EASING_LINEAR: number;
|
||||
declare var EASING_IN_SINE: number;
|
||||
declare var EASING_OUT_SINE: number;
|
||||
declare var EASING_IN_OUT_SINE: number;
|
||||
declare var EASING_IN_QUAD: number;
|
||||
declare var EASING_OUT_QUAD: number;
|
||||
declare var EASING_IN_OUT_QUAD: number;
|
||||
declare var EASING_IN_CUBIC: number;
|
||||
declare var EASING_OUT_CUBIC: number;
|
||||
declare var EASING_IN_OUT_CUBIC: number;
|
||||
declare var EASING_IN_QUART: number;
|
||||
declare var EASING_OUT_QUART: number;
|
||||
declare var EASING_IN_OUT_QUART: number;
|
||||
declare var EASING_IN_BACK: number;
|
||||
declare var EASING_OUT_BACK: number;
|
||||
declare var EASING_IN_OUT_BACK: number;
|
||||
Vendored
+22
@@ -31,6 +31,28 @@
|
||||
/// <reference path="./asset/assetbatch.d.ts" />
|
||||
/// <reference path="./asset/asset.d.ts" />
|
||||
|
||||
// animation
|
||||
/// <reference path="./animation/animation.d.ts" />
|
||||
|
||||
// overworld
|
||||
/// <reference path="./overworld/overworld.d.ts" />
|
||||
|
||||
// item system
|
||||
/// <reference path="./item/item.d.ts" />
|
||||
/// <reference path="./item/backpack.d.ts" />
|
||||
|
||||
// story system
|
||||
/// <reference path="./story/story.d.ts" />
|
||||
|
||||
// locale
|
||||
/// <reference path="./locale/locale.d.ts" />
|
||||
|
||||
// save
|
||||
/// <reference path="./save/save.d.ts" />
|
||||
|
||||
// ui
|
||||
/// <reference path="./ui/textbox.d.ts" />
|
||||
|
||||
// engine systems
|
||||
/// <reference path="./console/console.d.ts" />
|
||||
/// <reference path="./engine/engine.d.ts" />
|
||||
|
||||
Vendored
+63
@@ -0,0 +1,63 @@
|
||||
/**
|
||||
* Copyright (c) 2026 Dominic Masters
|
||||
*
|
||||
* This software is released under the MIT License.
|
||||
* https://opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
/** The player's item backpack (a fixed 20-slot inventory). */
|
||||
interface BackpackNamespace {
|
||||
/** `true` when all 20 storage slots are occupied by distinct items. */
|
||||
readonly isFull: boolean;
|
||||
|
||||
/**
|
||||
* Returns the quantity of `itemId` in the backpack (0 if absent).
|
||||
* @param itemId - An `ITEM_ID_*` constant.
|
||||
*/
|
||||
getCount(itemId: ItemId): number;
|
||||
|
||||
/**
|
||||
* Returns `true` if `itemId` is present with quantity greater than 0.
|
||||
* @param itemId - An `ITEM_ID_*` constant.
|
||||
*/
|
||||
has(itemId: ItemId): boolean;
|
||||
|
||||
/**
|
||||
* Returns `true` if the stack for `itemId` is at maximum quantity (255).
|
||||
* @param itemId - An `ITEM_ID_*` constant.
|
||||
*/
|
||||
isItemFull(itemId: ItemId): boolean;
|
||||
|
||||
/**
|
||||
* Sets the quantity of `itemId`; passing 0 removes the stack entirely.
|
||||
* @param itemId - An `ITEM_ID_*` constant.
|
||||
* @param quantity - New quantity, 0–255.
|
||||
*/
|
||||
set(itemId: ItemId, quantity: number): void;
|
||||
|
||||
/**
|
||||
* Adds `quantity` units of `itemId` to the backpack.
|
||||
* @param itemId - An `ITEM_ID_*` constant.
|
||||
* @param quantity - Amount to add, 1–255.
|
||||
*/
|
||||
add(itemId: ItemId, quantity: number): void;
|
||||
|
||||
/**
|
||||
* Removes `itemId` entirely from the backpack.
|
||||
* @param itemId - An `ITEM_ID_*` constant.
|
||||
*/
|
||||
remove(itemId: ItemId): void;
|
||||
|
||||
/**
|
||||
* Sorts the backpack contents.
|
||||
* @param sortBy - `INVENTORY_SORT_BY_ID` or `INVENTORY_SORT_BY_TYPE`.
|
||||
* @param reverse - Optional; pass `true` to reverse the sort order.
|
||||
*/
|
||||
sort(sortBy: number, reverse?: boolean): void;
|
||||
}
|
||||
|
||||
declare var Backpack: BackpackNamespace;
|
||||
|
||||
// Inventory sort constants — injected as globals by the engine at startup.
|
||||
declare var INVENTORY_SORT_BY_ID: number;
|
||||
declare var INVENTORY_SORT_BY_TYPE: number;
|
||||
Vendored
+39
@@ -0,0 +1,39 @@
|
||||
/**
|
||||
* 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;
|
||||
Vendored
+31
@@ -0,0 +1,31 @@
|
||||
/**
|
||||
* Copyright (c) 2026 Dominic Masters
|
||||
*
|
||||
* This software is released under the MIT License.
|
||||
* https://opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
/** Locale string lookup and language switching. */
|
||||
interface LocaleNamespace {
|
||||
/**
|
||||
* Returns the translated string for the given message ID.
|
||||
*
|
||||
* @param id - PO message ID, e.g. `"ITEM_POTION_NAME"`.
|
||||
* @param pluralCount - Optional count used to select the plural form.
|
||||
* Defaults to 1 (singular).
|
||||
* @param args - Optional substitution values (`%s`, `%d`, `%f`).
|
||||
*/
|
||||
getText(
|
||||
id: string,
|
||||
pluralCount?: number,
|
||||
...args: Array<string | number>
|
||||
): string;
|
||||
|
||||
/**
|
||||
* Switches the active locale.
|
||||
* @param name - Locale name string, e.g. `"en-US"`.
|
||||
*/
|
||||
setLocale(name: string): void;
|
||||
}
|
||||
|
||||
declare var Locale: LocaleNamespace;
|
||||
Vendored
+40
@@ -0,0 +1,40 @@
|
||||
/**
|
||||
* Copyright (c) 2026 Dominic Masters
|
||||
*
|
||||
* This software is released under the MIT License.
|
||||
* https://opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
/** Map loading and world-position management. */
|
||||
interface OverworldNamespace {
|
||||
/**
|
||||
* Loads the map with the given handle, disposing any currently loaded map.
|
||||
* @param handle Map handle string (max 31 chars).
|
||||
*/
|
||||
loadMap(handle: string): void;
|
||||
|
||||
/**
|
||||
* Returns `true` when a map is currently loaded.
|
||||
*/
|
||||
isLoaded(): boolean;
|
||||
|
||||
/**
|
||||
* Slides the loaded chunk window to the given tile-space position.
|
||||
* @param x Tile X.
|
||||
* @param y Tile Y.
|
||||
* @param z Tile Z.
|
||||
*/
|
||||
setPosition(x: number, y: number, z: number): void;
|
||||
|
||||
/**
|
||||
* Advances the map one tick. Call once per frame.
|
||||
*/
|
||||
update(): void;
|
||||
|
||||
/**
|
||||
* Unloads the current map.
|
||||
*/
|
||||
dispose(): void;
|
||||
}
|
||||
|
||||
declare var Overworld: OverworldNamespace;
|
||||
Vendored
+2
-3
@@ -11,9 +11,8 @@
|
||||
* Modules are cached after their first load. Subsequent calls with the same
|
||||
* resolved path return the cached exports without re-executing the file.
|
||||
*
|
||||
* Path rules: `"./foo"` / `"../foo"` resolve relative to the calling script's
|
||||
* directory; any other string resolves from the archive root. `.js` is
|
||||
* appended automatically when missing.
|
||||
* Path rules: the string is passed verbatim to the asset loader and resolved
|
||||
* from the archive root. The `.js` extension must be included explicitly.
|
||||
*
|
||||
* @example
|
||||
* const NPC = require('./entities/NPC');
|
||||
|
||||
Vendored
+38
@@ -0,0 +1,38 @@
|
||||
/**
|
||||
* Copyright (c) 2026 Dominic Masters
|
||||
*
|
||||
* This software is released under the MIT License.
|
||||
* https://opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
/** Slot-based save file management. */
|
||||
interface SaveNamespace {
|
||||
/**
|
||||
* Returns `true` if a save file is present for the given slot.
|
||||
* @param slot - Save slot index (0–2).
|
||||
*/
|
||||
exists(slot: number): boolean;
|
||||
|
||||
/**
|
||||
* Loads the save file for the given slot from persistent storage.
|
||||
* Throws if the load fails.
|
||||
* @param slot - Save slot index (0–2).
|
||||
*/
|
||||
load(slot: number): void;
|
||||
|
||||
/**
|
||||
* Writes the save file for the given slot to persistent storage.
|
||||
* Throws if the write fails.
|
||||
* @param slot - Save slot index (0–2).
|
||||
*/
|
||||
write(slot: number): void;
|
||||
|
||||
/**
|
||||
* Deletes the save file for the given slot from persistent storage.
|
||||
* Throws if the delete fails.
|
||||
* @param slot - Save slot index (0–2).
|
||||
*/
|
||||
delete(slot: number): void;
|
||||
}
|
||||
|
||||
declare var Save: SaveNamespace;
|
||||
Vendored
+30
@@ -0,0 +1,30 @@
|
||||
/**
|
||||
* Copyright (c) 2026 Dominic Masters
|
||||
*
|
||||
* This software is released under the MIT License.
|
||||
* https://opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
/** Opaque type alias for story flag identifier constants. */
|
||||
type StoryFlag = number;
|
||||
|
||||
/** Story flag read/write access. */
|
||||
interface StoryNamespace {
|
||||
/**
|
||||
* Returns the current value of a story flag (0–255).
|
||||
* @param flagId - A `STORY_FLAG_*` constant.
|
||||
*/
|
||||
get(flagId: StoryFlag): number;
|
||||
|
||||
/**
|
||||
* Sets a story flag to a new value.
|
||||
* @param flagId - A `STORY_FLAG_*` constant.
|
||||
* @param value - New value, 0–255.
|
||||
*/
|
||||
set(flagId: StoryFlag, value: number): void;
|
||||
}
|
||||
|
||||
declare var Story: StoryNamespace;
|
||||
|
||||
// Story flag constants — injected as globals by the engine at startup.
|
||||
declare var STORY_FLAG_TEST: StoryFlag;
|
||||
Vendored
+50
@@ -0,0 +1,50 @@
|
||||
/**
|
||||
* Copyright (c) 2026 Dominic Masters
|
||||
*
|
||||
* This software is released under the MIT License.
|
||||
* https://opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
/** VN-style typewriter textbox singleton. */
|
||||
interface UITextboxNamespace {
|
||||
/** `true` when the typewriter has fully revealed the current page. */
|
||||
readonly isPageComplete: boolean;
|
||||
/** `true` when at least one more page follows the current one. */
|
||||
readonly hasNextPage: boolean;
|
||||
/** Zero-based index of the current page. */
|
||||
readonly currentPage: number;
|
||||
/** Total number of pages for the current text. */
|
||||
readonly pageCount: number;
|
||||
|
||||
/**
|
||||
* Sets the textbox content and rebuilds the word-wrap layout.
|
||||
* Resets to page 0 and scroll 0.
|
||||
* @param text - Text to display (max 1024 chars).
|
||||
*/
|
||||
setText(text: string): void;
|
||||
|
||||
/**
|
||||
* Advances to the next page; no-op on the last page.
|
||||
*/
|
||||
nextPage(): void;
|
||||
|
||||
/**
|
||||
* Advances the typewriter scroll by one tick.
|
||||
* Call once per frame before `draw()`.
|
||||
*/
|
||||
update(): void;
|
||||
|
||||
/**
|
||||
* Draws the frame and currently visible text.
|
||||
* Call once per frame after `update()`.
|
||||
*/
|
||||
draw(): void;
|
||||
|
||||
/**
|
||||
* Sets the input action that auto-advances the textbox when held.
|
||||
* @param action - An `INPUT_ACTION_*` constant.
|
||||
*/
|
||||
setAdvanceAction(action: InputAction): void;
|
||||
}
|
||||
|
||||
declare var UITextbox: UITextboxNamespace;
|
||||
Reference in New Issue
Block a user