M  README.md
M  init.lua
This commit is contained in:
HybridDog 2016-06-04 22:13:11 +02:00
parent 55ee4e0511
commit 8c4e8bdf3c
2 changed files with 12 additions and 6 deletions

View File

@ -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)

View File

@ -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)