add trail mod support

This commit is contained in:
FaceDeer 2019-12-14 14:29:56 -07:00
parent 859f84686a
commit 3bd29df3bc
16 changed files with 199 additions and 31 deletions

View File

@ -136,6 +136,7 @@ local c_plant_matter = minetest.get_content_id("df_primordial_items:plant_matter
local c_packed_roots = minetest.get_content_id("df_primordial_items:packed_roots") local c_packed_roots = minetest.get_content_id("df_primordial_items:packed_roots")
local c_glowstone = minetest.get_content_id("df_underworld_items:glowstone") local c_glowstone = minetest.get_content_id("df_underworld_items:glowstone")
local c_ivy = minetest.get_content_id("df_primordial_items:jungle_ivy") local c_ivy = minetest.get_content_id("df_primordial_items:jungle_ivy")
local c_root = minetest.get_content_id("df_primordial_items:jungle_roots_2")
local jungle_cavern_floor = function(abs_cracks, humidity, vi, area, data, data_param2) local jungle_cavern_floor = function(abs_cracks, humidity, vi, area, data, data_param2)
local ystride = area.ystride local ystride = area.ystride
@ -163,9 +164,15 @@ local jungle_cavern_ceiling = function(abs_cracks, vi, area, data, data_param2)
elseif abs_cracks > 0.75 and math.random() < 0.1 then elseif abs_cracks > 0.75 and math.random() < 0.1 then
local ystride = area.ystride local ystride = area.ystride
local index = vi - ystride local index = vi - ystride
local hanging_node
if math.random() < 0.5 then
hanging_node = c_ivy
else
hanging_node = c_root
end
for i = 1, math.random(16) do for i = 1, math.random(16) do
if data[index] == c_air then if data[index] == c_air then
data[index] = c_ivy data[index] = hanging_node
index = index - ystride index = index - ystride
else else
break break

View File

@ -147,3 +147,41 @@ minetest.register_craft({
output = "df_farming:cave_bread", output = "df_farming:cave_bread",
recipe = "df_farming:cave_flour" recipe = "df_farming:cave_flour"
}) })
if minetest.get_modpath("trail") and trail and trail.register_trample_node then
minetest.register_node("df_farming:wheat_trampled", {
description = S("Flattened Cave Wheat"),
tiles = {"dfcaverns_cave_wheat_flattened.png"},
inventory_image = "dfcaverns_cave_wheat_flattened.png",
drawtype = "nodebox",
paramtype = "light",
paramtype2 = "facedir",
buildable_to = true,
node_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.5, 0.5, -3 / 8, 0.5}
},
},
groups = {snappy = 3, flammable = 2, attached_node = 1},
drop = "",
sounds = default.node_sound_leaves_defaults(),
})
trail.register_trample_node("df_farming:cave_wheat_5", {
trampled_node_name = "df_farming:wheat_trampled",
randomize_trampled_param2 = true,
})
trail.register_trample_node("df_farming:cave_wheat_6", {
trampled_node_name = "df_farming:wheat_trampled",
randomize_trampled_param2 = true,
})
trail.register_trample_node("df_farming:cave_wheat_7", {
trampled_node_name = "df_farming:wheat_trampled",
randomize_trampled_param2 = true,
})
trail.register_trample_node("df_farming:cave_wheat_8", {
trampled_node_name = "df_farming:wheat_trampled",
randomize_trampled_param2 = true,
})
end

View File

@ -1,9 +0,0 @@
default
farming?
cottages?
bucket?
dynamic_liquid?
wool?
intllib?
doc?
crafting?

View File

@ -1 +0,0 @@
Adds farmable underground plants that die in sunlight. Also includes various cooking reactions.

View File

@ -1,4 +1,4 @@
name = df_farming name = df_farming
description = Adds farmable underground plants that die in sunlight. Also includes various cooking reactions. description = Adds farmable underground plants that die in sunlight. Also includes various cooking reactions.
depends = default depends = default
optional_depends = farming, cottages, bucket, dynamic_liquid, wool, intllib, doc, crafting optional_depends = farming, cottages, bucket, dynamic_liquid, wool, intllib, doc, crafting, trail

