From 79547ede2608c009dc132bb69c1c636d204e0f2e Mon Sep 17 00:00:00 2001 From: Niklp Date: Thu, 18 Jul 2024 18:15:58 +0200 Subject: [PATCH] Disallow rotation of various doors (#36) Rotating them would result in a strange-looking state. --- .luacheckrc | 1 + my_future_doors/framed.lua | 5 ++++- my_future_doors/mod.conf | 2 +- my_future_doors/sliding.lua | 4 ++++ my_garage_door/init.lua | 6 ++++-- my_misc_doors/bars.lua | 4 ++++ my_misc_doors/mod.conf | 2 +- my_saloon_doors/init.lua | 2 ++ my_saloon_doors/mod.conf | 2 +- my_sliding_doors/jdoors1.lua | 8 ++++++++ my_sliding_doors/jdoors2.lua | 4 ++++ my_sliding_doors/mod.conf | 2 +- 12 files changed, 35 insertions(+), 7 deletions(-) diff --git a/.luacheckrc b/.luacheckrc index e686189..eaec4b8 100644 --- a/.luacheckrc +++ b/.luacheckrc @@ -6,6 +6,7 @@ read_globals = { "vector", "default", "doors", + "screwdriver", "stairs", "stairsplus", "mesecon", diff --git a/my_future_doors/framed.lua b/my_future_doors/framed.lua index eded89f..bfda778 100644 --- a/my_future_doors/framed.lua +++ b/my_future_doors/framed.lua @@ -36,7 +36,7 @@ local function add_door(col) {-0.625, 1.4375,-0.5625, 0.625, 1.625, 0.5625}, --top } }, - + on_rotate = screwdriver.disallow, on_place = function(itemstack, placer, pointed_thing) local pos1 = pointed_thing.above local pos2 = vector.add(pos1, {x=0,y=1,z=0}) @@ -112,6 +112,7 @@ local function add_door(col) {-0.5, -0.5, -0.5, -0.5, -0.5, -0.5}, } }, + on_rotate = screwdriver.disallow, }) minetest.register_node("my_future_doors:door1c_"..col, { tiles = { @@ -146,6 +147,7 @@ local function add_door(col) } }, drop = "my_future_doors:door1a_"..col, + on_rotate = screwdriver.disallow, after_place_node = function(pos, placer, itemstack, pointed_thing) local node = minetest.get_node(pos) local timer = minetest.get_node_timer(pos) @@ -194,6 +196,7 @@ local function add_door(col) {-0.5, -0.5, -0.5, -0.5, -0.5, -0.5}, } }, + on_rotate = screwdriver.disallow, }) minetest.register_craft({ output = "my_future_doors:door1a_"..col.." 1", diff --git a/my_future_doors/mod.conf b/my_future_doors/mod.conf index 6662068..43efe47 100644 --- a/my_future_doors/mod.conf +++ b/my_future_doors/mod.conf @@ -1,3 +1,3 @@ name = my_future_doors description = Futuristic style doors. -depends = my_door_wood \ No newline at end of file +depends = my_door_wood, screwdriver \ No newline at end of file diff --git a/my_future_doors/sliding.lua b/my_future_doors/sliding.lua index e21095a..8dd9084 100644 --- a/my_future_doors/sliding.lua +++ b/my_future_doors/sliding.lua @@ -147,6 +147,7 @@ local function add_door(doora, doorb, doorc, doord, num, des, recipe) {-0.5, -0.5, -0.0625, 0.5, 1.5, 0.0625} } }, + on_rotate = screwdriver.disallow, on_place = onplace, @@ -179,6 +180,7 @@ local function add_door(doora, doorb, doorc, doord, num, des, recipe) {0, 0, 0, 0, 0, 0}, } }, + on_rotate = screwdriver.disallow, }) minetest.register_node(doorc, { tiles = { @@ -209,6 +211,7 @@ local function add_door(doora, doorb, doorc, doord, num, des, recipe) after_place_node = afterplace, after_destruct = afterdestruct, on_timer = ontimer, + on_rotate = screwdriver.disallow, }) minetest.register_node(doord, { tiles = { @@ -235,6 +238,7 @@ local function add_door(doora, doorb, doorc, doord, num, des, recipe) {0, 0, 0, 0, 0, 0}, } }, + on_rotate = screwdriver.disallow, }) minetest.register_craft({ output = "my_future_doors:door"..num.."a 2", diff --git a/my_garage_door/init.lua b/my_garage_door/init.lua index 014bb7e..fa7320c 100644 --- a/my_garage_door/init.lua +++ b/my_garage_door/init.lua @@ -31,6 +31,7 @@ minetest.register_node("my_garage_door:garage_door", { {-1.5, -0.5, -0.1875, 1.5, 1.5, -0.0625}, } }, + on_rotate = screwdriver.disallow, on_place = function(itemstack, placer, pointed_thing) local pos1 = pointed_thing.above local pos2 = vector.add(pos1, {x=0,y=1,z=0}) @@ -124,6 +125,7 @@ minetest.register_node("my_garage_door:garage_door_top", { } }, selection_box = {type = "fixed",fixed = {{0, 0, 0, 0, 0, 0},}}, + on_rotate = screwdriver.disallow, }) minetest.register_node("my_garage_door:garage_door_open", { tiles = { @@ -146,7 +148,7 @@ minetest.register_node("my_garage_door:garage_door_open", { } }, selection_box = {type = "fixed",fixed = {{-1.5, 0.375, -0.5, 1.5, 0.5, 1.5},}}, - + on_rotate = screwdriver.disallow, on_rightclick = function(pos, node, player, itemstack, pointed_thing) local p2 = node.param2 local dir = minetest.facedir_to_dir((p2+2)%4) @@ -204,7 +206,7 @@ minetest.register_node("my_garage_door:garage_door_open2", { } }, selection_box = {type = "fixed",fixed = {{0, 0, 0, 0, 0, 0},}}, - + on_rotate = screwdriver.disallow, }) -- craft diff --git a/my_misc_doors/bars.lua b/my_misc_doors/bars.lua index 9f97aeb..49158fc 100644 --- a/my_misc_doors/bars.lua +++ b/my_misc_doors/bars.lua @@ -29,6 +29,7 @@ minetest.register_node("my_misc_doors:door2a", { {-0.4375, -0.5, -0.0625, 0.4375, 1.5, 0.0625}, } }, + on_rotate = screwdriver.disallow, on_place = function(itemstack, placer, pointed_thing) local pos1 = pointed_thing.above @@ -117,6 +118,7 @@ minetest.register_node("my_misc_doors:door2b", { {0, 0, 0, 0, 0, 0}, } }, + on_rotate = screwdriver.disallow, }) minetest.register_node("my_misc_doors:door2c", { tiles = { @@ -148,6 +150,7 @@ minetest.register_node("my_misc_doors:door2c", { } }, drop = "my_misc_doors:door2a", + on_rotate = screwdriver.disallow, after_place_node = function(pos, placer, itemstack, pointed_thing) local node = minetest.get_node(pos) local timer = minetest.get_node_timer(pos) @@ -203,6 +206,7 @@ minetest.register_node("my_misc_doors:door2d", { {0, 0, 0, 0, 0, 0}, } }, + on_rotate = screwdriver.disallow, }) minetest.register_craft({ output = "my_misc_doors:door2a 1", diff --git a/my_misc_doors/mod.conf b/my_misc_doors/mod.conf index 815c156..e3913ea 100644 --- a/my_misc_doors/mod.conf +++ b/my_misc_doors/mod.conf @@ -1,3 +1,3 @@ name = my_misc_doors description = Some misc. doors. -depends = default, my_door_wood, doors, wool \ No newline at end of file +depends = default, my_door_wood, doors, wool, screwdriver \ No newline at end of file diff --git a/my_saloon_doors/init.lua b/my_saloon_doors/init.lua index e98d678..50dada3 100644 --- a/my_saloon_doors/init.lua +++ b/my_saloon_doors/init.lua @@ -37,6 +37,7 @@ local function add_door(col, des, tint, craft) {-0.5, -0.1875, -0.0625, 0.5, 1, 0.0625}, } }, + on_rotate = screwdriver.rotate_simple, on_place = function(itemstack, placer, pointed_thing) local pos1 = pointed_thing.above @@ -106,6 +107,7 @@ local function add_door(col, des, tint, craft) {0, 0, 0, 0, 0, 0}, } }, + on_rotate = screwdriver.rotate_simple, on_timer = function(pos, elapsed) local node = minetest.get_node(pos) minetest.set_node(pos, {name="my_saloon_doors:door1a_"..col, param2=node.param2}) diff --git a/my_saloon_doors/mod.conf b/my_saloon_doors/mod.conf index 7c87cad..8b1d33b 100644 --- a/my_saloon_doors/mod.conf +++ b/my_saloon_doors/mod.conf @@ -1,3 +1,3 @@ name = my_saloon_doors description = Saloon style doors. -depends = default, my_door_wood, doors \ No newline at end of file +depends = default, my_door_wood, doors, screwdriver \ No newline at end of file diff --git a/my_sliding_doors/jdoors1.lua b/my_sliding_doors/jdoors1.lua index 30ee4d8..89fda03 100644 --- a/my_sliding_doors/jdoors1.lua +++ b/my_sliding_doors/jdoors1.lua @@ -130,6 +130,7 @@ local function add_door(doora, doorb, doorc, doord, num, des) {-0.5, -0.5, 0.0625, 0.5, 1.5, 0.1875} } }, + on_rotate = screwdriver.disallow, on_place = onplace, @@ -173,6 +174,7 @@ local function add_door(doora, doorb, doorc, doord, num, des) {0, 0, 0, 0, 0, 0}, } }, + on_rotate = screwdriver.disallow, }) minetest.register_node(doorc, { tiles = { @@ -211,6 +213,7 @@ local function add_door(doora, doorb, doorc, doord, num, des) {-1.5, -0.5, -0.0625, -0.5, 1.5, 0.1875} } }, + on_rotate = screwdriver.disallow, after_place_node = afterplace, after_destruct = afterdestruct, on_rightclick = rightclick, @@ -251,6 +254,7 @@ local function add_door(doora, doorb, doorc, doord, num, des) {0, 0, 0, 0, 0, 0}, } }, + on_rotate = screwdriver.disallow, }) minetest.register_node("my_sliding_doors:jpanel"..num, { description = des.." Panel", @@ -280,6 +284,7 @@ local function add_door(doora, doorb, doorc, doord, num, des) }, selection_box = {type = "fixed", fixed = {{-0.5, -0.5, -0.0625, 0.5, 1.5, 0.0625}}}, collision_box = {type = "fixed", fixed = {{-0.5, -0.5, -0.0625, 0.5, 1.5, 0.0625}}}, + on_rotate = screwdriver.disallow, on_place = function(itemstack, placer, pointed_thing) local p2 = minetest.dir_to_facedir(placer:get_look_dir()) @@ -353,6 +358,7 @@ local function add_door(doora, doorb, doorc, doord, num, des) {0, 0, 0, 0, 0, 0} } }, + on_rotate = screwdriver.disallow, }) minetest.register_node("my_sliding_doors:jpanel_corner_"..num, { description = des.." Panel Corner", @@ -389,6 +395,7 @@ local function add_door(doora, doorb, doorc, doord, num, des) {-0.5, -0.5, -0.0625, 0, 1.5, 0.0625}, } }, + on_rotate = screwdriver.disallow, on_place = function(itemstack, placer, pointed_thing) local p2 = minetest.dir_to_facedir(placer:get_look_dir()) local pos = pointed_thing.above @@ -463,6 +470,7 @@ local function add_door(doora, doorb, doorc, doord, num, des) {0, 0, 0, 0, 0, 0} } }, + on_rotate = screwdriver.disallow, }) end diff --git a/my_sliding_doors/jdoors2.lua b/my_sliding_doors/jdoors2.lua index fdbf43e..bdc1dc8 100644 --- a/my_sliding_doors/jdoors2.lua +++ b/my_sliding_doors/jdoors2.lua @@ -133,6 +133,7 @@ local function add_door(doora, doorb, doorc, doord, num) {-0.5, -0.5, -0.0625, 0.5, 1.5, -0.1875} } }, + on_rotate = screwdriver.disallow, on_place = onplace, @@ -176,6 +177,7 @@ local function add_door(doora, doorb, doorc, doord, num) {0, 0, 0, 0, 0, 0}, } }, + on_rotate = screwdriver.disallow, }) minetest.register_node(doorc.."2", { tiles = { @@ -214,6 +216,7 @@ local function add_door(doora, doorb, doorc, doord, num) {-1.5, -0.5, 0.0625, -0.5, 1.5, -0.1875} } }, + on_rotate = screwdriver.disallow, after_place_node = afterplace, after_destruct = afterdestruct, on_rightclick = rightclick, @@ -254,6 +257,7 @@ local function add_door(doora, doorb, doorc, doord, num) {0, 0, 0, 0, 0, 0}, } }, + on_rotate = screwdriver.disallow, }) end diff --git a/my_sliding_doors/mod.conf b/my_sliding_doors/mod.conf index 3e57432..e1c037b 100644 --- a/my_sliding_doors/mod.conf +++ b/my_sliding_doors/mod.conf @@ -1,3 +1,3 @@ name = my_sliding_doors description = Shoji sliding doors and panels. -depends = default, flowers \ No newline at end of file +depends = default, flowers, screwdriver \ No newline at end of file