make infinite HP also heal conditions

This commit is contained in:
Martin Michelsen
2023-12-25 19:06:08 -08:00
parent dfc451e86a
commit c7059874d3
6 changed files with 60 additions and 8 deletions
+11 -3
View File
@@ -1463,15 +1463,23 @@ static void server_command_infinite_hp(shared_ptr<Client> c, const std::string&)
check_cheats_enabled(l, c);
c->config.toggle_flag(Client::Flag::INFINITE_HP_ENABLED);
send_text_message_printf(c, "$C6Infinite HP %s", c->config.check_flag(Client::Flag::INFINITE_HP_ENABLED) ? "enabled" : "disabled");
bool enabled = c->config.check_flag(Client::Flag::INFINITE_HP_ENABLED);
send_text_message_printf(c, "$C6Infinite HP %s", enabled ? "enabled" : "disabled");
if (enabled && l->is_game()) {
send_remove_conditions(c);
}
}
static void proxy_command_infinite_hp(shared_ptr<ProxyServer::LinkedSession> ses, const std::string&) {
auto s = ses->require_server_state();
check_cheats_allowed(s, ses);
ses->config.toggle_flag(Client::Flag::INFINITE_HP_ENABLED);
send_text_message_printf(ses->client_channel, "$C6Infinite HP %s",
ses->config.check_flag(Client::Flag::INFINITE_HP_ENABLED) ? "enabled" : "disabled");
bool enabled = ses->config.check_flag(Client::Flag::INFINITE_HP_ENABLED);
send_text_message_printf(ses->client_channel, "$C6Infinite HP %s", enabled ? "enabled" : "disabled");
if (enabled && ses->is_in_game) {
send_remove_conditions(ses->client_channel, ses->lobby_client_id);
send_remove_conditions(ses->server_channel, ses->lobby_client_id);
}
}
static void server_command_infinite_tp(shared_ptr<Client> c, const std::string&) {