From fb10320550f2a4014f5f1e5aeae48df29d60bb54 Mon Sep 17 00:00:00 2001 From: Michieal Date: Thu, 3 Nov 2022 05:29:46 +0000 Subject: [PATCH] Quickfix: changed standing sign rotate replacement node. Replaced the standing sign (90 degrees) starting replacement node for on_rotate(). Tested on all signs, testing all degrees of rotation (all 16 of them). fixes newly found bug: non-oak standing sign becomes oak standing sign when initially rotated with a screwdriver. --- mods/ITEMS/mcl_signs/signs_api.lua | 44 ++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/mods/ITEMS/mcl_signs/signs_api.lua b/mods/ITEMS/mcl_signs/signs_api.lua index b189caa01..9d88b8ed1 100644 --- a/mods/ITEMS/mcl_signs/signs_api.lua +++ b/mods/ITEMS/mcl_signs/signs_api.lua @@ -70,6 +70,8 @@ end local pi = 3.1415926 -- enough accuracy, to build an engine for a car. +local math = math + -- locally cached copy of the official colors; this way, it updates as mcl_colors updates. local mcl_colors_official = mcl_colors if DEBUG then @@ -662,6 +664,18 @@ function mcl_signs.register_sign (modname, color, _name, ttsign) new_sign_standing.wield_image = "(default_sign.png^[multiply:" .. color .. ")" new_sign_standing.tiles = { "(mcl_signs_sign.png^[multiply:" .. color .. ")" } new_sign_standing.inventory_image = "(default_sign.png^[multiply:" .. color .. ")" + + new_sign_standing.on_rotate = function(pos, node, user, mode) + if mode == screwdriver.ROTATE_FACE then + node.name = "mcl_signs:standing_sign22_5" .. _name + minetest.swap_node(pos, node) + elseif mode == screwdriver.ROTATE_AXIS then + return false + end + mcl_signs:update_sign(pos, nil, nil, true) + return true + end, + minetest.register_node("mcl_signs:standing_sign" .. _name, new_sign_standing) update_sign_registry("standing", "mcl_signs:standing_sign" .. _name) -- debug step @@ -879,6 +893,16 @@ function mcl_signs.register_sign_custom (modname, _name, tiles, color, inventory new_sign_standing.wield_image ="("..wield_image.."^[multiply:" .. color .. ")" new_sign_standing.tiles = { "("..tiles.."^[multiply:" .. color .. ")" } new_sign_standing.inventory_image = "("..inventory_image.."^[multiply:" .. color .. ")" + new_sign_standing.on_rotate = function(pos, node, user, mode) + if mode == screwdriver.ROTATE_FACE then + node.name = "mcl_signs:standing_sign22_5" .. _name + minetest.swap_node(pos, node) + elseif mode == screwdriver.ROTATE_AXIS then + return false + end + mcl_signs:update_sign(pos, nil, nil, true) + return true + end, minetest.register_node("mcl_signs:standing_sign" .. _name, new_sign_standing) update_sign_registry("standing", "mcl_signs:standing_sign" .. _name) @@ -1098,6 +1122,16 @@ function mcl_signs.reregister_sign (modname, color, _name, ttsign) new_sign_standing.wield_image = "(default_sign.png^[multiply:" .. color .. ")" new_sign_standing.tiles = { "(mcl_signs_sign.png^[multiply:" .. color .. ")" } new_sign_standing.inventory_image = "(default_sign.png^[multiply:" .. color .. ")" + new_sign_standing.on_rotate = function(pos, node, user, mode) + if mode == screwdriver.ROTATE_FACE then + node.name = "mcl_signs:standing_sign22_5" .. _name + minetest.swap_node(pos, node) + elseif mode == screwdriver.ROTATE_AXIS then + return false + end + mcl_signs:update_sign(pos, nil, nil, true) + return true + end, minetest.override_item("mcl_signs:standing_sign" .. _name, new_sign_standing) update_sign_registry("standing", "mcl_signs:standing_sign" .. _name) -- debug step @@ -1315,6 +1349,16 @@ function mcl_signs.reregister_sign_custom (modname, _name, tiles, color, invento new_sign_standing.wield_image ="("..wield_image.."^[multiply:" .. color .. ")" new_sign_standing.tiles = { "("..tiles.."^[multiply:" .. color .. ")" } new_sign_standing.inventory_image = "("..inventory_image.."^[multiply:" .. color .. ")" + new_sign_standing.on_rotate = function(pos, node, user, mode) + if mode == screwdriver.ROTATE_FACE then + node.name = "mcl_signs:standing_sign22_5" .. _name + minetest.swap_node(pos, node) + elseif mode == screwdriver.ROTATE_AXIS then + return false + end + mcl_signs:update_sign(pos, nil, nil, true) + return true + end, minetest.override_item("mcl_signs:standing_sign" .. _name, new_sign_standing) update_sign_registry("standing", "mcl_signs:standing_sign" .. _name)