From 7f02b444dca689d2f6e98236dffa2d8b0271d10f Mon Sep 17 00:00:00 2001 From: z-op Date: Thu, 17 Apr 2025 15:38:56 +0300 Subject: [PATCH] Add place_rotated mod support (#208) Co-authored-by: Evgeniy --- .luacheckrc | 1 + mod.conf | 2 +- stairsplus/common.lua | 8 ++++++-- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/.luacheckrc b/.luacheckrc index 78ebf0b..a2f0a79 100644 --- a/.luacheckrc +++ b/.luacheckrc @@ -31,4 +31,5 @@ read_globals = { "HasOwner", "getLastOwner", "GetNodeOwnerName", + "place_rotated", } diff --git a/mod.conf b/mod.conf index b155297..c9dd836 100644 --- a/mod.conf +++ b/mod.conf @@ -1,4 +1,4 @@ name = moreblocks description = Adds various miscellaneous blocks to the game. -optional_depends = default,stairs,farming,wool,basic_materials +optional_depends = default,stairs,farming,wool,basic_materials,place_rotated min_minetest_version = 5.0.0 diff --git a/stairsplus/common.lua b/stairsplus/common.lua index 26d4031..18f6ecb 100644 --- a/stairsplus/common.lua +++ b/stairsplus/common.lua @@ -146,11 +146,14 @@ stairsplus.register_single = function(category, alternate, info, modname, subnam -- Darken light sources slightly to make up for their smaller visual size def.light_source = math.max(0, (def.light_source or 0) - 1) - - def.on_place = stairsplus.rotate_node_aux def.groups = stairsplus:prepare_groups(fields.groups) if category == "slab" then + if minetest.global_exists("place_rotated") then + def.on_place = place_rotated.slab + else + def.on_place = stairsplus.rotate_node_aux + end if type(info) ~= "table" then def.node_box = { type = "fixed", @@ -165,6 +168,7 @@ stairsplus.register_single = function(category, alternate, info, modname, subnam def.description = desc_base .. alternate:gsub("_", " "):gsub("(%a)(%S*)", function(a, b) return a:upper() .. b end) end else + def.on_place = stairsplus.rotate_node_aux def.description = desc_base if category == "slope" then def.drawtype = "mesh"