Merge pull request 'Glorius Mud' (#2402) from TheRandomLegoBrick/MineClone2:mud into master

Reviewed-on: https://git.minetest.land/MineClone2/MineClone2/pulls/2402
This commit is contained in:
cora 2022-07-09 00:24:28 +00:00
commit 6d5e8822dd
13 changed files with 171 additions and 68 deletions

View File

@ -0,0 +1,21 @@
License of Code
----------------
Author: TheRandomLegoBrick
License: GPLv3
See https://www.gnu.org/licenses/gpl-3.0.en.html for further information
License of Media (textures & sounds)
-------------------------------------
Author: TheRandomLegoBrick
Liscense: CC0 1.0 Universal (CC0 1.0)
Files:
mud_footsteps.ogg
mud_place_dug.ogg
mcl_mud_bricks.png
mcl_mud_packed_mud.png
mcl_mud.png
See https://creativecommons.org/publicdomain/zero/1.0/legalcode for further information

View File

@ -0,0 +1,65 @@
local S = minetest.get_translator(minetest.get_current_modname())
minetest.register_node("mcl_mud:mud", {
description = S("Mud"),
_doc_items_longdesc = S("Mud is a decorative block that generates in mangrove swamps. Mud can also be obtained by using water bottles on dirt or coarse dirt."),
_doc_items_hidden = false,
tiles = {"mcl_mud.png"},
is_ground_content = true,
sounds = {
footstep = {name="mud_footsteps", gain=1},
dug = {name="mud_place_dug", gain=1},
place = {name="mud_place_dug", gain=1},
},
groups = {handy=1,shovely=1, enderman_takable=1, building_block=1},
_mcl_blast_resistance = 0.5,
_mcl_hardness = 0.5,
collision_box = {
type = "fixed",
fixed = {
{-8 / 16, -8 / 16, -8 / 16, 8 / 16, 7 / 16, 8 / 16},
},
},
})
minetest.register_node("mcl_mud:packed_mud", {
description = S("Packed Mud"),
_doc_items_longdesc = S("Packed mud is a decorative block used to craft mud bricks."),
_doc_items_hidden = false,
tiles = {"mcl_mud_packed_mud.png"},
groups = {handy=1, pickaxey=1, building_block=1},
sounds = mcl_sounds.node_sound_dirt_defaults(),
_mcl_blast_resistance = 3,
_mcl_hardness = 1,
})
minetest.register_node("mcl_mud:mud_bricks", {
description = S("Mud Bricks"),
_doc_items_longdesc = S("Decorative block crafted from packed mud."),
_doc_items_hidden = false,
tiles = {"mcl_mud_bricks.png"},
groups = {handy=1, pickaxey=1, building_block=1},
sounds = mcl_sounds.node_sound_stone_defaults(),
_mcl_blast_resistance = 3,
_mcl_hardness = 1.5,
})
-- packed mud
minetest.register_craft({
type = "shapeless",
output = "mcl_mud:packed_mud",
recipe = {
"mcl_mud:mud",
"mcl_farming:wheat_item",
}
})
-- mud bricks
minetest.register_craft({
type = "shaped",
output = "mcl_mud:mud_bricks 4",
recipe = {
{"mcl_mud:packed_mud", "mcl_mud:packed_mud"},
{"mcl_mud:packed_mud", "mcl_mud:packed_mud"}
}
})

View File

@ -0,0 +1,4 @@
name = mcl_mud
author = TheRandomLegoBrick
description = Adds various mud blocks.
depends = mcl_sounds

Binary file not shown.

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 506 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 465 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 487 B

View File

@ -176,6 +176,76 @@ local fill_cauldron = function(cauldron, water_type)
end
end
-- function to set node and empty water bottle (used for cauldrons and mud)
local function set_node_empty_bottle(itemstack, placer, pointed_thing, newitemstring)
local pname = placer:get_player_name()
if minetest.is_protected(pointed_thing.under, pname) then
minetest.record_protection_violation(pointed_thing.under, pname)
return itemstack
end
-- set the node to `itemstring`
minetest.set_node(pointed_thing.under, {name=newitemstring})
-- play sound
minetest.sound_play("mcl_potions_bottle_pour", {pos=pointed_thing.under, gain=0.5, max_hear_range=16}, true)
--
if minetest.is_creative_enabled(placer:get_player_name()) then
return itemstack
else
return "mcl_potions:glass_bottle"
end
end
-- used for water bottles and river water bottles
local function dispense_water_bottle(stack, pos, droppos)
local node = minetest.get_node(droppos)
if node.name == "mcl_core:dirt" or node.name == "mcl_core:coarse_dirt" then
-- convert dirt/coarse dirt to mud
minetest.set_node(droppos, {name = "mcl_mud:mud"})
minetest.sound_play("mcl_potions_bottle_pour", {pos=droppos, gain=0.5, max_hear_range=16}, true)
return ItemStack("mcl_potions:glass_bottle")
elseif node.name == "mcl_mud:mud" then
-- dont dispense into mud
return stack
end
end
-- on_place function for `mcl_potions:water` and `mcl_potions:river_water`
local function water_bottle_on_place(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 = nil
if itemstack:get_name() == "mcl_potions:water" then -- regular water
cauldron = fill_cauldron(node.name, "mcl_core:water_source")
elseif itemstack:get_name() == "mcl_potions:river_water" then -- river water
cauldron = fill_cauldron(node.name, "mclx_core:river_water_source")
end
if cauldron then
set_node_empty_bottle(itemstack, placer, pointed_thing, cauldron)
elseif node.name == "mcl_core:dirt" or node.name == "mcl_core:coarse_dirt" then
set_node_empty_bottle(itemstack, placer, pointed_thing, "mcl_mud:mud")
end
end
-- Drink the water by default
return minetest.do_item_eat(0, "mcl_potions:glass_bottle", itemstack, placer, pointed_thing)
end
-- Itemstring of potions is “mcl_potions:<NBT Potion Tag>”
minetest.register_craftitem("mcl_potions:water", {
@ -187,39 +257,9 @@ minetest.register_craftitem("mcl_potions:water", {
inventory_image = potion_image("#0022FF"),
wield_image = potion_image("#0022FF"),
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, "mcl_core:water_source")
if cauldron then
local pname = placer:get_player_name()
if minetest.is_protected(pointed_thing.under, pname) then
minetest.record_protection_violation(pointed_thing.under, pname)
return itemstack
end
-- 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}, true)
if minetest.is_creative_enabled(placer:get_player_name()) then
return itemstack
else
return "mcl_potions:glass_bottle"
end
end
end
-- Drink the water by default
return minetest.do_item_eat(0, "mcl_potions:glass_bottle", itemstack, placer, pointed_thing)
end,
on_place = water_bottle_on_place,
_on_dispense = dispense_water_bottle,
_dispense_into_walkable = true,
on_secondary_use = minetest.item_eat(0, "mcl_potions:glass_bottle"),
})
@ -234,39 +274,9 @@ minetest.register_craftitem("mcl_potions:river_water", {
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
local pname = placer:get_player_name()
if minetest.is_protected(pointed_thing.under, pname) then
minetest.record_protection_violation(pointed_thing.under, pname)
return itemstack
end
-- 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}, true)
if minetest.is_creative_enabled(placer:get_player_name()) then
return itemstack
else
return "mcl_potions:glass_bottle"
end
end
end
-- Drink the water by default
return minetest.do_item_eat(0, "mcl_potions:glass_bottle", itemstack, placer, pointed_thing)
end,
on_place = water_bottle_on_place,
_on_dispense = dispense_water_bottle,
_dispense_into_walkable = true,
on_secondary_use = minetest.item_eat(0, "mcl_potions:glass_bottle"),
})

