Add place_rotated mod support (#208)

Co-authored-by: Evgeniy <evgenuel@gmail.com>
This commit is contained in:
z-op 2025-04-17 15:38:56 +03:00 committed by GitHub
parent 768225a990
commit 7f02b444dc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 8 additions and 3 deletions

View File

@ -31,4 +31,5 @@ read_globals = {
"HasOwner", "HasOwner",
"getLastOwner", "getLastOwner",
"GetNodeOwnerName", "GetNodeOwnerName",
"place_rotated",
} }

View File

@ -1,4 +1,4 @@
name = moreblocks name = moreblocks
description = Adds various miscellaneous blocks to the game. 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 min_minetest_version = 5.0.0

View File

@ -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 -- 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.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) def.groups = stairsplus:prepare_groups(fields.groups)
if category == "slab" then 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 if type(info) ~= "table" then
def.node_box = { def.node_box = {
type = "fixed", 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) def.description = desc_base .. alternate:gsub("_", " "):gsub("(%a)(%S*)", function(a, b) return a:upper() .. b end)
end end
else else
def.on_place = stairsplus.rotate_node_aux
def.description = desc_base def.description = desc_base
if category == "slope" then if category == "slope" then
def.drawtype = "mesh" def.drawtype = "mesh"