Add perennial plants, starting with olives.
This commit is contained in:
parent
23c312299c
commit
d7d3999401
|
|
@ -22,6 +22,7 @@ export const CROPS: CropDefinitions = {
|
|||
yield: 1,
|
||||
yieldType: 'celery',
|
||||
fertilityDepletion: 0.1,
|
||||
seedType: 'celery_seed',
|
||||
},
|
||||
corn: {
|
||||
id: 'corn',
|
||||
|
|
@ -31,6 +32,19 @@ export const CROPS: CropDefinitions = {
|
|||
yield: 5,
|
||||
yieldType: 'corn',
|
||||
fertilityDepletion: 0.3,
|
||||
seedType: 'corn_seed',
|
||||
},
|
||||
olive: {
|
||||
id: 'olive',
|
||||
name: 'Olive Tree',
|
||||
growthTicks: 200,
|
||||
waterPerTick: 1 / 50,
|
||||
yield: 5,
|
||||
yieldType: 'olive',
|
||||
fertilityDepletion: 0.1,
|
||||
seedType: 'olive', // Uses olives as seeds
|
||||
isPerennial: true,
|
||||
regrowthProgress: 150, // Resets to 150 ticks after harvest
|
||||
},
|
||||
}
|
||||
|
||||
|
|
@ -101,5 +115,18 @@ export const MARKET_ITEMS: Record<string, MarketItem> = {
|
|||
buyPrice: null,
|
||||
sellPrice: 5,
|
||||
},
|
||||
corn: { id: 'corn', name: 'Corn', emoji: '🌽', buyPrice: null, sellPrice: 8 },
|
||||
corn: {
|
||||
id: 'corn',
|
||||
name: 'Corn',
|
||||
emoji: '🌽',
|
||||
buyPrice: null,
|
||||
sellPrice: 8,
|
||||
},
|
||||
olive: {
|
||||
id: 'olive',
|
||||
name: 'Olive',
|
||||
emoji: '🫒',
|
||||
buyPrice: 15,
|
||||
sellPrice: null,
|
||||
},
|
||||
}
|
||||
|
|
|
|||
|
|
@ -144,7 +144,8 @@ export const useGameStore = create<
|
|||
|
||||
const plot = plots[row][col]
|
||||
if (plot.intended && !plot.current) {
|
||||
const seedId = `${plot.intended}_seed`
|
||||
const crop = CROPS[plot.intended]
|
||||
const seedId = crop.seedType
|
||||
|
||||
if (inventory[seedId] && inventory[seedId] > 0) {
|
||||
set(
|
||||
|
|
@ -207,7 +208,18 @@ export const useGameStore = create<
|
|||
|
||||
set(
|
||||
produce((state) => {
|
||||
if (crop.isPerennial) {
|
||||
// For perennial crops, reset progress instead of clearing
|
||||
state.plots[row][col].current = {
|
||||
cropId: plot.current!.cropId,
|
||||
progress: crop.regrowthProgress!,
|
||||
mature: false,
|
||||
}
|
||||
} else {
|
||||
// For regular crops, clear the plot
|
||||
state.plots[row][col].current = undefined
|
||||
}
|
||||
|
||||
state.inventory[yieldItem] =
|
||||
(state.inventory[yieldItem] || 0) + yieldAmount
|
||||
state.plots[row][col].fertility = Math.max(
|
||||
|
|
|
|||
|
|
@ -6,6 +6,9 @@ export interface Crop {
|
|||
yield: number
|
||||
yieldType: string
|
||||
fertilityDepletion: number
|
||||
seedType: string
|
||||
isPerennial?: boolean
|
||||
regrowthProgress?: number
|
||||
}
|
||||
|
||||
export interface CropDefinitions {
|
||||
|
|
|
|||
Loading…
Reference in a new issue