summaryrefslogtreecommitdiff
path: root/moretrees
diff options
context:
space:
mode:
Diffstat (limited to 'moretrees')
-rw-r--r--moretrees/.luacheckrc17
-rw-r--r--moretrees/date_palm.lua17
-rw-r--r--moretrees/init.lua9
-rw-r--r--moretrees/node_defs.lua10
4 files changed, 36 insertions, 17 deletions
diff --git a/moretrees/.luacheckrc b/moretrees/.luacheckrc
new file mode 100644
index 0000000..2933f30
--- /dev/null
+++ b/moretrees/.luacheckrc
@@ -0,0 +1,17 @@
+unused_args = false
+allow_defined_top = true
+
+read_globals = {
+ "DIR_DELIM",
+ "minetest", "core",
+ "dump",
+ "vector", "nodeupdate",
+ "VoxelManip", "VoxelArea",
+ "PseudoRandom", "ItemStack",
+ "intllib",
+ "default",
+ table = { fields = { "copy", "getn" } },
+ "biome_lib",
+ "stairs", "stairsplus",
+}
+
diff --git a/moretrees/date_palm.lua b/moretrees/date_palm.lua
index 0c40b72..f8b3e42 100644
--- a/moretrees/date_palm.lua
+++ b/moretrees/date_palm.lua
@@ -223,13 +223,18 @@ local function find_fruit_trunks_near(ftpos, sect)
return nil
end
+ local basevec = { x = ftpos.x + 2 * sect.x * sect_hr,
+ y = ftpos.y,
+ z = ftpos.z + 2 * sect.z * sect_hr}
+ -- find_nodes_in_area is limited to 82^3, make sure to not overrun it
+ local sizevec = { x = sect_hr, y = sect_vr, z = sect_hr }
+ if sect_hr * sect_hr * sect_vr > 41^3 then
+ sizevec = vector.apply(sizevec, function(a) return math.min(a, 41) end)
+ end
+
local all_palms = minetest.find_nodes_in_area(
- { x = ftpos.x + 2 * sect.x * sect_hr - sect_hr,
- y = ftpos.y - sect_vr,
- z = ftpos.z + 2 * sect.z * sect_hr - sect_hr },
- { x = ftpos.x + 2 * sect.x * sect_hr + sect_hr,
- y = ftpos.y + sect_vr,
- z = ftpos.z + 2 * sect.z * sect_hr + sect_hr },
+ vector.subtract(basevec, sizevec),
+ vector.add(basevec, sizevec),
{"moretrees:date_palm_mfruit_trunk", "moretrees:date_palm_ffruit_trunk"})
-- Collect different palms in separate lists.
diff --git a/moretrees/init.lua b/moretrees/init.lua
index c9813db..f3f840f 100644
--- a/moretrees/init.lua
+++ b/moretrees/init.lua
@@ -2,13 +2,13 @@
--
-- This mod adds more types of trees to the game
--
--- Some of the node definitions and textures came from cisoun's conifers mod
+-- Some of the node definitions and textures came from cisoun's conifers mod
-- and bas080's jungle trees mod.
--
-- Brought together into one mod and made L-systems compatible by Vanessa
-- Ezekowitz.
--
--- Firs and Jungle tree axioms/rules by Vanessa Ezekowitz, with the
+-- Firs and Jungle tree axioms/rules by Vanessa Ezekowitz, with the
-- latter having been tweaked by RealBadAngel, most other axioms/rules written
-- by RealBadAngel.
--
@@ -51,7 +51,8 @@ end
-- infinite stacks checking
-if minetest.get_modpath("unified_inventory") or not minetest.setting_getbool("creative_mode") then
+if minetest.get_modpath("unified_inventory") or not
+ minetest.settings:get_bool("creative_mode") then
moretrees.expect_infinite_stacks = false
else
moretrees.expect_infinite_stacks = true
@@ -224,7 +225,7 @@ function moretrees.grow_jungletree(pos)
local r2 = math.random(3)
if r1 == 1 then
moretrees.jungletree_model.leaves2 = "moretrees:jungletree_leaves_red"
- else
+ else
moretrees.jungletree_model.leaves2 = "moretrees:jungletree_leaves_yellow"
end
moretrees.jungletree_model.leaves2_chance = math.random(25, 75)
diff --git a/moretrees/node_defs.lua b/moretrees/node_defs.lua
index 505ff75..b33dede 100644
--- a/moretrees/node_defs.lua
+++ b/moretrees/node_defs.lua
@@ -1,7 +1,7 @@
local S = moretrees.intllib
moretrees.avoidnodes = {}
-
+
moretrees.treelist = {
{"beech", "Beech Tree"},
{"apple_tree", "Apple Tree"},
@@ -27,7 +27,7 @@ local dirs3 = { 14, 11, 16, 5, 14 }
local moretrees_new_leaves_drawtype = "allfaces_optional"
local moretrees_plantlike_leaves_visual_scale = 1
-if moretrees.plantlike_leaves then
+if moretrees.plantlike_leaves then
moretrees_new_leaves_drawtype = "plantlike"
moretrees_plantlike_leaves_visual_scale = math.sqrt(2)
end
@@ -159,7 +159,7 @@ for i in ipairs(moretrees.treelist) do
stairsplus:register_all(
"moretrees",
treename.."_trunk",
- "moretrees:"..treename.."_trunk",
+ "moretrees:"..treename.."_trunk",
{
groups = { snappy=1, choppy=2, oddly_breakable_by_hand=1, flammable=2, not_in_creative_inventory=1 },
tiles = {
@@ -480,10 +480,6 @@ minetest.register_alias("moretrees:jungletree_trunk_sideways", "moreblocks:horiz
minetest.register_alias("moretrees:jungletree_planks", "default:junglewood")
minetest.register_alias("moretrees:jungletree_leaves_green", "default:jungleleaves")
-minetest.register_alias("jungletree:leaves_green", "default:jungleleaves")
-minetest.register_alias("jungletree:leaves_red", "moretrees:jungletree_leaves_red")
-minetest.register_alias("jungletree:leaves_yellow", "moretrees:jungletree_leaves_yellow")
-
minetest.register_alias("moretrees:acacia_trunk", "default:acacia_tree")
minetest.register_alias("moretrees:acacia_planks", "default:acacia_wood")
minetest.register_alias("moretrees:acacia_sapling", "default:acacia_sapling")