1
0
mirror of https://github.com/tobspr/shapez.io.git synced 2025-12-13 10:11:50 +00:00

Merge branch 'modloader' of github.com:tobspr/shapez.io into modloader

This commit is contained in:
tobspr 2022-02-01 14:00:02 +01:00
commit b11ac4977f
2 changed files with 15 additions and 8 deletions

View File

@ -94,11 +94,12 @@ export class HUDEntityDebugger extends BaseHUDPart {
<div>`;
for (const property in val) {
const isRoot = val[property] == this.root;
const isRecursive = recursion.includes(val[property]);
let hiddenValue = isRoot ? "<root>" : null;
if (isRecursive) {
let hiddenValue = null;
if (val[property] == this.root) {
hiddenValue = "<root>";
} else if (val[property] instanceof Node) {
hiddenValue = `<${val[property].constructor.name}>`;
} else if (recursion.includes(val[property])) {
// Avoid recursion by not "expanding" object more than once
hiddenValue = "<recursion>";
}

View File

@ -31,6 +31,12 @@ import { BaseHUDPart } from "../game/hud/base_hud_part";
* @typedef {{new(...args: any[]): any, prototype: any}} constructable
*/
/**
* @template {(...args: any) => any} F The function
* @template {object} T The value of this
* @typedef {(this: T, ...args: Parameters<F>) => ReturnType<F>} bindThis
*/
/**
* @template {(...args: any[]) => any} F
* @template P
@ -400,7 +406,7 @@ export class ModInterface {
* @template {extendsPrams<P[M]>} O the method that will override the old one
* @param {C} classHandle
* @param {M} methodName
* @param {beforePrams<O, P[M]>} override
* @param {bindThis<beforePrams<O, P[M]>, InstanceType<C>>} override
*/
replaceMethod(classHandle, methodName, override) {
const oldMethod = classHandle.prototype[methodName];
@ -418,7 +424,7 @@ export class ModInterface {
* @template {extendsPrams<P[M]>} O the method that will run before the old one
* @param {C} classHandle
* @param {M} methodName
* @param {O} executeBefore
* @param {bindThis<O, InstanceType<C>>} executeBefore
*/
runBeforeMethod(classHandle, methodName, executeBefore) {
const oldHandle = classHandle.prototype[methodName];
@ -437,7 +443,7 @@ export class ModInterface {
* @template {extendsPrams<P[M]>} O the method that will run before the old one
* @param {C} classHandle
* @param {M} methodName
* @param {O} executeAfter
* @param {bindThis<O, InstanceType<C>>} executeAfter
*/
runAfterMethod(classHandle, methodName, executeAfter) {
const oldHandle = classHandle.prototype[methodName];