1
0
Fork 0

survival inventory

This commit is contained in:
AFCMS 2021-09-20 09:22:13 +02:00
parent 54b119cffa
commit 4ee6a67516
Signed by untrusted user: AFCMS
GPG Key ID: 8720389A25B652E3
2 changed files with 55 additions and 36 deletions

View File

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