Skip to content

Commit 032dbd3

Browse files
committed
Revert "Trigger onClientPlayerWeaponSwitch Event for Remote Players (fix #1141) (#3291)"
This reverts commit c4d63b4. For details, see comment on PR #3291
1 parent 66ebffd commit 032dbd3

File tree

5 files changed

+0
-54
lines changed

5 files changed

+0
-54
lines changed

Client/mods/deathmatch/logic/rpc/CPlayerRPCs.cpp

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ void CPlayerRPCs::LoadFunctions()
2323
AddHandler(SET_PLAYER_NAMETAG_SHOWING, SetPlayerNametagShowing, "SetPlayerNametagShowing");
2424
AddHandler(SET_PLAYER_TEAM, SetPlayerTeam, "SetPlayerTeam");
2525
AddHandler(TAKE_PLAYER_SCREEN_SHOT, TakePlayerScreenShot, "TakePlayerScreenShot");
26-
AddHandler(REMOTE_PLAYER_WEAPON_SWITCH, RemotePlayerSwitchWeapon, "RemotePlayerSwitchWeapon");
2726
}
2827

2928
void CPlayerRPCs::SetPlayerMoney(NetBitStreamInterface& bitStream)
@@ -169,22 +168,3 @@ void CPlayerRPCs::TakePlayerScreenShot(NetBitStreamInterface& bitStream)
169168

170169
m_pClientGame->TakePlayerScreenShot(usSizeX, usSizeY, strTag, ucQuality, uiMaxBandwidth, usMaxPacketSize, pResource, uiServerSentTime);
171170
}
172-
173-
void CPlayerRPCs::RemotePlayerSwitchWeapon(CClientEntity* pSource, NetBitStreamInterface& bitStream)
174-
{
175-
if (!bitStream.Can(eBitStreamVersion::OnPlayerWeaponSwitch_Remote))
176-
return;
177-
178-
uint lastSlot, currentSlot;
179-
if (!(bitStream.Read(lastSlot) && bitStream.Read(currentSlot)))
180-
return;
181-
182-
CClientPlayer* pPlayer = m_pPlayerManager->Get(pSource->GetID());
183-
if (!IS_REMOTE_PLAYER(pPlayer))
184-
return;
185-
186-
CLuaArguments Arguments;
187-
Arguments.PushNumber(lastSlot);
188-
Arguments.PushNumber(currentSlot);
189-
pPlayer->CallEvent("onClientPlayerWeaponSwitch", Arguments, true);
190-
}

Client/mods/deathmatch/logic/rpc/CPlayerRPCs.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,4 @@ class CPlayerRPCs : public CRPCFunctions
2727
DECLARE_ELEMENT_RPC(SetPlayerNametagShowing);
2828
DECLARE_ELEMENT_RPC(SetPlayerTeam);
2929
DECLARE_RPC(TakePlayerScreenShot);
30-
DECLARE_ELEMENT_RPC(RemotePlayerSwitchWeapon);
3130
};

Server/mods/deathmatch/logic/CRPCFunctions.cpp

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
#include "CElementIDs.h"
1818
#include "CWeaponNames.h"
1919
#include "CPerfStatManager.h"
20-
#include "packets/CElementRPCPacket.h"
2120
#include "CKeyBinds.h"
2221
#include "CStaticFunctionDefinitions.h"
2322
#include "net/SyncStructures.h"
@@ -179,32 +178,6 @@ void CRPCFunctions::PlayerWeapon(NetBitStreamInterface& bitStream)
179178
Arguments.PushNumber(m_pSourcePlayer->GetWeaponType(uiSlot));
180179

181180
m_pSourcePlayer->CallEvent("onPlayerWeaponSwitch", Arguments);
182-
183-
SViewerMapType& nearList = m_pSourcePlayer->GetNearPlayerList();
184-
185-
if (!nearList.empty())
186-
{
187-
static std::vector<CPlayer*> playersInNearList;
188-
playersInNearList.reserve(nearList.size());
189-
playersInNearList.clear();
190-
191-
for (const auto& player : nearList)
192-
{
193-
if (player.first->CanBitStream(eBitStreamVersion::OnPlayerWeaponSwitch_Remote))
194-
{
195-
playersInNearList.push_back(player.first);
196-
}
197-
}
198-
199-
if (!playersInNearList.empty())
200-
{
201-
CBitStream BitStream;
202-
BitStream.pBitStream->Write((unsigned int)ucPrevSlot);
203-
BitStream.pBitStream->Write(uiSlot);
204-
205-
m_pPlayerManager->Broadcast(CElementRPCPacket(m_pSourcePlayer, REMOTE_PLAYER_WEAPON_SWITCH, *BitStream.pBitStream), playersInNearList);
206-
}
207-
}
208181
}
209182

210183
m_pSourcePlayer->SetWeaponSlot(uiSlot);

Shared/sdk/net/bitstream.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -540,15 +540,10 @@ enum class eBitStreamVersion : unsigned short
540540
// 2023-10-12
541541
CPlayerJoinCompletePacket_ServerName,
542542

543-
// Send weapon switch for other players
544-
// 2023-01-13
545-
OnPlayerWeaponSwitch_Remote,
546-
547543
// Add "roadsignstext" to setWorldSpecialPropertyEnabled
548544
// 2024-05-17
549545
WorldSpecialProperty_RoadSignsText,
550546

551-
552547
// This allows us to automatically increment the BitStreamVersion when things are added to this enum.
553548
// Make sure you only add things above this comment.
554549
Next,

Shared/sdk/net/rpc_enums.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,6 @@ enum eElementRPCFunctions
104104
TAKE_ALL_WEAPONS,
105105
SET_WEAPON_AMMO,
106106
SET_WEAPON_SLOT,
107-
REMOTE_PLAYER_WEAPON_SWITCH,
108107

109108
DESTROY_ALL_BLIPS,
110109
SET_BLIP_ICON,

0 commit comments

Comments
 (0)