From 582f94952a706f8d03ecfb7ba79fe84a66c4c871 Mon Sep 17 00:00:00 2001 From: Maciej Kasatkin Date: Tue, 11 Sep 2012 18:47:09 +0200 Subject: [PATCH] Added Mining Drill --- electric.lua | 21 ++++++++ init.lua | 1 + items.lua | 2 +- mining_drill.lua | 60 +++++++++++++++++++++++ textures/technic_diamond_drill_head.png | Bin 0 -> 978 bytes textures/technic_doped_silicon_wafer.png | Bin 0 -> 867 bytes textures/technic_mining_drill.png | Bin 0 -> 2099 bytes textures/technic_silicon_wafer.png | Bin 0 -> 913 bytes 8 files changed, 83 insertions(+), 1 deletion(-) create mode 100644 mining_drill.lua create mode 100644 textures/technic_diamond_drill_head.png create mode 100644 textures/technic_doped_silicon_wafer.png create mode 100644 textures/technic_mining_drill.png create mode 100644 textures/technic_silicon_wafer.png diff --git a/electric.lua b/electric.lua index b4c6cca..deaa596 100644 --- a/electric.lua +++ b/electric.lua @@ -338,6 +338,27 @@ minetest.register_abm({ end end meta:set_float("battery_charge",charge) + + if inv:is_empty("src")==false then + srcstack = inv:get_stack("src", 1) + src_item=srcstack:to_table() + if src_item["name"]== "technic:mining_drill" then + local load1=tonumber((src_item["wear"])) + load1=get_RE_item_load(load1,60000) + load_step=1000 + if load1<60000 and charge>0 then + if charge-load_step<0 then load_step=charge end + if load1+load_step>60000 then load_step=60000-load1 end + load1=load1+load_step + charge=charge-load_step + load1=set_RE_item_load(load1,60000) + src_item["wear"]=tostring(load1) + inv:set_stack("src", 1, src_item) + end + end + end + meta:set_float("battery_charge",charge) + if inv:is_empty("dst") == false then diff --git a/init.lua b/init.lua index a41b11a..fc921d6 100644 --- a/init.lua +++ b/init.lua @@ -37,6 +37,7 @@ dofile(minetest.get_modpath("technic").."/geothermal.lua") 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") function has_locked_chest_privilege(meta, player) diff --git a/items.lua b/items.lua index e026ae9..f61fd6a 100644 --- a/items.lua +++ b/items.lua @@ -11,7 +11,7 @@ minetest.register_craftitem( "technic:doped_silicon_wafer", { }) minetest.register_craft({ - output = 'pipeworks:tube_000000 8', + output = 'pipeworks:tube_000000 9', recipe = { {'technic:stainless_steel_ingot', 'default:glass', 'technic:stainless_steel_ingot'}, {'technic:stainless_steel_ingot', 'default:glass', 'technic:stainless_steel_ingot'}, diff --git a/mining_drill.lua b/mining_drill.lua new file mode 100644 index 0000000..78c11a4 --- /dev/null +++ b/mining_drill.lua @@ -0,0 +1,60 @@ +mining_drill_max_charge=60000 + +minetest.register_tool("technic:mining_drill", { + description = "Mining Drill", + inventory_image = "technic_mining_drill.png", + stack_max = 1, + on_use = function(itemstack, user, pointed_thing) + if pointed_thing.type=="node" then + item=itemstack:to_table() + local charge=tonumber((item["wear"])) + if charge ==0 then charge =65535 end + if charge ==65535 then charge =1 end + charge=get_RE_item_load(charge,laser_mk1_max_charge) + if charge-400>0 then + drill_dig_it(minetest.get_pointed_thing_position(pointed_thing, above),user) + charge =charge-400; + charge=set_RE_item_load(charge,laser_mk1_max_charge) + item["wear"]=tostring(charge) + itemstack:replace(item) + end + return itemstack + end + end, +}) + +minetest.register_craft({ + output = 'technic:mining_drill', + recipe = { + {'technic:stainless_steel_ingot', 'technic:diamond_drill_head', 'technic:stainless_steel_ingot'}, + {'technic:stainless_steel_ingot', 'technic:red_energy_crystal', 'technic:stainless_steel_ingot'}, + {'', 'moreores:copper_ingot', ''}, + } +}) + + + + + + +function drill_dig_it (pos, player) + local node=minetest.env:get_node(pos) + if node.name == "air" then return end + if node.name == "default:lava_source" then return end + if node.name == "default:lava_flowing" then return end + if node.name == "default:water_source" then minetest.env:remove_node(pos) return end + if node.name == "default:water_flowing" then minetest.env:remove_node(pos) return end + if node.name == "ignore" then minetest.env:remove_node(pos) return end + + if player then + local drops = minetest.get_node_drops(node.name, "default:pick_mese") + if player:get_inventory() then + local _, dropped_item + for _, dropped_item in ipairs(drops) do + player:get_inventory():add_item("main", dropped_item) + end + end + minetest.env:remove_node(pos) + end + +end \ No newline at end of file diff --git a/textures/technic_diamond_drill_head.png b/textures/technic_diamond_drill_head.png new file mode 100644 index 0000000000000000000000000000000000000000..e3d31e8e09fcfc0aaf11ad51d9001fadbeeed542 GIT binary patch literal 978 zcmV;@11WFU8GbZ8()Nlj2>E@cM*00TBjL_t(I%XL$0Xp?6Y ze$M+PG1sQ1tx0XQ=`5ia?O;fyqKhcvnAjf*Lr_6*O8?Y}igs*Ocb|f{d4r-LDjg{3 z54HZN!m3goDy>eEHnv$)6I1gwU-G@jAE`QFJHHNxb9tWgoJ05@YrAyLMI*z@ zj83;+6nq-;Z`*qFzw+pf^TT(|_^Rb+v@|z1IqkOnMpwDv&v=^6Ml+^41g6>qKB%av zsjHv&_{5o$ShsrZy9V7ocahAbrnMd0d$m7X=puW1Co(x1&gUN9VB%|2E7eDr- z8)g}z(Xgy6Epa5Y9nD|o8U%wO%Z1Z>)Ybs=-zG0BlE`W%jA=TU1t4{NI;)J@A4J%v zgn6+w{QSuA^CbYF06;R{_x+u?xV&KLYC|AAv`du?Ejs~^2qXx>=*wM1f@8u#q>VXN z_-l)PzjMD`06;dI-hNxJHXiS|$8j~o#JRmN0RV%U03rzJ1&700YBgnlqthTrbFq{*g?LC@!*fRh3Pr#g(N57K91- zibBlHMk12$#0CfiMix>E*ldc^V9xhc#R7i?E=LL=6oSmr#y_cXl&s&Ec7MK)h7u}6 z$iAe~h0!cXjq)B$UI|vU4*&TI6>{x^4~MOHWbG1T?Z+ zEL>Y+7r*tz7ywMV#LDSolnr;u$)%ro3?dXgxaVjN!S&8tXqZ!{&RyPkxKMpM^Rp_4 zufmD2mW&_p8sj_XSVyVe)QcH~=G1{hZA+Fm%zm}|oBi*9BLM99atprwX)hk!z3q;K zddh}g=+zMH)kX&c>$m=Rg@|7EhaREaTl2Q&HAm!QD}}*X0{{R307*qoM6N<$g8M?e AZU6uP literal 0 HcmV?d00001 diff --git a/textures/technic_doped_silicon_wafer.png b/textures/technic_doped_silicon_wafer.png new file mode 100644 index 0000000000000000000000000000000000000000..6ff06a6f49691c047028699355734df5a2e2ca3e GIT binary patch literal 867 zcmV-p1DyPcP)WFU8GbZ8()Nlj2>E@cM*00PHJL_t(I%Z-vtXkAql zhQGb{+2=lE2=!h{l8RM?P)$dQ)QUwMND)B?IuKDOP6|?qEv*iUGoMAM(20TKW1u49 z11HWZ)JH&2DpHK479UA%o12(>?m6e4z1MPZ6SUNUKP=W7EdKvz{mbw#?0e%+jz8Ju z;iF62e)#UI2UqiSBB78@ck3_T9>4Q#{sU%n*zwd^9@zeg2JQd1pf zMq)*yJ;8Wq+uZ5bZ+`9YJC}Iz(QE%9xcl&F8vNB+yi{AxvVlP=qf%j#8i=4OSl@u8 z#Z-6v`?ysv@Dp`X(-I}-6s$!>-Ms*I z+^z1MoJdH$1Cu~f2Q0BzL&|lu>Z1}z=Tapv0|sN##OwgD=P%@Ib#F+V#kmAy-AFAC zi6W#v!8pI+ph84gS`FkwDFJM2%k1Jxzak1?Ea)g0<2-5-a5a*&wGo&StDLngYHuJv z0oXG~y%a-PNF0hWY?ewyhZ#kY6RQC#6*|mN5qeoPE9>&XW5+IFZa;L6M9ceEa{oz| z^@(MlSX@S{0#h5q`6kvTgmN9M!=_`J)>@pKpS1w?o0qn8>gAbFLx1^;SY~J#fJ8tc z24cBR9A=|*LIG9Z+%(;M@ literal 0 HcmV?d00001 diff --git a/textures/technic_mining_drill.png b/textures/technic_mining_drill.png new file mode 100644 index 0000000000000000000000000000000000000000..171888db61b65e29d58fae2fec87578c664a9060 GIT binary patch literal 2099 zcmV-32+a41P)WFU8GbZ8()Nlj2>E@cM*00);zL_t(o!?l-RY*W`A z$G_)XJN}nAA^1qjwi(XJ=PkfC7LlWsd2}%75K{;)MZ#U0YjQe^HU;QDd3;LRQ7t zyG@G zXL4}uJ4|Bt?x2v%o^UuES42^qUzHwcXlyz)-v4LY%zPXbCOzJ~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WI6H%9miJc)ebl&*y(xC=||Z-n^NaOeP|VB9h4@ z%jfe7A>@04AiU=Fdg1f=J~@a!4Ic{~d!bO+rqyb(xVVUHHVa9Tm@LZ$Lde$zL3qvW zcEjiM{r_!PETSmF<#JW$^Z6S_qjATXGiMk8a`*0CWHOlyrSyy-2)}J^ZpO&S$Y=A; zV~nAzt7{+-2(SwmF0h`S9=3h^_645j_X2?1?f$Phn$;BWcswpbNR`j$LtkGX3xz^4 zyJ>Fa9hjhSt_r4I$(&vMhING@2Po>25&~9zNA!^eH5agpf0o(u;n- dKk}sU{{YJ+ZAd^pMgjl;002ovPDHLkV1his)8GIA literal 0 HcmV?d00001 diff --git a/textures/technic_silicon_wafer.png b/textures/technic_silicon_wafer.png new file mode 100644 index 0000000000000000000000000000000000000000..78aef2002324dbda1d2206a22ea1c65e0abf390d GIT binary patch literal 913 zcmV;C18)3@P)WFU8GbZ8()Nlj2>E@cM*00Q+%L_t(I%WacOXk29& zhM)gG|2cEcT$*Ou+M%%}WRa>AUAPg%3rH$hF)hVnly>1t+C@vca3?MV-KgNc5mZVA z1D(367Xn437K$5bF_sWXBC*M2GMUS{{r~w~6&>lbdN<$mZr)Gv9~ST4Wb*N6_~q8Z z!Mi^+PYm43sLsP;|AD8MPrNhxB@aP82-m;*h>7RURBwO($<_9s%P-|Bfe@iDDvWEC zM#qT8CuUEbKKJSB@)D1ZPy8$RZhnsYO7E+#|F(WVUQ>etl{t%x3Vdq_(>i|8V7Do= zf9yc>#n<0D{-9U`96k9qtStSy-OiN@t4eAfeq{tdsG>?9Hc(_fw99o?`gVHZr|V~i z1kL%m3;4UnTG6O-NrWym&JImNgo>-W%umXzc1aJ1<>>JKZZdVHrl4FVo%ZYguL*elo5_7{7R1V z`=sRb86ZUqF{xNBF9R4)b)Ky6d4zDIgY!IG5Rlmb(`n&=f)vkblnl^P#_PwFB~iZd zp8(Kn>wk5MQiL%9%9K#rAkI+a0oG*@Xw zzI=(Z?|t~}-%;tJ!Nt{Hk819yrH<0T2i>?+n|$iXu~X+hd+0a*pD(_?^w{Ffg}PsO na`F9-?^Q?lZiom<4WIl2<0^DOW%_wt00000NkvXXu0mjfPc5g! literal 0 HcmV?d00001 -- 2.30.2