Merge branch 'master' into biome_colored_foliage

This commit is contained in:
FossFanatic 2023-02-14 13:27:37 +00:00
commit 57882ae56a
76 changed files with 10600 additions and 403 deletions

1
API.md
View file

@ -41,6 +41,7 @@ A lot of things are possible by using one of the APIs in the mods. Note that not
* Beds: `ITEMS/mcl_beds` * Beds: `ITEMS/mcl_beds`
* Buckets: `ITEMS/mcl_buckets` * Buckets: `ITEMS/mcl_buckets`
* Dispenser support: `ITEMS/REDSTONE/mcl_dispensers` * Dispenser support: `ITEMS/REDSTONE/mcl_dispensers`
* Campfires: `ITEMS/mcl_campfires`
### Mobs ### Mobs
* Mobs: `ENTITIES/mcl_mobs` * Mobs: `ENTITIES/mcl_mobs`

View file

@ -135,8 +135,8 @@ function mob_class:mob_activate(staticdata, def, dtime)
end end
end end
if not self.base_texture then --If textures in definition change, reload textures
if not self.base_texture or (def.textures and table.indexof(def.textures, self.base_texture) == -1) then
-- compatiblity with old simple mobs textures -- compatiblity with old simple mobs textures
if type(def.textures[1]) == "string" then if type(def.textures[1]) == "string" then
def.textures = {def.textures} def.textures = {def.textures}

View file

