Skip to content

Commit

Permalink
station keepMode and *AutoReplenish
Browse files Browse the repository at this point in the history
  • Loading branch information
huww98 committed Dec 30, 2023
1 parent 2eb36ef commit 3bb8e92
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 3 deletions.
10 changes: 10 additions & 0 deletions src/blueprint/parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,8 @@ export interface StationParameters {
max: number;
localLogic: LogisticRole;
remoteLogic: LogisticRole;
// 0: 不锁定,否则将库存容量锁定为max/keepMode
keepMode: number;
}[];
slots: {
dir: IODir;
Expand All @@ -202,6 +204,8 @@ export interface StationParameters {
deliveryAmountOfDrones: number;
deliveryAmountOfShips: number;
pilerCount: number;
droneAutoReplenish: boolean;
shipAutoReplenish: boolean;
}
export interface AdvancedMiningMachineParameters extends StationParameters {
miningSpeed: number;
Expand All @@ -226,6 +230,8 @@ function stationParamsParser(desc: typeof stationDesc): ParamParser<StationParam
setParam(a, base + 6, p.deliveryAmountOfDrones);
setParam(a, base + 7, p.deliveryAmountOfShips);
setParam(a, base + 8, p.pilerCount);
setParam(a, base + 10, p.droneAutoReplenish ? 1 : 0);
setParam(a, base + 11, p.shipAutoReplenish ? 1 : 0);
{
const {base, stride} = stationParamsMeta.storage;
for (let i = 0; i < desc.maxItemKind; i++) {
Expand All @@ -234,6 +240,7 @@ function stationParamsParser(desc: typeof stationDesc): ParamParser<StationParam
setParam(a, base + i * stride + 1, s.localLogic);
setParam(a, base + i * stride + 2, s.remoteLogic);
setParam(a, base + i * stride + 3, s.max);
setParam(a, base + i * stride + 4, s.keepMode);
}
} {
const {base, stride} = stationParamsMeta.slots;
Expand All @@ -258,6 +265,8 @@ function stationParamsParser(desc: typeof stationDesc): ParamParser<StationParam
deliveryAmountOfDrones: getParam(a, base + 6),
deliveryAmountOfShips: getParam(a, base + 7),
pilerCount: getParam(a, base + 8),
droneAutoReplenish: getParam(a, base + 10) > 0,
shipAutoReplenish: getParam(a, base + 11) > 0,
};
{
const {base, stride} = stationParamsMeta.storage;
Expand All @@ -267,6 +276,7 @@ function stationParamsParser(desc: typeof stationDesc): ParamParser<StationParam
localLogic: getParam(a, base + i * stride + 1),
remoteLogic: getParam(a, base + i * stride + 2),
max: getParam(a, base + i * stride + 3),
keepMode: getParam(a, base + i * stride + 4),
});
}
} {
Expand Down
5 changes: 5 additions & 0 deletions src/components/BuildingInfoPanel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,11 @@ const capacityForAutomation = computed(() => {

<style lang="scss">
.building-params {
margin-bottom: 20px;
h3 {
margin-bottom: 0;
}
>div, .p {
display: flex;
flex-direction: row;
Expand Down
3 changes: 3 additions & 0 deletions src/components/RecipeSelect.vue
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ const selected = (i: Recipe | null) => {
<style lang="scss">
.icon-select {
cursor: pointer;
.icon {
display: block;
}
}
.icon-placeholder {
Expand Down
19 changes: 16 additions & 3 deletions src/components/StationInfo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@
<ItemSelect :item-id="s.itemId > 0 ? s.itemId : null"
@update:item-id="itemId => setItemId(i, itemId)"/>
<template v-if="s.itemId > 0">
<div class="num"><label>{{ t('货物上限') }}</label> {{s.max}}</div>
<div class="num">
<div><label>{{ t('当前货物数') }}</label> {{s.keepMode > 0 ? s.max/s.keepMode : 0}}</div>
<div><label>{{ t('货物上限') }}</label> {{s.max}}</div>
</div>
<div>
<div class="role" :class="roleClass.get(s.localLogic)">{{ t('本地' + roleText.get(s.localLogic)) }}</div>
<div v-if="inter" class="role" :class="roleClass.get(s.remoteLogic)">{{ t('星际' + roleText.get(s.remoteLogic)) }}</div>
Expand All @@ -13,6 +16,11 @@
<div class="placeholder" v-else>{{ t('空栏位') }}</div>
</div>
</template>
<div class="building-params" v-if="!collector">
<h3>{{ t('自动补充提示') }}</h3>
<div><label>{{ t('物流运输机') }}</label><span class="v">{{ truth(p.droneAutoReplenish) }}</span></div>
<div v-if="inter"><label>{{ t('星际物流运输船') }}</label><span class="v">{{ truth(p.shipAutoReplenish) }}</span></div>
</div>
<div class="building-params">
<div v-if="!collector"><label>{{t('最大充能功率')}}</label><span class="v">{{(p.workEnergyPerTick * 60 / 1_000_000).toLocaleString([], { minimumFractionDigits: 1, maximumFractionDigits: 1 })}} MW</span></div>
<div v-if="!collector"><label>{{t('运输机最远路程')}}</label><span class="v">{{(Math.acos(p.tripRangeOfDrones) / Math.PI * 180.0).toLocaleString([], { maximumFractionDigits: 0 })}}°</span></div>
Expand Down Expand Up @@ -149,10 +157,15 @@ const truth = (v: boolean) => v ? '✓' : '✗';
flex-direction: row;
align-items: center;
margin: 10px 0;
gap: 10px;
.num {
margin-left: 5px;
margin-right: auto;
flex: auto;
>div {
display: flex;
flex-direction: row;
justify-content: space-between;
}
}
.role {
Expand Down
2 changes: 2 additions & 0 deletions src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@
"图标布局": "Icon Layout",
"增产剂效果简": "Proliferator effect",
"建筑公式": "Buildings",
"当前货物数": "Current",
"待机": "Idle",
"放电": "Discharge",
"星际仓储": "Remote storage",
Expand All @@ -216,6 +217,7 @@
"缩略图文字": "Thumbnail Text",
"翘曲器必要性": " Warpers required",
"自动化容量限制": "Limit for Automation Input",
"自动补充提示": "Automatically deploy transport devices",
"蓝图介绍": "Blueprint Description",
"蓝图代码": "Blueprint code",
"货物上限": "Limit",
Expand Down
2 changes: 2 additions & 0 deletions src/locales/zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@
"图标布局": "图标布局",
"增产剂效果简": "增产效果",
"建筑公式": "建筑",
"当前货物数": "当前",
"待机": "待机",
"放电": "放电",
"星际仓储": "星际仓储",
Expand All @@ -216,6 +217,7 @@
"缩略图文字": "缩略图文字",
"翘曲器必要性": " 翘曲器必备",
"自动化容量限制": "自动化输入限制",
"自动补充提示": "自动补充运输单位",
"蓝图介绍": "蓝图介绍",
"蓝图代码": "蓝图代码",
"货物上限": "上限",
Expand Down

0 comments on commit 3bb8e92

Please sign in to comment.