mirror of
https://github.com/lisacvuk/minetest-toolranks.git
synced 2024-08-20 05:04:05 +02:00
only update meta when needed
only update dug and level meta when needed
This commit is contained in:
parent
813897b514
commit
3def30b634
4
init.lua
4
init.lua
@ -58,6 +58,7 @@ function toolranks.new_afteruse(itemstack, user, node, digparams)
|
||||
-- Only count nodes that spend the tool
|
||||
if(digparams.wear > 0) then
|
||||
dugnodes = dugnodes + 1
|
||||
itemmeta:set_string("dug", dugnodes)
|
||||
end
|
||||
if(itemstack:get_wear() > 60135) then
|
||||
minetest.chat_send_player(user:get_player_name(), "Your tool is about to break, comrade!")
|
||||
@ -77,12 +78,11 @@ function toolranks.new_afteruse(itemstack, user, node, digparams)
|
||||
gain = 2.0,
|
||||
})
|
||||
minetest.chat_send_player(user:get_player_name(), levelup_text)
|
||||
itemmeta:set_string("lastlevel", level)
|
||||
end
|
||||
|
||||
local newdesc = toolranks.create_description(itemdesc, dugnodes, level)
|
||||
|
||||
itemmeta:set_string("lastlevel", level)
|
||||
itemmeta:set_string("dug", dugnodes)
|
||||
itemmeta:set_string("description", newdesc)
|
||||
local wear = digparams.wear
|
||||
if level > 1 then
|
||||
|
Loading…
Reference in New Issue
Block a user