Update dependencies

and use better method to test for module presence.
master
Olivier Dragon 2022-02-03 10:01:36 -05:00
parent 80fce710c3
commit 56ec0692c6
6 changed files with 82 additions and 90 deletions

View File

@ -9,17 +9,7 @@ This mod adds a maple tree to the minetest game. Originally written for the Home
## Bonemeal
The mod now registers itself with the bonemeal API, and saplings should be recognized automatically.
~~If you are using the bonemeal mod, you can add this to mods.lua to enable maple support:~~
```
if minetest.get_modpath("maple") then
bonemeal:add_sapling({
{"maple:maple_sapling", maple.grow_sapling, "soil"},
})
end
```
The mod now registers itself with the bonemeal API (optional). Saplings should be recognized automatically, and grow faster with bonemeal.
## Technic chainsaw
@ -35,9 +25,9 @@ if minetest.get_modpath("maple") then
end
```
## Stairs and slabs
## Stairs, slabs and doors
Maple tries to register fancy wooden shapes for maple wood with stairs or moreblocks.
Maple tries to register fancy wooden shapes for maple wood with stairs, moreblocks, and doors.
## Drawers

View File

@ -1,33 +1,3 @@
local S = maple.get_translator
default.register_fence(
"maple:fence_maple_wood",
{
description = S("Maple Fence"),
texture = "maple_fence.png",
inventory_image = "default_fence_overlay.png^maple_wood.png^default_fence_overlay.png^[makealpha:255,126,126",
wield_image = "default_fence_overlay.png^maple_wood.png^default_fence_overlay.png^[makealpha:255,126,126",
material = "maple:maple_wood",
groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2},
sounds = default.node_sound_wood_defaults()
}
)
default.register_fence_rail(
"maple:fence_rail_maple_wood",
{
description = S("Maple Fence Rail"),
texture = "maple_fence.png",
inventory_image = "default_fence_rail_overlay.png^maple_wood.png^" ..
"default_fence_rail_overlay.png^[makealpha:255,126,126",
wield_image = "default_fence_rail_overlay.png^maple_wood.png^" ..
"default_fence_rail_overlay.png^[makealpha:255,126,126",
material = "maple:maple_wood",
groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2},
sounds = default.node_sound_wood_defaults()
}
)
minetest.register_craft(
{
output = "maple:maple_wood 4",

View File

@ -1,5 +1,6 @@
default
stairs
stairs?
doors?
moreblocks?
drawers?
bonemeal?

View File

@ -1,4 +1,4 @@
minetest.log("[MOD] Loading maple module...")
minetest.log("verbose", "[MOD] Loading maple module...")
local S = minetest.get_translator(minetest.get_current_modname())
local modpath = minetest.get_modpath(minetest.get_current_modname())

View File

@ -1,7 +1,7 @@
local S = maple.get_translator
-- integration with bonemeal
if minetest.get_modpath("bonemeal") then
if minetest.global_exists("bonemeal") then
bonemeal:add_sapling(
{
{"maple:maple_sapling", maple.grow_sapling, "soil"}
@ -10,26 +10,48 @@ if minetest.get_modpath("bonemeal") then
end
-- derivative blocks (stairs / microblocks / etc)
if stairs and stairs.mod and stairs.mod == "redo" then
stairs.register_all(
"maple_wood",
"maple:maple_wood",
{choppy = 2, oddly_breakable_by_hand = 1, flammable = 3},
{"maple_wood.png"},
S("Maple Wood Stair"),
S("Maple Wood Slab"),
default.node_sound_wood_defaults()
)
if minetest.global_exists("stairs") then
if stairs.mod and stairs.mod == "redo" then
stairs.register_all(
"maple_wood",
"maple:maple_wood",
{choppy = 2, oddly_breakable_by_hand = 1, flammable = 3},
{"maple_wood.png"},
S("Maple Wood Stair"),
S("Maple Wood Slab"),
default.node_sound_wood_defaults()
)
stairs.register_all(
"maple_tree",
"maple:maple_tree",
{choppy = 2, oddly_breakable_by_hand = 1, flammable = 3},
{"maple_tree_top.png", "maple_tree_top.png", "maple_tree.png"},
S("Maple Trunk Stair"),
S("Maple Trunk Slab"),
default.node_sound_wood_defaults()
)
stairs.register_all(
"maple_tree",
"maple:maple_tree",
{choppy = 2, oddly_breakable_by_hand = 1, flammable = 3},
{"maple_tree_top.png", "maple_tree_top.png", "maple_tree.png"},
S("Maple Trunk Stair"),
S("Maple Trunk Slab"),
default.node_sound_wood_defaults()
)
else
stairs.register_stair_and_slab(
"maple_wood",
"maple:maple_wood",
{choppy = 2, oddly_breakable_by_hand = 1, flammable = 3},
{"maple_wood.png"},
S("Maple Stair"),
S("Maple Slab"),
default.node_sound_wood_defaults()
)
stairs.register_stair_and_slab(
"maple_tree",
"maple:maple_tree",
{choppy = 2, oddly_breakable_by_hand = 1, flammable = 3},
{"maple_tree_top.png", "maple_tree_top.png", "maple_tree.png"},
S("Maple Trunk Stair"),
S("Maple Trunk Slab"),
default.node_sound_wood_defaults()
)
end
elseif minetest.global_exists("stairsplus") then
stairsplus:register_all(
"maple",
@ -54,29 +76,10 @@ elseif minetest.global_exists("stairsplus") then
sounds = default.node_sound_wood_defaults()
}
)
else
stairs.register_stair_and_slab(
"maple_wood",
"maple:maple_wood",
{choppy = 2, oddly_breakable_by_hand = 1, flammable = 3},
{"maple_wood.png"},
S("Maple Stair"),
S("Maple Slab"),
default.node_sound_wood_defaults()
)
stairs.register_stair_and_slab(
"maple_tree",
"maple:maple_tree",
{choppy = 2, oddly_breakable_by_hand = 1, flammable = 3},
{"maple_tree_top.png", "maple_tree_top.png", "maple_tree.png"},
S("Maple Trunk Stair"),
S("Maple Trunk Slab"),
default.node_sound_wood_defaults()
)
end
if doors then
-- maple wood fence gates
if minetest.global_exists("doors") then
doors.register_fencegate(
"maple:gate_maple_wood",
{
@ -89,8 +92,36 @@ if doors then
)
end
default.register_fence(
"maple:fence_maple_wood",
{
description = S("Maple Fence"),
texture = "maple_fence.png",
inventory_image = "default_fence_overlay.png^maple_wood.png^default_fence_overlay.png^[makealpha:255,126,126",
wield_image = "default_fence_overlay.png^maple_wood.png^default_fence_overlay.png^[makealpha:255,126,126",
material = "maple:maple_wood",
groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2},
sounds = default.node_sound_wood_defaults()
}
)
default.register_fence_rail(
"maple:fence_rail_maple_wood",
{
description = S("Maple Fence Rail"),
texture = "maple_fence.png",
inventory_image = "default_fence_rail_overlay.png^maple_wood.png^" ..
"default_fence_rail_overlay.png^[makealpha:255,126,126",
wield_image = "default_fence_rail_overlay.png^maple_wood.png^" ..
"default_fence_rail_overlay.png^[makealpha:255,126,126",
material = "maple:maple_wood",
groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2},
sounds = default.node_sound_wood_defaults()
}
)
-- registering the wood type with drawers mod
if minetest.get_modpath("drawers") and default then
if minetest.global_exists("drawers") then
drawers.register_drawer(
"maple:maple_drawerk",
{
@ -107,6 +138,6 @@ if minetest.get_modpath("drawers") and default then
end
-- procedurally-generated arcs
if minetest.get_modpath("pkarcs") then
if minetest.global_exists("pkarcs") then
pkarcs.register_node("maple:maple_wood")
end

View File

@ -1,4 +1,4 @@
name = maple
description = Adds a maple tree placed during world generation.
depends = default, stairs
optional_depends = moreblocks,drawers,bonemeal,pkarcs
depends = default
optional_depends = stairs,doors,moreblocks,drawers,bonemeal,pkarcs