forked from VoxeLibre/VoxeLibre
survival inventory
This commit is contained in:
parent
54b119cffa
commit
4ee6a67516
|
@ -59,7 +59,8 @@ local function set_inventory(player)
|
|||
local armor_slot_imgs = ""
|
||||
for a = 1, 4 do
|
||||
if inv:get_stack("armor", a + 1):is_empty() then
|
||||
armor_slot_imgs = armor_slot_imgs .. "image[0,"..(a-1)..";1,1;mcl_inventory_empty_armor_slot_"..armor_slots[a]..".png]"
|
||||
armor_slot_imgs = armor_slot_imgs ..
|
||||
"image[0," .. (a - 1) .. ";1,1;mcl_inventory_empty_armor_slot_" .. armor_slots[a] .. ".png]"
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -190,6 +191,24 @@ function minetest.is_creative_enabled(name)
|
|||
return false
|
||||
end
|
||||
|
||||
--Insta "digging" nodes in gamemode-creative
|
||||
minetest.register_on_punchnode(function(pos, node, puncher, pointed_thing)
|
||||
if not puncher or not puncher:is_player() then return end
|
||||
local name = puncher:get_player_name()
|
||||
if not minetest.is_creative_enabled(name) then return end
|
||||
if pointed_thing.type ~= "node" then return end
|
||||
local def = minetest.registered_nodes[node.name]
|
||||
if def then
|
||||
minetest.node_dig(pos, node, puncher)
|
||||
return true
|
||||
end
|
||||
end)
|
||||
|
||||
--Don't subtract from inv when placing in gamemode-creative
|
||||
minetest.register_on_placenode(function(pos, newnode, placer, oldnode, itemstack, pointed_thing)
|
||||
if placer and placer:is_player() and minetest.is_creative_enabled(placer:get_player_name()) then return true end
|
||||
end)
|
||||
|
||||
local function in_table(n, h)
|
||||
for k, v in pairs(h) do
|
||||
if v == n then return true end
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 5.2 KiB |
Loading…
Reference in New Issue