summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 6698223)
raw | patch | inline | side by side (parent: 6698223)
author | fgsfds <pvt.fgsfds@gmail.com> | |
Sun, 25 Oct 2020 22:28:09 +0000 (01:28 +0300) | ||
committer | fgsfds <pvt.fgsfds@gmail.com> | |
Thu, 5 Nov 2020 17:58:59 +0000 (20:58 +0300) |
diff --git a/src/game/g_console.pas b/src/game/g_console.pas
index d3059549107a05b8fa58b92df8bbb916880f7109..c779409eaa4ecc070b5ddf844b941f1e4c16c7be 100644 (file)
--- a/src/game/g_console.pas
+++ b/src/game/g_console.pas
AddCommand('ready', GameCommands);
AddCommand('kick', GameCommands);
AddCommand('kick_id', GameCommands);
+ AddCommand('kick_pid', GameCommands);
AddCommand('ban', GameCommands);
- AddCommand('permban', GameCommands);
AddCommand('ban_id', GameCommands);
+ AddCommand('ban_pid', GameCommands);
+ AddCommand('permban', GameCommands);
AddCommand('permban_id', GameCommands);
+ AddCommand('permban_pid', GameCommands);
+ AddCommand('permban_ip', GameCommands);
AddCommand('unban', GameCommands);
AddCommand('connect', GameCommands);
AddCommand('disconnect', GameCommands);
WhitelistCommand('endmap');
WhitelistCommand('restart');
WhitelistCommand('kick');
+ WhitelistCommand('kick_pid');
WhitelistCommand('ban');
+ WhitelistCommand('ban_pid');
WhitelistCommand('centerprint');
WhitelistCommand('addbot');
diff --git a/src/game/g_game.pas b/src/game/g_game.pas
index 82d2981743c307471a549bd6a6e8ee65db137f58..8e3f80845b6be7acf54a4a67544da68c3b1e0c19 100644 (file)
--- a/src/game/g_game.pas
+++ b/src/game/g_game.pas
gShowFPS: Boolean = False;
gShowGoals: Boolean = True;
gShowStat: Boolean = True;
+ gShowPIDs: Boolean = False;
gShowKillMsg: Boolean = True;
gShowLives: Boolean = True;
gShowPing: Boolean = False;
stat: TPlayerStatArray;
wad, map: string;
mapstr: string;
+ namestr: string;
begin
s1 := '';
s2 := '';
gg := g;
bb := b;
end;
+ if gShowPIDs then
+ namestr := Format('[%5d] %s', [UID, Name])
+ else
+ namestr := Name;
// Èìÿ
- e_TextureFontPrintEx(x+16, _y, Name, gStdFont, rr, gg, bb, 1);
+ e_TextureFontPrintEx(x+16, _y, namestr, gStdFont, rr, gg, bb, 1);
// Ïèíã/ïîòåðè
e_TextureFontPrintEx(x+w1+16, _y, Format(_lc[I_GAME_PING_MS], [Ping, Loss]), gStdFont, rr, gg, bb, 1);
// Ôðàãè
r := 255;
g := 127;
end;
+ if gShowPIDs then
+ namestr := Format('[%5d] %s', [UID, Name])
+ else
+ namestr := Name;
// Öâåò èãðîêà
e_DrawFillQuad(x+16, _y+4, x+32-1, _y+16+4-1, Color.R, Color.G, Color.B, 0);
e_DrawQuad(x+16, _y+4, x+32-1, _y+16+4-1, 192, 192, 192);
// Èìÿ
- e_TextureFontPrintEx(x+16+16+8, _y+4, Name, gStdFont, r, g, 0, 1);
+ e_TextureFontPrintEx(x+16+16+8, _y+4, namestr, gStdFont, r, g, 0, 1);
// Ïèíã/ïîòåðè
e_TextureFontPrintEx(x+w1+16, _y+4, Format(_lc[I_GAME_PING_MS], [Ping, Loss]), gStdFont, r, g, 0, 1);
// Ôðàãè
end else
g_Console_Add(_lc[I_MSG_SERVERONLY]);
end
+ else if cmd = 'kick_pid' then
+ begin
+ if g_Game_IsServer and g_Game_IsNet then
+ begin
+ if Length(P) < 2 then
+ begin
+ g_Console_Add('kick_pid <player ID>');
+ Exit;
+ end;
+ if P[1] = '' then
+ begin
+ g_Console_Add('kick_pid <player ID>');
+ Exit;
+ end;
+
+ a := StrToIntDef(P[1], 0);
+ pl := g_Net_Client_ByPlayer(a);
+ if (pl <> nil) and pl^.Used and (pl^.Peer <> nil) then
+ begin
+ s := g_Net_ClientName_ByID(pl^.ID);
+ enet_peer_disconnect(pl^.Peer, NET_DISC_KICK);
+ g_Console_Add(Format(_lc[I_PLAYER_KICK], [s]));
+ MH_SEND_GameEvent(NET_EV_PLAYER_KICK, 0, s);
+ g_Net_Slist_ServerPlayerLeaves();
+ end;
+ end else
+ g_Console_Add(_lc[I_MSG_SERVERONLY]);
+ end
else if cmd = 'ban' then
begin
if g_Game_IsServer and g_Game_IsNet then
end else
g_Console_Add(_lc[I_MSG_SERVERONLY]);
end
+ else if cmd = 'ban_pid' then
+ begin
+ if g_Game_IsServer and g_Game_IsNet then
+ begin
+ if Length(P) < 2 then
+ begin
+ g_Console_Add('ban_pid <player ID>');
+ Exit;
+ end;
+ if P[1] = '' then
+ begin
+ g_Console_Add('ban_pid <player ID>');
+ Exit;
+ end;
+
+ a := StrToIntDef(P[1], 0);
+ pl := g_Net_Client_ByPlayer(a);
+ if (pl <> nil) and pl^.Used and (pl^.Peer <> nil) then
+ begin
+ s := g_Net_ClientName_ByID(pl^.ID);
+ g_Net_BanHost(pl^.Peer^.address.host, False);
+ enet_peer_disconnect(pl^.Peer, NET_DISC_TEMPBAN);
+ g_Console_Add(Format(_lc[I_PLAYER_BAN], [s]));
+ MH_SEND_GameEvent(NET_EV_PLAYER_BAN, 0, s);
+ g_Net_Slist_ServerPlayerLeaves();
+ end;
+ end else
+ g_Console_Add(_lc[I_MSG_SERVERONLY]);
+ end
else if cmd = 'permban' then
begin
if g_Game_IsServer and g_Game_IsNet then
end else
g_Console_Add(_lc[I_MSG_SERVERONLY]);
end
+ else if cmd = 'permban_pid' then
+ begin
+ if g_Game_IsServer and g_Game_IsNet then
+ begin
+ if Length(P) < 2 then
+ begin
+ g_Console_Add('permban_pid <player ID>');
+ Exit;
+ end;
+ if P[1] = '' then
+ begin
+ g_Console_Add('permban_pid <player ID>');
+ Exit;
+ end;
+
+ a := StrToIntDef(P[1], 0);
+ pl := g_Net_Client_ByPlayer(a);
+ if (pl <> nil) and pl^.Used and (pl^.Peer <> nil) then
+ begin
+ s := g_Net_ClientName_ByID(pl^.ID);
+ g_Net_BanHost(pl^.Peer^.address.host);
+ enet_peer_disconnect(pl^.Peer, NET_DISC_BAN);
+ g_Net_SaveBanList();
+ g_Console_Add(Format(_lc[I_PLAYER_BAN], [s]));
+ MH_SEND_GameEvent(NET_EV_PLAYER_BAN, 0, s);
+ g_Net_Slist_ServerPlayerLeaves();
+ end;
+ end else
+ g_Console_Add(_lc[I_MSG_SERVERONLY]);
+ end
+ else if cmd = 'permban_ip' then
+ begin
+ if g_Game_IsServer and g_Game_IsNet then
+ begin
+ if Length(P) < 2 then
+ begin
+ g_Console_Add('permban_ip <IP address>');
+ Exit;
+ end;
+ if P[1] = '' then
+ begin
+ g_Console_Add('permban_ip <IP address>');
+ Exit;
+ end;
+
+ g_Net_BanHost(P[1]);
+ g_Net_SaveBanList();
+ g_Console_Add(Format(_lc[I_PLAYER_BAN], [P[1]]));
+ end else
+ g_Console_Add(_lc[I_MSG_SERVERONLY]);
+ end
else if cmd = 'unban' then
begin
if g_Game_IsServer and g_Game_IsNet then
conRegVar('r_showlives', @gShowLives, 'show lives', 'show lives');
conRegVar('r_showspect', @gSpectHUD, 'show spectator hud', 'show spectator hud');
conRegVar('r_showstat', @gShowStat, 'show stats', 'show stats');
+ conRegVar('r_showpids', @gShowPIDs, 'show PIDs', 'show PIDs');
end.
diff --git a/src/game/g_net.pas b/src/game/g_net.pas
index 7dad24c613d1a30243f263f945b77e714f783353..7c5de2a51f0418201e7e24678177a7e9e4ae8f14 100644 (file)
--- a/src/game/g_net.pas
+++ b/src/game/g_net.pas
NetGotEverything: Boolean = False;
NetGotKeys: Boolean = False;
+ NetDeafLevel: Integer = 0;
+
{$IFDEF USE_MINIUPNPC}
NetPortForwarded: Word = 0;
NetPongForwarded: Boolean = False;
conRegVar('cl_interp', @NetInterpLevel, '', 'net player interpolation steps');
conRegVar('cl_last_ip', @NetClientIP, '', 'address of the last you have connected to');
conRegVar('cl_last_port', @NetClientPort, '', 'port of the last server you have connected to');
+ conRegVar('cl_deafen', @NetDeafLevel, '', 'filter server messages (0-3)');
conRegVar('sv_forwardports', @NetForwardPorts, '', 'forward server port using miniupnpc (requires server restart)');
conRegVar('sv_rcon', @NetAllowRCON, '', 'enable remote console');
diff --git a/src/game/g_netmsg.pas b/src/game/g_netmsg.pas
index 17942e24e65b63be12b38c02f369ee7a0d9f0e6d..0f57f84feeaf19f70148dae8ba60fcd250d53fe2 100644 (file)
--- a/src/game/g_netmsg.pas
+++ b/src/game/g_netmsg.pas
if Mode <> NET_CHAT_SYSTEM then
begin
- if Mode = NET_CHAT_PLAYER then
- begin
- g_Console_Add(Txt, True);
- e_WriteLog('[Chat] ' + b_Text_Unformat(Txt), TMsgType.Notify);
- g_Game_ChatSound(b_Text_Unformat(Txt));
- end else
- if (Mode = NET_CHAT_TEAM) and (gPlayer1 <> nil) then
+ if NetDeafLevel = 0 then
begin
- if gPlayer1.Team = TEAM_RED then
- g_Console_Add(b_Text_Format('\r[Team] ') + Txt, True);
- if gPlayer1.Team = TEAM_BLUE then
- g_Console_Add(b_Text_Format('\b[Team] ') + Txt, True);
- e_WriteLog('[Team Chat] ' + b_Text_Unformat(Txt), TMsgType.Notify);
- g_Game_ChatSound(b_Text_Unformat(Txt));
+ if Mode = NET_CHAT_PLAYER then
+ begin
+ g_Console_Add(Txt, True);
+ e_WriteLog('[Chat] ' + b_Text_Unformat(Txt), TMsgType.Notify);
+ g_Game_ChatSound(b_Text_Unformat(Txt));
+ end else
+ if (Mode = NET_CHAT_TEAM) and (gPlayer1 <> nil) then
+ begin
+ if gPlayer1.Team = TEAM_RED then
+ g_Console_Add(b_Text_Format('\r[Team] ') + Txt, True);
+ if gPlayer1.Team = TEAM_BLUE then
+ g_Console_Add(b_Text_Format('\b[Team] ') + Txt, True);
+ e_WriteLog('[Team Chat] ' + b_Text_Unformat(Txt), TMsgType.Notify);
+ g_Game_ChatSound(b_Text_Unformat(Txt));
+ end;
end;
- end else
+ end else if (NetDeafLevel < 2) then
g_Console_Add(Txt, True);
end;
NET_EV_CHANGE_TEAM:
begin
- if EvNum = TEAM_RED then
- g_Console_Add(Format(_lc[I_PLAYER_CHTEAM_RED], [EvStr]), True);
- if EvNum = TEAM_BLUE then
- g_Console_Add(Format(_lc[I_PLAYER_CHTEAM_BLUE], [EvStr]), True);
+ if NetDeafLevel < 2 then
+ begin
+ if EvNum = TEAM_RED then
+ g_Console_Add(Format(_lc[I_PLAYER_CHTEAM_RED], [EvStr]), True);
+ if EvNum = TEAM_BLUE then
+ g_Console_Add(Format(_lc[I_PLAYER_CHTEAM_BLUE], [EvStr]), True);
+ end;
end;
NET_EV_PLAYER_KICK:
g_Console_Add('*** ' + _lc[I_MESSAGE_LMS_SURVIVOR] + ' ***', True);
NET_EV_BIGTEXT:
- g_Game_Message(AnsiUpperCase(EvStr), Word(EvNum));
+ if NetDeafLevel < 2 then g_Game_Message(AnsiUpperCase(EvStr), Word(EvNum));
NET_EV_SCORE:
begin
end;
end;
- g_Console_Add(Format(_lc[I_PLAYER_JOIN], [PName]), True);
+ if NetDeafLevel < 3 then
+ g_Console_Add(Format(_lc[I_PLAYER_JOIN], [PName]), True);
e_WriteLog('NET: Player ' + PName + ' [' + IntToStr(PID) + '] added.', TMsgType.Notify);
Result := PID;
end;
Result := 0;
if Pl = nil then Exit;
- g_Console_Add(Format(_lc[I_PLAYER_LEAVE], [Pl.Name]), True);
+ if NetDeafLevel < 3 then
+ g_Console_Add(Format(_lc[I_PLAYER_LEAVE], [Pl.Name]), True);
e_WriteLog('NET: Player ' + Pl.Name + ' [' + IntToStr(PID) + '] removed.', TMsgType.Notify);
g_Player_Remove(PID);
if Pl.Name <> TmpName then
begin
- g_Console_Add(Format(_lc[I_PLAYER_NAME], [Pl.Name, TmpName]), True);
+ if NetDeafLevel < 3 then
+ g_Console_Add(Format(_lc[I_PLAYER_NAME], [Pl.Name, TmpName]), True);
Pl.Name := TmpName;
end;
Str1 := M.ReadString();
Str2 := M.ReadString();
- case EvID of
- NET_VE_STARTED:
- g_Console_Add(Format(_lc[I_MESSAGE_VOTE_STARTED], [Str1, Str2, Int1]), True);
- NET_VE_PASSED:
- g_Console_Add(Format(_lc[I_MESSAGE_VOTE_PASSED], [Str1]), True);
- NET_VE_FAILED:
- g_Console_Add(_lc[I_MESSAGE_VOTE_FAILED], True);
- NET_VE_VOTE:
- g_Console_Add(Format(_lc[I_MESSAGE_VOTE_VOTE], [Str1, Int1, Int2]), True);
- NET_VE_INPROGRESS:
- g_Console_Add(Format(_lc[I_MESSAGE_VOTE_INPROGRESS], [Str1]), True);
- end;
+ if NetDeafLevel < 2 then
+ case EvID of
+ NET_VE_STARTED:
+ g_Console_Add(Format(_lc[I_MESSAGE_VOTE_STARTED], [Str1, Str2, Int1]), True);
+ NET_VE_PASSED:
+ g_Console_Add(Format(_lc[I_MESSAGE_VOTE_PASSED], [Str1]), True);
+ NET_VE_FAILED:
+ g_Console_Add(_lc[I_MESSAGE_VOTE_FAILED], True);
+ NET_VE_VOTE:
+ g_Console_Add(Format(_lc[I_MESSAGE_VOTE_VOTE], [Str1, Int1, Int2]), True);
+ NET_VE_INPROGRESS:
+ g_Console_Add(Format(_lc[I_MESSAGE_VOTE_INPROGRESS], [Str1]), True);
+ end;
end;
// CLIENT SEND
diff --git a/src/game/g_player.pas b/src/game/g_player.pas
index 64e61666557c23ca74ea1011820a08725ee4d525..28032e95d4ea5c2b767c165ff8b6993915e5af21 100644 (file)
--- a/src/game/g_player.pas
+++ b/src/game/g_player.pas
Kills: Word;
Color: TRGB;
Spectator: Boolean;
+ UID: Word;
end;
TPlayerStatArray = Array of TPlayerStat;
Color := gPlayers[a].FModel.Color;
Lives := gPlayers[a].FLives;
Spectator := gPlayers[a].FSpectator;
+ UID := gPlayers[a].FUID;
end;
end;
end;