mirror of
https://git.minetest.land/VoxeLibre/VoxeLibre.git
synced 2024-11-24 11:31:09 +01:00
Notify the player if a picked block is already in their hotbar
This commit is contained in:
parent
077ea1828c
commit
9ac416ee3e
3 changed files with 15 additions and 1 deletions
|
@ -1,3 +1,5 @@
|
|||
local S = minetest.get_translator("vl_pickblock")
|
||||
|
||||
minetest.override_item("", {
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
if minetest.is_creative_enabled(placer:get_player_name()) then
|
||||
|
@ -21,6 +23,16 @@ minetest.override_item("", {
|
|||
rnode = node
|
||||
end
|
||||
|
||||
local inv = placer:get_inventory()
|
||||
for i=1,placer:hud_get_hotbar_itemcount() do
|
||||
local stack = inv:get_stack("main", i)
|
||||
if stack:get_name() == rnode.name then
|
||||
local msg = S("@1 is on slot @2", stack:get_short_description(), i)
|
||||
mcl_title.set(placer, "actionbar", {text = msg, stay = 30})
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
return rnode
|
||||
end
|
||||
end
|
||||
|
|
2
mods/PLAYER/vl_pickblock/locale/template.txt
Normal file
2
mods/PLAYER/vl_pickblock/locale/template.txt
Normal file
|
@ -0,0 +1,2 @@
|
|||
# textdomain: vl_pickblock
|
||||
@1 is on slot @2=
|
|
@ -1,3 +1,3 @@
|
|||
name = vl_pickblock
|
||||
description = Allows you to put the selected node in an empty slot of your hotbar when you're in creative mode.
|
||||
depeds = mcl_util
|
||||
depeds = mcl_util, mcl_title
|
||||
|
|
Loading…
Reference in a new issue