add: do not translate messages send to hlds console.
add: split messages sent to client & hlds console, so all message gets sent.
This commit is contained in:
parent
3b0f06bb09
commit
b8d35840b3
9 changed files with 143 additions and 59 deletions
|
|
@ -67,6 +67,8 @@ private:
|
|||
SmallArray <int32> m_botBuyEconomyTable = { 1900, 2100, 2100, 4000, 6000, 7000, 16000, 1200, 800, 1000, 3000 };
|
||||
SmallArray <int32> m_grenadeBuyPrecent = { 95, 85, 60 };
|
||||
|
||||
bool m_enableTranslation; // enable or disables translated output
|
||||
|
||||
public:
|
||||
BotConfig ();
|
||||
~BotConfig () = default;
|
||||
|
|
@ -140,6 +142,11 @@ private:
|
|||
|
||||
public:
|
||||
|
||||
// enables messages translation
|
||||
void enableTranslation (bool enable) {
|
||||
m_enableTranslation = enable;
|
||||
}
|
||||
|
||||
// checks whether chat banks contains messages
|
||||
bool hasChatBank (int chatType) const {
|
||||
return !m_chat[chatType].empty ();
|
||||
|
|
|
|||
|
|
@ -199,11 +199,22 @@ public:
|
|||
|
||||
// global heloer for sending message to correct channel
|
||||
template <typename ...Args> inline void BotControl::msg (const char *fmt, Args &&...args) {
|
||||
const bool isDedicated = game.isDedicated () && game.isNullEntity (m_ent);
|
||||
|
||||
// disable translation if we're sending to server console
|
||||
if (isDedicated) {
|
||||
conf.enableTranslation (false);
|
||||
}
|
||||
auto result = strings.format (conf.translate (fmt), cr::forward <Args> (args)...);
|
||||
|
||||
// if no receiver or many message have to appear, just print to server console
|
||||
if (game.isNullEntity (m_ent) || m_rapidOutput) {
|
||||
game.print (result);
|
||||
game.print (result); // print the info
|
||||
|
||||
// enable translation aftetwards
|
||||
if (isDedicated) {
|
||||
conf.enableTranslation (true);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -361,7 +361,10 @@ public:
|
|||
}
|
||||
|
||||
// helper to sending the client message
|
||||
void sendClientMessage (bool console, edict_t *ent, const char *message);
|
||||
void sendClientMessage (bool console, edict_t *ent, StringRef message);
|
||||
|
||||
// helper to sending the server message
|
||||
void sendServerMessage (StringRef message);
|
||||
|
||||
// send server command
|
||||
template <typename ...Args> void serverCommand (const char *fmt, Args &&...args) {
|
||||
|
|
@ -375,7 +378,7 @@ public:
|
|||
|
||||
// prints data to servers console
|
||||
template <typename ...Args> void print (const char *fmt, Args &&...args) {
|
||||
engfuncs.pfnServerPrint (strings.concat (strings.format (conf.translate (fmt), cr::forward <Args> (args)...), "\n", StringBuffer::StaticBufferSize));
|
||||
sendServerMessage (strings.concat (strings.format (conf.translate (fmt), cr::forward <Args> (args)...), "\n", StringBuffer::StaticBufferSize));
|
||||
}
|
||||
|
||||
// prints center message to specified player
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue