Getting started on moving all default dependencies to a single root mod

This commit is contained in:
FaceDeer 2022-08-01 17:37:41 -06:00
parent e5ceed23b8
commit b6c4dedcfb
23 changed files with 359 additions and 264 deletions

View File

@ -1,19 +1,19 @@
if minetest.get_modpath("fireflies") then if df_dependencies.node_name_fireflies then
df_caverns.node_id.fireflies = minetest.get_content_id("fireflies:firefly") df_caverns.node_id.fireflies = minetest.get_content_id(df_dependencies.node_name_fireflies)
end end
df_caverns.node_id.cobble = minetest.get_content_id("default:cobble") df_caverns.node_id.cobble = minetest.get_content_id(df_dependencies.node_name_cobble)
df_caverns.node_id.desert_sand = minetest.get_content_id("default:desert_sand") df_caverns.node_id.desert_sand = minetest.get_content_id(df_dependencies.node_name_desert_sand)
df_caverns.node_id.dirt = minetest.get_content_id("default:dirt") df_caverns.node_id.dirt = minetest.get_content_id(df_dependencies.node_name_dirt)
df_caverns.node_id.gravel = minetest.get_content_id("default:gravel") df_caverns.node_id.gravel = minetest.get_content_id(df_dependencies.node_name_gravel)
df_caverns.node_id.ice = minetest.get_content_id("default:ice") df_caverns.node_id.ice = minetest.get_content_id(df_dependencies.node_name_ice)
df_caverns.node_id.lava = minetest.get_content_id("default:lava_source") df_caverns.node_id.lava = minetest.get_content_id(df_dependencies.node_name_lava_source)
df_caverns.node_id.meseore = minetest.get_content_id("default:stone_with_mese") df_caverns.node_id.meseore = minetest.get_content_id(df_dependencies.node_name_stone_with_mese)
df_caverns.node_id.mossycobble = minetest.get_content_id("default:mossycobble") df_caverns.node_id.mossycobble = minetest.get_content_id(df_dependencies.node_name_mossycobble)
df_caverns.node_id.obsidian = minetest.get_content_id("default:obsidian") df_caverns.node_id.obsidian = minetest.get_content_id(df_dependencies.node_name_obsidian)
df_caverns.node_id.sand = minetest.get_content_id("default:sand") df_caverns.node_id.sand = minetest.get_content_id(df_dependencies.node_name_sand)
df_caverns.node_id.silver_sand = minetest.get_content_id("default:silver_sand") df_caverns.node_id.silver_sand = minetest.get_content_id(df_dependencies.node_name_silver_sand)
df_caverns.node_id.snow = minetest.get_content_id("default:snow") df_caverns.node_id.snow = minetest.get_content_id(df_dependencies.node_name_snow)
df_caverns.node_id.stone = minetest.get_content_id("default:stone") df_caverns.node_id.stone = minetest.get_content_id(df_dependencies.node_name_stone)
df_caverns.node_id.stone_with_coal = minetest.get_content_id("default:stone_with_coal") df_caverns.node_id.stone_with_coal = minetest.get_content_id(df_dependencies.node_name_stone_with_coal)
df_caverns.node_id.water = minetest.get_content_id("default:water_source") df_caverns.node_id.water = minetest.get_content_id(df_dependencies.node_name_water_source)

View File

@ -1,4 +1,4 @@
name = df_caverns name = df_caverns
description = Adds vast underground caverns in the style of Dwarf Fortress, complete with underground flora in diverse biomes. Also adds stalactite/stalagmite decorations in the smaller tunnels. description = Adds vast underground caverns in the style of Dwarf Fortress, complete with underground flora in diverse biomes. Also adds stalactite/stalagmite decorations in the smaller tunnels.
depends = default, subterrane, df_trees, df_mapitems depends = df_dependencies, subterrane, df_trees, df_mapitems
optional_depends = df_farming, ice_sprites, oil, df_underworld_items, magma_conduits, bones_loot, named_waypoints, name_generator, fireflies, chasms, big_webs optional_depends = df_farming, ice_sprites, oil, df_underworld_items, magma_conduits, bones_loot, named_waypoints, name_generator, fireflies, chasms, big_webs

View File

@ -0,0 +1,14 @@
# textdomain: df_dependencies
### minetest_game.lua ###
@1 Fence=
@1 Fence Gate=
@1 Fence Rail=
@1 Mese Post Light=
#WARNING: AUTOTRANSLATED BY GOOGLE TRANSLATE
@1 Slab=@1 Platte
#WARNING: AUTOTRANSLATED BY GOOGLE TRANSLATE
@1 Stair=@1 Treppe

View File

