@@ -5,88 +5,101 @@ Copyright 2020 Nordeck IT + Consulting GmbH.
55
66SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only OR LicenseRef-Element-Commercial
77Please see LICENSE files in the repository root for full details.
8- */
8+ */
9+
910import { _t , _td } from "../languageHandler" ;
10- import { type ConfettiOptions } from "./confetti" ;
11- import { type Effect } from "./effect" ;
12- import { type FireworksOptions } from "./fireworks" ;
13- import { type RainfallOptions } from "./rainfall" ;
14- import { type SnowfallOptions } from "./snowfall" ;
15- import { type SpaceInvadersOptions } from "./spaceinvaders" ;
16- import { type HeartOptions } from "./hearts" ;
11+ import { type Effect } from "./effect.ts" ;
1712
1813/**
1914 * This configuration defines room effects that can be triggered by custom message types and emojis
2015 */
21- export const CHAT_EFFECTS : Array < Effect < { [ key : string ] : any } > > = [
16+ export const CHAT_EFFECTS : Array < Effect > = [
2217 {
2318 emojis : [ "🎊" , "🎉" ] ,
2419 msgType : "nic.custom.confetti" ,
2520 command : "confetti" ,
2621 description : ( ) => _td ( "chat_effects|confetti_description" ) ,
2722 fallbackMessage : ( ) => _t ( "chat_effects|confetti_message" ) + " 🎉" ,
28- options : {
29- maxCount : 150 ,
30- speed : 3 ,
31- frameInterval : 15 ,
32- alpha : 1.0 ,
33- gradient : false ,
23+ getRenderer : async ( ) => {
24+ const { default : Effect } = await import ( "./confetti/index.ts" ) ;
25+ return new Effect ( {
26+ maxCount : 150 ,
27+ speed : 3 ,
28+ frameInterval : 15 ,
29+ alpha : 1.0 ,
30+ gradient : false ,
31+ } ) ;
3432 } ,
35- } as Effect < ConfettiOptions > ,
33+ } ,
3634 {
3735 emojis : [ "🎆" ] ,
3836 msgType : "nic.custom.fireworks" ,
3937 command : "fireworks" ,
4038 description : ( ) => _td ( "chat_effects|fireworks_description" ) ,
4139 fallbackMessage : ( ) => _t ( "chat_effects|fireworks_message" ) + " 🎆" ,
42- options : {
43- maxCount : 500 ,
44- gravity : 0.05 ,
40+ getRenderer : async ( ) => {
41+ const { default : Effect } = await import ( "./fireworks/index.ts" ) ;
42+ return new Effect ( {
43+ maxCount : 500 ,
44+ gravity : 0.05 ,
45+ } ) ;
4546 } ,
46- } as Effect < FireworksOptions > ,
47+ } ,
4748 {
4849 emojis : [ "🌧️" , "⛈️" , "🌦️" ] ,
4950 msgType : "io.element.effect.rainfall" ,
5051 command : "rainfall" ,
5152 description : ( ) => _td ( "chat_effects|rainfall_description" ) ,
5253 fallbackMessage : ( ) => _t ( "chat_effects|rainfall_message" ) + " 🌧️" ,
53- options : {
54- maxCount : 600 ,
55- speed : 10 ,
54+ getRenderer : async ( ) => {
55+ const { default : Effect } = await import ( "./rainfall/index.ts" ) ;
56+ return new Effect ( {
57+ maxCount : 600 ,
58+ speed : 10 ,
59+ } ) ;
5660 } ,
57- } as Effect < RainfallOptions > ,
61+ } ,
5862 {
5963 emojis : [ "❄" , "🌨" ] ,
6064 msgType : "io.element.effect.snowfall" ,
6165 command : "snowfall" ,
6266 description : ( ) => _td ( "chat_effects|snowfall_description" ) ,
6367 fallbackMessage : ( ) => _t ( "chat_effects|snowfall_message" ) + " ❄" ,
64- options : {
65- maxCount : 200 ,
66- gravity : 0.05 ,
67- maxDrift : 5 ,
68+ getRenderer : async ( ) => {
69+ const { default : Effect } = await import ( "./snowfall/index.ts" ) ;
70+ return new Effect ( {
71+ maxCount : 200 ,
72+ gravity : 0.05 ,
73+ maxDrift : 5 ,
74+ } ) ;
6875 } ,
69- } as Effect < SnowfallOptions > ,
76+ } ,
7077 {
7178 emojis : [ "👾" , "🌌" ] ,
7279 msgType : "io.element.effects.space_invaders" ,
7380 command : "spaceinvaders" ,
7481 description : ( ) => _td ( "chat_effects|spaceinvaders_description" ) ,
7582 fallbackMessage : ( ) => _t ( "chat_effects|spaceinvaders_message" ) + " 👾" ,
76- options : {
77- maxCount : 50 ,
78- gravity : 0.01 ,
83+ getRenderer : async ( ) => {
84+ const { default : Effect } = await import ( "./spaceinvaders/index.ts" ) ;
85+ return new Effect ( {
86+ maxCount : 50 ,
87+ gravity : 0.01 ,
88+ } ) ;
7989 } ,
80- } as Effect < SpaceInvadersOptions > ,
90+ } ,
8191 {
8292 emojis : [ "💝" ] ,
8393 msgType : "io.element.effect.hearts" ,
8494 command : "hearts" ,
8595 description : ( ) => _td ( "chat_effects|hearts_description" ) ,
8696 fallbackMessage : ( ) => _t ( "chat_effects|hearts_message" ) + " 💝" ,
87- options : {
88- maxCount : 120 ,
89- gravity : 3.2 ,
97+ getRenderer : async ( ) => {
98+ const { default : Effect } = await import ( "./hearts/index.ts" ) ;
99+ return new Effect ( {
100+ maxCount : 120 ,
101+ gravity : 3.2 ,
102+ } ) ;
90103 } ,
91- } as Effect < HeartOptions > ,
104+ } ,
92105] ;
0 commit comments