98 lines
2.4 KiB
JavaScript
98 lines
2.4 KiB
JavaScript
export default async function createHomestead(id) {
|
|
const area = {x: 100, y: 60};
|
|
const entities = [];
|
|
entities.push({
|
|
AreaSize: {x: area.x * 16, y: area.y * 16},
|
|
Ticking: {},
|
|
TileLayers: {
|
|
layers: [
|
|
{
|
|
area,
|
|
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: {},
|
|
Water: {water: {}},
|
|
});
|
|
entities.push({
|
|
Collider: {
|
|
bodies: [
|
|
{
|
|
points: [
|
|
{x: -36, y: 8},
|
|
{x: -21, y: 8},
|
|
{x: -36, y: 17},
|
|
{x: -21, y: 17},
|
|
],
|
|
tags: ['door'],
|
|
},
|
|
{
|
|
impassable: 1,
|
|
points: [
|
|
{x: -52, y: -16},
|
|
{x: 44, y: -16},
|
|
{x: -52, y: 15},
|
|
{x: 44, y: 15},
|
|
],
|
|
},
|
|
],
|
|
collisionStartScript: '/assets/shit-shack/collision-start.js',
|
|
},
|
|
Ecs: {
|
|
path: ['houses', `${id}`].join('/'),
|
|
},
|
|
Position: {x: 100, y: 100},
|
|
Sprite: {
|
|
anchorX: 0.5,
|
|
anchorY: 0.8,
|
|
source: '/assets/shit-shack/shit-shack.json',
|
|
},
|
|
Ticking: {},
|
|
VisibleAabb: {},
|
|
});
|
|
entities.push({
|
|
Collider: {
|
|
bodies: [
|
|
{
|
|
impassable: 1,
|
|
points: [
|
|
{x: -11, y: -7},
|
|
{x: 10, y: -7},
|
|
{x: 10, y: 5},
|
|
{x: -11, y: 5},
|
|
],
|
|
},
|
|
],
|
|
},
|
|
Interactive: {
|
|
interacting: 1,
|
|
interactScript: `
|
|
subject.Interlocutor.dialogue({
|
|
body: '<strong>Hey</strong><rate frequency={1}> </rate><rate frequency={0}><shake>what</shake></rate> <em>is</em> <wave frequency={0.5}>uu<rainbow frequency={2}>uu<blink>uu</blink><fade frequency={5}>uu<shake magnitude={4}>uu</shake>uuu</fade></rainbow>uup</wave>? ^_^',
|
|
origin: subject.Position.toJSON(),
|
|
position: {x: subject.Position.x, y: subject.Position.y - 32},
|
|
})
|
|
`,
|
|
},
|
|
Interlocutor: {},
|
|
Position: {x: 200, y: 200},
|
|
Sprite: {
|
|
anchorX: 0.5,
|
|
anchorY: 0.7,
|
|
source: '/assets/chest.json',
|
|
},
|
|
Ticking: {},
|
|
VisibleAabb: {},
|
|
});
|
|
return entities;
|
|
}
|