silphius/app/server/create/town.js

60 lines
1.2 KiB
JavaScript
Raw Normal View History

2024-07-23 17:04:17 -05:00
import data from '../../../public/assets/dev/town.json';
export default async function createTown() {
const area = {x: 60, y: 60};
const entities = [];
entities.push({
AreaSize: {x: area.x * 16, y: area.y * 16},
Ticking: {},
TileLayers: {
layers: [
{
area,
data,
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: {},
Water: {water: {}},
});
entities.push({
Collider: {
bodies: [
{
points: [
{x: -8, y: -16},
{x: 7, y: -16},
{x: 7, y: 15},
{x: -8, y: 15},
],
},
],
collisionStartScript: `
2024-07-24 01:50:33 -05:00
if (other.Player) {
ecs.switchEcs(
other,
['homesteads', other.Player.id].join('/'),
{
Position: {
x: 20,
y: 438,
},
2024-07-23 17:04:17 -05:00
},
2024-07-24 01:50:33 -05:00
);
}
2024-07-23 17:04:17 -05:00
`,
},
Position: {x: 952, y: 480},
Ticking: {},
});
return entities;
}