From 509db9790d174db2dca6b90f1130e812773f9457 Mon Sep 17 00:00:00 2001 From: sekta Date: Wed, 31 Jul 2024 17:44:25 +0400 Subject: [PATCH] srakotan --- res/scripts/stdcmd.lua | 17 +---------------- res/scripts/stdlib.lua | 38 ++++++++++++++++++-------------------- 2 files changed, 19 insertions(+), 36 deletions(-) diff --git a/res/scripts/stdcmd.lua b/res/scripts/stdcmd.lua index 95ba2639..61dccba8 100644 --- a/res/scripts/stdcmd.lua +++ b/res/scripts/stdcmd.lua @@ -69,21 +69,6 @@ console.add_command( end ) -local function FormattedTime(seconds, format ) -- from gmod - if not seconds then seconds = 0 end - - local hours = math.floor(seconds / 3600) - local minutes = math.floor((seconds / 60) % 60) - local millisecs = (seconds - math.floor(seconds)) * 100 - seconds = math.floor(seconds % 60) - - if format then - return string.format(format, minutes, seconds, millisecs) - else - return {h = hours, m = minutes, s = seconds, ms = millisecs} - end -end - console.add_command( "time.uptime", "Get time elapsed since the engine started", @@ -91,7 +76,7 @@ console.add_command( local uptime = time.uptime() local formatted_uptime = "" - local t = FormattedTime(uptime) + local t = string.formatted_time(uptime) formatted_uptime = t.h .. "h " .. t.m .. "m " .. t.s .. "s" diff --git a/res/scripts/stdlib.lua b/res/scripts/stdlib.lua index 5895ca06..60f9d2dd 100644 --- a/res/scripts/stdlib.lua +++ b/res/scripts/stdlib.lua @@ -285,25 +285,7 @@ entities.get_all = function(uids) end end -math.randomseed(time.uptime()*1536227939) - --- --------- Deprecated functions ------ -- -block_index = block.index -block_name = block.name -blocks_count = block.defs_count -is_solid_at = block.is_solid_at -is_replaceable_at = block.is_replaceable_at -set_block = block.set -get_block = block.get -get_block_X = block.get_X -get_block_Y = block.get_Y -get_block_Z = block.get_Z -get_block_states = block.get_states -set_block_states = block.set_states -get_block_rotation = block.get_rotation -set_block_rotation = block.set_rotation -get_block_user_bits = block.get_user_bits -set_block_user_bits = block.set_user_bits +math.randomseed(time.uptime() * 1536227939) ---------------------------------------------- @@ -444,7 +426,23 @@ function string.ends_with(str, endStr) return endStr == "" or string.sub(str, -string.len(endStr)) == endStr end ----------------------------------------------- +-- --------- Deprecated functions ------ -- +block_index = block.index +block_name = block.name +blocks_count = block.defs_count +is_solid_at = block.is_solid_at +is_replaceable_at = block.is_replaceable_at +set_block = block.set +get_block = block.get +get_block_X = block.get_X +get_block_Y = block.get_Y +get_block_Z = block.get_Z +get_block_states = block.get_states +set_block_states = block.set_states +get_block_rotation = block.get_rotation +set_block_rotation = block.set_rotation +get_block_user_bits = block.get_user_bits +set_block_user_bits = block.set_user_bits function load_script(path, nocache) on_deprecated_call("load_script")