839 Commits

Author SHA1 Message Date
Maximilian Rehms
40e5496819 compiles now on macos 2024-05-18 15:06:26 +02:00
Lion
5f9726f10f
Use hard disconnect instead of ClientKick in timeout (#320) 2024-05-11 13:00:25 +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 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
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
586510041d
fix TriggerGlobalEvent not passing event arguments correctly (#307)
This is supposed to close #106 (The code is by @lionkor from
b068a9b48f)
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 Kortlepel
40158dc252
fix compile error 2024-05-08 11:31:12 +02:00
Neptnium
5ece60574a
Make Plugin load order deterministic
fix typo "mResourceServerPath" named "mFolder"

Fix typo number 2
2024-05-08 11:31:05 +02:00
Neptnium
c605498a2d
Merge branch 'BeamMP:minor' into minor 2024-05-07 08:26:44 +02:00
sla-ppy
db8719b5cd fix timeout for synced players 2024-05-06 12:02:16 +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 Kortlepel
234bdf5877
add ENV variable to disable config generation and parsing 2024-05-06 11:46:21 +02:00
Lion Kortlepel
5cf6d1d228
add Util.LogDebug 2024-04-20 20:16:57 +02:00
Lion Kortlepel
1237e7e533
add lua logging facilities as Util.Log*() functions 2024-04-19 11:10:50 +02:00
Neptnium
d81087b5af
fix TriggerGlobalEvent not passing event arguments correctly (closes #106) 2024-04-18 18:43:04 +02:00
Lion Kortlepel
c85e026c2d
cleanup 2024-03-07 00:45:00 +01:00
Lion Kortlepel
e4826e8bf1
remove test code 2024-03-07 00:42:36 +01:00
Lion Kortlepel
590b159f14
switch to a runnning calculation for stdev and mean 2024-03-07 00:25:47 +01:00
Lion Kortlepel
40533c04bc add total calls to stats 2024-03-06 10:27:22 +01:00
Lion Kortlepel
946c1362e1 add custom profiling via Debug(Start|Stop)Profile 2024-03-06 10:27:22 +01:00
Lion Kortlepel
4347cb4af2 add min, max, stddev to stats 2024-03-06 10:27:22 +01:00
Lion Kortlepel
7deea900fb add Util.DebugExecutionTime 2024-03-06 10:27:22 +01:00
Lion Kortlepel
cbc1483537 add profiling code 2024-03-06 10:27:22 +01:00
Lion
913ba1c793
Link to the docs instead of the wiki in ServerConfig.toml (#291)
Changed the update message as well.
Closes #290
2024-02-15 12:38:48 +01:00
sla-ppy
a0d9be18b7 documentate unicycle dirty fix 2024-02-14 13:51:37 +01:00
alex.ita
87d2e3355a
Update Common.cpp 2024-02-14 11:56:02 +01:00
alex.ita
afb3763eab
Update TConfig.cpp 2024-02-14 11:51:24 +01:00
sla-ppy
9de5a08b0c dirty fix unicycle counting as car 2024-02-12 01:24:17 +01:00
sla-ppy
e852245bae add mutex to openid 2024-02-08 23:29:10 +01:00
sla-ppy
64f2e08ed2 add the letter v 2024-02-07 21:46:18 +01:00
sla-ppy
707682f4a8 refactor version 2024-02-07 20:47:01 +01:00
sla-ppy
913674740d add version cmd 2024-02-07 16:07:22 +01:00
Lion Kortlepel
aff537afdf add AGPL-3.0 license header 2024-01-23 21:00:11 +01:00
Lucca Jiménez Könings
fff9580f66 remove unecessary comment
Signed-off-by: Lucca Jiménez Könings <development@jimkoen.com>
2024-01-19 14:29:05 +01:00
Lucca Jiménez Könings
9948f2412d move undef macros into Compat.h
Signed-off-by: Lucca Jiménez Könings <development@jimkoen.com>
2024-01-19 14:29:05 +01:00
Lucca Jiménez Könings
df5766a935 document FreeBSD specific undefs
Signed-off-by: Lucca Jiménez Könings <development@jimkoen.com>
2024-01-19 14:29:05 +01:00
Lucca Jiménez Könings
2a54d448c3 fix typo
Signed-off-by: Lucca Jiménez Könings <development@jimkoen.com>
2024-01-19 14:29:05 +01:00
Lucca Jiménez Könings
2374eba750 fix tests on FreeBSD
Signed-off-by: Lucca Jiménez Könings <development@jimkoen.com>
2024-01-19 14:29:05 +01:00
Lucca Jiménez Könings
f82572077f add FreeBSD build target
Signed-off-by: Lucca Jiménez Könings <development@jimkoen.com>
2024-01-19 14:29:05 +01:00
Lion Kortlepel
c6aa7776fc make update message adjustable by provider 2024-01-09 17:41:05 +01:00
Lion Kortlepel
4228e18c90 reset default ID to 0 2024-01-09 15:34:33 +01:00
Lion Kortlepel
023e968302 refactor position packet handling, add regression tests 2024-01-09 15:34:33 +01:00
Lion Kortlepel
a4eb10b6a4 fix MP.GetPositionRaw 2024-01-09 15:34:33 +01:00
Lion Kortlepel
0166e488d0 fix calling GlobalParser as static 2024-01-09 15:34:33 +01:00
Lion Kortlepel
0836fd3af8 fix bug in HandlePosition which caused the vehicle position not to be
saved properly
2024-01-09 15:34:33 +01:00
Lion Kortlepel
9791b8875c fix wrong order of SendErrorsShowMessage and SendErrors 2024-01-09 15:34:16 +01:00
Lion Kortlepel
e724a2e467
Merge remote-tracking branch 'origin/master' into feature-tags 2023-12-28 13:57:49 +01:00