@ -0,0 +1,14 @@
# textdomain: df_dependencies
### minetest_game.lua ###
@1 Fence=
@1 Fence Gate=
@1 Fence Rail=
@1 Mese Post Light=
#WARNING: AUTOTRANSLATED BY GOOGLE TRANSLATE
@1 Slab=@1 Lastra
#WARNING: AUTOTRANSLATED BY GOOGLE TRANSLATE
@1 Stair=@1 Scala

View File

@ -0,0 +1,11 @@
# textdomain: df_dependencies
### minetest_game.lua ###
@1 Fence=
@1 Fence Gate=
@1 Fence Rail=
@1 Mese Post Light=
@1 Slab=
@1 Stair=

View File

@ -0,0 +1,206 @@
local S = minetest.get_translator(minetest.get_current_modname())
--- From "default"
df_dependencies.sound_dirt = default.node_sound_dirt_defaults
df_dependencies.sound_glass = default.node_sound_glass_defaults
df_dependencies.sound_leaves = default.node_sound_leaves_defaults
df_dependencies.sound_sand = default.node_sound_sand_defaults
df_dependencies.sound_stone = default.node_sound_stone_defaults
df_dependencies.sound_water = default.node_sound_water_defaults
df_dependencies.sound_wood = default.node_sound_wood_defaults
df_dependencies.soundfile_grass_footstep = "default_grass_footstep"
df_dependencies.soundfile_snow_footstep = "default_snow_footstep"
df_dependencies.node_name_apple = "default:apple"
df_dependencies.node_name_chest = "default:chest"
df_dependencies.node_name_coalblock = "default:coalblock"
df_dependencies.node_name_cobble = "default:cobble"
df_dependencies.node_name_coral_skeleton = "default:coral_skeleton"
df_dependencies.node_name_desert_sand = "default:desert_sand"
df_dependencies.node_name_dirt = "default:dirt"
df_dependencies.node_name_dry_grass_3 = "default:dry_grass_3"
df_dependencies.node_name_dry_grass_4 = "default:dry_grass_4"
df_dependencies.node_name_dry_shrub = "default:dry_shrub"
df_dependencies.node_name_furnace = "default:furnace"
df_dependencies.node_name_gold_ingot = "default:gold_ingot"
df_dependencies.node_name_gravel = "default:gravel"
df_dependencies.node_name_ice = "default:ice"
df_dependencies.node_name_junglewood = "default:junglewood"
df_dependencies.node_name_lava_source = "default:lava_source"
df_dependencies.node_name_mese_crystal = "default:mese_crystal"
df_dependencies.node_name_mossycobble = "default:mossycobble"
df_dependencies.node_name_obsidian = "default:obsidian"
df_dependencies.node_name_paper = "default:paper"
df_dependencies.node_name_river_water_flowing = "default:river_water_flowing"
df_dependencies.node_name_river_water_source = "default:river_water_source"
df_dependencies.node_name_sand = "default:sand"
df_dependencies.node_name_sand = "default:sand"
df_dependencies.node_name_silver_sand = "default:silver_sand"
df_dependencies.node_name_snow = "default:snow"
df_dependencies.node_name_stone = "default:stone"
df_dependencies.node_name_stone_with_coal = "default:stone_with_coal"
df_dependencies.node_name_stone_with_mese = "default:stone_with_mese"
df_dependencies.node_name_torch = "default:torch"
df_dependencies.node_name_torch_wall = "default:torch_wall"
df_dependencies.node_name_water_flowing = "default:water_flowing"
df_dependencies.node_name_water_source = "default:water_source"
df_dependencies.texture_cobble = "default_cobble.png"
df_dependencies.texture_coral_skeleton = "default_coral_skeleton.png"
df_dependencies.texture_dirt = "default_dirt.png"
df_dependencies.texture_gold_block = "default_gold_block.png"
df_dependencies.texture_ice = "default_ice.png"
df_dependencies.texture_sand = "default_sand.png"
df_dependencies.texture_stone = "default_stone.png"
df_dependencies.data_iron_containing_nodes = {"default:stone_with_iron", "default:steelblock"}
df_dependencies.data_copper_containing_nodes = {"default:stone_with_copper", "default:copperblock"}
df_dependencies.data_mese_containing_nodes = {"default:stone_with_mese", "default:mese"}
df_dependencies.register_leafdecay = default.register_leafdecay
df_dependencies.after_place_leaves = default.after_place_leaves
-- Note that a circular table reference will result in a crash, TODO: guard against that.
-- Unlikely to be needed, though - it'd take a lot of work for users to get into this bit of trouble.
local function deep_copy(table_in)
local table_out = {}
for index, value in pairs(table_in) do
if type(value) == "table" then
table_out[index] = deep_copy(value)
else
table_out[index] = value
end
end
return table_out
end
df_dependencies.register_all_stairs = function(name, override_def)
local mod = minetest.get_current_modname()
local node_def = minetest.registered_nodes[mod..":"..name]
override_def = override_def or {}
local node_copy = deep_copy(node_def)
for index, value in pairs(override_def) do
node_copy[index] = value
end
if minetest.get_modpath("stairs") then
stairs.register_stair_and_slab(
name,
mod ..":" .. name,
node_copy.groups,
node_copy.tiles,
S("@1 Stair", node_copy.description),
S("@1 Slab", node_copy.description),
node_copy.sounds
)
end
if minetest.get_modpath("moreblocks") then
stairsplus:register_all(mod, name, mod..":"..name, node_copy)
end
end
df_dependencies.register_all_fences = function (name, override_def)
local mod = minetest.get_current_modname()
local material = mod..":"..name
local node_def = minetest.registered_nodes[material]
override_def = override_def or {}
local burntime = override_def.burntime
default.register_fence(material .. "_fence", {
description = S("@1 Fence", node_def.description),
texture = override_def.texture or node_def.tiles[1],
material = override_def.material or material,
groups = deep_copy(node_def.groups or {}), -- the default register_fence function modifies the groups table passed in, so send a copy instead to be on the safe side.
sounds = node_def.sounds
})
if burntime then
minetest.register_craft({
type = "fuel",
recipe = material .. "_fence",
burntime = burntime, -- ignoring two sticks
})
end
default.register_fence_rail(material .. "_fence_rail", {
description = S("@1 Fence Rail", node_def.description),
texture = override_def.texture or node_def.tiles[1],
material = override_def.material or material,
groups = deep_copy(node_def.groups or {}), -- the default register_fence_rail function modifies the groups table passed in, so send a copy instead to be on the safe side.
sounds = node_def.sounds
})
if burntime then
minetest.register_craft({
type = "fuel",
recipe = material .. "_fence_rail",
burntime = burntime * 4/16,
})
end
default.register_mesepost(material .. "_mese_light", {
description = S("@1 Mese Post Light", node_def.description),
texture = override_def.texture or node_def.tiles[1],
material = override_def.material or material,
groups = deep_copy(node_def.groups or {}), -- the default register_fence_rail function modifies the groups table passed in, so send a copy instead to be on the safe side.
sounds = node_def.sounds
})
if minetest.get_modpath("doors") then
doors.register_fencegate(material .. "_fence_gate", {
description = S("@1 Fence Gate", node_def.description),
texture = override_def.texture or node_def.tiles[1],
material = override_def.material or material,
groups = deep_copy(node_def.groups or {}), -- the default register_fence_rail function modifies the groups table passed in, so send a copy instead to be on the safe side.
sounds = node_def.sounds
})
if burntime then
minetest.register_craft({
type = "fuel",
recipe = material .. "_fence_gate_closed",
burntime = burntime * 2, -- ignoring four sticks
})
end
end
end
-- from "farming"
if minetest.get_modpath("farming") then
df_dependencies.node_name_dirt_furrowed = "farming:soil"
df_dependencies.node_name_dirt_wet = "farming:soil_wet"
df_dependencies.node_name_mortar_pestle = "farming:mortar_pestle"
df_dependencies.node_name_string = "farming:string"
-- If the farming mod is installed, add the "straw" group to farming straw.
-- This way goblin caps just need to check for group:straw to get cave straw as well
local straw_def = minetest.registered_items["farming:straw"]
if straw_def then
local new_groups = {}
for group, val in pairs(straw_def.groups) do
new_groups[group] = val
end
new_groups.straw = 1
minetest.override_item("farming:straw", {
groups = new_groups
})
end
end
-- from "bucket"
df_dependencies.node_name_bucket_empty = "bucket:bucket_empty"
-- from "wool"
df_dependencies.node_name_wool_white = "wool:white"
-- from "fireflies"
df_dependencies.node_name_fireflies = "fireflies:firefly"

