udomacenje zombija in uboj\
This commit is contained in:
@@ -18,6 +18,7 @@ class FarmingSystem {
|
||||
// Let's say if it has crop and it is ripe, harvest it regardless of tool.
|
||||
if (tile.hasCrop) {
|
||||
const crop = terrain.cropsMap.get(`${gridX},${gridY}`);
|
||||
console.log('🌾 Check harvest:', crop);
|
||||
if (crop && crop.stage === 4) {
|
||||
this.harvest(gridX, gridY);
|
||||
return true;
|
||||
@@ -26,10 +27,11 @@ class FarmingSystem {
|
||||
|
||||
// 2. TILLING (Requires Hoe)
|
||||
if (toolType === 'hoe') {
|
||||
if (tile.type === 'grass' || tile.type === 'dirt') {
|
||||
const typeName = tile.type.name || tile.type;
|
||||
if (typeName.includes('grass') || typeName === 'dirt') {
|
||||
if (!tile.hasDecoration && !tile.hasCrop) {
|
||||
console.log('🚜 Tilling soil...');
|
||||
terrain.setTileType(gridX, gridY, 'farmland');
|
||||
terrain.setTileType(gridX, gridY, 'farmland'); // This sets it to string 'farmland' usually? or object? Assuming method handles it.
|
||||
// Play sound
|
||||
return true;
|
||||
}
|
||||
@@ -38,10 +40,16 @@ class FarmingSystem {
|
||||
|
||||
// 3. PLANTING (Requires Seeds)
|
||||
if (toolType === 'seeds') {
|
||||
if (tile.type === 'farmland' && !tile.hasCrop && !tile.hasDecoration) {
|
||||
const typeName = tile.type.name || tile.type;
|
||||
if (typeName === 'farmland' && !tile.hasCrop && !tile.hasDecoration) {
|
||||
console.log('🌱 Planting seeds...');
|
||||
this.plant(gridX, gridY);
|
||||
return true; // Consume seed logic handled by caller?
|
||||
|
||||
// Remove 1 seed from inventory
|
||||
if (this.scene.inventorySystem) {
|
||||
this.scene.inventorySystem.removeItem('seeds', 1);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user