Fix custom coopdx server settings working in coop lobbies

This commit is contained in:
Agent X 2023-12-12 20:06:10 -05:00
parent 3af855b440
commit 641c2f4159
2 changed files with 27 additions and 16 deletions

View File

@ -231,20 +231,21 @@ bool exec_chat_command(char* command) {
return true; return true;
} }
if (gServerSettings.nametags) {
if (strcmp("/nametags", command) == 0) { if (strcmp("/nametags", command) == 0) {
djui_chat_message_create(DLANG(CHAT, NAMETAGS_MISSING_PARAMETERS)); djui_chat_message_create(DLANG(CHAT, NAMETAGS_MISSING_PARAMETERS));
return true; return true;
} }
if (str_starts_with("/nametags ", command)) { if (str_starts_with("/nametags ", command)) {
char *option = &command[10]; char *option = &command[10];
if (strcmp("show-tag", option) == 0) { if (strcmp("show-tag", option) == 0) {
gNametagsSettings.showSelfTag = !gNametagsSettings.showSelfTag; gNametagsSettings.showSelfTag = !gNametagsSettings.showSelfTag;
} else if (strcmp("show-health", option) == 0) { } else if (strcmp("show-health", option) == 0) {
gNametagsSettings.showHealth = !gNametagsSettings.showHealth; gNametagsSettings.showHealth = !gNametagsSettings.showHealth;
}
return true;
} }
return true;
} }
#ifdef DEVELOPMENT #ifdef DEVELOPMENT
@ -267,7 +268,9 @@ void display_chat_commands(void) {
djui_chat_message_create(DLANG(CHAT, MOD_DESC)); djui_chat_message_create(DLANG(CHAT, MOD_DESC));
} }
} }
djui_chat_message_create(DLANG(CHAT, NAMETAGS_DESC)); if (gServerSettings.nametags) {
djui_chat_message_create(DLANG(CHAT, NAMETAGS_DESC));
}
#ifdef DEVELOPMENT #ifdef DEVELOPMENT
dev_display_chat_commands(); dev_display_chat_commands();
#endif #endif

View File

@ -164,14 +164,22 @@ void network_receive_join(struct Packet* p) {
packet_read(p, &myGlobalIndex, sizeof(u8)); packet_read(p, &myGlobalIndex, sizeof(u8));
packet_read(p, &gCurrSaveFileNum, sizeof(s16)); packet_read(p, &gCurrSaveFileNum, sizeof(s16));
packet_read(p, &gServerSettings.playerInteractions, sizeof(u8)); packet_read(p, &gServerSettings.playerInteractions, sizeof(u8));
if (!gCoopCompatibility) { packet_read(p, &gServerSettings.bouncyLevelBounds, sizeof(u8)); } if (!gCoopCompatibility) {
packet_read(p, &gServerSettings.bouncyLevelBounds, sizeof(u8));
} else {
gServerSettings.bouncyLevelBounds = BOUNCY_LEVEL_BOUNDS_OFF;
}
packet_read(p, &gServerSettings.playerKnockbackStrength, sizeof(u8)); packet_read(p, &gServerSettings.playerKnockbackStrength, sizeof(u8));
packet_read(p, &gServerSettings.stayInLevelAfterStar, sizeof(u8)); packet_read(p, &gServerSettings.stayInLevelAfterStar, sizeof(u8));
packet_read(p, &gServerSettings.skipIntro, sizeof(u8)); packet_read(p, &gServerSettings.skipIntro, sizeof(u8));
packet_read(p, &gServerSettings.enableCheats, sizeof(u8)); packet_read(p, &gServerSettings.enableCheats, sizeof(u8));
packet_read(p, &gServerSettings.bubbleDeath, sizeof(u8)); packet_read(p, &gServerSettings.bubbleDeath, sizeof(u8));
packet_read(p, &gServerSettings.headlessServer, sizeof(u8)); packet_read(p, &gServerSettings.headlessServer, sizeof(u8));
if (!gCoopCompatibility) { packet_read(p, &gServerSettings.nametags, sizeof(u8)); } if (!gCoopCompatibility) {
packet_read(p, &gServerSettings.nametags, sizeof(u8));
} else {
gServerSettings.nametags = false;
}
packet_read(p, &gServerSettings.maxPlayers, sizeof(u8)); packet_read(p, &gServerSettings.maxPlayers, sizeof(u8));
packet_read(p, eeprom, sizeof(u8) * 512); packet_read(p, eeprom, sizeof(u8) * 512);