1
0
mirror of https://github.com/misskey-dev/misskey.git synced 2026-05-19 04:15:36 +02:00
This commit is contained in:
syuilo
2026-02-15 20:43:25 +09:00
parent d8d4b230b0
commit be67e75ef9
34 changed files with 789 additions and 310 deletions

View File

@@ -0,0 +1,17 @@
/*
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/
import { defineObject } from '../engine.js';
export const aircon = defineObject({
id: 'aircon',
defaultOptions: {},
placement: 'wall',
createInstance: () => {
return {
interactions: {},
};
},
});

View File

@@ -0,0 +1,52 @@
/*
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/
import * as BABYLON from '@babylonjs/core';
import { defineObject } from '../engine.js';
export const aquarium = defineObject({
id: 'aquarium',
defaultOptions: {},
placement: 'top',
createInstance: ({ room, o, root }) => {
return {
onInited: () => {
const noiseTexture = new BABYLON.NoiseProceduralTexture('perlin', 256, room.scene);
noiseTexture.animationSpeedFactor = 70;
noiseTexture.persistence = 10;
noiseTexture.brightness = 0.5;
noiseTexture.octaves = 5;
const emitter = new BABYLON.TransformNode('emitter', room.scene);
emitter.parent = root;
emitter.position = new BABYLON.Vector3(17/*cm*/, 7/*cm*/, -9/*cm*/);
const ps = new BABYLON.ParticleSystem('', 128, room.scene);
ps.particleTexture = new BABYLON.Texture('/client-assets/room/objects/lava-lamp/bubble.png');
ps.emitter = emitter;
ps.isLocal = true;
ps.minEmitBox = new BABYLON.Vector3(-2/*cm*/, 0, -2/*cm*/);
ps.maxEmitBox = new BABYLON.Vector3(2/*cm*/, 0, 2/*cm*/);
ps.minEmitPower = 40;
ps.maxEmitPower = 60;
ps.minLifeTime = 0.5;
ps.maxLifeTime = 0.5;
ps.minSize = 0.1/*cm*/;
ps.maxSize = 1/*cm*/;
ps.direction1 = new BABYLON.Vector3(0, 1, 0);
ps.direction2 = new BABYLON.Vector3(0, 1, 0);
ps.noiseTexture = noiseTexture;
ps.noiseStrength = new BABYLON.Vector3(500, 0, 500);
ps.emitRate = 32;
ps.blendMode = BABYLON.ParticleSystem.BLENDMODE_ADD;
//ps.color1 = new BABYLON.Color4(1, 1, 1, 0.3);
//ps.color2 = new BABYLON.Color4(1, 1, 1, 0.2);
//ps.colorDead = new BABYLON.Color4(1, 1, 1, 0);
ps.preWarmCycles = Math.random() * 1000;
ps.start();
},
interactions: {},
};
},
});

View File

