File tree Expand file tree Collapse file tree 2 files changed +12
-6
lines changed
Expand file tree Collapse file tree 2 files changed +12
-6
lines changed Original file line number Diff line number Diff line change @@ -141,6 +141,10 @@ const common_config = {
141141 kick_other_sessions : true
142142 } ,
143143
144+ chat : {
145+ create_global_chat : true
146+ } ,
147+
144148 tps : 20 , // tickrate
145149
146150 // Disable some of the features that you don't need in your game
Original file line number Diff line number Diff line change @@ -2,15 +2,17 @@ import Chat, { chatCreate } from "#concepts/chat";
22import ChatLog from "#schemas/chat" ;
33
44// create instances of every chat from the DB
5- const chatLogs = await ChatLog . find ( { } ) ;
6- chatLogs . forEach ( chatlog => {
7- let chat = new Chat ( chatlog ) ;
8- global . chats [ chat . chat_id ] = chat ;
9- } ) ;
5+ if ( global . config . db_enabled ) {
6+ const chatLogs = await ChatLog . find ( { } ) ;
7+ chatLogs . forEach ( chatlog => {
8+ let chat = new Chat ( chatlog ) ;
9+ global . chats [ chat . chat_id ] = chat ;
10+ } ) ;
11+ }
1012
1113
1214// create a new id=0 "global" chat if it doesn't exist already
13- if ( global . chats [ '0' ] === undefined ) {
15+ if ( global . chats [ '0' ] === undefined && global . config . chat . create_global_chat ) {
1416 let chatlog = new ChatLog ( ) ;
1517 chatlog . _id = '0' ;
1618
You can’t perform that action at this time.
0 commit comments