mirror of
https://github.com/unanmed/HumanBreak.git
synced 2025-06-09 00:38:00 +08:00
fix: 捕捉 & 插件
This commit is contained in:
parent
284a16757b
commit
b1a28b6b3d
@ -325,10 +325,10 @@ core.prototype._loadPluginAsync = async function () {
|
|||||||
plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1
|
plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1
|
||||||
)) {
|
)) {
|
||||||
try {
|
try {
|
||||||
value.call(plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1);
|
value?.call(plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error(`Plugin '${key}' init fail. `);
|
console.error(`Plugin '${key}' init failed.`);
|
||||||
throw e;
|
console.error(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -1063,9 +1063,9 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = {
|
|||||||
if (v.x === x + dx * 2 && v.y === y + dy * 2) {
|
if (v.x === x + dx * 2 && v.y === y + dy * 2) {
|
||||||
const loc = `${x + dx},${y + dy}`;
|
const loc = `${x + dx},${y + dy}`;
|
||||||
this.setMapDamage(damage, loc, 0);
|
this.setMapDamage(damage, loc, 0);
|
||||||
|
damage[loc].ambush = damage[loc].ambush ?? [];
|
||||||
|
damage[loc].ambush.push(this);
|
||||||
}
|
}
|
||||||
damage[loc].ambush = damage[loc].ambush ?? [];
|
|
||||||
damage[loc].ambush.push(this);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -385,12 +385,17 @@ class MPlugin {
|
|||||||
|
|
||||||
static init() {
|
static init() {
|
||||||
for (const [key, data] of Object.entries(this.plugins)) {
|
for (const [key, data] of Object.entries(this.plugins)) {
|
||||||
if (data.type === 'content') {
|
try {
|
||||||
data.init?.(key, data.data);
|
if (data.type === 'content') {
|
||||||
} else {
|
data.init?.(key, data.data);
|
||||||
data.data = data.init!(key);
|
} else {
|
||||||
|
data.data = data.init!(key);
|
||||||
|
}
|
||||||
|
this.pluginData[key] = data.data;
|
||||||
|
} catch (e) {
|
||||||
|
console.error(`Plugin ${key} init failed.`);
|
||||||
|
console.error(e);
|
||||||
}
|
}
|
||||||
this.pluginData[key] = data.data;
|
|
||||||
}
|
}
|
||||||
this.inited = true;
|
this.inited = true;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user