2014-08-12 21:08:11 +02:00
|
|
|
-----------------------------------------------------------------------------------------------
|
|
|
|
-- Grasses - Juncus 0.0.5
|
|
|
|
-----------------------------------------------------------------------------------------------
|
|
|
|
-- by Mossmanikin
|
|
|
|
-- textures & ideas partly by Neuromancer
|
|
|
|
|
2018-02-18 01:28:43 +01:00
|
|
|
-- License (everything): WTFPL
|
|
|
|
-- Contains code from: biome_lib
|
2017-08-03 15:02:56 +02:00
|
|
|
-- Looked at code from: default
|
2014-08-12 21:08:11 +02:00
|
|
|
-----------------------------------------------------------------------------------------------
|
|
|
|
|
2017-08-03 15:02:56 +02:00
|
|
|
-- support for i18n
|
|
|
|
local S = plantlife_i18n.gettext
|
|
|
|
|
2014-08-12 21:08:11 +02:00
|
|
|
abstract_dryplants.grow_juncus = function(pos)
|
|
|
|
local juncus_type = math.random(2,3)
|
|
|
|
local right_here = {x=pos.x, y=pos.y+1, z=pos.z}
|
2014-08-16 01:34:15 +02:00
|
|
|
if minetest.get_node(right_here).name == "air" -- instead of check_air = true,
|
|
|
|
or minetest.get_node(right_here).name == "default:junglegrass" then
|
2014-08-12 21:08:11 +02:00
|
|
|
if juncus_type == 2 then
|
2014-08-16 01:34:15 +02:00
|
|
|
minetest.set_node(right_here, {name="dryplants:juncus_02"})
|
2014-08-12 21:08:11 +02:00
|
|
|
else
|
2014-08-16 01:34:15 +02:00
|
|
|
minetest.set_node(right_here, {name="dryplants:juncus"})
|
2014-08-12 21:08:11 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
minetest.register_node("dryplants:juncus", {
|
2017-08-03 15:02:56 +02:00
|
|
|
description = S("Juncus"),
|
2014-08-12 21:08:11 +02:00
|
|
|
drawtype = "plantlike",
|
2017-06-16 20:16:18 +02:00
|
|
|
visual_scale = math.sqrt(8),
|
2014-08-12 21:08:11 +02:00
|
|
|
paramtype = "light",
|
|
|
|
tiles = {"dryplants_juncus_03.png"},
|
|
|
|
inventory_image = "dryplants_juncus_inv.png",
|
|
|
|
walkable = false,
|
2014-08-13 05:57:23 +02:00
|
|
|
buildable_to = true,
|
2014-08-12 21:08:11 +02:00
|
|
|
groups = {
|
|
|
|
snappy=3,
|
|
|
|
flammable=2,
|
|
|
|
attached_node=1,
|
|
|
|
flora=1
|
|
|
|
--not_in_creative_inventory=1
|
|
|
|
},
|
|
|
|
sounds = default.node_sound_leaves_defaults(),
|
|
|
|
selection_box = {
|
|
|
|
type = "fixed",
|
|
|
|
fixed = {-7/16, -1/2, -7/16, 7/16, 0, 7/16},
|
|
|
|
},
|
|
|
|
on_place = function(itemstack, placer, pointed_thing)
|
2015-10-21 10:01:03 +02:00
|
|
|
local playername = placer:get_player_name()
|
2017-08-03 15:02:56 +02:00
|
|
|
if minetest.is_protected(pointed_thing.above, playername) or
|
|
|
|
minetest.is_protected(pointed_thing.under, playername) then
|
2015-10-21 10:01:03 +02:00
|
|
|
minetest.chat_send_player(playername, "Someone else owns that spot.")
|
|
|
|
return
|
|
|
|
end
|
2014-08-12 21:08:11 +02:00
|
|
|
local pos = pointed_thing.under
|
|
|
|
local juncus_type = math.random(2,3)
|
|
|
|
local right_here = {x=pos.x, y=pos.y+1, z=pos.z}
|
|
|
|
if juncus_type == 2 then
|
2014-08-16 01:34:15 +02:00
|
|
|
minetest.set_node(right_here, {name="dryplants:juncus_02"})
|
2014-08-12 21:08:11 +02:00
|
|
|
else
|
2014-08-16 01:34:15 +02:00
|
|
|
minetest.set_node(right_here, {name="dryplants:juncus"})
|
2014-08-12 21:08:11 +02:00
|
|
|
end
|
|
|
|
if not minetest.setting_getbool("creative_mode") then
|
|
|
|
itemstack:take_item()
|
|
|
|
end
|
|
|
|
return itemstack
|
|
|
|
end,
|
|
|
|
})
|
|
|
|
minetest.register_node("dryplants:juncus_02", {
|
2017-08-03 15:02:56 +02:00
|
|
|
description = S("Juncus"),
|
2014-08-12 21:08:11 +02:00
|
|
|
drawtype = "plantlike",
|
2017-06-16 20:16:18 +02:00
|
|
|
visual_scale = math.sqrt(8),
|
2014-08-12 21:08:11 +02:00
|
|
|
paramtype = "light",
|
|
|
|
tiles = {"dryplants_juncus_02.png"},
|
|
|
|
walkable = false,
|
2014-08-13 05:57:23 +02:00
|
|
|
buildable_to = true,
|
2014-08-12 21:08:11 +02:00
|
|
|
groups = {
|
|
|
|
snappy=3,
|
|
|
|
flammable=2,
|
|
|
|
attached_node=1,
|
|
|
|
flora=1,
|
|
|
|
not_in_creative_inventory=1
|
|
|
|
},
|
|
|
|
sounds = default.node_sound_leaves_defaults(),
|
|
|
|
selection_box = {
|
|
|
|
type = "fixed",
|
|
|
|
fixed = {-7/16, -1/2, -7/16, 7/16, 0, 7/16},
|
|
|
|
},
|
|
|
|
drop = "dryplants:juncus",
|
|
|
|
})
|
|
|
|
-----------------------------------------------------------------------------------------------
|
|
|
|
-- GENERATE SMALL JUNCUS
|
|
|
|
-----------------------------------------------------------------------------------------------
|
|
|
|
-- near water or swamp
|
2015-08-09 16:11:30 +02:00
|
|
|
biome_lib:register_generate_plant({
|
2014-08-12 21:08:11 +02:00
|
|
|
surface = {
|
2017-08-03 15:02:56 +02:00
|
|
|
"default:dirt_with_grass",
|
2014-08-12 21:08:11 +02:00
|
|
|
--"default:desert_sand",
|
|
|
|
--"default:sand",
|
|
|
|
"stoneage:grass_with_silex",
|
|
|
|
"sumpf:peat",
|
|
|
|
"sumpf:sumpf"
|
|
|
|
},
|
|
|
|
max_count = JUNCUS_NEAR_WATER_PER_MAPBLOCK,
|
|
|
|
rarity = 101 - JUNCUS_NEAR_WATER_RARITY,
|
|
|
|
min_elevation = 1, -- above sea level
|
|
|
|
near_nodes = {"default:water_source","sumpf:dirtywater_source","sumpf:sumpf"},
|
|
|
|
near_nodes_size = 2,
|
|
|
|
near_nodes_vertical = 1,
|
|
|
|
near_nodes_count = 1,
|
|
|
|
plantlife_limit = -0.9,
|
|
|
|
},
|
2014-08-15 16:09:01 +02:00
|
|
|
abstract_dryplants.grow_juncus
|
2014-08-12 21:08:11 +02:00
|
|
|
)
|
|
|
|
-- at dunes/beach
|
2015-08-09 16:11:30 +02:00
|
|
|
biome_lib:register_generate_plant({
|
2014-08-12 21:08:11 +02:00
|
|
|
surface = {
|
2017-08-03 15:02:56 +02:00
|
|
|
--"default:dirt_with_grass",
|
2014-08-12 21:08:11 +02:00
|
|
|
--"default:desert_sand",
|
|
|
|
"default:sand",
|
|
|
|
--"stoneage:grass_with_silex",
|
|
|
|
--"sumpf:peat",
|
|
|
|
--"sumpf:sumpf"
|
|
|
|
},
|
|
|
|
max_count = JUNCUS_AT_BEACH_PER_MAPBLOCK,
|
|
|
|
rarity = 101 - JUNCUS_AT_BEACH_RARITY,
|
|
|
|
min_elevation = 1, -- above sea level
|
|
|
|
near_nodes = {"default:dirt_with_grass"},
|
|
|
|
near_nodes_size = 2,
|
|
|
|
near_nodes_vertical = 1,
|
|
|
|
near_nodes_count = 1,
|
|
|
|
plantlife_limit = -0.9,
|
|
|
|
},
|
2014-08-15 16:09:01 +02:00
|
|
|
abstract_dryplants.grow_juncus
|
2014-08-13 05:19:51 +02:00
|
|
|
)
|