Lion
03b0bd4d2c
Add 'P' packet on UDP ( #379 )
...
This can be used to check if UDP works :)
I've tested this a bit with snep ingame, even spamming this on localhost
with a large number of connections seems to not impact gameplay at all.
2024-10-20 18:29:12 +02:00
Lion Kortlepel
f40d4c1ddd
add 'P' packet on UDP
...
this can be used to check if UDP works :)
2024-10-13 22:13:05 +02:00
Lion
4f052a3e0a
Make modlist an empty array by default instead of null ( #377 )
...
Related launcher PR: https://github.com/BeamMP/BeamMP-Launcher/pull/136
2024-10-12 21:06:41 +02:00
Lion
89c906232d
Report correct client minimum version to the backend ( #376 )
2024-10-09 18:06:03 +02:00
Lion and Tixx
c39beb5b72
reuse minclientversion where possible
...
Co-authored-by: Tixx <83774803+WiserTixx@users.noreply.github.com >
2024-10-09 18:03:01 +02:00
Lion Kortlepel
7dd2d89ad9
clarify auth version reject message
2024-10-09 16:48:40 +02:00
Lion Kortlepel
3403c8acba
fix version check on auth
2024-10-09 16:44:38 +02:00
Lion Kortlepel
0a6eecee69
report correct client minimum version to the backend
2024-10-09 16:37:16 +02:00
Lion
cf3985ce00
Add Lua function to get a player's role ( #366 )
...
Adds `MP.GetPlayerRole(player_id)` to the Lua API to get a player's role
("USER", "EA", "MDEV", "STAFF", "ET") by their player id.
Currently you can only get someone's role in onPlayerAuth from the
parameters and in onVehicleSpawned and onVehicleEdited from the packet
data, but not in onPlayerJoin for example without storing it.
2024-10-05 16:09:37 +02:00
Lion Kortlepel
b04c5068ea
bump version
2024-10-05 16:09:02 +02:00
Lion
077bb6b1cd
Add player limit bypass to onPlayerAuth ( #372 )
...
With this PR, returning 2 in onPlayerAuth will allow the player to join
without checking if the server is full. This makes it easier for plugin
developers to allow for example their staff to join without having to
change the max player count.
2024-10-05 16:07:53 +02:00
Lion
0850cde1fb
Add MP.SendNotification ( #373 )
...
Adds MP.SendNotification(message, icon, category (optional) ) to the Lua
api. Uses the newly added "N" packet in the mod.
2024-10-05 16:07:27 +02:00
Lion
611e53b484
Mod hashing + better download ( #374 )
2024-10-04 23:29:11 +02:00
Lion Kortlepel
5d34090952
fix stupid read size error leading to corrupt zip
2024-09-29 01:34:38 +02:00
Lion Kortlepel
88ca17236a
remove two-socket download
2024-09-29 01:15:48 +02:00
Lion Kortlepel
a4b62d013c
implement mod hashing + new download
2024-09-29 00:32:52 +02:00
Lion
55f1a3c734
Add MP.Get ( #369 )
...
Adds `MP.Get(ConfigID)` to the lua api to get the current server
settings.
```lua
lua> print(MP.Get(MP.Settings.Name]))
[LUA] BeamMP Server
lua> MP.Set(MP.Settings.Name, 'Hello World')
[INFO] Set `Name` to Hello World
lua> print(MP.Get(MP.Settings.Name))
[LUA] Hello World
```
Closes #146
2024-09-28 20:30:14 +02:00
Lion
7f69e336a9
Fix exception propagation on packet decompression ( #365 )
2024-09-20 11:39:36 +02:00
Lion
f08dfc0585
fix MaxPlayers setting using value of MaxCars ( #367 )
2024-09-20 11:39:22 +02:00
Lion Kortlepel
5319c2878a
bump version to v3.5.1
2024-09-19 17:24:57 +02:00
Lion Kortlepel
73f494041a
fix exception propagation on packet decompression
2024-09-19 16:59:17 +02:00
Lion Kortlepel
530d605bc1
fix release
2024-09-19 01:54:16 +02:00
Lion
63b2a8e4a3
Add post event(s) ( #364 )
...
Adds `post*` events which are triggered after the respective `on*` event
has completed and the results have been sent.
They have the same arguments as the `on*` function, with the exception
that another argument is added in the beginning which contains whether
the `on*` variant was cancelled.
2024-09-19 01:37:17 +02:00
Lion
a7a19d9a30
Fix disconnect not calling onVehicleDeleted ( #336 )
...
OnDisconnect sent a packet to the client, which was already
disconnected.
2024-09-18 18:08:46 +02:00
Lion Kortlepel
3068a0e5c4
add back car deletion
2024-09-18 16:46:11 +02:00
Lion Kortlepel
f70514a021
add postVehicleEdited
...
why the fuck is it in past tense
2024-09-18 16:34:56 +02:00
Lion Kortlepel
94768c916d
add postChatMessage
2024-09-18 16:30:49 +02:00
Lion Kortlepel
86b37e8ae1
move postPlayerAuth later again, after client insert
2024-09-18 16:26:26 +02:00
Lion Kortlepel
8f9db10474
move postPlayerAuth to after kick
2024-09-18 16:26:20 +02:00
Lion Kortlepel
afa5a04043
add postPlayerAuth
2024-09-18 16:26:16 +02:00
Lion Kortlepel
4444be0af9
add postVehicleSpawn event
2024-09-18 16:26:11 +02:00
Lion
5f7207bc52
Move toml11 out of vcpkg since the toml11 authors broke it ( #352 )
2024-09-18 16:18:38 +02:00
Lion Kortlepel
9927d2befb
add toml11 submodule
2024-09-18 15:58:55 +02:00
Lion Kortlepel
60f88916a9
remove toml11 from vcpkg.json
2024-09-18 15:51:11 +02:00
Lion
ce5f2e666d
Download Refactoring ( #356 )
...
Limits download RAM usage (to zero) on Linux by use of `sendfile(2)`
2024-08-31 20:32:23 +02:00
Lion
e076197ab2
support for non toplevel event handlers ( #360 )
...
this change replaces the `_G` event handler lookup with a lua snippet
that fetches whatever the user has set, which could be a module's
function, a builtin global, or even a function defined in the
`RegisterEvent `call
2024-08-31 20:30:02 +02:00
Lion Kortlepel
f3627ce0bf
Merge branch 'fix-little-issues' into minor
2024-07-28 10:54:55 +02:00
Lion Kortlepel
e1aaaf5e63
Merge branch 'fix-little-issues' into minor
2024-07-28 10:52:33 +02:00
Lion Kortlepel
a147edd31a
update to toml11 v3.4.1
2024-07-28 10:50:01 +02:00
Lion
214096409d
Add stack trace to server lua engine ( #350 )
...
Don't worry about it
2024-07-27 19:57:37 +02:00
Lion Kortlepel
ba723ee106
revert fix for sol2
2024-07-16 17:51:31 +02:00
Lion Kortlepel
49ed82bea1
add more info to debug print for freebsd ipv6 support
2024-07-16 17:30:45 +02:00
Lion Kortlepel
0d848fda7c
add warning about IPV6_V6ONLY=false not working on FreeBSD
2024-07-16 17:25:29 +02:00
Lion Kortlepel
a0040d8c57
fix invalid sol2 linking
2024-07-16 16:58:12 +02:00
Lion
baa2c86e25
fix typo in DeComp buffer size logic
2024-07-15 12:35:32 +02:00
Lion
0950d367d4
refactor decompression limits and resizing
2024-07-15 12:31:09 +02:00
Lion
8b21b6cef3
add comments to DeComp() magic numbers
2024-07-15 12:26:08 +02:00
Lion Kortlepel
82a6d4af60
repeat sendfile() until all data is sent
2024-07-14 17:01:24 +02:00
Lion Kortlepel
8b753ab6ea
ignore SIGPIPE in sendfile() implementation of mod sending
2024-07-14 17:01:08 +02:00
Lion Kortlepel
b097acfd4a
use sendfile64
2024-07-14 16:17:39 +02:00
Lion Kortlepel
5baeaa72c2
clarify RAM requirements
2024-07-14 16:03:08 +02:00
Lion Kortlepel
bd76e28ca6
use sendfile to send mods on linux
2024-07-14 15:33:26 +02:00
Lion Kortlepel
9db3619cd8
cleanup and add comments to traceback feature
2024-07-14 01:50:31 +02:00
Lion Kortlepel
6f4c3f0ceb
add traceback to lua errors by way of shitty lua hacks
2024-07-14 01:43:01 +02:00
Lion Kortlepel
eaedeb5324
add IPv6 support
2024-07-12 15:45:50 +02:00
Lion
72022e3349
Refactor config, add settings command ( #295 )
...
Fix #158
2024-06-26 14:24:24 +02:00
Lion Kortlepel
28a9690a64
validate Ot packets
2024-06-23 21:58:32 +02:00
Lion Kortlepel
07a8d49046
fix tcp send also
2024-06-22 23:56:18 +02:00
Lion Kortlepel
bfb0675efa
send large packets over tcp
2024-06-22 23:51:01 +02:00
Lion Kortlepel
105fd6d4c9
rewrite compression and decompression to limit at 30 MB
2024-06-22 22:47:31 +02:00
Lion
a9385c47e1
Adjust allow guests feature in heartbeat to follow Backend#33 ( #341 )
...
https://github.com/BeamMP/Backend/issues/33
2024-06-20 09:00:13 +02:00
Lion
1e9c4e357c
adjust allow guests feature in heartbeat to follow Backend#33
...
https://github.com/BeamMP/Backend/issues/33
2024-06-20 08:58:58 +02:00
Lion
a998a7c091
Reuse HTTP connections ( #339 )
...
fix #223
2024-06-16 03:10:29 +02:00
Lion
33b5384398
Add config setting to allow/deny guests ( #335 )
...
fix #247
2024-06-11 09:01:49 +02:00
Lion
8b94b1f0ef
Add an entry in serverconfig.toml for the time between update reminders ( #329 )
...
fix #321
2024-06-10 22:59:09 +02:00
Lion
2fcb53530a
Add more info to return to backend's /pkToUser endpoint ( #332 )
...
Features added were tested through a custom client (since @sla-ppy is
too cheap to own the game) with @lionkor while pair programming.
Fixes : #303
2024-06-01 12:25:01 +02:00
Lion
93192fd9b5
Fix #326 Arch Compile Issue "copy_n is not a member of 'std';" ( #327 )
...
added ```#include <algorithm>``` to Common.h, needed for "copy_n"
2024-05-24 23:01:48 +02:00
Lion
a3670bff4a
Add platform, lua, openssl version to version command, show lua version on startup ( #325 )
...
Closes #300
2024-05-24 12:58:30 +02:00
Lion Kortlepel
04e8d00daa
fix invalid default initialization in SettingsMap
2024-05-24 09:07:54 +02:00
Lion
fd2f713485
bump version
2024-05-21 08:52:05 +02:00
Lion
c880460a55
Fix macos compile Issue ( #324 )
...
Related [Issue 206](https://github.com/BeamMP/BeamMP-Server/issues/206 )
2024-05-19 12:57:49 +02:00
Lion Kortlepel
31ce0cc7de
add unit test + concept constraints for set(string)
2024-05-17 11:08:05 +02:00
Lion Kortlepel
3a8f4ded29
fix errors in Settings::set
2024-05-17 10:50:50 +02:00
Lion
5f9726f10f
Use hard disconnect instead of ClientKick in timeout ( #320 )
2024-05-11 13:00:25 +02:00
Lion Kortlepel
fcd408970b
always initialize ping timer
2024-05-11 12:44:41 +02:00
Lion
cf5ebcbd1a
Fix lua number (int vs double) handling, add lua unit tests for json encode + decode, fix empty array or table serializing to null ( #319 )
2024-05-11 12:19:13 +02:00
Lion
c9d926f9e3
Fix Lua assert error when adding values to tables (e.g. in event arguments) ( #318 )
...
When adding elements to a table, the .add() function does not behave as
expected in various cases, making it really shit and difficult to use.
Instead, we keep our own index and just add one by one. It works, and
it's easy to understand.
This may lead to indices which are nil, i.e. non-fully-sequential
tables, but I can't be asked to worry about it because that shouldn't be
an issue when we use .set() everywhere.
2024-05-11 12:18:56 +02:00
Lion Kortlepel
9f47978f0f
use hard disconnect insteadof clientkick
2024-05-11 12:17:02 +02:00
Lion Kortlepel
a0f649288e
fix lua number handling, add lua unit tests for json encode + decode
2024-05-10 15:54:52 +02:00
Lion Kortlepel
b995a222ff
bump version
2024-05-10 14:57:22 +02:00
Lion Kortlepel
c5dff8b913
fix lua assertion on event argument passing
...
When adding elements to a table, the .add() function does not behave as
expected in various cases, making it really shit and difficult to use.
Instead, we keep our own index and just add one by one. It works, and
it's easy to understand.
This may lead to indices which are nil, i.e. non-fully-sequential
tables, but I can't be asked to worry about it because that shouldn't be
an issue when we use .set() everywhere.
2024-05-10 14:45:06 +02:00
Lion
0c740ccedf
bump version
2024-05-08 12:01:33 +02:00
Lion
b0cf5c7838
Fix lua assertions crashing the server ( #198 )
...
The server would crash on a Lua plugin ASSERT() - this now instead
prints an error. May still lead to weird behavior, but less weird than a
crash.
2024-05-08 11:48:56 +02:00
Lion
586510041d
fix TriggerGlobalEvent not passing event arguments correctly ( #307 )
...
This is supposed to close #106 (The code is by @lionkor from
https://github.com/BeamMP/BeamMP-Server/commit/b068a9b48f21cc80c6aa2ae3580fc9a5e3d411e0 )
2024-05-08 11:47:23 +02:00
Lion
1794c3fe45
Add Lua execution profiler Util.DebugExecutionTime() ( #267 )
...
Adds `Util.DebugExecutionTime()`, which returns a table of
`function_name: milliseconds`, in which each function's execution time
is averaged over all time.
You can call this function like so:
```lua
-- event to print the debug times
MP.RegisterEvent("printStuff", "printStuff")
-- prints the execution time of all event handlers
function printStuff()
print(Util.DebugExecutionTime())
end
-- run every 5 seconds (or 10, or 60, whatever makes sense for you
MP.CreateEventTimer("printStuff", 5000)
```
Pretty print function:
```lua
function printDebugExecutionTime()
local stats = Util.DebugExecutionTime()
local pretty = "DebugExecutionTime:\n"
local longest = 0
for name, t in pairs(stats) do
if #name > longest then
longest = #name
end
end
for name, t in pairs(stats) do
pretty = pretty .. string.format("%" .. longest + 1 .. "s: %12f +/- %12f (min: %12f, max: %12f) (called %d time(s))\n", name, t.mean, t.stdev, t.min, t.max, t.n)
end
print(pretty)
end
```
`Util.DebugExecutionTime()` returns a table, where each key is an event
handler function name, and each value is a table consisting of `mean`
(simple average), `stddev` (standard deviation aka mean of the
variance), `min` and `max`, all in milliseconds, as well as `n` as the
number of samples taken.
2024-05-08 11:46:02 +02:00
Lion
ee599e970d
Make Plugin load order deterministic (alphabetic) ( #315 )
...
Add Feature / Fix : #306
2024-05-08 11:31:34 +02:00
Lion Kortlepel
40158dc252
fix compile error
2024-05-08 11:31:12 +02:00
Lion
4d7967d5d9
bump version ( #314 )
2024-05-06 14:37:50 +02:00
Lion Kortlepel
5dd4c97ed1
bump version
2024-05-06 14:37:34 +02:00
Lion
13390c5388
Remove backup1, backup2 backend endpoints ( #313 )
2024-05-06 12:05:30 +02:00
Lion Kortlepel
2f995a71ae
remove backup1, backup2 endpoints
2024-05-06 12:04:56 +02:00
Lion
3b5c6491a3
Fix timeout for synced players ( #289 )
...
Fix : #275 .
While I was at it, I also refactored the debug output so its more
appealing to read.
I dont see further ways to improve on this currently.
2024-05-06 12:02:31 +02:00
Lion
a3c4b82a5d
Allow provider to define server port ENV via BEAMMP_PROVIDER_PORT_ENV ( #244 )
2024-05-06 11:59:28 +02:00
Lion Kortlepel
3b0e49fb06
add /bigobj to fix compiling on windows
2024-05-06 11:56:26 +02:00
Lion Kortlepel
cf8f10b949
add --port=value argument
2024-05-06 11:56:26 +02:00
Lion Kortlepel
6f50cad76b
add BEAMMP_PROVIDER_PORT_ENV to allow provider to change which ENV
...
variable the port is fetched from
2024-05-06 11:56:26 +02:00
Lion
03d91b1f4d
Disable server config generation via ENV variable BEAMMP_PROVIDER_DISABLE_CONFIG ( #240 )
2024-05-06 11:53:57 +02:00
Lion Kortlepel
e407d246e2
update vcpkg
2024-05-06 11:47:00 +02:00
Lion Kortlepel
234bdf5877
add ENV variable to disable config generation and parsing
2024-05-06 11:46:21 +02:00
Lion
c3b4528c89
Add lua Util.LogInfo(), Util.LogError(), etc. functions ( #309 )
...
```lua
Util.LogInfo("Hello, World!")
Util.LogWarn("Cool warning")
Util.LogError("Oh no!")
Util.LogDebug("hi")
```
now produces
```
[19/04/24 11:06:50.142] [Test] [INFO] Hello, World!
[19/04/24 11:06:50.142] [Test] [WARN] Cool warning
[19/04/24 11:06:50.142] [Test] [ERROR] Oh no!
[19/04/24 11:06:50.142] [Test] [DEBUG] hi
```
where `Test` is the lua state id.
2024-05-06 11:39:12 +02:00