🐈
M README.md M init.lua
This commit is contained in:
parent
55ee4e0511
commit
8c4e8bdf3c
@ -1,5 +1,7 @@
|
||||
[Mod] giveme completion [giveme_completion]
|
||||
|
||||
This mod overrides the giveme chatcommand function that you don't need to type the full nodename for lots of nodes.
|
||||
|
||||
**License:** see [LICENSE.txt](https://raw.githubusercontent.com/HybridDog/giveme_completion/master/LICENSE.txt)
|
||||
**Download:** [zip](https://github.com/HybridDog/giveme_completion/archive/master.zip), [tar.gz](https://github.com/HybridDog/giveme_completion/tarball/master)
|
||||
|
||||
|
16
init.lua
16
init.lua
@ -1,4 +1,5 @@
|
||||
local load_time_start = os.clock()
|
||||
local load_time_start = minetest.get_us_time()
|
||||
|
||||
|
||||
local player_items = {}
|
||||
local function find_item(name, pname)
|
||||
@ -103,17 +104,20 @@ function minetest.chatcommands.giveme.func(name, param)
|
||||
local cnt = #items
|
||||
local txt = "More items found:\n"
|
||||
for i = 1,cnt-1 do
|
||||
txt = txt..i..": "..items[i]..", \t"
|
||||
--txt = txt..i..": "..items[i]..", \t"
|
||||
txt = txt..minetest.colorize("#fe55ff", i)..": "..items[i]..", \t"
|
||||
end
|
||||
txt = txt..cnt..": "..items[cnt]
|
||||
--txt = txt..cnt..": "..items[cnt]
|
||||
txt = txt..minetest.colorize("#fe55ff", cnt)..": "..items[cnt]
|
||||
return false, txt
|
||||
end
|
||||
return oldfunc(name, items..rest)
|
||||
end
|
||||
|
||||
local time = math.floor(tonumber(os.clock()-load_time_start)*100+0.5)/100
|
||||
local msg = "[giveme_completion] loaded after ca. "..time
|
||||
if time > 0.05 then
|
||||
|
||||
local time = (minetest.get_us_time() - load_time_start) / 1000000
|
||||
local msg = "[giveme_completion] loaded after ca. " .. time .. " seconds."
|
||||
if time > 0.01 then
|
||||
print(msg)
|
||||
else
|
||||
minetest.log("info", msg)
|
||||
|
Loading…
x
Reference in New Issue
Block a user