add option to enable switch assist by default

This commit is contained in:
Martin Michelsen
2024-06-17 22:02:31 -07:00
parent 4416579210
commit e2c34dfb70
5 changed files with 13 additions and 1 deletions
+5 -1
View File
@@ -253,9 +253,13 @@ static bool send_enable_send_function_call_if_applicable(shared_ptr<Client> c) {
////////////////////////////////////////////////////////////////////////////////
void on_connect(std::shared_ptr<Client> c) {
auto s = c->require_server_state();
if (s->default_switch_assist_enabled) {
c->config.set_flag(Client::Flag::SWITCH_ASSIST_ENABLED);
}
switch (c->server_behavior) {
case ServerBehavior::PC_CONSOLE_DETECT: {
auto s = c->require_server_state();
uint16_t pc_port = s->name_to_port_config.at("pc-login")->port;
uint16_t console_port = s->name_to_port_config.at("console-login")->port;
send_pc_console_split_reconnect(c, s->connect_address_for_client(c), pc_port, console_port);
+1
View File
@@ -783,6 +783,7 @@ void ServerState::load_config_early() {
this->persistent_game_idle_timeout_usecs = this->config_json->get_int("PersistentGameIdleTimeout", 0);
this->cheat_mode_behavior = parse_behavior_switch("CheatModeBehavior", BehaviorSwitch::OFF_BY_DEFAULT);
this->default_switch_assist_enabled = this->config_json->get_bool("EnableSwitchAssistByDefault", false);
this->use_game_creator_section_id = this->config_json->get_bool("UseGameCreatorSectionID", false);
this->default_rare_notifs_enabled_v1_v2 = this->config_json->get_bool("RareNotificationsEnabledByDefault", false);
this->default_rare_notifs_enabled_v3_v4 = this->default_rare_notifs_enabled_v1_v2;
+1
View File
@@ -131,6 +131,7 @@ struct ServerState : public std::enable_shared_from_this<ServerState> {
bool hide_download_commands = true;
RunShellBehavior run_shell_behavior = RunShellBehavior::DEFAULT;
BehaviorSwitch cheat_mode_behavior = BehaviorSwitch::OFF_BY_DEFAULT;
bool default_switch_assist_enabled = false;
bool use_game_creator_section_id = false;
bool default_rare_notifs_enabled_v1_v2 = false;
bool default_rare_notifs_enabled_v3_v4 = false;
+5
View File
@@ -995,6 +995,11 @@
// available on the proxy server.
"CheatModeBehavior": "OnByDefault",
// Default switch assist behavior. Players can always toggle switch assist
// with the $swa command; this only controls whether it's enabled by default
// for all players or not.
"EnableSwitchAssistByDefault": false,
// Whether to enable rare drop notifications by default. Players can toggle
// this behavior for themselves with the $itemnotifs command.
"RareNotificationsEnabledByDefaultV1V2": false,
+1
View File
@@ -30,6 +30,7 @@
"DefaultDropModeV4Battle": "SERVER_SHARED",
"DefaultDropModeV4Challenge": "SERVER_SHARED",
"CheatModeBehavior": "OnByDefault",
"EnableSwitchAssistByDefault": false,
"RareNotificationsEnabledByDefault": false,
"NotifyGameForItemPrimaryIdentifiersV1V2": [],
"NotifyGameForItemPrimaryIdentifiersV3": [],