Merge pull request 'Add Grass Palette Group' (#3481) from grass_palette_group into master

Reviewed-on: MineClone2/MineClone2#3481
Reviewed-by: ancientmarinerdev <ancientmariner_dev@proton.me>
This commit is contained in:
ancientmarinerdev 2023-03-05 12:53:46 +00:00
commit 25aff57076
6 changed files with 14 additions and 11 deletions

View File

@ -1511,7 +1511,7 @@ end
--
-- The snowable nodes also MUST have _mcl_snowed defined to contain the name
-- of the snowed node.
function mcl_core.register_snowed_node(itemstring_snowed, itemstring_clear, tiles, sounds, clear_colorization, desc)
function mcl_core.register_snowed_node(itemstring_snowed, itemstring_clear, tiles, sounds, clear_colorization, desc, grass_palette)
local def = table.copy(minetest.registered_nodes[itemstring_clear])
local create_doc_alias
if def.description then
@ -1525,6 +1525,7 @@ function mcl_core.register_snowed_node(itemstring_snowed, itemstring_clear, tile
def._doc_items_usagehelp = nil
def._doc_items_create_entry = false
def.groups.not_in_creative_inventory = 1
def.groups.grass_palette = grass_palette
if def.groups.grass_block == 1 then
def.groups.grass_block_no_snow = nil
def.groups.grass_block_snow = 1

View File

@ -380,7 +380,7 @@ minetest.register_node("mcl_core:dirt_with_grass", {
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, path_creation_possible=1
compostability = 30, path_creation_possible = 1, grass_palette = 1
},
drop = "mcl_core:dirt",
sounds = mcl_sounds.node_sound_dirt_defaults({
@ -401,7 +401,7 @@ minetest.register_node("mcl_core:dirt_with_grass", {
_mcl_hardness = 0.6,
_mcl_silk_touch_drop = true,
})
mcl_core.register_snowed_node("mcl_core:dirt_with_grass_snow", "mcl_core:dirt_with_grass", nil, nil, true, S("Dirt with Snow"))
mcl_core.register_snowed_node("mcl_core:dirt_with_grass_snow", "mcl_core:dirt_with_grass", nil, nil, true, S("Dirt with Snow"), 1)
minetest.register_node("mcl_core:grass_path", {
tiles = {"mcl_core_grass_path_top.png", "default_dirt.png", "mcl_core_grass_path_side.png"},

View File

@ -84,7 +84,7 @@ minetest.register_node("mcl_core:reeds", {
stack_max = 64,
groups = {
dig_immediate = 3, craftitem = 1, deco_block = 1, dig_by_piston = 1,
plant = 1, non_mycelium_plant = 1, compostability = 50
plant = 1, non_mycelium_plant = 1, compostability = 50, grass_palette = 1
},
sounds = mcl_sounds.node_sound_leaves_defaults(),
node_placement_prediction = "",

View File

@ -75,11 +75,13 @@ function mcl_flowerpots.register_potted_flower(name, def)
use_texture_alpha = "clip",
visual_scale = 0.5,
paramtype = "light",
paramtype2 = def.paramtype2,
palette = def.palette,
sunlight_propagates = true,
selection_box = pot_box,
collision_box = pot_box,
is_ground_content = false,
groups = { dig_immediate = 3, attached_node = 1, dig_by_piston = 1, not_in_creative_inventory = 1, flower_pot = 2 },
groups = { dig_immediate = 3, attached_node = 1, dig_by_piston = 1, not_in_creative_inventory = 1, flower_pot = 2, grass_palette = def.grass_palette_group },
sounds = mcl_sounds.node_sound_stone_defaults(),
on_rightclick = function(pos, item, clicker)
local player_name = clicker:get_player_name()

View File

@ -156,7 +156,7 @@ local def_tallgrass = {
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
dig_by_water = 1, destroy_by_lava_flow = 1, compostability = 30, grass_palette = 1
},
sounds = mcl_sounds.node_sound_leaves_defaults(),
drop = wheat_seed_drop,
@ -190,6 +190,7 @@ if has_mcl_flowerpots then
name = "fern",
desc = S("Fern"),
image = "mcl_flowers_fern_inv.png",
grass_palette_group = 1
})
end
@ -206,7 +207,7 @@ local function add_large_plant(name, desc, longdesc, bottom_img, top_img, inv_im
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
plant = 1, double_plant = 1, non_mycelium_plant = 1, compostability = 65, grass_palette = nil
}
if name == "double_grass" then
bottom_groups.compostability = 50
@ -223,6 +224,7 @@ local function add_large_plant(name, desc, longdesc, bottom_img, top_img, inv_im
if grass_color then
paramtype2 = "color"
palette = "mcl_core_palette_grass.png"
bottom_groups.grass_palette = 1
end
if longdesc == nil then
bottom_groups.not_in_creative_inventory = 1

View File

@ -345,15 +345,13 @@ local function world_structure(vm, data, data2, emin, emax, area, minp, maxp, bl
return lvm_used, lvm_used, deco, ores
end
local affected_grass_blocks = {"mcl_core:dirt_with_grass", "mcl_flowers:tallgrass", "mcl_flowers:double_grass", "mcl_flowers:double_grass_top", "mcl_flowers:fern", "mcl_flowers:double_fern", "mcl_flowers:double_fern_top", "mcl_core:reeds", "mcl_core:dirt_with_grass_snow"}
local function block_fixes_grass(vm, data, data2, emin, emax, area, minp, maxp, blockseed)
local biomemap = minetest.get_mapgen_object("biomemap")
local lvm_used = false
local pr = PseudoRandom(blockseed)
if minp.y <= mcl_vars.mg_overworld_max and maxp.y >= mcl_vars.mg_overworld_min then
-- Set param2 (=color) of nodes which use the grass colour palette.
lvm_used = set_grass_palette(minp,maxp,data2,area,biomemap,affected_grass_blocks)
lvm_used = set_grass_palette(minp,maxp,data2,area,biomemap,{"group:grass_palette"})
end
return lvm_used
end
@ -424,7 +422,7 @@ end, 100, true)
minetest.register_lbm({
label = "Fix grass palette indexes", -- This LBM fixes any incorrect grass palette indexes.
name = "mcl_mapgen_core:fix_grass_palette_indexes",
nodenames = affected_grass_blocks,
nodenames = {"group:grass_palette"},
run_at_every_load = false,
action = function(pos, node)
local grass_palette_index = mcl_util.get_palette_indexes_from_pos(pos).grass_palette_index