0
0
Fork 0

Add hardness to pressure plates

This commit is contained in:
Wuzzy 2017-02-27 17:29:07 +01:00
parent 03628cf246
commit 77cb90f8d5
1 changed files with 17 additions and 5 deletions

View File

@ -48,13 +48,18 @@ end
-- tiles_on: textures of the pressure plate when active -- tiles_on: textures of the pressure plate when active
-- image: inventory and wield image of the pressure plate -- image: inventory and wield image of the pressure plate
-- recipe: crafting recipe of the pressure plate -- recipe: crafting recipe of the pressure plate
-- sounds: sound table (like in minetest.register_node)
-- plusgroups: group memberships (attached_node=1 and not_in_creative_inventory=1 are already used)
function mesecon:register_pressure_plate(offstate, onstate, description, texture_off, texture_on, recipe, sounds) function mesecon:register_pressure_plate(offstate, onstate, description, texture_off, texture_on, recipe, sounds, plusgroups)
local ppspec = { local ppspec = {
offstate = offstate, offstate = offstate,
onstate = onstate onstate = onstate
} }
local groups_off = table.copy(plusgroups)
groups_off.attached_node = 1
minetest.register_node(offstate, { minetest.register_node(offstate, {
drawtype = "nodebox", drawtype = "nodebox",
tiles = {texture_off}, tiles = {texture_off},
@ -62,7 +67,7 @@ function mesecon:register_pressure_plate(offstate, onstate, description, texture
paramtype = "light", paramtype = "light",
selection_box = pp_box_off, selection_box = pp_box_off,
node_box = pp_box_off, node_box = pp_box_off,
groups = {snappy = 2, oddly_breakable_by_hand = 3, attached_node = 1}, groups = groups_off,
is_ground_content = false, is_ground_content = false,
description = description, description = description,
pressureplate = ppspec, pressureplate = ppspec,
@ -75,15 +80,19 @@ function mesecon:register_pressure_plate(offstate, onstate, description, texture
minetest.get_node_timer(pos):start(PRESSURE_PLATE_INTERVAL) minetest.get_node_timer(pos):start(PRESSURE_PLATE_INTERVAL)
end, end,
_mcl_blast_resistance = 2.5, _mcl_blast_resistance = 2.5,
_mcl_hardness = 0.5,
}) })
local groups_on = table.copy(groups_off)
groups_on.not_in_creative_inventory = 1
minetest.register_node(onstate, { minetest.register_node(onstate, {
drawtype = "nodebox", drawtype = "nodebox",
tiles = {texture_on}, tiles = {texture_on},
paramtype = "light", paramtype = "light",
selection_box = pp_box_on, selection_box = pp_box_on,
node_box = pp_box_on, node_box = pp_box_on,
groups = {snappy = 2, oddly_breakable_by_hand = 3, attached_node = 1, not_in_creative_inventory = 1}, groups = groups_on,
is_ground_content = false, is_ground_content = false,
drop = offstate, drop = offstate,
pressureplate = ppspec, pressureplate = ppspec,
@ -102,6 +111,7 @@ function mesecon:register_pressure_plate(offstate, onstate, description, texture
end end
end, end,
_mcl_blast_resistance = 2.5, _mcl_blast_resistance = 2.5,
_mcl_hardness = 0.5,
}) })
minetest.register_craft({ minetest.register_craft({
@ -117,7 +127,8 @@ mesecon:register_pressure_plate(
"default_wood.png", "default_wood.png",
"default_wood.png", "default_wood.png",
{{"group:wood", "group:wood"}}, {{"group:wood", "group:wood"}},
mcl_sounds.node_sound_wood_defaults()) mcl_sounds.node_sound_wood_defaults(),
{axey=1})
mesecon:register_pressure_plate( mesecon:register_pressure_plate(
"mesecons_pressureplates:pressure_plate_stone_off", "mesecons_pressureplates:pressure_plate_stone_off",
@ -126,7 +137,8 @@ mesecon:register_pressure_plate(
"default_stone.png", "default_stone.png",
"default_stone.png", "default_stone.png",
{{"mcl_core:stone", "mcl_core:stone"}}, {{"mcl_core:stone", "mcl_core:stone"}},
mcl_sounds.node_sound_stone_defaults()) mcl_sounds.node_sound_stone_defaults(),
{pickaxey=1})
minetest.register_craft({ minetest.register_craft({
type = "fuel", type = "fuel",