@@ -0,0 +1,17 @@
/*
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/
import { defineObject } from '../engine.js';
export const banknote = defineObject({
id: 'banknote',
defaultOptions: {},
placement: 'top',
createInstance: () => {
return {
interactions: {},
};
},
});

View File

@@ -0,0 +1,17 @@
/*
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/
import { defineObject } from '../engine.js';
export const bed = defineObject({
id: 'bed',
defaultOptions: {},
placement: 'floor',
createInstance: () => {
return {
interactions: {},
};
},
});

View File

@@ -40,6 +40,7 @@ export const blind = defineObject({
const applyAngle = () => {
for (const b of [blade, ...blades]) {
b.rotation.x = o.options.angle;
b.rotation.x += Math.random() * 0.3 - 0.15;
}
};

View File

@@ -0,0 +1,35 @@
/*
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/
import * as BABYLON from '@babylonjs/core';
import { defineObject } from '../engine.js';
export const book = defineObject({
id: 'book',
defaultOptions: {
variation: null as number | null,
},
placement: 'top',
createInstance: ({ room, o, root }) => {
return {
onInited: () => {
const mesh = root.getChildMeshes()[1] as BABYLON.Mesh;
mesh.markVerticesDataAsUpdatable(BABYLON.VertexBuffer.UVKind, true);
const index = o.options.variation ?? 0;
const x = index % 8;
const y = Math.floor(index / 8);
const uvs = mesh.getVerticesData(BABYLON.VertexBuffer.UVKind)!;
for (let i = 0; i < uvs.length / 2; i++) {
const u = uvs[i * 2];
const v = uvs[i * 2 + 1];
uvs[i * 2] = (u / 8) + (x / 8);
uvs[i * 2 + 1] = (v / 8) + (y / 8);
}
mesh.updateVerticesData(BABYLON.VertexBuffer.UVKind, uvs);
},
interactions: {},
};
},
});

View File

@@ -0,0 +1,32 @@
/*
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/
import * as BABYLON from '@babylonjs/core';
import { defineObject } from '../engine.js';
export const cardboardBox = defineObject({
id: 'cardboardBox',
defaultOptions: {
variation: null as string | null,
},
placement: 'top',
createInstance: ({ room, o, root }) => {
return {
onInited: () => {
const boxMesh = root.getChildMeshes().find(m => m.name === 'Box') as BABYLON.Mesh;
if (o.options.variation === 'mikan') {
const tex = new BABYLON.Texture('/client-assets/room/objects/cardboard-box/textures/mikan.png', room.scene, false, false);
(boxMesh.material as BABYLON.PBRMaterial).albedoTexture = tex;
(boxMesh.material as BABYLON.PBRMaterial).albedoColor = new BABYLON.Color3(1, 1, 1);
} else if (o.options.variation === 'aizon') {
const tex = new BABYLON.Texture('/client-assets/room/objects/cardboard-box/textures/aizon.png', room.scene, false, false);
(boxMesh.material as BABYLON.PBRMaterial).albedoTexture = tex;
(boxMesh.material as BABYLON.PBRMaterial).albedoColor = new BABYLON.Color3(1, 1, 1);
}
},
interactions: {},
};
},
});

View File

@@ -0,0 +1,29 @@
/*
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/
import * as BABYLON from '@babylonjs/core';
import { defineObject } from '../engine.js';
export const ceilingFanLight = defineObject({
id: 'ceilingFanLight',
defaultOptions: {},
placement: 'ceiling',
createInstance: ({ room, o, root }) => {
return {
onInited: () => {
const rotor = root.getChildMeshes().find(m => m.name === 'Rotor') as BABYLON.Mesh;
rotor.rotation = rotor.rotationQuaternion != null ? rotor.rotationQuaternion.toEulerAngles() : rotor.rotation;
const anim = new BABYLON.Animation('', 'rotation.y', 60, BABYLON.Animation.ANIMATIONTYPE_FLOAT, BABYLON.Animation.ANIMATIONLOOPMODE_CYCLE);
anim.setKeys([
{ frame: 0, value: 0 },
{ frame: 100, value: Math.PI * 2 },
]);
rotor.animations = [anim];
room.scene.beginAnimation(rotor, 0, 100, true);
},
interactions: {},
};
},
});

View File

@@ -0,0 +1,18 @@
/*
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/
import { defineObject } from '../engine.js';
export const chair = defineObject({
id: 'chair',
defaultOptions: {},
placement: 'floor',
isChair: true,
createInstance: () => {
return {
interactions: {},
};
},
});

View File

@@ -0,0 +1,17 @@
/*
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/
import { defineObject } from '../engine.js';
export const colorBox = defineObject({
id: 'colorBox',
defaultOptions: {},
placement: 'floor',
createInstance: () => {
return {
interactions: {},
};
},
});

View File

@@ -0,0 +1,22 @@
/*
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/
import * as BABYLON from '@babylonjs/core';
import { defineObject } from '../engine.js';
import { yuge } from '../utility.js';
export const cupNoodle = defineObject({
id: 'cupNoodle',
defaultOptions: {},
placement: 'top',
createInstance: ({ room, root }) => {
return {
onInited: () => {
yuge(room, root, new BABYLON.Vector3(0, 10/*cm*/, 0));
},
interactions: {},
};
},
});

View File

