phase 11 part1

This commit is contained in:
2025-12-08 12:30:15 +01:00
parent 3336b59e7d
commit 07f0752d81
15 changed files with 1383 additions and 133 deletions

View File

@@ -159,6 +159,30 @@ class GameScene extends Phaser.Scene {
}
*/
// ZOMBIE WORKER SYSTEM
console.log('🧟⚒️ Initializing Zombie Worker System...');
this.zombieWorkerSystem = new ZombieWorkerSystem(this);
// GRAVE SYSTEM
console.log('🪦 Initializing Grave System...');
this.graveSystem = new GraveSystem(this);
// SCOOTER REPAIR SYSTEM
console.log('🛵 Initializing Scooter Repair System...');
this.scooterRepairSystem = new ScooterRepairSystem(this);
// EXPANSION SYSTEM
console.log('🗺️ Initializing Expansion System...');
this.expansionSystem = new ExpansionSystem(this);
// BLUEPRINT SYSTEM
console.log('📜 Initializing Blueprint System...');
this.blueprintSystem = new BlueprintSystem(this);
// WORKSTATION SYSTEM
console.log('🏭 Initializing Workstation System...');
this.workstationSystem = new WorkstationSystem(this);
// ELITE ZOMBIE v City območju (samo 1 za testiranje)
console.log('👹 Spawning ELITE ZOMBIE in City...');
const eliteX = Phaser.Math.Between(50, 80); // City area
@@ -169,8 +193,8 @@ class GameScene extends Phaser.Scene {
// Easter Egg: Broken Scooter
console.log('🛵 Spawning Scooter Easter Egg...');
this.vehicles = [];
const scooter = new Scooter(this, 25, 25);
this.vehicles.push(scooter);
// const scooter = new Scooter(this, 25, 25);
// this.vehicles.push(scooter);
// ZOMBIE SPAWNERS (City area)
console.log('👹 Creating Zombie Spawners...');
@@ -274,6 +298,140 @@ class GameScene extends Phaser.Scene {
console.log('✅ GameScene ready - FAZA 20 (Full Features)!');
// Global command: giveSeeds(amount) - daj seeds najbližjemu tamed zombiju
window.giveSeeds = (amount = 10) => {
if (!this.zombieWorkerSystem || !this.player) {
console.log('🚫 System not ready!');
return;
}
const workers = this.zombieWorkerSystem.workers;
if (workers.length === 0) {
console.log('🚫 No tamed zombies found!');
return;
}
// Find closest worker
const playerPos = this.player.getPosition();
let closest = null;
let minDist = 999;
for (const worker of workers) {
const dist = Phaser.Math.Distance.Between(playerPos.x, playerPos.y, worker.gridX, worker.gridY);
if (dist < minDist) {
minDist = dist;
closest = worker;
}
}
if (closest && closest.workerData) {
closest.workerData.inventory.seeds += amount;
closest.showEmote(`📦+${amount}`);
console.log(`🧟📦 Gave ${amount} seeds to worker! (Total: ${closest.workerData.inventory.seeds})`);
}
};
console.log('💡 TIP: Use giveSeeds(20) to give 20 seeds to nearest zombie');
// Global command: placeGrave() - postavi grob pri playerju
window.placeGrave = () => {
if (!this.graveSystem || !this.player) {
console.log('🚫 System not ready!');
return;
}
const playerPos = this.player.getPosition();
const result = this.graveSystem.placeGrave(
Math.floor(playerPos.x),
Math.floor(playerPos.y)
);
if (result) {
console.log('🪦 Grave placed successfully!');
}
};
console.log('💡 TIP: Use placeGrave() to place grave at your location');
// Global command: giveAllParts() - daj vse scooter parts
window.giveAllParts = () => {
if (!this.scooterRepairSystem || !this.inventorySystem) {
console.log('🚫 System not ready!');
return;
}
const parts = this.scooterRepairSystem.requiredParts;
const tools = this.scooterRepairSystem.requiredTools;
for (const [part, count] of Object.entries(parts)) {
this.inventorySystem.addItem(part, count);
}
for (const [tool, count] of Object.entries(tools)) {
this.inventorySystem.addItem(tool, count);
}
console.log('✅ All scooter parts and tools added!');
this.scooterRepairSystem.listMissingParts();
};
// Global command: checkScooter() - preveri kaj manjka
window.checkScooter = () => {
if (!this.scooterRepairSystem) {
console.log('🚫 System not ready!');
return;
}
this.scooterRepairSystem.listMissingParts();
};
console.log('💡 TIP: Use checkScooter() to see repair requirements');
console.log('💡 TIP: Use giveAllParts() to get all scooter parts (testing)');
// Global command: unlockZone(id)
window.unlockZone = (id) => {
if (this.expansionSystem) {
this.expansionSystem.unlockZone(id);
}
};
// Global command: dropBlueprint()
window.dropBlueprint = () => {
if (this.blueprintSystem && this.player) {
const pos = this.player.getPosition();
this.blueprintSystem.tryDropBlueprint(pos.x, pos.y, 'boss'); // 100% chance
}
};
// Global command: placeFurnace()
window.placeFurnace = () => {
if (this.terrainSystem && this.player) {
const pos = this.player.getPosition();
const x = Math.floor(pos.x);
const y = Math.floor(pos.y);
this.terrainSystem.placeStructure(x, y, 'furnace');
if (this.inventorySystem) {
this.inventorySystem.addItem('coal', 10);
this.inventorySystem.addItem('ore_iron', 10);
}
console.log(`🏭 Furnace placed at ${x},${y}`);
}
};
// Global command: placeMint()
window.placeMint = () => {
if (this.terrainSystem && this.player) {
const pos = this.player.getPosition();
const x = Math.floor(pos.x);
const y = Math.floor(pos.y);
this.terrainSystem.placeStructure(x, y, 'mint');
if (this.inventorySystem) {
this.inventorySystem.addItem('iron_bar', 10);
this.inventorySystem.addItem('coal', 10);
}
console.log(`💰 Mint placed at ${x},${y}`);
}
};
// Start Engine
this.Antigravity_Start();
}
@@ -397,7 +555,26 @@ class GameScene extends Phaser.Scene {
}
}
// Parallax
// Zombie Worker System
if (this.zombieWorkerSystem) this.zombieWorkerSystem.update(delta);
// Workstation System
if (this.workstationSystem) this.workstationSystem.update(delta);
// Grave System Update (regeneration)
if (this.graveSystem) {
this.graveSystem.update(delta);
// Auto-rest check every 5 seconds
if (!this.graveAutoRestTimer) this.graveAutoRestTimer = 0;
this.graveAutoRestTimer += delta;
if (this.graveAutoRestTimer >= 5000) {
this.graveSystem.autoRest();
this.graveAutoRestTimer = 0;
}
}
// Parallax Logic
if (this.parallaxSystem && this.player) {
const playerPos = this.player.getPosition();
const screenPos = this.iso.toScreen(playerPos.x, playerPos.y);
@@ -542,38 +719,41 @@ class GameScene extends Phaser.Scene {
if (this.terrainSystem.decorationsMap.has(key)) {
this.terrainSystem.removeDecoration(x, y);
}
// Make it grass or dirt
this.terrainSystem.tiles[y][x].type = { name: 'grass', color: 0x228B22 };
this.terrainSystem.tiles[y][x].sprite.setTint(0x228B22);
// Make it grass or dirt - USE CORRECT TERRAIN TYPE OBJECT
this.terrainSystem.tiles[y][x].type = this.terrainSystem.terrainTypes.GRASS_FULL;
if (this.terrainSystem.tiles[y][x].sprite) {
this.terrainSystem.tiles[y][x].sprite.setTexture('grass');
this.terrainSystem.tiles[y][x].sprite.setTint(0xffffff); // Clear tint
}
}
}
}
// 2. Place starter resources (chest s semeni)
this.terrainSystem.placeStructure(farmX + 3, farmY + 3, 'chest');
// 2. Place starter resources (chest s semeni) - REMOVED PER USER REQUEST (Floating chest bug)
// this.terrainSystem.placeStructure(farmX + 3, farmY + 3, 'chest');
// 3. Place FULL FENCE around farm
console.log('🚧 Building Farm Fence...');
const minX = farmX - farmRadius;
const maxX = farmX + farmRadius;
const minY = farmY - farmRadius;
const maxY = farmY + farmRadius;
// console.log('🚧 Building Farm Fence...');
// const minX = farmX - farmRadius;
// const maxX = farmX + farmRadius;
// const minY = farmY - farmRadius;
// const maxY = farmY + farmRadius;
// Top and bottom horizontal fences
for (let x = minX; x <= maxX; x++) {
if (x >= 0 && x < 100) {
this.terrainSystem.placeStructure(x, minY, 'fence_full'); // Top
this.terrainSystem.placeStructure(x, maxY, 'fence_full'); // Bottom
}
}
// // Top and bottom horizontal fences
// for (let x = minX; x <= maxX; x++) {
// if (x >= 0 && x < 100) {
// this.terrainSystem.placeStructure(x, minY, 'fence_full'); // Top
// this.terrainSystem.placeStructure(x, maxY, 'fence_full'); // Bottom
// }
// }
// Left and right vertical fences
for (let y = minY; y <= maxY; y++) {
if (y >= 0 && y < 100) {
this.terrainSystem.placeStructure(minX, y, 'fence_full'); // Left
this.terrainSystem.placeStructure(maxX, y, 'fence_full'); // Right
}
}
// // Left and right vertical fences
// for (let y = minY; y <= maxY; y++) {
// if (y >= 0 && y < 100) {
// this.terrainSystem.placeStructure(minX, y, 'fence_full'); // Left
// this.terrainSystem.placeStructure(maxX, y, 'fence_full'); // Right
// }
// }
console.log('✅ Farm Area Initialized at (20,20)');
}