Zefram
2014-04-28 99fd5dfee5a70b0656e40787168d2c67ba417738
technic/tools/sonic_screwdriver.lua
@@ -7,17 +7,22 @@
minetest.register_tool("technic:sonic_screwdriver", {
   description = S("Sonic Screwdriver"),
   inventory_image = "technic_sonic_screwdriver.png",
   wear_represents = "technic_RE_charge",
   on_use = function(itemstack, user, pointed_thing)
      -- Must be pointing to facedir applicable node
      if pointed_thing.type ~= "node" then
         return
      end
      local pos = minetest.get_pointed_thing_position(pointed_thing, above)
      local pos = pointed_thing.under
      if minetest.is_protected(pos, user:get_player_name()) then
         minetest.record_protection_violation(pos, user:get_player_name())
         return
      end
      local node = minetest.get_node(pos)
      local node_name = node.name
      if minetest.registered_nodes[node_name].paramtype2 ~= "facedir" and
         minetest.registered_nodes[node_name].paramtype2 ~= "wallmounted" then
         return itemstack
         return
      end
      if node.param2 == nil then
         return
@@ -26,7 +31,7 @@
      if not meta1 or not meta1.charge then
         return
      end
      if meta1.charge - 100 > 0 then
      if meta1.charge >= 100 then
         minetest.sound_play("technic_sonic_screwdriver",
               {pos = pos, gain = 0.3, max_hear_distance = 10})
         local p = node.param2