3 different twigs, twigs on water, more settings

master
Mossmanikin 2013-10-02 05:47:16 +02:00
parent 139f5d9eff
commit 47c8eac79c
9 changed files with 110 additions and 33 deletions

View File

@ -1,4 +1,4 @@
minetest.register_craft({
output = "default:stick",
recipe = {{"trunks:twig"}}
recipe = {{"trunks:twig_1"}}
})

View File

@ -3,13 +3,14 @@
-----------------------------------------------------------------------------------------------
abstract_trunks.place_twig = function(pos)
local right_here = {x=pos.x, y=pos.y+1, z=pos.z}
minetest.add_node(right_here, {name="trunks:twig", param2=math.random(0,3)})
minetest.add_node(right_here, {name="trunks:twig_"..math.random(1,3), param2=math.random(0,3)})
end
if Twigs_on_ground == true then
plantslib:register_generate_plant({
surface = {"default:dirt_with_grass"},
max_count = Twigs_Max_Count,
rarity = Twigs_Rarity,
max_count = Twigs_on_ground_Max_Count,
rarity = Twigs_on_ground_Rarity,
min_elevation = 1,
max_elevation = 40,
near_nodes = {"group:tree","ferns:fern_03","ferns:fern_02","ferns:fern_01"},
@ -20,6 +21,24 @@ plantslib:register_generate_plant({
},
"abstract_trunks.place_twig"
)
end
if Twigs_on_water == true then
plantslib:register_generate_plant({
surface = {"default:water_source"},
max_count = Twigs_on_water_Max_Count,
rarity = Twigs_on_water_Rarity,
min_elevation = 1,
max_elevation = 40,
near_nodes = {"group:tree"},
near_nodes_size = 3,
near_nodes_vertical = 1,
near_nodes_count = 1,
plantlife_limit = -0.9,
},
"abstract_trunks.place_twig"
)
end
-----------------------------------------------------------------------------------------------
-- TRuNKS
@ -170,6 +189,7 @@ plantslib:register_generate_plant({
-----------------------------------------------------------------------------------------------
-- MoSS & FuNGuS -- on ground
-----------------------------------------------------------------------------------------------
if Moss_on_ground == true then
abstract_trunks.grow_moss_on_ground = function(pos)
local on_ground = {x=pos.x, y=pos.y+1, z=pos.z}
local moss_type = math.random(1,21)
@ -201,10 +221,12 @@ plantslib:register_generate_plant({
},
"abstract_trunks.grow_moss_on_ground"
)
end
-----------------------------------------------------------------------------------------------
-- MoSS & FuNGuS -- on trunks
-----------------------------------------------------------------------------------------------
if Moss_on_trunk == true then
abstract_trunks.grow_moss_on_trunk = function(pos)
local on_ground = {x=pos.x, y=pos.y+1, z=pos.z}
local at_side_n = {x=pos.x, y=pos.y, z=pos.z+1}
@ -298,4 +320,5 @@ plantslib:register_generate_plant({
check_air = false,
},
"abstract_trunks.grow_moss_on_trunk"
)
)
end

View File

@ -1,6 +1,6 @@
-----------------------------------------------------------------------------------------------
local title = "Trunks"
local version = "0.0.5"
local version = "0.0.6"
local mname = "trunks"
-----------------------------------------------------------------------------------------------

View File

@ -1,25 +1,48 @@
-----------------------------------------------------------------------------------------------
-- TWiG
-- TWiGS
-----------------------------------------------------------------------------------------------
local flat_stick = {-1/2, -1/2, -1/2, 1/2, -7/16, 1/2}
-- For compatibility with older stuff
minetest.register_alias("trunks:twig", "trunks:twig_1")
minetest.register_node("trunks:twig", {
description = "Twig",
inventory_image = "trunks_twig.png",
wield_image = "trunks_twig.png",
drawtype = "nodebox",
tiles = { "trunks_twig.png" },
paramtype = "light",
paramtype2 = "facedir",
sunlight_propagates = true,
buildable_to = true,
node_box = {type = "fixed", fixed = flat_stick},
groups = {
dig_immediate=3, -- almost literally immediate, like just picking up
attached_node=1
},
sounds = default.node_sound_leaves_defaults(),
})
local flat_stick = {-1/2, -1/2, -1/2, 1/2, -7/16, 1/2}
local NoDe = { {1}, {2}, {3} }
for i in pairs(NoDe) do
local NR = NoDe[i][1]
local iNV = NR - 1
minetest.register_node("trunks:twig_"..NR, {
description = "Twig",
inventory_image = "trunks_twig_"..NR..".png",
wield_image = "trunks_twig_"..NR..".png",
drawtype = "nodebox",
tiles = { "trunks_twig_"..NR..".png" },
paramtype = "light",
paramtype2 = "facedir",
walkable = false,
sunlight_propagates = true,
buildable_to = true,
node_box = {type = "fixed", fixed = flat_stick},
groups = {
dig_immediate=3, -- almost literally immediate, like just picking up
attached_node=1,
not_in_creative_inventory=iNV
},
drop = "trunks:twig_1",
sounds = default.node_sound_leaves_defaults(),
liquids_pointable = true,
on_place = function(itemstack, placer, pointed_thing)
local pt = pointed_thing
local direction = minetest.dir_to_facedir(placer:get_look_dir())
if minetest.get_node(pt.above).name=="air" then
minetest.set_node(pt.above, {name="trunks:twig_"..math.random(1,3), param2=direction})
if not minetest.setting_getbool("creative_mode") then
itemstack:take_item()
end
return itemstack
end
end,
})
end
-----------------------------------------------------------------------------------------------
-- MoSS
@ -36,7 +59,6 @@ minetest.register_node("trunks:moss", {
walkable = false,
selection_box = {type = "wallmounted"},
groups = {dig_immediate=2,attached_node=1},
--legacy_wallmounted = true,
sounds = default.node_sound_leaves_defaults(),
})
@ -55,6 +77,5 @@ minetest.register_node("trunks:moss_fungus", {
walkable = false,
selection_box = {type = "wallmounted"},
groups = {dig_immediate=2,attached_node=1},
--legacy_wallmounted = true,
sounds = default.node_sound_leaves_defaults(),
})

Binary file not shown.

Before

Width:  |  Height:  |  Size: 277 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 244 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 251 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 262 B

View File

@ -1,15 +1,48 @@
-- Settings for generation of trunks (at map-generation time)
-- Settings for generation of stuff (at map-generation time)
Horizontal_Trunks = true
Trunks_Max_Count = 320 -- absolute maximum number in an area of 80x80x80 nodes
Trunks_Rarity = 99 -- larger values make trunks more rare (100 means chance of 0 %)
Twigs_Max_Count = 640 -- absolute maximum number in an area of 80x80x80 nodes
Twigs_Rarity = 66 -- larger values make twigs more rare (100 means chance of 0 %)
Horizontal_Trunks = true
Trunks_Max_Count = 320 -- absolute maximum number in an area of 80x80x80 nodes
Trunks_Rarity = 99 -- larger values make trunks more rare (100 means chance of 0 %)
Twigs_on_ground = true
Twigs_on_ground_Max_Count = 640 -- absolute maximum number in an area of 80x80x80 nodes
Twigs_on_ground_Rarity = 66 -- larger values make twigs more rare (100 means chance of 0 %)
Twigs_on_water = true
Twigs_on_water_Max_Count = 320 -- absolute maximum number in an area of 80x80x80 nodes
Twigs_on_water_Rarity = 33 -- larger values make twigs more rare (100 means chance of 0 %)
Moss_on_ground = true
Moss_on_ground_Max_Count = 400 -- absolute maximum number in an area of 80x80x80 nodes
Moss_on_ground_Rarity = 79 -- larger values makes moss more rare (100 means chance of 0 %)
Moss_on_trunk = true
Moss_on_trunk_Max_Count = 640 -- absolute maximum number in an area of 80x80x80 nodes
Moss_on_trunk_Rarity = 24 -- larger values makes moss more rare (100 means chance of 0 %)