chore: Add "Timeout" as a reaction (#1837)

This commit is contained in:
HCR-750F 2023-07-25 17:00:21 +08:00 committed by GitHub
parent 17e79dbaaa
commit f593d85af6
4 changed files with 12 additions and 2 deletions

View File

@ -14,7 +14,7 @@ namespace big
bool m_blockable;
bool m_karmaable;
NLOHMANN_DEFINE_TYPE_INTRUSIVE(interloper_reaction, announce_in_chat, notify, log, add_to_player_db, block_joins, kick, block, karma)// json doesn't serialize parent fields automatically
NLOHMANN_DEFINE_TYPE_INTRUSIVE(interloper_reaction, announce_in_chat, notify, log, add_to_player_db, block_joins, kick, block, karma, timeout)// json doesn't serialize parent fields automatically
virtual void process(player_ptr attacker, player_ptr victim);
};

View File

@ -48,6 +48,14 @@ namespace big
NETWORK::NETWORK_SESSION_KICK_PLAYER(player->id());
});
}
if (timeout)
{
player->block_net_events = true;
player->block_clone_sync = true;
player->block_clone_create = true;
LOG(WARNING) << std::format("{} has been timed out", player->get_name());
}
}

View File

@ -17,12 +17,13 @@ namespace big
bool add_to_player_db = false;
bool block_joins = false;
bool kick = false;
bool timeout = false;
const char* m_event_name;
const char* m_notify_message;
const char* m_announce_message;
NLOHMANN_DEFINE_TYPE_INTRUSIVE(reaction, announce_in_chat, notify, log, add_to_player_db, block_joins, kick)
NLOHMANN_DEFINE_TYPE_INTRUSIVE(reaction, announce_in_chat, notify, log, add_to_player_db, block_joins, kick, timeout)
reaction(const char* event_name, const char* notify_message, const char* announce_message);
virtual void process(player_ptr player);

View File

@ -24,6 +24,7 @@ namespace big
if (reaction.add_to_player_db)
ImGui::Checkbox("REACTION_BLOCK_JOINS"_T.data(), &reaction.block_joins);
ImGui::Checkbox("REACTION_KICK_PLAYER"_T.data(), &reaction.kick);
ImGui::Checkbox("Timeout", &reaction.timeout);
ImGui::TreePop();
}
ImGui::PopID();