View File

@ -116,3 +116,40 @@ minetest.register_craft({
burntime = 1, burntime = 1,
}) })
if minetest.get_modpath("trail") and trail and trail.register_trample_node then
minetest.register_node("df_farming:pig_tail_trampled", {
description = S("Flattened Pig Tail"),
tiles = {"dfcaverns_pig_tail_flattened.png"},
inventory_image = "dfcaverns_pig_tail_flattened.png",
drawtype = "nodebox",
paramtype = "light",
paramtype2 = "facedir",
buildable_to = true,
node_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.5, 0.5, -3 / 8, 0.5}
},
},
groups = {snappy = 3, flammable = 2, attached_node = 1},
drop = "",
sounds = default.node_sound_leaves_defaults(),
})
trail.register_trample_node("df_farming:pig_tail_5", {
trampled_node_name = "df_farming:pig_tail_trampled",
randomize_trampled_param2 = true,
})
trail.register_trample_node("df_farming:pig_tail_6", {
trampled_node_name = "df_farming:pig_tail_trampled",
randomize_trampled_param2 = true,
})
trail.register_trample_node("df_farming:pig_tail_7", {
trampled_node_name = "df_farming:pig_tail_trampled",
randomize_trampled_param2 = true,
})
trail.register_trample_node("df_farming:pig_tail_8", {
trampled_node_name = "df_farming:pig_tail_trampled",
randomize_trampled_param2 = true,
})
end

Binary file not shown.

After

Width:  |  Height:  |  Size: 196 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 694 B

View File

@ -1,7 +0,0 @@
default
subterrane
df_farming?
farming?
intllib?
doc?
radiant_damage?

View File

@ -1 +0,0 @@
Various node types used by the dfcaverns mapgen mod. Includes cave coral, flowstone, glowing crystals, glow worms, moss and fungi ground cover, and snare weed.

View File

