Update stdcmd.lua
This commit is contained in:
parent
4502a1206e
commit
e05b9bff5d
@ -26,7 +26,6 @@ console.add_command(
|
|||||||
"help name:str=''",
|
"help name:str=''",
|
||||||
"Show help infomation for the specified command",
|
"Show help infomation for the specified command",
|
||||||
function(args, kwargs)
|
function(args, kwargs)
|
||||||
|
|
||||||
local name = args[1]
|
local name = args[1]
|
||||||
if #name == 0 then
|
if #name == 0 then
|
||||||
|
|
||||||
@ -67,7 +66,6 @@ console.add_command(
|
|||||||
end
|
end
|
||||||
|
|
||||||
return str .. "\n" .. SEPARATOR
|
return str .. "\n" .. SEPARATOR
|
||||||
|
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -75,33 +73,14 @@ console.add_command(
|
|||||||
"time.uptime",
|
"time.uptime",
|
||||||
"Get time elapsed since the engine started",
|
"Get time elapsed since the engine started",
|
||||||
function()
|
function()
|
||||||
|
|
||||||
local uptime = time.uptime()
|
local uptime = time.uptime()
|
||||||
local years = math.floor(uptime / 31536000)
|
|
||||||
local days = math.floor((uptime % 31536000) / 86400) % 365
|
|
||||||
local hours = math.floor((uptime % 86400) / 3600) % 24
|
|
||||||
local minutes = math.floor((uptime % 3600) / 60) % 60
|
|
||||||
local seconds = math.floor(uptime % 60)
|
|
||||||
|
|
||||||
local formatted_uptime = ""
|
local formatted_uptime = ""
|
||||||
|
|
||||||
if years > 0 then
|
local t = string.FormattedTime(uptime)
|
||||||
formatted_uptime = formatted_uptime .. years .. "y "
|
|
||||||
end
|
|
||||||
if days > 0 or years > 0 then
|
|
||||||
formatted_uptime = formatted_uptime .. days .. "d "
|
|
||||||
end
|
|
||||||
if hours > 0 or days > 0 or years > 0 then
|
|
||||||
formatted_uptime = formatted_uptime .. hours .. "h "
|
|
||||||
end
|
|
||||||
if minutes > 0 or hours > 0 or days > 0 or years > 0 then
|
|
||||||
formatted_uptime = formatted_uptime .. minutes .. "m "
|
|
||||||
end
|
|
||||||
if seconds > 0 or minutes > 0 or hours > 0 or days > 0 or years > 0 then
|
|
||||||
formatted_uptime = formatted_uptime .. seconds .. "s"
|
|
||||||
end
|
|
||||||
|
|
||||||
return uptime .. " (" .. formatted_uptime .. ")"
|
formatted_uptime = t.h .. "h " .. t.m .. "m " .. t.s .. "s"
|
||||||
|
|
||||||
|
return formatted_uptime .. " (" .. uptime .. "s)"
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -111,7 +90,7 @@ console.add_command(
|
|||||||
function(args, kwargs)
|
function(args, kwargs)
|
||||||
local eid, x, y, z = unpack(args)
|
local eid, x, y, z = unpack(args)
|
||||||
local entity = entities.get(eid)
|
local entity = entities.get(eid)
|
||||||
if entity ~= nil then
|
if entity then
|
||||||
entity.transform:set_pos({x, y, z})
|
entity.transform:set_pos({x, y, z})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -127,7 +106,8 @@ console.add_command(
|
|||||||
"time.set value:num",
|
"time.set value:num",
|
||||||
"Set day time [0..1] where 0 is midnight, 0.5 is noon",
|
"Set day time [0..1] where 0 is midnight, 0.5 is noon",
|
||||||
function(args, kwargs)
|
function(args, kwargs)
|
||||||
return world.set_day_time(args[1])
|
world.set_day_time(args[1])
|
||||||
|
return "Time set to " .. args[1]
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
console.add_command(
|
console.add_command(
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user