Fix rubber tree

This commit is contained in:
2023-04-12 16:53:54 +03:00
parent f700a33a2a
commit a3bdc55b37
2 changed files with 11 additions and 43 deletions

View File

@@ -214,9 +214,9 @@ end
industrialtest.makeRubberTree=function(pos)
-- FIXME: Replace this with placing schematic
-- Taken and adapted from https://github.com/minetest/minetest_game/blob/master/mods/default/trees.lua#L182
minetest.chat_send_all("Making rubber sapling")
local height=industrialtest.random:next(4,5)
local tree=minetest.get_content_id("industrialtest:rubber_wood")
local treeWithRubber=minetest.get_content_id("industrialtest:rubber_wood_with_rubber")
local leaves=minetest.get_content_id("industrialtest:rubber_leaves")
local air=minetest.get_content_id("air")
local ignore=minetest.get_content_id("ignore")
@@ -235,7 +235,7 @@ industrialtest.makeRubberTree=function(pos)
local index=area:index(pos.x,y,pos.z)
local id=data[index]
if id==air or id==ignore or id==leaves then
data[index]=tree
data[index]=(industrialtest.random:next(0,5)==1 and treeWithRubber or tree)
end
end
-- Force leaves near the trunk