mirror of
https://github.com/mt-mods/moretrees.git
synced 2025-06-29 14:41:03 +02:00
Compare commits
7 Commits
2019-10-03
...
20200603-1
Author | SHA1 | Date | |
---|---|---|---|
e72c539cdc | |||
66fd6724c5 | |||
fa83e1b262 | |||
f94f1bea26 | |||
09f08b50bc | |||
d335eceecc | |||
89bffdecaf |
31
crafts.lua
31
crafts.lua
@ -117,10 +117,39 @@ for i in ipairs(moretrees.cutting_tools) do
|
|||||||
},
|
},
|
||||||
replacements = {
|
replacements = {
|
||||||
{ "moretrees:coconut", "moretrees:raw_coconut" },
|
{ "moretrees:coconut", "moretrees:raw_coconut" },
|
||||||
{ tool, tool }
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
end
|
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({
|
minetest.register_craft({
|
||||||
type = "shapeless",
|
type = "shapeless",
|
||||||
|
3
mod.conf
3
mod.conf
@ -1 +1,4 @@
|
|||||||
name = moretrees
|
name = moretrees
|
||||||
|
depends = default, biome_lib, vessels
|
||||||
|
optional_depends = doors, stairs, moreblocks, intllib, farming
|
||||||
|
min_minetest_version = 5.2.0
|
||||||
|
@ -119,6 +119,18 @@ for i in ipairs(moretrees.treelist) do
|
|||||||
},
|
},
|
||||||
groups = {snappy=2,dig_immediate=3,flammable=2,attached_node=1,sapling=1},
|
groups = {snappy=2,dig_immediate=3,flammable=2,attached_node=1,sapling=1},
|
||||||
sounds = default.node_sound_defaults(),
|
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
|
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},
|
groups = {snappy=2,dig_immediate=3,flammable=2,attached_node=1,sapling=1},
|
||||||
sounds = default.node_sound_defaults(),
|
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
|
local fruitname = nil
|
||||||
|
Reference in New Issue
Block a user