mirror of
https://github.com/tobspr/shapez.io.git
synced 2026-03-02 03:39:21 +00:00
Only store changed properties for all components
This commit is contained in:
@@ -40,12 +40,6 @@ export class BeltComponent extends Component {
|
||||
return "Belt";
|
||||
}
|
||||
|
||||
static getSchema() {
|
||||
return {
|
||||
direction: types.string,
|
||||
};
|
||||
}
|
||||
|
||||
duplicateWithoutContents() {
|
||||
return new BeltComponent({ direction: this.direction });
|
||||
}
|
||||
|
||||
@@ -7,17 +7,6 @@ export class BeltUnderlaysComponent extends Component {
|
||||
return "BeltUnderlays";
|
||||
}
|
||||
|
||||
static getSchema() {
|
||||
return {
|
||||
underlays: types.array(
|
||||
types.structured({
|
||||
pos: types.vector,
|
||||
direction: types.enum(enumDirection),
|
||||
})
|
||||
),
|
||||
};
|
||||
}
|
||||
|
||||
duplicateWithoutContents() {
|
||||
const beltUnderlaysCopy = [];
|
||||
for (let i = 0; i < this.underlays.length; ++i) {
|
||||
|
||||
@@ -28,18 +28,6 @@ export class ItemAcceptorComponent extends Component {
|
||||
return "ItemAcceptor";
|
||||
}
|
||||
|
||||
static getSchema() {
|
||||
return {
|
||||
slots: types.array(
|
||||
types.structured({
|
||||
pos: types.vector,
|
||||
directions: types.array(types.enum(enumDirection)),
|
||||
filter: types.nullable(types.enum(enumItemType)),
|
||||
})
|
||||
),
|
||||
};
|
||||
}
|
||||
|
||||
duplicateWithoutContents() {
|
||||
const slotsCopy = [];
|
||||
for (let i = 0; i < this.slots.length; ++i) {
|
||||
|
||||
@@ -29,8 +29,6 @@ export class ItemEjectorComponent extends Component {
|
||||
return {
|
||||
slots: types.array(
|
||||
types.structured({
|
||||
pos: types.vector,
|
||||
direction: types.enum(enumDirection),
|
||||
item: types.nullable(types.obj(gItemRegistry)),
|
||||
progress: types.float,
|
||||
})
|
||||
|
||||
@@ -29,9 +29,6 @@ export class ItemProcessorComponent extends Component {
|
||||
static getSchema() {
|
||||
return {
|
||||
nextOutputSlot: types.uint,
|
||||
type: types.enum(enumItemProcessorTypes),
|
||||
inputsPerCharge: types.uint,
|
||||
|
||||
inputSlots: types.array(
|
||||
types.structured({
|
||||
item: types.obj(gItemRegistry),
|
||||
|
||||
@@ -15,7 +15,6 @@ export class MinerComponent extends Component {
|
||||
// cachedMinedItem is not serialized.
|
||||
return {
|
||||
lastMiningTime: types.ufloat,
|
||||
chainable: types.bool,
|
||||
itemChainBuffer: types.array(types.obj(gItemRegistry)),
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
import { Component } from "../component";
|
||||
|
||||
/**
|
||||
* Marks an entity as replaceable, so that when other buildings are placed above him it
|
||||
* simply gets deleted
|
||||
*/
|
||||
export class ReplaceableMapEntityComponent extends Component {
|
||||
static getId() {
|
||||
return "ReplaceableMapEntity";
|
||||
}
|
||||
|
||||
duplicateWithoutContents() {
|
||||
return new ReplaceableMapEntityComponent();
|
||||
}
|
||||
}
|
||||
@@ -6,6 +6,7 @@ import { enumDirection, Vector } from "../../core/vector";
|
||||
import { types } from "../../savegame/serialization";
|
||||
import { Component } from "../component";
|
||||
import { getBuildingDataFromCode } from "../building_codes";
|
||||
import { MetaBuilding } from "../meta_building";
|
||||
|
||||
export class StaticMapEntityComponent extends Component {
|
||||
static getId() {
|
||||
@@ -15,7 +16,6 @@ export class StaticMapEntityComponent extends Component {
|
||||
static getSchema() {
|
||||
return {
|
||||
origin: types.tileVector,
|
||||
tileSize: types.tileVector,
|
||||
rotation: types.float,
|
||||
originalRotation: types.float,
|
||||
|
||||
@@ -56,6 +56,14 @@ export class StaticMapEntityComponent extends Component {
|
||||
return getBuildingDataFromCode(this.code).silhouetteColor;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the meta building
|
||||
* @returns {MetaBuilding}
|
||||
*/
|
||||
getMetaBuilding() {
|
||||
return getBuildingDataFromCode(this.code).metaInstance;
|
||||
}
|
||||
|
||||
duplicateWithoutContents() {
|
||||
return new StaticMapEntityComponent({
|
||||
origin: this.origin.copy(),
|
||||
|
||||
@@ -12,10 +12,8 @@ export class StorageComponent extends Component {
|
||||
|
||||
static getSchema() {
|
||||
return {
|
||||
maximumStorage: types.uint,
|
||||
storedCount: types.uint,
|
||||
storedItem: types.nullable(types.obj(gItemRegistry)),
|
||||
overlayOpacity: types.ufloat,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -26,9 +26,7 @@ export class UndergroundBeltComponent extends Component {
|
||||
|
||||
static getSchema() {
|
||||
return {
|
||||
mode: types.enum(enumUndergroundBeltMode),
|
||||
pendingItems: types.array(types.pair(types.obj(gItemRegistry), types.float)),
|
||||
tier: types.uint,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
import { Component } from "../component";
|
||||
|
||||
export class UnremovableComponent extends Component {
|
||||
static getId() {
|
||||
return "Unremovable";
|
||||
}
|
||||
|
||||
static getSchema() {
|
||||
return {};
|
||||
}
|
||||
|
||||
duplicateWithoutContents() {
|
||||
return new UnremovableComponent();
|
||||
}
|
||||
}
|
||||
@@ -29,17 +29,6 @@ export class WiredPinsComponent extends Component {
|
||||
return "WiredPins";
|
||||
}
|
||||
|
||||
static getSchema() {
|
||||
return {
|
||||
slots: types.array(
|
||||
types.structured({
|
||||
pos: types.vector,
|
||||
type: types.enum(enumPinSlotType),
|
||||
})
|
||||
),
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {object} param0
|
||||
|
||||
Reference in New Issue
Block a user