1
0
mirror of https://github.com/misskey-dev/misskey.git synced 2026-05-21 11:05:37 +02:00
Files
misskey/packages/frontend/src/world/room/objects/snakeplant.ts
syuilo 52e9395fab wip
2026-04-29 09:40:12 +09:00

47 lines
918 B
TypeScript

/*
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/
import * as BABYLON from '@babylonjs/core';
import { defineObject } from '../object.js';
export const snakeplant = defineObject({
id: 'snakeplant',
name: 'Snake Plant',
options: {
schema: {
potColor: {
type: 'color',
label: 'potColor',
},
},
default: {
potColor: [0.7, 0.7, 0.7],
},
},
placement: 'top',
hasCollisions: false,
hasTexture: true,
canPreMeshesMerging: true,
createInstance: ({ options, model }) => {
const potMaterial = model.findMaterial('__X_POT__');
const applyPotColor = () => {
const [r, g, b] = options.potColor;
potMaterial.albedoColor = new BABYLON.Color3(r, g, b);
};
applyPotColor();
return {
onOptionsUpdated: ([k, v]) => {
switch (k) {
case 'potColor': applyPotColor(); break;
}
},
interactions: {},
};
},
});