diff --git a/README.md b/README.md index bbe36b4..70e0cd4 100644 --- a/README.md +++ b/README.md @@ -36,7 +36,6 @@ Query string `?gameId=` may be added to quickly open desired game, for exa # TODO list -- Conveyors/Robotic arms/Pipes/etc.. support for link - Color/Icon states for link and item (overflow, underflow, warning, etc..) - Move/Delete entire blueprint, production chain or multiple factories (selection, edit) - Apply counts calculated in locked mode to current factories diff --git a/data/evospace/calculator/calculator.ts b/data/evospace/calculator/calculator.ts index 738c83e..98473c1 100644 --- a/data/evospace/calculator/calculator.ts +++ b/data/evospace/calculator/calculator.ts @@ -3,7 +3,7 @@ Author: Alexey Usov (dax@xdax.ru, https://github.com/doubleaxe) Please don't remove this comment if you use unmodified file */ import type {Calculator} from '#types/calculator'; -import type {GameRecipeDictionary} from '#types/game-data'; +import type {FromatCountPerSecond, GameItem, GameRecipeDictionary} from '#types/game-data'; import {GameItemType} from '#types/contants'; import {GameRecipeDictionaryExData, GameRecipeIOType} from '../types/custom-game-data'; @@ -48,8 +48,8 @@ export function useCalculator(): Calculator { return (io.count * unitMul * Math.pow(1.5, tierDiff) * TICKS_PER_SECOND) / io.recipe.time; }; - const formatCountPerSecond: Calculator['formatCountPerSecond'] = function(io, count) { - const productType = io.product.type; + function formatCount(item: GameItem, count: number): FromatCountPerSecond { + const productType = item.type; if(productType == GameItemType.Energy) { //energy measured in Watts, 1 Resource Item [R] * 20 = 20 Watt count *= 20; @@ -62,6 +62,14 @@ export function useCalculator(): Calculator { count, unit: 'ps', }; + } + + const formatCountPerSecond: Calculator['formatCountPerSecond'] = function(io, count) { + return formatCount(io.product, count); + }; + + const formatTransportFlow: Calculator['formatTransportFlow'] = function(transport, flow) { + return formatCount(transport.item, flow); }; const isCommonIo: Calculator['isCommonIo'] = function(io) { @@ -73,6 +81,7 @@ export function useCalculator(): Calculator { return { getCountPerSecond, formatCountPerSecond, + formatTransportFlow, isCommonIo, }; } diff --git a/data/evospace/static/custom-data.ts b/data/evospace/static/custom-data.ts index f6a1bf6..5c2e847 100644 --- a/data/evospace/static/custom-data.ts +++ b/data/evospace/static/custom-data.ts @@ -2,6 +2,7 @@ import type {GameLogisticSerialized} from '#types/game-data-serialized'; export const logistic: GameLogisticSerialized[] = [{ name: 'RobotArm90', + label: 'Robot Arm 90°', items: [{ name: 'AnySolidStaticItem', }], @@ -38,6 +39,7 @@ export const logistic: GameLogisticSerialized[] = [{ stackable: true, }, { name: 'RobotArm180', + label: 'Robot Arm 180°', items: [{ name: 'AnySolidStaticItem', }], diff --git a/data/sample/calculator/calculator.ts b/data/sample/calculator/calculator.ts index 521b30a..7236861 100644 --- a/data/sample/calculator/calculator.ts +++ b/data/sample/calculator/calculator.ts @@ -5,17 +5,25 @@ Please don't remove this comment if you use unmodified file import type { Calculator, } from '#types/calculator'; +import type {FromatCountPerSecond, GameItem} from '#types/game-data'; export function useCalculator(): Calculator { const getCountPerSecond: Calculator['getCountPerSecond'] = function(item, io) { return io.count * (item.recipe?.tier || 1) / io.recipe.time; }; - const formatCountPerSecond: Calculator['formatCountPerSecond'] = function(io, count) { + function formatCount(item: GameItem, count: number): FromatCountPerSecond { return { count, - unit: (io.product.name == 'R') ? 'W' : 'ps', + unit: (item.name == 'R') ? 'W' : 'ps', }; + } + const formatCountPerSecond: Calculator['formatCountPerSecond'] = function(io, count) { + return formatCount(io.product, count); + }; + + const formatTransportFlow: Calculator['formatTransportFlow'] = function(transport, flow) { + return formatCount(transport.item, flow); }; const isCommonIo: Calculator['isCommonIo'] = function(io) { @@ -25,6 +33,7 @@ export function useCalculator(): Calculator { return { getCountPerSecond, formatCountPerSecond, + formatTransportFlow, isCommonIo, }; } diff --git a/site/data/types/calculator.ts b/site/data/types/calculator.ts index 14b397e..ffc43ca 100644 --- a/site/data/types/calculator.ts +++ b/site/data/types/calculator.ts @@ -6,11 +6,13 @@ Please don't remove this comment if you use unmodified file import type { FromatCountPerSecond, GameItem, + GameLogisticTransport, GameRecipeIO, } from './game-data'; export interface Calculator { getCountPerSecond: (item: GameItem, io: GameRecipeIO) => number; formatCountPerSecond: (io: GameRecipeIO, count: number) => FromatCountPerSecond; + formatTransportFlow: (transport: GameLogisticTransport, flow: number) => FromatCountPerSecond; isCommonIo: (io: GameRecipeIO) => boolean; } diff --git a/site/data/types/game-data-serialized.ts b/site/data/types/game-data-serialized.ts index f6e654b..a9523b2 100644 --- a/site/data/types/game-data-serialized.ts +++ b/site/data/types/game-data-serialized.ts @@ -85,6 +85,7 @@ export interface GameLogisticTransportSerialized { export interface GameLogisticSerialized { name: string; longName?: string; + label?: string; items: GameLogisticItemSerialized[]; transport: GameLogisticTransportSerialized[]; time: number; diff --git a/site/data/types/game-data.ts b/site/data/types/game-data.ts index 790b9c9..9d5e8e1 100644 --- a/site/data/types/game-data.ts +++ b/site/data/types/game-data.ts @@ -68,6 +68,7 @@ export interface GameLogisticTransportRaw extends GameLogisticTransportSerialize logistic: GameLogistic; item: GameItem; countPerSecond: number; + formatCountPerSecond: (count: number) => FromatCountPerSecond; } export type GameLogisticTransport = Readonly; diff --git a/site/src/components/main-panel/link-menu.vue b/site/src/components/main-panel/link-menu.vue index 8814feb..2ef89a0 100644 --- a/site/src/components/main-panel/link-menu.vue +++ b/site/src/components/main-panel/link-menu.vue @@ -4,7 +4,7 @@ Please don't remove this comment if you use unmodified file -->