1
0
mirror of https://github.com/mt-mods/moretrees.git synced 2025-06-28 22:26:45 +02:00

7 Commits

Author SHA1 Message Date
e72c539cdc add minimum minetest version key for contentdb 2020-06-03 13:00:26 -04:00
66fd6724c5 Merge branch 'respect_protection' into 'master'
Respect protection when placing saplings

See merge request VanessaE/moretrees!6
2020-04-23 02:40:25 +00:00
fa83e1b262 Respect protection when placing saplings 2020-04-22 22:09:04 +00:00
f94f1bea26 Merge branch 'patch-1' into 'master'
Fix missing comma messing with load order

See merge request VanessaE/moretrees!5
2020-04-20 08:14:05 +00:00
09f08b50bc Fix missing comma messing with load order 2020-04-20 08:04:21 +00:00
d335eceecc Merge branch 'cocomilk-axe-bugfix' into 'master'
Fix bug with coconut-milk craft

See merge request VanessaE/moretrees!3
2020-02-02 19:19:47 +00:00
89bffdecaf Fix bug with coconut-milk craft
When crafting, tool used was fully repaired.
Now crafting will do damages on tool used instead.
2020-02-02 15:13:41 +01:00
3 changed files with 58 additions and 2 deletions

View File

@ -117,10 +117,39 @@ for i in ipairs(moretrees.cutting_tools) do
},
replacements = {
{ "moretrees:coconut", "moretrees:raw_coconut" },
{ tool, tool }
}
})
end
-- give tool back with wear preserved
minetest.register_on_craft(function(itemstack, player, old_craft_grid, craft_inv)
if (itemstack:get_name() == "moretrees:coconut_milk") then
for i, j in pairs(old_craft_grid) do
-- find tool used to do the craft
local ocg_name = j:get_name()
if ((ocg_name ~= "") and (ocg_name ~= "moretrees:coconut") and (ocg_name ~= "vessels:drinking_glass")) then
-- create a new tool and set wear
local t = ItemStack(ocg_name)
local w = j:get_wear()
-- works if tool used is an axe
local uses = j:get_tool_capabilities().groupcaps.choppy.uses or 0
if (w == 0 and uses ~= 0) then
-- tool has never been used
-- use tool once
t:set_wear(65535/(9*(uses - 1)))
else
-- set wear back
t:set_wear(w)
-- use tool once
if (uses ~= 0) then
t:add_wear(65535/(9*(uses - 1)))
end
end
-- add to craft inventory
craft_inv:add_item("craft", t)
end
end
end
end)
minetest.register_craft({
type = "shapeless",

View File

@ -1 +1,4 @@
name = moretrees
depends = default, biome_lib, vessels
optional_depends = doors, stairs, moreblocks, intllib, farming
min_minetest_version = 5.2.0

View File

@ -119,6 +119,18 @@ for i in ipairs(moretrees.treelist) do
},
groups = {snappy=2,dig_immediate=3,flammable=2,attached_node=1,sapling=1},
sounds = default.node_sound_defaults(),
on_place = function(itemstack, placer, pointed_thing)
itemstack = default.sapling_on_place(itemstack, placer, pointed_thing,
"moretrees:" ..treename.. "_sapling",
-- minp, maxp to be checked, relative to sapling pos
-- minp_relative.y = 1 because sapling pos has been checked
{x = -3, y = 1, z = -3},
{x = 3, y = 6, z = 3},
-- maximum interval of interior volume check
4)
return itemstack
end,
})
local moretrees_leaves_inventory_image = nil
@ -261,7 +273,19 @@ for i in ipairs(moretrees.treelist) do
},
groups = {snappy=2,dig_immediate=3,flammable=2,attached_node=1,sapling=1},
sounds = default.node_sound_defaults(),
drop = "moretrees:"..treename.."_sapling"
drop = "moretrees:"..treename.."_sapling",
on_place = function(itemstack, placer, pointed_thing)
itemstack = default.sapling_on_place(itemstack, placer, pointed_thing,
"moretrees:" ..treename.. "_sapling_ongen",
-- minp, maxp to be checked, relative to sapling pos
-- minp_relative.y = 1 because sapling pos has been checked
{x = -3, y = 1, z = -3},
{x = 3, y = 6, z = 3},
-- maximum interval of interior volume check
4)
return itemstack
end,
})
local fruitname = nil