1
0
mirror of https://github.com/mt-mods/homedecor_modpack.git synced 2024-12-23 00:20:17 +01:00

Disallow partially or entirely some items to rotate with the screwdriver

This commit is contained in:
kilbith 2015-05-14 12:25:11 +02:00
parent 246a38832a
commit e374b83bc0
20 changed files with 43 additions and 3 deletions

View File

@ -248,6 +248,7 @@ minetest.register_node("computer:tetris_arcade", {
paramtype = "light", paramtype = "light",
paramtype2 = "facedir", paramtype2 = "facedir",
groups = {snappy=3}, groups = {snappy=3},
on_rotate = screwdriver.rotate_simple,
selection_box = { selection_box = {
type = "fixed", type = "fixed",
fixed = {-0.5, -0.5, -0.5, 0.5, 1.5, 0.5} fixed = {-0.5, -0.5, -0.5, 0.5, 1.5, 0.5}

View File

@ -107,6 +107,7 @@ minetest.register_node("fake_fire:fancy_fire", {
light_source = 14, light_source = 14,
walkable = false, walkable = false,
damage_per_second = 4, damage_per_second = 4,
on_rotate = screwdriver.rotate_simple,
tiles = { tiles = {
{name="fake_fire_animated.png", {name="fake_fire_animated.png",
animation={type='vertical_frames', aspect_w=16, aspect_h=16, length=1}}, {name='fake_fire_logs.png'}}, animation={type='vertical_frames', aspect_w=16, aspect_h=16, length=1}}, {name='fake_fire_logs.png'}},

View File

@ -150,7 +150,8 @@ homedecor.register("taps", {
groups = {cracky=3}, groups = {cracky=3},
sounds = default.node_sound_stone_defaults(), sounds = default.node_sound_stone_defaults(),
on_rightclick = taps_on_rightclick, on_rightclick = taps_on_rightclick,
on_destruct = homedecor.stop_particle_spawner on_destruct = homedecor.stop_particle_spawner,
on_rotate = screwdriver.disallow
}) })
homedecor.register("taps_brass", { homedecor.register("taps_brass", {
@ -172,7 +173,8 @@ homedecor.register("taps_brass", {
groups = {cracky=3}, groups = {cracky=3},
sounds = default.node_sound_stone_defaults(), sounds = default.node_sound_stone_defaults(),
on_rightclick = taps_on_rightclick, on_rightclick = taps_on_rightclick,
on_destruct = homedecor.stop_particle_spawner on_destruct = homedecor.stop_particle_spawner,
on_rotate = screwdriver.disallow
}) })
--Shower Tray --Shower Tray
@ -225,6 +227,7 @@ homedecor.register("shower_head", {
groups = {snappy=3}, groups = {snappy=3},
selection_box = sh_cbox, selection_box = sh_cbox,
walkable = false, walkable = false,
on_rotate = screwdriver.disallow,
on_rightclick = function (pos, node, clicker) on_rightclick = function (pos, node, clicker)
local below = minetest.get_node_or_nil({x=pos.x, y=pos.y-2.0, z=pos.z}) local below = minetest.get_node_or_nil({x=pos.x, y=pos.y-2.0, z=pos.z})
if below and below.name == "homedecor:shower_tray" then if below and below.name == "homedecor:shower_tray" then

View File

@ -64,6 +64,7 @@ for i in ipairs(bedcolors) do
selection_box = bed_sbox, selection_box = bed_sbox,
collision_box = bed_cbox, collision_box = bed_cbox,
sounds = default.node_sound_wood_defaults(), sounds = default.node_sound_wood_defaults(),
on_rotate = screwdriver.disallow,
after_place_node = function(pos, placer, itemstack, pointed_thing) after_place_node = function(pos, placer, itemstack, pointed_thing)
if not placer:get_player_control().sneak then if not placer:get_player_control().sneak then
return homedecor.bed_expansion(pos, placer, itemstack, pointed_thing, color) return homedecor.bed_expansion(pos, placer, itemstack, pointed_thing, color)
@ -93,6 +94,7 @@ for i in ipairs(bedcolors) do
collision_box = bed_cbox, collision_box = bed_cbox,
sounds = default.node_sound_wood_defaults(), sounds = default.node_sound_wood_defaults(),
expand = { forward = "air" }, expand = { forward = "air" },
on_rotate = screwdriver.disallow,
after_dig_node = function(pos) after_dig_node = function(pos)
homedecor.unextend_bed(pos, color) homedecor.unextend_bed(pos, color)
end, end,
@ -121,6 +123,7 @@ for i in ipairs(bedcolors) do
selection_box = kbed_sbox, selection_box = kbed_sbox,
collision_box = kbed_cbox, collision_box = kbed_cbox,
sounds = default.node_sound_wood_defaults(), sounds = default.node_sound_wood_defaults(),
on_rotate = screwdriver.disallow,
after_dig_node = function(pos, oldnode, oldmetadata, digger) after_dig_node = function(pos, oldnode, oldmetadata, digger)
local inv = digger:get_inventory() local inv = digger:get_inventory()
if digger:get_player_control().sneak and inv:room_for_item("main", "bed_"..color.."_regular 1") then if digger:get_player_control().sneak and inv:room_for_item("main", "bed_"..color.."_regular 1") then

View File

@ -37,6 +37,7 @@ homedecor.register("desk_fan", {
inventory_image = "homedecor_desk_fan_inv.png", inventory_image = "homedecor_desk_fan_inv.png",
wield_image = "homedecor_desk_fan_inv.png", wield_image = "homedecor_desk_fan_inv.png",
selection_box = { type = "regular" }, selection_box = { type = "regular" },
on_rotate = screwdriver.disallow,
on_construct = function(pos) on_construct = function(pos)
local entity_remove = minetest.get_objects_inside_radius(pos, 0.1) local entity_remove = minetest.get_objects_inside_radius(pos, 0.1)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)

View File

@ -92,6 +92,7 @@ homedecor.register("grandfather_clock", {
collision_box = gf_cbox, collision_box = gf_cbox,
sounds = default.node_sound_wood_defaults(), sounds = default.node_sound_wood_defaults(),
expand = { top="air" }, expand = { top="air" },
on_rotate = screwdriver.rotate_simple
}) })
minetest.register_alias("homedecor:grandfather_clock_bottom", "homedecor:grandfather_clock") minetest.register_alias("homedecor:grandfather_clock_bottom", "homedecor:grandfather_clock")

View File

@ -243,6 +243,7 @@ for i in ipairs(sides) do
use_texture_alpha = door_model.usealpha, use_texture_alpha = door_model.usealpha,
selection_box = selbox, selection_box = selbox,
collision_box = colbox, collision_box = colbox,
on_rotate = screwdriver.rotate_simple,
on_place = function(itemstack, placer, pointed_thing) on_place = function(itemstack, placer, pointed_thing)
return homedecor.stack_wing(itemstack, placer, pointed_thing, return homedecor.stack_wing(itemstack, placer, pointed_thing,
"homedecor:door_"..doorname.."_left", "air", "homedecor:door_"..doorname.."_left", "air",
@ -620,6 +621,7 @@ minetest.register_node("homedecor:door_japanese_open", {
paramtype2 = "facedir", paramtype2 = "facedir",
groups = { snappy = 3, not_in_creative_inventory = 1 }, groups = { snappy = 3, not_in_creative_inventory = 1 },
sounds = default.node_sound_wood_defaults(), sounds = default.node_sound_wood_defaults(),
on_rotate = screwdriver.disallow,
selection_box = { selection_box = {
type = "fixed", type = "fixed",
fixed = {-1.5, -0.5, -0.0625, 0.5, 1.5, 0}, fixed = {-1.5, -0.5, -0.0625, 0.5, 1.5, 0},

View File

@ -56,6 +56,7 @@ homedecor.register("bench_large_1", {
sounds = default.node_sound_wood_defaults(), sounds = default.node_sound_wood_defaults(),
selection_box = bl1_sbox, selection_box = bl1_sbox,
node_box = bl1_cbox, node_box = bl1_cbox,
on_rotate = screwdriver.disallow
}) })
minetest.register_alias("homedecor:bench_large_1_left", "homedecor:bench_large_1") minetest.register_alias("homedecor:bench_large_1_left", "homedecor:bench_large_1")
@ -84,6 +85,7 @@ homedecor.register("bench_large_2", {
node_box = bl2_cbox, node_box = bl2_cbox,
expand = { right="air" }, expand = { right="air" },
sounds = default.node_sound_wood_defaults(), sounds = default.node_sound_wood_defaults(),
on_rotate = screwdriver.disallow
}) })
minetest.register_alias("homedecor:bench_large_2_left", "homedecor:bench_large_2") minetest.register_alias("homedecor:bench_large_2_left", "homedecor:bench_large_2")
@ -103,6 +105,7 @@ homedecor.register("deckchair", {
sounds = default.node_sound_wood_defaults(), sounds = default.node_sound_wood_defaults(),
selection_box = dc_cbox, selection_box = dc_cbox,
collision_box = dc_cbox, collision_box = dc_cbox,
on_rotate = screwdriver.disallow
}) })
minetest.register_alias("homedecor:deckchair_foot", "homedecor:deckchair") minetest.register_alias("homedecor:deckchair_foot", "homedecor:deckchair")
@ -117,6 +120,7 @@ homedecor.register("deckchair_striped_blue", {
sounds = default.node_sound_wood_defaults(), sounds = default.node_sound_wood_defaults(),
selection_box = dc_cbox, selection_box = dc_cbox,
collision_box = dc_cbox, collision_box = dc_cbox,
on_rotate = screwdriver.disallow
}) })
homedecor.register("doghouse", { homedecor.register("doghouse", {
@ -133,6 +137,7 @@ homedecor.register("doghouse", {
groups = {snappy=3}, groups = {snappy=3},
expand = { top="air" }, expand = { top="air" },
sounds = default.node_sound_wood_defaults(), sounds = default.node_sound_wood_defaults(),
on_rotate = screwdriver.rotate_simple
}) })
minetest.register_alias("homedecor:doghouse_roof", "air") minetest.register_alias("homedecor:doghouse_roof", "air")
@ -222,6 +227,7 @@ homedecor.register("swing", {
groups = { snappy=3, oddly_breakable_by_hand=3 }, groups = { snappy=3, oddly_breakable_by_hand=3 },
sounds = default.node_sound_wood_defaults(), sounds = default.node_sound_wood_defaults(),
walkable = false, walkable = false,
on_rotate = screwdriver.disallow,
node_box = { node_box = {
type = "fixed", type = "fixed",
fixed = { fixed = {
@ -318,6 +324,7 @@ homedecor.register("well", {
collision_box = homedecor.nodebox.slab_y(2), collision_box = homedecor.nodebox.slab_y(2),
expand = { top="air" }, expand = { top="air" },
sounds = default.node_sound_stone_defaults(), sounds = default.node_sound_stone_defaults(),
on_rotate = screwdriver.rotate_simple
}) })
if minetest.get_modpath("bucket") then if minetest.get_modpath("bucket") then

View File

@ -181,6 +181,7 @@ homedecor.register("office_chair_"..c, {
selection_box = ofchairs_sbox, selection_box = ofchairs_sbox,
collision_box = ofchairs_cbox, collision_box = ofchairs_cbox,
expand = { top = "air" }, expand = { top = "air" },
on_rotate = screwdriver.rotate_simple
}) })
end end

View File

@ -99,6 +99,8 @@ function homedecor.find_ceiling(itemstack, placer, pointed_thing)
return isceiling, pos return isceiling, pos
end end
if screwdriver == nil then screwdriver = {} end
homedecor.plain_wood = "homedecor_generic_wood_plain.png^".. homedecor.plain_wood = "homedecor_generic_wood_plain.png^"..
"(homedecor_generic_wood_boards_overlay.png^[colorize:#a7682020:100)" "(homedecor_generic_wood_boards_overlay.png^[colorize:#a7682020:100)"

View File

@ -18,6 +18,7 @@ homedecor.register("refrigerator_steel", {
size=50, size=50,
lockable=true, lockable=true,
}, },
on_rotate = screwdriver.rotate_simple
}) })
-- white, enameled fridge -- white, enameled fridge
@ -36,6 +37,7 @@ homedecor.register("refrigerator_white", {
size=50, size=50,
lockable=true lockable=true
}, },
on_rotate = screwdriver.rotate_simple
}) })
minetest.register_alias("homedecor:refrigerator_white_bottom", "homedecor:refrigerator_white") minetest.register_alias("homedecor:refrigerator_white_bottom", "homedecor:refrigerator_white")
@ -116,7 +118,8 @@ homedecor.register("coffee_maker", {
walkable = false, walkable = false,
groups = {snappy=3}, groups = {snappy=3},
selection_box = cm_cbox, selection_box = cm_cbox,
node_box = cm_cbox node_box = cm_cbox,
on_rotate = screwdriver.disallow
}) })
local fdir_to_steampos = { local fdir_to_steampos = {

View File

@ -113,6 +113,7 @@ homedecor.register("kitchen_faucet", {
groups = {snappy=3}, groups = {snappy=3},
selection_box = kf_cbox, selection_box = kf_cbox,
walkable = false, walkable = false,
on_rotate = screwdriver.disallow,
on_rightclick = function(pos, node, clicker) on_rightclick = function(pos, node, clicker)
local below = minetest.get_node_or_nil({x=pos.x, y=pos.y-1, z=pos.z}) local below = minetest.get_node_or_nil({x=pos.x, y=pos.y-1, z=pos.z})
if below and if below and

View File

@ -472,6 +472,7 @@ local function reg_lamp(suffix, nxt, tilesuffix, light, color)
}, },
selection_box = slamp_cbox, selection_box = slamp_cbox,
sounds = default.node_sound_wood_defaults(), sounds = default.node_sound_wood_defaults(),
on_rotate = screwdriver.rotate_simple,
on_punch = function(pos, node, puncher) on_punch = function(pos, node, puncher)
node.name = "homedecor:standing_lamp"..lampcolor.."_"..repl[suffix] node.name = "homedecor:standing_lamp"..lampcolor.."_"..repl[suffix]
minetest.set_node(pos, node) minetest.set_node(pos, node)

View File

@ -280,6 +280,7 @@ homedecor.register("pool_table", {
collision_box = pooltable_cbox, collision_box = pooltable_cbox,
expand = { forward="air" }, expand = { forward="air" },
sounds = default.node_sound_wood_defaults(), sounds = default.node_sound_wood_defaults(),
on_rotate = screwdriver.disallow
}) })
minetest.register_alias("homedecor:pool_table_2", "air") minetest.register_alias("homedecor:pool_table_2", "air")
@ -322,6 +323,7 @@ homedecor.register("coat_tree", {
type = "fixed", type = "fixed",
fixed = { -0.4, -0.5, -0.4, 0.4, 1.5, 0.4 } fixed = { -0.4, -0.5, -0.4, 0.4, 1.5, 0.4 }
}, },
on_rotate = screwdriver.rotate_simple
}) })
local cutlery_cbox = { local cutlery_cbox = {
@ -439,6 +441,7 @@ homedecor.register("piano", {
collision_box = piano_cbox, collision_box = piano_cbox,
expand = { right="air" }, expand = { right="air" },
sounds = default.node_sound_wood_defaults(), sounds = default.node_sound_wood_defaults(),
on_rotate = screwdriver.disallow
}) })
minetest.register_alias("homedecor:piano_left", "homedecor:piano") minetest.register_alias("homedecor:piano_left", "homedecor:piano")
@ -562,6 +565,7 @@ homedecor.register("tool_cabinet", {
"homedecor_tool_cabinet_misc.png", "homedecor_tool_cabinet_misc.png",
}, },
inventory_image = "homedecor_tool_cabinet_inv.png", inventory_image = "homedecor_tool_cabinet_inv.png",
on_rotate = screwdriver.rotate_simple,
groups = { snappy=3 }, groups = { snappy=3 },
selection_box = homedecor.nodebox.slab_y(2), selection_box = homedecor.nodebox.slab_y(2),
expand = { top="air" }, expand = { top="air" },
@ -802,6 +806,7 @@ homedecor.register("spiral_staircase", {
}, },
groups = {choppy=2}, groups = {choppy=2},
sounds = default.node_sound_wood_defaults(), sounds = default.node_sound_wood_defaults(),
on_rotate = screwdriver.rotate_simple,
after_place_node = function(pos, placer, itemstack, pointed_thing) after_place_node = function(pos, placer, itemstack, pointed_thing)
local fdir = minetest.dir_to_facedir(placer:get_look_dir()) local fdir = minetest.dir_to_facedir(placer:get_look_dir())
local leftx = homedecor.fdir_to_left[fdir+1][1] local leftx = homedecor.fdir_to_left[fdir+1][1]
@ -870,6 +875,7 @@ homedecor.register("soda_machine", {
collision_box = svm_cbox, collision_box = svm_cbox,
expand = { top="air" }, expand = { top="air" },
sounds = default.node_sound_wood_defaults(), sounds = default.node_sound_wood_defaults(),
on_rotate = screwdriver.rotate_simple,
on_punch = function(pos, node, puncher, pointed_thing) on_punch = function(pos, node, puncher, pointed_thing)
local wielditem = puncher:get_wielded_item() local wielditem = puncher:get_wielded_item()
local wieldname = wielditem:get_name() local wieldname = wielditem:get_name()

View File

@ -19,6 +19,7 @@ homedecor.register("wardrobe", {
collision_box = wd_cbox, collision_box = wd_cbox,
sounds = default.node_sound_wood_defaults(), sounds = default.node_sound_wood_defaults(),
expand = { top="air" }, expand = { top="air" },
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 skins = {"male1", "male2", "male3", "male4", "male5"} local skins = {"male1", "male2", "male3", "male4", "male5"}

View File

@ -30,6 +30,7 @@ minetest.register_node("inbox:empty", {
paramtype2 = "facedir", paramtype2 = "facedir",
groups = {choppy=2,oddly_breakable_by_hand=2}, groups = {choppy=2,oddly_breakable_by_hand=2},
sounds = default.node_sound_wood_defaults(), sounds = default.node_sound_wood_defaults(),
on_rotate = screwdriver.rotate_simple,
after_place_node = function(pos, placer, itemstack) after_place_node = function(pos, placer, itemstack)
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

@ -110,6 +110,7 @@ minetest.register_node("itemframes:frame",{
groups = { choppy=2,dig_immediate=2 }, groups = { choppy=2,dig_immediate=2 },
legacy_wallmounted = true, legacy_wallmounted = true,
sounds = default.node_sound_defaults(), sounds = default.node_sound_defaults(),
on_rotate = screwdriver.disallow,
after_place_node = function(pos, placer, itemstack) after_place_node = function(pos, placer, itemstack)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
meta:set_string("owner",placer:get_player_name()) meta:set_string("owner",placer:get_player_name())
@ -155,6 +156,7 @@ minetest.register_node("itemframes:pedestal",{
paramtype = "light", paramtype = "light",
groups = { cracky=3 }, groups = { cracky=3 },
sounds = default.node_sound_defaults(), sounds = default.node_sound_defaults(),
on_rotate = screwdriver.disallow,
after_place_node = function(pos, placer, itemstack) after_place_node = function(pos, placer, itemstack)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
meta:set_string("owner",placer:get_player_name()) meta:set_string("owner",placer:get_player_name())

View File

@ -41,6 +41,7 @@ for i in ipairs(longsofas_list) do
sounds = default.node_sound_wood_defaults(), sounds = default.node_sound_wood_defaults(),
selection_box = longsofa_sbox, selection_box = longsofa_sbox,
node_box = longsofa_cbox, node_box = longsofa_cbox,
on_rotate = screwdriver.disallow,
on_place = function(itemstack, placer, pointed_thing) on_place = function(itemstack, placer, pointed_thing)
local pos = pointed_thing.above local pos = pointed_thing.above
local fdir = minetest.dir_to_facedir(placer:get_look_dir(), false) local fdir = minetest.dir_to_facedir(placer:get_look_dir(), false)

View File

@ -41,6 +41,7 @@ for i in ipairs(sofas_list) do
sounds = default.node_sound_wood_defaults(), sounds = default.node_sound_wood_defaults(),
selection_box = sofa_sbox, selection_box = sofa_sbox,
node_box = sofa_cbox, node_box = sofa_cbox,
on_rotate = screwdriver.disallow,
on_place = function(itemstack, placer, pointed_thing) on_place = function(itemstack, placer, pointed_thing)
local pos = pointed_thing.above local pos = pointed_thing.above
local fdir = minetest.dir_to_facedir(placer:get_look_dir(), false) local fdir = minetest.dir_to_facedir(placer:get_look_dir(), false)

View File

@ -114,6 +114,7 @@ minetest.register_node("plasmascreen:tv", {
light_source = 10, light_source = 10,
selection_box = tv_cbox, selection_box = tv_cbox,
collision_box = tv_cbox, collision_box = tv_cbox,
on_rotate = screwdriver.disallow,
groups = {snappy=1, choppy=2, oddly_breakable_by_hand=2}, groups = {snappy=1, choppy=2, oddly_breakable_by_hand=2},
after_place_node = function(pos, placer, itemstack) after_place_node = function(pos, placer, itemstack)
if not checkwall(pos) then if not checkwall(pos) then