]> git.lizzy.rs Git - xdecor.git/blobdiff - mechanisms.lua
Workbench : move formspecs table outside of function to avoid overhead
[xdecor.git] / mechanisms.lua
index 511d062cf2c14ffe48e666ffb760815189ce4a90..36e0ef8bc91bd69c037eb283a2268720dafa1f87 100644 (file)
@@ -1,4 +1,8 @@
--- Thanks to sofar for helping with that code.
+--[[ Thanks to sofar for helping with that code.
+Pressure plates work better with this setting in minetest.conf (requires 0.4.14):
+       nodetimer_interval = 0.1
+]]
+
 local plate = {}
 screwdriver = screwdriver or {}
 
@@ -45,14 +49,13 @@ function plate.timer(pos)
 end
 
 function plate.register(material, desc, def)
-       local sound, groups = def.sounds, def.groups
        xdecor.register("pressure_"..material.."_off", {
                description = desc.." Pressure Plate",
                tiles = {"xdecor_pressure_"..material..".png"},
                drawtype = "nodebox",
                node_box = xdecor.pixelbox(16, {{1, 0, 1, 14, 1, 14}}),
-               groups = groups,
-               sounds = sound,
+               groups = def.groups,
+               sounds = def.sounds,
                sunlight_propagates = true,
                on_rotate = screwdriver.rotate_simple,
                on_construct = plate.construct,
@@ -62,8 +65,8 @@ function plate.register(material, desc, def)
                tiles = {"xdecor_pressure_"..material..".png"},
                drawtype = "nodebox",
                node_box = xdecor.pixelbox(16, {{1, 0, 1, 14, 0.4, 14}}),
-               groups = groups,
-               sounds = sound,
+               groups = def.groups,
+               sounds = def.sounds,
                drop = "xdecor:pressure_"..material.."_off",
                sunlight_propagates = true,
                on_rotate = screwdriver.rotate_simple
@@ -72,12 +75,12 @@ end
 
 plate.register("wood", "Wooden", {
        sounds = default.node_sound_wood_defaults(),
-       groups = {choppy=3, flammable=2}
+       groups = {choppy=3, oddly_breakable_by_hand=2, flammable=2}
 })
 
 plate.register("stone", "Stone", {
        sounds = default.node_sound_stone_defaults(),
-       groups = {cracky=3}
+       groups = {cracky=3, oddly_breakable_by_hand=2}
 })
 
 xdecor.register("lever_off", {