Use infinite stacks in creative mode and make the hand break anything
This commit is contained in:
parent
8c977451a8
commit
61e60724f6
1
mods/creative/depends.txt
Normal file
1
mods/creative/depends.txt
Normal file
@ -0,0 +1 @@
|
||||
default
|
@ -44,15 +44,7 @@ minetest.after(0, function()
|
||||
table.sort(creative_list)
|
||||
inv:set_size("main", #creative_list)
|
||||
for _,itemstring in ipairs(creative_list) do
|
||||
local stack = ItemStack(itemstring)
|
||||
-- Make a stack of the right number of items
|
||||
local stack2 = nil
|
||||
if stack:get_stack_max() == 1 then
|
||||
stack2 = ItemStack(stack:get_name())
|
||||
else
|
||||
stack2 = ItemStack(stack:get_name().." "..stack:get_stack_max())
|
||||
end
|
||||
inv:add_item("main", stack2)
|
||||
inv:add_item("main", ItemStack(itemstring))
|
||||
end
|
||||
creative_inventory.creative_inventory_size = #creative_list
|
||||
print("creative inventory size: "..dump(creative_inventory.creative_inventory_size))
|
||||
@ -129,3 +121,42 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
|
||||
creative_inventory.set_creative_formspec(player, start_i, start_i / (6*4) + 1)
|
||||
end)
|
||||
|
||||
if minetest.setting_getbool("creative_mode") then
|
||||
|
||||
minetest.register_item(":", {
|
||||
type = "none",
|
||||
wield_image = "wieldhand.png",
|
||||
wield_scale = {x=1,y=1,z=2.5},
|
||||
tool_capabilities = {
|
||||
full_punch_interval = 0.5,
|
||||
max_drop_level = 3,
|
||||
groupcaps = {
|
||||
crumbly = {times={[1]=0.5, [2]=0.5, [3]=0.5}, uses=0, maxlevel=3},
|
||||
cracky = {times={[1]=0.5, [2]=0.5, [3]=0.5}, uses=0, maxlevel=3},
|
||||
snappy = {times={[1]=0.5, [2]=0.5, [3]=0.5}, uses=0, maxlevel=3},
|
||||
choppy = {times={[1]=0.5, [2]=0.5, [3]=0.5}, uses=0, maxlevel=3},
|
||||
oddly_breakable_by_hand = {times={[1]=0.5, [2]=0.5, [3]=0.5}, uses=0, maxlevel=3},
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_on_placenode(function(pos, newnode, placer, oldnode, itemstack)
|
||||
return true
|
||||
end)
|
||||
|
||||
function minetest.handle_node_drops(pos, drops, digger)
|
||||
if not digger or not digger:is_player() then
|
||||
return
|
||||
end
|
||||
local inv = digger:get_inventory()
|
||||
if inv then
|
||||
for _,item in ipairs(drops) do
|
||||
item = ItemStack(item):get_name()
|
||||
if not inv:contains_item("main", item) then
|
||||
inv:add_item("main", item)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user