-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
272 additions
and
115 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ Author: Alexey Usov ([email protected], 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, | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ | |
Author: Alexey Usov ([email protected], https://github.com/doubleaxe) | ||
Please don't remove this comment if you use unmodified file | ||
*/ | ||
import type {GameItemType} from '#types/contants'; | ||
import type {GameItem} from '#types/game-data'; | ||
import {type InjectionKey, provide, reactive, inject} from 'vue'; | ||
import type {GameData} from './data'; | ||
|
@@ -13,6 +14,7 @@ class Filter { | |
private _tierEqual = 0; | ||
private _groupTier = true; | ||
private _key?: string; | ||
private _type?: GameItemType; | ||
private _direction = 0; | ||
private _filtered?: GameItem[][]; | ||
|
||
|
@@ -32,6 +34,9 @@ class Filter { | |
get key() { return this._key; } | ||
set key(key: string | undefined) { this._key = key; this._filtered = undefined; } | ||
|
||
get type() { return this._type; } | ||
set type(type: GameItemType | undefined) { this._type = type; this._filtered = undefined; } | ||
|
||
get direction() { return this._direction; } | ||
set direction(direction: number) { this._direction = direction; this._filtered = undefined; } | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
Author: Alexey Usov ([email protected], https://github.com/doubleaxe) | ||
Please don't remove this comment if you use unmodified file | ||
*/ | ||
import type {RecipeIOModel} from './model/store'; | ||
import type {RecipeIOModel, TransportModel} from './model/store'; | ||
|
||
const decimals = 3; | ||
const upperPrefixes = ['k', 'M', 'G', 'T', 'P', 'E', 'Z', 'Y', 'R', 'Q']; | ||
|
@@ -49,3 +49,10 @@ export function formatIo(n: number | undefined, io: RecipeIOModel) { | |
const format = io.formatCountPerSecond(n); | ||
return formatNumber(format.count, format.unit); | ||
} | ||
|
||
export function formatTransport(n: number | undefined, transport: TransportModel) { | ||
if(n === undefined) | ||
return ''; | ||
const format = transport.formatCountPerSecond(n); | ||
return formatNumber(format.count, format.unit); | ||
} |
Oops, something went wrong.