forked from mem9-ai/mem9
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpalette.ts
More file actions
152 lines (135 loc) · 4.48 KB
/
palette.ts
File metadata and controls
152 lines (135 loc) · 4.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
import type { PixelFarmBabyCowColor } from "@/lib/pixel-farm/baby-cow";
import type { PixelFarmChickenColor } from "@/lib/pixel-farm/chicken";
import type { PixelFarmCowColor } from "@/lib/pixel-farm/cow";
import type { PixelFarmAssetTileSelection } from "@/lib/pixel-farm/tileset-config";
const FARMING_PLANTS_COLUMNS = 5;
const MUSHROOMS_FLOWERS_STONES_COLUMNS = 12;
export const PIXEL_FARM_TOP_CROP_TAG_COUNT = 13;
export type PixelFarmCropStage = "seed" | "sprout" | "growing" | "mature";
export type PixelFarmBucketAnimalTier = "chicken" | "baby-cow" | "cow";
export interface PixelFarmCropFamilyPalette {
family: string;
stages: Record<PixelFarmCropStage, PixelFarmAssetTileSelection>;
}
export interface PixelFarmDecorationPalette {
family: string;
frames: PixelFarmAssetTileSelection[];
}
export interface PixelFarmBucketAnimalPalette {
color: PixelFarmBabyCowColor | PixelFarmChickenColor | PixelFarmCowColor;
tier: PixelFarmBucketAnimalTier;
type: PixelFarmBucketAnimalTier;
}
function frameAt(columns: number, row: number, column: number): number {
return row * columns + column;
}
function farmingPlant(row: number, column: number): PixelFarmAssetTileSelection {
return {
sourceId: "farmingPlants",
frame: frameAt(FARMING_PLANTS_COLUMNS, row, column),
};
}
function otherDecoration(row: number, column: number): PixelFarmAssetTileSelection {
return {
sourceId: "mushroomsFlowersStones",
frame: frameAt(MUSHROOMS_FLOWERS_STONES_COLUMNS, row, column),
};
}
function singleTileCropPalette(row: number, family: string): PixelFarmCropFamilyPalette {
return {
family,
stages: {
// Normal crop rows use four populated columns; the last column is blank.
seed: farmingPlant(row, 0),
sprout: farmingPlant(row, 1),
growing: farmingPlant(row, 2),
mature: farmingPlant(row, 3),
},
};
}
// ---------------------------------------------------------------------------
// Main field crops
// ---------------------------------------------------------------------------
// Avoid the first farmingPlants row for now. The user flagged the corn row as
// visually tall, so keep it out of the base bucket maturity chain.
export const PIXEL_FARM_CROP_BUCKET_PALETTES: readonly PixelFarmCropFamilyPalette[] = [
singleTileCropPalette(2, "crop-01"),
singleTileCropPalette(3, "crop-02"),
singleTileCropPalette(4, "crop-03"),
singleTileCropPalette(5, "crop-04"),
singleTileCropPalette(6, "crop-05"),
singleTileCropPalette(7, "crop-06"),
singleTileCropPalette(8, "crop-07"),
singleTileCropPalette(9, "crop-08"),
singleTileCropPalette(10, "crop-09"),
singleTileCropPalette(11, "crop-10"),
singleTileCropPalette(12, "crop-11"),
singleTileCropPalette(13, "crop-12"),
singleTileCropPalette(14, "crop-13"),
] as const;
export const PIXEL_FARM_SPECIAL_TALL_CROP_CANDIDATE: PixelFarmCropFamilyPalette = {
family: "corn",
stages: {
seed: farmingPlant(0, 0),
sprout: farmingPlant(0, 1),
growing: farmingPlant(0, 2),
mature: farmingPlant(0, 4),
},
};
// ---------------------------------------------------------------------------
// Other zone decorations
// ---------------------------------------------------------------------------
// Confirmed sheet usage for v1:
// row 0 col 0-2: red mushroom small -> large
// row 1 col 0-5: stones small -> large
// row 2 col 0-3: grass small -> large
export const PIXEL_FARM_OTHER_ZONE_DECORATIONS = {
grass: {
family: "grass",
frames: [
otherDecoration(2, 0),
otherDecoration(2, 1),
otherDecoration(2, 2),
otherDecoration(2, 3),
],
},
redMushroom: {
family: "red-mushroom",
frames: [
otherDecoration(0, 0),
otherDecoration(0, 1),
otherDecoration(0, 2),
],
},
stone: {
family: "stone",
frames: [
otherDecoration(1, 0),
otherDecoration(1, 1),
otherDecoration(1, 2),
otherDecoration(1, 3),
otherDecoration(1, 4),
otherDecoration(1, 5),
],
},
} as const satisfies Record<string, PixelFarmDecorationPalette>;
// ---------------------------------------------------------------------------
// Bucket animals
// ---------------------------------------------------------------------------
export const PIXEL_FARM_BUCKET_ANIMAL_PALETTES: readonly PixelFarmBucketAnimalPalette[] = [
{
tier: "chicken",
type: "chicken",
color: "default",
},
{
tier: "baby-cow",
type: "baby-cow",
color: "brown",
},
{
tier: "cow",
type: "cow",
color: "brown",
},
] as const;