Commit Graph

820 Commits

Author SHA1 Message Date
20dka
6b65907a7f add ID parameter to onPlayerRequestMods and update Changelog.md 2022-11-23 09:34:51 +01:00
20dka
468a6b340e add event 'onPlayerRequestMods', restructure modloading
now every player has their own list of allowed client mods, this can be modified by lua upon joining and is later used as a whitelist to ensure only those files can be sent to each client
2022-11-23 09:34:51 +01:00
20dka
056827546e assign IDs to new players earlier in the connection process 2022-11-23 09:34:51 +01:00
20dka
6a47521c7c fix lua autocomplete crash when a table contains number keys 2022-11-23 09:34:51 +01:00
Lion Kortlepel
eaab5eaf30 fix crash which could happen when closing an invalid socket
for some reason boost::asio doesn't account for this and lets us simply
die when/if this happens.
2022-11-23 09:34:51 +01:00
Lion Kortlepel
35b38f35bb replace usages of ForEachClientWeak with ForEachClient 2022-11-23 09:34:51 +01:00
Lion Kortlepel
8551e68184 fix bug which could cause multiple players to have the same ID (closes #154) 2022-11-23 09:34:51 +01:00
Lion Kortlepel
2f85c708c5 rework GetClient to use new ForEachClient, return shared_ptr
this simplifies a lot of functions, and removes a lot of potential
errors when using the function. You now only check whether the return
value is null, and if it's not, you have a valid, reference-counted,
client pointer.
2022-11-23 09:34:51 +01:00
Lion Kortlepel
844b64f5d9 rework ForEachClient to use concepts instead of SFINAE 2022-11-23 09:34:51 +01:00
Lion Kortlepel
d7369c3bc5 deprecate ForEachClientWeak in favor of new ForEachClient 2022-11-23 09:34:51 +01:00
Lion Kortlepel
a8ad9034b2 update lk-result 2022-11-23 09:34:50 +01:00
Lion Kortlepel
b756ce3c3f fix formatting in all files 2022-11-23 09:34:50 +01:00
Lion Kortlepel
152393f8bf switch boost variant for std::variant for settings, for sol2 2022-11-23 09:34:50 +01:00
Lion Kortlepel
4cc163ea1c switch to c++20
this will allow us to use more convenience features of the language, and
leave more legacy code behind - also we can use c++20 libraries ;)
2022-11-23 09:34:50 +01:00
Lion Kortlepel
01bcc3d18c replace all clocks with a generic TimeType 2022-11-23 09:34:50 +01:00
Lion Kortlepel
c7f6835702 use high_resolution_clock instead of system_clock 2022-11-23 09:34:50 +01:00
Lion Kortlepel
0327b41611 change to system_clock for times converted to time_t 2022-11-23 09:34:50 +01:00
Lion Kortlepel
0411ba533d change onShutdown to be called before all players are kicked 2022-11-23 09:34:50 +01:00
Lion Kortlepel
e1c2d0d5fb add version command 2022-11-23 09:34:50 +01:00
Lion Kortlepel
69c2868025 fix server not closing after detecting an invalid config (fixes #151) 2022-11-23 09:34:50 +01:00
Lion Kortlepel
c8ca4564a1 fix error which complains about AuthKey not being present before reading the config file 2022-11-23 09:34:50 +01:00
Lion Kortlepel
3bd67d959f handle all exceptions which happen inside a logging macro
and print them ;)
2022-11-23 09:34:50 +01:00
Lion Kortlepel
13a86d3e77 add explanative debug messages to parse errors in GetPidVid 2022-11-23 09:34:50 +01:00
Lion Kortlepel
dff94a41be fix potential out of bounds exception in GetPidVid 2022-11-23 09:34:50 +01:00
Lion Kortlepel
79ee5915b4 fix unhandled out of bounds in Authentication 2022-11-23 09:34:50 +01:00
Lion Kortlepel
3fcf23977b fix fix for out-of-bounds crash, add disconnect messages to some failure conditions 2022-11-23 09:34:50 +01:00
Lion Kortlepel
487917482f fix out-of-range crash in SendFile
when the UnsafeName does not contain a `/`, the server would simply
crash, as an invalid substr() index was given, which triggered a
std::out_of_range.
2022-11-23 09:34:50 +01:00
20dka
9d8aeef423 refactor of vehicle packet handling 2022-11-23 09:34:50 +01:00
20dka
dee7f74906 remove unused PPSMonitor parameter 2022-11-23 09:34:50 +01:00
20dka
66f014ae42 add autocomplete for lua,kick,settings commands 2022-11-23 09:34:50 +01:00
20dka
12245d81a1 fix compilation error and use boost for string lowercase 2022-11-23 09:34:50 +01:00
20dka
a6e0332e3c add command 'quit' as alternative to 'exit' 2022-11-23 09:34:50 +01:00
20dka
c461a63d9d update client pointer lock approach 2022-11-23 09:34:50 +01:00
20dka
69726a9b03 add owner check to other vehicle packets 2022-11-23 09:34:50 +01:00
20dka
9acb6951d6 add owner check to position packets 2022-11-23 09:34:50 +01:00
Lion Kortlepel
6ebfe5743c add :Wait(timeout_s) function to the result of MP.TriggerGlobalEvent 2022-11-23 09:34:50 +01:00
Lion Kortlepel
3c138e2891 change date format from d/m/y to Y/m/d 2022-11-23 09:34:50 +01:00
Lion Kortlepel
2279ba4d6b attempt to report errors from event triggers 2022-11-23 09:34:50 +01:00
Lion Kortlepel
30b038a6bb revert adding nil to json
it causes issues, not worth it
2022-11-23 09:34:50 +01:00
Lion Kortlepel
06b238d63f remove unused code 2022-11-23 09:34:50 +01:00
Lion Kortlepel
1856dd2002 fix various little things in the json encode and decode 2022-11-23 09:34:50 +01:00
Lion Kortlepel
b068a9b48f fix TriggerGlobalEvent not passing event arguments correctly (closes #106) 2022-11-23 09:34:50 +01:00
Lion Kortlepel
e8d66ef983 add git hash to version print on startup
this helps us debug issues
2022-11-23 09:34:50 +01:00
Lion Kortlepel
7f47337e1b modify authkey notice to mention the possibility of entering an invalid key
this makes it clear that you may put anything as your key, as long as
you only want private servers.
2022-11-23 09:34:50 +01:00
Lion Kortlepel
b0b4dc51b0 fix crash when the header of a TCP packet is negative 2022-11-23 09:34:50 +01:00
Lion Kortlepel
7abfae425d move around includes to satisfy the magical msvc 2022-11-23 09:34:50 +01:00
Lion Kortlepel
4791af4453 use system_clock::to_time_t instead of high_resolution_clock::* 2022-11-23 09:34:50 +01:00
Lion Kortlepel
c51d713969 add uuid source files
were missed last commit related to uuids
2022-11-23 09:34:50 +01:00
Lion Kortlepel
9e469b04f1 add Util.GenerateUUID lua api
This api generates a pseudorandom RFC 4122 compliant UUID
(https://www.ietf.org/rfc/rfc4122.txt). It's pseudorandom, so it is
*unlikely* to have collisions.
2022-11-23 09:34:49 +01:00
Lion Kortlepel
96273e1d06 fix invalid include, reformat TConsole 2022-11-23 09:34:49 +01:00