From 0e58a6f0149e42ba5fc797ad5b85b2874e21541f Mon Sep 17 00:00:00 2001 From: Maciej Kasatkin Date: Wed, 12 Sep 2012 00:48:51 +0200 Subject: [PATCH] Added screwdriver --- init.lua | 1 + screwdriver.lua | 38 +++++++++++++++++++++++++++++++ textures/technic_screwdriver.png | Bin 0 -> 1001 bytes 3 files changed, 39 insertions(+) create mode 100644 screwdriver.lua create mode 100644 textures/technic_screwdriver.png diff --git a/init.lua b/init.lua index 6629b38..4197e58 100644 --- a/init.lua +++ b/init.lua @@ -39,6 +39,7 @@ dofile(minetest.get_modpath("technic").."/water_mill.lua") dofile(minetest.get_modpath("technic").."/alloy_furnace.lua") dofile(minetest.get_modpath("technic").."/items.lua") dofile(minetest.get_modpath("technic").."/mining_drill.lua") +dofile(minetest.get_modpath("technic").."/screwdriver.lua") function has_locked_chest_privilege(meta, player) diff --git a/screwdriver.lua b/screwdriver.lua new file mode 100644 index 0000000..c8aaa7b --- /dev/null +++ b/screwdriver.lua @@ -0,0 +1,38 @@ + minetest.register_tool("technic:screwdriver", { + description = "Screwdriver", + inventory_image = "technic_screwdriver.png", + 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 node=minetest.env:get_node(pos) + local node_name=node.name + if node.param2==nil then return end + print (node_name) + -- Get ready to set the param2 + local n = node.param2 + n = n+1 + if n == 4 then n = 0 end + -- hacky_swap_node, unforunatly. + local meta = minetest.env:get_meta(pos) + local meta0 = meta:to_table() + node.param2 = n + print(node_name) + minetest.env:set_node(pos,node) + meta = minetest.env:get_meta(pos) + meta:from_table(meta0) + -- appropriatly set the wear of the screwdriver + -- m = itemstack:get_wear() + -- if m == 0 then m = 65535 end + -- m = m-6554 + -- return {wear=m} + end, + }) + + minetest.register_craft({ + output = "technic:screwdriver", + recipe = { + {"technic:stainless_steel_ingot"}, + {"default:stick"} + } + }) diff --git a/textures/technic_screwdriver.png b/textures/technic_screwdriver.png new file mode 100644 index 0000000000000000000000000000000000000000..bd2da222f51ea29ea9ac07ef39b5e92d21f2e0cd GIT binary patch literal 1001 zcmV000McNliru+zAU6EjETkJ!t>{19nM7 zK~z}7?bKgrTV)u>@$Y+*leSCJ*tAWIUG~p)wrLAO9Zt|9s4cAygdu|>cq4)+UXA(Z z!V4M0UCymc1TPiVQs~XBty9n$B9rYPU4Ynx^TW*eoZ><3;QtMJSu*R4@F& zfpgxA^L%)o_kH1Cj@o?r_Pa5O#bO+OqMfFuCbgr0(a}-S9aZ@K^(-$h6OBe`Yip%> z2Ot_i{O%%dw+nzkAV5b)2O@BJ{EAFZPmARMzt6|Y$_gSvp->=~%i-~OXlZHT$DhL1 zcVPGK29n7nN)I_FHe3eIEAGkH&)sal2e( zvsoVY`x*Xv1YLK~)%838=ld>5xe;3djg98d=jZ3e>-Ey#KY*qbFLXX<8DiUn!(lmj z@;w`Og(An9^&l8i( zL~d~B(g^_8s`8xazpEbjBD&wSx3{a~$6w*<4_6ucW}I9`ap%$rx(REpgMj5tQcC(SSU2$W6UdC$f;Hb&r?v z>x)DdHt;&_1Z#9&|KgS^>j+AdFbsSy2fxOD$EGQkQfv6!c6twcdF`dA2zYcp>kW!! zfI3}g@Y)g+w>F5c8pPKOYIoW2*7>+SJH??#58!j#w?&lgN`2?qdO7yE2cNf^*@a~` z48c{Q(YSvvQ?qj<)^oh^nZ-2)>-P%$a$}B`0}a%$LIx%o0YvSR6o8uwe)@b5TNjeNlIa{aO_5A*EpB-SHuHYBU$R-D!mhRy|4-x( X7-6TR_5>p900000NkvXXu0mjf81vB> literal 0 HcmV?d00001 -- 2.30.2