1
0
mirror of https://github.com/tobspr/shapez.io.git synced 2024-10-27 20:34:29 +00:00

Minor fixes

This commit is contained in:
tobspr 2020-10-08 10:41:06 +02:00
parent c65c955984
commit 7b01db5dae
8 changed files with 1658 additions and 1642 deletions

View File

@ -7,6 +7,7 @@ import { BeltComponent } from "../components/belt";
import { Entity } from "../entity";
import { MetaBuilding } from "../meta_building";
import { GameRoot } from "../root";
import { THEME } from "../theme";
export const arrayBeltVariantToRotation = [enumDirection.top, enumDirection.left, enumDirection.right];
@ -22,7 +23,7 @@ export class MetaBeltBuilding extends MetaBuilding {
}
getSilhouetteColor() {
return "#777";
return THEME.map.chunkOverview.beltColor;
}
getPlacementSound() {

View File

@ -26,7 +26,7 @@ export class ItemEjectorComponent extends Component {
static getSchema() {
// The cachedDestSlot, cachedTargetEntity fields are not serialized.
return {
slots: types.array(
slots: types.fixedSizeArray(
types.structured({
item: types.nullable(typeItemSingleton),
progress: types.float,

View File

@ -31,7 +31,7 @@ export class WiredPinsComponent extends Component {
static getSchema() {
return {
slots: types.array(
slots: types.fixedSizeArray(
types.structured({
value: types.nullable(typeItemSingleton),
})

View File

@ -32,7 +32,8 @@
},
"chunkOverview": {
"empty": "#444856",
"filled": "#646b7d"
"filled": "#646b7d",
"beltColor": "#9096a3"
},
"wires": {

View File

@ -33,7 +33,8 @@
"chunkOverview": {
"empty": "#a6afbb",
"filled": "#c5ccd6"
"filled": "#c5ccd6",
"beltColor": "#777"
},
"wires": {

View File

@ -96,6 +96,13 @@ export const types = {
return new TypeArray(innerType);
},
/**
* @param {BaseDataType} innerType
*/
fixedSizeArray(innerType) {
return new TypeArray(innerType, true);
},
/**
* @param {SingletonFactoryTemplate<*>} innerType
*/

View File

@ -122,7 +122,7 @@ export class BaseDataType {
"serialization verify failed: " +
errorCode +
" [value " +
JSON.stringify(value).substr(0, 100) +
(JSON.stringify(value) || "").substr(0, 100) +
"]"
);
}
@ -859,8 +859,9 @@ export class TypeArray extends BaseDataType {
/**
* @param {BaseDataType} innerType
*/
constructor(innerType) {
constructor(innerType, fixedSize = false) {
super();
this.fixedSize = fixedSize;
this.innerType = innerType;
}
@ -887,7 +888,9 @@ export class TypeArray extends BaseDataType {
targetObject[targetKey] = destination = new Array(value.length);
}
for (let i = 0; i < value.length; ++i) {
const size = this.fixedSize ? Math.min(value.length, destination.length) : value.length;
for (let i = 0; i < size; ++i) {
const errorStatus = this.innerType.deserializeWithVerify(value[i], destination, i, root);
if (errorStatus) {
return errorStatus;

View File

@ -80,8 +80,11 @@ export class SerializerInternal {
for (const componentId in data) {
if (!entity.components[componentId]) {
if (G_IS_DEV && !globalConfig.debug.disableSlowAsserts) {
// @ts-ignore
if (++window.componentWarningsShown < 100) {
logger.warn("Entity no longer has component:", componentId);
}
}
continue;
}