mirror of
https://github.com/joe7575/techpack.git
synced 2024-11-22 23:33:44 +01:00
Merge pull request #60 from oversword/bls-265
Suggestion to check replanting against commonly plantable nodes instead of quarry-able GroundNodes
This commit is contained in:
commit
b87cc754b9
@ -147,6 +147,16 @@ local function remove_all_sapling_items(pos)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local function is_plantable_ground(node)
|
||||||
|
if minetest.get_item_group(node.name, "soil") ~= 0 then
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
if minetest.get_item_group(node.name, "sand") ~= 0 then
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
-- Remove wood/leave nodes and place sapling if necessary
|
-- Remove wood/leave nodes and place sapling if necessary
|
||||||
-- Return false if inventory is full
|
-- Return false if inventory is full
|
||||||
-- else return true
|
-- else return true
|
||||||
@ -163,7 +173,7 @@ local function remove_or_replace_node(this, pos, inv, node, order)
|
|||||||
minetest.remove_node(pos)
|
minetest.remove_node(pos)
|
||||||
inv:add_item("main", ItemStack(order.drop))
|
inv:add_item("main", ItemStack(order.drop))
|
||||||
this.num_items = this.num_items + 1
|
this.num_items = this.num_items + 1
|
||||||
if tubelib_addons1.GroundNodes[next_node.name] ~= nil and order.plant then -- hit the ground?
|
if is_plantable_ground(next_node) and order.plant then -- hit the ground?
|
||||||
minetest.set_node(pos, {name=order.plant, paramtype2 = "wallmounted", param2=1})
|
minetest.set_node(pos, {name=order.plant, paramtype2 = "wallmounted", param2=1})
|
||||||
if order.t1 ~= nil then
|
if order.t1 ~= nil then
|
||||||
-- We have to simulate "on_place" and start the timer by hand
|
-- We have to simulate "on_place" and start the timer by hand
|
||||||
|
Loading…
Reference in New Issue
Block a user