From 122245edce64ff88307a27ae43101274bc945e75 Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Sun, 24 Jul 2016 16:32:49 +0200 Subject: Add hand (sort of) --- init.lua | 35 ++++++++++++++++++++++++++++------- 1 file changed, 28 insertions(+), 7 deletions(-) (limited to 'init.lua') diff --git a/init.lua b/init.lua index 157dde6..76de1f7 100644 --- a/init.lua +++ b/init.lua @@ -282,7 +282,13 @@ doc.new_category("tools", { if data then local longdesc = data.longdesc or "N/A" local usagehelp = data.usagehelp or "N/A" - local formstring = "item_image[11,0;1,1;"..data.itemstring.."]" + local formstring = "" + -- TODO: Read hand image from hand definition instead of hardcoding it + if data.itemstring == ":" then + formstring = formstring .. "image[11,0;1,1;wieldhand.png]" + else + formstring = formstring .. "item_image[11,0;1,1;"..data.itemstring.."]" + end formstring = formstring .. "textarea[0.25,1;10,8;;Description: "..longdesc.."\n\n" formstring = formstring .. "Usage: "..usagehelp .. "\n\n" formstring = formstring .. "Maximum stack size: "..data.def.stack_max.. "\n" @@ -298,10 +304,6 @@ doc.new_category("tools", { formstring = formstring .. "Range: "..range.."\n" formstring = formstring .. "\n" - if data.def.tool_capabilities.full_punch_interval ~= nil then - punch = data.def.tool_capabilities.full_punch_interval - end - if data.def.tool_capabilities ~= nil and data.def.tool_capabilities ~= {} then local punch = 1.0 @@ -455,8 +457,6 @@ local function gather_descs() end end - - -- TODO: Add hand for id, def in pairs(minetest.registered_tools) do local name, ld, uh if item_name_overrides[id] ~= nil then @@ -484,6 +484,27 @@ local function gather_descs() end end + -- Add the hand + doc.new_entry("tools", ":", { name = "Hand", data = { longdesc = "You use your bare hand whenever you are not wielding any item. With your hand you can dig the weakest blocks and deal minor damage by punching. Using the hand is often a last resort, as proper mining tools and weapons are usually better than the hand. When you are wielding an item which is not a mining tool or a weapon it will behave is it were the hand when you start mining or punching.", + itemstring = ":", + -- FIXME: The real hand data should be read directly from the original definition + def = { + type = "none", + wield_image = "wieldhand.png", + stack_max = 1, + tool_capabilities = { + full_punch_interval = 0.9, + max_drop_level = 0, + groupcaps = { + crumbly = {times={[2]=3.00, [3]=0.70}, uses=0, maxlevel=1}, + snappy = {times={[3]=0.40}, uses=0, maxlevel=1}, + oddly_breakable_by_hand = {times={[1]=3.50,[2]=2.00,[3]=0.70}, uses=0} + }, + damage_groups = {fleshy=1}, + } + }}}) + + for id, def in pairs(minetest.registered_craftitems) do local name, ld, uh -- cgit v1.2.3