View File

@ -1,4 +1,4 @@
name = df_dependencies name = df_dependencies
description = A utility mod for df_caverns that gathers all dependencies on the default minetest_game in one place, to ease compatibility efforts with mineclone and other such non-default games description = A utility mod for df_caverns that gathers all dependencies on minetest_game in one place, to ease compatibility efforts with mineclone and other such games
depends = default depends = default
optional_depends = optional_depends = moreblocks, stairs, doors, farming, wool, fireflies

View File

@ -129,15 +129,15 @@ if minetest.get_modpath("cottages") then
recipe_registered = true recipe_registered = true
end end
if minetest.registered_items["farming:mortar_pestle"] ~= nil then if minetest.registered_items[df_farming.node_names.mortar_pestle] ~= nil then
minetest.register_craft({ minetest.register_craft({
type = "shapeless", type = "shapeless",
output = "df_farming:cave_flour", output = "df_farming:cave_flour",
recipe = { recipe = {
"df_farming:cave_wheat", "df_farming:cave_wheat", "df_farming:cave_wheat", "df_farming:cave_wheat", "df_farming:cave_wheat", "df_farming:cave_wheat",
"df_farming:cave_wheat", "farming:mortar_pestle" "df_farming:cave_wheat", df_farming.node_names.mortar_pestle
}, },
replacements = {{"group:food_mortar_pestle", "farming:mortar_pestle"}}, replacements = {{"group:food_mortar_pestle", df_farming.node_names.mortar_pestle}},
}) })
recipe_registered = true recipe_registered = true
end end

