@nighthawk.hq/macro-sdk 0.2.0 → 0.4.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/lib/index.d.ts +3 -2
- package/lib/roblox/index.d.ts +18 -7
- package/lib/settings.d.ts +8 -0
- package/package.json +11 -3
- package/runtime-manifest.json +1 -0
package/lib/index.d.ts
CHANGED
|
@@ -3,11 +3,12 @@ export { Macro, OnStart, OnStop, OnTick, Action, Panel, Overlay } from './decora
|
|
|
3
3
|
export type { ActionOptions } from './decorators';
|
|
4
4
|
export { MacroBase } from './macro-base';
|
|
5
5
|
export { robloxTarget } from './targets';
|
|
6
|
-
export { region, ratio, point, color, number, string, boolean, select, pixelColor, findColor, defaultsOf, } from './settings';
|
|
7
|
-
export type { Setting, SettingMap, RegionSetting, RatioSetting, PointSetting, ColorSetting, NumberSetting, StringSetting, BooleanSetting, SelectSetting, PixelColorSetting, PixelColorValue, FindColorSetting, FindColorValue, } from './settings';
|
|
6
|
+
export { region, ratio, point, color, number, string, boolean, select, pixelColor, findColor, group, defaultsOf, } from './settings';
|
|
7
|
+
export type { Setting, SettingMap, SettingGroup, RegionSetting, RatioSetting, PointSetting, ColorSetting, NumberSetting, StringSetting, BooleanSetting, SelectSetting, PixelColorSetting, PixelColorValue, FindColorSetting, FindColorValue, } from './settings';
|
|
8
8
|
export { Group, Row, Stat, Chip, Divider, Button, Text, Meter, Image } from './widgets';
|
|
9
9
|
export type { Widget, PanelDeclaration, WidgetTone, WidgetSize, WidgetAlign, WidgetWeight, } from './panel-types';
|
|
10
10
|
export { Roblox, Instance } from './roblox/index';
|
|
11
|
+
export type { RobloxValidation } from './roblox/index';
|
|
11
12
|
export type { RobloxOffsets } from './roblox/offsets';
|
|
12
13
|
export type { UDim2, Vector3, TreeNode } from './roblox/instance';
|
|
13
14
|
export { offsetsFromDump } from './roblox/offsets-dump';
|
package/lib/roblox/index.d.ts
CHANGED
|
@@ -2,6 +2,18 @@ import { Address } from '../process/address';
|
|
|
2
2
|
import type { ProcessAccess } from '../process/process-access';
|
|
3
3
|
import { Instance } from './instance';
|
|
4
4
|
import type { RobloxOffsets } from './offsets';
|
|
5
|
+
/**
|
|
6
|
+
* Result of {@link Roblox.validate}. A discriminated union so the caller gets a single,
|
|
7
|
+
* ready-to-surface, user-facing `reason` for the failure — no macro has to author its
|
|
8
|
+
* own wording — while `problems` carries the diagnostic detail for logs.
|
|
9
|
+
*/
|
|
10
|
+
export type RobloxValidation = {
|
|
11
|
+
ok: true;
|
|
12
|
+
} | {
|
|
13
|
+
ok: false;
|
|
14
|
+
reason: string;
|
|
15
|
+
problems: string[];
|
|
16
|
+
};
|
|
5
17
|
export declare class Roblox {
|
|
6
18
|
#private;
|
|
7
19
|
readonly process: ProcessAccess;
|
|
@@ -10,14 +22,13 @@ export declare class Roblox {
|
|
|
10
22
|
static bind(process: ProcessAccess, offsets: RobloxOffsets): Roblox;
|
|
11
23
|
invalidateCache(): void;
|
|
12
24
|
/**
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
25
|
+
* Check the live game state + offsets and, on failure, return the real user-facing
|
|
26
|
+
* `reason` for it — so a macro just surfaces `check.reason` instead of authoring its
|
|
27
|
+
* own wording. The three failure modes are distinct: not attached (Roblox closed),
|
|
28
|
+
* attached but no DataModel (at the menu / still loading), and a resolved DataModel
|
|
29
|
+
* whose shape is wrong (offsets stale after a Roblox build bump).
|
|
16
30
|
*/
|
|
17
|
-
validate():
|
|
18
|
-
ok: boolean;
|
|
19
|
-
problems: string[];
|
|
20
|
-
};
|
|
31
|
+
validate(): RobloxValidation;
|
|
21
32
|
dataModel(): Instance | null;
|
|
22
33
|
service(name: string): Instance | null;
|
|
23
34
|
workspace(): Instance | null;
|
package/lib/settings.d.ts
CHANGED
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
import type { Point, Region, RegionRatio } from './geometry';
|
|
2
|
+
export type SettingGroup = {
|
|
3
|
+
label: string;
|
|
4
|
+
collapsed?: boolean;
|
|
5
|
+
};
|
|
2
6
|
type Base<K extends string, T> = {
|
|
3
7
|
kind: K;
|
|
4
8
|
label: string;
|
|
5
9
|
description?: string;
|
|
6
10
|
default: T;
|
|
11
|
+
group?: SettingGroup;
|
|
7
12
|
};
|
|
8
13
|
export type RegionSetting = Base<'region', Region>;
|
|
9
14
|
export type RatioSetting = Base<'ratio', RegionRatio>;
|
|
@@ -48,5 +53,8 @@ export declare const boolean: (s: Omit<BooleanSetting, "kind">) => BooleanSettin
|
|
|
48
53
|
export declare const select: <T extends string>(s: Omit<SelectSetting<T>, "kind">) => SelectSetting<T>;
|
|
49
54
|
export declare const pixelColor: (s: Omit<PixelColorSetting, "kind">) => PixelColorSetting;
|
|
50
55
|
export declare const findColor: (s: Omit<FindColorSetting, "kind">) => FindColorSetting;
|
|
56
|
+
export declare function group<M extends SettingMap>(label: string, settings: M, opts?: {
|
|
57
|
+
collapsed?: boolean;
|
|
58
|
+
}): M;
|
|
51
59
|
export declare function defaultsOf<M extends SettingMap>(map: M): Record<string, unknown>;
|
|
52
60
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nighthawk.hq/macro-sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"packageManager": "pnpm@10.34.1",
|
|
5
5
|
"description": "Nighthawk macro author SDK — types only. Runtime is provided by the host.",
|
|
6
6
|
"type": "module",
|
|
@@ -10,10 +10,18 @@
|
|
|
10
10
|
},
|
|
11
11
|
"types": "./lib/index.d.ts",
|
|
12
12
|
"exports": {
|
|
13
|
-
".": {
|
|
13
|
+
".": {
|
|
14
|
+
"types": "./lib/index.d.ts",
|
|
15
|
+
"default": "./stub.js"
|
|
16
|
+
},
|
|
14
17
|
"./build": "./build/index.js"
|
|
15
18
|
},
|
|
16
|
-
"files": [
|
|
19
|
+
"files": [
|
|
20
|
+
"lib/**/*.d.ts",
|
|
21
|
+
"stub.js",
|
|
22
|
+
"build/index.js",
|
|
23
|
+
"runtime-manifest.json"
|
|
24
|
+
],
|
|
17
25
|
"scripts": {
|
|
18
26
|
"generate": "node scripts/generate.mjs",
|
|
19
27
|
"test": "node --test test/shim.test.mjs"
|