Move craft registration from throwing to throwing_arrows

This commit is contained in:
upsilon 2020-02-11 20:00:49 +01:00
parent af62c8f9b5
commit 1449f49af7
No known key found for this signature in database
GPG Key ID: A80DAE1F266E1C3C
3 changed files with 1 additions and 36 deletions

View File

@ -30,7 +30,6 @@ function throwing.register_bow(name, definition)
--[[
Name: Bow name. If it doesn't contain ":", the "throwing:" prefix will be added.
Definition: definition table, containing:
* itemcraft (optional, you may want to register your own craft or to make the bow uncraftable): item used to craft the bow.
* description (highly recommended): description of the bow.
* texture (essential): texture of the bow, shown in inventory.
* groups (optional): groups of the item.
@ -64,8 +63,6 @@ function throwing.register_arrow(name, definition table)
--[[
Name: Arrow name. If it doesn't contain ":", the "throwing:" prefix will be added.
Definition: definition table, containing:
* itemcraft (optional, you may want to register your own craft or to make the arrow uncraftable): item used to craft the arrow.
* craft_quantity (optional, defaulting to 1 if itemcraft is non-nil, pointless otherwise): quantity of arrows in the craft output.
* tiles (essential): tiles of the arrow.
* target (optional, defaulting to throwing.target_both): what the arrow is able to hit (throwing.target_node, throwing.target_object, throwing.target_both).
* allow_protected (optional, defaulting to false): whether the arrow can be throw in a protected area

View File

@ -291,21 +291,6 @@ function throwing.register_arrow(name, def)
on_hit_fails = def.on_hit_fails,
item = name,
})
if def.itemcraft then
minetest.register_craft({
output = name.." "..tostring(def.craft_quantity or 1),
recipe = {
{def.itemcraft, "default:stick", "default:stick"}
}
})
minetest.register_craft({
output = name.." "..tostring(def.craft_quantity or 1),
recipe = {
{ "default:stick", "default:stick", def.itemcraft}
}
})
end
end
@ -378,21 +363,4 @@ function throwing.register_bow(name, def)
return itemstack
end
minetest.register_tool(name, def)
if def.itemcraft then
-- Check for an override name
-- because an ``output = ":name"'' can't exist in a recipe
local output_name = name
if name:sub(1,1) == ":" then
output_name = name:sub(2)
end
minetest.register_craft({
output = output_name,
recipe = {
{"farming:cotton", def.itemcraft, ""},
{"farming:cotton", "", def.itemcraft},
{"farming:cotton", def.itemcraft, ""},
}
})
end
end

View File

@ -1,3 +1,3 @@
name = throwing
optional_depends = wielded_light, farming
optional_depends = wielded_light
description = Throwing library: provides an API for registering throwing and throwable things