diff --git a/dagger.lua b/dagger.lua new file mode 100644 index 0000000..7e5eb20 --- /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 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 da4409f..d0b08a1 100644 --- a/init.lua +++ b/init.lua @@ -380,6 +380,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 0000000..fb750e9 Binary files /dev/null and b/textures/moreores_tin_dagger.png differ