View File

@ -1,18 +1,23 @@
df_farming.sounds = {} df_farming.sounds = {}
df_farming.sounds.leaves = default.node_sound_leaves_defaults() df_farming.sounds.leaves = df_dependencies.sound_leaves()
df_farming.sounds.water = default.node_sound_water_defaults() df_farming.sounds.syrup = df_dependencies.sound_water()
if minetest.get_modpath("oil") then
df_farming.sounds.syrup.footstep = {name = "oil_oil_footstep", gain = 0.2}
end
df_farming.node_names = {} df_farming.node_names = {}
df_farming.node_names.dirt = "default:dirt" df_farming.node_names.dirt = df_dependencies.node_name_dirt
df_farming.node_names.dirt_wet = df_dependencies.node_name_dirt_wet
df_farming.node_names.mortar_pestle = df_dependencies.node_name_mortar_pestle
df_farming.node_names.bucket = df_dependencies.node_name_bucket_empty
df_farming.node_names.wool_white = df_dependencies.node_name_wool_white
df_farming.node_names.string = df_dependencies.node_name_string
df_farming.node_names.dirt_moss = "df_farming:dirt_with_cave_moss" df_farming.node_names.dirt_moss = "df_farming:dirt_with_cave_moss"
df_farming.node_names.floor_fungus = "df_farming:cobble_with_floor_fungus" df_farming.node_names.floor_fungus = "df_farming:cobble_with_floor_fungus"
df_farming.node_names.dirt_wet = "farming:soil_wet"
df_farming.node_names.mortar_pestle = "farming:mortar_pestle"
df_farming.node_names.bucket = "bucket:bucket_empty"
df_farming.node_names.wool_white = "wool:white"
-- these are only for initialization -- these are only for initialization
minetest.after(0, function() minetest.after(0, function()

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 = df_dependencies
optional_depends = farming, cottages, bucket, dynamic_liquid, wool, doc, crafting, footprints optional_depends = farming, cottages, bucket, dynamic_liquid, doc, crafting, footprints, oil

View File

@ -95,7 +95,7 @@ minetest.register_craftitem("df_farming:pig_tail_thread", {
groups = {flammable = 1, thread = 1}, groups = {flammable = 1, thread = 1},
}) })
if minetest.get_modpath("wool") then if df_farming.node_names.wool_white then
minetest.register_craft({ minetest.register_craft({
output = df_farming.node_names.wool_white, output = df_farming.node_names.wool_white,
recipe = { recipe = {
@ -104,9 +104,9 @@ if minetest.get_modpath("wool") then
} }
}) })
end end
if minetest.get_modpath("farming") then if df_farming.node_names.string then
minetest.register_craft({ minetest.register_craft({
output = "farming:string 2", output = df_farming.node_names.string .. " 2",
recipe = { recipe = {
{"group:thread"}, {"group:thread"},
{"group:thread"}, {"group:thread"},

View File

@ -184,7 +184,7 @@ if minetest.get_modpath("bucket") then
liquid_range = 2, liquid_range = 2,
post_effect_color = {a = 204, r = 179, g = 131, b = 88}, post_effect_color = {a = 204, r = 179, g = 131, b = 88},
groups = {liquid = 3, flammable = 2}, groups = {liquid = 3, flammable = 2},
sounds = df_farming.sounds.water, sounds = df_farming.sounds.syrup,
}) })
minetest.register_node("df_farming:dwarven_syrup_flowing", { minetest.register_node("df_farming:dwarven_syrup_flowing", {
@ -233,7 +233,7 @@ if minetest.get_modpath("bucket") then
liquid_range = 2, liquid_range = 2,
post_effect_color = {a = 204, r = 179, g = 131, b = 88}, post_effect_color = {a = 204, r = 179, g = 131, b = 88},
groups = {liquid = 3, flammable = 2, not_in_creative_inventory = 1}, groups = {liquid = 3, flammable = 2, not_in_creative_inventory = 1},
sounds = df_farming.sounds.water, sounds = df_farming.sounds.syrup,
}) })
bucket.register_liquid( bucket.register_liquid(

View File

@ -1,40 +1,40 @@
df_mapitems.sounds = {} df_mapitems.sounds = {}
df_mapitems.sounds.stone = default.node_sound_stone_defaults() df_mapitems.sounds.stone = df_dependencies.sound_stone()
df_mapitems.sounds.floor_fungus = default.node_sound_stone_defaults({footstep = {name = "dfcaverns_squish", gain = 0.25},}) df_mapitems.sounds.floor_fungus = df_dependencies.sound_stone({footstep = {name = "dfcaverns_squish", gain = 0.25},})
df_mapitems.sounds.sandscum = default.node_sound_sand_defaults({footstep = {name = "dfcaverns_squish", gain = 0.25},}) df_mapitems.sounds.sandscum = df_dependencies.sound_sand({footstep = {name = "dfcaverns_squish", gain = 0.25},})
df_mapitems.sounds.glass = default.node_sound_glass_defaults() df_mapitems.sounds.glass = df_dependencies.sound_glass()
df_mapitems.sounds.dirt = default.node_sound_dirt_defaults() df_mapitems.sounds.dirt = df_dependencies.sound_dirt()
df_mapitems.sounds.dirt_mossy = default.node_sound_dirt_defaults({footstep = {name = "default_grass_footstep", gain = 0.25},}) df_mapitems.sounds.dirt_mossy = df_dependencies.sound_dirt({footstep = {name = df_dependencies.soundfile_grass_footstep, gain = 0.25},})
df_mapitems.node_id = {} df_mapitems.node_id = {}
df_mapitems.node_id.stone = minetest.get_content_id("default:stone") df_mapitems.node_id.stone = minetest.get_content_id(df_dependencies.node_name_stone)
df_mapitems.node_id.water = minetest.get_content_id("default:water_source") df_mapitems.node_id.water = minetest.get_content_id(df_dependencies.node_name_water_source)
df_mapitems.node_id.dirt = minetest.get_content_id("default:dirt") df_mapitems.node_id.dirt = minetest.get_content_id(df_dependencies.node_name_dirt)
df_mapitems.texture = {} df_mapitems.texture = {}
df_mapitems.texture.coral_skeleton = "default_coral_skeleton.png" df_mapitems.texture.coral_skeleton = df_dependencies.texture_coral_skeleton
df_mapitems.texture.cobble = "default_cobble.png" df_mapitems.texture.cobble = df_dependencies.texture_cobble
df_mapitems.texture.stone = "default_stone.png" df_mapitems.texture.stone = df_dependencies.texture_stone
df_mapitems.texture.ice = "default_ice.png" df_mapitems.texture.ice = df_dependencies.texture_ice
df_mapitems.texture.sand = "default_sand.png" df_mapitems.texture.sand = df_dependencies.texture_sand
df_mapitems.texture.dirt = "default_dirt.png" df_mapitems.texture.dirt = df_dependencies.texture_dirt
df_mapitems.node_name = {} df_mapitems.node_name = {}
df_mapitems.node_name.coral_skeleton = "default:coral_skeleton" df_mapitems.node_name.coral_skeleton = df_dependencies.node_name_coral_skeleton
df_mapitems.node_name.water = "default:water_source" df_mapitems.node_name.water = df_dependencies.node_name_water_source
df_mapitems.node_name.mese_crystal = "default:mese_crystal" df_mapitems.node_name.mese_crystal = df_dependencies.node_name_mese_crystal
df_mapitems.node_name.cobble = "default:cobble" df_mapitems.node_name.cobble = df_dependencies.node_name_cobble
df_mapitems.node_name.sand = "default:sand" df_mapitems.node_name.sand = df_dependencies.node_name_sand
df_mapitems.node_name.dirt = "default:dirt" df_mapitems.node_name.dirt = df_dependencies.node_name_dirt
df_mapitems.node_name.stone = "default:stone" df_mapitems.node_name.stone = df_dependencies.node_name_stone
df_mapitems.node_name.ice = "default:ice" df_mapitems.node_name.ice = df_dependencies.node_name_ice
df_mapitems.node_name.farming_soil = "farming:soil" df_mapitems.node_name.farming_soil = df_dependencies.node_name_dirt_furrowed
df_mapitems.node_name.farming_soil_wet = "farming:soil_wet" df_mapitems.node_name.farming_soil_wet = df_dependencies.node_name_dirt_wet
-- This stuff should only be used during initialization -- This stuff should only be used during initialization
minetest.after(0, function() minetest.after(0, function()

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 = df_dependencies, subterrane
optional_depends = df_farming, farming, doc, radiant_damage, footprints optional_depends = df_farming, doc, radiant_damage, footprints

View File

@ -2,21 +2,21 @@
df_primordial_items.node_names = {} df_primordial_items.node_names = {}
df_primordial_items.node_names.dirt = "default:dirt" df_primordial_items.node_names.dirt = df_dependencies.node_name_dirt
df_primordial_items.node_names.dry_shrub = "default:dry_shrub" df_primordial_items.node_names.dry_shrub = df_dependencies.node_name_dry_shrub
df_primordial_items.node_names.dry_grass_3 = "default:dry_grass_3" df_primordial_items.node_names.dry_grass_3 = df_dependencies.node_name_dry_grass_3
df_primordial_items.node_names.dry_grass_4 = "default:dry_grass_4" df_primordial_items.node_names.dry_grass_4 = df_dependencies.node_name_dry_grass_4
df_primordial_items.node_names.junglewood = "default:junglewood" df_primordial_items.node_names.junglewood = df_dependencies.node_name_junglewood
df_primordial_items.sounds = {} df_primordial_items.sounds = {}
df_primordial_items.sounds.leaves = default.node_sound_leaves_defaults() df_primordial_items.sounds.leaves = df_dependencies.sound_leaves()
df_primordial_items.sounds.wood = default.node_sound_wood_defaults() df_primordial_items.sounds.wood = df_dependencies.sound_wood()
df_primordial_items.sounds.glass = default.node_sound_glass_defaults() df_primordial_items.sounds.glass = df_dependencies.sound_glass()
df_primordial_items.sounds.dirt = default.node_sound_dirt_defaults() df_primordial_items.sounds.dirt = df_dependencies.sound_dirt()
df_primordial_items.register_leafdecay = default.register_leafdecay df_primordial_items.register_leafdecay = df_dependencies.register_leafdecay
df_primordial_items.after_place_leaves = default.after_place_leaves df_primordial_items.after_place_leaves = df_dependencies.after_place_leaves
-- This stuff should only be used during initialization -- This stuff should only be used during initialization
minetest.after(0, function() minetest.after(0, function()

View File

@ -1,4 +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 = df_dependencies, mapgen_helper, subterrane, df_underworld_items, df_trees
optional_depends = footprints, df_farming optional_depends = footprints, df_farming

View File

@ -1,145 +1,40 @@
-- Note that a circular table reference will result in a crash, TODO: guard against that.
-- Unlikely to be needed, though - it'd take a lot of work for users to get into this bit of trouble.
local function deep_copy(table_in)
local table_out = {}
for index, value in pairs(table_in) do
if type(value) == "table" then
table_out[index] = deep_copy(value)
else
table_out[index] = value
end
end
return table_out
end
local S = minetest.get_translator(minetest.get_current_modname()) local S = minetest.get_translator(minetest.get_current_modname())
df_trees.sounds = {} df_trees.sounds = {}
df_trees.sounds.wood = default.node_sound_wood_defaults() df_trees.sounds.wood = df_dependencies.sound_wood()
df_trees.sounds.leaves = default.node_sound_leaves_defaults() df_trees.sounds.leaves = df_dependencies.sound_leaves()
df_trees.sounds.nethercap_wood = default.node_sound_wood_defaults({ df_trees.sounds.nethercap_wood = df_dependencies.sound_wood({
footstep = {name = "default_snow_footstep", gain = 0.2}, footstep = {name = df_dependencies.soundfile_snow_footstep, gain = 0.2},
}) })
df_trees.sounds.glass = default.node_sound_glass_defaults() df_trees.sounds.glass = df_dependencies.sound_glass()
df_trees.node_names = {} df_trees.node_names = {}
df_trees.node_names.torch = "default:torch" df_trees.node_names.torch = df_dependencies.node_name_torch
df_trees.node_names.chest = "default:chest" df_trees.node_names.chest = df_dependencies.node_name_chest
df_trees.node_names.furnace = "default:furnace" df_trees.node_names.furnace = df_dependencies.node_name_furnace
df_trees.node_names.apple = "default:apple" df_trees.node_names.apple = df_dependencies.node_name_apple
df_trees.node_names.gold_ingot = "default:gold_ingot" df_trees.node_names.gold_ingot = df_dependencies.node_name_gold_ingot
df_trees.node_names.water_source = "default:water_source" df_trees.node_names.water_source = df_dependencies.node_name_water_source
df_trees.node_names.river_water_source = "default:river_water_source" df_trees.node_names.river_water_source = df_dependencies.node_name_river_water_source
df_trees.node_names.ice = "default:ice" df_trees.node_names.ice = df_dependencies.node_name_ice
df_trees.node_names.water_flowing = "default:water_flowing" df_trees.node_names.water_flowing = df_dependencies.node_name_water_flowing
df_trees.node_names.river_water_flowing = "default:river_water_flowing" df_trees.node_names.river_water_flowing = df_dependencies.node_name_river_water_flowing
df_trees.node_names.snow = "default:snow" df_trees.node_names.snow = df_dependencies.node_name_snow
df_trees.node_names.torch_wall = "default:torch_wall" df_trees.node_names.torch_wall = df_dependencies.node_name_torch_wall
df_trees.node_names.stone_with_coal = "default:stone_with_coal" df_trees.node_names.stone_with_coal = df_dependencies.node_name_stone_with_coal
df_trees.node_names.coalblock = "default:coalblock" df_trees.node_names.coalblock = df_dependencies.node_name_coalblock
df_trees.node_names.paper = "default:paper" df_trees.node_names.paper = df_dependencies.node_name_paper
df_trees.textures = {} df_trees.textures = {}
df_trees.textures.gold_block = "default_gold_block.png" df_trees.textures.gold_block = df_dependencies.texture_gold_block
df_trees.register = {} df_trees.register = {}
df_trees.register.all_stairs = function(name, override_def) df_trees.register.all_stairs = df_dependencies.register_all_stairs
local mod = minetest.get_current_modname()
local node_def = minetest.registered_nodes[mod..":"..name] df_trees.register.all_fences = df_dependencies.register_all_fences
override_def = override_def or {}
local node_copy = deep_copy(node_def)
for index, value in pairs(override_def) do
node_copy[index] = value
end
if minetest.get_modpath("stairs") then
stairs.register_stair_and_slab(
name,
mod ..":" .. name,
node_copy.groups,
node_copy.tiles,
S("@1 Stair", node_copy.description),
S("@1 Slab", node_copy.description),
node_copy.sounds
)
end
if minetest.get_modpath("moreblocks") then
stairsplus:register_all(mod, name, mod..":"..name, node_copy)
end
end
df_trees.register.all_fences = function (name, override_def)
local mod = minetest.get_current_modname()
local material = mod..":"..name
local node_def = minetest.registered_nodes[material]
override_def = override_def or {}
local burntime = override_def.burntime
default.register_fence(material .. "_fence", {
description = S("@1 Fence", node_def.description),
texture = override_def.texture or node_def.tiles[1],
material = override_def.material or material,
groups = deep_copy(node_def.groups or {}), -- the default register_fence function modifies the groups table passed in, so send a copy instead to be on the safe side.
sounds = node_def.sounds
})
if burntime then
minetest.register_craft({
type = "fuel",
recipe = material .. "_fence",
burntime = burntime, -- ignoring two sticks
})
end
default.register_fence_rail(material .. "_fence_rail", {
description = S("@1 Fence Rail", node_def.description),
texture = override_def.texture or node_def.tiles[1],
material = override_def.material or material,
groups = deep_copy(node_def.groups or {}), -- the default register_fence_rail function modifies the groups table passed in, so send a copy instead to be on the safe side.
sounds = node_def.sounds
})
if burntime then
minetest.register_craft({
type = "fuel",
recipe = material .. "_fence_rail",
burntime = burntime * 4/16,
})
end
default.register_mesepost(material .. "_mese_light", {
description = S("@1 Mese Post Light", node_def.description),
texture = override_def.texture or node_def.tiles[1],
material = override_def.material or material,
groups = deep_copy(node_def.groups or {}), -- the default register_fence_rail function modifies the groups table passed in, so send a copy instead to be on the safe side.
sounds = node_def.sounds
})
if minetest.get_modpath("doors") then
doors.register_fencegate(material .. "_fence_gate", {
description = S("@1 Fence Gate", node_def.description),
texture = override_def.texture or node_def.tiles[1],
material = override_def.material or material,
groups = deep_copy(node_def.groups or {}), -- the default register_fence_rail function modifies the groups table passed in, so send a copy instead to be on the safe side.
sounds = node_def.sounds
})
if burntime then
minetest.register_craft({
type = "fuel",
recipe = material .. "_fence_gate_closed",
burntime = burntime * 2, -- ignoring four sticks
})
end
end
end
-- this stuff is only for during initialization -- this stuff is only for during initialization
minetest.after(0, function() minetest.after(0, function()
@ -149,20 +44,18 @@ minetest.after(0, function()
df_trees.register = nil df_trees.register = nil
end) end)
df_trees.iron_containing_nodes = df_dependencies.data_iron_containing_nodes
df_trees.copper_containing_nodes = df_dependencies.data_copper_containing_nodes
df_trees.mese_containing_nodes = df_dependencies.data_mese_containing_nodes
df_trees.iron_containing_nodes = {"default:stone_with_iron", "default:steelblock"} df_trees.after_place_leaves = df_dependencies.after_place_leaves
df_trees.copper_containing_nodes = {"default:stone_with_copper", "default:copperblock"} df_trees.register_leafdecay = df_dependencies.register_leafdecay
df_trees.mese_containing_nodes = {"default:stone_with_mese", "default:mese"}
df_trees.after_place_leaves = default.after_place_leaves
df_trees.register_leafdecay = default.register_leafdecay
-- This is used by other mods, leave it exposed -- This is used by other mods, leave it exposed
df_trees.node_sound_tree_soft_fungus_defaults = function(table) df_trees.node_sound_tree_soft_fungus_defaults = function(table)
table = table or {} table = table or {}
table.footstep = table.footstep or table.footstep = table.footstep or
{name = "dfcaverns_fungus_footstep", gain = 0.3} {name = "dfcaverns_fungus_footstep", gain = 0.3}
default.node_sound_wood_defaults(table) df_dependencies.sound_wood(table)
return table return table
end end

View File

@ -248,23 +248,6 @@ local c_stem = minetest.get_content_id("df_trees:goblin_cap_stem")
local c_cap = minetest.get_content_id("df_trees:goblin_cap") local c_cap = minetest.get_content_id("df_trees:goblin_cap")
local c_gills = minetest.get_content_id("df_trees:goblin_cap_gills") local c_gills = minetest.get_content_id("df_trees:goblin_cap_gills")
-- If the farming mod is installed, add the "straw" group to farming straw.
-- This way we just need to check for group:straw to get cave straw as well, without
-- needing a df_farming dependency for this mod.
if minetest.get_modpath("farming") then
local straw_def = minetest.registered_items["farming:straw"]
if straw_def then
local new_groups = {}
for group, val in pairs(straw_def.groups) do
new_groups[group] = val
end
new_groups.straw = 1
minetest.override_item("farming:straw", {
groups = new_groups
})
end
end
df_trees.spawn_goblin_cap = function(pos) df_trees.spawn_goblin_cap = function(pos)
if math.random() < 0.1 then if math.random() < 0.1 then
if math.random() < 0.5 then if math.random() < 0.5 then

View File

@ -22,17 +22,6 @@ Blood Thorn Stem=Blutdornstamm
Dead Blood Thorn Spike= Dead Blood Thorn Spike=
Dead Blood Thorn Stem= Dead Blood Thorn Stem=
### dependencies.lua ###
@1 Fence=
@1 Fence Gate=
@1 Fence Rail=
@1 Mese Post Light=
#WARNING: AUTOTRANSLATED BY GOOGLE TRANSLATE
@1 Slab=@1 Platte
#WARNING: AUTOTRANSLATED BY GOOGLE TRANSLATE
@1 Stair=@1 Treppe
### doc.lua ### ### doc.lua ###
#WARNING: AUTOTRANSLATED BY GOOGLE TRANSLATE #WARNING: AUTOTRANSLATED BY GOOGLE TRANSLATE

View File

@ -17,17 +17,6 @@ Blood Thorn Stem=Gambo di spina del sangue
Dead Blood Thorn Spike=Spuntone di spina del sangue morta Dead Blood Thorn Spike=Spuntone di spina del sangue morta
Dead Blood Thorn Stem=Gambo di spina del sangue morta Dead Blood Thorn Stem=Gambo di spina del sangue morta
### dependencies.lua ###
@1 Fence=
@1 Fence Gate=
@1 Fence Rail=
@1 Mese Post Light=
#WARNING: AUTOTRANSLATED BY GOOGLE TRANSLATE
@1 Slab=@1 Lastra
#WARNING: AUTOTRANSLATED BY GOOGLE TRANSLATE
@1 Stair=@1 Scala
### doc.lua ### ### doc.lua ###
#WARNING: AUTOTRANSLATED BY GOOGLE TRANSLATE #WARNING: AUTOTRANSLATED BY GOOGLE TRANSLATE

View File

@ -17,15 +17,6 @@ Blood Thorn Stem=
Dead Blood Thorn Spike= Dead Blood Thorn Spike=
Dead Blood Thorn Stem= Dead Blood Thorn Stem=
### dependencies.lua ###
@1 Fence=
@1 Fence Gate=
@1 Fence Rail=
@1 Mese Post Light=
@1 Slab=
@1 Stair=
### doc.lua ### ### doc.lua ###
A torchspine alternates between active and quiescent phases and emits dim light when active. They can be harvested for torches, and their embers sprout into new torchspines when placed on flammable surfaces.= A torchspine alternates between active and quiescent phases and emits dim light when active. They can be harvested for torches, and their embers sprout into new torchspines when placed on flammable surfaces.=

View File

@ -1,4 +1,4 @@
name = df_trees name = df_trees
description = Adds various types of underground fungal "trees". Light kills their saplings, they only grow in the dark. description = Adds various types of underground fungal "trees". Light kills their saplings, they only grow in the dark.
depends = default depends = df_dependencies
optional_depends = doc, moreblocks, stairs, vessels, basic_materials, farming, doors, beds, df_farming, mapgen_helper optional_depends = doc, vessels, basic_materials, beds, df_farming, mapgen_helper

View File

@ -6,5 +6,5 @@ df_underworld_items.abm_neighbors.pit_plasma = {"group:stone", "df_underworld_it
-- This stuff should only be used during initialization -- This stuff should only be used during initialization
minetest.after(0, function() minetest.after(0, function()
df_underworld_items.node_name = nil df_underworld_items.abm_neighbors = nil
end) end)