Skip to content

Commit

Permalink
add some additional checks to maybe allow for older versions of these…
Browse files Browse the repository at this point in the history
… mods
  • Loading branch information
FaceDeer committed Aug 29, 2022
1 parent 0a0c97b commit 52b2cf8
Showing 1 changed file with 43 additions and 37 deletions.
80 changes: 43 additions & 37 deletions df_dependencies/helper_functions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ end

df_dependencies.register_stairs = function(name, override_def)
local mod, node_copy = node_name_to_stair_properties(name, override_def)
if minetest.get_modpath("stairs") then
if minetest.get_modpath("stairs") and stairs.register_stair_and_slab then
stairs.register_stair_and_slab(
name,
mod ..":" .. name,
Expand All @@ -76,7 +76,7 @@ df_dependencies.register_stairs = function(name, override_def)
node_copy.sounds
)
end
if minetest.get_modpath("mcl_stairs") then
if minetest.get_modpath("mcl_stairs") and mcl_stairs.register_stair_and_slab_simple then
mcl_stairs.register_stair_and_slab_simple(
name,
mod ..":" .. name,
Expand All @@ -89,7 +89,7 @@ end

df_dependencies.register_more_stairs = function(name, override_def)
local mod, node_copy = node_name_to_stair_properties(name, override_def)
if minetest.get_modpath("moreblocks") then
if minetest.get_modpath("moreblocks") and stairsplus.register_all then
stairsplus:register_all(mod, name, mod..":"..name, node_copy)
end
end
Expand All @@ -104,46 +104,52 @@ df_dependencies.register_all_fences = function (name, override_def)
local texture = override_def.texture or node_def.tiles[1]

if minetest.get_modpath("default") then
default.register_fence(material .. "_fence", {
description = S("@1 Fence", node_def.description),
texture = texture,
material = 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
if default.register_fence then
default.register_fence(material .. "_fence", {
description = S("@1 Fence", node_def.description),
texture = texture,
material = 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
end

default.register_fence_rail(material .. "_fence_rail", {
description = S("@1 Fence Rail", node_def.description),
texture = texture,
material = 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,

if default.register_fence_rail then
default.register_fence_rail(material .. "_fence_rail", {
description = S("@1 Fence Rail", node_def.description),
texture = texture,
material = 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
end

default.register_mesepost(material .. "_mese_light", {
description = S("@1 Mese Post Light", node_def.description),
texture = texture,
material = 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 default.register_mesepost then
default.register_mesepost(material .. "_mese_light", {
description = S("@1 Mese Post Light", node_def.description),
texture = texture,
material = 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
})
end
end

if minetest.get_modpath("doors") then
if minetest.get_modpath("doors") and doors.register_fencegate then
doors.register_fencegate(material .. "_fence_gate", {
description = S("@1 Fence Gate", node_def.description),
texture = texture,
Expand All @@ -161,7 +167,7 @@ df_dependencies.register_all_fences = function (name, override_def)
end
end

if minetest.get_modpath("mcl_fences") then
if minetest.get_modpath("mcl_fences") and mcl_fences.register_fence_and_fence_gate then
local groups = deep_copy(node_def.groups or {})
groups.fence_wood = 1
mcl_fences.register_fence_and_fence_gate(name .. "_fence",
Expand Down

0 comments on commit 52b2cf8

Please sign in to comment.