2024-06-28 16:38:49 -05:00
|
|
|
if (3 === plant.stage) {
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
|
|
|
|
const {TileLayers, Water} = ecs.get(1);
|
|
|
|
const layer = TileLayers.layer(0)
|
|
|
|
const {Position} = ecs.get(plant.entity);
|
|
|
|
const x = (Position.x - layer.tileSize.x * 0.5) / layer.tileSize.x
|
|
|
|
const y = (Position.y - layer.tileSize.y * 0.5) / layer.tileSize.y
|
|
|
|
const tileIndex = layer.area.x * y + x
|
|
|
|
if (!Water.water[tileIndex]) {
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
if (Water.water[tileIndex] < 32) {
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
if (Water.water[tileIndex] > 224) {
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
return true
|