@@ -0,0 +1,17 @@
/*
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/
import { defineObject } from '../engine.js';
export const desk = defineObject({
id: 'desk',
defaultOptions: {},
placement: 'floor',
createInstance: () => {
return {
interactions: {},
};
},
});

View File

@@ -0,0 +1,17 @@
/*
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/
import { defineObject } from '../engine.js';
export const energyDrink = defineObject({
id: 'energyDrink',
defaultOptions: {},
placement: 'top',
createInstance: () => {
return {
interactions: {},
};
},
});

View File

@@ -0,0 +1,17 @@
/*
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/
import { defineObject } from '../engine.js';
export const facialTissue = defineObject({
id: 'facialTissue',
defaultOptions: {},
placement: 'top',
createInstance: () => {
return {
interactions: {},
};
},
});

View File

@@ -0,0 +1,17 @@
/*
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/
import { defineObject } from '../engine.js';
export const keyboard = defineObject({
id: 'keyboard',
defaultOptions: {},
placement: 'top',
createInstance: () => {
return {
interactions: {},
};
},
});

View File

@@ -0,0 +1,68 @@
/*
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/
import * as BABYLON from '@babylonjs/core';
import { defineObject } from '../engine.js';
export const lavaLamp = defineObject({
id: 'lavaLamp',
defaultOptions: {},
placement: 'top',
createInstance: ({ room, o, root }) => {
return {
onInited: () => {
const light = new BABYLON.PointLight('lavaLampLight', new BABYLON.Vector3(0, 11/*cm*/, 0), room.scene);
light.parent = root;
light.diffuse = new BABYLON.Color3(1.0, 0.5, 0.2);
light.intensity = 300;
light.range = 100/*cm*/;
const sphere = BABYLON.MeshBuilder.CreateSphere('lavaLampLightSphere', { diameter: 4/*cm*/ }, room.scene);
sphere.parent = root;
sphere.position = new BABYLON.Vector3(0, 15/*cm*/, 0);
const mat = new BABYLON.StandardMaterial('lavaLampLightMat', room.scene);
mat.emissiveColor = new BABYLON.Color3(1.0, 0.5, 0.2);
mat.alpha = 0.5;
//mat.disableLighting = true;
sphere.material = mat;
const anim = new BABYLON.Animation('lavaLampLightAnim', 'position.y', 60, BABYLON.Animation.ANIMATIONTYPE_FLOAT, BABYLON.Animation.ANIMATIONLOOPMODE_CYCLE);
anim.setKeys([
{ frame: 0, value: 11/*cm*/ },
{ frame: 500, value: 38/*cm*/ },
]);
sphere.animations = [anim];
room.scene.beginAnimation(sphere, 0, 500, true);
const emitter = new BABYLON.TransformNode('emitter', room.scene);
emitter.parent = root;
emitter.position = new BABYLON.Vector3(0, 10/*cm*/, 0);
const ps = new BABYLON.ParticleSystem('', 32, room.scene);
ps.particleTexture = new BABYLON.Texture('/client-assets/room/objects/lava-lamp/bubble.png');
ps.emitter = emitter;
ps.isLocal = true;
ps.minEmitBox = new BABYLON.Vector3(-1/*cm*/, 0, -1/*cm*/);
ps.maxEmitBox = new BABYLON.Vector3(1/*cm*/, 0, 1/*cm*/);
ps.minEmitPower = 2;
ps.maxEmitPower = 3;
ps.minLifeTime = 9;
ps.maxLifeTime = 9;
ps.minSize = 0.5/*cm*/;
ps.maxSize = 1/*cm*/;
ps.direction1 = new BABYLON.Vector3(0, 1, 0);
ps.direction2 = new BABYLON.Vector3(0, 1, 0);
ps.emitRate = 1;
ps.blendMode = BABYLON.ParticleSystem.BLENDMODE_ADD;
ps.color1 = new BABYLON.Color4(1, 1, 1, 0.3);
ps.color2 = new BABYLON.Color4(1, 1, 1, 0.2);
ps.colorDead = new BABYLON.Color4(1, 1, 1, 0);
ps.preWarmCycles = Math.random() * 1000;
ps.start();
},
interactions: {},
};
},
});

View File

