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

@@ -14,45 +14,13 @@
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
local definition={
name="industrialtest:rubber_tree",
deco_type="schematic",
sidelen=16,
noise_params={
offset=0.024,
scale=0.015,
spread={x=250,y=250,z=250},
seed=2,
octaves=3,
persist=0.66
},
schematic={
size=vector.new(1,1,1),
data={
{
name="industrialtest:rubber_sapling",
param2=1
}
}
},
flags="place_center_x, place_center_z"
}
if industrialtest.mtgAvailable then
definition.place_on={"default:dirt_with_grass"}
definition.biomes={"deciduous_forest"}
definition.y_max=31000
definition.y_min=1
end
minetest.register_decoration(definition)
minetest.register_lbm({
label="Make rubber trees",
name="industrialtest:make_rubber_trees",
nodenames={"industrialtest:rubber_sapling"},
run_at_every_load=false,
action=function(pos)
local node=minetest.get_node(pos)
if node.param2==1 then
industrialtest.makeRubberTree(pos)
end
minetest.register_on_generated(function(minp,maxp,seed)
if industrialtest.random:next(1,100)>40 then
return
end
})
local center=vector.new((maxp.x-minp.x)/2+ minp.x,(maxp.y-minp.y)/2+minp.y,(maxp.z-minp.z)/2+minp.z)
local pos=minetest.find_node_near(center,maxp.x-minp.x,{"default:dirt_with_grass"})
if pos then
industrialtest.makeRubberTree(pos)
end
end)