Skip to content

Commit

Permalink
Revert "Trigger onClientPlayerWeaponSwitch Event for Remote Players (fix
Browse files Browse the repository at this point in the history
 #1141) (#3291)"

This reverts commit c4d63b4.
For details, see comment on PR #3291
  • Loading branch information
Dutchman101 committed May 23, 2024
1 parent 66ebffd commit 032dbd3
Show file tree
Hide file tree
Showing 5 changed files with 0 additions and 54 deletions.
20 changes: 0 additions & 20 deletions Client/mods/deathmatch/logic/rpc/CPlayerRPCs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ void CPlayerRPCs::LoadFunctions()
AddHandler(SET_PLAYER_NAMETAG_SHOWING, SetPlayerNametagShowing, "SetPlayerNametagShowing");
AddHandler(SET_PLAYER_TEAM, SetPlayerTeam, "SetPlayerTeam");
AddHandler(TAKE_PLAYER_SCREEN_SHOT, TakePlayerScreenShot, "TakePlayerScreenShot");
AddHandler(REMOTE_PLAYER_WEAPON_SWITCH, RemotePlayerSwitchWeapon, "RemotePlayerSwitchWeapon");
}

void CPlayerRPCs::SetPlayerMoney(NetBitStreamInterface& bitStream)
Expand Down Expand Up @@ -169,22 +168,3 @@ void CPlayerRPCs::TakePlayerScreenShot(NetBitStreamInterface& bitStream)

m_pClientGame->TakePlayerScreenShot(usSizeX, usSizeY, strTag, ucQuality, uiMaxBandwidth, usMaxPacketSize, pResource, uiServerSentTime);
}

void CPlayerRPCs::RemotePlayerSwitchWeapon(CClientEntity* pSource, NetBitStreamInterface& bitStream)
{
if (!bitStream.Can(eBitStreamVersion::OnPlayerWeaponSwitch_Remote))
return;

uint lastSlot, currentSlot;
if (!(bitStream.Read(lastSlot) && bitStream.Read(currentSlot)))
return;

CClientPlayer* pPlayer = m_pPlayerManager->Get(pSource->GetID());
if (!IS_REMOTE_PLAYER(pPlayer))
return;

CLuaArguments Arguments;
Arguments.PushNumber(lastSlot);
Arguments.PushNumber(currentSlot);
pPlayer->CallEvent("onClientPlayerWeaponSwitch", Arguments, true);
}
1 change: 0 additions & 1 deletion Client/mods/deathmatch/logic/rpc/CPlayerRPCs.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,4 @@ class CPlayerRPCs : public CRPCFunctions
DECLARE_ELEMENT_RPC(SetPlayerNametagShowing);
DECLARE_ELEMENT_RPC(SetPlayerTeam);
DECLARE_RPC(TakePlayerScreenShot);
DECLARE_ELEMENT_RPC(RemotePlayerSwitchWeapon);
};
27 changes: 0 additions & 27 deletions Server/mods/deathmatch/logic/CRPCFunctions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
#include "CElementIDs.h"
#include "CWeaponNames.h"
#include "CPerfStatManager.h"
#include "packets/CElementRPCPacket.h"
#include "CKeyBinds.h"
#include "CStaticFunctionDefinitions.h"
#include "net/SyncStructures.h"
Expand Down Expand Up @@ -179,32 +178,6 @@ void CRPCFunctions::PlayerWeapon(NetBitStreamInterface& bitStream)
Arguments.PushNumber(m_pSourcePlayer->GetWeaponType(uiSlot));

m_pSourcePlayer->CallEvent("onPlayerWeaponSwitch", Arguments);

SViewerMapType& nearList = m_pSourcePlayer->GetNearPlayerList();

if (!nearList.empty())
{
static std::vector<CPlayer*> playersInNearList;
playersInNearList.reserve(nearList.size());
playersInNearList.clear();

for (const auto& player : nearList)
{
if (player.first->CanBitStream(eBitStreamVersion::OnPlayerWeaponSwitch_Remote))
{
playersInNearList.push_back(player.first);
}
}

if (!playersInNearList.empty())
{
CBitStream BitStream;
BitStream.pBitStream->Write((unsigned int)ucPrevSlot);
BitStream.pBitStream->Write(uiSlot);

m_pPlayerManager->Broadcast(CElementRPCPacket(m_pSourcePlayer, REMOTE_PLAYER_WEAPON_SWITCH, *BitStream.pBitStream), playersInNearList);
}
}
}

m_pSourcePlayer->SetWeaponSlot(uiSlot);
Expand Down
5 changes: 0 additions & 5 deletions Shared/sdk/net/bitstream.h
Original file line number Diff line number Diff line change
Expand Up @@ -540,15 +540,10 @@ enum class eBitStreamVersion : unsigned short
// 2023-10-12
CPlayerJoinCompletePacket_ServerName,

// Send weapon switch for other players
// 2023-01-13
OnPlayerWeaponSwitch_Remote,

// Add "roadsignstext" to setWorldSpecialPropertyEnabled
// 2024-05-17
WorldSpecialProperty_RoadSignsText,


// This allows us to automatically increment the BitStreamVersion when things are added to this enum.
// Make sure you only add things above this comment.
Next,
Expand Down
1 change: 0 additions & 1 deletion Shared/sdk/net/rpc_enums.h
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@ enum eElementRPCFunctions
TAKE_ALL_WEAPONS,
SET_WEAPON_AMMO,
SET_WEAPON_SLOT,
REMOTE_PLAYER_WEAPON_SWITCH,

DESTROY_ALL_BLIPS,
SET_BLIP_ICON,
Expand Down

0 comments on commit 032dbd3

Please sign in to comment.