Prevent some rotations on some nodes when using the screwdriver

This commit is contained in:
jp 2015-11-15 20:35:20 +01:00
parent bfc4be1eea
commit fe60a07e76
7 changed files with 24 additions and 2 deletions

View File

@ -1,6 +1,7 @@
-- See https://github.com/kilbith/realchess for the main repository -- See https://github.com/kilbith/realchess for the main repository
local realchess = {} local realchess = {}
screwdriver = screwdriver or {}
local function index_to_xy(index) local function index_to_xy(index)
index = index - 1 index = index - 1
@ -599,6 +600,7 @@ minetest.register_node(":realchess:chessboard", {
sounds = default.node_sound_wood_defaults(), sounds = default.node_sound_wood_defaults(),
node_box = {type = "fixed", fixed = {-0.5, -0.5, -0.5, 0.5, -0.4375, 0.5}}, node_box = {type = "fixed", fixed = {-0.5, -0.5, -0.5, 0.5, -0.4375, 0.5}},
sunlight_propagates = true, sunlight_propagates = true,
on_rotate = screwdriver.rotate_simple,
can_dig = realchess.dig, can_dig = realchess.dig,
on_construct = realchess.init, on_construct = realchess.init,
on_receive_fields = realchess.fields, on_receive_fields = realchess.fields,

View File

@ -1,4 +1,5 @@
local enchanting = {} local enchanting = {}
screwdriver = screwdriver or {}
function enchanting.tools_fs() function enchanting.tools_fs()
return "size[9,8;]"..default.gui_slots.. return "size[9,8;]"..default.gui_slots..
@ -94,6 +95,7 @@ xdecor.register("enchantment_table", {
}, },
groups = {cracky=1}, groups = {cracky=1},
sounds = default.node_sound_stone_defaults(), sounds = default.node_sound_stone_defaults(),
on_rotate = screwdriver.rotate_simple,
can_dig = enchanting.dig, can_dig = enchanting.dig,
on_construct = enchanting.default_fs, on_construct = enchanting.default_fs,
on_receive_fields = enchanting.fields, on_receive_fields = enchanting.fields,

View File

@ -1,4 +1,5 @@
local mailbox = {} local mailbox = {}
screwdriver = screwdriver or {}
local xbg = default.gui_bg..default.gui_bg_img..default.gui_slots local xbg = default.gui_bg..default.gui_bg_img..default.gui_slots
xdecor.register("mailbox", { xdecor.register("mailbox", {
@ -9,6 +10,7 @@ xdecor.register("mailbox", {
"xdecor_mailbox.png", "xdecor_mailbox.png", "xdecor_mailbox.png", "xdecor_mailbox.png",
}, },
groups = {cracky=3}, groups = {cracky=3},
on_rotate = screwdriver.rotate_simple,
after_place_node = function(pos, placer, _) after_place_node = function(pos, placer, _)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
local owner = placer:get_player_name() local owner = placer:get_player_name()

View File

@ -1,3 +1,5 @@
screwdriver = screwdriver or {}
local function sit(pos, node, clicker) local function sit(pos, node, clicker)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
local player = clicker:get_player_name() local player = clicker:get_player_name()
@ -67,7 +69,8 @@ xdecor.register("barrel", {
infotext = "Barrel", infotext = "Barrel",
tiles = {"xdecor_barrel_top.png", "xdecor_barrel_sides.png"}, tiles = {"xdecor_barrel_top.png", "xdecor_barrel_sides.png"},
groups = {choppy=3, flammable=3}, 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", { xdecor.register("cabinet", {
@ -76,6 +79,7 @@ xdecor.register("cabinet", {
infotext = "Wood Cabinet", infotext = "Wood Cabinet",
groups = {choppy=3, flammable=3}, groups = {choppy=3, flammable=3},
sounds = default.node_sound_wood_defaults(), sounds = default.node_sound_wood_defaults(),
on_rotate = screwdriver.rotate_simple,
tiles = { tiles = {
"xdecor_cabinet_sides.png", "xdecor_cabinet_sides.png", "xdecor_cabinet_sides.png", "xdecor_cabinet_sides.png",
"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", { xdecor.register("cauldron", {
description = "Cauldron", description = "Cauldron",
groups = {cracky=2}, groups = {cracky=2},
on_rotate = screwdriver.rotate_simple,
tiles = { tiles = {
{ name = "xdecor_cauldron_top_anim.png", { name = "xdecor_cauldron_top_anim.png",
animation = {type="vertical_frames", length=3.0} }, animation = {type="vertical_frames", length=3.0} },
@ -175,6 +180,7 @@ xdecor.register("chair", {
tiles = {"xdecor_wood.png"}, tiles = {"xdecor_wood.png"},
sounds = default.node_sound_wood_defaults(), sounds = default.node_sound_wood_defaults(),
groups = {choppy=3, flammable=3}, groups = {choppy=3, flammable=3},
on_rotate = screwdriver.rotate_simple,
node_box = { node_box = {
type = "fixed", type = "fixed",
fixed = {{-0.3125, -0.5, 0.1875, -0.1875, 0.5, 0.3125}, fixed = {{-0.3125, -0.5, 0.1875, -0.1875, 0.5, 0.3125},
@ -326,7 +332,8 @@ xdecor.register("empty_shelf", {
infotext = "Empty Shelf", infotext = "Empty Shelf",
tiles = {"default_wood.png", "default_wood.png^xdecor_empty_shelf.png"}, tiles = {"default_wood.png", "default_wood.png^xdecor_empty_shelf.png"},
groups = {choppy=3, flammable=3}, 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", { xdecor.register("enderchest", {
@ -338,6 +345,7 @@ xdecor.register("enderchest", {
}, },
groups = {cracky=2}, groups = {cracky=2},
sounds = default.node_sound_stone_defaults(), sounds = default.node_sound_stone_defaults(),
on_rotate = screwdriver.rotate_simple,
on_construct = function(pos) on_construct = function(pos)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
local xbg = default.gui_bg..default.gui_bg_img..default.gui_slots local xbg = default.gui_bg..default.gui_bg_img..default.gui_slots
@ -482,6 +490,7 @@ xdecor.register("painting", {
paramtype2 = "wallmounted", paramtype2 = "wallmounted",
legacy_wallmounted = true, legacy_wallmounted = true,
walkable = false, walkable = false,
on_rotate = screwdriver.rotate_simple,
wield_image = "xdecor_painting.png", wield_image = "xdecor_painting.png",
selection_box = {type="wallmounted"}, selection_box = {type="wallmounted"},
groups = {dig_immediate=3, flammable=3, attached_node=1} groups = {dig_immediate=3, flammable=3, attached_node=1}
@ -508,6 +517,7 @@ xdecor.register("multishelf", {
description = "Multi Shelf", description = "Multi Shelf",
inventory = {size=24}, inventory = {size=24},
infotext = "Multi Shelf", infotext = "Multi Shelf",
on_rotate = screwdriver.rotate_simple,
tiles = {"default_wood.png", "default_wood.png^xdecor_multishelf.png"}, tiles = {"default_wood.png", "default_wood.png^xdecor_multishelf.png"},
groups = {choppy=3, flammable=3}, groups = {choppy=3, flammable=3},
sounds = default.node_sound_wood_defaults() sounds = default.node_sound_wood_defaults()
@ -533,6 +543,7 @@ xdecor.register("stonepath", {
description = "Garden Stone Path", description = "Garden Stone Path",
tiles = {"default_stone.png"}, tiles = {"default_stone.png"},
groups = {snappy=3}, groups = {snappy=3},
on_rotate = screwdriver.rotate_simple,
sounds = default.node_sound_stone_defaults(), sounds = default.node_sound_stone_defaults(),
sunlight_propagates = true, sunlight_propagates = true,
node_box = { node_box = {
@ -585,6 +596,7 @@ xdecor.register("tv", {
description = "Television", description = "Television",
light_source = 11, light_source = 11,
groups = {snappy=3}, groups = {snappy=3},
on_rotate = screwdriver.rotate_simple,
tiles = { tiles = {
"xdecor_television_left.png^[transformR270", "xdecor_television_left.png^[transformR270",
"xdecor_television_left.png^[transformR90", "xdecor_television_left.png^[transformR90",

Binary file not shown.

Before

Width:  |  Height:  |  Size: 188 B

After

Width:  |  Height:  |  Size: 192 B

View File

@ -1,4 +1,5 @@
local worktable = {} local worktable = {}
screwdriver = screwdriver or {}
local xbg = default.gui_bg..default.gui_bg_img..default.gui_slots local xbg = default.gui_bg..default.gui_bg_img..default.gui_slots
local nodes = { -- Nodes allowed to be cut. Mod name = {node name}. 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_sides.png", "xdecor_worktable_sides.png",
"xdecor_worktable_front.png", "xdecor_worktable_front.png" "xdecor_worktable_front.png", "xdecor_worktable_front.png"
}, },
on_rotate = screwdriver.rotate_simple,
can_dig = worktable.dig, can_dig = worktable.dig,
on_construct = worktable.construct, on_construct = worktable.construct,
on_receive_fields = worktable.fields, on_receive_fields = worktable.fields,

View File

@ -3,6 +3,7 @@
-- Optimized by kilbith -- Optimized by kilbith
local xwall = {} local xwall = {}
screwdriver = screwdriver or {}
xwall.get_candidate = {} xwall.get_candidate = {}
local profiles = { local profiles = {
@ -152,6 +153,7 @@ function xwall.register_wall(name, tiles, def)
sounds = default.node_sound_stone_defaults(), sounds = default.node_sound_stone_defaults(),
groups = {cracky=3, stone=1, pane=1}, groups = {cracky=3, stone=1, pane=1},
sunlight_propagates = true, sunlight_propagates = true,
on_rotate = screwdriver.disallow,
collision_box = { collision_box = {
type = "fixed", type = "fixed",
fixed = {-.5, -.5, -.25, .5, 1, .25} fixed = {-.5, -.5, -.25, .5, 1, .25}