diff --git a/src/blueprint/parser.ts b/src/blueprint/parser.ts index 23f7d35..e9daa62 100644 --- a/src/blueprint/parser.ts +++ b/src/blueprint/parser.ts @@ -425,20 +425,48 @@ const tankParamParser: ParamParser = { }, } +export enum StorageType { + DEFAULT = 0, + FILTERED = 9, +} +export interface StorageGrid { + filter: number; +} export interface StorageParameters { - automationLimit: number + automationLimit: number; + type: StorageType; + grids: StorageGrid[]; } -const storageParamParser: ParamParser = { - encodedSize() { return 1; }, - encode(p, a) { - setParam(a, 0, p.automationLimit); - }, - decode(a) { - return { - automationLimit: getParam(a, 0), - }; - }, +function storageParamParser(size: number): ParamParser{ + return { + encodedSize() { + const s = 10 + size; + if (s < 110) + return 110; + return s; + }, + encode(p, a) { + setParam(a, 0, p.automationLimit); + setParam(a, 1, p.type); + for (let i = 0; i < size; i++) { + setParam(a, 10 + i, p.grids[i].filter); + } + }, + decode(a) { + const grids: StorageGrid[] = []; + for (let i = 0; i < size; i++) { + grids.push({ + filter: getParam(a, 10 + i, 0), + }); + } + return { + automationLimit: getParam(a, 0), + type: getParam(a, 1, StorageType.DEFAULT), + grids, + }; + }, + } } export interface EjectorParameters { @@ -631,8 +659,8 @@ const parameterParsers = new Map>([ [2011, inserterParamParser], [2012, inserterParamParser], [2013, inserterParamParser], - [2101, storageParamParser], - [2102, storageParamParser], + [2101, storageParamParser(30)], + [2102, storageParamParser(60)], [2106, tankParamParser], [2311, ejectorParamParser], [2208, powerGeneratorParamParser], diff --git a/src/components/BuildingIcon.vue b/src/components/BuildingIcon.vue index 39a026a..fdfbf0b 100644 --- a/src/components/BuildingIcon.vue +++ b/src/components/BuildingIcon.vue @@ -26,7 +26,6 @@ watchEffect(async () => { .icon { display: inline-block; position: relative; - height: 2.5rem; width: 2.5rem; &.has-count { @@ -34,8 +33,8 @@ watchEffect(async () => { } img { - height: 100%; width: 100%; + display: block; } .count { diff --git a/src/components/BuildingInfoPanel.vue b/src/components/BuildingInfoPanel.vue index 0f7669c..1e8d917 100644 --- a/src/components/BuildingInfoPanel.vue +++ b/src/components/BuildingInfoPanel.vue @@ -5,6 +5,7 @@ +
@@ -22,10 +23,6 @@ {{ (bParams as InserterParameters).length }}
-
- - {{ capacityForAutomation }} -