From e09cb20ec944118c3ea629c41eec60824a773c7b Mon Sep 17 00:00:00 2001 From: "Tai @ Flex" Date: Sun, 4 Sep 2016 23:17:18 +0100 Subject: [PATCH 1/2] Add a cheap tin dagger --- dagger.lua | 41 +++++++++++++++++++++++++++++++ init.lua | 3 +++ textures/moreores_tin_dagger.png | Bin 0 -> 954 bytes 3 files changed, 44 insertions(+) create mode 100644 dagger.lua create mode 100644 textures/moreores_tin_dagger.png diff --git a/dagger.lua b/dagger.lua new file mode 100644 index 0000000..843f37c --- /dev/null +++ b/dagger.lua @@ -0,0 +1,41 @@ +-- Tin ore is very common and has very little use. Here's a tin dagger. +-- Useful in that it's efficient +-- Pathetic in that it breaks fairly quickly + +local maxuses = 20 + +local tindaggercaps = { + full_punch_interval = 2.0, + max_drop_level = 0, + groupcaps = { + snappy = {times = {[2] = 1.2, [3] = 0.3}, uses = 2, maxlevel = 1}, + }, + damage_groups = {fleshy = 4}, +} + +minetest.register_tool("moreores:tin_dagger", { + description = "Tin Dagger", + inventory_image = "moreores_tin_dagger.png", + tool_capabilities = tindaggercaps, -- overridden by use of on_use .... + on_use = function(itemstack,user,pointedthing) + if pointedthing.type == "object" then + pointedthing.ref:punch(user,1,tindaggercaps) + + -- explicitly non-physical entities should not incur wear, cater for nil + if not (pointedthing.ref:get_luaentity().physical_state == false) then + itemstack:add_wear(math.ceil(65536/maxuses)) + end + end + return itemstack + end +}) + +core.register_craft({ + output = "moreores:tin_dagger", + recipe = { + {"moreores:tin_ingot"}, + {"moreores:tin_ingot"}, + {"default:stick"} + } +}) + diff --git a/init.lua b/init.lua index 72bd0a1..c4b81d2 100644 --- a/init.lua +++ b/init.lua @@ -359,6 +359,9 @@ minetest.register_node("moreores:copper_rail", { }, }) +-- something usefule with tin +dofile(minetest.get_modpath("moreores").."/dagger.lua" ) + if minetest.setting_getbool("log_mods") then minetest.log("action", S("[moreores] loaded.")) diff --git a/textures/moreores_tin_dagger.png b/textures/moreores_tin_dagger.png new file mode 100644 index 0000000000000000000000000000000000000000..fb750e9d6b47c2ca43b5be929e71a5a67bcd64c2 GIT binary patch literal 954 zcmV;r14aCaP)NWo&J2(e3SRTI{){n&b|L+5USY&H-=P+wnPGR9N~ zBuP5IxVQiz1e8)lB9Z9s?(Xo52ndBj?^3B0SeAVhu(Pu>2tY3tS7QeG>FFtTyWOvI zxg1!Q1ps8TS)81l{Bw16^+&1LifbSc2rQqSojsB&iUNjVAj@(*kw~mP6<_fcjE;^D z=ks|eiUPOWjY6S-hldA*!{Nzt;wy5Xr>AGx?RGn}+3e%JQ%cd))C5&kf32zjK@h$j z85tSQ<#GT3r_%{S2t-kg3W7k&%~STl|AXVWR!Nfn)HDq>HUHHzr4+$n&`v46E;o;1 z2kdtHTb5;C&(6;Ncyn{}X#M8qW;7TKeqw|iFz7%m7Nf_<$B<R16bi6ftssOT z5C|B0^A9L{4(#piy&oSR{~;EO`BYW4_V@S0VzGb_0-on#x7*(w9v=Q|RDfYLH#aYP zJRUkYI7p+>C_OkhprR=L{oH(pCZQk*D}8-^!)oNOiX;waUAmbJnrxB;c~f<$z%W^K0iPIwXW;?Mg^4J1<7P`OO|ES*4BdO zd1#szpPruX*EB88^Ze(TOs448Qwrre@L6wfZ^Y~MzHMn~fyH9M+}zw(>2$j2qG2i; z8ylBrW@hNx+8XWd?tTZrZdUFmKSr&stt;*A?L+Bw8oI7SlB6L3hWq_l0u~n+-zSqv zr`PKR&+~{xA`t+0W|0F=w4p4^uR1z9I&@tJ!!X#`*k}WgGgClO2mF5jiqGd8ayp$* zRW-i4x;g>i-b`|!L>Gj^Vd`)=aDIM{g@uJL?(Xh>Gn*VJ;lTd>K4e+O*w`2thAH}M zRVj)NqOPtkxLhv8<8j>H-u_ Date: Mon, 5 Sep 2016 10:12:25 +0100 Subject: [PATCH 2/2] cleanup phys check --- dagger.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dagger.lua b/dagger.lua index 843f37c..7e5eb20 100644 --- a/dagger.lua +++ b/dagger.lua @@ -22,7 +22,7 @@ minetest.register_tool("moreores:tin_dagger", { pointedthing.ref:punch(user,1,tindaggercaps) -- explicitly non-physical entities should not incur wear, cater for nil - if not (pointedthing.ref:get_luaentity().physical_state == false) then + if pointedthing.ref:get_luaentity().physical_state ~= false then itemstack:add_wear(math.ceil(65536/maxuses)) end end