16 lines
518 B
TypeScript
16 lines
518 B
TypeScript
import type { BuildingType } from '~/types/game'
|
|
|
|
/**
|
|
* What is picked in the fullscreen village: a building (its card opens in the window)
|
|
* or the empty plot of a type that doesn't stand yet (its build card).
|
|
*/
|
|
export function useVillageSelection() {
|
|
const selected = useState<number | null>('village.selected', () => null)
|
|
const plot = useState<BuildingType | null>('village.plot', () => null)
|
|
const clear = () => {
|
|
selected.value = null
|
|
plot.value = null
|
|
}
|
|
return { selected, plot, clear }
|
|
}
|