Отличные задачи! Планирую:
- Приказы игрока имеют приоритет — если игрок дал команду крестьянину, автоматизация не должна её перебивать. Добавлю флаг
manualOrder — авто срабатывает только если крестьянин действительно простаивает или был перенаправлен автоматизацией.
- 6 новых мирных + 2 военных здания: мельница, лесопилка, лагерь золотодобытчиков, рынок, храм, колодец / башня лучников, крепость.
- Разнообразие визуала — уникальный рендер каждого нового здания.
- Карта x1.5: 140 → 210 тайлов.
Начну с типов и стоимостей.
Now I need to add stats for the new unit knight and all new buildings.
Now update Unit to include a manualOrder flag so автоматизация не перебивает приказы игрока.
Now update logic.ts — auto-villagers must not override manual orders, and dropoff should use DROPOFF_FOR for the correct building type near the resource.
Now the crucial change: automation should not touch units with manualOrder = true. Let me view the villager loop.
The key logic changes I need:
- In
case 'idle' (villager): only auto-assign if !u.manualOrder
- In
case 'move' (villager): when reaching manual move, clear manualOrder so future automation can resume
- When auto-assigning to new resource on depletion — only if
!u.manualOrder
- After delivery, only auto-continue if
!u.manualOrder
Actually the cleanest semantics: manualOrder means "the player deliberately assigned this specific job — don't touch it until it completes or player reassigns". When the job completes (move arrived / attack target killed / gather node depleted), clear the flag so automation can resume for villagers.
Let me update:
Now the gather-depleted branch — if manualOrder, don't auto-jump to a next resource:
Now deliver — after delivery, if manualOrder, keep the flag only if returning to the original node; otherwise clear:
Also attackMove / attack orders should clear manualOrder on completion — but they aren't given to villagers typically. Still, when villager finishes attack, clear:
Now — when damageUnit reroutes a villager (flee/fight-back), that shouldn't disturb manualOrder either? Actually, self-preservation should override. Let me check that later. Now — the App.tsx must SET manualOrder = true when the player issues commands via right-click, and also add tower auto-attack behavior for the new tower building.
First let's update world.ts to also give players a starting knight? No, keep starting units — but I need to ensure new map size (210) works. Old start positions used offsets from map corners — they use MAP_SIZE - m so they'll automatically be spread across the bigger map. That's fine.
Let me also add more resources for the bigger map. Let me check:
Scale the count of forests/resources by 1.5² = 2.25 for the bigger map:
Now add tower auto-attack in updateBuilding. Let me look at it:
Add fields:
Now add projectile update in the main loop and drawing. Also need to import correctly. Let me update updateGame:
Now update the AI to use the new buildings too — bots should also build lumbermills, mills, towers, castles. Let me look:
Now the biggest task: add render code for the 8 new buildings, the knight unit, and projectiles. Let me update render.ts:
Now add all 8 building drawing functions plus knight + projectiles. Let me append them at the end of the render module, then add projectile rendering to draw() and knight to drawUnit. First let me add the building draw functions after drawFarm:
Now add the knight unit rendering and projectile drawing. First let me update the drawUnit switch:
Add drawKnight function and projectile rendering. Let me add them after drawArcher:
Now add projectile rendering in the main draw() function. Let me add it after entities are drawn:
Now the biggest UI task: the App.tsx build panel needs the new buildings, castles need training UI (knight), the manual-order flag has to be set in onContextMenu, and we need a small map-size fix — the initial camera centering should still work. Let me build first to catch errors, then fix.
Build passes. Now App.tsx — set manualOrder = true in the right-click handler, and update the build panel + building panel. Let me view the current handlers:
Now update the buildable list (buildables) and building panel to show new buildings + castle training + a categorized layout. Let me look at the panels:
Now the UnitsPanel with all new buildings, grouped by category. Let me view it:
Now rewrite the UnitsPanel to have all buildings grouped by category. I need BUILDING_CATEGORY imported first. Let me check the imports:
Now rewrite the UnitsPanel using tabs by category:
Remove unused import:
Also the initial camera centering used tile 16 — but the map starts at tile 16 (m=16). For the bigger map the player's TC still spawns at (16-1, 16-1) so this is fine. But let me make the panel wider since we added new categories. And also — the AI's pickTarget currently uses myTc — with lumbermills etc., bots will still work. Let me build:
Build passes. Let me widen the bottom panel to fit 3 columns of the new tiles nicely, and also — I notice the damageUnit function reroutes villagers when attacked. That's a survival reflex and should override manualOrder. That's already correct (it sets order directly). Good.
Let me also update the bottom-panel width:
One more thing — the map got 1.5× bigger, so the minimap could show more detail. Let me bump it slightly:
Also let me update the start-screen description to mention the new buildings/units:
Сборка успешна! Все запрошенные изменения внесены. 🏰
Что обновлено
🎯 Приказы игрока приоритетнее автоматизации
- Добавил флаг
manualOrder на юните. Когда игрок отдаёт крестьянину любую команду (добывать/двигаться/атаковать) — автоматика не будет её перебивать.
- Флаг сбрасывается только когда приказ действительно завершён: крестьянин пришёл к точке движения, добыл всё в узле, убил цель. После этого автоматизация снова помогает.
- Если крестьянин на добыче — он спокойно возит ресурс туда-обратно, как приказано. Если игрок отправил крестьянина стоять в углу — он там и стоит.
🏗️ 6 новых мирных построек
- 🌾 Ферма (была)
- ⚙️ Мельница — каменный корпус с крутящимися лопастями (реальная анимация вращения по времени)
- 🪚 Лесопилка — навес с штабелем брёвен и зубчатой дисковой пилой; дерево можно сдавать сюда, если она ближе
- ⛏️ Шахтёрский лагерь — палатка со скрещёнными кирками, вагонетка с золотом; сдача золота
- 🏪 Рынок — 2 разноцветных навеса, столбы, прилавки с товарами и бочка
- ⛪ Храм — 4 колонны, фронтон с золотой эмблемой-солнцем и ступенями (даёт +5 населения)
- 💧 Колодец — каменный круг с водой (с бликом), крыша на столбах и ведро на верёвке
⚔️ 2 новых военных здания
- 🗼 Сторожевая башня — многоярусная башня с зубцами, бойницей и остроконечной крышей. Автоматически стреляет стрелами по врагам в радиусе 6 (7 урона / 1.4 сек).
- 🏯 Замок — крупная крепость 4×4 с 4 угловыми башнями, донжоном, огромным флагом и подъёмным мостом. Стреляет мощнее (12 урона / 8 радиус) и тренирует нового юнита — Рыцаря 🐎 (110 HP, быстрый, 14 урона, с копьём, попоной цвета фракции и плюмажем на шлеме).
💥 Летящие стрелы
- Башни/замки выпускают снаряды с параболической дугой и наконечником — видно, кто и в кого стреляет.
🗺️ Карта расширена в 1.5×
- 140 → 210 тайлов по каждой стороне (2.25× площади)
- Лимит населения: 120 → 150
- В 2 раза больше лесов, ягод и золотых жил, чтобы карта была живой
🎨 Разнообразный визуал
Каждая из 12 построек уникальна — свои формы, цвета, детали (вращающиеся лопасти мельницы, дисковая пила, вагонетка, товары рынка, солнце храма, вода в колодце и т.д.). Цвет фракции есть у каждого здания в виде крыши, флага или эмблемы.
🎛️ Обновлённая панель строительства
Теперь с тремя вкладками — Экономика / Жилые / Военные — сеткой 3×N карточек с иконкой, названием и ценой.
Files built: src/game/types.ts, src/game/world.ts, src/game/logic.ts, src/game/ai.ts, src/game/render.ts, src/App.tsx