Skip to content

Commit

Permalink
Move craft registration from throwing to throwing_arrows
Browse files Browse the repository at this point in the history
  • Loading branch information
paly2 committed Feb 11, 2020
1 parent af62c8f commit 1449f49
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 36 deletions.
3 changes: 0 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand Down
32 changes: 0 additions & 32 deletions init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down Expand Up @@ -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
2 changes: 1 addition & 1 deletion mod.conf
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 1449f49

Please sign in to comment.