16 lines
672 B
JavaScript
16 lines
672 B
JavaScript
"use strict";
|
|
|
|
(function (global) {
|
|
const applied = new Set();
|
|
function patchPrototype(key, owner, patchFn) {
|
|
if (!key || !owner?.prototype || typeof patchFn !== "function") return false;
|
|
const fullKey = `${owner.name || "Owner"}:${key}`;
|
|
if (applied.has(fullKey) || owner.prototype[`__${key}Patched`]) return false;
|
|
patchFn(owner.prototype);
|
|
applied.add(fullKey);
|
|
owner.prototype[`__${key}Patched`] = true;
|
|
return true;
|
|
}
|
|
function patchWorld(key, patchFn) { return patchPrototype(key, global.World, patchFn); }
|
|
global.TarinaiPatcher = { patchPrototype, patchWorld, applied };
|
|
})(typeof window !== "undefined" ? window : globalThis);
|