Merge remote-tracking branch 'origin/buckets'

This commit is contained in:
Kotolegokot 2012-10-15 17:31:00 +06:00
commit 04417393a3
33 changed files with 108 additions and 197 deletions

View File

@ -144,85 +144,48 @@ minetest.register_node("anvil:self", {
inv:set_stack("ingot",1,ingotstack)
hammerstack:add_wear(65535/30)
inv:set_stack("hammer",1,hammerstack)
return
elseif recipestack:get_name()=="metals:recipe_hammer" then
inv:add_item("res","metals:tool_hammer_"..string.sub(s,8,string.len(s)-6).."_head")
ingotstack:take_item()
inv:set_stack("ingot",1,ingotstack)
hammerstack:add_wear(65535/30)
inv:set_stack("hammer",1,hammerstack)
return
elseif recipestack:get_name()=="metals:recipe_pick" then
inv:add_item("res","metals:tool_pick_"..string.sub(s,8,string.len(s)-6).."_head")
ingotstack:take_item()
inv:set_stack("ingot",1,ingotstack)
hammerstack:add_wear(65535/30)
inv:set_stack("hammer",1,hammerstack)
return
elseif recipestack:get_name()=="metals:recipe_shovel" then
inv:add_item("res","metals:tool_shovel_"..string.sub(s,8,string.len(s)-6).."_head")
ingotstack:take_item()
inv:set_stack("ingot",1,ingotstack)
hammerstack:add_wear(65535/30)
inv:set_stack("hammer",1,hammerstack)
return
elseif recipestack:get_name()=="metals:recipe_spear" then
inv:add_item("res","metals:tool_spear_"..string.sub(s,8,string.len(s)-6).."_head")
ingotstack:take_item()
inv:set_stack("ingot",1,ingotstack)
hammerstack:add_wear(65535/30)
inv:set_stack("hammer",1,hammerstack)
return
elseif recipestack:get_name()=="metals:recipe_sword" then
inv:add_item("res","metals:tool_sword_"..string.sub(s,8,string.len(s)-6).."_head")
ingotstack:take_item()
inv:set_stack("ingot",1,ingotstack)
hammerstack:add_wear(65535/30)
inv:set_stack("hammer",1,hammerstack)
return
elseif recipestack:get_name()=="metals:recipe_bucket" then
inv:add_item("res","metals:bucket_empty_"..string.sub(s,8,string.len(s)-6))
ingotstack:take_item()
inv:set_stack("ingot",1,ingotstack)
hammerstack:add_wear(65535/30)
inv:set_stack("hammer",1,hammerstack)
elseif ingotstack:get_name()=="metals:pig_iron_ingot" then
inv:add_item("res","metals:wrought_iron_ingot")
ingotstack:take_item()
inv:set_stack("ingot",1,ingotstack)
hammerstack:add_wear(65535/30)
inv:set_stack("hammer",1,hammerstack)
return
--moreores
elseif ingotstack:get_name()=="metals:gold_ingot" and minetest.get_modpath("moreores") ~= nil then
inv:add_item("res","moreores:gold_ingot")
ingotstack:take_item()
inv:set_stack("ingot",1,ingotstack)
hammerstack:add_wear(65535/30)
inv:set_stack("hammer",1,hammerstack)
return
elseif ingotstack:get_name()=="metals:silver_ingot" and minetest.get_modpath("moreores") ~= nil then
inv:add_item("res","moreores:silver_ingot")
ingotstack:take_item()
inv:set_stack("ingot",1,ingotstack)
hammerstack:add_wear(65535/30)
inv:set_stack("hammer",1,hammerstack)
return
elseif ingotstack:get_name()=="metals:tin_ingot" and minetest.get_modpath("moreores") ~= nil then
inv:add_item("res","moreores:tin_ingot")
ingotstack:take_item()
inv:set_stack("ingot",1,ingotstack)
hammerstack:add_wear(65535/30)
inv:set_stack("hammer",1,hammerstack)
return
elseif ingotstack:get_name()=="metals:copper_ingot" and minetest.get_modpath("moreores") ~= nil then
inv:add_item("res","moreores:copper_ingot")
ingotstack:take_item()
inv:set_stack("ingot",1,ingotstack)
hammerstack:add_wear(65535/30)
inv:set_stack("hammer",1,hammerstack)
return
elseif ingotstack:get_name()=="metals:bronze_ingot" and minetest.get_modpath("moreores") ~= nil then
ingotstack:take_item()
inv:add_item("res","moreores:bronze_ingot")
inv:set_stack("ingot",1,ingotstack)
hammerstack:add_wear(65535/30)
inv:set_stack("hammer",1,hammerstack)
return
--[[elseif string.sub(ingotstack:get_name(), 1, 6)=="metals" and string.sub(ingotstack:get_name(),string.len(ingotstack:get_name())-9,9)=="_unshaped" then
inv:add_item("res", "metals:"..string.sub(ingotstack:get_name(),7,string.len(ingotstack:get_name())-13).."_ingot")
ingotstack:take_item()

View File

@ -1,26 +0,0 @@
Minetest 0.4 mod: bucket
=========================
License of source code:
-----------------------
Copyright (C) 2011-2012 Kahrl <kahrl@gmx.net>
Copyright (C) 2011-2012 celeron55, Perttu Ahola <celeron55@gmail.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
http://www.gnu.org/licenses/lgpl-2.1.html
License of media (textures and sounds)
--------------------------------------
Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0)
http://creativecommons.org/licenses/by-sa/3.0/
Authors of media files
-----------------------
Everything not listed in here:
Copyright (C) 2010-2012 celeron55, Perttu Ahola <celeron55@gmail.com>

View File

@ -1,2 +0,0 @@
default

View File

@ -1,88 +0,0 @@
-- Minetest 0.4 mod: bucket
-- See README.txt for licensing and other information.
minetest.register_alias("bucket", "bucket:bucket_empty")
minetest.register_alias("bucket_water", "bucket:bucket_water")
minetest.register_alias("bucket_lava", "bucket:bucket_lava")
bucket = {}
bucket.liquids = {}
-- Register a new liquid
-- source = name of the source node
-- flowing = name of the flowing node
-- itemname = name of the new bucket item (or nil if liquid is not takeable)
-- inventory_image = texture of the new bucket item (ignored if itemname == nil)
-- This function can be called from any mod (that depends on bucket).
function bucket.register_liquid(source, flowing, itemname, inventory_image)
bucket.liquids[source] = {
source = source,
flowing = flowing,
itemname = itemname,
}
bucket.liquids[flowing] = bucket.liquids[source]
if itemname ~= nil then
minetest.register_craftitem(itemname, {
inventory_image = inventory_image,
stack_max = 1,
liquids_pointable = true,
on_use = function(itemstack, user, pointed_thing)
-- Must be pointing to node
if pointed_thing.type ~= "node" then
return
end
-- Check if pointing to a liquid
n = minetest.env:get_node(pointed_thing.under)
if bucket.liquids[n.name] == nil then
-- Not a liquid
minetest.env:add_node(pointed_thing.above, {name=source})
elseif n.name ~= source then
-- It's a liquid
minetest.env:add_node(pointed_thing.under, {name=source})
end
return {name="bucket:bucket_empty"}
end
})
end
end
minetest.register_craftitem("bucket:bucket_empty", {
description = "Emtpy bucket",
inventory_image = "bucket.png",
stack_max = 1,
liquids_pointable = true,
on_use = function(itemstack, user, pointed_thing)
-- Must be pointing to node
if pointed_thing.type ~= "node" then
return
end
-- Check if pointing to a liquid source
n = minetest.env:get_node(pointed_thing.under)
liquiddef = bucket.liquids[n.name]
if liquiddef ~= nil and liquiddef.source == n.name and liquiddef.itemname ~= nil then
minetest.env:add_node(pointed_thing.under, {name="air"})
return {name=liquiddef.itemname}
end
end,
})
bucket.register_liquid(
"default:water_source",
"default:water_flowing",
"bucket:bucket_water",
"bucket_water.png"
)
bucket.register_liquid(
"default:lava_source",
"default:lava_flowing",
"bucket:bucket_lava",
"bucket_lava.png"
)
minetest.register_craft({
type = "fuel",
recipe = "bucket:bucket_lava",
burntime = 60,
})

Binary file not shown.

Before

Width:  |  Height:  |  Size: 329 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 363 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 369 B

76
mods/metals/buckets.lua Normal file
View File

@ -0,0 +1,76 @@
bucket = {}
bucket.liquids = {}
function bucket.register_liquid(source, flowing, itemname, inventory_image)
bucket.liquids[source] = {
source = source,
flowing = flowing,
itemname = itemname,
}
bucket.liquids[flowing] = bucket.liquids[source]
if itemname ~= nil then
for i = 1,#METALS_LIST do
minetest.register_craftitem(itemname.."_"..METALS_LIST[i], {
inventory_image = "metals_"..METALS_LIST[i].."_bucket.png^"..inventory_image,
stack_max = 1,
liquids_pointable = true,
on_use = function(itemstack, user, pointed_thing)
-- Must be pointing to node
if pointed_thing.type ~= "node" then
return
end
-- Check if pointing to a liquid
n = minetest.env:get_node(pointed_thing.under)
if bucket.liquids[n.name] == nil then
-- Not a liquid
--if minetest.env:get_node(pointed_thing.above) == "air" then
minetest.env:add_node(pointed_thing.above, {name=source})
-- end
elseif n.name ~= source then
-- It's a liquid
minetest.env:add_node(pointed_thing.under, {name=source})
end
return {name="metals:bucket_empty_"..METALS_LIST[i]}
end
})
end
end
end
for i = 1,#METALS_LIST do
minetest.register_craftitem("metals:bucket_empty_"..METALS_LIST[i], {
description = "Emtpy " .. DESC_LIST[i] .. " Bucket",
inventory_image = "metals_"..METALS_LIST[i].."_bucket.png",
stack_max = 1,
liquids_pointable = true,
on_use = function(itemstack, user, pointed_thing)
-- Must be pointing to node
if pointed_thing.type ~= "node" then
return
end
-- Check if pointing to a liquid source
n = minetest.env:get_node(pointed_thing.under)
liquiddef = bucket.liquids[n.name]
if liquiddef ~= nil and liquiddef.source == n.name and liquiddef.itemname ~= nil then
minetest.env:add_node(pointed_thing.under, {name="air"})
return {name=liquiddef.itemname.."_"..METALS_LIST[i]}
end
end,
})
end
bucket.register_liquid(
"default:water_source",
"default:water_flowing",
"metals:bucket_water",
"metals_water.png"
)
bucket.register_liquid(
"default:lava_source",
"default:lava_flowing",
"metals:bucket_lava",
"metals_lava.png"
)

View File

@ -1,2 +1,2 @@
minerals
default
minerals

View File

@ -75,6 +75,7 @@ DESC_SMALL_LIST={
dofile(minetest.get_modpath("metals").."/groupcaps.lua")
dofile(minetest.get_modpath("metals").."/buckets.lua")
for i=1, #METALS_LIST do
@ -261,14 +262,6 @@ for i=1, #METALS_LIST do
},
})
minetest.register_craft({
output = 'bucket:bucket_empty',
recipe = {
{"metals:"..METALS_LIST[i].."_ingot", '', "metals:"..METALS_LIST[i].."_ingot"},
{'', "metals:"..METALS_LIST[i].."_ingot", ''},
}
})
minetest.register_craft({
output = 'sawing_table:self',
recipe = {
@ -452,35 +445,23 @@ end
-- Recipes
--
minetest.register_craftitem("metals:recipe_pick", {
description = "Pick recipe",
inventory_image = "metals_recipe.png",
})
local recipes = {
{"metals:recipe_pick", "Pick recipe"},
{"metals:recipe_axe", "Axe recipe"},
{"metals:recipe_shovel", "Shovel recipe"},
{"metals:recipe_sword", "Sword recipe"},
{"metals:recipe_hammer", "Hammer recipe"},
{"metals:recipe_spear", "Spear recipe"},
{"metals:recipe_bucket","Bucket recipe"},
}
minetest.register_craftitem("metals:recipe_axe", {
description = "Axe recipe",
inventory_image = "metals_recipe.png",
})
minetest.register_craftitem("metals:recipe_shovel", {
description = "Shovel recipe",
inventory_image = "metals_recipe.png",
})
minetest.register_craftitem("metals:recipe_sword", {
description = "Sword recipe",
inventory_image = "metals_recipe.png",
})
minetest.register_craftitem("metals:recipe_hammer", {
description = "Hammer recipe",
inventory_image = "metals_recipe.png",
})
minetest.register_craftitem("metals:recipe_spear", {
description = "Spear recipe",
inventory_image = "metals_recipe.png",
})
for _, recipe in ipairs(recipes) do
minetest.register_craftitem(recipe[1], {
description = recipe[2],
inventory_image = "metals_recipe.png",
stack_max = 1,
})
end
--
-- Alloys

Binary file not shown.

After

Width:  |  Height:  |  Size: 354 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 378 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 375 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 357 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 337 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 379 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 374 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 378 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 376 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 458 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 369 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 379 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 379 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 368 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 370 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 367 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 346 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 378 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 359 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 436 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 355 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 370 B

View File

@ -52,6 +52,13 @@ local recipes = {
0,1,1,0,0,
1,0,0,0,0,}
},
{"metals:recipe_bucket",
{1,0,0,0,1,
1,0,0,0,1,
1,0,0,0,1,
1,0,0,0,1,
0,1,1,1,0,}
},
}
local function check_recipe(pos)