@ -47,7 +47,7 @@ local cod = {
visual = "mesh", visual = "mesh",
mesh = "extra_mobs_cod.b3d", mesh = "extra_mobs_cod.b3d",
textures = { textures = {
{"extra_mobs_cod.png"} {"mobs_mc_cod.png"}
}, },
sounds = { sounds = {
}, },

View file

@ -25,7 +25,7 @@ local base_psdef = {
local psdefs = {} local psdefs = {}
for i=1,4 do for i=1,4 do
local p = table.copy(base_psdef) local p = table.copy(base_psdef)
p.texture = "extra_mobs_glow_squid_glint"..i..".png" p.texture = "mobs_mc_glow_squid_glint"..i..".png"
table.insert(psdefs,p) table.insert(psdefs,p)
end end
@ -47,7 +47,7 @@ mcl_mobs.register_mob("mobs_mc:glow_squid", {
visual = "mesh", visual = "mesh",
mesh = "extra_mobs_glow_squid.b3d", mesh = "extra_mobs_glow_squid.b3d",
textures = { textures = {
{ "extra_mobs_glow_squid.png" } { "mobs_mc_glow_squid.png" }
}, },
sounds = { sounds = {
damage = { name = "mobs_mc_squid_hurt", gain = 0.3 }, damage = { name = "mobs_mc_squid_hurt", gain = 0.3 },

View file

@ -25,7 +25,7 @@ local salmon = {
visual = "mesh", visual = "mesh",
mesh = "extra_mobs_salmon.b3d", mesh = "extra_mobs_salmon.b3d",
textures = { textures = {
{"extra_mobs_salmon.png"} {"mobs_mc_salmon.png"}
}, },
sounds = { sounds = {
}, },

View file

@ -305,7 +305,7 @@ awards.register_achievement("mcl:tacticalFishing", {
awards.register_achievement("mcl:cutestPredator", { awards.register_achievement("mcl:cutestPredator", {
title = S("The Cutest Predator"), title = S("The Cutest Predator"),
description = S("Catch an Axolotl with a bucket!"), description = S("Catch an Axolotl with a bucket!"),
icon = "axolotl_bucket.png", icon = "mcl_achievements_axolotl_bucket.png",
type = "Advancement", type = "Advancement",
group = "Husbandry", group = "Husbandry",
}) })

View file

@ -225,8 +225,8 @@ local woods = {
{ "junglewood", "mcl_core:junglewood", "default_junglewood.png", S("Jungle Button") }, { "junglewood", "mcl_core:junglewood", "default_junglewood.png", S("Jungle Button") },
{ "mangrove_wood", "mcl_mangrove:mangrove_wood", "mcl_mangrove_planks.png", S("Mangrove Button") }, { "mangrove_wood", "mcl_mangrove:mangrove_wood", "mcl_mangrove_planks.png", S("Mangrove Button") },
{ "crimson_hyphae_wood", "mcl_crimson:crimson_hyphae_wood", "crimson_hyphae_wood.png", S("Crimson Button") }, { "crimson_hyphae_wood", "mcl_crimson:crimson_hyphae_wood", "mcl_crimson_hyphae_wood.png", S("Crimson Button") },
{ "warped_hyphae_wood", "mcl_crimson:warped_hyphae_wood", "warped_hyphae_wood.png", S("Warped Button") }, { "warped_hyphae_wood", "mcl_crimson:warped_hyphae_wood", "mcl_crimson_warped_hyphae_wood.png", S("Warped Button") },
} }
for w=1, #woods do for w=1, #woods do

View file

@ -223,8 +223,8 @@ local woods = {
{ "junglewood", "mcl_core:junglewood", "default_junglewood.png", S("Jungle Pressure Plate") }, { "junglewood", "mcl_core:junglewood", "default_junglewood.png", S("Jungle Pressure Plate") },
{ "mangrove_wood", "mcl_mangrove:mangrove_wood", "mcl_mangrove_planks.png", S("Mangrove Pressure Plate") }, { "mangrove_wood", "mcl_mangrove:mangrove_wood", "mcl_mangrove_planks.png", S("Mangrove Pressure Plate") },
{ "crimson_hyphae_wood", "mcl_crimson:crimson_hyphae_wood", "crimson_hyphae_wood.png", S("Crimson Pressure Plate") }, { "crimson_hyphae_wood", "mcl_crimson:crimson_hyphae_wood", "mcl_crimson_hyphae_wood.png", S("Crimson Pressure Plate") },
{ "warped_hyphae_wood", "mcl_crimson:warped_hyphae_wood", "warped_hyphae_wood.png", S("Warped Pressure Plate") }, { "warped_hyphae_wood", "mcl_crimson:warped_hyphae_wood", "mcl_crimson_warped_hyphae_wood.png", S("Warped Pressure Plate") },
} }
for w=1, #woods do for w=1, #woods do

View file

@ -51,8 +51,8 @@ minetest.register_node("mcl_armor_stand:armor_stand", {
_doc_items_usagehelp = S("Just place an armor item on the armor stand. To take the top piece of armor from the armor stand, select your hand and use the place key on the armor stand."), _doc_items_usagehelp = S("Just place an armor item on the armor stand. To take the top piece of armor from the armor stand, select your hand and use the place key on the armor stand."),
drawtype = "mesh", drawtype = "mesh",
mesh = "3d_armor_stand.obj", mesh = "3d_armor_stand.obj",
inventory_image = "3d_armor_stand_item.png", inventory_image = "mcl_armor_stand_item.png",
wield_image = "3d_armor_stand_item.png", wield_image = "mcl_armor_stand_item.png",
tiles = {"default_wood.png", "mcl_stairs_stone_slab_top.png"}, tiles = {"default_wood.png", "mcl_stairs_stone_slab_top.png"},
paramtype = "light", paramtype = "light",
paramtype2 = "facedir", paramtype2 = "facedir",

View file

@ -0,0 +1,26 @@
MineClone 2 Campfire API
========================
`mcl_campfires.register_campfire`
---------------------------------
Used to register campfires.
**Example Usage**
```
mcl_campfires.register_campfire("mcl_campfires:campfire", {
description = S("Campfire"),
inv_texture = "mcl_campfires_campfire_inv.png",
fire_texture = "mcl_campfires_campfire_fire.png",
lit_logs_texture = "mcl_campfires_campfire_log_lit.png",
drops = "mcl_core:charcoal_lump 2",
lightlevel = 14,
damage = 1,
})
```
**Values**
* description - human readable node name.
* inv_texture - campfire inventory texture.
* fire_texture - texture of the campfire fire.
* lit_logs_texture - texture for the logs of the lit campfire. if not changed, specify mcl_campfires_log.png.
* drops - what items drop when the campfire is mined.
* lightlevel - the level of light the campfire emits.
* damage - amount of damage the campfire deals when the player stands on it.

View file

@ -0,0 +1,117 @@
local S = minetest.get_translator(minetest.get_current_modname())
mcl_campfires = {}
function mcl_campfires.register_campfire(name, def)
-- Define Campfire
minetest.register_node(name, {
description = def.description,
_tt_help = S("Cooks food and keeps bees happy."),
_doc_items_longdesc = S("Campfires have multiple uses, including keeping bees happy, cooking raw meat and fish, and as a trap."),
inventory_image = def.inv_texture,
wield_image = def.inv_texture,
drawtype = "mesh",
mesh = "mcl_campfires_campfire.obj",
tiles = {{name="mcl_campfires_log.png"},},
use_texture_alpha = "clip",
groups = { handy=1, axey=1, material_wood=1, not_in_creative_inventory=1, campfire=1, },
paramtype = "light",
paramtype2 = "facedir",
on_rightclick = function (pos, node, player, itemstack, pointed_thing)
if player:get_wielded_item():get_name() == "mcl_fire:flint_and_steel" then
node.name = name.."_lit"
minetest.set_node(pos, node)
end
end,
drop = def.drops,
_mcl_silk_touch_drop = {name},
mcl_sounds.node_sound_wood_defaults(),
selection_box = {
type = 'fixed',
fixed = {-.5, -.5, -.5, .5, -.05, .5}, --left, bottom, front, right, top
},
collision_box = {
type = 'fixed',
fixed = {-.5, -.5, -.5, .5, -.05, .5},
},
_mcl_blast_resistance = 2,
_mcl_hardness = 2,
})
--Define Lit Campfire
minetest.register_node(name.."_lit", {
description = def.description,
_tt_help = S("Cooks food and keeps bees happy."),
_doc_items_longdesc = S("Campfires have multiple uses, including keeping bees happy, cooking raw meat and fish, and as a trap."),
inventory_image = def.inv_texture,
wield_image = def.inv_texture,
drawtype = "mesh",
mesh = "mcl_campfires_campfire_lit.obj",
tiles = {{
name=def.fire_texture,
animation={
type="vertical_frames",
aspect_w=16,
aspect_h=16,
length=2.0
}},
{name=def.lit_logs_texture,
animation={
type="vertical_frames",
aspect_w=16,
aspect_h=16,
length=2.0
}}
},
use_texture_alpha = "clip",
groups = { handy=1, axey=1, material_wood=1, campfire=1, lit_campfire=1 },
paramtype = "light",
paramtype2 = "facedir",
on_rightclick = function (pos, node, player, itemstack, pointed_thing)
if player:get_wielded_item():get_name():find("shovel") then
node.name = name
minetest.set_node(pos, node)
minetest.sound_play("fire_extinguish_flame", {pos = pos, gain = 0.25, max_hear_distance = 16}, true)
end
end,
drop = def.drops,
_mcl_silk_touch_drop = {name.."_lit"},
light_source = def.lightlevel,
mcl_sounds.node_sound_wood_defaults(),
selection_box = {
type = "fixed",
fixed = {-.5, -.5, -.5, .5, -.05, .5}, --left, bottom, front, right, top
},
collision_box = {
type = "fixed",
fixed = {-.5, -.5, -.5, .5, -.05, .5},
},
_mcl_blast_resistance = 2,
_mcl_hardness = 2,
damage_per_second = def.damage,
})
end
local function burn_in_campfire(obj)
local p = obj:get_pos()
if p then
local n = minetest.find_node_near(p,0.4,{"group:lit_campfire"},true)
if n then
mcl_burning.set_on_fire(obj, 5)
end
end
end
local etime = 0
minetest.register_globalstep(function(dtime)
etime = dtime + etime
if etime < 0.5 then return end
etime = 0
for _,pl in pairs(minetest.get_connected_players()) do
burn_in_campfire(pl)
end
for _,ent in pairs(minetest.luaentities) do
if ent.is_mob then
burn_in_campfire(ent.object)
end
end
end)

View file

@ -1,147 +1,9 @@
-- ||||||||||||||||||||||||||||||||
-- ||||||||||| CAMPFIRES ||||||||||
-- ||||||||||||||||||||||||||||||||
-- TO-DO: -- TO-DO:
-- * Add Smoke Particles -- * Add Smoke Particles
-- * Add Spark Particles -- * Add Spark Particles
-- * Add Cooking Meat -- * Add Cooking Meat
-- * Add Working Sounds -- * Add Working Sounds
local modname = minetest.get_modpath(minetest.get_current_modname())
local S = minetest.get_translator(minetest.get_current_modname()) dofile(modname.."/api.lua") -- Load API File
dofile(modname.."/register.lua") -- Load Campfire Registration File
local campfires = {
{ name = "Campfire", lightlevel = 14, techname = "campfire", damage = 1, drops = "mcl_core:charcoal_lump 2" },
{ name = "Soul Campfire", lightlevel = 10, techname = "soul_campfire", damage = 2, drops = "mcl_blackstone:soul_soil" },
}
for _, campfire in pairs(campfires) do
-- Define Campfire
minetest.register_node("mcl_campfires:" .. campfire.techname, {
description = S(campfire.name),
_tt_help = S("Cooks food and keeps bees happy."),
_doc_items_longdesc = S("Campfires have multiple uses, including keeping bees happy, cooking raw meat and fish, and as a trap."),
inventory_image = "mcl_campfires_" .. campfire.techname .. "_inv.png",
drawtype = "mesh",
mesh = "mcl_campfires_campfire.obj",
tiles = {{name="mcl_campfires_log.png"},},
use_texture_alpha = "clip",
groups = { handy=1, axey=1, material_wood=1, not_in_creative_inventory=1, campfire=1, },
paramtype = "light",
paramtype2 = "facedir",
on_rightclick = function (pos, node, player, itemstack, pointed_thing)
if player:get_wielded_item():get_name() == "mcl_fire:flint_and_steel" then
node.name = "mcl_campfires:" .. campfire.techname .. "_lit"
minetest.set_node(pos, node)
end
end,
drop = campfire.drops,
_mcl_silk_touch_drop = {"mcl_campfires:" .. campfire.techname},
mcl_sounds.node_sound_wood_defaults(),
selection_box = {
type = 'fixed',
fixed = {-.5, -.5, -.5, .5, -.05, .5}, --left, bottom, front, right, top
},
collision_box = {
type = 'fixed',
fixed = {-.5, -.5, -.5, .5, -.05, .5},
},
_mcl_blast_resistance = 2,
_mcl_hardness = 2,
})
--Define Lit Campfire
minetest.register_node("mcl_campfires:" .. campfire.techname .. "_lit", {
description = S(campfire.name),
_tt_help = S("Cooks food and keeps bees happy."),
_doc_items_longdesc = S("Campfires have multiple uses, including keeping bees happy, cooking raw meat and fish, and as a trap."),
inventory_image = "mcl_campfires_" .. campfire.techname .. "_inv.png",
drawtype = "mesh",
mesh = "mcl_campfires_campfire_lit.obj",
tiles = {{
name="mcl_campfires_" .. campfire.techname .. "_fire.png",
animation={
type="vertical_frames",
aspect_w=16,
aspect_h=16,
length=2.0
}},
{name="mcl_campfires_" .. campfire.techname .. "_log_lit.png",
animation={
type="vertical_frames",
aspect_w=16,
aspect_h=16,
length=2.0
}}
},
use_texture_alpha = "clip",
groups = { handy=1, axey=1, material_wood=1, campfire=1, lit_campfire=1 },
paramtype = "light",
paramtype2 = "facedir",
on_rightclick = function (pos, node, player, itemstack, pointed_thing)
if player:get_wielded_item():get_name():find("shovel") then
node.name = "mcl_campfires:" .. campfire.techname
minetest.set_node(pos, node)
minetest.sound_play("fire_extinguish_flame", {pos = pos, gain = 0.25, max_hear_distance = 16}, true)
end
end,
drop = campfire.drops,
_mcl_silk_touch_drop = {"mcl_campfires:" .. campfire.techname .. "_lit"},
light_source = campfire.lightlevel,
mcl_sounds.node_sound_wood_defaults(),
selection_box = {
type = "fixed",
fixed = {-.5, -.5, -.5, .5, -.05, .5}, --left, bottom, front, right, top
},
collision_box = {
type = "fixed",
fixed = {-.5, -.5, -.5, .5, -.05, .5},
},
_mcl_blast_resistance = 2,
_mcl_hardness = 2,
damage_per_second = campfire.damage,
})
end
minetest.register_craft({
output = "mcl_campfires:campfire_lit",
recipe = {
{ "", "mcl_core:stick", "" },
{ "mcl_core:stick", "group:coal", "mcl_core:stick" },
{ "group:tree", "group:tree", "group:tree" },
}
})
minetest.register_craft({
output = "mcl_campfires:soul_campfire_lit",
recipe = {
{ "", "mcl_core:stick", "" },
{ "mcl_core:stick", "group:soul_block", "mcl_core:stick" },
{ "group:tree", "group:tree", "group:tree" },
}
})
local function burn_in_campfire(obj)
local p = obj:get_pos()
if p then
local n = minetest.find_node_near(p,0.4,{"group:lit_campfire"},true)
if n then
mcl_burning.set_on_fire(obj, 5)
end
end
end
local etime = 0
minetest.register_globalstep(function(dtime)
etime = dtime + etime
if etime < 0.5 then return end
etime = 0
for _,pl in pairs(minetest.get_connected_players()) do
burn_in_campfire(pl)
end
for _,ent in pairs(minetest.luaentities) do
if ent.is_mob then
burn_in_campfire(ent.object)
end
end
end)

View file

@ -0,0 +1,42 @@
local S = minetest.get_translator(minetest.get_current_modname())
-- Register Plain Campfire
mcl_campfires.register_campfire("mcl_campfires:campfire", {
description = S("Campfire"),
inv_texture = "mcl_campfires_campfire_inv.png",
fire_texture = "mcl_campfires_campfire_fire.png",
lit_logs_texture = "mcl_campfires_campfire_log_lit.png",
drops = "mcl_core:charcoal_lump 2",
lightlevel = 14,
damage = 1,
})
-- Register Soul Campfire
mcl_campfires.register_campfire("mcl_campfires:soul_campfire", {
description = S("Soul Campfire"),
inv_texture = "mcl_campfires_soul_campfire_inv.png",
fire_texture = "mcl_campfires_soul_campfire_fire.png",
lit_logs_texture = "mcl_campfires_soul_campfire_log_lit.png",
drops = "mcl_blackstone:soul_soil",
lightlevel = 10,
damage = 2,
})
-- Register Campfire Crafting
minetest.register_craft({
output = "mcl_campfires:campfire_lit",
recipe = {
{ "", "mcl_core:stick", "" },
{ "mcl_core:stick", "group:coal", "mcl_core:stick" },
{ "group:tree", "group:tree", "group:tree" },
}
})
minetest.register_craft({
output = "mcl_campfires:soul_campfire_lit",
recipe = {
{ "", "mcl_core:stick", "" },
{ "mcl_core:stick", "group:soul_block", "mcl_core:stick" },
{ "group:tree", "group:tree", "group:tree" },
}
})

View file

@ -1,14 +1,14 @@
local S = minetest.get_translator(minetest.get_current_modname()) local S = minetest.get_translator(minetest.get_current_modname())
-- Cartography Table Code. Used to create and copy maps. Needs a GUI still. -- Cartography Table Code. Used to create and copy maps. TODO: Needs a GUI still.
minetest.register_node("mcl_cartography_table:cartography_table", { minetest.register_node("mcl_cartography_table:cartography_table", {
description = S("Cartography Table"), description = S("Cartography Table"),
_tt_help = S("Used to create or copy maps"), _tt_help = S("Used to create or copy maps"),
_doc_items_longdesc = S("Is used to create or copy maps for use.."), _doc_items_longdesc = S("Is used to create or copy maps for use.."),
tiles = { tiles = {
"cartography_table_top.png", "cartography_table_side3.png", "mcl_cartography_table_top.png", "mcl_cartography_table_side3.png",
"cartography_table_side3.png", "cartography_table_side2.png", "mcl_cartography_table_side3.png", "mcl_cartography_table_side2.png",
"cartography_table_side3.png", "cartography_table_side1.png" "mcl_cartography_table_side3.png", "mcl_cartography_table_side1.png"
}, },
paramtype2 = "facedir", paramtype2 = "facedir",
groups = { axey = 2, handy = 1, deco_block = 1, material_wood = 1, flammable = 1 }, groups = { axey = 2, handy = 1, deco_block = 1, material_wood = 1, flammable = 1 },

View file

@ -70,9 +70,9 @@ minetest.register_node("mcl_crimson:warped_fungus", {
_tt_help = S("Warped fungus is a mushroom found in the nether's warped forest."), _tt_help = S("Warped fungus is a mushroom found in the nether's warped forest."),
_doc_items_longdesc = S("Warped fungus is a mushroom found in the nether's warped forest."), _doc_items_longdesc = S("Warped fungus is a mushroom found in the nether's warped forest."),
drawtype = "plantlike", drawtype = "plantlike",
tiles = { "farming_warped_fungus.png" }, tiles = { "mcl_crimson_warped_fungus.png" },
inventory_image = "farming_warped_fungus.png", inventory_image = "mcl_crimson_warped_fungus.png",
wield_image = "farming_warped_fungus.png", wield_image = "mcl_crimson_warped_fungus.png",
sunlight_propagates = true, sunlight_propagates = true,
paramtype = "light", paramtype = "light",
walkable = false, walkable = false,
@ -98,14 +98,14 @@ minetest.register_node("mcl_crimson:warped_fungus", {
mcl_flowerpots.register_potted_flower("mcl_crimson:warped_fungus", { mcl_flowerpots.register_potted_flower("mcl_crimson:warped_fungus", {
name = "warped fungus", name = "warped fungus",
desc = S("Warped Fungus"), desc = S("Warped Fungus"),
image = "farming_warped_fungus.png", image = "mcl_crimson_warped_fungus.png",
}) })
minetest.register_node("mcl_crimson:twisting_vines", { minetest.register_node("mcl_crimson:twisting_vines", {
description = S("Twisting Vines"), description = S("Twisting Vines"),
drawtype = "plantlike", drawtype = "plantlike",
tiles = { "twisting_vines_plant.png" }, tiles = { "mcl_crimson_twisting_vines_plant.png" },
inventory_image = "twisting_vines.png", inventory_image = "mcl_crimson_twisting_vines.png",
sunlight_propagates = true, sunlight_propagates = true,
paramtype = "light", paramtype = "light",
walkable = false, walkable = false,
@ -254,8 +254,8 @@ minetest.register_node("mcl_crimson:weeping_vines", {
minetest.register_node("mcl_crimson:nether_sprouts", { minetest.register_node("mcl_crimson:nether_sprouts", {
description = S("Nether Sprouts"), description = S("Nether Sprouts"),
drawtype = "plantlike", drawtype = "plantlike",
tiles = { "nether_sprouts.png" }, tiles = { "mcl_crimson_nether_sprouts.png" },
inventory_image = "nether_sprouts.png", inventory_image = "mcl_crimson_nether_sprouts.png",
sunlight_propagates = true, sunlight_propagates = true,
paramtype = "light", paramtype = "light",
walkable = false, walkable = false,
@ -276,8 +276,8 @@ minetest.register_node("mcl_crimson:nether_sprouts", {
minetest.register_node("mcl_crimson:warped_roots", { minetest.register_node("mcl_crimson:warped_roots", {
description = S("Warped Roots"), description = S("Warped Roots"),
drawtype = "plantlike", drawtype = "plantlike",
tiles = { "warped_roots.png" }, tiles = { "mcl_crimson_warped_roots.png" },
inventory_image = "warped_roots.png", inventory_image = "mcl_crimson_warped_roots.png",
sunlight_propagates = true, sunlight_propagates = true,
paramtype = "light", paramtype = "light",
walkable = false, walkable = false,
@ -296,13 +296,13 @@ minetest.register_node("mcl_crimson:warped_roots", {
mcl_flowerpots.register_potted_flower("mcl_crimson:warped_roots", { mcl_flowerpots.register_potted_flower("mcl_crimson:warped_roots", {
name = "warped roots", name = "warped roots",
desc = S("Warped Roots"), desc = S("Warped Roots"),
image = "warped_roots.png", image = "mcl_crimson_warped_roots.png",
}) })
minetest.register_node("mcl_crimson:warped_wart_block", { minetest.register_node("mcl_crimson:warped_wart_block", {
description = S("Warped Wart Block"), description = S("Warped Wart Block"),
tiles = {"warped_wart_block.png"}, tiles = {"mcl_crimson_warped_stem_stripped_side.png"},
groups = {handy = 1, hoey = 7, swordy = 1, deco_block = 1, compostability = 85}, groups = {handy = 1, hoey = 7, swordy = 1, deco_block = 1, compostability = 85},
_mcl_hardness = 1, _mcl_hardness = 1,
sounds = mcl_sounds.node_sound_leaves_defaults({ sounds = mcl_sounds.node_sound_leaves_defaults({
@ -313,7 +313,7 @@ minetest.register_node("mcl_crimson:warped_wart_block", {
minetest.register_node("mcl_crimson:shroomlight", { minetest.register_node("mcl_crimson:shroomlight", {
description = S("Shroomlight"), description = S("Shroomlight"),
tiles = {"shroomlight.png"}, tiles = {"mcl_crimson_shroomlight.png"},
groups = {handy = 1, hoey = 7, swordy = 1, deco_block = 1, compostability = 65}, groups = {handy = 1, hoey = 7, swordy = 1, deco_block = 1, compostability = 65},
light_source = minetest.LIGHT_MAX, light_source = minetest.LIGHT_MAX,
_mcl_hardness = 1, _mcl_hardness = 1,
@ -328,10 +328,10 @@ minetest.register_node("mcl_crimson:warped_hyphae", {
_doc_items_longdesc = S("The stem of a warped hyphae"), _doc_items_longdesc = S("The stem of a warped hyphae"),
_doc_items_hidden = false, _doc_items_hidden = false,
tiles = { tiles = {
"warped_hyphae.png", "mcl_crimson_warped_hyphae.png",
"warped_hyphae.png", "mcl_crimson_warped_hyphae.png",
{ {
image="warped_hyphae_side.png", image="mcl_crimson_warped_hyphae_side.png",
animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=2.0} animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=2.0}
}, },
}, },
@ -347,12 +347,12 @@ minetest.register_node("mcl_crimson:warped_hyphae", {
minetest.register_node("mcl_crimson:warped_nylium", { minetest.register_node("mcl_crimson:warped_nylium", {
description = S("Warped Nylium"), description = S("Warped Nylium"),
tiles = { tiles = {
"warped_nylium.png", "mcl_crimson_warped_nylium.png",
"mcl_nether_netherrack.png", "mcl_nether_netherrack.png",
"mcl_nether_netherrack.png^warped_nylium_side.png", "mcl_nether_netherrack.png^mcl_crimson_warped_nylium_side.png",
"mcl_nether_netherrack.png^warped_nylium_side.png", "mcl_nether_netherrack.png^mcl_crimson_warped_nylium_side.png",
"mcl_nether_netherrack.png^warped_nylium_side.png", "mcl_nether_netherrack.png^mcl_crimson_warped_nylium_side.png",
"mcl_nether_netherrack.png^warped_nylium_side.png", "mcl_nether_netherrack.png^mcl_crimson_warped_nylium_side.png",
}, },
is_ground_content = true, is_ground_content = true,
drop = "mcl_nether:netherrack", drop = "mcl_nether:netherrack",
@ -370,7 +370,7 @@ minetest.register_node("mcl_crimson:warped_hyphae_bark", {
_doc_items_longdesc = S("This is a decorative block surrounded by the bark of an hyphae."), _doc_items_longdesc = S("This is a decorative block surrounded by the bark of an hyphae."),
tiles = { tiles = {
{ {
image="warped_hyphae_side.png", image="mcl_crimson_warped_hyphae_side.png",
animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=2.0} animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=2.0}
}, },
}, },
@ -396,7 +396,7 @@ minetest.register_node("mcl_crimson:stripped_warped_hyphae", {
description = S("Stripped Warped Hyphae"), description = S("Stripped Warped Hyphae"),
_doc_items_longdesc = S("The stripped hyphae of a warped fungus"), _doc_items_longdesc = S("The stripped hyphae of a warped fungus"),
_doc_items_hidden = false, _doc_items_hidden = false,
tiles = {"warped_stem_stripped_top.png", "warped_stem_stripped_top.png", "warped_stem_stripped_side.png"}, tiles = {"mcl_crimson_warped_stem_stripped_top.png", "mcl_crimson_warped_stem_stripped_top.png", "mcl_crimson_warped_stem_stripped_side.png"},
paramtype2 = "facedir", paramtype2 = "facedir",
on_place = mcl_util.rotate_axis, on_place = mcl_util.rotate_axis,
groups = {handy = 1, axey = 1, tree = 1, building_block = 1, material_wood = 1}, groups = {handy = 1, axey = 1, tree = 1, building_block = 1, material_wood = 1},
@ -408,7 +408,7 @@ minetest.register_node("mcl_crimson:stripped_warped_hyphae", {
minetest.register_node("mcl_crimson:stripped_warped_hyphae_bark", { minetest.register_node("mcl_crimson:stripped_warped_hyphae_bark", {
description = S("Stripped Warped Hyphae Bark"), description = S("Stripped Warped Hyphae Bark"),
_doc_items_longdesc = S("The stripped hyphae bark of a warped fungus"), _doc_items_longdesc = S("The stripped hyphae bark of a warped fungus"),
tiles = {"warped_stem_stripped_side.png"}, tiles = {"mcl_crimson_warped_stem_stripped_side.png"},
paramtype2 = "facedir", paramtype2 = "facedir",
on_place = mcl_util.rotate_axis, on_place = mcl_util.rotate_axis,
groups = {handy = 1, axey = 1, bark = 1, building_block = 1, material_wood = 1}, groups = {handy = 1, axey = 1, bark = 1, building_block = 1, material_wood = 1},
@ -428,7 +428,7 @@ minetest.register_craft({
minetest.register_node("mcl_crimson:warped_hyphae_wood", { minetest.register_node("mcl_crimson:warped_hyphae_wood", {
description = S("Warped Hyphae Wood"), description = S("Warped Hyphae Wood"),
tiles = {"warped_hyphae_wood.png"}, tiles = {"mcl_crimson_warped_hyphae_wood.png"},
groups = {handy = 5,axey = 1, flammable = 3, wood=1,building_block = 1, material_wood = 1, fire_encouragement = 5, fire_flammability = 20}, groups = {handy = 5,axey = 1, flammable = 3, wood=1,building_block = 1, material_wood = 1, fire_encouragement = 5, fire_flammability = 20},
sounds = mcl_sounds.node_sound_wood_defaults(), sounds = mcl_sounds.node_sound_wood_defaults(),
_mcl_hardness = 2, _mcl_hardness = 2,
@ -456,9 +456,9 @@ minetest.register_node("mcl_crimson:crimson_fungus", {
_tt_help = S("Crimson fungus is a mushroom found in the nether's crimson forest."), _tt_help = S("Crimson fungus is a mushroom found in the nether's crimson forest."),
_doc_items_longdesc = S("Crimson fungus is a mushroom found in the nether's crimson forest."), _doc_items_longdesc = S("Crimson fungus is a mushroom found in the nether's crimson forest."),
drawtype = "plantlike", drawtype = "plantlike",
tiles = { "farming_crimson_fungus.png" }, tiles = { "mcl_crimson_crimson_fungus.png" },
inventory_image = "farming_crimson_fungus.png", inventory_image = "mcl_crimson_crimson_fungus.png",
wield_image = "farming_crimson_fungus.png", wield_image = "mcl_crimson_crimson_fungus.png",
sunlight_propagates = true, sunlight_propagates = true,
paramtype = "light", paramtype = "light",
walkable = false, walkable = false,
@ -488,14 +488,14 @@ minetest.register_node("mcl_crimson:crimson_fungus", {
mcl_flowerpots.register_potted_flower("mcl_crimson:crimson_fungus", { mcl_flowerpots.register_potted_flower("mcl_crimson:crimson_fungus", {
name = "crimson fungus", name = "crimson fungus",
desc = S("Crimson Fungus"), desc = S("Crimson Fungus"),
image = "farming_crimson_fungus.png", image = "mcl_crimson_crimson_fungus.png",
}) })
minetest.register_node("mcl_crimson:crimson_roots", { minetest.register_node("mcl_crimson:crimson_roots", {
description = S("Crimson Roots"), description = S("Crimson Roots"),
drawtype = "plantlike", drawtype = "plantlike",
tiles = { "crimson_roots.png" }, tiles = { "mcl_crimson_crimson_roots.png" },
inventory_image = "crimson_roots.png", inventory_image = "mcl_crimson_crimson_roots.png",
sunlight_propagates = true, sunlight_propagates = true,
paramtype = "light", paramtype = "light",
walkable = false, walkable = false,
@ -514,7 +514,7 @@ minetest.register_node("mcl_crimson:crimson_roots", {
mcl_flowerpots.register_potted_flower("mcl_crimson:crimson_roots", { mcl_flowerpots.register_potted_flower("mcl_crimson:crimson_roots", {
name = "crimson roots", name = "crimson roots",
desc = S("Crimson Roots"), desc = S("Crimson Roots"),
image = "crimson_roots.png", image = "mcl_crimson_crimson_roots.png",
}) })
minetest.register_node("mcl_crimson:crimson_hyphae", { minetest.register_node("mcl_crimson:crimson_hyphae", {
@ -522,10 +522,10 @@ minetest.register_node("mcl_crimson:crimson_hyphae", {
_doc_items_longdesc = S("The stem of a crimson hyphae"), _doc_items_longdesc = S("The stem of a crimson hyphae"),
_doc_items_hidden = false, _doc_items_hidden = false,
tiles = { tiles = {
"crimson_hyphae.png", "mcl_crimson_hyphae.png",
"crimson_hyphae.png", "mcl_crimson_hyphae.png",
{ {
image="crimson_hyphae_side.png", image="mcl_crimson_hyphae_side.png",
animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=2.0} animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=2.0}
}, },
}, },
@ -545,7 +545,7 @@ minetest.register_node("mcl_crimson:crimson_hyphae_bark", {
_doc_items_longdesc = S("This is a decorative block surrounded by the bark of an hyphae."), _doc_items_longdesc = S("This is a decorative block surrounded by the bark of an hyphae."),
tiles = { tiles = {
{ {
image="crimson_hyphae_side.png", image="mcl_crimson_hyphae_side.png",
animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=2.0} animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=2.0}
}, },
}, },
@ -571,7 +571,7 @@ minetest.register_node("mcl_crimson:stripped_crimson_hyphae", {
description = S("Stripped Crimson Hyphae"), description = S("Stripped Crimson Hyphae"),
_doc_items_longdesc = S("The stripped stem of a crimson hyphae"), _doc_items_longdesc = S("The stripped stem of a crimson hyphae"),
_doc_items_hidden = false, _doc_items_hidden = false,
tiles = {"crimson_stem_stripped_top.png", "crimson_stem_stripped_top.png", "crimson_stem_stripped_side.png"}, tiles = {"mcl_crimson_crimson_stem_stripped_top.png", "mcl_crimson_crimson_stem_stripped_top.png", "mcl_crimson_crimson_stem_stripped_side.png"},
paramtype2 = "facedir", paramtype2 = "facedir",
on_place = mcl_util.rotate_axis, on_place = mcl_util.rotate_axis,
groups = {handy = 1, axey = 1, tree = 1, building_block = 1, material_wood = 1}, groups = {handy = 1, axey = 1, tree = 1, building_block = 1, material_wood = 1},
@ -583,7 +583,7 @@ minetest.register_node("mcl_crimson:stripped_crimson_hyphae", {
minetest.register_node("mcl_crimson:stripped_crimson_hyphae_bark", { minetest.register_node("mcl_crimson:stripped_crimson_hyphae_bark", {
description = S("Stripped Crimson Hyphae Bark"), description = S("Stripped Crimson Hyphae Bark"),
_doc_items_longdesc = S("The stripped wood of a crimson hyphae"), _doc_items_longdesc = S("The stripped wood of a crimson hyphae"),
tiles = {"crimson_stem_stripped_side.png"}, tiles = {"mcl_crimson_crimson_stem_stripped_side.png"},
paramtype2 = "facedir", paramtype2 = "facedir",
on_place = mcl_util.rotate_axis, on_place = mcl_util.rotate_axis,
groups = {handy = 1, axey = 1, bark = 1, building_block = 1, material_wood = 1}, groups = {handy = 1, axey = 1, bark = 1, building_block = 1, material_wood = 1},
@ -603,7 +603,7 @@ minetest.register_craft({
minetest.register_node("mcl_crimson:crimson_hyphae_wood", { minetest.register_node("mcl_crimson:crimson_hyphae_wood", {
description = S("Crimson Hyphae Wood"), description = S("Crimson Hyphae Wood"),
tiles = {"crimson_hyphae_wood.png"}, tiles = {"mcl_crimson_hyphae_wood.png"},
groups = {handy = 5, axey = 1, wood = 1, building_block = 1, material_wood = 1}, groups = {handy = 5, axey = 1, wood = 1, building_block = 1, material_wood = 1},
sounds = mcl_sounds.node_sound_wood_defaults(), sounds = mcl_sounds.node_sound_wood_defaults(),
_mcl_hardness = 2, _mcl_hardness = 2,
@ -612,12 +612,12 @@ minetest.register_node("mcl_crimson:crimson_hyphae_wood", {
minetest.register_node("mcl_crimson:crimson_nylium", { minetest.register_node("mcl_crimson:crimson_nylium", {
description = S("Crimson Nylium"), description = S("Crimson Nylium"),
tiles = { tiles = {
"crimson_nylium.png", "mcl_crimson_nylium.png",
"mcl_nether_netherrack.png", "mcl_nether_netherrack.png",
"mcl_nether_netherrack.png^crimson_nylium_side.png", "mcl_nether_netherrack.png^mcl_crimson_nylium_side.png",
"mcl_nether_netherrack.png^crimson_nylium_side.png", "mcl_nether_netherrack.png^mcl_crimson_nylium_side.png",
"mcl_nether_netherrack.png^crimson_nylium_side.png", "mcl_nether_netherrack.png^mcl_crimson_nylium_side.png",
"mcl_nether_netherrack.png^crimson_nylium_side.png", "mcl_nether_netherrack.png^mcl_crimson_nylium_side.png",
}, },
groups = {pickaxey = 1, building_block = 1, material_stone = 1}, groups = {pickaxey = 1, building_block = 1, material_stone = 1},
sounds = mcl_sounds.node_sound_stone_defaults(), sounds = mcl_sounds.node_sound_stone_defaults(),
@ -676,7 +676,7 @@ mcl_doors:register_trapdoor("mcl_crimson:crimson_trapdoor", {
_doc_items_longdesc = S("Wooden trapdoors are horizontal barriers which can be opened and closed by hand or a redstone signal. They occupy the upper or lower part of a block, depending on how they have been placed. When open, they can be climbed like a ladder."), _doc_items_longdesc = S("Wooden trapdoors are horizontal barriers which can be opened and closed by hand or a redstone signal. They occupy the upper or lower part of a block, depending on how they have been placed. When open, they can be climbed like a ladder."),
_doc_items_usagehelp = S("To open or close the trapdoor, rightclick it or send a redstone signal to it."), _doc_items_usagehelp = S("To open or close the trapdoor, rightclick it or send a redstone signal to it."),
tile_front = "mcl_crimson_crimson_trapdoor.png", tile_front = "mcl_crimson_crimson_trapdoor.png",
tile_side = "crimson_hyphae_wood.png", tile_side = "mcl_crimson_hyphae_wood.png",
wield_image = "mcl_crimson_crimson_trapdoor.png", wield_image = "mcl_crimson_crimson_trapdoor.png",
groups = {handy=1,axey=1, mesecon_effector_on=1, material_wood=1, flammable=-1}, groups = {handy=1,axey=1, mesecon_effector_on=1, material_wood=1, flammable=-1},
_mcl_hardness = 3, _mcl_hardness = 3,
@ -714,7 +714,7 @@ mcl_doors:register_trapdoor("mcl_crimson:warped_trapdoor", {
_doc_items_longdesc = S("Wooden trapdoors are horizontal barriers which can be opened and closed by hand or a redstone signal. They occupy the upper or lower part of a block, depending on how they have been placed. When open, they can be climbed like a ladder."), _doc_items_longdesc = S("Wooden trapdoors are horizontal barriers which can be opened and closed by hand or a redstone signal. They occupy the upper or lower part of a block, depending on how they have been placed. When open, they can be climbed like a ladder."),
_doc_items_usagehelp = S("To open or close the trapdoor, rightclick it or send a redstone signal to it."), _doc_items_usagehelp = S("To open or close the trapdoor, rightclick it or send a redstone signal to it."),
tile_front = "mcl_crimson_warped_trapdoor.png", tile_front = "mcl_crimson_warped_trapdoor.png",
tile_side = "warped_hyphae_wood.png", tile_side = "mcl_crimson_warped_hyphae_wood.png",
wield_image = "mcl_crimson_warped_trapdoor.png", wield_image = "mcl_crimson_warped_trapdoor.png",
groups = {handy=1,axey=1, mesecon_effector_on=1, material_wood=1, flammable=-1}, groups = {handy=1,axey=1, mesecon_effector_on=1, material_wood=1, flammable=-1},
_mcl_hardness = 3, _mcl_hardness = 3,

View file

@ -456,6 +456,12 @@ minetest.register_craft({
recipe = {{"mcl_core:lapis"}}, recipe = {{"mcl_core:lapis"}},
}) })
--[[ Uncomment when crafting blue dye back into lapis is removed.
minetest.register_craft({
output = "mcl_dye:blue",
recipe = {{"mcl_flowers:cornflower"}},
})]]
minetest.register_craft({ minetest.register_craft({
output = "mcl_dye:lightblue", output = "mcl_dye:lightblue",
recipe = {{"mcl_flowers:blue_orchid"}}, recipe = {{"mcl_flowers:blue_orchid"}},
@ -526,6 +532,12 @@ minetest.register_craft({
recipe = {{"mcl_flowers:rose_bush"}}, recipe = {{"mcl_flowers:rose_bush"}},
}) })
--[[Uncomment when crafting white dye back into bonemeal is removed
minetest.register_craft({
output = "mcl_dye:white",
recipe = {{"mcl_flowers:lily_of_the_valley"}},
})]]
minetest.register_craft({ minetest.register_craft({
type = "cooking", type = "cooking",
output = "mcl_dye:dark_green", output = "mcl_dye:dark_green",
@ -533,6 +545,13 @@ minetest.register_craft({
cooktime = 10, cooktime = 10,
}) })
minetest.register_craft({
type = "cooking",
output = "mcl_dye:green",
recipe = "group:sea_pickle",
cooktime = 10,
})
-- Dye mixing recipes. -- Dye mixing recipes.
-- --
minetest.register_craft({ minetest.register_craft({

View file

@ -11,6 +11,9 @@ White Tulip=
Allium= Allium=
Azure Bluet= Azure Bluet=
Blue Orchid= Blue Orchid=
Wither Rose=
Lily of the Valley=
Cornflower=
Tall Grass= Tall Grass=
Tall grass is a small plant which often occurs on the surface of grasslands. It can be harvested for wheat seeds. By using bone meal, tall grass can be turned into double tallgrass which is two blocks high.= Tall grass is a small plant which often occurs on the surface of grasslands. It can be harvested for wheat seeds. By using bone meal, tall grass can be turned into double tallgrass which is two blocks high.=
Fern= Fern=

View file

@ -66,3 +66,15 @@ mcl_flowers.register_simple_flower("wither_rose", {
selection_box = { -3/16, -0.5, -3/16, 3/16, 6/16, 3/16 }, selection_box = { -3/16, -0.5, -3/16, 3/16, 6/16, 3/16 },
potted = true, potted = true,
}) })
mcl_flowers.register_simple_flower("lily_of_the_valley", {
desc = S("Lily of the Valley"),
image = "mcl_flowers_lily_of_the_valley.png",
selection_box = { -5/16, -0.5, -5/16, 4/16, 5/16, 5/16 },
potted = true,
})
mcl_flowers.register_simple_flower("cornflower", {
desc = S("Cornflower"),
image = "mcl_flowers_cornflower.png",
selection_box = { -4/16, -0.5, -4/16, 4/16, 3/16, 4/16 },
potted = true,
})

File diff suppressed because one or more lines are too long

View file

@ -24,7 +24,7 @@ minetest.mkdir(map_textures_path)
local function load_json_file(name) local function load_json_file(name)
local file = assert(io.open(modpath .. "/" .. name .. ".json", "r")) local file = assert(io.open(modpath .. "/" .. name .. ".json", "r"))
local data = minetest.parse_json(file:read()) local data = minetest.parse_json(file:read("*all"))
file:close() file:close()
return data return data
end end

View file

@ -413,7 +413,7 @@ minetest.register_craftitem("mcl_mobitems:glow_ink_sac", {
description = S("Glow Ink Sac"), description = S("Glow Ink Sac"),
_doc_items_longdesc = S("Use it to craft the Glow Item Frame."), _doc_items_longdesc = S("Use it to craft the Glow Item Frame."),
_doc_items_usagehelp = S("Use the Glow Ink Sac and the normal Item Frame to craft the Glow Item Frame."), _doc_items_usagehelp = S("Use the Glow Ink Sac and the normal Item Frame to craft the Glow Item Frame."),
inventory_image = "extra_mobs_glow_ink_sac.png", inventory_image = "mcl_mobitems_glow_ink_sac.png",
groups = { craftitem = 1 }, groups = { craftitem = 1 },
}) })

View file

@ -25,9 +25,7 @@ local mt_get_node = minetest.get_node
local mt_get_node_level = minetest.get_node_level local mt_get_node_level = minetest.get_node_level
local mt_get_node_max_level = minetest.get_node_max_level local mt_get_node_max_level = minetest.get_node_max_level
local mt_get_node_or_nil = minetest.get_node_or_nil local mt_get_node_or_nil = minetest.get_node_or_nil
local mt_get_node_timer = minetest.get_node_timer
local mt_get_meta = minetest.get_meta local mt_get_meta = minetest.get_meta
local mt_hash_node_position = minetest.hash_node_position
local mt_set_node = minetest.set_node local mt_set_node = minetest.set_node
local mt_swap_node = minetest.swap_node local mt_swap_node = minetest.swap_node
local mt_pos_to_string = minetest.pos_to_string local mt_pos_to_string = minetest.pos_to_string
@ -52,18 +50,11 @@ local table = table
local kelp = {} local kelp = {}
mcl_ocean.kelp = kelp mcl_ocean.kelp = kelp
-- Kelp minimum and maximum age. Once reached the maximum, kelp no longer grows. -- Once reach the maximum, kelp no longer grows.
kelp.MIN_AGE = 0 kelp.MIN_AGE = 0
kelp.MAX_AGE = 25 kelp.MAX_AGE = 25
-- Tick interval (in seconds) for updating kelp. kelp.TICK = 0.2 -- Tick interval (in seconds) for updating kelp.
kelp.TICK = 0.2
-- Tick interval (in seconds) to store kelp meta.
kelp.META_TICK = 2
-- Max age queue length
kelp.MAX_AGE_QUEUE = 20
-- The average amount of growth for kelp in a day is 2.16 (https://youtu.be/5Bp4lAjAk3I) -- The average amount of growth for kelp in a day is 2.16 (https://youtu.be/5Bp4lAjAk3I)
-- Normally, a day lasts 20 minutes, meaning kelp.next_grow() is executed -- Normally, a day lasts 20 minutes, meaning kelp.next_grow() is executed
@ -81,19 +72,6 @@ kelp.ROLL_GROWTH_DENOMINATOR = 100 * 1200
-- Sounds used to dig and place kelp. -- Sounds used to dig and place kelp.
kelp.leaf_sounds = mcl_sounds.node_sound_leaves_defaults() kelp.leaf_sounds = mcl_sounds.node_sound_leaves_defaults()
-- Pool storing nodetimers
kelp.timers_pool = {}
-- Pool storing age, indexed by pos_hash.
kelp.age_pool = {}
-- Queue(List) of hashed positions to save their ages.
-- Invalid ones may still persist in this queue.
kelp.age_queue = {}
-- Stores only valid positions of each hashed postiions.
kelp.age_queue_pos = {}
-- is age in the growable range? -- is age in the growable range?
function kelp.is_age_growable(age) function kelp.is_age_growable(age)
return age >= 0 and age < kelp.MAX_AGE return age >= 0 and age < kelp.MAX_AGE
@ -177,7 +155,8 @@ end
-- Roll whether to grow kelp or not. -- Roll whether to grow kelp or not.
function kelp.roll_growth(numerator, denominator) function kelp.roll_growth(numerator, denominator)
-- Optional params: numerator, denominator -- Optional params: numerator, denominator
return math.random(denominator or kelp.ROLL_GROWTH_DENOMINATOR) <= (numerator or kelp.ROLL_GROWTH_NUMERATOR) --return math.random(denominator or kelp.ROLL_GROWTH_DENOMINATOR) <= (numerator or kelp.ROLL_GROWTH_NUMERATOR)
return true -- probability done by ABM
end end
@ -230,87 +209,50 @@ function kelp.next_param2(param2)
return math.min(param2+16 - param2 % 16, 255); return math.min(param2+16 - param2 % 16, 255);
end end
local function store_age (pos, age)
-- Stores age from kelp.age_queue* into their respective meta
function kelp.store_meta()
local count = 0
for _ in pairs(kelp.age_queue_pos) do
count = count + 1
end
-- chatlog(string.format("Storing age metadata: %d in queue", #kelp.age_queue))
-- chatlog(string.format("Storing age metadata: %d valid in queue", count))
for i=1,#kelp.age_queue do
local pos_hash = kelp.age_queue[i]
local pos = kelp.age_queue_pos[pos_hash]
-- queued hashes may no longer point to a valid pos, e.g. kelp is destroyed.
if pos then if pos then
mt_get_meta(pos):set_int("mcl_ocean:kelp_age", kelp.age_pool[pos_hash]) --minetest.log("age: ".. tostring(age) .. ", pos: ".. mt_pos_to_string(pos))
mt_get_meta(pos):set_int("mcl_ocean:kelp_age", age)
end end
end end
kelp.age_queue = {}
kelp.age_queue_pos = {} local function retrieve_age (pos, include_nil)
local meta = mt_get_meta(pos)
if include_nil then
local age_set = meta:contains("mcl_ocean:kelp_age")
if not age_set then
return nil
end end
-- Store and queue a kelp's age to be saved into meta later.
function kelp.store_age(age, pos, pos_hash)
-- Watched params: pos
-- Optional params: pos_hash
local pos_hash = pos_hash or mt_hash_node_position(pos)
kelp.age_pool[pos_hash] = age
if not kelp.age_queue_pos[pos_hash] then
table.insert(kelp.age_queue, pos_hash)
kelp.age_queue_pos[pos_hash] = pos
return true, pos_hash
end end
return meta:get_int("mcl_ocean:kelp_age")
return false, pos_hash
end end
-- Initialise a kelp's age. -- Initialise a kelp's age.
function kelp.init_age(pos, age, pos_hash, meta) function kelp.init_age(pos, age, from_lbm)
-- Watched params: pos -- Watched params: pos
-- Optional params: age, pos_hash, meta -- Optional params: age, from_lbm
local pos_hash = pos_hash or mt_hash_node_position(pos)
local meta = meta or mt_get_meta(pos) local new_age
local stored_age = retrieve_age(pos, from_lbm)
local age = age
if age then if age then
kelp.store_age(age, pos, pos_hash) --minetest.log("age: " .. tostring(age))
elseif not meta:contains("mcl_ocean:kelp_age") then store_age(pos, age)
age = kelp.roll_init_age() new_age = age
kelp.store_age(age, pos, pos_hash) elseif not stored_age then
new_age = kelp.roll_init_age()
--minetest.log("no kelp age set so init with: " .. tostring(new_age))
store_age(pos, new_age)
else else
age = meta:get_int("mcl_ocean:kelp_age") --minetest.log("stored_age: " .. tostring(stored_age))
if not kelp.age_pool[pos_hash] then new_age = stored_age
kelp.age_pool[pos_hash] = age
end
end end
return age, pos_hash, meta return new_age
end end
-- Initialise kelp nodetimer.
function kelp.init_timer(pos, pos_hash)
-- Optional params: pos_hash
local pos_hash = pos_hash or mt_hash_node_position(pos)
local timer = kelp.timers_pool[pos_hash]
if not timer then
timer = mt_get_node_timer(pos)
kelp.timers_pool[pos_hash] = timer
end
if not timer:is_started() then
timer:start(kelp.TICK)
end
return pos_hash
end
-- Apply next kelp height. The surface is swapped. so on_construct is skipped. -- Apply next kelp height. The surface is swapped. so on_construct is skipped.
function kelp.next_height(pos, node, pos_tip, node_tip, submerged, downward_flowing) function kelp.next_height(pos, node, pos_tip, node_tip, submerged, downward_flowing)
-- Modified params: node -- Modified params: node
@ -342,12 +284,11 @@ end
-- Grow next kelp. -- Grow next kelp.
function kelp.next_grow(age, pos, node, pos_hash, pos_tip, node_tip, submerged, downward_flowing) function kelp.next_grow(age, pos, node, pos_tip, node_tip, submerged, downward_flowing)
-- Watched params: pos -- Watched params: pos
-- Modified params: node -- Modified params: node
-- Optional params: node, pos_hash, pos_tip, node_tip, submerged, downward_flowing -- Optional params: node, pos_tip, node_tip, submerged, downward_flowing
local node = node or mt_get_node(pos) local node = node or mt_get_node(pos)
local pos_hash = pos_hash or mt_hash_node_position(pos)
local pos_tip = pos_tip local pos_tip = pos_tip
local node_tip = node_tip or (pos_tip and mt_get_node(pos_tip)) local node_tip = node_tip or (pos_tip and mt_get_node(pos_tip))
if not pos_tip then if not pos_tip then
@ -361,8 +302,8 @@ function kelp.next_grow(age, pos, node, pos_hash, pos_tip, node_tip, submerged,
end end
kelp.next_height(pos, node, pos_tip, node_tip, submerged, downward_flowing) kelp.next_height(pos, node, pos_tip, node_tip, submerged, downward_flowing)
store_age(pos, age)
return kelp.store_age(age, pos, pos_hash), node, pos_hash, pos_tip, node_tip, submerged, downward_flowing return true, node, pos_tip, node_tip, submerged, downward_flowing
end end
@ -420,75 +361,68 @@ function kelp.surface_on_dig(pos, node, digger)
kelp.detach_dig(pos, pos, true, node) kelp.detach_dig(pos, pos, true, node)
end end
function kelp.surface_after_dig_node(pos, node) function kelp.surface_after_dig_node(pos, node)
return mt_set_node(pos, {name=minetest.registered_nodes[node.name].node_dig_prediction}) return mt_set_node(pos, {name=minetest.registered_nodes[node.name].node_dig_prediction})
end end
function kelp.surface_on_timer(pos) local function detach_unsubmerged(pos)
local node = mt_get_node(pos) local node = mt_get_node(pos)
local pos_hash
-- Update detahed kelps
local dig_pos,_, height = kelp.find_unsubmerged(pos, node) local dig_pos,_, height = kelp.find_unsubmerged(pos, node)
if dig_pos then if dig_pos then
pos_hash = mt_hash_node_position(pos)
mt_sound_play(mt_registered_nodes[node.name].sounds.dug, { gain = 0.5, pos = dig_pos }, true) mt_sound_play(mt_registered_nodes[node.name].sounds.dug, { gain = 0.5, pos = dig_pos }, true)
kelp.detach_dig(dig_pos, pos, true, node, height) kelp.detach_dig(dig_pos, pos, true, node, height)
kelp.store_age(kelp.roll_init_age(), pos, pos_hash) local new_age = kelp.roll_init_age()
store_age(pos, new_age)
end
end end
-- Grow kelp on chance local function grow_kelp (pos)
local node = mt_get_node(pos)
if kelp.roll_growth() then if kelp.roll_growth() then
pos_hash = pos_hash or mt_hash_node_position(pos) local age = retrieve_age(pos)
local age = kelp.age_pool[pos_hash]
if kelp.is_age_growable(age) then if not age then
kelp.next_grow(age+1, pos, node, pos_hash) --minetest.log("init a new age as not set: " .. mt_pos_to_string(pos))
end kelp.init_age(pos, nil)
end end
return true if kelp.is_age_growable(age) then
--minetest.log("age growable: ".. tostring(age) .. ", pos: ".. mt_pos_to_string(pos))
kelp.next_grow(age+1, pos, node)
else
--minetest.log("age not: ".. tostring(age) .. ", pos: ".. mt_pos_to_string(pos))
end
end
end end
function kelp.surface_on_construct(pos) function kelp.surface_on_construct(pos)
local pos_hash = mt_hash_node_position(pos) --minetest.log("on construct kelp called")
kelp.init_age(pos, nil, pos_hash) kelp.init_age(pos, nil)
kelp.init_timer(pos, pos_hash)
end end
function kelp.surface_on_destruct(pos) function kelp.surface_on_destruct(pos)
local node = mt_get_node(pos) local node = mt_get_node(pos)
local pos_hash = mt_hash_node_position(pos)
-- on_falling callback. Activated by pistons for falling nodes too. -- on_falling callback. Activated by pistons for falling nodes too.
-- I'm not sure this works. I think piston digs water and the unsubmerged nature drops kelp.
if kelp.is_falling(pos, node) then if kelp.is_falling(pos, node) then
kelp.detach_drop(pos, kelp.get_height(node.param2)) kelp.detach_drop(pos, kelp.get_height(node.param2))
end end
-- Removes position from queue
kelp.age_queue_pos[pos_hash] = nil
end end
function kelp.surface_on_mvps_move(pos, node, oldpos, nodemeta) function kelp.surface_on_mvps_move(pos, node, oldpos, nodemeta)
-- Pistons moving falling nodes will have already activated on_falling callback. -- Pistons moving falling nodes will have already activated on_falling callback.
--minetest.log("kelp.surface_on_mvps_move: " .. mt_pos_to_string(pos))
kelp.detach_dig(pos, pos, mt_get_item_group(node.name, "falling_node") ~= 1, node) kelp.detach_dig(pos, pos, mt_get_item_group(node.name, "falling_node") ~= 1, node)
end end
-- NOTE: Old ABM implementation.
-- local function surface_unsubmerged_abm(pos, node)
-- local dig_pos = find_unsubmerged(pos, node)
-- if dig_pos then
-- detach_dig(dig_pos, pos, node, true)
-- end
-- return true
-- end
function kelp.kelp_on_place(itemstack, placer, pointed_thing) function kelp.kelp_on_place(itemstack, placer, pointed_thing)
if pointed_thing.type ~= "node" or not placer then if pointed_thing.type ~= "node" or not placer then
return itemstack return itemstack
@ -576,48 +510,29 @@ function kelp.kelp_on_place(itemstack, placer, pointed_thing)
end end
-- Initialize age and timer when it's planted on a new surface. -- Initialize age and timer when it's planted on a new surface.
local pos_hash = mt_hash_node_position(pos_under) local init_age = kelp.roll_init_age()
if new_surface then if new_surface then
kelp.init_age(pos_under, nil, pos_hash) kelp.init_age(pos_under, init_age)
kelp.init_timer(pos_under, pos_hash)
else else
kelp.store_age(kelp.roll_init_age(), pos_under, pos_hash) store_age(pos_under, init_age)
end end
return itemstack return itemstack
end end
function kelp.lbm_register(pos)
function kelp.lbm_register_nodetimer(pos, node) kelp.init_age(pos, nil, true)
local pos_hash = mt_hash_node_position(pos)
kelp.init_age(pos, nil, pos_hash)
kelp.init_timer(pos, pos_hash)
end end
minetest.register_lbm({
label = "Kelp initialise",
name = "mcl_ocean:kelp_init",
nodenames = { "group:kelp" },
run_at_every_load = true, -- so old kelps are also initialised
action = kelp.lbm_register,
})
local gstep_time = 0
function kelp.globalstep(dtime)
if #kelp.age_queue > kelp.MAX_AGE_QUEUE then
kelp.store_meta()
end
gstep_time = gstep_time + dtime
if gstep_time < kelp.META_TICK then
return
end
gstep_time = 0
if #kelp.age_queue > 0 then
kelp.store_meta()
end
end
function kelp.on_shutdown()
if #kelp.age_queue > 0 then
kelp.store_meta()
end
end
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
-- Kelp registration API -- Kelp registration API
@ -664,7 +579,6 @@ kelp.surface_deftemplate = {
on_destruct = kelp.surface_on_destruct, on_destruct = kelp.surface_on_destruct,
on_dig = kelp.surface_on_dig, on_dig = kelp.surface_on_dig,
after_dig_node = kelp.surface_after_dig_node, after_dig_node = kelp.surface_after_dig_node,
on_timer = kelp.surface_on_timer,
mesecon = { on_mvps_move = kelp.surface_on_mvps_move, }, mesecon = { on_mvps_move = kelp.surface_on_mvps_move, },
drop = "", -- drops are handled in on_dig drop = "", -- drops are handled in on_dig
--_mcl_falling_node_alternative = is_falling and nodename or nil, --_mcl_falling_node_alternative = is_falling and nodename or nil,
@ -811,35 +725,28 @@ minetest.register_craft({
burntime = 200, burntime = 200,
}) })
-- Global registration ------------------------------------------------------------------------ minetest.register_abm({
label = "Kelp drops",
minetest.register_lbm({
label = "Kelp initialise",
name = "mcl_ocean:kelp_init",
nodenames = { "group:kelp" }, nodenames = { "group:kelp" },
run_at_every_load = true, -- so old kelps are also initialised interval = 1.0,
action = kelp.lbm_register_nodetimer, chance = 1,
catch_up = false,
action = detach_unsubmerged, --surface_unsubmerged_abm,
}) })
minetest.register_globalstep(kelp.globalstep) -- 50% growth over a minute https://minecraft.fandom.com/wiki/Tutorials/Kelp_farming
minetest.register_on_shutdown(kelp.on_shutdown) -- 14% chance every random tick
-- On average, blocks are updated every 68.27 seconds (1365.33 game ticks)
-- NOTE: Old ABM implementation. -- 1 in 7 every 68
-- minetest.register_abm({ -- 1 in 28 every 17
-- label = "Kelp drops", -- 1 in 21 every 22
-- nodenames = { "group:kelp" }, -- https://minecraft.fandom.com/wiki/Tick#Random_tick
-- interval = 1.0, minetest.register_abm({
-- chance = 1, label = "Kelp growth",
-- catch_up = false, nodenames = { "group:kelp" },
-- action = surface_unsubmerged_abm, interval = 17, --17
-- }) chance = 28,
-- catch_up = false,
-- minetest.register_abm({ action = grow_kelp,
-- label = "Kelp growth", })
-- nodenames = { "group:kelp" },
-- interval = 45,
-- chance = 12,
-- catch_up = false,
-- action = grow_abm,
-- })

View file

@ -6,10 +6,10 @@ local eat = minetest.item_eat(6, "mcl_core:bowl") --6 hunger points, player rece
local flower_effect = { local flower_effect = {
[ "mcl_flowers:allium" ] = "fire_resistance", [ "mcl_flowers:allium" ] = "fire_resistance",
[ "mcl_flowers:tulip_white" ] = "poison", [ "mcl_flowers:lily_of_the_valley" ] = "poison",
[ "mcl_flowers:blue_orchid" ] = "hunger", [ "mcl_flowers:blue_orchid" ] = "hunger",
[ "mcl_flowers:dandelion" ] = "hunger", [ "mcl_flowers:dandelion" ] = "hunger",
[ "mcl_flowers:peony" ] = "jump", [ "mcl_flowers:cornflower" ] = "jump",
[ "mcl_flowers:oxeye_daisy" ] = "regeneration", [ "mcl_flowers:oxeye_daisy" ] = "regeneration",
[ "mcl_flowers:poppy" ] = "night_vision" [ "mcl_flowers:poppy" ] = "night_vision"
} }
@ -108,7 +108,7 @@ minetest.register_craft({
minetest.register_craft({ minetest.register_craft({
type = "shapeless", type = "shapeless",
output = "mcl_sus_stew:stew", output = "mcl_sus_stew:stew",
recipe = {"mcl_mushrooms:mushroom_red", "mcl_mushrooms:mushroom_brown", "mcl_core:bowl", "mcl_flowers:tulip_white"}, recipe = {"mcl_mushrooms:mushroom_red", "mcl_mushrooms:mushroom_brown", "mcl_core:bowl", "mcl_flowers:lily_of_the_valley"},
}) })
minetest.register_craft({ minetest.register_craft({
@ -126,7 +126,7 @@ minetest.register_craft({
minetest.register_craft({ minetest.register_craft({
type = "shapeless", type = "shapeless",
output = "mcl_sus_stew:stew", output = "mcl_sus_stew:stew",
recipe = {"mcl_mushrooms:mushroom_red", "mcl_mushrooms:mushroom_brown", "mcl_core:bowl", "mcl_flowers:peony"}, recipe = {"mcl_mushrooms:mushroom_red", "mcl_mushrooms:mushroom_brown", "mcl_core:bowl", "mcl_flowers:cornflower"},
}) })
minetest.register_craft({ minetest.register_craft({

View file

@ -5395,6 +5395,8 @@ local function register_decorations()
register_flower("allium", nil, 0) -- flower Forest only register_flower("allium", nil, 0) -- flower Forest only
register_flower("blue_orchid", {"Swampland"}, 64500, false) register_flower("blue_orchid", {"Swampland"}, 64500, false)
register_flower("lily_of_the_valley", nil, 325)
register_flower("cornflower", flower_biomes2, 486)
end end
-- Decorations in non-Overworld dimensions -- Decorations in non-Overworld dimensions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 785 B

View file

Before

Width:  |  Height:  |  Size: 251 B

After

Width:  |  Height:  |  Size: 251 B

View file

Before

Width:  |  Height:  |  Size: 201 B

After

Width:  |  Height:  |  Size: 201 B

View file

Before

Width:  |  Height:  |  Size: 297 B

After

Width:  |  Height:  |  Size: 297 B

View file

Before

Width:  |  Height:  |  Size: 332 B

After

Width:  |  Height:  |  Size: 332 B

View file

Before

Width:  |  Height:  |  Size: 261 B

After

Width:  |  Height:  |  Size: 261 B

View file

Before

Width:  |  Height:  |  Size: 495 B

After

Width:  |  Height:  |  Size: 495 B

View file

Before

Width:  |  Height:  |  Size: 304 B

After

Width:  |  Height:  |  Size: 304 B

View file

Before

Width:  |  Height:  |  Size: 194 B

After

Width:  |  Height:  |  Size: 194 B

View file

Before

Width:  |  Height:  |  Size: 190 B

After

Width:  |  Height:  |  Size: 190 B

View file

Before

Width:  |  Height:  |  Size: 231 B

After

Width:  |  Height:  |  Size: 231 B

View file

Before

Width:  |  Height:  |  Size: 214 B

After

Width:  |  Height:  |  Size: 214 B

View file

Before

Width:  |  Height:  |  Size: 264 B

After

Width:  |  Height:  |  Size: 264 B

View file

Before

Width:  |  Height:  |  Size: 217 B

After

Width:  |  Height:  |  Size: 217 B

View file

Before

Width:  |  Height:  |  Size: 239 B

After

Width:  |  Height:  |  Size: 239 B

View file

Before

Width:  |  Height:  |  Size: 170 B

After

Width:  |  Height:  |  Size: 170 B

View file

Before

Width:  |  Height:  |  Size: 239 B

After

Width:  |  Height:  |  Size: 239 B

View file

Before

Width:  |  Height:  |  Size: 250 B

After

Width:  |  Height:  |  Size: 250 B

View file

Before

Width:  |  Height:  |  Size: 190 B

After

Width:  |  Height:  |  Size: 190 B

View file

Before

Width:  |  Height:  |  Size: 190 B

After

Width:  |  Height:  |  Size: 190 B

View file

Before

Width:  |  Height:  |  Size: 222 B

After

Width:  |  Height:  |  Size: 222 B

View file

Before

Width:  |  Height:  |  Size: 196 B

After

Width:  |  Height:  |  Size: 196 B

View file

Before

Width:  |  Height:  |  Size: 192 B

After

Width:  |  Height:  |  Size: 192 B

View file

Before

Width:  |  Height:  |  Size: 237 B

After

Width:  |  Height:  |  Size: 237 B

View file

Before

Width:  |  Height:  |  Size: 283 B

After

Width:  |  Height:  |  Size: 283 B

View file

Before

Width:  |  Height:  |  Size: 309 B

After

Width:  |  Height:  |  Size: 309 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 236 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 287 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 284 B

View file

Before

Width:  |  Height:  |  Size: 532 B

After

Width:  |  Height:  |  Size: 532 B

View file

Before

Width:  |  Height:  |  Size: 210 B

After

Width:  |  Height:  |  Size: 210 B

View file

Before

Width:  |  Height:  |  Size: 259 B

After

Width:  |  Height:  |  Size: 259 B

View file

Before

Width:  |  Height:  |  Size: 217 B

After

Width:  |  Height:  |  Size: 217 B

View file

Before

Width:  |  Height:  |  Size: 264 B

After

Width:  |  Height:  |  Size: 264 B

View file

Before

Width:  |  Height:  |  Size: 223 B

After

Width:  |  Height:  |  Size: 223 B

View file

Before

Width:  |  Height:  |  Size: 268 B

After

Width:  |  Height:  |  Size: 268 B

View file

Before

Width:  |  Height:  |  Size: 263 B

After

Width:  |  Height:  |  Size: 263 B

View file

Before

Width:  |  Height:  |  Size: 192 B

After

Width:  |  Height:  |  Size: 192 B

View file

Before

Width:  |  Height:  |  Size: 228 B

After

Width:  |  Height:  |  Size: 228 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 261 B

View file

Before

Width:  |  Height:  |  Size: 186 B

After

Width:  |  Height:  |  Size: 186 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 292 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 230 B

View file

Before

Width:  |  Height:  |  Size: 222 B

After

Width:  |  Height:  |  Size: 222 B

View file

Before

Width:  |  Height:  |  Size: 298 B

After

Width:  |  Height:  |  Size: 298 B

View file

Before

Width:  |  Height:  |  Size: 8.1 KiB

After

Width:  |  Height:  |  Size: 8.1 KiB

View file

Before

Width:  |  Height:  |  Size: 170 B

After

Width:  |  Height:  |  Size: 170 B

View file

Before

Width:  |  Height:  |  Size: 175 B

After

Width:  |  Height:  |  Size: 175 B

View file

Before

Width:  |  Height:  |  Size: 175 B

After

Width:  |  Height:  |  Size: 175 B

View file

Before

Width:  |  Height:  |  Size: 175 B

After

Width:  |  Height:  |  Size: 175 B

View file

Before

Width:  |  Height:  |  Size: 357 B

After

Width:  |  Height:  |  Size: 357 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 106 B

After

Width:  |  Height:  |  Size: 102 B