Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion SDK
3 changes: 3 additions & 0 deletions Server/Components/LegacyNetwork/legacy_network_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -828,6 +828,7 @@ void RakNetLegacyNetwork::start()

IConfig& config = core->getConfig();
int maxPlayers = *config.getInt("max_players");
int minimumSendBPS = *config.getFloat("network.minimum_send_bits_per_second");

int port = *config.getInt("network.port");
int sleep = static_cast<int>(*config.getFloat("sleep"));
Expand All @@ -837,6 +838,8 @@ void RakNetLegacyNetwork::start()
bool artwork = !artwork_config ? false : *artwork_config;
bool allow037 = *config.getBool("network.allow_037_clients");

SAMPRakNet::SetMinimumSendBitsPerSecond(minimumSendBPS); // Default: 96 kbps (~12 KB/s)

query.setCore(core);

std::stringstream version;
Expand Down
5 changes: 5 additions & 0 deletions Server/Components/NPCs/NPC/npc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1792,6 +1792,11 @@ void NPC::setWeaponState(PlayerWeaponState state)
}
}

Vector3 NPC::getPositionMovingTo() const
{
return targetPosition_;
}

void NPC::updateWeaponState()
{
switch (weapon_)
Expand Down
2 changes: 2 additions & 0 deletions Server/Components/NPCs/NPC/npc.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,8 @@ class NPC : public INPC, public PoolIDProvider, public NoCopy

void setWeaponState(PlayerWeaponState state) override;

Vector3 getPositionMovingTo() const override;

void setAmmoInClip(int ammo) override;

int getAmmoInClip() const override;
Expand Down
23 changes: 22 additions & 1 deletion Server/Components/Pawn/Scripting/NPC/Natives.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,21 @@ SCRIPT_API(NPC_GetSkin, bool(INPC& npc))
return -1;
}

SCRIPT_API(NPC_GetCustomSkin, bool(INPC& npc))
{
auto player = npc.getPlayer();
if (player)
{
IPlayerCustomModelsData* data = queryExtension<IPlayerCustomModelsData>(player);
if (!data)
{
return -1;
}
return data->getCustomSkin();
}
return -1;
}

SCRIPT_API(NPC_IsStreamedIn, bool(INPC& npc, IPlayer& player))
{
return npc.isStreamedInForPlayer(player);
Expand Down Expand Up @@ -535,7 +550,7 @@ SCRIPT_API(NPC_GetPathPoint, bool(int pathId, int pointIndex, Vector3& position,
return false;
}

SCRIPT_API(NPC_GetCurrentPathPointIndex, bool(INPC& npc))
SCRIPT_API(NPC_GetCurrentPathPointIndex, int(INPC& npc))
{
return npc.getCurrentPathPointIndex();
}
Expand Down Expand Up @@ -1088,3 +1103,9 @@ SCRIPT_API(NPC_SetWeaponState, bool(INPC& npc, int weaponState))
npc.setWeaponState(PlayerWeaponState(weaponState));
return true;
}

SCRIPT_API(NPC_GetPosMovingTo, bool(INPC& npc, Vector3& position))
{
position = npc.getPositionMovingTo();
return true;
}
1 change: 1 addition & 0 deletions Server/Source/core_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ static const std::map<String, ConfigStorage> Defaults {
{ "network.allow_037_clients", true },
{ "network.grace_period", 5000 },
{ "network.use_omp_encryption", false },
{ "network.minimum_send_bits_per_second", 96000.0f }, // 96 kbps (~12 KB/s)
// rcon
{ "rcon.allow_teleport", false },
{ "rcon.enable", false },
Expand Down
7 changes: 7 additions & 0 deletions docker/build_ubuntu-20.04/docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#!/bin/sh
[ -z $CONFIG ] && config=Release || config="$CONFIG"
[ -z $BUILD_SHARED ] && build_shared=1 || build_shared="$BUILD_SHARED"
[ -z $BUILD_SERVER ] && build_server=1 || build_server="$BUILD_SERVER"
[ -z $BUILD_TOOLS ] && build_tools=0 || build_tools="$BUILD_TOOLS"
[ -z $TARGET_BUILD_ARCH ] && target_build_arch=x86 || target_build_arch="$TARGET_BUILD_ARCH"

cd build \
Expand All @@ -8,6 +11,10 @@ cmake .. \
-G Ninja \
-DTARGET_BUILD_ARCH=$target_build_arch \
-DCMAKE_BUILD_TYPE=$config \
-DSHARED_OPENSSL=$build_shared \
-DSTATIC_STDCXX=true \
-DBUILD_SERVER=$build_server \
-DBUILD_ABI_CHECK_TOOL=$build_tools \
&&
cmake \
--build . \
Expand Down
7 changes: 7 additions & 0 deletions docker/build_ubuntu-22.04/docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#!/bin/sh
[ -z $CONFIG ] && config=Release || config="$CONFIG"
[ -z $BUILD_SHARED ] && build_shared=1 || build_shared="$BUILD_SHARED"
[ -z $BUILD_SERVER ] && build_server=1 || build_server="$BUILD_SERVER"
[ -z $BUILD_TOOLS ] && build_tools=0 || build_tools="$BUILD_TOOLS"
[ -z $TARGET_BUILD_ARCH ] && target_build_arch=x86 || target_build_arch="$TARGET_BUILD_ARCH"

cd build \
Expand All @@ -8,6 +11,10 @@ cmake .. \
-G Ninja \
-DTARGET_BUILD_ARCH=$target_build_arch \
-DCMAKE_BUILD_TYPE=$config \
-DSHARED_OPENSSL=$build_shared \
-DSTATIC_STDCXX=true \
-DBUILD_SERVER=$build_server \
-DBUILD_ABI_CHECK_TOOL=$build_tools \
&&
cmake \
--build . \
Expand Down
2 changes: 1 addition & 1 deletion lib/RakNet
Loading