Skip to content

Commit

Permalink
导入productive数据计算增产模式
Browse files Browse the repository at this point in the history
  • Loading branch information
huww98 committed May 26, 2024
1 parent 644a510 commit 2a21748
Show file tree
Hide file tree
Showing 8 changed files with 832 additions and 181 deletions.
4 changes: 3 additions & 1 deletion src/blueprint/parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -766,6 +766,7 @@ const parameterParsers = new Map<number, ParamParser<AllParameters>>([
[2316, advancedMiningMachineParamParser()],
[2020, splitterParamParser],
[2901, labParamParser],
[2902, labParamParser],
[2001, beltParamParser],
[2002, beltParamParser],
[2003, beltParamParser],
Expand All @@ -785,7 +786,8 @@ const parameterParsers = new Map<number, ParamParser<AllParameters>>([
[2107, dispenserParamParser],
]);
for (const id of allAssemblers) {
parameterParsers.set(id, assembleParamParser);
if (!parameterParsers.has(id))
parameterParsers.set(id, assembleParamParser);
}

function parserFor(itemId: number) {
Expand Down
30 changes: 23 additions & 7 deletions src/components/BuildingInfoPanel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ import {
isEjector, isEnergyExchanger, isArtificialStar, isRayReciver, isMonitor, isSplitter,
isBattleBase, isDispenser,
} from '@/data/items';
import { recipesMap } from '@/data';
import { commandQueueKey } from '@/define';
import BuildingRecipe from './BuildingRecipe.vue';
Expand Down Expand Up @@ -133,14 +134,29 @@ const LabModeText = computed(() => {
const mode = (props.building.parameters as LabParamerters).researchMode;
return t(labModeTexts.get(mode)!);
})
const productive = computed(() => {
const recipeId = props.building.recipeId;
if (recipeId === 0)
return undefined;
const recipe = recipesMap.get(recipeId)!;
if (recipe.nonProductive)
return false;
let p = true;
for (const i of recipe.to)
p &&= i.item.productive === true;
return p;
})
const accModeText = computed(() => {
const itemId = props.building.itemId
if (isLab(itemId) && (props.building!.parameters as LabParamerters).researchMode === ResearchMode.Compose ||
allAssemblers.has(itemId)) {
const mode = (props.building!.parameters as AssembleParamerters).acceleratorMode;
return t(accModeTexts.get(mode)!);
}
return undefined;
if (!allAssemblers.has(props.building.itemId))
return undefined;
const p = productive.value;
if (p === undefined)
return undefined;
let mode = AcceleratorMode.Accelerate;
if (p)
mode = (props.building!.parameters as AssembleParamerters).acceleratorMode;
return t(accModeTexts.get(mode)!);
})
const beltVersion = ref(0);
Expand Down
8 changes: 7 additions & 1 deletion src/data/gen_items.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,13 @@ def main():
g = d['GridIndex']
if g == 0:
continue
sys.stdout.write(f" {{id: {d['ID']}, models: [{models}], name: '{d['Name']}', icon: '{icon}', grid: [{g // 1000}, {(g // 100) % 10}, {g % 100}]}},\n")
sys.stdout.write( " {\n")
sys.stdout.write( f" id: {d['ID']}, models: [{models}], grid: [{g // 1000}, {(g // 100) % 10}, {g % 100}],\n")
sys.stdout.write( f" name: '{d['Name']}', icon: '{icon}',\n")
if d['Productive']:
sys.stdout.write(f" productive: true,\n")
sys.stdout.write( " },\n")

sys.stdout.write('];\n')

if __name__ == '__main__':
Expand Down
2 changes: 2 additions & 0 deletions src/data/gen_recipes.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ def main():
if d['IconPath']:
icon = d['IconPath'].split('/')[-1]
sys.stdout.write(f" icon: '{icon}',\n")
if d['NonProductive']:
sys.stdout.write(f" nonProductive: true,\n")
sys.stdout.write( " },\n")
sys.stdout.write('];\n')

Expand Down
2 changes: 2 additions & 0 deletions src/data/items.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,4 +83,6 @@ export const allAssemblers = new Set([
2309, // 化工厂
2317,
2310, // 对撞机
2901, // 研究站
2902,
]);
960 changes: 788 additions & 172 deletions src/data/itemsData.ts

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions src/data/recipesData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -452,6 +452,7 @@ export const recipes: Recipe[] = [
{item: itemsMap.get(1121)!, count: 5},
],
grid: [1, 5, 7],
nonProductive: true,
},
{
id: 41, name: '氘核燃料棒', time: 720,
Expand Down Expand Up @@ -501,6 +502,7 @@ export const recipes: Recipe[] = [
{item: itemsMap.get(1803)!, count: 2},
],
grid: [1, 6, 11],
nonProductive: true,
},
{
id: 45, name: '制造台 Mk.I', time: 120,
Expand Down Expand Up @@ -667,6 +669,7 @@ export const recipes: Recipe[] = [
],
grid: [1, 2, 7],
icon: 'X-ray',
nonProductive: true,
},
{
id: 59, name: '高纯硅块', time: 120,
Expand Down Expand Up @@ -851,6 +854,7 @@ export const recipes: Recipe[] = [
],
grid: [1, 7, 8],
icon: 'photon-formula',
nonProductive: true,
},
{
id: 75, name: '宇宙矩阵', time: 900,
Expand Down Expand Up @@ -1401,6 +1405,7 @@ export const recipes: Recipe[] = [
],
grid: [1, 3, 7],
icon: 'reforming-refine',
nonProductive: true,
},
{
id: 122, name: '物流配送器', time: 480,
Expand Down
2 changes: 2 additions & 0 deletions src/data/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ export interface Item {
icon: string;
/** page, row, column */
grid: [number, number, number];
productive?: boolean;
}

export interface ItemStack {
Expand All @@ -22,6 +23,7 @@ export interface Recipe {
to: ItemStack[];
/** page, row, column */
grid: [number, number, number];
nonProductive?: boolean;
}

export interface Tech {
Expand Down

0 comments on commit 2a21748

Please sign in to comment.