Skip to content

Commit

Permalink
Merge branch 'master' into feature/extendedwatercannons
Browse files Browse the repository at this point in the history
  • Loading branch information
FileEX authored May 24, 2024
2 parents 4544624 + ee7d32a commit ef84d4f
Show file tree
Hide file tree
Showing 312 changed files with 18,828 additions and 10,376 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);
};
1 change: 1 addition & 0 deletions Server/mods/deathmatch/logic/CGame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1592,6 +1592,7 @@ void CGame::AddBuiltInEvents()
m_Events.AddEvent("onPlayerProjectileCreation", "weaponType, posX, posY, posZ, force, target, rotX, rotY, rotZ, velX, velY, velZ", nullptr, false);
m_Events.AddEvent("onPlayerDetonateSatchels", "", nullptr, false);
m_Events.AddEvent("onPlayerTriggerEventThreshold", "", nullptr, false);
m_Events.AddEvent("onPlayerTeamChange", "oldTeam, newTeam", nullptr, false);

// Ped events
m_Events.AddEvent("onPedVehicleEnter", "vehicle, seat, jacked", NULL, false);
Expand Down
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
54 changes: 42 additions & 12 deletions Server/mods/deathmatch/logic/CStaticFunctionDefinitions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -328,19 +328,36 @@ bool CStaticFunctionDefinitions::DestroyElement(CElement* pElement)

// We can't destroy the root or a player/remote client/console
int iType = pElement->GetType();
if (pElement == m_pMapManager->GetRootElement() || iType == CElement::PLAYER || iType == CElement::CONSOLE ||
if (pElement == m_pMapManager->GetRootElement() || iType == CElement::PLAYER || iType == CElement::CONSOLE ||
g_pGame->GetResourceManager()->IsAResourceElement(pElement))
{
return false;
}

if (iType == CElement::TEAM) { // Its team trigger onPlayerTeamChange for each player in the team
CTeam* pTeam = static_cast<CTeam*>(pElement);

auto iterBegin = pTeam->PlayersBegin();
auto iterEnd = pTeam->PlayersEnd();
CLuaArguments arguments;

for (auto iter = iterBegin; iter != iterEnd; ++iter)
{
CPlayer* player = *iter;
arguments.PushElement(pTeam); // Return team element as oldteam
arguments.PushNil(); // No new team return nil
player->CallEvent("onPlayerTeamChange", arguments);
arguments.DeleteArguments();
}
}

// Tell everyone to destroy it if this is not a per-player entity
if (IS_PERPLAYER_ENTITY(pElement))
{
// Unsync it (will destroy it for those that know about it)
CPerPlayerEntity* pEntity = static_cast<CPerPlayerEntity*>(pElement);
pEntity->Sync(false);
}
}

// Tell everyone to destroy it
CEntityRemovePacket Packet;
Expand Down Expand Up @@ -9204,21 +9221,34 @@ bool CStaticFunctionDefinitions::SetPlayerTeam(CPlayer* pPlayer, CTeam* pTeam)
{
assert(pPlayer);

CTeam* currentTeam = pPlayer->GetTeam();
// If its a different team
if (pTeam != pPlayer->GetTeam())
if (pTeam == currentTeam)
return false;

// Call the Event
CLuaArguments Arguments;
if (currentTeam)
{
// Change his team
pPlayer->SetTeam(pTeam, true);
Arguments.PushElement(currentTeam);
}
else
{
Arguments.PushNil(); // No oldTeam return nil
}
Arguments.PushElement(pTeam);
if (!pPlayer->CallEvent("onPlayerTeamChange", Arguments))
return false; // Event cancelled, return false

// Tell everyone his new team
CBitStream BitStream;
BitStream.pBitStream->Write(pTeam ? pTeam->GetID() : INVALID_ELEMENT_ID);
m_pPlayerManager->BroadcastOnlyJoined(CElementRPCPacket(pPlayer, SET_PLAYER_TEAM, *BitStream.pBitStream));
// Change his team
pPlayer->SetTeam(pTeam, true);

return true;
}
// Tell everyone his new team
CBitStream BitStream;
BitStream.pBitStream->Write(pTeam ? pTeam->GetID() : INVALID_ELEMENT_ID);
m_pPlayerManager->BroadcastOnlyJoined(CElementRPCPacket(pPlayer, SET_PLAYER_TEAM, *BitStream.pBitStream));

return false;
return true;
}

bool CStaticFunctionDefinitions::SetTeamFriendlyFire(CTeam* pTeam, bool bFriendlyFire)
Expand Down
Binary file modified Shared/data/launchers/CEFLauncher.exe
Binary file not shown.
Binary file modified Shared/data/launchers/MTA Server ARM64.exe
Binary file not shown.
Binary file modified Shared/data/launchers/MTA Server.exe
Binary file not shown.
Binary file modified Shared/data/launchers/MTA Server64.exe
Binary file not shown.
Binary file modified Shared/data/launchers/Multi Theft Auto.exe
Binary file not shown.
Binary file modified Shared/data/launchers/wow64_helper.exe
Binary file not shown.
2 changes: 1 addition & 1 deletion Shared/sdk/net/bitstream.h
Original file line number Diff line number Diff line change
Expand Up @@ -540,6 +540,7 @@ enum class eBitStreamVersion : unsigned short
// 2023-10-12
CPlayerJoinCompletePacket_ServerName,


// Add "extendedwatercannons" to setWorldSpecialPropertyEnabled
// 2024-05-23
WorldSpecialProperty_ExtendedWaterCannons,
Expand All @@ -552,7 +553,6 @@ enum class eBitStreamVersion : unsigned short
// 2024-05-23
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
6 changes: 3 additions & 3 deletions utils/buildactions/install_unifont.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ premake.modules.install_unifont = {}

-- Config variables
local UNIFONT_BASEURL = "https://github.com/multitheftauto/unifont/releases/download/"
local UNIFONT_DOWNLOAD_FILENAME = "unifont-15.1.04.ttf"
local UNIFONT_DOWNLOAD_FILENAME = "unifont-15.1.05.ttf"
local UNIFONT_FILENAME = "unifont.ttf"
local UNIFONT_PATH = "Shared/data/MTA San Andreas/MTA/cgui"

-- Change these to update the version
local UNIFONT_TAG = "v15.1.04"
local UNIFONT_HASH = "1da5b1b2e41875cc009e8a3a22bc0e3d0d50d4febfd9021933ff4019d3270def"
local UNIFONT_TAG = "v15.1.05"
local UNIFONT_HASH = "ed6457062d96e58eaf6c77958a78068017fb4db8022e41b79435c3bc23c536d9"

newaction {
trigger = "install_unifont",
Expand Down
Loading

0 comments on commit ef84d4f

Please sign in to comment.