mirror of
https://github.com/minetest-mods/throwing.git
synced 2025-01-09 09:40:26 +01:00
Move craft registration from throwing to throwing_arrows
This commit is contained in:
parent
af62c8f9b5
commit
1449f49af7
@ -30,7 +30,6 @@ function throwing.register_bow(name, definition)
|
|||||||
--[[
|
--[[
|
||||||
Name: Bow name. If it doesn't contain ":", the "throwing:" prefix will be added.
|
Name: Bow name. If it doesn't contain ":", the "throwing:" prefix will be added.
|
||||||
Definition: definition table, containing:
|
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.
|
* description (highly recommended): description of the bow.
|
||||||
* texture (essential): texture of the bow, shown in inventory.
|
* texture (essential): texture of the bow, shown in inventory.
|
||||||
* groups (optional): groups of the item.
|
* 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.
|
Name: Arrow name. If it doesn't contain ":", the "throwing:" prefix will be added.
|
||||||
Definition: definition table, containing:
|
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.
|
* 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).
|
* 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
|
* allow_protected (optional, defaulting to false): whether the arrow can be throw in a protected area
|
||||||
|
32
init.lua
32
init.lua
@ -291,21 +291,6 @@ function throwing.register_arrow(name, def)
|
|||||||
on_hit_fails = def.on_hit_fails,
|
on_hit_fails = def.on_hit_fails,
|
||||||
item = name,
|
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
|
end
|
||||||
|
|
||||||
|
|
||||||
@ -378,21 +363,4 @@ function throwing.register_bow(name, def)
|
|||||||
return itemstack
|
return itemstack
|
||||||
end
|
end
|
||||||
minetest.register_tool(name, def)
|
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
|
end
|
||||||
|
2
mod.conf
2
mod.conf
@ -1,3 +1,3 @@
|
|||||||
name = throwing
|
name = throwing
|
||||||
optional_depends = wielded_light, farming
|
optional_depends = wielded_light
|
||||||
description = Throwing library: provides an API for registering throwing and throwable things
|
description = Throwing library: provides an API for registering throwing and throwable things
|
||||||
|
Loading…
Reference in New Issue
Block a user