Merge pull request 'More composters fixes and updates.' (#2093) from composters into master

Reviewed-on: https://git.minetest.land/MineClone2/MineClone2/pulls/2093
Reviewed-by: cora <cora@noreply.git.minetest.land>
This commit is contained in:
cora 2022-04-02 02:01:34 +00:00
commit 85d1f61188
23 changed files with 195 additions and 199 deletions

View File

@ -72,6 +72,7 @@ Please read <http://minecraft.gamepedia.com/Breaking> to learn how digging times
* `coral_block=X`: Coral block (1 = alive, 2 = dead)
* `coral_species=X`: Specifies the species of a coral; equal X means equal species
* `set_on_fire=X`: Sets any (not fire-resistant) mob or player on fire for X seconds when touching
* `compostability=X`: Item can be used on a composter block; X (1-100) is the % chance of adding a level of compost
#### Footnotes

View File

@ -52,7 +52,10 @@ minetest.register_node("mcl_cake:cake", {
fixed = full_cake
},
stack_max = 1,
groups = {handy=1, cake=7, food=2,no_eat_delay=1, attached_node=1, dig_by_piston=1, comparator_signal=14},
groups = {
handy = 1, attached_node = 1, dig_by_piston = 1, comparator_signal = 14,
cake = 7, food = 2, no_eat_delay = 1, compostability = 100
},
drop = "",
on_rightclick = function(pos, node, clicker, itemstack)
-- Cake is subject to protection
@ -125,7 +128,11 @@ local register_slice = function(level, nodebox, desc)
type = "fixed",
fixed = nodebox,
},
groups = {handy=1, cake=level, food=2,no_eat_delay=1,attached_node=1,not_in_creative_inventory=1,dig_by_piston=1,comparator_signal=level*2},
groups = {
handy = 1, attached_node = 1, not_in_creative_inventory = 1,
dig_by_piston = 1, cake = level, comparator_signal = level * 2,
food = 2, no_eat_delay = 1
},
drop = "",
on_rightclick = on_rightclick,
sounds = mcl_sounds.node_sound_leaves_defaults(),

View File

@ -38,134 +38,52 @@ minetest.register_craft({
burntime = 15,
})
local compostability = {
["mcl_cake:cake"] = 100,
["mcl_farming:pumpkin_pie"] = 100,
["mcl_farming:potato_item_baked"] = 85,
["mcl_farming:bread"] = 85,
["mcl_farming:cookie"] = 85,
["mcl_farming:hay_block"] = 85,
-- mushroom cap block have 64 variants, wtf!?
["mcl_mushrooms:brown_mushroom_block_cap_111111"] = 85,
["mcl_mushrooms:red_mushroom_block_cap_111111"] = 85,
["mcl_nether:nether_wart_block"] = 85,
["mcl_mushroom:warped_wart_block"] = 85,
["mcl_core:apple"] = 65,
-- missing: azalea
["mcl_farming:beetroot_item"] = 65,
-- missing: big dripleaf
["mcl_farming:carrot_item"] = 65,
-- what's up with cocoa beans?
["mcl_dye:brown"] = 65,
["mcl_flowers:fern"] = 65,
["mcl_flowers:double_fern"] = 65,
["mcl_flowers:allium"] = 65,
["mcl_flowers:azure_bluet"] = 65,
["mcl_flowers:blue_orchid"] = 65,
["mcl_flowers:dandelion"] = 65,
["mcl_flowers:lilac"] = 65,
["mcl_flowers:oxeye_daisy"] = 65,
["mcl_flowers:poppy"] = 65,
["mcl_flowers:tulip_orange"] = 65,
["mcl_flowers:tulip_pink"] = 65,
["mcl_flowers:tulip_red"] = 65,
["mcl_flowers:tulip_white"] = 65,
["mcl_flowers:peony"] = 65,
["mcl_flowers:rose_bush"] = 65,
["mcl_flowers:sunflower"] = 65,
["mcl_flowers:waterlily"] = 65,
["mcl_farming:melon"] = 65,
-- missing: moss block?
-- mushroom aliases below?
["mcl_farming:mushroom_brown"] = 65,
["mcl_mushrooms:mushroom_brown"] = 65,
["mcl_farming:mushroom_red"] = 65,
["mcl_mushrooms:mushroom_red"] = 65,
["mcl_mushrooms:brown_mushroom_block_stem_full"] = 65,
["mcl_mushrooms:red_mushroom_block_stem_full"] = 65,
-- nether wart
["mcl_farming:potato_item"] = 65,
["mcl_farming:pumpkin"] = 65,
["mcl_farming:pumpkin_face_light"] = 65,
["mcl_ocean:sea_pickle_"] = 65,
["mcl_mushroom:shroomlight"] = 65,
-- missing: spore blossom
["mcl_farming:wheat_item"] = 65,
["mcl_mushroom:crimson_fungus"] = 65,
["mcl_mushroom:warped_fungus"] = 65,
["mcl_mushroom:crimson_roots"] = 65,
["mcl_mushroom:warped_roots"] = 65,
["mcl_core:cactus"] = 50,
["mcl_ocean:dried_kelp_block"] = 50,
-- missing: flowering azalea leaves
-- missing: glow lichen
["mcl_farming:melon_item"] = 50,
["mcl_mushroom:nether_sprouts"] = 50,
["mcl_core:reeds"] = 50,
["mcl_flowers:double_grass"] = 50,
["mcl_core:vine"] = 50,
-- missing: weeping vines
["mcl_mushroom:twisting_vines"] = 50,
["mcl_flowers:tallgrass"] = 30,
["mcl_farming:beetroot_seeds"] = 30,
["mcl_core:dirt_with_grass"] = 30,
["mcl_core:tallgrass"] = 30,
["mcl_ocean:dried_kelp"] = 30,
["mcl_ocean:kelp"] = 30,
["mcl_core:leaves"] = 30,
["mcl_core:acacialeaves"] = 30,
["mcl_core:birchleaves"] = 30,
["mcl_core:darkleaves"] = 30,
["mcl_core:jungleleaves"] = 30,
["mcl_core:spruceleaves"] = 30,
--
["mcl_farming:melon_seeds"] = 30,
-- missing: moss carpet
["mcl_farming:pumpkin_seeds"] = 30,
["mcl_core:sapling"] = 30,
["mcl_core:acaciasapling"] = 30,
["mcl_core:birchsapling"] = 30,
["mcl_core:darksapling"] = 30,
["mcl_core:junglesapling"] = 30,
["mcl_core:sprucesapling"] = 30,
["mcl_ocean:seagrass"] = 30,
-- missing: small dripleaf
["mcl_sweet_berry:sweet_berry"] = 30,
["mcl_farming:sweet_berry"] = 30,
["mcl_farming:wheat_seeds"] = 30,
}
local get_item_group = minetest.get_item_group
local is_creative_enabled = minetest.is_creative_enabled
local registered_nodes = minetest.registered_nodes
local swap_node = minetest.swap_node
local get_node_timer = minetest.get_node_timer
local add_item = minetest.add_item
local vector_offset = vector.offset
local is_protected = minetest.is_protected
local record_protection_violation = minetest.record_protection_violation
--- Fill the composter when rightclicked.
--
-- `on_rightclick` handler for composter blocks of all fill levels except
-- for the "ready" composter (see: composter_harvest).
-- If the item used on the composter block is compostable, there is a chance
-- that the level of the composter may increase, depending on the value of
-- compostability of the item.
--
-- parameters are the standard parameters passed to `on_rightclick`.
-- returns the remaining itemstack.
--
local function composter_add_item(pos, node, player, itemstack, pointed_thing)
--
-- handler for filling the composter when rightclicked
--
-- as an on_rightclick handler, it returns an itemstack
--
if not player or (player:get_player_control() and player:get_player_control().sneak) then
return itemstack
end
if not itemstack and itemstack:is_empty() then
local name = player:get_player_name()
if is_protected(pos, name) then
record_protection_violation(pos, name)
return itemstack
end
if not itemstack or itemstack:is_empty() then
return itemstack
end
local itemname = itemstack:get_name()
local chance = compostability[itemname]
if chance then
if not minetest.is_creative_enabled(player:get_player_name()) then
local chance = get_item_group(itemname, "compostability")
if chance > 0 then
if not is_creative_enabled(player:get_player_name()) then
itemstack:take_item()
end
-- calculate leveling up chance
local rand = math.random(0,100)
if chance >= rand then
-- get current compost level
local node_defs = minetest.registered_nodes[node.name]
local level = node_defs["_mcl_compost_level"]
local level = registered_nodes[node.name]["_mcl_compost_level"]
-- spawn green particles above new layer
mcl_dye.add_bone_meal_particle(vector.add(pos, vector.new(0, level/8, 0)))
mcl_dye.add_bone_meal_particle(vector_offset(pos, 0, level/8, 0))
-- TODO: play some sounds
-- update composter block
if level < 7 then
@ -173,11 +91,11 @@ local function composter_add_item(pos, node, player, itemstack, pointed_thing)
else
level = "ready"
end
minetest.swap_node(pos, {name = "mcl_composters:composter_" .. level})
swap_node(pos, {name = "mcl_composters:composter_" .. level})
-- a full composter becomes ready for harvest after one second
-- the block will get updated by the node timer callback set in node reg def
if level == 7 then
local timer = minetest.get_node_timer(pos)
local timer = get_node_timer(pos)
timer:start(1)
end
end
@ -185,39 +103,53 @@ local function composter_add_item(pos, node, player, itemstack, pointed_thing)
return itemstack
end
--- Update a full composter block to ready for harvesting.
--
-- `on_timer` handler. The timer is set in function 'composter_add_item'
-- when the composter level has reached 7.
--
-- pos: position of the composter block.
-- returns false, thereby cancelling further activity of the timer.
--
local function composter_ready(pos)
--
-- update the composter block to ready for harvesting
-- this function is a node callback on_timer.
-- the timer is set in function 'composter_fill' when composter level is 7
--
-- returns false in order to cancel further activity of the timer
--
minetest.swap_node(pos, {name = "mcl_composters:composter_ready"})
swap_node(pos, {name = "mcl_composters:composter_ready"})
-- maybe spawn particles again?
-- TODO: play some sounds
return false
end
--- Spawn bone meal item and reset composter block.
--
-- `on_rightclick` handler for the "ready" composter block. Causes a
-- bone meal item to be spawned from the composter and resets the
-- composter block to an empty composter block.
--
-- parameterss are the standard parameters passed to `on_rightclick`.
-- returns itemstack (unchanged in this function).
--
local function composter_harvest(pos, node, player, itemstack, pointed_thing)
--
-- handler for harvesting bone meal from a ready composter when rightclicked
--
if not player or (player:get_player_control() and player:get_player_control().sneak) then
return
return itemstack
end
local name = player:get_player_name()
if is_protected(pos, name) then
record_protection_violation(pos, name)
return itemstack
end
-- reset ready type composter to empty type
minetest.swap_node(pos, {name="mcl_composters:composter"})
swap_node(pos, {name="mcl_composters:composter"})
-- spawn bone meal item (wtf dye?! is this how they make white cocoa)
minetest.add_item(pos, "mcl_dye:white")
add_item(pos, "mcl_dye:white")
-- TODO play some sounds
return itemstack
end
--- Construct composter nodeboxes with varying levels of compost.
--
-- level: compost level in the composter
-- returns a nodebox definition table.
--
local function composter_get_nodeboxes(level)
--
-- Convenience function to construct the nodeboxes for varying levels of compost
--
local top_y_tbl = {[0]=-7, -5, -3, -1, 1, 3, 5, 7}
local top_y = top_y_tbl[level] / 16
return {
@ -232,9 +164,9 @@ local function composter_get_nodeboxes(level)
}
end
--- Register empty composter node.
--
-- Register empty composter node
-- This is the base model that is craftable and can be placed in an inventory
-- This is the craftable base model that can be placed in an inventory.
--
minetest.register_node("mcl_composters:composter", {
description = composter_description,
@ -250,7 +182,6 @@ minetest.register_node("mcl_composters:composter", {
"mcl_composter_bottom.png",
"mcl_composter_side.png"
},
use_texture_alpha = minetest.features.use_texture_alpha_string_modes and "opaque" or false,
is_ground_content = false,
groups = {
handy=1, material_wood=1, deco_block=1, dirtifier=1,
@ -263,9 +194,9 @@ minetest.register_node("mcl_composters:composter", {
on_rightclick = composter_add_item
})
--- Template function for composters with compost.
--
-- Template function for composters with compost
-- For each fill level a custom node is registered
-- For each fill level a custom node is registered.
--
local function register_filled_composter(level)
local id = "mcl_composters:composter_"..level
@ -281,7 +212,6 @@ local function register_filled_composter(level)
"mcl_composter_bottom.png",
"mcl_composter_side.png"
},
use_texture_alpha = minetest.features.use_texture_alpha_string_modes and "opaque" or false,
is_ground_content = false,
groups = {
handy=1, material_wood=1, deco_block=1, dirtifier=1,
@ -304,20 +234,17 @@ local function register_filled_composter(level)
end
end
--
-- Register filled composters (7 levels)
--- Register filled composters (7 levels).
--
for level = 1, 7 do
register_filled_composter(level)
end
--
-- Register composter ready to be harvested
--- Register composter that is ready to be harvested.
--
minetest.register_node("mcl_composters:composter_ready", {
description = S("Composter") .. "(" .. S("ready for harvest") .. ")",
_doc_items_create_entry = false,
use_texture_alpha = minetest.features.use_texture_alpha_string_modes and "opaque" or false,
paramtype = "light",
drawtype = "nodebox",
node_box = composter_get_nodeboxes(7),
@ -344,6 +271,6 @@ minetest.register_node("mcl_composters:composter_ready", {
-- Add entry aliases for the Help
if minetest.get_modpath("doc") then
doc.add_entry_alias("nodes", "mcl_composters:composter",
doc.add_entry_alias("nodes", "mcl_composters:composter",
"nodes", "mcl_composters:composter_ready" )
end

View File

@ -139,7 +139,7 @@ minetest.register_craftitem("mcl_core:apple", {
stack_max = 64,
on_place = minetest.item_eat(4),
on_secondary_use = minetest.item_eat(4),
groups = { food = 2, eatable = 4 },
groups = { food = 2, eatable = 4, compostability = 65 },
_mcl_saturation = 2.4,
})

View File

@ -368,7 +368,12 @@ minetest.register_node("mcl_core:dirt_with_grass", {
color = "#8EB971",
is_ground_content = true,
stack_max = 64,
groups = {handy=1,shovely=1,dirt=2,grass_block=1, grass_block_no_snow=1, soil=1, soil_sapling=2, soil_sugarcane=1, cultivatable=2, spreading_dirt_type=1, enderman_takable=1, building_block=1},
groups = {
handy = 1, shovely = 1, dirt = 2, grass_block = 1, grass_block_no_snow = 1,
soil = 1, soil_sapling = 2, soil_sugarcane = 1, cultivatable = 2,
spreading_dirt_type = 1, enderman_takable = 1, building_block = 1,
compostability = 30
},
drop = "mcl_core:dirt",
sounds = mcl_sounds.node_sound_dirt_defaults({
footstep = {name="default_grass_footstep", gain=0.1},

View File

@ -12,7 +12,10 @@ minetest.register_node("mcl_core:cactus", {
tiles = {"mcl_core_cactus_top.png", "mcl_core_cactus_bottom.png", "mcl_core_cactus_side.png"},
is_ground_content = true,
stack_max = 64,
groups = {handy=1, attached_node=1, plant=1, deco_block=1, dig_by_piston=1, enderman_takable=1},
groups = {
handy = 1, attached_node = 1, deco_block = 1, dig_by_piston = 1,
plant = 1, enderman_takable = 1, compostability = 50
},
sounds = mcl_sounds.node_sound_wood_defaults(),
paramtype = "light",
sunlight_propagates = true,
@ -79,7 +82,10 @@ minetest.register_node("mcl_core:reeds", {
},
},
stack_max = 64,
groups = {dig_immediate=3, craftitem=1, deco_block=1, plant=1, non_mycelium_plant=1, dig_by_piston=1},
groups = {
dig_immediate = 3, craftitem = 1, deco_block = 1, dig_by_piston = 1,
plant = 1, non_mycelium_plant = 1, compostability = 50
},
sounds = mcl_sounds.node_sound_leaves_defaults(),
node_placement_prediction = "",
drop = "mcl_core:reeds", -- to prevent color inheritation

View File

@ -104,7 +104,11 @@ minetest.register_node("mcl_core:vine", {
type = "wallmounted",
},
stack_max = 64,
groups = {handy=1,axey=1,shearsy=1,swordy=1, flammable=2,deco_block=1,destroy_by_lava_flow=1,dig_by_piston=1, fire_encouragement=15, fire_flammability=100},
groups = {
handy = 1, axey = 1, shearsy = 1, swordy = 1, deco_block = 1,
dig_by_piston = 1, destroy_by_lava_flow = 1, compostability = 50,
flammable = 2, fire_encouragement = 15, fire_flammability = 100
},
sounds = mcl_sounds.node_sound_leaves_defaults(),
drop = "",
_mcl_shears_drop = true,

View File

@ -152,17 +152,10 @@ local function register_leaves(subname, description, longdesc, tiles, sapling, d
paramtype = "light",
stack_max = 64,
groups = {
handy=1,
hoey=1,
shearsy=1,
swordy=1,
leafdecay=leafdecay_distance,
flammable=2,
leaves=1,
deco_block=1,
dig_by_piston=1,
fire_encouragement=30,
fire_flammability=60
handy = 1, hoey = 1, shearsy = 1, swordy = 1, dig_by_piston = 1,
leaves = 1, leafdecay = leafdecay_distance, deco_block = 1,
flammable = 2, fire_encouragement = 30, fire_flammability = 60,
compostability = 30
},
drop = get_drops(0),
_mcl_shears_drop = true,
@ -194,7 +187,11 @@ local function register_sapling(subname, description, longdesc, tt_help, texture
fixed = selbox
},
stack_max = 64,
groups = {dig_immediate=3, plant=1,sapling=1,non_mycelium_plant=1,attached_node=1,dig_by_water=1,dig_by_piston=1,destroy_by_lava_flow=1,deco_block=1},
groups = {
plant = 1, sapling = 1, non_mycelium_plant = 1, attached_node = 1,
deco_block = 1, dig_immediate = 3, dig_by_water = 1, dig_by_piston = 1,
destroy_by_lava_flow = 1, compostability = 30
},
sounds = mcl_sounds.node_sound_leaves_defaults(),
on_construct = function(pos)
local meta = minetest.get_meta(pos)
@ -275,4 +272,4 @@ register_leaves("birchleaves", S("Birch Leaves"), S("Birch leaves are grown from
-- Node aliases
minetest.register_alias("default:acacia_tree", "mcl_core:acaciatree")
minetest.register_alias("default:acacia_leaves", "mcl_core:acacialeaves")
minetest.register_alias("default:acacia_leaves", "mcl_core:acacialeaves")

View File

@ -78,7 +78,7 @@ dyelocal.dyes = {
{"dark_green", "dye_dark_green", S("Cactus Green"),{dye=1, craftitem=1, basecolor_green=1, excolor_green=1, unicolor_dark_green=1}},
{"green", "mcl_dye_lime", S("Lime Dye"), {dye=1, craftitem=1, basecolor_green=1, excolor_green=1, unicolor_green=1}},
{"yellow", "dye_yellow", S("Dandelion Yellow"), {dye=1, craftitem=1, basecolor_yellow=1, excolor_yellow=1, unicolor_yellow=1}},
{"brown", "mcl_dye_brown", S("Cocoa Beans"), {dye=1, craftitem=1, basecolor_brown=1, excolor_orange=1, unicolor_dark_orange=1}},
{"brown", "mcl_dye_brown", S("Cocoa Beans"), {dye=1, craftitem=1, basecolor_brown=1, excolor_orange=1, unicolor_dark_orange=1, compostability = 65}},
{"orange", "dye_orange", S("Orange Dye"), {dye=1, craftitem=1, basecolor_orange=1, excolor_orange=1, unicolor_orange=1}},
{"red", "dye_red", S("Rose Red"), {dye=1, craftitem=1, basecolor_red=1, excolor_red=1, unicolor_red=1}},
{"magenta", "dye_magenta", S("Magenta Dye"), {dye=1, craftitem=1, basecolor_magenta=1, excolor_red_violet=1,unicolor_red_violet=1}},
@ -561,5 +561,3 @@ minetest.register_craft({
output = "mcl_dye:white 3",
recipe = {{"mcl_mobitems:bone"}},
})

View File

@ -5,7 +5,7 @@ minetest.register_craftitem("mcl_farming:beetroot_seeds", {
_tt_help = S("Grows on farmland"),
_doc_items_longdesc = S("Grows into a beetroot plant. Chickens like beetroot seeds."),
_doc_items_usagehelp = S("Place the beetroot seeds on farmland (which can be created with a hoe) to plant a beetroot plant. They grow in sunlight and grow faster on hydrated farmland. Rightclick an animal to feed it beetroot seeds."),
groups = { craftitem=1 },
groups = {craftitem = 1, compostability = 30},
inventory_image = "mcl_farming_beetroot_seeds.png",
wield_image = "mcl_farming_beetroot_seeds.png",
on_place = function(itemstack, placer, pointed_thing)
@ -133,7 +133,7 @@ minetest.register_craftitem("mcl_farming:beetroot_item", {
wield_image = "mcl_farming_beetroot.png",
on_place = minetest.item_eat(1),
on_secondary_use = minetest.item_eat(1),
groups = { food = 2, eatable = 1 },
groups = {food = 2, eatable = 1, compostability = 65},
_mcl_saturation = 1.2,
})

View File

@ -86,7 +86,7 @@ minetest.register_craftitem("mcl_farming:carrot_item", {
_doc_items_longdesc = S("Carrots can be eaten and planted. Pigs and rabbits like carrots."),
_doc_items_usagehelp = S("Hold it in your hand and rightclick to eat it. Place it on top of farmland to plant the carrot. It grows in sunlight and grows faster on hydrated farmland. Rightclick an animal to feed it."),
inventory_image = "farming_carrot.png",
groups = { food = 2, eatable = 3 },
groups = {food = 2, eatable = 3, compostability = 65},
_mcl_saturation = 3.6,
on_secondary_use = minetest.item_eat(3),
on_place = function(itemstack, placer, pointed_thing)

View File

@ -7,7 +7,7 @@ minetest.register_craftitem("mcl_farming:melon_seeds", {
_doc_items_longdesc = S("Grows into a melon stem which in turn grows melons. Chickens like melon seeds."),
_doc_items_usagehelp = S("Place the melon seeds on farmland (which can be created with a hoe) to plant a melon stem. Melon stems grow in sunlight and grow faster on hydrated farmland. When mature, the stem will attempt to grow a melon at the side. Rightclick an animal to feed it melon seeds."),
stack_max = 64,
groups = { craftitem=1 },
groups = {craftitem = 1, compostability = 30},
inventory_image = "mcl_farming_melon_seeds.png",
on_place = function(itemstack, placer, pointed_thing)
return mcl_farming:place_seed(itemstack, placer, pointed_thing, "mcl_farming:melontige_1")
@ -21,7 +21,10 @@ local melon_base_def = {
_doc_items_longdesc = S("A melon is a block which can be grown from melon stems, which in turn are grown from melon seeds. It can be harvested for melon slices."),
stack_max = 64,
tiles = {"farming_melon_top.png", "farming_melon_top.png", "farming_melon_side.png", "farming_melon_side.png", "farming_melon_side.png", "farming_melon_side.png"},
groups = {handy=1,axey=1, plant=1,building_block=1,enderman_takable=1,dig_by_piston=1},
groups = {
handy = 1, axey = 1, plant = 1, building_block = 1, dig_by_piston = 1,
enderman_takable = 1, compostability = 65
},
drop = {
max_items = 1,
items = {
@ -134,7 +137,7 @@ minetest.register_craftitem("mcl_farming:melon_item", {
inventory_image = "farming_melon.png",
on_place = minetest.item_eat(2),
on_secondary_use = minetest.item_eat(2),
groups = { food = 2, eatable = 2 },
groups = {food = 2, eatable = 2, compostability = 50},
_mcl_saturation = 1.2,
})

View File

@ -91,7 +91,7 @@ minetest.register_craftitem("mcl_farming:potato_item", {
_doc_items_longdesc = S("Potatoes are food items which can be eaten, cooked in the furnace and planted. Pigs like potatoes."),
_doc_items_usagehelp = S("Hold it in your hand and rightclick to eat it. Place it on top of farmland to plant it. It grows in sunlight and grows faster on hydrated farmland. Rightclick an animal to feed it."),
inventory_image = "farming_potato.png",
groups = { food = 2, eatable = 1 },
groups = {food = 2, eatable = 1, compostability = 65},
_mcl_saturation = 0.6,
stack_max = 64,
on_secondary_use = minetest.item_eat(1),
@ -112,7 +112,7 @@ minetest.register_craftitem("mcl_farming:potato_item_baked", {
inventory_image = "farming_potato_baked.png",
on_place = minetest.item_eat(5),
on_secondary_use = minetest.item_eat(5),
groups = { food = 2, eatable = 5 },
groups = {food = 2, eatable = 5, compostability = 85},
_mcl_saturation = 6.0,
})

View File

@ -15,7 +15,7 @@ minetest.register_craftitem("mcl_farming:pumpkin_seeds", {
_doc_items_usagehelp = S("Place the pumpkin seeds on farmland (which can be created with a hoe) to plant a pumpkin stem. Pumpkin stems grow in sunlight and grow faster on hydrated farmland. When mature, the stem attempts to grow a pumpkin next to it. Rightclick an animal to feed it pumpkin seeds."),
stack_max = 64,
inventory_image = "mcl_farming_pumpkin_seeds.png",
groups = { craftitem=1 },
groups = {craftitem=1, compostability = 30},
on_place = function(itemstack, placer, pointed_thing)
return mcl_farming:place_seed(itemstack, placer, pointed_thing, "mcl_farming:pumpkin_1")
end
@ -99,7 +99,10 @@ local pumpkin_base_def = {
stack_max = 64,
paramtype2 = "facedir",
tiles = {"farming_pumpkin_top.png", "farming_pumpkin_top.png", "farming_pumpkin_side.png"},
groups = {handy=1,axey=1, plant=1,building_block=1, dig_by_piston=1, enderman_takable=1},
groups = {
handy = 1, axey = 1, plant = 1, building_block = 1, dig_by_piston = 1,
enderman_takable = 1, compostability = 65
},
sounds = mcl_sounds.node_sound_wood_defaults(),
on_rotate = on_rotate,
_mcl_blast_resistance = 1,
@ -230,7 +233,7 @@ minetest.register_craftitem("mcl_farming:pumpkin_pie", {
wield_image = "mcl_farming_pumpkin_pie.png",
on_place = minetest.item_eat(8),
on_secondary_use = minetest.item_eat(8),
groups = { food = 2, eatable = 8 },
groups = {food = 2, eatable = 8, compostability = 100},
_mcl_saturation = 4.8,
})

View File

@ -9,7 +9,7 @@ minetest.register_craftitem("mcl_farming:wheat_seeds", {
Place the wheat seeds on farmland (which can be created with a hoe) to plant a wheat plant.
They grow in sunlight and grow faster on hydrated farmland. Rightclick an animal to feed it wheat seeds.
]]),
groups = { craftitem=1 },
groups = {craftitem = 1, compostability = 30},
inventory_image = "mcl_farming_wheat_seeds.png",
on_place = function(itemstack, placer, pointed_thing)
return mcl_farming:place_seed(itemstack, placer, pointed_thing, "mcl_farming:wheat_1")
@ -104,7 +104,7 @@ minetest.register_craftitem("mcl_farming:wheat_item", {
_doc_items_longdesc = S("Wheat is used in crafting. Some animals like wheat."),
_doc_items_usagehelp = S("Use the “Place” key on an animal to try to feed it wheat."),
inventory_image = "farming_wheat_harvested.png",
groups = { craftitem = 1 },
groups = {craftitem = 1, compostability = 65},
})
minetest.register_craft({
@ -125,7 +125,7 @@ minetest.register_craftitem("mcl_farming:cookie", {
description = S("Cookie"),
_doc_items_longdesc = S("This is a food item which can be eaten."),
inventory_image = "farming_cookie.png",
groups = {food=2, eatable=2},
groups = {food = 2, eatable = 2, compostability = 85},
_mcl_saturation = 0.4,
on_place = minetest.item_eat(2),
on_secondary_use = minetest.item_eat(2),
@ -136,7 +136,7 @@ minetest.register_craftitem("mcl_farming:bread", {
description = S("Bread"),
_doc_items_longdesc = S("This is a food item which can be eaten."),
inventory_image = "farming_bread.png",
groups = {food=2, eatable=5},
groups = {food = 2, eatable = 5, compostability = 85},
_mcl_saturation = 6.0,
on_place = minetest.item_eat(5),
on_secondary_use = minetest.item_eat(5),
@ -156,8 +156,11 @@ minetest.register_node("mcl_farming:hay_block", {
stack_max = 64,
paramtype2 = "facedir",
on_place = mcl_util.rotate_axis,
groups = {handy=1, hoey=1, flammable=2, fire_encouragement=60,
fire_flammability=20, building_block=1, fall_damage_add_percent=-80},
groups = {
handy = 1, hoey = 1, building_block = 1, fall_damage_add_percent = -80,
flammable = 2, fire_encouragement = 60, fire_flammability = 20,
compostability = 85
},
sounds = mcl_sounds.node_sound_leaves_defaults(),
on_rotate = on_rotate,
_mcl_blast_resistance = 0.5,

View File

@ -80,7 +80,13 @@ function mcl_flowers.register_simple_flower(name, def)
walkable = false,
stack_max = 64,
drop = def.drop,
groups = {dig_immediate=3,flammable=2,fire_encouragement=60,fire_flammability=100,plant=1,flower=1,place_flowerlike=1,non_mycelium_plant=1,attached_node=1,dig_by_water=1,destroy_by_lava_flow=1,dig_by_piston=1,enderman_takable=1,deco_block=1},
groups = {
attached_node = 1, deco_block = 1, dig_by_piston = 1, dig_immediate = 3,
dig_by_water = 1, destroy_by_lava_flow = 1, enderman_takable = 1,
plant = 1, flower = 1, place_flowerlike = 1, non_mycelium_plant = 1,
flammable = 2, fire_encouragement = 60, fire_flammability = 100,
compostability = 65
},
sounds = mcl_sounds.node_sound_leaves_defaults(),
node_placement_prediction = "",
on_place = on_place_flower,
@ -143,7 +149,12 @@ local def_tallgrass = {
walkable = false,
buildable_to = true,
is_ground_content = true,
groups = {handy=1,shearsy=1, flammable=3,fire_encouragement=60,fire_flammability=100,attached_node=1,plant=1,place_flowerlike=2,non_mycelium_plant=1,dig_by_water=1,destroy_by_lava_flow=1,deco_block=1},
groups = {
handy = 1, shearsy = 1, attached_node = 1, deco_block = 1,
plant = 1, place_flowerlike = 2, non_mycelium_plant = 1,
flammable = 3, fire_encouragement = 60, fire_flammability = 100,
dig_by_water = 1, destroy_by_lava_flow = 1, compostability = 30
},
sounds = mcl_sounds.node_sound_leaves_defaults(),
drop = wheat_seed_drop,
_mcl_shears_drop = true,
@ -167,6 +178,7 @@ def_fern.selection_box = {
type = "fixed",
fixed = { -6/16, -0.5, -6/16, 6/16, 5/16, 6/16 },
}
def_fern.groups.compostability = 65
minetest.register_node("mcl_flowers:fern", def_fern)
@ -187,7 +199,15 @@ local function add_large_plant(name, desc, longdesc, bottom_img, top_img, inv_im
is_flower = true
end
local bottom_groups = {flammable=2, fire_encouragement=60, fire_flammability=100, non_mycelium_plant=1, attached_node=1, dig_by_water=1, destroy_by_lava_flow=1, dig_by_piston=1, plant=1, double_plant=1, deco_block=1}
local bottom_groups = {
attached_node = 1, deco_block = 1,
dig_by_water = 1, destroy_by_lava_flow = 1, dig_by_piston = 1,
flammable = 2, fire_encouragement = 60, fire_flammability = 100,
plant = 1, double_plant = 1, non_mycelium_plant = 1, compostability = 65
}
if name == "double_grass" then
bottom_groups.compostability = 50
end
if is_flower then
bottom_groups.flower = 1
bottom_groups.place_flowerlike = 1
@ -410,7 +430,10 @@ minetest.register_node("mcl_flowers:waterlily", {
liquids_pointable = true,
walkable = true,
sunlight_propagates = true,
groups = {dig_immediate = 3, plant=1, dig_by_water = 1,destroy_by_lava_flow=1, dig_by_piston = 1, deco_block=1, dig_by_boat=1},
groups = {
deco_block = 1, plant = 1, compostability = 65, destroy_by_lava_flow = 1,
dig_immediate = 3, dig_by_water = 1, dig_by_piston = 1, dig_by_boat = 1,
},
sounds = mcl_sounds.node_sound_leaves_defaults(),
node_placement_prediction = "",
node_box = {

View File

@ -3,7 +3,10 @@ local S = minetest.get_translator(minetest.get_current_modname())
local vector = vector
local template = {
groups = {handy=1,axey=1, building_block = 1, material_wood = 1, flammable = -1 },
groups = {
handy = 1, axey = 1, building_block = 1, material_wood = 1,
flammable = -1, compostability = 85
},
sounds = mcl_sounds.node_sound_wood_defaults(),
is_ground_content = true,
_mcl_blast_resistance = 0.2,
@ -51,6 +54,7 @@ local function register_mushroom(color, species_id, template, d_cap, d_stem, d_s
stem_full.tiles = { "mcl_mushrooms_mushroom_block_skin_stem.png" }
stem_full.groups.huge_mushroom = species_id
stem_full.groups.huge_mushroom_stem = 2
stem_full.groups.compostability = 65
minetest.register_node("mcl_mushrooms:"..color.."_mushroom_block_stem_full", stem_full)
-- Stem
@ -60,6 +64,7 @@ local function register_mushroom(color, species_id, template, d_cap, d_stem, d_s
stem.tiles = { "mcl_mushrooms_mushroom_block_inside.png", "mcl_mushrooms_mushroom_block_inside.png", "mcl_mushrooms_mushroom_block_skin_stem.png" }
stem.groups.huge_mushroom = species_id
stem.groups.huge_mushroom_stem = 1
stem.groups.compostability = 65
minetest.register_node("mcl_mushrooms:"..color.."_mushroom_block_stem", stem)
-- Mushroom block (cap)

View File

@ -38,7 +38,11 @@ minetest.register_node("mcl_mushrooms:mushroom_brown", {
sunlight_propagates = true,
paramtype = "light",
walkable = false,
groups = {dig_immediate=3,mushroom=1,attached_node=1,dig_by_water=1,destroy_by_lava_flow=1,dig_by_piston=1,enderman_takable=1,deco_block=1},
groups = {
attached_node = 1, deco_block = 1, destroy_by_lava_flow = 1,
dig_immediate = 3, dig_by_water = 1, dig_by_piston = 1,
mushroom = 1, enderman_takable = 1, compostability = 65
},
sounds = mcl_sounds.node_sound_leaves_defaults(),
light_source = 1,
selection_box = {
@ -62,7 +66,11 @@ minetest.register_node("mcl_mushrooms:mushroom_red", {
sunlight_propagates = true,
paramtype = "light",
walkable = false,
groups = {dig_immediate=3,mushroom=1,attached_node=1,dig_by_water=1,destroy_by_lava_flow=1,dig_by_piston=1,enderman_takable=1,deco_block=1},
groups = {
attached_node = 1, deco_block = 1, destroy_by_lava_flow = 1,
dig_immediate = 3, dig_by_water = 1, dig_by_piston = 1,
mushroom = 1, enderman_takable = 1, compostability = 65
},
sounds = mcl_sounds.node_sound_leaves_defaults(),
selection_box = {
type = "fixed",

View File

@ -174,7 +174,7 @@ minetest.register_node("mcl_nether:nether_wart_block", {
stack_max = 64,
tiles = {"mcl_nether_nether_wart_block.png"},
is_ground_content = false,
groups = {handy=1, hoey=1, building_block=1},
groups = {handy=1, hoey=1, building_block=1, compostability = 85},
sounds = mcl_sounds.node_sound_leaves_defaults(
{
footstep={name="default_dirt_footstep", gain=0.7},

View File

@ -110,6 +110,7 @@ minetest.register_craftitem("mcl_nether:nether_wart_item", {
_doc_items_usagehelp = S("Place this item on soul sand to plant it and watch it grow."),
inventory_image = "mcl_nether_nether_wart.png",
wield_image = "mcl_nether_nether_wart.png",
groups = {craftitem = 1, brewitem = 1, compostability = 30},
on_place = function(itemstack, placer, pointed_thing)
if pointed_thing.type ~= "node" then
return itemstack
@ -143,7 +144,6 @@ minetest.register_craftitem("mcl_nether:nether_wart_item", {
end
end
end,
groups = { craftitem = 1, brewitem=1 },
})
local names = {"mcl_nether:nether_wart_0", "mcl_nether:nether_wart_1", "mcl_nether:nether_wart_2"}

View File

@ -741,7 +741,7 @@ minetest.register_craftitem("mcl_ocean:kelp", {
inventory_image = "mcl_ocean_kelp_item.png",
wield_image = "mcl_ocean_kelp_item.png",
on_place = kelp.kelp_on_place,
groups = { deco_block = 1 },
groups = {deco_block = 1, compostability = 30},
})
if mod_doc then
@ -756,7 +756,7 @@ minetest.register_craftitem("mcl_ocean:dried_kelp", {
_doc_items_longdesc = S("Dried kelp is a food item."),
inventory_image = "mcl_ocean_dried_kelp.png",
wield_image = "mcl_ocean_dried_kelp.png",
groups = { food = 2, eatable = 1 },
groups = {food = 2, eatable = 1, compostability = 30},
on_place = minetest.item_eat(1),
on_secondary_use = minetest.item_eat(1),
_mcl_saturation = 0.6,
@ -773,7 +773,10 @@ minetest.register_node("mcl_ocean:dried_kelp_block", {
description = S("Dried Kelp Block"),
_doc_items_longdesc = S("A decorative block that serves as a great furnace fuel."),
tiles = { "mcl_ocean_dried_kelp_top.png", "mcl_ocean_dried_kelp_bottom.png", "mcl_ocean_dried_kelp_side.png" },
groups = { handy = 1, hoey = 1, building_block = 1, flammable = 2, fire_encouragement = 30, fire_flammability = 60 },
groups = {
handy = 1, hoey = 1, building_block = 1, compostability = 50,
flammable = 2, fire_encouragement = 30, fire_flammability = 60
},
sounds = mcl_sounds.node_sound_leaves_defaults(),
paramtype2 = "facedir",
on_place = mcl_util.rotate_axis,

View File

@ -106,7 +106,10 @@ for s=1,4 do
},
inventory_image = img,
wield_image = img,
groups = { dig_immediate = 3, deco_block = 1, sea_pickle=1, not_in_creative_inventory=nici },
groups = {
dig_immediate = 3, deco_block = 1, sea_pickle = 1,
not_in_creative_inventory=nici, compostability = 65
},
-- Light level: 6 at size 1, +3 for each additional stage
light_source = math.min(6 + (s-1)*3, minetest.LIGHT_MAX),
selection_box = {

View File

@ -85,7 +85,7 @@ minetest.register_craftitem("mcl_ocean:seagrass", {
inventory_image = "mcl_ocean_seagrass.png^[verticalframe:12:0",
wield_image = "mcl_ocean_seagrass.png^[verticalframe:12:0",
on_place = seagrass_on_place,
groups = { deco_block = 1 },
groups = {deco_block = 1, compostability = 30},
})
-- Seagrass nodes: seagrass on a surface node