mirror of
https://github.com/lisacvuk/minetest-toolranks.git
synced 2025-01-09 15:30:17 +01: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
|
-- Only count nodes that spend the tool
|
||||||
if(digparams.wear > 0) then
|
if(digparams.wear > 0) then
|
||||||
dugnodes = dugnodes + 1
|
dugnodes = dugnodes + 1
|
||||||
|
itemmeta:set_string("dug", dugnodes)
|
||||||
end
|
end
|
||||||
if(itemstack:get_wear() > 60135) then
|
if(itemstack:get_wear() > 60135) then
|
||||||
minetest.chat_send_player(user:get_player_name(), "Your tool is about to break, comrade!")
|
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,
|
gain = 2.0,
|
||||||
})
|
})
|
||||||
minetest.chat_send_player(user:get_player_name(), levelup_text)
|
minetest.chat_send_player(user:get_player_name(), levelup_text)
|
||||||
|
itemmeta:set_string("lastlevel", level)
|
||||||
end
|
end
|
||||||
|
|
||||||
local newdesc = toolranks.create_description(itemdesc, dugnodes, level)
|
local newdesc = toolranks.create_description(itemdesc, dugnodes, level)
|
||||||
|
|
||||||
itemmeta:set_string("lastlevel", level)
|
|
||||||
itemmeta:set_string("dug", dugnodes)
|
|
||||||
itemmeta:set_string("description", newdesc)
|
itemmeta:set_string("description", newdesc)
|
||||||
local wear = digparams.wear
|
local wear = digparams.wear
|
||||||
if level > 1 then
|
if level > 1 then
|
||||||
|
Loading…
Reference in New Issue
Block a user