mirror of
https://github.com/minetest-mods/technic.git
synced 2025-02-22 23:00:22 +01:00
limit cpu time of the quarry
This commit is contained in:
parent
458f23b929
commit
897538d3fa
@ -178,7 +178,17 @@ local function quarry_run(pos, node)
|
|||||||
vector.multiply(qdir, -radius))
|
vector.multiply(qdir, -radius))
|
||||||
local owner = meta:get_string("owner")
|
local owner = meta:get_string("owner")
|
||||||
local nd = meta:get_int("dug")
|
local nd = meta:get_int("dug")
|
||||||
|
|
||||||
|
local t0 = minetest.get_us_time()
|
||||||
|
|
||||||
while nd < diameter*diameter * (quarry_dig_above_nodes+1+quarry_max_depth) do
|
while nd < diameter*diameter * (quarry_dig_above_nodes+1+quarry_max_depth) do
|
||||||
|
|
||||||
|
local us_used = minetest.get_us_time() - t0
|
||||||
|
if us_used > 50000 then
|
||||||
|
-- abort if this quarry takes too much time
|
||||||
|
break
|
||||||
|
end
|
||||||
|
|
||||||
local ry = math.floor(nd / (diameter*diameter))
|
local ry = math.floor(nd / (diameter*diameter))
|
||||||
local ndl = nd % (diameter*diameter)
|
local ndl = nd % (diameter*diameter)
|
||||||
if ry % 2 == 1 then
|
if ry % 2 == 1 then
|
||||||
|
Loading…
x
Reference in New Issue
Block a user