@fruit-pie/quicksave 0.1.0 → 1.0.1
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/dist/index.js +145 -156
- package/package.json +4 -9
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
//#region node_modules/@fruit-pie/sdk/dist/index.js
|
|
2
2
|
var e = function(e) {
|
|
3
|
-
let {
|
|
3
|
+
let { identity: t, hostApi: n, prefix: r, objects: i, internalReceive: a, internalCreate: o, normalizeEventName: s, context: c, queue: l, scratch: u } = e, d = /* @__PURE__ */ new Map();
|
|
4
4
|
for (let e of i) for (let n of Object.keys(e.receive ?? {})) {
|
|
5
5
|
let r = s(n), i = d.get(r);
|
|
6
6
|
if (i) throw Error(`mod ${t.id}: both ${i} and ${e.name} receive ${JSON.stringify(r)}. They would race for each message; give it to one of them.`);
|
|
@@ -157,7 +157,7 @@ var l = function(e) {
|
|
|
157
157
|
for (let t of e.scripts) {
|
|
158
158
|
let n = {};
|
|
159
159
|
(t.args ?? []).forEach((i, a) => {
|
|
160
|
-
if (!r.test(i)) throw Error(`mod ${e.
|
|
160
|
+
if (!r.test(i)) throw Error(`mod ${e.identity.id}: script ${JSON.stringify(t.name)} has an argument called ${JSON.stringify(i)}, which is not a usable name`);
|
|
161
161
|
n[i] = `argument${a}`;
|
|
162
162
|
}), e.hostApi.resource.create({
|
|
163
163
|
kind: "script",
|
|
@@ -287,7 +287,7 @@ var l = function(e) {
|
|
|
287
287
|
a(r);
|
|
288
288
|
return;
|
|
289
289
|
}
|
|
290
|
-
console.warn(`[${e.
|
|
290
|
+
console.warn(`[${e.identity.id}] sprite ${JSON.stringify(n)} failed: ${r.message}`), a(r);
|
|
291
291
|
} else i(o);
|
|
292
292
|
}, h = () => {
|
|
293
293
|
clearTimeout(d), d = setTimeout(() => p(/* @__PURE__ */ Error(`the game stopped answering after ${l} of ${u.length} chunks`)), f);
|
|
@@ -434,7 +434,7 @@ while (${i("b64i")} < 64) {
|
|
|
434
434
|
}
|
|
435
435
|
${r(y.hello)}`;
|
|
436
436
|
}, C = function(e) {
|
|
437
|
-
let {
|
|
437
|
+
let { identity: t, sprites: n, shown: r, spriteLoader: i, handlers: a } = e;
|
|
438
438
|
if (n.length === 0) return;
|
|
439
439
|
let o = 0;
|
|
440
440
|
a.set(y.hello, [() => {
|
|
@@ -458,161 +458,154 @@ ${r(y.hello)}`;
|
|
|
458
458
|
i.failed(t < 0 ? "the game refused the picture" : e.slice(t + 1));
|
|
459
459
|
}]);
|
|
460
460
|
}, w = function(e) {
|
|
461
|
-
let t = (e.split(
|
|
461
|
+
let t = (e.split(/[/.]/u).pop() ?? e).replaceAll(/[^A-Za-z0-9]/gu, "").slice(0, 12), n = 2166136261;
|
|
462
462
|
for (let t = 0; t < e.length; t += 1) n = Math.imul(n ^ e.charCodeAt(t), 16777619);
|
|
463
463
|
return `m${t}_${((n >>> 0) % 65536).toString(16).padStart(4, "0")}_`;
|
|
464
|
-
}, T = function(t
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
if (!
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
script: {
|
|
504
|
-
create(e) {
|
|
505
|
-
if (!v) throw Error(`mod ${s.id}: scripts can only be declared while the mod is built`);
|
|
506
|
-
if (!r.test(e.name)) throw Error(`mod ${s.id}: ${JSON.stringify(e.name)} is not a usable script name (letters, digits and _, starting with a letter)`);
|
|
507
|
-
if (p.some((t) => t.name === e.name)) throw Error(`mod ${s.id}: two scripts are called ${JSON.stringify(e.name)}`);
|
|
508
|
-
p.push(e);
|
|
509
|
-
},
|
|
510
|
-
hook(e, t) {
|
|
511
|
-
if (!v) throw Error(`mod ${s.id}: hooks can only be declared while the mod is built`);
|
|
512
|
-
h.push({
|
|
513
|
-
script: e,
|
|
514
|
-
wrap: t
|
|
515
|
-
});
|
|
516
|
-
},
|
|
517
|
-
insert(e) {
|
|
518
|
-
if (!v) throw Error(`mod ${s.id}: insertions can only be declared while the mod is built`);
|
|
519
|
-
g.push({
|
|
520
|
-
at: c(s.id, e),
|
|
521
|
-
place: e.place,
|
|
522
|
-
body: e.body
|
|
523
|
-
});
|
|
524
|
-
}
|
|
464
|
+
}, T = function(t) {
|
|
465
|
+
return { activate(a) {
|
|
466
|
+
let s = a.identity, d = w(s.id), f = [], p = [], m = [], h = [], g = [], _ = /* @__PURE__ */ new Map(), v = !0, y = (e) => {
|
|
467
|
+
if (!n.test(e)) throw Error(`mod ${s.id}: ${JSON.stringify(e)} is not a usable event name (letters, digits, - and _, starting with a letter)`);
|
|
468
|
+
return e.replaceAll("-", "_");
|
|
469
|
+
}, T = (e) => `${d}__${e}`, E = (e) => {
|
|
470
|
+
let t = {};
|
|
471
|
+
for (let n of e.vars ?? []) {
|
|
472
|
+
if (!r.test(n)) throw Error(`mod ${s.id}: ${JSON.stringify(n)} is not a usable variable name (letters, digits and _, starting with a letter)`);
|
|
473
|
+
t[n] = `${d}v_${n}`;
|
|
474
|
+
}
|
|
475
|
+
return t;
|
|
476
|
+
}, D = (e) => `global.${d}q_${e}`, O = (e, t = "") => a.send(`${e} ${t}`), k = (e, t) => a.gml.send(t ? `"${e} " + (${t})` : `"${e} "`), A = (e, t) => k(y(e), t), j = (e, ...t) => {
|
|
477
|
+
if (!p.some((t) => t.name === e)) throw Error(`mod ${s.id}: call(${JSON.stringify(e)}) names a script this mod never declared. It has: ${p.map((e) => e.name).join(", ") || "none"}`);
|
|
478
|
+
return `${d}s_${e}(${t.join(", ")})`;
|
|
479
|
+
}, M = (e) => ({
|
|
480
|
+
engine: a.target.engine,
|
|
481
|
+
v: E(e),
|
|
482
|
+
send: A,
|
|
483
|
+
call: j
|
|
484
|
+
}), N = b({
|
|
485
|
+
hostApi: a,
|
|
486
|
+
identity: s,
|
|
487
|
+
sendInternal: O
|
|
488
|
+
}), P = /* @__PURE__ */ new Map(), F = a.game;
|
|
489
|
+
t({
|
|
490
|
+
engine: a.target.engine,
|
|
491
|
+
content: F,
|
|
492
|
+
resource: {
|
|
493
|
+
object: { create(e) {
|
|
494
|
+
if (!v) throw Error(`mod ${s.id}: objects can only be declared while the mod is built`);
|
|
495
|
+
f.push(e);
|
|
496
|
+
} },
|
|
497
|
+
script: {
|
|
498
|
+
create(e) {
|
|
499
|
+
if (!v) throw Error(`mod ${s.id}: scripts can only be declared while the mod is built`);
|
|
500
|
+
if (!r.test(e.name)) throw Error(`mod ${s.id}: ${JSON.stringify(e.name)} is not a usable script name (letters, digits and _, starting with a letter)`);
|
|
501
|
+
if (p.some((t) => t.name === e.name)) throw Error(`mod ${s.id}: two scripts are called ${JSON.stringify(e.name)}`);
|
|
502
|
+
p.push(e);
|
|
525
503
|
},
|
|
526
|
-
|
|
527
|
-
if (!v) throw Error(`mod ${s.id}:
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
r ? r.push(t) : _.set(n, [t]);
|
|
542
|
-
},
|
|
543
|
-
onStart(e) {
|
|
544
|
-
t.on("start", e);
|
|
545
|
-
},
|
|
546
|
-
scratchPath(e) {
|
|
547
|
-
if (!i.test(e)) throw Error(`mod ${s.id}: ${JSON.stringify(e)} is not a usable scratch file name (letters, digits, _ . and -)`);
|
|
548
|
-
return t.target.engine === "gm8" ? `temp_directory + "\\${d}${e}"` : `"${d}${e}"`;
|
|
504
|
+
hook(e, t) {
|
|
505
|
+
if (!v) throw Error(`mod ${s.id}: hooks can only be declared while the mod is built`);
|
|
506
|
+
h.push({
|
|
507
|
+
script: e,
|
|
508
|
+
wrap: t
|
|
509
|
+
});
|
|
510
|
+
},
|
|
511
|
+
insert(e) {
|
|
512
|
+
if (!v) throw Error(`mod ${s.id}: insertions can only be declared while the mod is built`);
|
|
513
|
+
g.push({
|
|
514
|
+
at: c(s.id, e),
|
|
515
|
+
place: e.place,
|
|
516
|
+
body: e.body
|
|
517
|
+
});
|
|
518
|
+
}
|
|
549
519
|
},
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
520
|
+
sprite: { create(e, t = {}) {
|
|
521
|
+
if (!v) throw Error(`mod ${s.id}: sprites can only be declared while the mod is built`);
|
|
522
|
+
if (!r.test(e)) throw Error(`mod ${s.id}: ${JSON.stringify(e)} is not a usable sprite name (letters, digits and _, starting with a letter)`);
|
|
523
|
+
if (m.some((t) => t.name === e)) throw Error(`mod ${s.id}: two sprites are called ${JSON.stringify(e)}`);
|
|
524
|
+
return m.push({
|
|
525
|
+
name: e,
|
|
526
|
+
options: t
|
|
527
|
+
}), {
|
|
528
|
+
id: `global.${d}spr_${e}`,
|
|
529
|
+
load: (n) => (P.set(e, n), N.loadSprite(e, t, n))
|
|
530
|
+
};
|
|
531
|
+
} }
|
|
532
|
+
},
|
|
533
|
+
on(e, t) {
|
|
534
|
+
let n = y(e), r = _.get(n);
|
|
535
|
+
r ? r.push(t) : _.set(n, [t]);
|
|
536
|
+
},
|
|
537
|
+
onStart(e) {
|
|
538
|
+
a.on("start", e);
|
|
539
|
+
},
|
|
540
|
+
scratchPath(e) {
|
|
541
|
+
if (!i.test(e)) throw Error(`mod ${s.id}: ${JSON.stringify(e)} is not a usable scratch file name (letters, digits, _ . and -)`);
|
|
542
|
+
return a.target.engine === "gm8" ? `temp_directory + "\\${d}${e}"` : `"${d}${e}"`;
|
|
543
|
+
},
|
|
544
|
+
send(e, t = "") {
|
|
545
|
+
a.send(`${y(e)} ${t}`);
|
|
546
|
+
}
|
|
547
|
+
}), v = !1, l({
|
|
548
|
+
identity: s,
|
|
549
|
+
inserts: g,
|
|
550
|
+
prefix: d,
|
|
551
|
+
hostApi: a,
|
|
552
|
+
send: A,
|
|
553
|
+
call: j
|
|
554
|
+
}), u({
|
|
555
|
+
identity: s,
|
|
556
|
+
scripts: p,
|
|
557
|
+
hostApi: a,
|
|
558
|
+
prefix: d,
|
|
559
|
+
send: A,
|
|
560
|
+
call: j
|
|
561
|
+
}), o({
|
|
562
|
+
identity: s,
|
|
563
|
+
hooks: h,
|
|
564
|
+
content: F,
|
|
565
|
+
hostApi: a,
|
|
566
|
+
prefix: d,
|
|
567
|
+
send: A,
|
|
568
|
+
call: j
|
|
569
|
+
}), e({
|
|
570
|
+
identity: s,
|
|
571
|
+
hostApi: a,
|
|
572
|
+
prefix: d,
|
|
573
|
+
objects: f,
|
|
574
|
+
internalReceive: x({
|
|
575
|
+
hostApi: a,
|
|
572
576
|
prefix: d,
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
577
|
+
sprites: m,
|
|
578
|
+
payload: T("pl"),
|
|
579
|
+
sendInternalGml: k
|
|
580
|
+
}),
|
|
581
|
+
internalCreate: S({
|
|
578
582
|
prefix: d,
|
|
579
|
-
objects: f,
|
|
580
|
-
internalReceive: x({
|
|
581
|
-
hostApi: t,
|
|
582
|
-
prefix: d,
|
|
583
|
-
sprites: m,
|
|
584
|
-
payload: T("pl"),
|
|
585
|
-
sendInternalGml: k
|
|
586
|
-
}),
|
|
587
|
-
internalCreate: S({
|
|
588
|
-
prefix: d,
|
|
589
|
-
sprites: m,
|
|
590
|
-
sendInternalGml: k
|
|
591
|
-
}),
|
|
592
|
-
normalizeEventName: y,
|
|
593
|
-
context: M,
|
|
594
|
-
queue: D,
|
|
595
|
-
scratch: T
|
|
596
|
-
}), C({
|
|
597
|
-
manifest: s,
|
|
598
583
|
sprites: m,
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
584
|
+
sendInternalGml: k
|
|
585
|
+
}),
|
|
586
|
+
normalizeEventName: y,
|
|
587
|
+
context: M,
|
|
588
|
+
queue: D,
|
|
589
|
+
scratch: T
|
|
590
|
+
}), C({
|
|
591
|
+
identity: s,
|
|
592
|
+
sprites: m,
|
|
593
|
+
shown: P,
|
|
594
|
+
spriteLoader: N,
|
|
595
|
+
handlers: _
|
|
596
|
+
}), a.on("message", (e) => {
|
|
597
|
+
let t = e.indexOf(" "), n = t < 0 ? e : e.slice(0, t), r = t < 0 ? "" : e.slice(t + 1), i = _.get(n);
|
|
598
|
+
if (!i) {
|
|
599
|
+
console.warn(`[${s.id}] no handler for ${JSON.stringify(n)}`);
|
|
600
|
+
return;
|
|
601
|
+
}
|
|
602
|
+
for (let e of i) new Promise((t) => {
|
|
603
|
+
t(e(r));
|
|
604
|
+
}).catch((e) => {
|
|
605
|
+
console.error(`[${s.id}] handling ${n} failed:`, e);
|
|
613
606
|
});
|
|
614
|
-
}
|
|
615
|
-
};
|
|
607
|
+
});
|
|
608
|
+
} };
|
|
616
609
|
}, E = /* @__PURE__ */ new Set([
|
|
617
610
|
"file_bin_open",
|
|
618
611
|
"file_text_open_read",
|
|
@@ -1172,11 +1165,7 @@ file_text_close(qs_file);`
|
|
|
1172
1165
|
"dropped",
|
|
1173
1166
|
"refused"
|
|
1174
1167
|
]) e.on(t, (e) => console.log(`[quicksave] ${t}${e ? `: ${e}` : ""}`));
|
|
1175
|
-
}, q = T({
|
|
1176
|
-
id: "fruit-pie.quicksave",
|
|
1177
|
-
name: "Quicksave",
|
|
1178
|
-
version: "1.0.0"
|
|
1179
|
-
}, (e) => {
|
|
1168
|
+
}, q = T((e) => {
|
|
1180
1169
|
let t = V(e.content);
|
|
1181
1170
|
t.ok ? K(e, t.value) : console.warn(`[quicksave] this game is not supported: ${t.error}`);
|
|
1182
1171
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fruit-pie/quicksave",
|
|
3
|
-
"version": "0.1
|
|
3
|
+
"version": "1.0.1",
|
|
4
|
+
"displayName": "Quicksave",
|
|
4
5
|
"description": "Save anywhere between two of the game's saves, without touching its save files.",
|
|
5
6
|
"type": "module",
|
|
6
7
|
"main": "dist/index.js",
|
|
@@ -16,12 +17,6 @@
|
|
|
16
17
|
"publishConfig": {
|
|
17
18
|
"access": "public"
|
|
18
19
|
},
|
|
19
|
-
"fruitPieMod": {
|
|
20
|
-
"manifestId": "fruit-pie.quicksave",
|
|
21
|
-
"name": "Quicksave",
|
|
22
|
-
"entry": "dist/index.js",
|
|
23
|
-
"apiVersion": 2
|
|
24
|
-
},
|
|
25
20
|
"devDependencies": {
|
|
26
21
|
"@types/node": "^24.13.4",
|
|
27
22
|
"concurrently": "^10.0.5",
|
|
@@ -29,7 +24,7 @@
|
|
|
29
24
|
"vite": "^8.3.0"
|
|
30
25
|
},
|
|
31
26
|
"dependencies": {
|
|
32
|
-
"@fruit-pie/detect": "^
|
|
33
|
-
"@fruit-pie/sdk": "^
|
|
27
|
+
"@fruit-pie/detect": "^2.0.0",
|
|
28
|
+
"@fruit-pie/sdk": "^2.0.0"
|
|
34
29
|
}
|
|
35
30
|
}
|