From fe60a07e7628b133c0b49e86a080f7ab76ce889f Mon Sep 17 00:00:00 2001 From: jp Date: Sun, 15 Nov 2015 20:35:20 +0100 Subject: [PATCH] Prevent some rotations on some nodes when using the screwdriver --- chess.lua | 2 ++ enchanting.lua | 2 ++ mailbox.lua | 2 ++ nodes.lua | 16 ++++++++++++++-- textures/xdecor_ivy.png | Bin 188 -> 192 bytes worktable.lua | 2 ++ xwall.lua | 2 ++ 7 files changed, 24 insertions(+), 2 deletions(-) diff --git a/chess.lua b/chess.lua index d454a98..71b6b7c 100644 --- a/chess.lua +++ b/chess.lua @@ -1,6 +1,7 @@ -- See https://github.com/kilbith/realchess for the main repository local realchess = {} +screwdriver = screwdriver or {} local function index_to_xy(index) index = index - 1 @@ -599,6 +600,7 @@ minetest.register_node(":realchess:chessboard", { sounds = default.node_sound_wood_defaults(), node_box = {type = "fixed", fixed = {-0.5, -0.5, -0.5, 0.5, -0.4375, 0.5}}, sunlight_propagates = true, + on_rotate = screwdriver.rotate_simple, can_dig = realchess.dig, on_construct = realchess.init, on_receive_fields = realchess.fields, diff --git a/enchanting.lua b/enchanting.lua index a900f09..ee52457 100644 --- a/enchanting.lua +++ b/enchanting.lua @@ -1,4 +1,5 @@ local enchanting = {} +screwdriver = screwdriver or {} function enchanting.tools_fs() return "size[9,8;]"..default.gui_slots.. @@ -94,6 +95,7 @@ xdecor.register("enchantment_table", { }, groups = {cracky=1}, sounds = default.node_sound_stone_defaults(), + on_rotate = screwdriver.rotate_simple, can_dig = enchanting.dig, on_construct = enchanting.default_fs, on_receive_fields = enchanting.fields, diff --git a/mailbox.lua b/mailbox.lua index b437585..5cc216c 100644 --- a/mailbox.lua +++ b/mailbox.lua @@ -1,4 +1,5 @@ local mailbox = {} +screwdriver = screwdriver or {} local xbg = default.gui_bg..default.gui_bg_img..default.gui_slots xdecor.register("mailbox", { @@ -9,6 +10,7 @@ xdecor.register("mailbox", { "xdecor_mailbox.png", "xdecor_mailbox.png", }, groups = {cracky=3}, + on_rotate = screwdriver.rotate_simple, after_place_node = function(pos, placer, _) local meta = minetest.get_meta(pos) local owner = placer:get_player_name() diff --git a/nodes.lua b/nodes.lua index a3f38d2..d3c6d04 100644 --- a/nodes.lua +++ b/nodes.lua @@ -1,3 +1,5 @@ +screwdriver = screwdriver or {} + local function sit(pos, node, clicker) local meta = minetest.get_meta(pos) local player = clicker:get_player_name() @@ -67,7 +69,8 @@ xdecor.register("barrel", { infotext = "Barrel", tiles = {"xdecor_barrel_top.png", "xdecor_barrel_sides.png"}, groups = {choppy=3, flammable=3}, - sounds = default.node_sound_wood_defaults() + sounds = default.node_sound_wood_defaults(), + on_rotate = screwdriver.rotate_simple }) xdecor.register("cabinet", { @@ -76,6 +79,7 @@ xdecor.register("cabinet", { infotext = "Wood Cabinet", groups = {choppy=3, flammable=3}, sounds = default.node_sound_wood_defaults(), + on_rotate = screwdriver.rotate_simple, tiles = { "xdecor_cabinet_sides.png", "xdecor_cabinet_sides.png", "xdecor_cabinet_sides.png", "xdecor_cabinet_sides.png", @@ -126,6 +130,7 @@ xdecor.register("candle", { xdecor.register("cauldron", { description = "Cauldron", groups = {cracky=2}, + on_rotate = screwdriver.rotate_simple, tiles = { { name = "xdecor_cauldron_top_anim.png", animation = {type="vertical_frames", length=3.0} }, @@ -175,6 +180,7 @@ xdecor.register("chair", { tiles = {"xdecor_wood.png"}, sounds = default.node_sound_wood_defaults(), groups = {choppy=3, flammable=3}, + on_rotate = screwdriver.rotate_simple, node_box = { type = "fixed", fixed = {{-0.3125, -0.5, 0.1875, -0.1875, 0.5, 0.3125}, @@ -326,7 +332,8 @@ xdecor.register("empty_shelf", { infotext = "Empty Shelf", tiles = {"default_wood.png", "default_wood.png^xdecor_empty_shelf.png"}, groups = {choppy=3, flammable=3}, - sounds = default.node_sound_wood_defaults() + sounds = default.node_sound_wood_defaults(), + on_rotate = screwdriver.rotate_simple }) xdecor.register("enderchest", { @@ -338,6 +345,7 @@ xdecor.register("enderchest", { }, groups = {cracky=2}, sounds = default.node_sound_stone_defaults(), + on_rotate = screwdriver.rotate_simple, on_construct = function(pos) local meta = minetest.get_meta(pos) local xbg = default.gui_bg..default.gui_bg_img..default.gui_slots @@ -482,6 +490,7 @@ xdecor.register("painting", { paramtype2 = "wallmounted", legacy_wallmounted = true, walkable = false, + on_rotate = screwdriver.rotate_simple, wield_image = "xdecor_painting.png", selection_box = {type="wallmounted"}, groups = {dig_immediate=3, flammable=3, attached_node=1} @@ -508,6 +517,7 @@ xdecor.register("multishelf", { description = "Multi Shelf", inventory = {size=24}, infotext = "Multi Shelf", + on_rotate = screwdriver.rotate_simple, tiles = {"default_wood.png", "default_wood.png^xdecor_multishelf.png"}, groups = {choppy=3, flammable=3}, sounds = default.node_sound_wood_defaults() @@ -533,6 +543,7 @@ xdecor.register("stonepath", { description = "Garden Stone Path", tiles = {"default_stone.png"}, groups = {snappy=3}, + on_rotate = screwdriver.rotate_simple, sounds = default.node_sound_stone_defaults(), sunlight_propagates = true, node_box = { @@ -585,6 +596,7 @@ xdecor.register("tv", { description = "Television", light_source = 11, groups = {snappy=3}, + on_rotate = screwdriver.rotate_simple, tiles = { "xdecor_television_left.png^[transformR270", "xdecor_television_left.png^[transformR90", diff --git a/textures/xdecor_ivy.png b/textures/xdecor_ivy.png index dce627b2986394ad9ee71071e3df943acaf27048..d540e1839b57d439a034d38c563590f19cff7b87 100644 GIT binary patch delta 111 zcmdnPcz|(&ijhQsPlzi61A}{`gI%VDdAwo5{0QF;H&su?kcmDkj?GjB$}yG%`2{mL zJiCzwK1ujfeIpk-j$aE8;wtl>paLP*0Z&$dfCY&uFj4DaT$oe1K$oCQ?O;OXk; Jvd$@?2>_aPAq@Zk diff --git a/worktable.lua b/worktable.lua index 8d844db..daa1c0c 100644 --- a/worktable.lua +++ b/worktable.lua @@ -1,4 +1,5 @@ local worktable = {} +screwdriver = screwdriver or {} local xbg = default.gui_bg..default.gui_bg_img..default.gui_slots local nodes = { -- Nodes allowed to be cut. Mod name = {node name}. @@ -171,6 +172,7 @@ xdecor.register("worktable", { "xdecor_worktable_sides.png", "xdecor_worktable_sides.png", "xdecor_worktable_front.png", "xdecor_worktable_front.png" }, + on_rotate = screwdriver.rotate_simple, can_dig = worktable.dig, on_construct = worktable.construct, on_receive_fields = worktable.fields, diff --git a/xwall.lua b/xwall.lua index 3cc5932..5495774 100644 --- a/xwall.lua +++ b/xwall.lua @@ -3,6 +3,7 @@ -- Optimized by kilbith local xwall = {} +screwdriver = screwdriver or {} xwall.get_candidate = {} local profiles = { @@ -152,6 +153,7 @@ function xwall.register_wall(name, tiles, def) sounds = default.node_sound_stone_defaults(), groups = {cracky=3, stone=1, pane=1}, sunlight_propagates = true, + on_rotate = screwdriver.disallow, collision_box = { type = "fixed", fixed = {-.5, -.5, -.25, .5, 1, .25}