Fix crash regarding blueprints being copied wrong

This commit is contained in:
tobspr 2020-05-28 13:49:50 +02:00
parent f33473b77a
commit 2a4ee8e784
4 changed files with 34 additions and 12 deletions

View File

@ -83,7 +83,7 @@ export const globalConfig = {
debug: {
/* dev:start */
// fastGameEnter: true,
fastGameEnter: true,
// noArtificialDelays: true,
// disableSavegameWrite: true,
// showEntityBounds: true,
@ -100,7 +100,7 @@ export const globalConfig = {
// testClipping: true,
// framePausesBetweenTicks: 40,
// testTranslations: true,
// enableEntityInspector: true,
enableEntityInspector: true,
// testAds: true,
// disableMapOverview: true,
disableTutorialHints: true,

View File

@ -49,17 +49,35 @@ function stringPolyfills() {
}
function objectPolyfills() {
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/entries
// @ts-ignore
if (!Object.entries) {
// @ts-ignore
Object.entries = function (obj) {
var ownProps = Object.keys(obj),
i = ownProps.length,
resArray = new Array(i); // preallocate the Array
while (i--) resArray[i] = [ownProps[i], obj[ownProps[i]]];
// https://github.com/tc39/proposal-object-values-entries/blob/master/polyfill.js
return resArray;
// @ts-ignore
const reduce = Function.bind.call(Function.call, Array.prototype.reduce);
// @ts-ignore
const isEnumerable = Function.bind.call(Function.call, Object.prototype.propertyIsEnumerable);
// @ts-ignore
const concat = Function.bind.call(Function.call, Array.prototype.concat);
const keys = Reflect.ownKeys;
// @ts-ignore
if (!Object.values) {
// @ts-ignore
Object.values = function values(O) {
return reduce(
keys(O),
(v, k) => concat(v, typeof k === "string" && isEnumerable(O, k) ? [O[k]] : []),
[]
);
};
}
if (!Object.entries) {
Object.entries = function entries(O) {
return reduce(
keys(O),
(e, k) => concat(e, typeof k === "string" && isEnumerable(O, k) ? [[k, O[k]]] : []),
[]
);
};
}
}

View File

@ -61,6 +61,7 @@ export class ItemAcceptorComponent extends Component {
slotsCopy.push({
pos: slot.pos.copy(),
directions: slot.directions.slice(),
filter: slot.filter,
});
}

View File

@ -26,6 +26,9 @@ export class HUDEntityDebugger extends BaseHUDPart {
update() {
const mousePos = this.root.app.mousePosition;
if (!mousePos) {
return;
}
const worldPos = this.root.camera.screenToWorld(mousePos);
const worldTile = worldPos.toTileSpace();