put spindlestems with goblin caps, make them always grow red when near those

This commit is contained in:
FaceDeer 2019-08-04 19:53:13 -06:00
parent c20e3918ef
commit 271a9441f4
4 changed files with 17 additions and 7 deletions

View File

@ -60,6 +60,8 @@ if minetest.get_modpath("df_farming") then
}
end
local c_red = minetest.get_content_id("df_trees:spindlestem_cap_red")
local goblin_cap_cavern_floor = function(abs_cracks, vert_rand, vi, area, data, data_param2)
local ystride = area.ystride
if abs_cracks < 0.1 then
@ -72,6 +74,8 @@ local goblin_cap_cavern_floor = function(abs_cracks, vert_rand, vi, area, data,
end
if math.random() < 0.1 then
df_caverns.place_shrub(vi+ystride, area, data, data_param2, goblin_cap_shrublist)
elseif math.random() < 0.02 then
df_trees.spawn_spindlestem_vm(vi+ystride, area, data, data_param2, c_red)
elseif math.random() < 0.015 then
df_trees.spawn_goblin_cap_vm(vi+ystride, area, data)
end

View File

@ -108,6 +108,8 @@ local mushroom_cavern_floor = function(abs_cracks, vert_rand, vi, area, data, da
df_trees.spawn_tower_cap_vm(vi+ystride, area, data)
elseif math.random() < 0.01 then
df_trees.spawn_goblin_cap_vm(vi+ystride, area, data)
elseif math.random() < 0.02 then
df_trees.spawn_spindlestem_vm(vi+ystride, area, data, data_param2)
end
end
end

View File

@ -9,7 +9,7 @@ minetest.register_node("df_trees:goblin_cap_stem", {
_doc_items_usagehelp = df_trees.doc.goblin_cap_usage,
tiles = {"dfcaverns_goblin_cap_stem.png"},
is_ground_content = true,
groups = {tree = 1, choppy = 2, oddly_breakable_by_hand = 1, flammable = 2},
groups = {tree = 1, choppy = 2, oddly_breakable_by_hand = 1, flammable = 2, goblin_cap = 1},
sounds = default.node_sound_wood_defaults(),
})
@ -20,7 +20,7 @@ minetest.register_node("df_trees:goblin_cap", {
_doc_items_usagehelp = df_trees.doc.goblin_cap_usage,
tiles = {"dfcaverns_goblin_cap.png"},
is_ground_content = true,
groups = {tree = 1, choppy = 2, oddly_breakable_by_hand = 1, flammable = 2},
groups = {tree = 1, choppy = 2, oddly_breakable_by_hand = 1, flammable = 2, goblin_cap = 1},
sounds = default.node_sound_wood_defaults(),
})
@ -31,7 +31,7 @@ minetest.register_node("df_trees:goblin_cap_gills", {
_doc_items_usagehelp = df_trees.doc.goblin_cap_usage,
tiles = {"dfcaverns_goblin_cap_gills.png"},
is_ground_content = true,
groups = {snappy = 3, leafdecay = 3, flammable = 2, leaves = 1},
groups = {snappy = 3, leafdecay = 3, flammable = 2, leaves = 1, goblin_cap = 1},
sounds = default.node_sound_leaves_defaults(),
drawtype = "plantlike",
paramtype = "light",

View File

@ -37,8 +37,8 @@ local stem_on_place = function(itemstack, placer, pointed_thing)
end
local new_param2
-- check if pointing at an existing stalactite
if minetest.get_item_group(under.name, "spindlestem") ~= 0 then
-- check if pointing at an existing spindlestem
if minetest.get_item_group(under.name, "spindlestem") > 0 then
new_param2 = under.param2
else
new_param2 = math.random(0,3)
@ -143,7 +143,7 @@ local register_spindlestem_type = function(item_suffix, colour_name, colour_code
},
},
on_place = stal_on_place,
on_place = stem_on_place,
on_timer = function(pos, elapsed)
local above = vector.add(pos, {x=0,y=1,z=0})
local node_above = minetest.get_node(above)
@ -244,7 +244,7 @@ minetest.register_node("df_trees:spindlestem_seedling", {
}
},
on_place = stal_on_place,
on_place = stem_on_place,
on_construct = seedling_construct,
on_timer = function(pos, elapsed)
@ -310,6 +310,10 @@ get_spindlestem_cap_type = function(pos)
if pos.y > -100 then
return c_white
end
if minetest.find_node_near(pos, 15, "group:goblin_cap") then
return c_red
end
local iron = minetest.find_node_near(pos, 5, {"default:stone_with_iron", "default:steelblock"})
local copper = minetest.find_node_near(pos, 5, {"default:stone_with_copper", "default:copperblock"})
local mese = minetest.find_node_near(pos, 5, {"default:stone_with_mese", "default:mese"})