1594 Commits

Author SHA1 Message Date
Lucca Jiménez Könings
67db9358e1
Fix concepts related error (for compat with gcc9)
Signed-off-by: Lucca Jiménez Könings <development@jimkoen.com>
2024-05-21 11:50:46 +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
Maximilian Rehms
7f54bcfaec
successful implemented suggested change to "lua_nil"
Co-authored-by: Lion <development@kortlepel.com>
2024-05-18 22:36:57 +02:00
Maximilian Rehms
785c5343cd removed warnig suppression 2024-05-18 15:11:42 +02:00
Maximilian Rehms
40e5496819 compiles now on macos 2024-05-18 15:06:26 +02:00
Lucca Jiménez Könings
4c9fbc250a
Change concepts in Settings.set + add test for remaining set overloads
Signed-off-by: Lucca Jiménez Könings <development@jimkoen.com>
2024-05-17 11:53:51 +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
Lucca Jiménez Könings
f567645db6
Add issue with implicit argument type conversions for Settings.set()
Signed-off-by: Lucca Jiménez Könings <development@jimkoen.com>
2024-05-15 13:40:25 +02:00
Lucca Jiménez Könings
3609fd77ec
Potential fix for compiler issues on Ubuntu
Signed-off-by: Lucca Jiménez Könings <development@jimkoen.com>
2024-05-15 13:15:54 +02:00
Lucca Jiménez Könings
a5e3fc8fb9
Add Sync.h
Signed-off-by: Lucca Jiménez Könings <development@jimkoen.com>
2024-05-15 12:57:08 +02:00
Lucca Jiménez Könings
bcd4b5a235
Fix Debug asserts on FreeBSD
Signed-off-by: Lucca Jiménez Könings <development@jimkoen.com>
2024-05-15 12:54:50 +02:00
Lucca Jiménez Könings
8c15b87628
Refactor all references to settings to use new Settings type
Signed-off-by: Lucca Jiménez Könings <development@jimkoen.com>
2024-05-15 12:52:09 +02:00
Lucca Jiménez Könings
13e641b3a3
Remove interfering legacy code (http,password,etc)
Signed-off-by: Lucca Jiménez Könings <development@jimkoen.com>
2024-05-15 12:45:19 +02:00
Lion
5f9726f10f
Use hard disconnect instead of ClientKick in timeout (#320) v3.4.1 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 v3.4.0 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
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
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
Neptnium
5ece60574a
Make Plugin load order deterministic
fix typo "mResourceServerPath" named "mFolder"

Fix typo number 2
2024-05-08 11:31:05 +02:00
Lucca Jiménez Könings
ff812429ed Fix settings set not accepting boolean literals
Signed-off-by: Lucca Jiménez Könings <development@jimkoen.com>
2024-05-07 18:16:06 +02:00
Lucca Jiménez Könings
639c46ad36 Remove additional debug calls
Signed-off-by: Lucca Jiménez Könings <development@jimkoen.com>
2024-05-07 18:16:06 +02:00
Lucca Jiménez Könings
158875a962 Remove debug code for new Settings implementation
Signed-off-by: Lucca Jiménez Könings <development@jimkoen.com>
2024-05-07 18:16:06 +02:00
Lucca Jiménez Könings
c6dac55679 Wrap Settings into synchronization primitives
Signed-off-by: Lucca Jiménez Könings <development@jimkoen.com>
2024-05-07 18:16:06 +02:00
Lucca Jiménez Könings
37109ae3f1 Make 'General::Debug' setting r/w from runtime
Signed-off-by: Lucca Jiménez Könings <development@jimkoen.com>
2024-05-07 18:16:05 +02:00
Lucca Jiménez Könings
d6b78b9683 Fix argument parsing at wrong index
Signed-off-by: Lucca Jiménez Könings <development@jimkoen.com>
2024-05-07 18:16:05 +02:00
Lucca Jiménez Könings
f5e2f7425f Fix ComposedKey metadata not printing to console
Make ComposedKey formattable by overloading fmt::format

Signed-off-by: Lucca Jiménez Könings <development@jimkoen.com>
2024-05-07 18:16:05 +02:00
Lucca Jiménez Könings
8693b8a2b0 Add list argument to command settings
Signed-off-by: Lucca Jiménez Könings <development@jimkoen.com>
2024-05-07 18:16:05 +02:00
Lucca Jiménez Könings
3989961ff9 Add get and set to console command settings
Signed-off-by: Lucca Jiménez Könings <development@jimkoen.com>
2024-05-07 18:16:05 +02:00
Lucca Jiménez Könings
a357ff8ca3 Add missing options to defaults
Signed-off-by: Lucca Jiménez Könings <development@jimkoen.com>
2024-05-07 18:16:05 +02:00
Lucca Jiménez Könings
86f0052e07 Add rudimentary access control to type Settings
Signed-off-by: Lucca Jiménez Könings <development@jimkoen.com>
2024-05-07 18:16:05 +02:00
Lucca Jiménez Könings
89034a64e0 Add logic for new Settings type
Signed-off-by: Lucca Jiménez Könings <development@jimkoen.com>
2024-05-07 18:16:05 +02:00
Lucca Jiménez Könings
55f5437618 Add new type Settings & refactor TSettings behavior
into Settings by adding getters/setters

Signed-off-by: Lucca Jiménez Könings <development@jimkoen.com>
2024-05-07 18:16:05 +02:00
Neptnium
c605498a2d
Merge branch 'BeamMP:minor' into minor 2024-05-07 08:26:44 +02:00
Lion
4d7967d5d9
bump version (#314) 2024-05-06 14:37:50 +02:00
Lion Kortlepel
5dd4c97ed1
bump version v3.3.0 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
sla-ppy
db8719b5cd fix timeout for synced players 2024-05-06 12:02:16 +02:00