1
0
mirror of https://github.com/Sokomine/cottages.git synced 2025-07-12 12:50:20 +02:00

refactor, cleanup, API, bugfixes (#1)

This commit is contained in:
fluxionary
2022-10-09 14:13:47 -07:00
committed by flux
parent dbe69bcfaf
commit 846308ef5a
106 changed files with 5594 additions and 4596 deletions

19
modules/mining/crafts.lua Normal file
View File

@ -0,0 +1,19 @@
local ci = cottages.craftitems
if ci.cotton then
minetest.register_craft({
output = "cottages:rope",
recipe = {
{ci.cotton, ci.cotton, ci.cotton}
}
})
end
if ci.ladder and ci.rail then
minetest.register_craft({
output = "cottages:ladder_with_rope_and_rail 3",
recipe = {
{ci.ladder, "cottages:rope", ci.rail}
}
})
end

3
modules/mining/init.lua Normal file
View File

@ -0,0 +1,3 @@
cottages.dofile("modules", "mining", "nodes")
cottages.dofile("modules", "mining", "crafts")

70
modules/mining/nodes.lua Normal file
View File

@ -0,0 +1,70 @@
local S = cottages.S
minetest.register_node("cottages:rope", {
description = S("Rope"),
tiles = {"cottages_rope.png"},
groups = {
snappy = 3, choppy = 3, oddly_breakable_by_hand = 3,
},
walkable = false,
climbable = true,
paramtype = "light",
sunlight_propagates = true,
drawtype = "plantlike",
is_ground_content = false,
can_dig = function(pos, player)
local below = minetest.get_node({x = pos.x, y = pos.y - 1, z = pos.z})
if below.name == "cottages:rope" then
if minetest.is_player(player) then
minetest.chat_send_player(
player:get_player_name(),
S("The entire rope would be too heavy. Start digging at its lowest end!")
)
end
return false
end
return true
end
})
if cottages.has.carts then
carts:register_rail("cottages:ladder_with_rope_and_rail", {
description = S("Ladder with \"rail support\""),
tiles = {
"default_ladder_wood.png^carts_rail_straight.png^cottages_rope.png"
},
inventory_image = "default_ladder_wood.png",
wield_image = "default_ladder_wood.png",
groups = carts:get_rail_groups(),
sounds = cottages.sounds.wood,
paramtype2 = "wallmounted",
legacy_wallmounted = true,
}, {})
else
minetest.register_node("cottages:ladder_with_rope_and_rail", {
description = S("Ladder with \"rail support\""),
inventory_image = "default_ladder_wood.png",
wield_image = "default_ladder_wood.png",
drawtype = "raillike",
tiles = {
"default_ladder_wood.png^carts_rail_straight.png^cottages_rope.png"
},
paramtype = "light",
paramtype2 = "wallmounted",
sunlight_propagates = true,
walkable = false,
climbable = true,
is_ground_content = false,
selection_box = {
type = "wallmounted",
},
groups = {
choppy = 2, oddly_breakable_by_hand = 3, rail = 1,
connect_to_raillike = minetest.raillike_group("rail"),
},
legacy_wallmounted = true,
sounds = cottages.sounds.wood,
})
end