@ -8,7 +8,7 @@ local S, NS = dofile(MP.."/intllib.lua")
-- cyan/dark cyan -- cyan/dark cyan
minetest.register_node("df_mapitems:dirt_with_cave_moss", { minetest.register_node("df_mapitems:dirt_with_cave_moss", {
description = S("Dirt With Cave Moss"), description = S("Dirt with Cave Moss"),
_doc_items_longdesc = df_mapitems.doc.cave_moss_desc, _doc_items_longdesc = df_mapitems.doc.cave_moss_desc,
_doc_items_usagehelp = df_mapitems.doc.cave_moss_usage, _doc_items_usagehelp = df_mapitems.doc.cave_moss_usage,
tiles = {"default_dirt.png^dfcaverns_cave_moss.png", "default_dirt.png", tiles = {"default_dirt.png^dfcaverns_cave_moss.png", "default_dirt.png",
@ -45,13 +45,26 @@ minetest.register_abm{
end, end,
} }
if minetest.get_modpath("trail") and trail and trail.register_trample_node then
local HARDPACK_PROBABILITY = minetest.settings:get("trail_hardpack_probability") or 0.5 -- Chance walked dirt/grass is worn and compacted to trail:trail.
local HARDPACK_COUNT = minetest.settings:get("trail_hardpack_count") or 5 -- Number of times the above chance needs to be passed for soil to compact.
trail.register_trample_node("df_mapitems:dirt_with_cave_moss", {
trampled_node_def_override = {description = S("Dirt with Cave Moss and Footprint"),},
hard_pack_node_name = "trail:trail",
footprint_opacity = 128,
hard_pack_probability = HARDPACK_PROBABILITY,
hard_pack_count = HARDPACK_COUNT,
})
end
-------------------------------------------------- --------------------------------------------------
-- floor fungus -- floor fungus
-- white/yellow -- white/yellow
minetest.register_node("df_mapitems:cobble_with_floor_fungus", { minetest.register_node("df_mapitems:cobble_with_floor_fungus", {
description = S("Cobblestone With Floor Fungus"), description = S("Cobblestone with Floor Fungus"),
_doc_items_longdesc = df_mapitems.doc.floor_fungus_desc, _doc_items_longdesc = df_mapitems.doc.floor_fungus_desc,
_doc_items_usagehelp = df_mapitems.doc.floor_fungus_usage, _doc_items_usagehelp = df_mapitems.doc.floor_fungus_usage,
tiles = {"default_cobble.png^dfcaverns_floor_fungus.png"}, tiles = {"default_cobble.png^dfcaverns_floor_fungus.png"},
@ -66,7 +79,7 @@ minetest.register_node("df_mapitems:cobble_with_floor_fungus", {
}) })
minetest.register_node("df_mapitems:cobble_with_floor_fungus_fine", { minetest.register_node("df_mapitems:cobble_with_floor_fungus_fine", {
description = S("Cobblestone With Floor Fungus"), description = S("Cobblestone with Floor Fungus"),
_doc_items_longdesc = df_mapitems.doc.floor_fungus_desc, _doc_items_longdesc = df_mapitems.doc.floor_fungus_desc,
_doc_items_usagehelp = df_mapitems.doc.floor_fungus_usage, _doc_items_usagehelp = df_mapitems.doc.floor_fungus_usage,
tiles = {"default_cobble.png^dfcaverns_floor_fungus_fine.png"}, tiles = {"default_cobble.png^dfcaverns_floor_fungus_fine.png"},
@ -106,7 +119,7 @@ minetest.register_abm{
-- Hoar moss -- Hoar moss
minetest.register_node("df_mapitems:ice_with_hoar_moss", { minetest.register_node("df_mapitems:ice_with_hoar_moss", {
description = S("Ice With Hoar Moss"), description = S("Ice with Hoar Moss"),
_doc_items_longdesc = df_mapitems.doc.hoar_moss_desc, _doc_items_longdesc = df_mapitems.doc.hoar_moss_desc,
_doc_items_usagehelp = df_mapitems.doc.hoar_moss_usage, _doc_items_usagehelp = df_mapitems.doc.hoar_moss_usage,
tiles = {"default_ice.png^dfcaverns_hoar_moss.png"}, tiles = {"default_ice.png^dfcaverns_hoar_moss.png"},

View File

@ -1,4 +1,4 @@
name = df_mapitems name = df_mapitems
description = Various node types used by the dfcaverns mapgen mod. Includes cave coral, flowstone, glowing crystals, glow worms, moss and fungi ground cover, and snare weed. description = Various node types used by the dfcaverns mapgen mod. Includes cave coral, flowstone, glowing crystals, glow worms, moss and fungi ground cover, and snare weed.
depends = default, subterrane depends = default, subterrane
optional_depends = df_farming, farming, intllib, doc, radiant_damage optional_depends = df_farming, farming, intllib, doc, radiant_damage, trail

View File

@ -107,7 +107,7 @@ minetest.register_node("df_primordial_items:glow_pods", {
-- Dirt -- Dirt
minetest.register_node("df_primordial_items:dirt_with_mycelium", { minetest.register_node("df_primordial_items:dirt_with_mycelium", {
description = S("Dirt With Primordial Mycelium"), description = S("Dirt with Primordial Mycelium"),
tiles = {"dfcaverns_mush_soil.png"}, tiles = {"dfcaverns_mush_soil.png"},
groups = {crumbly = 3, soil = 1}, groups = {crumbly = 3, soil = 1},
is_ground_content = false, is_ground_content = false,
@ -115,3 +115,16 @@ minetest.register_node("df_primordial_items:dirt_with_mycelium", {
sounds = default.node_sound_dirt_defaults(), sounds = default.node_sound_dirt_defaults(),
light_source = 3, light_source = 3,
}) })
if minetest.get_modpath("trail") and trail and trail.register_trample_node then
local HARDPACK_PROBABILITY = minetest.settings:get("trail_hardpack_probability") or 0.5 -- Chance walked dirt/grass is worn and compacted to trail:trail.
local HARDPACK_COUNT = minetest.settings:get("trail_hardpack_count") or 5 -- Number of times the above chance needs to be passed for soil to compact.
trail.register_trample_node("df_primordial_items:dirt_with_mycelium", {
trampled_node_def_override = {description = S("Dirt with Primordial Mycelium and Footprint"),},
footprint_opacity = 196,
hard_pack_node_name = "trail:trail",
hard_pack_probability = HARDPACK_PROBABILITY,
hard_pack_count = HARDPACK_COUNT,
})
end

View File

@ -2,6 +2,11 @@
local MP = minetest.get_modpath(minetest.get_current_modname()) local MP = minetest.get_modpath(minetest.get_current_modname())
local S, NS = dofile(MP.."/intllib.lua") local S, NS = dofile(MP.."/intllib.lua")
local vegetation =
{
}
---------------------------------------------------- ----------------------------------------------------
-- Ferns -- Ferns
@ -250,6 +255,26 @@ minetest.register_node("df_primordial_items:plant_matter", {
groups = {crumbly = 3, soil = 1}, groups = {crumbly = 3, soil = 1},
sounds = default.node_sound_dirt_defaults(), sounds = default.node_sound_dirt_defaults(),
}) })
if minetest.get_modpath("trail") and trail and trail.register_trample_node then
local HARDPACK_PROBABILITY = minetest.settings:get("trail_hardpack_probability") or 0.5 -- Chance walked dirt/grass is worn and compacted to trail:trail.
local HARDPACK_COUNT = minetest.settings:get("trail_hardpack_count") or 5 -- Number of times the above chance needs to be passed for soil to compact.
trail.register_trample_node("df_primordial_items:dirt_with_jungle_grass", {
trampled_node_def_override = {description = S("Dirt With Primordial Jungle Grass and Footprint"),},
footprint_opacity = 128,
hard_pack_node_name = "trail:trail",
hard_pack_probability = HARDPACK_PROBABILITY,
hard_pack_count = HARDPACK_COUNT,
})
trail.register_trample_node("df_primordial_items:plant_matter", {
trampled_node_def_override = {description = S("Primordial Plant Matter with Footprint"),},
footprint_opacity = 128,
hard_pack_node_name = "trail:trail",
hard_pack_probability = HARDPACK_PROBABILITY,
hard_pack_count = HARDPACK_COUNT,
})
end
minetest.register_node("df_primordial_items:packed_roots", { minetest.register_node("df_primordial_items:packed_roots", {
description = S("Packed Primordial Jungle Roots"), description = S("Packed Primordial Jungle Roots"),
_doc_items_longdesc = df_primordial_items.doc.packed_roots_desc, _doc_items_longdesc = df_primordial_items.doc.packed_roots_desc,
@ -305,7 +330,7 @@ minetest.register_node("df_primordial_items:jungle_roots_2", {
tiles = {"dfcaverns_jungle_root_02.png"}, tiles = {"dfcaverns_jungle_root_02.png"},
inventory_image = "dfcaverns_jungle_root_02.png", inventory_image = "dfcaverns_jungle_root_02.png",
wield_image = "dfcaverns_jungle_root_02.png", wield_image = "dfcaverns_jungle_root_02.png",
groups = {snappy = 3, flora = 1, attached_node = 1, flammable = 1}, groups = {snappy = 3, flora = 1, flammable = 1},
paramtype = "light", paramtype = "light",
drawtype = "plantlike", drawtype = "plantlike",
sounds = default.node_sound_leaves_defaults(), sounds = default.node_sound_leaves_defaults(),
@ -327,7 +352,7 @@ minetest.register_node("df_primordial_items:jungle_thorns", {
visual_scale = 1.41, visual_scale = 1.41,
inventory_image = "dfcaverns_jungle_thorns_01.png", inventory_image = "dfcaverns_jungle_thorns_01.png",
wield_image = "dfcaverns_jungle_thorns_01.png", wield_image = "dfcaverns_jungle_thorns_01.png",
groups = {snappy = 3, flora = 1, attached_node = 1, flammable = 1}, groups = {snappy = 3, flora = 1, flammable = 1},
paramtype = "light", paramtype = "light",
drawtype = "plantlike", drawtype = "plantlike",
walkable = false, walkable = false,
@ -337,4 +362,56 @@ minetest.register_node("df_primordial_items:jungle_thorns", {
use_texture_alpha = true, use_texture_alpha = true,
sunlight_propagates = true, sunlight_propagates = true,
damage_per_second = 1, damage_per_second = 1,
}) })
--local thorn_dir =
--{
-- {x=1,y=0,z=1},
-- {x=-1,y=0,z=-1},
-- {x=1,y=0,z=0},
-- {x=1,y=0,z=-1},
-- {x=-1,y=0,z=0},
-- {x=-1,y=0,z=1},
--}
--
--
--local thorn_name = "df_primordial_items:jungle_thorns"
--minetest.register_abm({
-- label = "Primordial thorn growth",
-- nodenames = {thorn_name},
-- neighbors = {"group:soil"},
-- interval = 1.0,
-- chance = 5,
-- catch_up = true,
-- action = function(pos, node, active_object_count, active_object_count_wider)
-- if math.random() < 0.1 then
-- local above = vector.add({x=0,y=1,z=0},pos)
-- local below = vector.add({x=0,y=-1,z=0},pos)
-- local above_node = minetest.get_node(above)
-- local below_node = minetest.get_node(below)
-- if above_node.name == "air" and minetest.get_item_group(below_node.name, "soil") then
-- minetest.set_node(above, {name=thorn_name})
-- end
-- if below_node.name == "air" then
-- minetest.set_node(below, {name=thorn_name})
-- end
-- return
-- end
--
-- local dir = thorn_dir[math.random(#thorn_dir)]
-- local target_pos = vector.add(dir, pos)
-- -- This gets the corners of the target zone
-- local pos1 = vector.add(target_pos, thorn_dir[1])
-- local pos2 = vector.add(target_pos, thorn_dir[2])
--
-- local list, counts = minetest.find_nodes_in_area(pos1, pos2, {thorn_name})
-- local count = counts[thorn_name]
-- local target_node = minetest.get_node(target_pos)
-- -- Cellular automaton rule B3/S12345, approximately
-- if count == 3 and target_node.name == "air" then
-- minetest.set_node(target_pos, {name=thorn_name})
-- elseif count > 5 then
-- minetest.set_node(target_pos, {name="air"})
-- end
-- end
--})

View File

@ -1,3 +1,4 @@
name = df_primordial_items name = df_primordial_items
description = A collection of flora found in the "primordial" cavern layer of DF Caverns description = A collection of flora found in the "primordial" cavern layer of DF Caverns
depends = default, mapgen_helper, subterrane, df_underworld_items, df_trees depends = default, mapgen_helper, subterrane, df_underworld_items, df_trees
optional_depends = trail

View File

@ -241,7 +241,7 @@ local digging_seal_def = {
tiles = {"dfcaverns_pit_plasma_static.png", "dfcaverns_pit_plasma_static.png^dfcaverns_seal.png", "dfcaverns_pit_plasma_static.png"}, tiles = {"dfcaverns_pit_plasma_static.png", "dfcaverns_pit_plasma_static.png^dfcaverns_seal.png", "dfcaverns_pit_plasma_static.png"},
paramtype = "light", paramtype = "light",
paramtype2 = "facedir", paramtype2 = "facedir",
light_source = 15, light_source = default.LIGHT_MAX,
groups = {immortal=1, stone=1, level=3, slade=1, pit_plasma_resistant=1, mese_radiation_shield=1, not_in_creative_inventory=1}, groups = {immortal=1, stone=1, level=3, slade=1, pit_plasma_resistant=1, mese_radiation_shield=1, not_in_creative_inventory=1},
sounds = default.node_sound_stone_defaults({ footstep = { name = "bedrock2_step", gain = 1 } }), sounds = default.node_sound_stone_defaults({ footstep = { name = "bedrock2_step", gain = 1 } }),
selection_box = { selection_box = {