mirror of
https://github.com/minetest/minetest_game.git
synced 2024-11-16 15:00:18 +01:00
51 lines
1.4 KiB
Lua
51 lines
1.4 KiB
Lua
dofile(minetest.get_modpath("creative") .. "/inventory.lua")
|
|
|
|
if minetest.setting_getbool("creative_mode") then
|
|
-- Dig time is modified according to difference (leveldiff) between tool
|
|
-- 'maxlevel' and node 'level'. Digtime is divided by the larger of
|
|
-- leveldiff and 1.
|
|
-- To speed up digging in creative, hand 'maxlevel' and 'digtime' have been
|
|
-- increased such that nodes of differing levels have an insignificant
|
|
-- effect on digtime.
|
|
local digtime = 42
|
|
local caps = {times = {digtime, digtime, digtime}, uses = 0, maxlevel = 256}
|
|
|
|
minetest.register_item(":", {
|
|
type = "none",
|
|
wield_image = "wieldhand.png",
|
|
wield_scale = {x = 1, y = 1, z = 2.5},
|
|
range = 10,
|
|
tool_capabilities = {
|
|
full_punch_interval = 0.5,
|
|
max_drop_level = 3,
|
|
groupcaps = {
|
|
crumbly = caps,
|
|
cracky = caps,
|
|
snappy = caps,
|
|
choppy = caps,
|
|
oddly_breakable_by_hand = caps,
|
|
},
|
|
damage_groups = {fleshy = 10},
|
|
}
|
|
})
|
|
|
|
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
|