forked from VoxeLibre/VoxeLibre
part 2
This commit is contained in:
parent
182e825303
commit
72149a2c56
|
@ -217,8 +217,7 @@ minetest.register_craftitem("mcl_buckets:bucket_empty", {
|
||||||
end
|
end
|
||||||
|
|
||||||
elseif minetest.get_item_group(nn, "cauldron") then
|
elseif minetest.get_item_group(nn, "cauldron") then
|
||||||
mcl_cauldrons.take_cauldron(pos, itemstack)
|
mcl_cauldrons.take_cauldron(pointed_thing.under, new_bucket, user)
|
||||||
-- Take water out of full cauldron
|
|
||||||
minetest.set_node(pointed_thing.under, {name="mcl_cauldrons:cauldron"})
|
minetest.set_node(pointed_thing.under, {name="mcl_cauldrons:cauldron"})
|
||||||
if not minetest.is_creative_enabled(user:get_player_name()) then
|
if not minetest.is_creative_enabled(user:get_player_name()) then
|
||||||
new_bucket = ItemStack("mcl_buckets:bucket_water")
|
new_bucket = ItemStack("mcl_buckets:bucket_water")
|
||||||
|
|
|
@ -67,25 +67,45 @@ minetest.register_node("mcl_cauldrons:cauldron", {
|
||||||
})
|
})
|
||||||
|
|
||||||
function mcl_cauldrons.set_cauldron(pos, type, level)
|
function mcl_cauldrons.set_cauldron(pos, type, level)
|
||||||
if cauldrons_list["mcl_cauldrons:cauldron_"..type.."_"..level] then
|
minetest.set_node(pos, {name = mcl_cauldrons.get_cauldron_string(type, level)})
|
||||||
minetest.set_node(pos, {name="mcl_cauldrons:cauldron_"..type.."_"..level})
|
return true
|
||||||
return true
|
end
|
||||||
|
|
||||||
|
function mcl_cauldrons.take_cauldron(pos, itemstack, user)
|
||||||
|
if user and not minetest.is_creative_enabled(user:get_player_name()) then
|
||||||
|
return ItemStack("mcl_buckets:bucket_water")
|
||||||
else
|
else
|
||||||
minetest.log("error", "[mcl_cauldrons] trying to set invalid cauldron")
|
return itemstack
|
||||||
return false
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function mcl_cauldrons.take_cauldron(pos, itemstack, sound)
|
function mcl_cauldrons.get_cauldron_string(type, level)
|
||||||
|
if cauldrons_list["mcl_cauldrons:cauldron_"..type.."_"..level] then
|
||||||
|
return "mcl_cauldrons:cauldron_"..type.."_"..level
|
||||||
|
else
|
||||||
|
minetest.log("warning", "[mcl_cauldrons] trying to get string from invalid cauldron params")
|
||||||
|
return "air"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function mcl_cauldrons.add_cauldron_level(pos, number)
|
||||||
|
local nn = minetest.get_node(pos).name
|
||||||
|
if cauldrons_list[nn] and number >= 1 and number <= 3 then
|
||||||
|
local nb = minetest.get_item_group(nn, "cauldron_filled")
|
||||||
|
if nb > 3 then nb = 3 end
|
||||||
|
|
||||||
|
else
|
||||||
|
minetest.log("error", "[mcl_cauldrons] trying to add level to not cauldron node at "..minetest.serialize(pos))
|
||||||
|
end
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
function mcl_cauldrons.register_cauldron_type(name, desc, texture)
|
function mcl_cauldrons.register_cauldron_type(def)
|
||||||
for water_level = 1,3 do
|
for water_level = 1,3 do
|
||||||
local id = "mcl_cauldrons:cauldron_"..name.."_"..water_level
|
local id = "mcl_cauldrons:cauldron_"..def.name.."_"..water_level
|
||||||
cauldrons_list[id] = true
|
cauldrons_list[id] = true
|
||||||
minetest.register_node(id, {
|
minetest.register_node(id, {
|
||||||
description = string.format(desc, water_level),
|
description = string.format(def.desc, water_level),
|
||||||
_doc_items_create_entry = false,
|
_doc_items_create_entry = false,
|
||||||
use_texture_alpha = minetest.features.use_texture_alpha_string_modes and "opaque" or false,
|
use_texture_alpha = minetest.features.use_texture_alpha_string_modes and "opaque" or false,
|
||||||
drawtype = "nodebox",
|
drawtype = "nodebox",
|
||||||
|
@ -96,7 +116,7 @@ function mcl_cauldrons.register_cauldron_type(name, desc, texture)
|
||||||
collision_box = cauldron_nodeboxes[0],
|
collision_box = cauldron_nodeboxes[0],
|
||||||
selection_box = { type = "regular" },
|
selection_box = { type = "regular" },
|
||||||
tiles = {
|
tiles = {
|
||||||
"("..texture.."^[verticalframe:16:0"..")^mcl_cauldrons_cauldron_top.png",
|
"("..def.texture.."^[verticalframe:16:0"..")^mcl_cauldrons_cauldron_top.png",
|
||||||
"mcl_cauldrons_cauldron_inner.png^mcl_cauldrons_cauldron_bottom.png",
|
"mcl_cauldrons_cauldron_inner.png^mcl_cauldrons_cauldron_bottom.png",
|
||||||
"mcl_cauldrons_cauldron_side.png"
|
"mcl_cauldrons_cauldron_side.png"
|
||||||
},
|
},
|
||||||
|
@ -113,49 +133,12 @@ function mcl_cauldrons.register_cauldron_type(name, desc, texture)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Template function for cauldrons with water
|
mcl_cauldrons.register_cauldron_type({
|
||||||
local register_filled_cauldron = function(water_level, description, river_water)
|
name = "water",
|
||||||
local id = "mcl_cauldrons:cauldron_"..water_level
|
bucket = "mcl_buckets:bucket_water",
|
||||||
local water_tex
|
desc = S("Cauldron (%s/3 Water)"),
|
||||||
if river_water then
|
texture = "default_water_source_animated.png"
|
||||||
id = id .. "r"
|
})
|
||||||
water_tex = "default_river_water_source_animated.png^[verticalframe:16:0"
|
|
||||||
else
|
|
||||||
water_tex = "default_water_source_animated.png^[verticalframe:16:0"
|
|
||||||
end
|
|
||||||
minetest.register_node(id, {
|
|
||||||
description = description,
|
|
||||||
_doc_items_create_entry = false,
|
|
||||||
use_texture_alpha = minetest.features.use_texture_alpha_string_modes and "opaque" or false,
|
|
||||||
drawtype = "nodebox",
|
|
||||||
paramtype = "light",
|
|
||||||
is_ground_content = false,
|
|
||||||
groups = {pickaxey=1, not_in_creative_inventory=1, cauldron=(1+water_level), cauldron_filled=water_level, comparator_signal=water_level},
|
|
||||||
node_box = cauldron_nodeboxes[water_level],
|
|
||||||
collision_box = cauldron_nodeboxes[0],
|
|
||||||
selection_box = { type = "regular" },
|
|
||||||
tiles = {
|
|
||||||
"("..water_tex..")^mcl_cauldrons_cauldron_top.png",
|
|
||||||
"mcl_cauldrons_cauldron_inner.png^mcl_cauldrons_cauldron_bottom.png",
|
|
||||||
"mcl_cauldrons_cauldron_side.png"
|
|
||||||
},
|
|
||||||
sounds = mcl_sounds.node_sound_metal_defaults(),
|
|
||||||
drop = "mcl_cauldrons:cauldron",
|
|
||||||
_mcl_hardness = 2,
|
|
||||||
_mcl_blast_resistance = 2,
|
|
||||||
})
|
|
||||||
|
|
||||||
-- Add entry aliases for the Help
|
|
||||||
if minetest.get_modpath("doc") then
|
|
||||||
doc.add_entry_alias("nodes", "mcl_cauldrons:cauldron", "nodes", id)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Filled cauldrons (3 levels)
|
|
||||||
--register_filled_cauldron(1, S("Cauldron (1/3 Water)"))
|
|
||||||
--register_filled_cauldron(2, S("Cauldron (2/3 Water)"))
|
|
||||||
--register_filled_cauldron(3, S("Cauldron (3/3 Water)"))
|
|
||||||
mcl_cauldrons.register_cauldron_type("water", S("Cauldron (%s/3 Water)"), "default_water_source_animated.png")
|
|
||||||
|
|
||||||
if minetest.get_modpath("mclx_core") then
|
if minetest.get_modpath("mclx_core") then
|
||||||
--register_filled_cauldron(1, S("Cauldron (1/3 River Water)"), true)
|
--register_filled_cauldron(1, S("Cauldron (1/3 River Water)"), true)
|
||||||
|
|
Loading…
Reference in New Issue