View File

@ -1,2 +1,2 @@
name = mcl_stairs
depends = mcl_core, mcl_sounds, mcl_nether, mcl_end, mcl_ocean
depends = mcl_core, mcl_sounds, mcl_nether, mcl_end, mcl_ocean, mcl_mud

View File

@ -138,6 +138,8 @@ mcl_stairs.register_slab("purpur_block", "group:purpur_block",
mcl_stairs.register_stair_and_slab_simple("prismarine", "mcl_ocean:prismarine", S("Prismarine Stairs"), S("Prismarine Slab"), S("Double Prismarine Slab"))
mcl_stairs.register_stair_and_slab_simple("mud_brick", "mcl_mud:mud_bricks", S("Mud Brick Stair"), S("Mud Brick Slab"), S("Double Mud Brick Slab"))
mcl_stairs.register_stair_and_slab_simple("prismarine_brick", "mcl_ocean:prismarine_brick", S("Prismarine Brick Stairs"), S("Prismarine Brick Slab"), S("Double Prismarine Brick Slab"))
mcl_stairs.register_stair_and_slab_simple("prismarine_dark", "mcl_ocean:prismarine_dark", S("Dark Prismarine Stairs"), S("Dark Prismarine Slab"), S("Double Dark Prismarine Slab"))

View File

@ -1,3 +1,3 @@
name = mcl_walls
depends = mcl_core, mcl_end, mcl_ocean, mcl_nether, mcl_sounds
depends = mcl_core, mcl_end, mcl_ocean, mcl_nether, mcl_sounds, mcl_mud
optional_depends = doc

View File

@ -14,3 +14,4 @@ mcl_walls.register_wall("mcl_walls:prismarine", S("Prismarine Wall"), "mcl_ocean
mcl_walls.register_wall("mcl_walls:endbricks", S("End Stone Brick Wall"), "mcl_end:end_bricks")
mcl_walls.register_wall("mcl_walls:netherbrick", S("Nether Brick Wall"), "mcl_nether:nether_brick")
mcl_walls.register_wall("mcl_walls:rednetherbrick", S("Red Nether Brick Wall"), "mcl_nether:red_nether_brick")
mcl_walls.register_wall("mcl_walls:mudbrick", S("Mud Brick Wall"), "mcl_mud:mud_bricks")