Move craftitems and tools in separate file

s
This commit is contained in:
kilbith 2016-01-07 22:51:58 +01:00
parent 201f402fcb
commit 43824cb4f5
8 changed files with 74 additions and 77 deletions

View File

@ -594,10 +594,6 @@ function realchess.on_move(pos, from_list, from_index, to_list, to_index, count,
return false
end
function realchess.take(pos, listname, index, stack, player)
return 0
end
minetest.register_node(":realchess:chessboard", {
description = "Chess Board",
drawtype = "nodebox",
@ -616,7 +612,7 @@ minetest.register_node(":realchess:chessboard", {
on_receive_fields = realchess.fields,
allow_metadata_inventory_move = realchess.move,
on_metadata_inventory_move = realchess.on_move,
allow_metadata_inventory_take = realchess.take
allow_metadata_inventory_take = function() return 0 end
})
local function register_piece(name, count)
@ -648,11 +644,3 @@ register_piece("bishop", 2)
register_piece("queen")
register_piece("king")
minetest.register_craft({
output = "realchess:chessboard",
recipe = {
{"dye:black", "dye:white", "dye:black"},
{"stairs:slab_wood", "stairs:slab_wood", "stairs:slab_wood"}
}
})

View File

@ -26,7 +26,7 @@ xdecor.register("cauldron_empty", {
on_rotate = screwdriver.rotate_simple,
tiles = {"xdecor_cauldron_top_empty.png", "xdecor_cauldron_sides.png"},
infotext = "Cauldron (empty)",
on_rightclick = function(pos, node, clicker, itemstack, _)
on_rightclick = function(pos, node, clicker, itemstack)
local wield_item = clicker:get_wielded_item():get_name()
if wield_item == "bucket:bucket_water" or
wield_item == "bucket:bucket_river_water" then

60
craftitems.lua Normal file
View File

@ -0,0 +1,60 @@
minetest.register_craftitem("xdecor:bowl", {
description = "Bowl",
inventory_image = "xdecor_bowl.png",
wield_image = "xdecor_bowl.png"
})
minetest.register_craftitem("xdecor:bowl_soup", {
description = "Bowl of soup",
inventory_image = "xdecor_bowl_soup.png",
wield_image = "xdecor_bowl_soup.png",
groups = {not_in_creative_inventory=1},
stack_max = 1,
on_use = function(itemstack, user)
itemstack:replace("xdecor:bowl 1")
if minetest.get_modpath("hunger") then
minetest.item_eat(20)
else
user:set_hp(20)
end
return itemstack
end
})
minetest.register_tool("xdecor:flint_steel", {
description = "Flint & Steel",
inventory_image = "xdecor_flint_steel.png",
tool_capabilities = {
groupcaps = { igniter = {uses=10, maxlevel=1} }
},
on_use = function(itemstack, user, pointed_thing)
local player = user:get_player_name()
if pointed_thing.type == "node" and
minetest.get_node(pointed_thing.above).name == "air" then
if not minetest.is_protected(pointed_thing.above, player) then
minetest.set_node(pointed_thing.above, {name="xdecor:fire"})
else
minetest.chat_send_player(player, "This area is protected.")
end
end
itemstack:add_wear(1000)
return itemstack
end
})
minetest.register_tool("xdecor:hammer", {
description = "Hammer",
inventory_image = "xdecor_hammer.png",
wield_image = "xdecor_hammer.png",
on_use = function() do return end end
})
minetest.register_craftitem("xdecor:honey", {
description = "Honey",
inventory_image = "xdecor_honey.png",
wield_image = "xdecor_honey.png",
groups = {not_in_creative_inventory=1},
on_use = minetest.item_eat(2)
})

View File

@ -31,7 +31,7 @@ xdecor.register("hive", {
return minetest.get_meta(pos):get_inventory():is_empty("honey")
end,
on_punch = function(_, _, puncher)
puncher:set_hp(puncher:get_hp()-4)
puncher:set_hp(puncher:get_hp() - 2)
end,
allow_metadata_inventory_put = function() return 0 end
})

View File

@ -6,13 +6,14 @@ dofile(modpath.."/handlers/nodeboxes.lua")
dofile(modpath.."/handlers/registration.lua")
dofile(modpath.."/chess.lua")
dofile(modpath.."/cooking.lua")
dofile(modpath.."/crafts.lua")
dofile(modpath.."/craftitems.lua")
dofile(modpath.."/enchanting.lua")
dofile(modpath.."/hive.lua")
dofile(modpath.."/itemframe.lua")
dofile(modpath.."/mailbox.lua")
dofile(modpath.."/rope.lua")
dofile(modpath.."/nodes.lua")
dofile(modpath.."/recipes.lua")
dofile(modpath.."/rope.lua")
dofile(modpath.."/sitting.lua")
dofile(modpath.."/worktable.lua")
dofile(modpath.."/xwall.lua")

View File

@ -246,35 +246,6 @@ xdecor.register("fire", {
groups = {dig_immediate=3, hot=3, not_in_creative_inventory=1}
})
minetest.register_tool("xdecor:flint_steel", {
description = "Flint & Steel",
inventory_image = "xdecor_flint_steel.png",
tool_capabilities = {
groupcaps = { igniter = {uses=10, maxlevel=1} }
},
on_use = function(itemstack, user, pointed_thing)
local player = user:get_player_name()
if pointed_thing.type == "node" and
minetest.get_node(pointed_thing.above).name == "air" then
if not minetest.is_protected(pointed_thing.above, player) then
minetest.set_node(pointed_thing.above, {name="xdecor:fire"})
else
minetest.chat_send_player(player, "This area is protected.")
end
end
itemstack:add_wear(1000)
return itemstack
end
})
minetest.register_tool("xdecor:hammer", {
description = "Hammer",
inventory_image = "xdecor_hammer.png",
wield_image = "xdecor_hammer.png",
on_use = function() do return end end
})
xdecor.register("ivy", {
description = "Ivy",
drawtype = "signlike",

View File

@ -24,29 +24,6 @@ minetest.register_craft({
}
})
minetest.register_craftitem("xdecor:bowl", {
description = "Bowl",
inventory_image = "xdecor_bowl.png",
wield_image = "xdecor_bowl.png"
})
minetest.register_craftitem("xdecor:bowl_soup", {
description = "Bowl of soup",
inventory_image = "xdecor_bowl_soup.png",
wield_image = "xdecor_bowl_soup.png",
groups = {not_in_creative_inventory = 1},
stack_max = 1,
on_use = function(itemstack, user)
itemstack:replace("xdecor:bowl 1")
if minetest.get_modpath("hunger") then
minetest.item_eat(20)
else
user:set_hp(20)
end
return itemstack
end
})
minetest.register_craft({
output = "xdecor:candle",
recipe = {
@ -70,6 +47,14 @@ minetest.register_craft({
}
})
minetest.register_craft({
output = "realchess:chessboard",
recipe = {
{"dye:black", "dye:white", "dye:black"},
{"stairs:slab_wood", "stairs:slab_wood", "stairs:slab_wood"}
}
})
minetest.register_craft({
output = "xdecor:cushion 2",
recipe = {
@ -213,14 +198,6 @@ minetest.register_craft({
}
})
minetest.register_craftitem("xdecor:honey", {
description = "Honey",
inventory_image = "xdecor_honey.png",
wield_image = "xdecor_honey.png",
groups = {not_in_creative_inventory=1},
on_use = minetest.item_eat(2)
})
minetest.register_craft({
output = "xdecor:ivy 4",
recipe = {

Binary file not shown.

Before

Width:  |  Height:  |  Size: 238 B

After

Width:  |  Height:  |  Size: 210 B