Merge branch 'river_water'

This commit is contained in:
Wuzzy 2017-12-05 23:01:05 +01:00
commit ff1996c708
30 changed files with 368 additions and 90 deletions

View file

@ -50,6 +50,7 @@ Please read <http://minecraft.gamepedia.com/Breaking> to learn how digging times
* `destroys_items=1`: If an item happens to be *inside* this node, the item will be destroyed
* `no_eat_delay=1`: Only for foodstuffs. When eating this, all eating delays are ignored.
* `can_eat_when_full=1`: Only for foodstuffs. This item can be eaten when the user has a full hunger bar
* `cauldron`: Cauldron. 1: Empty. 2-4: Water height
#### Footnotes
@ -73,6 +74,7 @@ Please read <http://minecraft.gamepedia.com/Breaking> to learn how digging times
* `wool=1`: Wool (only full blocks)
* `carpet=1:` (Wool) carpet
* `stick=1`: Stick
* `water_bucket=1`: Bucket containing a liquid of group “water”
### Material groups

View file

@ -81,6 +81,7 @@ mobs_mc.items = {
gunpowder = "tnt:gunpowder",
flint_and_steel = "fire:flint_and_steel",
water_source = "default:water_source",
river_water_source = "default:river_water_source",
black_dye = "dye:black",
poppy = "flowers:rose",
dandelion = "flowers:dandelion_yellow",

View file

@ -73,7 +73,7 @@ mobs:register_mob("mobs_mc:guardian", {
max = 1,},
},
fly = true,
fly_in = mobs_mc.items.water_source,
fly_in = { mobs_mc.items.water_source, mobs_mc.items.river_water_source },
view_range = 16,
water_damage = 0,
lava_damage = 4,

View file

@ -78,7 +78,7 @@ mobs:register_mob("mobs_mc:guardian_elder", {
max = 1,},
},
fly = true,
fly_in = mobs_mc.items.water_source,
fly_in = { mobs_mc.items.water_source, mobs_mc.items.river_water_source },
water_damage = 0,
lava_damage = 4,
light_damage = 0,

View file

@ -43,8 +43,7 @@ mobs:register_mob("mobs_mc:squid", {
makes_footstep_sound = false,
stepheight = 1.1,
fly = true,
-- fly_in = mobs_mc.items.water_source, fuck this
fly_in = {"mcl_core:water_source", "default:water_source"},
fly_in = { mobs_mc.items.water_source, mobs_mc.items.river_water_source },
jump = true,
jump_height = 1.25,
jump_chance = 98,

View file

@ -55,6 +55,7 @@ mobs_mc.override.items = {
gunpowder = "mcl_mobitems:gunpowder",
flint_and_steel = "mcl_fire:flint_and_steel",
water_source = "mcl_core:water_source",
river_water_source = "mclx_core:river_water_source",
black_dye = "mcl_dye:black",
poppy = "mcl_flowers:poppy",
dandelion = "mcl_flowers:dandelion",

View file

@ -221,6 +221,7 @@ if mcl_weather.allow_abm then
interval = 56.0,
chance = 1,
action = function(pos, node, active_object_count, active_object_count_wider)
-- Rain is equivalent to a water bottle
if mcl_weather.rain.raining and mcl_weather.is_outdoor(pos) then
if node.name == "mcl_cauldrons:cauldron" then
minetest.set_node(pos, {name="mcl_cauldrons:cauldron_1"})
@ -228,6 +229,10 @@ if mcl_weather.allow_abm then
minetest.set_node(pos, {name="mcl_cauldrons:cauldron_2"})
elseif node.name == "mcl_cauldrons:cauldron_2" then
minetest.set_node(pos, {name="mcl_cauldrons:cauldron_3"})
elseif node.name == "mcl_cauldrons:cauldron_1r" then
minetest.set_node(pos, {name="mcl_cauldrons:cauldron_2r"})
elseif node.name == "mcl_cauldrons:cauldron_2r" then
minetest.set_node(pos, {name="mcl_cauldrons:cauldron_3r"})
end
end
end

View file

@ -68,11 +68,7 @@ local dispenserdef = {
droppos = {x=pos.x, y=pos.y-1, z=pos.z}
end
local dropnode = minetest.get_node(droppos)
-- Do not dispense into solid nodes
local dropnodedef = minetest.registered_nodes[dropnode.name]
if dropnodedef.walkable then
return
end
local stacks = {}
for i=1,inv:get_size("main") do
local stack = inv:get_stack("main", i)
@ -88,8 +84,12 @@ local dispenserdef = {
local iname = stack:get_name()
local igroups = minetest.registered_items[iname].groups
-- Do not dispense into solid nodes. Exception: Water bucket into cauldron
if dropnodedef.walkable and not (minetest.get_item_group(dropnode.name, "cauldron") ~= 0 and (iname == "mcl_buckets:bucket_water" or iname == "mcl_buckets:bucket_river_water")) then
-- no-op
--[===[ Dispense item ]===]
if iname == "mcl_throwing:arrow" then
elseif iname == "mcl_throwing:arrow" then
-- Shoot arrow
local shootpos = vector.add(pos, vector.multiply(dropdir, 0.51))
local yaw = math.atan2(dropdir.z, dropdir.x) - math.pi/2
@ -153,6 +153,9 @@ local dispenserdef = {
elseif dropnode.name == "mcl_core:lava_source" or dropnode.name == "mcl_nether:nether_lava_source" then
collect_liquid = true
bucket_id = "mcl_buckets:bucket_lava"
elseif dropnode.name == "mclx_core:river_water_source" then
collect_liquid = true
bucket_id = "mcl_buckets:bucket_river_water"
end
if collect_liquid then
minetest.set_node(droppos, {name="air"})
@ -175,9 +178,18 @@ local dispenserdef = {
stack:take_item()
inv:set_stack("main", stack_id, stack)
end
elseif iname == "mcl_buckets:bucket_water" or iname == "mcl_buckets:bucket_lava" then
elseif iname == "mcl_buckets:bucket_water" or iname == "mcl_buckets:bucket_river_water" or iname == "mcl_buckets:bucket_lava" then
local do_empty = false
-- Place water/lava source
if dropnodedef.buildable_to then
if minetest.get_item_group(dropnode.name, "cauldron") ~= 0 then
if iname == "mcl_buckets:bucket_water" then
minetest.set_node(droppos, {name = "mcl_cauldrons:cauldron_3"})
do_empty = true
elseif iname == "mcl_buckets:bucket_river_water" then
minetest.set_node(droppos, {name = "mcl_cauldrons:cauldron_3r"})
do_empty = true
end
elseif dropnodedef.buildable_to then
local dim = mcl_worlds.pos_to_dimension(droppos)
if iname == "mcl_buckets:bucket_water" then
if dim == "nether" then
@ -185,14 +197,25 @@ local dispenserdef = {
else
minetest.set_node(droppos, {name = "mcl_core:water_source"})
end
do_empty = true
elseif iname == "mcl_buckets:bucket_river_water" then
if dim == "nether" then
minetest.sound_play("fire_extinguish_flame", {pos = droppos, gain = 0.25, max_hear_distance = 16})
else
minetest.set_node(droppos, {name = "mclx_core:river_water_source"})
end
do_empty = true
elseif iname == "mcl_buckets:bucket_lava" then
if dim == "nether" then
minetest.set_node(droppos, {name = "mcl_nether:nether_lava_source"})
else
minetest.set_node(droppos, {name = "mcl_core:lava_source"})
end
do_empty = true
end
end
if do_empty then
stack:take_item()
inv:set_stack("main", stack_id, stack)

View file

@ -203,6 +203,12 @@ for colorid, colortab in pairs(mcl_banners.colors) do
new_node = "mcl_cauldrons:cauldron_1"
elseif node_under.name == "mcl_cauldrons:cauldron_1" then
new_node = "mcl_cauldrons:cauldron"
elseif node_under.name == "mcl_cauldrons:cauldron_3r" then
new_node = "mcl_cauldrons:cauldron_2r"
elseif node_under.name == "mcl_cauldrons:cauldron_2r" then
new_node = "mcl_cauldrons:cauldron_1r"
elseif node_under.name == "mcl_cauldrons:cauldron_1r" then
new_node = "mcl_cauldrons:cauldron"
end
if new_node then
local imeta = itemstack:get_meta()

View file

@ -1,3 +1,4 @@
mcl_worlds
mcl_core?
mclx_core?
doc?

View file

@ -7,6 +7,7 @@ minetest.register_alias("bucket:bucket_lava", "mcl_buckets:bucket_lava")
local mod_doc = minetest.get_modpath("doc")
local mod_mcl_core = minetest.get_modpath("mcl_core")
local mod_mclx_core = minetest.get_modpath("mclx_core")
if mod_mcl_core then
minetest.register_craft({
@ -47,9 +48,10 @@ end
-- longdesc = long explanatory description (for help)
-- usagehelp = short usage explanation (for help)
-- extra_check = optional function(pos) which can returns false to avoid placing the liquid
-- groups = optional list of item groups
--
-- This function can be called from any mod (which depends on this one)
function mcl_buckets.register_liquid(source_place, source_take, itemname, inventory_image, name, longdesc, usagehelp, extra_check)
function mcl_buckets.register_liquid(source_place, source_take, itemname, inventory_image, name, longdesc, usagehelp, extra_check, groups)
for i=1, #source_take do
mcl_buckets.liquids[source_take[i]] = {
source_place = source_place,
@ -69,6 +71,7 @@ function mcl_buckets.register_liquid(source_place, source_take, itemname, invent
inventory_image = inventory_image,
stack_max = 16,
liquids_pointable = true,
groups = groups,
on_place = function(itemstack, user, pointed_thing)
-- Must be pointing to node
if pointed_thing.type ~= "node" then
@ -203,6 +206,13 @@ minetest.register_craftitem("mcl_buckets:bucket_empty", {
new_bucket = ItemStack("mcl_buckets:bucket_water")
end
sound_take("mcl_core:water_source", pointed_thing.under)
elseif nn == "mcl_cauldrons:cauldron_3r" then
-- Take river water out of full cauldron
minetest.set_node(pointed_thing.under, {name="mcl_cauldrons:cauldron"})
if not minetest.settings:get_bool("creative_mode") then
new_bucket = ItemStack("mcl_buckets:bucket_river_water")
end
sound_take("mclx_core:river_water_source", pointed_thing.under)
end
-- Add liquid bucket and put it into inventory, if possible.
@ -227,39 +237,6 @@ minetest.register_craftitem("mcl_buckets:bucket_empty", {
})
if mod_mcl_core then
-- Water bucket
mcl_buckets.register_liquid(
"mcl_core:water_source",
{"mcl_core:water_source"},
"mcl_buckets:bucket_water",
"bucket_water.png",
"Water Bucket",
"A bucket can be used to collect and release liquids. This one is filled with water.",
"Right-click on any block to empty the bucket and put a water source on this spot.",
function(pos)
local nn = minetest.get_node(pos).name
-- Pour water into cauldron
if (nn == "mcl_cauldrons:cauldron" or
nn == "mcl_cauldrons:cauldron_1" or
nn == "mcl_cauldrons:cauldron_2") then
-- Put water into cauldron
minetest.set_node(pos, {name="mcl_cauldrons:cauldron_3"})
sound_place("mcl_core:water_source", pos)
return false
elseif nn == "mcl_cauldrons:cauldron_3" then
sound_place("mcl_core:water_source", pos)
return false
-- Evaporate water if used in Nether (except on cauldron)
else
local dim = mcl_worlds.pos_to_dimension(pos)
if dim == "nether" then
minetest.sound_play("fire_extinguish_flame", {pos = pos, gain = 0.25, max_hear_distance = 16})
return false
end
end
end
)
-- Lava bucket
mcl_buckets.register_liquid(
function(pos)
@ -277,6 +254,70 @@ if mod_mcl_core then
"A bucket can be used to collect and release liquids. This one is filled with hot lava, safely contained inside. Use with caution.",
"Choose a place where you want to empty the bucket, then get in a safe spot somewhere above it. Be prepared to run away when something goes wrong as the lava will soon start to flow after placing. To empty the bucket (which places a lava source), right-click on your chosen place."
)
-- Water bucket
mcl_buckets.register_liquid(
"mcl_core:water_source",
{"mcl_core:water_source"},
"mcl_buckets:bucket_water",
"bucket_water.png",
"Water Bucket",
"A bucket can be used to collect and release liquids. This one is filled with water.",
"Right-click on any block to empty the bucket and put a water source on this spot.",
function(pos)
local nn = minetest.get_node(pos).name
-- Pour water into cauldron
if minetest.get_item_group(nn, "cauldron") ~= 0 then
-- Put water into cauldron
if nn ~= "mcl_cauldrons:cauldron_3" then
minetest.set_node(pos, {name="mcl_cauldrons:cauldron_3"})
end
sound_place("mcl_core:water_source", pos)
return false
-- Evaporate water if used in Nether (except on cauldron)
else
local dim = mcl_worlds.pos_to_dimension(pos)
if dim == "nether" then
minetest.sound_play("fire_extinguish_flame", {pos = pos, gain = 0.25, max_hear_distance = 16})
return false
end
end
end,
{ water_bucket = 1 }
)
end
if mod_mclx_core then
-- River water bucket
mcl_buckets.register_liquid(
"mclx_core:river_water_source",
{"mclx_core:river_water_source"},
"mcl_buckets:bucket_river_water",
"bucket_river_water.png",
"River Water Bucket",
"A bucket can be used to collect and release liquids. This one is filled with river water.",
"Right-click on any block to empty the bucket and put a river water source on this spot.",
function(pos)
local nn = minetest.get_node(pos).name
-- Pour into cauldron
if minetest.get_item_group(nn, "cauldron") ~= 0 then
-- Put water into cauldron
if nn ~= "mcl_cauldrons:cauldron_3r" then
minetest.set_node(pos, {name="mcl_cauldrons:cauldron_3r"})
end
sound_place("mcl_core:water_source", pos)
return false
else
-- Evaporate water if used in Nether (except on cauldron)
local dim = mcl_worlds.pos_to_dimension(pos)
if dim == "nether" then
minetest.sound_play("fire_extinguish_flame", {pos = pos, gain = 0.25, max_hear_distance = 16})
return false
end
end
end,
{ water_bucket = 1 }
)
end
minetest.register_craft({

Binary file not shown.

After

Width:  |  Height:  |  Size: 212 B

View file

@ -1,3 +1,4 @@
mcl_core
mclx_core?
mcl_sounds
doc?

View file

@ -43,7 +43,7 @@ end
-- Empty cauldron
minetest.register_node("mcl_cauldrons:cauldron", {
description = "Cauldron",
_doc_items_longdesc = "Cauldrons are used to store water and slowly fill up under rain.",
_doc_items_longdesc = "Cauldrons are used to store water and slowly fill up under rain. They can also be used to wash off banners.",
_doc_items_usagehelp = "Place a water pucket into the cauldron to fill it with water. Place an empty bucket on a full cauldron to retrieve the water. Place a water bottle into the cauldron to fill the cauldron to one third with water. Place a glass bottle in a cauldron with water to retrieve one third of the water. Use an emblazoned banner on a cauldron with water to wash off its top layer.",
wield_image = "mcl_cauldrons_cauldron.png",
inventory_image = "mcl_cauldrons_cauldron.png",
@ -51,7 +51,7 @@ minetest.register_node("mcl_cauldrons:cauldron", {
paramtype = "light",
is_ground_content = false,
sunlight_propagates = true,
groups = {pickaxey=1, deco_block=1},
groups = {pickaxey=1, deco_block=1, cauldron=1},
node_box = cauldron_nodeboxes[0],
selection_box = { type = "regular" },
tiles = {
@ -65,20 +65,28 @@ minetest.register_node("mcl_cauldrons:cauldron", {
})
-- Template function for cauldrons with water
local register_filled_cauldron = function(water_level, description)
minetest.register_node("mcl_cauldrons:cauldron_"..water_level, {
local register_filled_cauldron = function(water_level, description, river_water)
local id = "mcl_cauldrons:cauldron_"..water_level
local water_tex
if river_water then
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,
drawtype = "nodebox",
paramtype = "light",
is_ground_content = false,
sunlight_propagates = true,
groups = {pickaxey=1, not_in_creative_inventory=1},
groups = {pickaxey=1, not_in_creative_inventory=1, cauldron=(1+water_level)},
node_box = cauldron_nodeboxes[water_level],
collision_box = cauldron_nodeboxes[0],
selection_box = { type = "regular" },
tiles = {
"(default_water_source_animated.png^[verticalframe:16:0)^mcl_cauldrons_cauldron_top.png",
"("..water_tex..")^mcl_cauldrons_cauldron_top.png",
"mcl_cauldrons_cauldron_inner.png^mcl_cauldrons_cauldron_bottom.png",
"mcl_cauldrons_cauldron_side.png"
},
@ -90,14 +98,20 @@ local register_filled_cauldron = function(water_level, description)
-- Add entry aliases for the Help
if minetest.get_modpath("doc") then
doc.add_entry_alias("nodes", "mcl_cauldrons:cauldron", "nodes", "mcl_cauldrons:cauldron_"..water_level)
doc.add_entry_alias("nodes", "mcl_cauldrons:cauldron", "nodes", id)
end
end
-- Filled crauldrons (3 levels)
register_filled_cauldron(1, "Cauldron (One Third Full)")
register_filled_cauldron(2, "Cauldron (Two Thirds Full)")
register_filled_cauldron(3, "Cauldron (Full)")
-- Filled cauldrons (3 levels)
register_filled_cauldron(1, "Cauldron (1/3 Water)")
register_filled_cauldron(2, "Cauldron (2/3 Water)")
register_filled_cauldron(3, "Cauldron (3/3 Water)")
if minetest.get_modpath("mclx_core") then
register_filled_cauldron(1, "Cauldron (1/3 River Water)", true)
register_filled_cauldron(2, "Cauldron (2/3 River Water)", true)
register_filled_cauldron(3, "Cauldron (3/3 River Water)", true)
end
minetest.register_craft({
output = "mcl_cauldrons:cauldron",

View file

@ -193,10 +193,13 @@ local function furnace_node_timer(pos, elapsed)
inv:add_item("dst", cooked.item)
inv:set_stack("src", 1, aftercooked.items[1])
-- Unique recipe: Put water into empty bucket after cooking wet sponge successfully
if srclist[1]:get_name() == "mcl_sponges:sponge_wet" then
if inv:get_stack("fuel", 1):get_name() == "mcl_buckets:bucket_empty" then
-- Unique recipe: Pour water into empty bucket after cooking wet sponge successfully
if inv:get_stack("fuel", 1):get_name() == "mcl_buckets:bucket_empty" then
if srclist[1]:get_name() == "mcl_sponges:sponge_wet" then
inv:set_stack("fuel", 1, "mcl_buckets:bucket_water")
-- Also for river water
elseif srclist[1]:get_name() == "mcl_sponges:sponge_wet_river_water" then
inv:set_stack("fuel", 1, "mcl_buckets:bucket_river_water")
end
end

View file

@ -157,7 +157,7 @@ minetest.register_craftitem("mcl_mobitems:milk_bucket", {
minetest.register_craftitem("mcl_mobitems:spider_eye", {
description = "Spider Eye",
_doc_items_longdesc = "Spider eyes are used mainly in crafting and brewing. If you're really desperate, you can eat a spider eye, but it will poison you briefly.",
_doc_items_longdesc = "Spider eyes are used mainly in crafting. If you're really desperate, you can eat a spider eye, but it will poison you briefly.",
inventory_image = "mcl_mobitems_spider_eye.png",
wield_image = "mcl_mobitems_spider_eye.png",
on_place = minetest.item_eat(2),
@ -195,7 +195,7 @@ minetest.register_craftitem("mcl_mobitems:blaze_rod", {
minetest.register_craftitem("mcl_mobitems:blaze_powder", {
description = "Blaze Powder",
_doc_items_longdesc = "This item is mainly used for brewing potions and crafting.",
_doc_items_longdesc = "This item is mainly used for crafting.",
wield_image = "mcl_mobitems_blaze_powder.png",
inventory_image = "mcl_mobitems_blaze_powder.png",
groups = { brewitem = 1 },
@ -213,7 +213,7 @@ minetest.register_craftitem("mcl_mobitems:magma_cream", {
minetest.register_craftitem("mcl_mobitems:ghast_tear", {
description = "Ghast Tear",
_doc_items_longdesc = "A ghast tear is an item used in potion brewing. It is dropped from dead ghasts.",
_doc_items_longdesc = "A ghast tear is dropped from dead ghasts. It has no purpose yet.",
wield_image = "mcl_mobitems_ghast_tear.png",
inventory_image = "mcl_mobitems_ghast_tear.png",
groups = { brewitem = 1 },
@ -258,7 +258,7 @@ minetest.register_craftitem("mcl_mobitems:rabbit_hide", {
minetest.register_craftitem("mcl_mobitems:rabbit_foot", {
description = "Rabbit's Foot",
_doc_items_longdesc = "This item is used in brewing.",
_doc_items_longdesc = "This item currently has no purpose.",
wield_image = "mcl_mobitems_rabbit_foot.png",
inventory_image = "mcl_mobitems_rabbit_foot.png",
groups = { brewitem = 1 },

View file

@ -209,7 +209,7 @@ minetest.register_node("mcl_nether:quartz_smooth", {
minetest.register_craftitem("mcl_nether:glowstone_dust", {
description = "Glowstone Dust",
_doc_items_longdesc = "Glowstone dust is the dust which comes out of broken glowstones. It is mainly used in crafting and brewing.",
_doc_items_longdesc = "Glowstone dust is the dust which comes out of broken glowstones. It is mainly used in crafting.",
inventory_image = "mcl_nether_glowstone_dust.png",
stack_max = 64,
groups = { craftitem=1 },

View file

@ -1,4 +1,4 @@
local brewhelp = "This item is used in potion brewing."
local brewhelp = "This item currently has no purpose."
minetest.register_craftitem("mcl_potions:fermented_spider_eye", {
description = "Fermented Spider Eye",
@ -17,8 +17,8 @@ minetest.register_craft({
minetest.register_craftitem("mcl_potions:glass_bottle", {
description = "Glass Bottle",
_doc_items_longdesc = "A glass bottle is used as a container for potions and can be used to collect water directly.",
_doc_items_usagehelp = "To collect water, it on a cauldron with water (which removes a level of water) or a water source (which removes no water).",
_doc_items_longdesc = "A glass bottle is used as a container for liquids and can be used to collect water directly.",
_doc_items_usagehelp = "To collect water, it on a cauldron with water (which removes a level of water) or any water source (which removes no water).",
inventory_image = "mcl_potions_potion_bottle_empty.png",
wield_image = "mcl_potions_potion_bottle_empty.png",
groups = {brewitem=1},
@ -37,11 +37,13 @@ minetest.register_craftitem("mcl_potions:glass_bottle", {
-- Try to fill glass bottle with water
local get_water = false
local river_water = false
if not def then
-- Unknown node: no-op
elseif def.groups and def.groups.water and def.liquidtype == "source" then
-- Water source
get_water = true
river_water = node.name == "mclx_core:river_water_source"
-- Or reduce water level of cauldron by 1
elseif node.name == "mcl_cauldrons:cauldron_3" then
get_water = true
@ -52,11 +54,28 @@ minetest.register_craftitem("mcl_potions:glass_bottle", {
elseif node.name == "mcl_cauldrons:cauldron_1" then
get_water = true
minetest.set_node(pointed_thing.under, {name="mcl_cauldrons:cauldron"})
elseif node.name == "mcl_cauldrons:cauldron_3r" then
get_water = true
river_water = true
minetest.set_node(pointed_thing.under, {name="mcl_cauldrons:cauldron_2r"})
elseif node.name == "mcl_cauldrons:cauldron_2r" then
get_water = true
river_water = true
minetest.set_node(pointed_thing.under, {name="mcl_cauldrons:cauldron_1r"})
elseif node.name == "mcl_cauldrons:cauldron_1r" then
get_water = true
river_water = true
minetest.set_node(pointed_thing.under, {name="mcl_cauldrons:cauldron"})
end
if get_water then
-- Replace with water bottle, if possible, otherwise
-- place the water potion at a place where's space
local water_bottle = ItemStack("mcl_potions:potion_water")
local water_bottle
if river_water then
water_bottle = ItemStack("mcl_potions:potion_river_water")
else
water_bottle = ItemStack("mcl_potions:potion_water")
end
minetest.sound_play("mcl_potions_bottle_fill", {pos=pointed_thing.under, gain=0.5, max_hear_range=16})
if itemstack:get_count() == 1 then
return water_bottle
@ -83,7 +102,7 @@ minetest.register_craft( {
}
})
-- Tempalte function for creating images of filled potions
-- Template function for creating images of filled potions
-- - colorstring must be a ColorString of form “#RRGGBB”, e.g. “#0000FF” for blue.
-- - opacity is optional opacity from 0-255 (default: 127)
local potion_image = function(colorstring, opacity)
@ -93,16 +112,39 @@ local potion_image = function(colorstring, opacity)
return "mcl_potions_potion_bottle_drinkable.png^(mcl_potions_potion_overlay.png^[colorize:"..colorstring..":"..tostring(opacity)..")"
end
-- Cauldron fill up rules:
-- Adding any water increases the water level by 1, preserving the current water type
local cauldron_levels = {
-- start = { add water, add river water }
{ "", "_1", "_1r" },
{ "_1", "_2", "_2" },
{ "_2", "_3", "_3" },
{ "_1r", "_2r", "_2r" },
{ "_2r", "_3r", "_3r" },
}
local fill_cauldron = function(cauldron, water_type)
local base = "mcl_cauldrons:cauldron"
for i=1, #cauldron_levels do
if cauldron == base .. cauldron_levels[i][1] then
if water_type == "mclx_core:river_water_source" then
return base .. cauldron_levels[i][3]
else
return base .. cauldron_levels[i][2]
end
end
end
end
-- Itemstring of potions is “mcl_potions:potion_<NBT Potion Tag>”
minetest.register_craftitem("mcl_potions:potion_water", {
description = "Water Bottle",
_doc_items_longdesc = "Water bottles can be used to brew potions and to fill cauldrons. Drinking water has no effect.",
_doc_items_usagehelp = "Wield it and rightclick to drink it. Rightclick a cauldron to put the water into the cauldron.",
_doc_items_longdesc = "Water bottles can be used to fill cauldrons. Drinking water has no effect.",
_doc_items_usagehelp = "Rightclick to drink. Rightclick a cauldron to pour the water into the cauldron.",
stack_max = 1,
inventory_image = potion_image("#0000FF"),
wield_image = potion_image("#0000FF"),
groups = {brewitem=1, food=3, can_eat_when_full=1},
groups = {brewitem=1, food=3, can_eat_when_full=1, water_bottle=1},
on_place = function(itemstack, placer, pointed_thing)
if pointed_thing.type == "node" then
local node = minetest.get_node(pointed_thing.under)
@ -115,17 +157,10 @@ minetest.register_craftitem("mcl_potions:potion_water", {
end
end
local cauldron = fill_cauldron(node.name, "mcl_core:water_source")
if cauldron then
-- Increase water level of cauldron by 1
if node.name == "mcl_cauldrons:cauldron" then
minetest.set_node(pointed_thing.under, {name="mcl_cauldrons:cauldron_1"})
minetest.sound_play("mcl_potions_bottle_pour", {pos=pointed_thing.under, gain=0.5, max_hear_range=16})
return "mcl_potions:glass_bottle"
elseif node.name == "mcl_cauldrons:cauldron_1" then
minetest.set_node(pointed_thing.under, {name="mcl_cauldrons:cauldron_2"})
minetest.sound_play("mcl_potions_bottle_pour", {pos=pointed_thing.under, gain=0.5, max_hear_range=16})
return "mcl_potions:glass_bottle"
elseif node.name == "mcl_cauldrons:cauldron_2" then
minetest.set_node(pointed_thing.under, {name="mcl_cauldrons:cauldron_3"})
minetest.set_node(pointed_thing.under, {name=cauldron})
minetest.sound_play("mcl_potions_bottle_pour", {pos=pointed_thing.under, gain=0.5, max_hear_range=16})
return "mcl_potions:glass_bottle"
end
@ -137,6 +172,43 @@ minetest.register_craftitem("mcl_potions:potion_water", {
on_secondary_use = minetest.item_eat(0, "mcl_potions:glass_bottle"),
})
minetest.register_craftitem("mcl_potions:potion_river_water", {
description = "River Water Bottle",
_doc_items_longdesc = "River water bottles can be used to fill cauldrons. Drinking it has no effect.",
_doc_items_usagehelp = "Rightclick to drink. Rightclick a cauldron to pour the river water into the cauldron.",
stack_max = 1,
inventory_image = potion_image("#0044FF"),
wield_image = potion_image("#0044FF"),
groups = {brewitem=1, food=3, can_eat_when_full=1, water_bottle=1},
on_place = function(itemstack, placer, pointed_thing)
if pointed_thing.type == "node" then
local node = minetest.get_node(pointed_thing.under)
local def = minetest.registered_nodes[node.name]
-- Call on_rightclick if the pointed node defines it
if placer and not placer:get_player_control().sneak then
if def and def.on_rightclick then
return def.on_rightclick(pointed_thing.under, node, placer, itemstack) or itemstack
end
end
local cauldron = fill_cauldron(node.name, "mclx_core:river_water_source")
if cauldron then
-- Increase water level of cauldron by 1
minetest.set_node(pointed_thing.under, {name=cauldron})
minetest.sound_play("mcl_potions_bottle_pour", {pos=pointed_thing.under, gain=0.5, max_hear_range=16})
return "mcl_potions:glass_bottle"
end
end
-- Drink the water by default
return minetest.do_item_eat(0, "mcl_potions:glass_bottle", itemstack, placer, pointed_thing)
end,
on_secondary_use = minetest.item_eat(0, "mcl_potions:glass_bottle"),
})
local how_to_drink = "To drink it, wield it, then rightclick."
minetest.register_craftitem("mcl_potions:potion_awkward", {

View file

@ -1 +1,3 @@
mcl_sounds
mcl_core?
mclx_core?

View file

@ -1,5 +1,9 @@
local absorb = function(pos)
local change = false
-- Count number of absorbed river water vs other nodes
-- to determine the wet sponge type.
local river_water = 0
local non_river_water = 0
local p, n
for i=-3,3 do
for j=-3,3 do
@ -9,11 +13,24 @@ local absorb = function(pos)
if minetest.get_item_group(n.name, "water") ~= 0 then
minetest.add_node(p, {name="air"})
change = true
if n.name == "mclx_core:river_water_source" or n.name == "mclx_core:river_water_flowing" then
river_water = river_water + 1
else
non_river_water = non_river_water + 1
end
end
end
end
end
return change
-- The dominant water type wins. In case of a tie, normal water wins.
-- This slight bias is intentional.
local sponge_type
if river_water > non_river_water then
sponge_type = "mcl_sponges:sponge_wet_river_water"
else
sponge_type = "mcl_sponges:sponge_wet"
end
return change, sponge_type
end
minetest.register_node("mcl_sponges:sponge", {
@ -59,8 +76,9 @@ minetest.register_node("mcl_sponges:sponge", {
if on_water then
-- Absorb water
-- FIXME: pos is not always the right placement position because of pointed_thing
if absorb(pos) then
minetest.item_place_node(ItemStack("mcl_sponges:sponge_wet"), placer, pointed_thing)
local absorbed, wet_sponge = absorb(pos)
if absorbed then
minetest.item_place_node(ItemStack(wet_sponge), placer, pointed_thing)
if not minetest.settings:get_bool("creative_mode") then
itemstack:take_item()
end
@ -74,8 +92,8 @@ minetest.register_node("mcl_sponges:sponge", {
})
minetest.register_node("mcl_sponges:sponge_wet", {
description = "Wet Sponge",
_doc_items_longdesc = "Wet sponges can be dried in the furnace to turn it into (dry) sponge. When there's an empty bucket in the fuel slot of a furnace, water will pour into the bucket.",
description = "Waterlogged Sponge",
_doc_items_longdesc = "A waterlogged sponge can be dried in the furnace to turn it into (dry) sponge. When there's an empty bucket in the fuel slot of a furnace, the water will pour into the bucket.",
drawtype = "normal",
is_ground_content = false,
tiles = {"mcl_sponges_sponge_wet.png"},
@ -90,6 +108,32 @@ minetest.register_node("mcl_sponges:sponge_wet", {
_mcl_hardness = 0.6,
})
if minetest.get_modpath("mclx_core") then
minetest.register_node("mcl_sponges:sponge_wet_river_water", {
description = "Riverwaterlogged Sponge",
_doc_items_longdesc = "A sponge full of river water. It can be dried in the furnace to turn it into (dry) sponge. When there's an empty bucket in the fuel slot of the furnace, the river water will pour into the bucket.",
drawtype = "normal",
is_ground_content = false,
tiles = {"mcl_sponges_sponge_wet_river_water.png"},
walkable = true,
pointable = true,
diggable = true,
buildable_to = false,
stack_max = 64,
sounds = mcl_sounds.node_sound_dirt_defaults(),
groups = {handy=1, building_block=1},
_mcl_blast_resistance = 3,
_mcl_hardness = 0.6,
})
minetest.register_craft({
type = "cooking",
output = "mcl_sponges:sponge",
recipe = "mcl_sponges:sponge_wet_river_water",
cooktime = 10,
})
end
minetest.register_craft({
type = "cooking",
output = "mcl_sponges:sponge",
@ -104,8 +148,9 @@ minetest.register_abm({
interval = 1,
chance = 1,
action = function(pos)
if absorb(pos) then
minetest.add_node(pos, {name = "mcl_sponges:sponge_wet"})
local absorbed, wet_sponge = absorb(pos)
if absorbed then
minetest.add_node(pos, {name = wet_sponge})
end
end,
})

Binary file not shown.

After

Width:  |  Height:  |  Size: 177 B

View file

@ -0,0 +1,2 @@
mcl_core
doc?

View file

@ -0,0 +1 @@
Core items not found in Minecraft

View file

@ -0,0 +1,52 @@
-- Liquids: River Water
local source = table.copy(minetest.registered_nodes["mcl_core:water_source"])
source.description = "Still River Water"
source.liquid_range = 2
source.liquid_alternative_flowing = "mclx_core:river_water_flowing"
source.liquid_alternative_source = "mclx_core:river_water_source"
source.liquid_renewable = false
source._doc_items_longdesc = "River water has the same properties as water, but has a reduced flowing distance and is not renewable."
source._doc_items_entry_name = "River Water"
-- Auto-expose entry only in valleys mapgen
source._doc_items_hidden = minetest.get_mapgen_setting("mg_name") ~= "valleys"
source.post_effect_color = {a=204, r=0x2c, g=0x88, b=0x8c}
source.tiles = {
{name="default_river_water_source_animated.png", animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=5.0}}
}
source.special_tiles = {
-- New-style water source material (mostly unused)
{
name="default_river_water_source_animated.png",
animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=5.0},
backface_culling = false,
}
}
local flowing = table.copy(minetest.registered_nodes["mcl_core:water_flowing"])
flowing.description = "Flowing River Water"
flowing.liquid_range = 2
flowing.liquid_alternative_flowing = "mclx_core:river_water_flowing"
flowing.liquid_alternative_source = "mclx_core:river_water_source"
flowing.liquid_renewable = false
flowing.tiles = {"default_river_water_flowing_animated.png^[verticalframe:64:0"}
flowing.post_effect_color = {a=204, r=0x2c, g=0x88, b=0x8c}
flowing.special_tiles = {
{
image="default_river_water_flowing_animated.png",
backface_culling=false,
animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=4.0}
},
{
image="default_river_water_flowing_animated.png",
backface_culling=true,
animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=4.0}
},
}
minetest.register_node("mclx_core:river_water_source", source)
minetest.register_node("mclx_core:river_water_flowing", flowing)
if minetest.get_modpath("doc") then
doc.add_entry_alias("nodes", "mclx_core:river_water_source", "nodes", "mclx_core:river_water_flowing")
end

View file

@ -0,0 +1 @@
name = mclx_core

Binary file not shown.

After

Width:  |  Height:  |  Size: 601 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 423 B

View file

@ -24,6 +24,7 @@ wieldview.transform = {
["mcl_flowers:tallgrass"]="R270",
["mcl_buckets:bucket_empty"]="R270",
["mcl_buckets:bucket_water"]="R270",
["mcl_buckets:bucket_river_water"]="R270",
["mcl_buckets:bucket_lava"]="R270",
["mcl_mobitems:milk_bucket"]="R270",
["mcl_potions:glass_bottle"]="R270",

View file

@ -1,5 +1,6 @@
mcl_init
mcl_core
mclx_core?
mcl_worlds
mcl_cocoas
mcl_stairs

View file

@ -28,7 +28,11 @@ minetest.register_alias("mapgen_stone_with_iron", "mcl_core:stone_with_iron")
minetest.register_alias("mapgen_desert_sand", "mcl_core:sand")
minetest.register_alias("mapgen_desert_stone", "mcl_core:sandstone")
minetest.register_alias("mapgen_sandstone", "mcl_core:sandstone")
minetest.register_alias("mapgen_river_water_source", "mcl_core:water_source")
if minetest.get_modpath("mclx_core") then
minetest.register_alias("mapgen_river_water_source", "mclx_core:river_water_source")
else
minetest.register_alias("mapgen_river_water_source", "mcl_core:water_source")
end
minetest.register_alias("mapgen_snow", "mcl_core:snow")
minetest.register_alias("mapgen_snowblock", "mcl_core:snowblock")
minetest.register_alias("mapgen_ice", "mcl_core:ice")