1
0
mirror of https://github.com/misskey-dev/misskey.git synced 2026-05-22 21:04:08 +02:00
Files
misskey/packages/frontend/src/utility/room/objects/petBottle.ts
syuilo a8456a45ab wip
2026-02-25 19:15:26 +09:00

53 lines
949 B
TypeScript

/*
* 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 petBottle = defineObject({
id: 'petBottle',
name: 'PET Bottle',
options: {
schema: {
withCap: {
type: 'boolean',
label: 'With Cap',
},
empty: {
type: 'boolean',
label: 'Empty',
},
},
default: {
withCap: true,
empty: false,
},
},
placement: 'top',
createInstance: ({ findMesh, options }) => {
const capMesh = findMesh('__X_CAP__');
const liquidMesh = findMesh('__X_LIQUID__');
const applyWithCap = () => {
capMesh.setEnabled(options.withCap);
};
const applyEmpty = () => {
liquidMesh.setEnabled(!options.empty);
};
applyWithCap();
applyEmpty();
return {
onOptionsUpdated: ([k, v]) => {
applyWithCap();
applyEmpty();
},
interactions: {},
};
},
});