@@ -0,0 +1,17 @@
/*
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/
import { defineObject } from '../engine.js';
export const milk = defineObject({
id: 'milk',
defaultOptions: {},
placement: 'top',
createInstance: () => {
return {
interactions: {},
};
},
});

View File

@@ -0,0 +1,17 @@
/*
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/
import { defineObject } from '../engine.js';
export const monitor = defineObject({
id: 'monitor',
defaultOptions: {},
placement: 'top',
createInstance: () => {
return {
interactions: {},
};
},
});

View File

@@ -0,0 +1,17 @@
/*
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/
import { defineObject } from '../engine.js';
export const monstera = defineObject({
id: 'monstera',
defaultOptions: {},
placement: 'top',
createInstance: () => {
return {
interactions: {},
};
},
});

View File

@@ -0,0 +1,22 @@
/*
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/
import * as BABYLON from '@babylonjs/core';
import { defineObject } from '../engine.js';
import { yuge } from '../utility.js';
export const mug = defineObject({
id: 'mug',
defaultOptions: {},
placement: 'top',
createInstance: ({ room, root }) => {
return {
onInited: () => {
yuge(room, root, new BABYLON.Vector3(0, 5/*cm*/, 0));
},
interactions: {},
};
},
});

View File

@@ -0,0 +1,17 @@
/*
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/
import { defineObject } from '../engine.js';
export const openedCardboardBox = defineObject({
id: 'openedCardboardBox',
defaultOptions: {},
placement: 'top',
createInstance: () => {
return {
interactions: {},
};
},
});

View File

@@ -0,0 +1,17 @@
/*
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/
import { defineObject } from '../engine.js';
export const plant = defineObject({
id: 'plant',
defaultOptions: {},
placement: 'top',
createInstance: () => {
return {
interactions: {},
};
},
});

View File

@@ -0,0 +1,17 @@
/*
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/
import { defineObject } from '../engine.js';
export const plant2 = defineObject({
id: 'plant2',
defaultOptions: {},
placement: 'top',
createInstance: () => {
return {
interactions: {},
};
},
});

View File

@@ -0,0 +1,17 @@
/*
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/
import { defineObject } from '../engine.js';
export const powerStrip = defineObject({
id: 'powerStrip',
defaultOptions: {},
placement: 'top',
createInstance: () => {
return {
interactions: {},
};
},
});

View File

@@ -0,0 +1,17 @@
/*
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/
import { defineObject } from '../engine.js';
export const roundRug = defineObject({
id: 'roundRug',
defaultOptions: {},
placement: 'floor',
createInstance: () => {
return {
interactions: {},
};
},
});

View File

@@ -0,0 +1,17 @@
/*
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/
import { defineObject } from '../engine.js';
export const snakeplant = defineObject({
id: 'snakeplant',
defaultOptions: {},
placement: 'top',
createInstance: () => {
return {
interactions: {},
};
},
});

View File

@@ -0,0 +1,17 @@
/*
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/
import { defineObject } from '../engine.js';
export const steelRack = defineObject({
id: 'steelRack',
defaultOptions: {},
placement: 'floor',
createInstance: () => {
return {
interactions: {},
};
},
});

View File

@@ -0,0 +1,17 @@
/*
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/
import { defineObject } from '../engine.js';
export const tv = defineObject({
id: 'tv',
defaultOptions: {},
placement: 'top',
createInstance: () => {
return {
interactions: {},
};
},
});

View File

@@ -0,0 +1,31 @@
/*
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/
import * as BABYLON from '@babylonjs/core';
import { defineObject } from '../engine.js';
export const wallClock = defineObject({
id: 'wallClock',
defaultOptions: {},
placement: 'side',
createInstance: ({ room, o, root }) => {
return {
onInited: () => {
const hourHand = root.getChildMeshes().find(m => m.name === 'HandH') as BABYLON.Mesh;
const minuteHand = root.getChildMeshes().find(m => m.name === 'HandM') as BABYLON.Mesh;
room.intervalIds.push(window.setInterval(() => {
const now = new Date();
const hours = now.getHours() % 12;
const minutes = now.getMinutes();
const hAngle = -(hours / 12) * Math.PI * 2 - (minutes / 60) * (Math.PI * 2 / 12);
const mAngle = -(minutes / 60) * Math.PI * 2;
hourHand.rotation = new BABYLON.Vector3(0, 0, hAngle);
minuteHand.rotation = new BABYLON.Vector3(0, 0, mAngle);
}, 1000));
},
interactions: {},
};
},
});

View File

@@ -0,0 +1,17 @@
/*
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/
import { defineObject } from '../engine.js';
export const woodSoundAbsorbingPanel = defineObject({
id: 'woodSoundAbsorbingPanel',
defaultOptions: {},
placement: 'side',
createInstance: () => {
return {
interactions: {},
};
},
});