Trim trailing content when obtaining dedicated_server_step

This change trims anything starting with the first space from dedicated_server_step, including single-line comments following the configured value specifically, before using it for calculations. It fixes compatibility-breaking crashes with some mods/games, which change the mentioned value by adding a comment after it. Such a comment is, as far as I know, syntactically valid, and is accepted by the engine it seems.
This commit is contained in:
nauta-turbidus 2023-08-06 14:05:34 +02:00 committed by GitHub
parent 689ff90a78
commit b4202ea779
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -101,7 +101,7 @@ end
local function deferred_execution(next_one, finished)
-- Allocate 100% of server step for execution (might lag a little)
local allocated_usecs =
tonumber(minetest.settings:get("dedicated_server_step")) * 1000000
tonumber(minetest.settings:get("dedicated_server_step"):split(" ")[1]) * 1000000
local function f()
local deadline = minetest.get_us_time() + allocated_usecs
repeat