refactor: layer 1

This commit is contained in:
cha0s 2024-07-07 17:32:54 -05:00
parent cd875f8025
commit df61a43ab5
5 changed files with 19 additions and 6 deletions

View File

@ -13,7 +13,13 @@ export default async function createHomestead(Ecs) {
data: Array(area.x * area.y).fill(0).map(() => 1 + Math.floor(Math.random() * 4)),
source: '/assets/tileset.json',
tileSize: {x: 16, y: 16},
}
},
{
area,
data: Array(area.x * area.y).fill(0),
source: '/assets/tileset.json',
tileSize: {x: 16, y: 16},
},
],
},
Time: {},

View File

@ -1,8 +1,13 @@
const layer0 = ecs.get(1).TileLayers.layer(0)
const layer1 = ecs.get(1).TileLayers.layer(1)
const filtered = []
for (let i = 0; i < projected.length; ++i) {
const tile = layer.tile(projected[i])
if ([1, 2, 3, 4, 6].includes(tile)) {
if (
[1, 2, 3, 4, 6].includes(layer0.tile(projected[i]))
&& ![7].includes(layer1.tile(projected[i]))
) {
filtered.push(projected[i])
}
}

View File

@ -115,9 +115,7 @@ if (projected?.length > 0) {
}
for (let i = 0; i < projected.length; ++i) {
if ([1, 2, 3, 4].includes(layer.tile(projected[i]))) {
layer.stamp(projected[i], [[7]])
}
TileLayers.layer(1).stamp(projected[i], [[7]])
}
Controlled.locked = 0;

View File

@ -1,3 +1,5 @@
const layer = ecs.get(1).TileLayers.layer(1)
const filtered = []
for (let i = 0; i < projected.length; ++i) {

View File

@ -1,3 +1,5 @@
const layer = ecs.get(1).TileLayers.layer(1)
const filtered = []
for (let i = 0; i < projected.length; ++i) {