refactor: collision scripts
This commit is contained in:
parent
a2b30d2f8b
commit
eaf144668a
|
@ -28,15 +28,6 @@ export default async function createHomestead(id) {
|
|||
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: [
|
||||
|
@ -47,7 +38,6 @@ export default async function createHomestead(id) {
|
|||
],
|
||||
},
|
||||
],
|
||||
collisionStartScript: '/assets/shit-shack/collision-start.js',
|
||||
},
|
||||
Ecs: {
|
||||
path: ['houses', `${id}`].join('/'),
|
||||
|
@ -61,6 +51,36 @@ export default async function createHomestead(id) {
|
|||
Ticking: {},
|
||||
VisibleAabb: {},
|
||||
});
|
||||
entities.push({
|
||||
Collider: {
|
||||
bodies: [
|
||||
{
|
||||
points: [
|
||||
{x: -8, y: -5},
|
||||
{x: 8, y: -5},
|
||||
{x: 8, y: 5},
|
||||
{x: -8, y: 5},
|
||||
],
|
||||
},
|
||||
],
|
||||
collisionStartScript: `
|
||||
if (other.Player) {
|
||||
ecs.switchEcs(
|
||||
other,
|
||||
'houses/${id}',
|
||||
{
|
||||
Position: {
|
||||
x: 72,
|
||||
y: 304,
|
||||
},
|
||||
},
|
||||
);
|
||||
}
|
||||
`,
|
||||
},
|
||||
Position: {x: 71, y: 113},
|
||||
Ticking: {},
|
||||
});
|
||||
entities.push({
|
||||
Collider: {
|
||||
bodies: [
|
||||
|
|
|
@ -29,10 +29,20 @@ export default async function createHouse(Ecs, id) {
|
|||
],
|
||||
},
|
||||
],
|
||||
collisionStartScript: '/assets/house/collision-start.js',
|
||||
},
|
||||
Ecs: {
|
||||
path: ['homesteads', `${id}`].join('/'),
|
||||
collisionStartScript: `
|
||||
if (other.Player) {
|
||||
ecs.switchEcs(
|
||||
other,
|
||||
'homesteads/${id}',
|
||||
{
|
||||
Position: {
|
||||
x: 74,
|
||||
y: 128,
|
||||
},
|
||||
},
|
||||
);
|
||||
}
|
||||
`,
|
||||
},
|
||||
Position: {
|
||||
x: 72,
|
||||
|
|
|
@ -1,10 +0,0 @@
|
|||
ecs.switchEcs(
|
||||
other,
|
||||
entity.Ecs.path,
|
||||
{
|
||||
Position: {
|
||||
x: 74,
|
||||
y: 128,
|
||||
},
|
||||
},
|
||||
);
|
|
@ -1,16 +0,0 @@
|
|||
for (const [{tags}] of intersections) {
|
||||
if (tags && tags.includes('door')) {
|
||||
if (other.Player) {
|
||||
ecs.switchEcs(
|
||||
other,
|
||||
entity.Ecs.path,
|
||||
{
|
||||
Position: {
|
||||
x: 72,
|
||||
y: 304,
|
||||
},
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -17,7 +17,15 @@ for (let i = 0; i < 10; ++i) {
|
|||
],
|
||||
},
|
||||
],
|
||||
collisionStartScript: '/assets/tomato/collision-start.js',
|
||||
collisionStartScript: `
|
||||
if (other.Inventory) {
|
||||
other.Inventory.give({
|
||||
qty: 1,
|
||||
source: '/assets/tomato/tomato.json',
|
||||
})
|
||||
ecs.destroy(entity.id)
|
||||
}
|
||||
`,
|
||||
},
|
||||
Forces: {},
|
||||
Magnetic: {},
|
||||
|
|
|
@ -1,7 +0,0 @@
|
|||
if (other.Inventory) {
|
||||
other.Inventory.give({
|
||||
qty: 1,
|
||||
source: '/assets/tomato/tomato.json',
|
||||
})
|
||||
ecs.destroy(entity.id)
|
||||
}
|
Loading…
Reference in New Issue
Block a user