@terrafirmagreg-team/recipe 1.2.32 → 1.2.34
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +4 -4
- package/src/components/cards/card/strip.tsx +1 -0
- package/src/components/cards/card/text.tsx +2 -9
- package/src/components/cards/scroll-card/index.tsx +2 -7
- package/src/components/cards/slot-hitbox.tsx +2 -4
- package/src/components/cards/strip-card/member-cell.tsx +1 -1
- package/src/components/views/browser/type-tabs.tsx +10 -4
- package/src/components/views/calc/calculator/index.tsx +3 -2
- package/src/components/views/calc/node-card/full.tsx +20 -5
- package/src/hooks/calc/use-actions.ts +23 -5
- package/src/hooks/calc/use-far-mode.ts +2 -2
- package/src/hooks/calc/use-view-mode.ts +1 -1
- package/src/hooks/use-panel-cells.ts +2 -0
- package/src/lib/browser/lookup.ts +23 -2
- package/src/lib/browser/panel.ts +19 -6
- package/styles/calc.css +0 -6
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@terrafirmagreg-team/recipe",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.34",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Recipe viewer and calculator",
|
|
6
6
|
"license": "LGPL-3.0-only",
|
|
@@ -25,13 +25,13 @@
|
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"@terrafirmagreg-team/data": "^1.2.14",
|
|
27
27
|
"@terrafirmagreg-team/dump": "^1.2.25",
|
|
28
|
-
"@terrafirmagreg-team/game": "^1.2.
|
|
29
|
-
"@terrafirmagreg-team/kit": "^1.2.
|
|
28
|
+
"@terrafirmagreg-team/game": "^1.2.15",
|
|
29
|
+
"@terrafirmagreg-team/kit": "^1.2.33",
|
|
30
30
|
"@terrafirmagreg-team/mdx": "^1.2.14",
|
|
31
31
|
"@terrafirmagreg-team/preview": "^1.2.12",
|
|
32
32
|
"@terrafirmagreg-team/sites": "^1.2.5",
|
|
33
33
|
"@terrafirmagreg-team/translate": "^1.2.14",
|
|
34
|
-
"@terrafirmagreg-team/ui": "^1.2.
|
|
34
|
+
"@terrafirmagreg-team/ui": "^1.2.25",
|
|
35
35
|
"@types/pathfinding": "^0.1.0",
|
|
36
36
|
"comlink": "^4.4.2",
|
|
37
37
|
"fflate": "0.8.3",
|
|
@@ -111,6 +111,7 @@ export function CardStrip({
|
|
|
111
111
|
top: widget.y * scale,
|
|
112
112
|
width: widget.w * scale,
|
|
113
113
|
height: widget.h * scale,
|
|
114
|
+
backgroundColor: 'var(--color-mc-inset)',
|
|
114
115
|
backgroundImage: `url(${widgetsUrl})`,
|
|
115
116
|
backgroundSize: `${256 * scale}px ${256 * scale}px`,
|
|
116
117
|
backgroundPosition: '0px 0px',
|
|
@@ -26,9 +26,7 @@ export function CardText({
|
|
|
26
26
|
: widget.text;
|
|
27
27
|
if (!content) return null;
|
|
28
28
|
const wrap = widget.type === 'paragraph';
|
|
29
|
-
const rgb =
|
|
30
|
-
const shadowRgb = ((rgb & 0xfcfcfc) >> 2) & 0xffffff;
|
|
31
|
-
const shadowed = widget.shadow === true;
|
|
29
|
+
const rgb = 0x000000;
|
|
32
30
|
return (
|
|
33
31
|
<span
|
|
34
32
|
className={`font-mc pointer-events-none absolute leading-none ${wrap ? 'whitespace-pre-wrap' : 'whitespace-pre'}`}
|
|
@@ -47,14 +45,9 @@ export function CardText({
|
|
|
47
45
|
}),
|
|
48
46
|
fontSize: size ?? 8 * scale,
|
|
49
47
|
color: `#${rgb.toString(16).padStart(6, '0')}`,
|
|
50
|
-
...(shadowed
|
|
51
|
-
? {
|
|
52
|
-
textShadow: `${scale}px ${scale}px 0 #${shadowRgb.toString(16).padStart(6, '0')}`,
|
|
53
|
-
}
|
|
54
|
-
: {}),
|
|
55
48
|
}}
|
|
56
49
|
>
|
|
57
|
-
<McText text={content} surface="
|
|
50
|
+
<McText text={content} surface="light" />
|
|
58
51
|
</span>
|
|
59
52
|
);
|
|
60
53
|
}
|
|
@@ -315,7 +315,6 @@ export function ScrollCard(props: Props) {
|
|
|
315
315
|
|
|
316
316
|
const renderText = (el: ScrollElement, index: number, moving: boolean) => {
|
|
317
317
|
const rgb = (el.color ?? 0xffffff) & 0xffffff;
|
|
318
|
-
const shadowRgb = ((rgb & 0xfcfcfc) >> 2) & 0xffffff;
|
|
319
318
|
const x = (el.x - viewport.x) * scale;
|
|
320
319
|
const y = (el.y - viewport.y) * scale;
|
|
321
320
|
const shifted = (horizontal ? x : y) - (moving ? offset * scale : 0);
|
|
@@ -328,11 +327,6 @@ export function ScrollCard(props: Props) {
|
|
|
328
327
|
top: horizontal ? y : shifted,
|
|
329
328
|
fontSize: 8 * scale,
|
|
330
329
|
color: `#${rgb.toString(16).padStart(6, '0')}`,
|
|
331
|
-
...(shadowRgb !== rgb
|
|
332
|
-
? {
|
|
333
|
-
textShadow: `${scale}px ${scale}px 0 #${shadowRgb.toString(16).padStart(6, '0')}`,
|
|
334
|
-
}
|
|
335
|
-
: {}),
|
|
336
330
|
}}
|
|
337
331
|
>
|
|
338
332
|
<McText text={el.text ?? ''} surface="dark" />
|
|
@@ -369,6 +363,7 @@ export function ScrollCard(props: Props) {
|
|
|
369
363
|
aria-hidden
|
|
370
364
|
className="absolute inset-0 block"
|
|
371
365
|
style={{
|
|
366
|
+
backgroundColor: 'var(--color-mc-inset)',
|
|
372
367
|
backgroundImage: `url(${slotTexUrl})`,
|
|
373
368
|
backgroundSize: `${ATLAS * scale}px ${ATLAS * scale}px`,
|
|
374
369
|
backgroundPosition: `-${(el.u ?? 0) * scale}px -${(el.v ?? 0) * scale}px`,
|
|
@@ -417,7 +412,7 @@ export function ScrollCard(props: Props) {
|
|
|
417
412
|
) : null}
|
|
418
413
|
{el.label ? (
|
|
419
414
|
<span
|
|
420
|
-
className="font-mc pointer-events-none absolute right-0 bottom-0 leading-none text-
|
|
415
|
+
className="font-mc pointer-events-none absolute right-0 bottom-0 leading-none text-black"
|
|
421
416
|
style={{ fontSize: (el.w / 16) * 7 * scale }}
|
|
422
417
|
>
|
|
423
418
|
{el.label}
|
|
@@ -142,11 +142,10 @@ export function SlotHitbox({
|
|
|
142
142
|
{widget.kind === 'tag' ? (
|
|
143
143
|
<span
|
|
144
144
|
aria-hidden
|
|
145
|
-
className="font-mc pointer-events-none absolute top-0 left-0 leading-none text-
|
|
145
|
+
className="font-mc pointer-events-none absolute top-0 left-0 leading-none text-black"
|
|
146
146
|
style={{
|
|
147
147
|
paddingLeft: scale / 2,
|
|
148
148
|
fontSize: (Math.min(widget.w, widget.h) / 16) * 7 * scale,
|
|
149
|
-
textShadow: `${scale}px ${scale}px 0 var(--color-mc-arrow)`,
|
|
150
149
|
}}
|
|
151
150
|
>
|
|
152
151
|
#
|
|
@@ -164,7 +163,7 @@ export function SlotHitbox({
|
|
|
164
163
|
widget.count !== undefined && widget.count > 1 ? (
|
|
165
164
|
<span
|
|
166
165
|
aria-hidden
|
|
167
|
-
className="font-mc pointer-events-none absolute right-0 bottom-0 leading-none text-
|
|
166
|
+
className="font-mc pointer-events-none absolute right-0 bottom-0 leading-none text-black"
|
|
168
167
|
style={{
|
|
169
168
|
paddingRight: scale,
|
|
170
169
|
paddingBottom: scale,
|
|
@@ -172,7 +171,6 @@ export function SlotHitbox({
|
|
|
172
171
|
(Math.min(widget.w, widget.h) / 16) *
|
|
173
172
|
(widget.kind === 'fluid' ? 4 : 7) *
|
|
174
173
|
scale,
|
|
175
|
-
textShadow: `${scale}px ${scale}px 0 var(--color-mc-arrow)`,
|
|
176
174
|
}}
|
|
177
175
|
>
|
|
178
176
|
{widget.kind === 'fluid'
|
|
@@ -109,7 +109,7 @@ export function StripCardMember({
|
|
|
109
109
|
)}
|
|
110
110
|
{badges.length > 0 && (
|
|
111
111
|
<span
|
|
112
|
-
className="font-mc pointer-events-none absolute right-0 bottom-0 leading-none text-
|
|
112
|
+
className="font-mc pointer-events-none absolute right-0 bottom-0 leading-none text-black"
|
|
113
113
|
style={{ fontSize: (pitch / 16) * (kind === 'fluid' ? 4 : 7) }}
|
|
114
114
|
>
|
|
115
115
|
{badges.join(' ')}
|
|
@@ -4,6 +4,7 @@ import type { DatasetRef } from '@terrafirmagreg-team/sites/location';
|
|
|
4
4
|
import { useMemo } from 'react';
|
|
5
5
|
import { Shapes } from 'lucide-react';
|
|
6
6
|
import { Entry } from '@terrafirmagreg-team/game/components/entry/entry';
|
|
7
|
+
import { creativeTabName } from '@terrafirmagreg-team/dump/lib/dump/assets/lang/names';
|
|
7
8
|
import { recipeItemName } from '@terrafirmagreg-team/recipe/lib/client-index';
|
|
8
9
|
import { IconPager } from '@terrafirmagreg-team/ui/components/blocks/page/pager';
|
|
9
10
|
import type { RecipeCategory, RecipeSession } from '@terrafirmagreg-team/recipe/types';
|
|
@@ -37,13 +38,16 @@ export function RecipeTypeTabs({
|
|
|
37
38
|
onChange,
|
|
38
39
|
className,
|
|
39
40
|
}: {
|
|
40
|
-
session: Pick<
|
|
41
|
+
session: Pick<
|
|
42
|
+
RecipeSession,
|
|
43
|
+
'lang' | 'names' | 'index' | 'dataset' | 'langMap'
|
|
44
|
+
>;
|
|
41
45
|
ids: string[];
|
|
42
46
|
value?: string;
|
|
43
47
|
onChange?: (id: string) => void;
|
|
44
48
|
className?: string;
|
|
45
49
|
}) {
|
|
46
|
-
const { lang, names, index, dataset } = session;
|
|
50
|
+
const { lang, names, index, dataset, langMap } = session;
|
|
47
51
|
|
|
48
52
|
const options = useMemo(() => {
|
|
49
53
|
const byId = new Map(
|
|
@@ -54,10 +58,12 @@ export function RecipeTypeTabs({
|
|
|
54
58
|
return {
|
|
55
59
|
id,
|
|
56
60
|
icon: <CategoryGlyph category={category} dataset={dataset} />,
|
|
57
|
-
help:
|
|
61
|
+
help: category?.display?.name
|
|
62
|
+
? creativeTabName(langMap ?? {}, category.display.name)
|
|
63
|
+
: recipeItemName(names, lang, id),
|
|
58
64
|
};
|
|
59
65
|
});
|
|
60
|
-
}, [index, ids, lang, names, dataset]);
|
|
66
|
+
}, [index, ids, lang, names, dataset, langMap]);
|
|
61
67
|
|
|
62
68
|
return (
|
|
63
69
|
<IconPager
|
|
@@ -84,6 +84,7 @@ export function Calculator({ session }: { session: RecipeSession }) {
|
|
|
84
84
|
nodes: deferredNodes,
|
|
85
85
|
tagMembers,
|
|
86
86
|
ensureMaterial,
|
|
87
|
+
fluids: session.index?.fluids,
|
|
87
88
|
});
|
|
88
89
|
|
|
89
90
|
const iconItems = useMemo(
|
|
@@ -157,8 +158,8 @@ export function Calculator({ session }: { session: RecipeSession }) {
|
|
|
157
158
|
focusNodeId={focusNodeId}
|
|
158
159
|
onFocusedNode={() => setFocusNodeId(null)}
|
|
159
160
|
empty={
|
|
160
|
-
<div className="absolute inset-0 z-10 grid place-items-center overflow-auto p-4">
|
|
161
|
-
<div className="flex flex-col items-center gap-4">
|
|
161
|
+
<div className="pointer-events-none absolute inset-0 z-10 grid place-items-center overflow-auto p-4">
|
|
162
|
+
<div className="pointer-events-auto flex flex-col items-center gap-4">
|
|
162
163
|
<EmptyState variant="empty">
|
|
163
164
|
{t('Click an item in the catalog to add a card.', { note: 'recipe.calc.empty' })}
|
|
164
165
|
</EmptyState>
|
|
@@ -214,12 +214,27 @@ export const CalcNodeCardFull = memo(function CalcNodeCardFull({
|
|
|
214
214
|
>
|
|
215
215
|
<Minus className="size-2.5" />
|
|
216
216
|
</button>
|
|
217
|
-
<
|
|
218
|
-
|
|
217
|
+
<input
|
|
218
|
+
key={node.crafts}
|
|
219
|
+
type="number"
|
|
220
|
+
min={1}
|
|
221
|
+
defaultValue={node.crafts}
|
|
219
222
|
title={t('Crafts', { note: 'recipe.calc.crafts.title' })}
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
+
aria-label={t('Crafts', { note: 'recipe.calc.crafts.title' })}
|
|
224
|
+
className="w-9 rounded border border-transparent bg-transparent text-center tabular-nums hover:border-border focus:border-border focus:outline-none"
|
|
225
|
+
onClick={(e) => e.stopPropagation()}
|
|
226
|
+
onKeyDown={(e) => {
|
|
227
|
+
if (e.key === 'Enter') e.currentTarget.blur();
|
|
228
|
+
}}
|
|
229
|
+
onBlur={(e) => {
|
|
230
|
+
const next = Math.max(
|
|
231
|
+
1,
|
|
232
|
+
Math.round(Number(e.target.value) || 1),
|
|
233
|
+
);
|
|
234
|
+
if (next !== node.crafts) onCrafts(id, next);
|
|
235
|
+
else e.target.value = String(node.crafts);
|
|
236
|
+
}}
|
|
237
|
+
/>
|
|
223
238
|
<button
|
|
224
239
|
type="button"
|
|
225
240
|
aria-label={t('More crafts', { note: 'recipe.calc.crafts.up' })}
|
|
@@ -12,7 +12,10 @@ import { recipeCalcHref, recipeStackHref } from '@terrafirmagreg-team/recipe/lib
|
|
|
12
12
|
import type { Recipe } from '@terrafirmagreg-team/recipe/lib/data/dto';
|
|
13
13
|
import { loadClientRecipe } from '@terrafirmagreg-team/recipe/lib/client/recipe';
|
|
14
14
|
import { resolveClientTag } from '@terrafirmagreg-team/dump/lib/dump/client/tags';
|
|
15
|
-
import {
|
|
15
|
+
import {
|
|
16
|
+
recipeDivisor,
|
|
17
|
+
toCalcRecipe,
|
|
18
|
+
} from '@terrafirmagreg-team/recipe/lib/calc/tree';
|
|
16
19
|
import { CALC_NODE_W } from '@terrafirmagreg-team/recipe/lib/calc/flow';
|
|
17
20
|
import type { Lang } from '@terrafirmagreg-team/translate/types/locale';
|
|
18
21
|
import type {
|
|
@@ -47,6 +50,7 @@ export function useCalcActions({
|
|
|
47
50
|
nodes,
|
|
48
51
|
tagMembers,
|
|
49
52
|
ensureMaterial,
|
|
53
|
+
fluids,
|
|
50
54
|
}: {
|
|
51
55
|
dataset: DatasetRef;
|
|
52
56
|
lang: Lang;
|
|
@@ -64,7 +68,9 @@ export function useCalcActions({
|
|
|
64
68
|
nodes: CalcNode[];
|
|
65
69
|
tagMembers?: (tagId: string) => TagResolution | undefined;
|
|
66
70
|
ensureMaterial?: (materialId: string) => void;
|
|
71
|
+
fluids?: readonly string[];
|
|
67
72
|
}) {
|
|
73
|
+
const fluidIds = useMemo(() => new Set(fluids ?? []), [fluids]);
|
|
68
74
|
const { checked: shared, onClick: onShare } = useCopyButton(async () => {
|
|
69
75
|
const tree = encodeShare();
|
|
70
76
|
const { id: datasetId, version } = dataset;
|
|
@@ -127,6 +133,13 @@ export function useCalcActions({
|
|
|
127
133
|
|
|
128
134
|
const onAddCard = useCallback(
|
|
129
135
|
(materialId: string, kind: CalcKind, pos?: { x: number; y: number }) => {
|
|
136
|
+
if (kind === 'item' && materialId.endsWith('_bucket')) {
|
|
137
|
+
const fluidId = materialId.slice(0, -'_bucket'.length);
|
|
138
|
+
if (fluidIds.has(fluidId)) {
|
|
139
|
+
materialId = fluidId;
|
|
140
|
+
kind = 'fluid';
|
|
141
|
+
}
|
|
142
|
+
}
|
|
130
143
|
const id = newCardId();
|
|
131
144
|
persist({
|
|
132
145
|
cards: [
|
|
@@ -139,7 +152,7 @@ export function useCalcActions({
|
|
|
139
152
|
setFocusNodeId(id);
|
|
140
153
|
return id;
|
|
141
154
|
},
|
|
142
|
-
[flushAmounts, persist, wires, tagSelections, setFocusNodeId],
|
|
155
|
+
[flushAmounts, persist, wires, tagSelections, setFocusNodeId, fluidIds],
|
|
143
156
|
);
|
|
144
157
|
|
|
145
158
|
const onSupplyInput = useCallback(
|
|
@@ -149,8 +162,13 @@ export function useCalcActions({
|
|
|
149
162
|
const input = consumerNode?.inputs[inputIndex];
|
|
150
163
|
if (!consumerNode || !consumerCard || !input?.id) return null;
|
|
151
164
|
const need = Math.max(1, input.amount - input.covered);
|
|
152
|
-
const
|
|
153
|
-
?
|
|
165
|
+
const per = outputAmount ?? (() => {
|
|
166
|
+
const body = recipeId ? recipeBody(recipeId) : undefined;
|
|
167
|
+
const calc = body ? toCalcRecipe(body) : undefined;
|
|
168
|
+
return calc ? recipeDivisor(calc, input.id!, input.kind) : 0;
|
|
169
|
+
})();
|
|
170
|
+
const crafts = recipeId && per > 0
|
|
171
|
+
? Math.max(1, Math.ceil(need / per))
|
|
154
172
|
: need;
|
|
155
173
|
const base = consumerCard.pos;
|
|
156
174
|
const id = newCardId();
|
|
@@ -179,7 +197,7 @@ export function useCalcActions({
|
|
|
179
197
|
});
|
|
180
198
|
return id;
|
|
181
199
|
},
|
|
182
|
-
[nodes, cards, wires, flushAmounts, persist, tagSelections],
|
|
200
|
+
[nodes, cards, wires, flushAmounts, persist, tagSelections, recipeBody],
|
|
183
201
|
);
|
|
184
202
|
|
|
185
203
|
const onDemandOutput = useCallback(
|
|
@@ -15,10 +15,10 @@ import type { CalcFarMode } from '@terrafirmagreg-team/recipe/lib/calc/flow';
|
|
|
15
15
|
const FAR_MODES: CalcFarMode[] = ['full', 'preview', 'hidden'];
|
|
16
16
|
const useStoredMode = createStoredValue(
|
|
17
17
|
'calc:far',
|
|
18
|
-
literalCodec(FAR_MODES, '
|
|
18
|
+
literalCodec(FAR_MODES, 'full'),
|
|
19
19
|
);
|
|
20
20
|
|
|
21
|
-
const CalcFarContext = createContext<CalcFarMode>('
|
|
21
|
+
const CalcFarContext = createContext<CalcFarMode>('full');
|
|
22
22
|
|
|
23
23
|
export const CalcFarProvider = CalcFarContext.Provider;
|
|
24
24
|
|
|
@@ -10,7 +10,7 @@ import type { CalcViewMode } from '@terrafirmagreg-team/recipe/lib/calc/flow';
|
|
|
10
10
|
const MODES: CalcViewMode[] = ['mini', 'normal', 'detailed'];
|
|
11
11
|
const useStoredMode = createStoredValue(
|
|
12
12
|
'calc:view',
|
|
13
|
-
literalCodec(MODES, '
|
|
13
|
+
literalCodec(MODES, 'detailed'),
|
|
14
14
|
);
|
|
15
15
|
|
|
16
16
|
export function useCalcViewMode() {
|
|
@@ -112,10 +112,12 @@ export function usePanelCells({
|
|
|
112
112
|
: [],
|
|
113
113
|
);
|
|
114
114
|
}
|
|
115
|
+
const fluidIds = new Set(dIndex?.fluids ?? []);
|
|
115
116
|
return buildPanelCells(
|
|
116
117
|
deferredFiltered,
|
|
117
118
|
dIndex?.groups,
|
|
118
119
|
expandedGroups,
|
|
120
|
+
fluidIds,
|
|
119
121
|
);
|
|
120
122
|
}, [deferredFiltered, dIndex, mode, expandedGroups, favorites.entries]);
|
|
121
123
|
|
|
@@ -56,7 +56,13 @@ export async function recipesForOutput(
|
|
|
56
56
|
]);
|
|
57
57
|
const extra = io?.outputs.get(base) ?? [];
|
|
58
58
|
const ids = extra.length ? [...new Set([...refs, ...extra])] : refs;
|
|
59
|
-
|
|
59
|
+
const keepTagRows = opts?.includeTagRows ?? false;
|
|
60
|
+
return (await resolveRecipeRows(dataset, index, ids, opts)).filter(
|
|
61
|
+
(row) =>
|
|
62
|
+
row.out.includes(base) ||
|
|
63
|
+
(keepTagRows &&
|
|
64
|
+
(row.cat ?? index.types[row.type]) === 'emi:tag'),
|
|
65
|
+
);
|
|
60
66
|
}
|
|
61
67
|
|
|
62
68
|
export async function usesForInput(
|
|
@@ -88,10 +94,12 @@ export async function usesForInput(
|
|
|
88
94
|
...tagKinds.map((tagKind) => loadTagSlice(dataset, tagKind, ns)),
|
|
89
95
|
]);
|
|
90
96
|
const tagKeys: string[] = [];
|
|
97
|
+
const acceptedTags = new Set<string>();
|
|
91
98
|
for (const [i, slice] of tagSlices.entries()) {
|
|
92
99
|
const registry = `${tagKinds[i]}s`;
|
|
93
100
|
for (const tag of slice[base] ?? slice[item] ?? []) {
|
|
94
101
|
const raw = tag.startsWith('#') ? tag.slice(1) : tag;
|
|
102
|
+
acceptedTags.add(`#${raw}`);
|
|
95
103
|
const parts = splitDumpId(raw);
|
|
96
104
|
if (parts) tagKeys.push(`${parts.ns}:${registry}/${parts.path}`);
|
|
97
105
|
}
|
|
@@ -111,8 +119,21 @@ export async function usesForInput(
|
|
|
111
119
|
const allRefs = ioRefs.length
|
|
112
120
|
? [...new Set([...refs, ...ioRefs])]
|
|
113
121
|
: refs;
|
|
122
|
+
const [refRows, tagRows] = await Promise.all([
|
|
123
|
+
resolveRecipeRows(dataset, index, allRefs, {
|
|
124
|
+
includeTagRows: false,
|
|
125
|
+
...opts,
|
|
126
|
+
}),
|
|
127
|
+
resolveRecipeRows(dataset, index, tagRefs, {
|
|
128
|
+
includeTagRows: false,
|
|
129
|
+
...opts,
|
|
130
|
+
}),
|
|
131
|
+
]);
|
|
114
132
|
return uniqueRows([
|
|
115
|
-
...(
|
|
133
|
+
...refRows.filter((row) => row.in.includes(base)),
|
|
134
|
+
...tagRows.filter((row) =>
|
|
135
|
+
row.in.some((id) => acceptedTags.has(id)),
|
|
136
|
+
),
|
|
116
137
|
...stationRows.flat(),
|
|
117
138
|
]);
|
|
118
139
|
}
|
package/src/lib/browser/panel.ts
CHANGED
|
@@ -3,6 +3,7 @@ import {
|
|
|
3
3
|
type TaggedReference,
|
|
4
4
|
} from '@terrafirmagreg-team/dump/lib/dump/contract/ref';
|
|
5
5
|
import { registryId } from '@terrafirmagreg-team/dump/lib/dump/paths';
|
|
6
|
+
import { creativeTabName } from '@terrafirmagreg-team/dump/lib/dump/assets/lang/names';
|
|
6
7
|
import { recipeItemName } from '@terrafirmagreg-team/recipe/lib/client-index';
|
|
7
8
|
import type { Lang } from '@terrafirmagreg-team/translate/types/locale';
|
|
8
9
|
import type {
|
|
@@ -12,7 +13,7 @@ import type {
|
|
|
12
13
|
} from '@terrafirmagreg-team/recipe/types';
|
|
13
14
|
|
|
14
15
|
function catalogPool(index: RecipeCompactIndex, tab?: string): string[] {
|
|
15
|
-
if (!tab) return index.items;
|
|
16
|
+
if (!tab) return [...index.items, ...(index.fluids ?? [])];
|
|
16
17
|
return index.tabItems?.[tab] ?? [];
|
|
17
18
|
}
|
|
18
19
|
|
|
@@ -39,8 +40,13 @@ export function buildPanelCells(
|
|
|
39
40
|
ids: readonly string[],
|
|
40
41
|
groups: RecipeStackGroup[] | undefined,
|
|
41
42
|
expandedGroups: ReadonlySet<string>,
|
|
43
|
+
fluidIds?: ReadonlySet<string>,
|
|
42
44
|
): ItemPanelCell[] {
|
|
43
|
-
|
|
45
|
+
const cell = (id: string): ItemPanelCell =>
|
|
46
|
+
fluidIds?.has(registryId(id))
|
|
47
|
+
? { kind: 'stack', id, ref: 'fluid' }
|
|
48
|
+
: { kind: 'stack', id };
|
|
49
|
+
if (!groups?.length) return ids.map(cell);
|
|
44
50
|
const byMember = new Map<string, RecipeStackGroup>();
|
|
45
51
|
for (const group of groups)
|
|
46
52
|
for (const member of group.members) {
|
|
@@ -56,7 +62,7 @@ export function buildPanelCells(
|
|
|
56
62
|
seen.add(base);
|
|
57
63
|
const group = byMember.get(base);
|
|
58
64
|
if (!group) {
|
|
59
|
-
out.push(
|
|
65
|
+
out.push(cell(id));
|
|
60
66
|
continue;
|
|
61
67
|
}
|
|
62
68
|
const members = group.members.filter((member) =>
|
|
@@ -64,7 +70,7 @@ export function buildPanelCells(
|
|
|
64
70
|
);
|
|
65
71
|
for (const member of members) seen.add(registryId(member));
|
|
66
72
|
if (members.length <= 1) {
|
|
67
|
-
out.push(
|
|
73
|
+
out.push(cell(members[0] ?? id));
|
|
68
74
|
continue;
|
|
69
75
|
}
|
|
70
76
|
const expanded = expandedGroups.has(group.id);
|
|
@@ -77,7 +83,12 @@ export function buildPanelCells(
|
|
|
77
83
|
});
|
|
78
84
|
if (expanded)
|
|
79
85
|
for (const member of members)
|
|
80
|
-
out.push({
|
|
86
|
+
out.push({
|
|
87
|
+
kind: 'stack',
|
|
88
|
+
id: member,
|
|
89
|
+
groupId: group.id,
|
|
90
|
+
...(fluidIds?.has(registryId(member)) ? { ref: 'fluid' as const } : {}),
|
|
91
|
+
});
|
|
81
92
|
}
|
|
82
93
|
return out;
|
|
83
94
|
}
|
|
@@ -97,7 +108,9 @@ export function panelTabRows(
|
|
|
97
108
|
id: row.id,
|
|
98
109
|
icon,
|
|
99
110
|
iconRef: row.icon,
|
|
100
|
-
help:
|
|
111
|
+
help: row.display?.name
|
|
112
|
+
? creativeTabName(names[lang] ?? names.en_us ?? {}, row.display.name)
|
|
113
|
+
: recipeItemName(names, lang, row.id),
|
|
101
114
|
});
|
|
102
115
|
}
|
|
103
116
|
return rows;
|
package/styles/calc.css
CHANGED
|
@@ -178,12 +178,6 @@
|
|
|
178
178
|
line-height: 1;
|
|
179
179
|
padding-bottom: 0.5px;
|
|
180
180
|
color: var(--color-foreground);
|
|
181
|
-
text-shadow:
|
|
182
|
-
0 0 2px var(--color-card),
|
|
183
|
-
0 1px 1px var(--color-card),
|
|
184
|
-
1px 0 1px var(--color-card),
|
|
185
|
-
-1px 0 1px var(--color-card),
|
|
186
|
-
0 -1px 1px var(--color-card);
|
|
187
181
|
}
|
|
188
182
|
|
|
189
183
|
.calc-port-count[data-len='l'] {
|