Skip to content

Commit

Permalink
Do not accidentally build barracks in the sea.
Browse files Browse the repository at this point in the history
GitOrigin-RevId: 962c88cbec0b61e53bb9af280c8441e0b611a14f
  • Loading branch information
cpojer committed Nov 15, 2024
1 parent 8662b2e commit 1f7495e
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions athena/lib/couldSpawnBuilding.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import getFirstOrThrow from '@deities/hephaestus/getFirstOrThrow.tsx';
import { BuildingInfo } from '../info/Building.tsx';
import { Plain } from '../info/Tile.tsx';
import { PlayerID } from '../map/Player.tsx';
import Vector from '../map/Vector.tsx';
import MapData from '../MapData.tsx';
Expand All @@ -12,16 +13,15 @@ export default function couldSpawnBuilding(
building: BuildingInfo,
player: PlayerID,
) {
const { editorPlaceOn, placeOn } = building.configuration;
const tiles = new Set([...(placeOn || []), ...editorPlaceOn]);
if (!tiles.has(map.getTileInfo(vector))) {
if (map.getTileInfo(vector) === Plain) {
const { editorPlaceOn, placeOn } = building.configuration;
const tileMap = map.map.slice();
const modifiers = map.modifiers.slice();
writeTile(
tileMap,
modifiers,
map.getTileIndex(vector),
getFirstOrThrow(tiles),
getFirstOrThrow(new Set([...(placeOn || []), ...editorPlaceOn])),
);
map = map.copy({
map: tileMap,
Expand Down

0 comments on commit 1f7495e

Please sign in to comment.