Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve ladder placement #2797

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions mods/default/nodes.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2621,6 +2621,16 @@ register_sign("steel", S("Steel Sign"), {
groups = {cracky = 2, attached_node = 1}
})

local place_ladder = function(itemstack, placer, pointed_thing)
local under = minetest.get_node(pointed_thing.under)
local sneaking = placer and placer:get_player_control().sneak
if sneaking and under and under.name:find("^default:ladder_") then
return minetest.item_place(itemstack, placer, pointed_thing, under.param2)
else
return minetest.item_place(itemstack, placer, pointed_thing)
end
end

minetest.register_node("default:ladder_wood", {
description = S("Wooden Ladder"),
drawtype = "signlike",
Expand All @@ -2639,6 +2649,7 @@ minetest.register_node("default:ladder_wood", {
--wall_bottom = = <default>
--wall_side = = <default>
},
on_place = place_ladder,
groups = {choppy = 2, oddly_breakable_by_hand = 3, flammable = 2},
legacy_wallmounted = true,
sounds = default.node_sound_wood_defaults(),
Expand All @@ -2662,6 +2673,7 @@ minetest.register_node("default:ladder_steel", {
--wall_bottom = = <default>
--wall_side = = <default>
},
on_place = place_ladder,
groups = {cracky = 2},
sounds = default.node_sound_metal_defaults(),
})
Expand Down