Skip to content

Commit 7ea4dac

Browse files
author
pushkin
committed
Восстановление бетонной крышки после лопаты
1 parent 51b71d5 commit 7ea4dac

2 files changed

Lines changed: 24 additions & 4 deletions

File tree

shared/level.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ export function createLevel(rawMapData, basesEnabled) {
55
if (!rawMapData) return [];
66

77
const map = [];
8+
let hasConcreteBlocker = false;
89

910
for (let r = 0; r < rawMapData.length; r++) {
1011
const row = [];
@@ -48,8 +49,6 @@ export function createLevel(rawMapData, basesEnabled) {
4849
// АВТО-УКРЕПЛЕНИЕ (Line of Sight)
4950
const checkCols = [12, 13]; // Центральные колонки
5051

51-
let hasConcreteBlocker = false;
52-
5352
// Сканируем пространство МЕЖДУ базами (исключая сами базы)
5453
// Ряды от 4 до 21 (примерно)
5554
for (let r = 4; r <= 21; r++) {
@@ -79,6 +78,8 @@ export function createLevel(rawMapData, basesEnabled) {
7978
}
8079
}
8180

81+
teamManager.setConcreteLid(!hasConcreteBlocker);
82+
8283
return map;
8384
}
8485

shared/team_manager.js

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ export class TeamManager {
55
constructor() {
66
this.teams = {};
77
this.basesEnabled = true;
8+
this.useConcreteLid = false;
89

910
TEAMS_CONFIG.forEach(cfg => {
1011
this.teams[cfg.id] = {
@@ -23,6 +24,10 @@ export class TeamManager {
2324
});
2425
}
2526

27+
setConcreteLid(enabled) {
28+
this.useConcreteLid = enabled;
29+
}
30+
2631
setBasesEnabled(enabled) {
2732
this.basesEnabled = enabled;
2833
}
@@ -64,12 +69,26 @@ export class TeamManager {
6469
if (!team || !team.baseAlive) return;
6570

6671
const walls = BASE_WALLS[teamId];
67-
const newType = isSteel ? 2 : 1;
72+
const baseType = isSteel ? 2 : 1;
6873

6974
walls.forEach(w => {
7075
if (map[w.r] && map[w.r][w.c] !== undefined) {
76+
77+
let typeToSet = baseType;
78+
79+
if (!isSteel && this.useConcreteLid) {
80+
const isCenter = (w.c === 12 || w.c === 13);
81+
82+
// Для Зеленых (1) ряд 23, для Красных (2) ряд 2
83+
const isLidRow = (teamId === 1 && w.r === 23) || (teamId === 2 && w.r === 2);
84+
85+
if (isCenter && isLidRow) {
86+
typeToSet = 2; // Принудительно Бетон
87+
}
88+
}
89+
7190
map[w.r][w.c] = {
72-
type: newType,
91+
type: typeToSet,
7392
mask: BLOCK_FULL,
7493
isBaseWall: true
7594
};

0 commit comments

Comments
 (0)