plantlife_modpack/poisonivy/init.lua
Vanessa Ezekowitz 68a6ce43a7 Changed plants_lib API to require a table argument when not using legacy
calling options.  This opens the door for even more features in the future.
Changed flowers, junglegrass, poisonivy to match.

Made plants lib faster in some places, especially the surface-hunting
algorithm, and especially over water.  Fixed a few other misc. bugs.

Made growth code properly execute all biome-control code before executing
any string-named function or spawn_tree().

Tuned flowers settings.  Made flowers require at least some light to spawn,
made waterlilies require shallower water.  Fixed a bug in water depth detection
and made water depth depend on whether the bottom of the water area is dirt,
dirt with grass, or sand, rather than just anything.

Made waterlilies randomly rotate on spawning to break up the patterns (now has
16 orientations with the help of nodeboxes and facedir, requires only 3 new
nodes). Smoothed edges of the regular waterlily texture.  Made all flowers and
water- lilies spawn using only 3 ABM calls instead of 8.

Got rid of colon prefix node def overrides on all plants, since this is a
modpack now instead of an integrated mod.  Fixed a misspelled folder name for
poisonivy.

Fixed a bug in the wall detection routine - it returned the last wall found,
not the first.

Made the top-side-check for air only apply when spawning on top of the
target rather than its sides/bottom.

Many other features and enhancements have been made.  Too many to list here.
Please see API.txt for details.
2013-01-25 23:16:54 -05:00

97 lines
2.5 KiB
Lua

-- This file supplies poison ivy for the plantlife modpack
-- Last revision: 2013-01-24
local SPAWN_DELAY = 1000
local SPAWN_CHANCE = 200
local GROW_DELAY = 500
local GROW_CHANCE = 30
local poisonivy_seed_diff = 339
local walls_list = {
"default:dirt",
"default:dirt_with_grass",
"default:stone",
"default:cobble",
"default:mossycobble",
"default:brick",
"default:tree",
"default:jungletree",
"default:coal",
"default:iron"
},
minetest.register_node('poisonivy:seedling', {
description = "Poison ivy (seedling)",
drawtype = 'plantlike',
tile_images = { 'poisonivy_seedling.png' },
inventory_image = 'poisonivy_seedling.png',
wield_image = 'poisonivy_seedling.png',
sunlight_propagates = true,
paramtype = 'light',
walkable = false,
groups = { snappy = 3, poisonivy=1 },
sounds = default.node_sound_leaves_defaults(),
})
minetest.register_node('poisonivy:sproutling', {
description = "Poison ivy (sproutling)",
drawtype = 'plantlike',
tile_images = { 'poisonivy_sproutling.png' },
inventory_image = 'poisonivy_sproutling.png',
wield_image = 'poisonivy_sproutling.png',
sunlight_propagates = true,
paramtype = 'light',
walkable = false,
groups = { snappy = 3, poisonivy=1 },
sounds = default.node_sound_leaves_defaults(),
})
minetest.register_node('poisonivy:climbing', {
description = "Poison ivy (climbing plant)",
drawtype = 'signlike',
tile_images = { 'poisonivy_climbing.png' },
inventory_image = 'poisonivy_climbing.png',
wield_image = 'poisonivy_climbing.png',
sunlight_propagates = true,
paramtype = 'light',
paramtype2 = 'wallmounted',
walkable = false,
groups = { snappy = 3, poisonivy=1 },
sounds = default.node_sound_leaves_defaults(),
selection_box = {
type = "wallmounted",
--wall_side = = <default>
},
})
plantslib:spawn_on_surfaces({
spawn_delay = SPAWN_DELAY,
spawn_plants = {"poisonivy:seedling"},
avoid_radius = 10,
spawn_chance = SPAWN_CHANCE/10,
spawn_surfaces = {"default:dirt_with_grass"},
avoid_nodes = {"group:poisonivy","group:flower"},
seed_diff = poisonivy_seed_diff,
light_min = 7,
alt_wallnode = "poisonivy:climbing",
verticals_list = walls_list
})
plantslib:grow_plants({
grow_delay = SPAWN_DELAY,
grow_chance = GROW_CHANCE,
grow_plant = "poisonivy:seedling",
grow_result = "poisonivy:sproutling",
grow_nodes = {"default:dirt_with_grass"}
})
plantslib:grow_plants({
grow_delay = GROW_DELAY,
grow_chance = GROW_CHANCE*2,
grow_plant = "poisonivy:climbing",
need_wall = true,
grow_vertically = true,
verticals_list = walls_list,
ground_nodes = {"default:dirt_with_grass"}
})
print("[Poison Ivy] Loaded.")