0
0
Fork 0

First step towards param2-based grass color

This commit is contained in:
Wuzzy 2019-12-13 14:03:12 +01:00
parent 8e224d0bd9
commit 325801efd7
7 changed files with 30 additions and 43 deletions

View File

@ -653,9 +653,9 @@ function mcl_core.get_grass_block_type(pos)
end end
end end
if dry then if dry then
return {name="mcl_core:dirt_with_dry_grass"} return {name="mcl_core:dirt_with_grass", param2=1}
else else
return {name="mcl_core:dirt_with_grass"} return {name="mcl_core:dirt_with_grass", param2=0}
end end
end end
@ -1232,10 +1232,11 @@ end
-- * itemstring_clear: Itemstring of the original “clear” node without snow -- * itemstring_clear: Itemstring of the original “clear” node without snow
-- * tiles: Optional custom tiles -- * tiles: Optional custom tiles
-- * sounds: Optional custom sounds -- * sounds: Optional custom sounds
-- * clear_colorization: Optional. If true, will clear all paramtype2="color" related node def. fields
-- --
-- The snowable nodes also MUST have _mcl_snowed defined to contain the name -- The snowable nodes also MUST have _mcl_snowed defined to contain the name
-- of the snowed node. -- of the snowed node.
mcl_core.register_snowed_node = function(itemstring_snowed, itemstring_clear, tiles, sounds) mcl_core.register_snowed_node = function(itemstring_snowed, itemstring_clear, tiles, sounds, clear_colorization)
local def = table.copy(minetest.registered_nodes[itemstring_clear]) local def = table.copy(minetest.registered_nodes[itemstring_clear])
local create_doc_alias local create_doc_alias
if def.description then if def.description then
@ -1270,6 +1271,11 @@ mcl_core.register_snowed_node = function(itemstring_snowed, itemstring_clear, ti
else else
def.tiles = tiles def.tiles = tiles
end end
if clear_colorization then
def.paramtype2 = nil
def.color = nil
def.overlay_tiles = nil
end
if not sounds then if not sounds then
def.sounds = mcl_sounds.node_sound_dirt_defaults({ def.sounds = mcl_sounds.node_sound_dirt_defaults({
footstep = { name = "pedology_snow_soft_footstep", gain = 0.5 } footstep = { name = "pedology_snow_soft_footstep", gain = 0.5 }

View File

@ -312,7 +312,12 @@ minetest.register_node("mcl_core:dirt_with_grass", {
description = S("Grass Block"), description = S("Grass Block"),
_doc_items_longdesc = S("A grass block is dirt with a grass cover. Grass blocks are resourceful blocks which allow the growth of all sorts of plants. They can be turned into farmland with a hoe and turned into grass paths with a shovel. In light, the grass slowly spreads onto dirt nearby. Under an opaque block or a liquid, a grass block may turn back to dirt."), _doc_items_longdesc = S("A grass block is dirt with a grass cover. Grass blocks are resourceful blocks which allow the growth of all sorts of plants. They can be turned into farmland with a hoe and turned into grass paths with a shovel. In light, the grass slowly spreads onto dirt nearby. Under an opaque block or a liquid, a grass block may turn back to dirt."),
_doc_items_hidden = false, _doc_items_hidden = false,
tiles = {"default_grass.png", "default_dirt.png", {name="default_dirt.png^default_grass_side.png", tileable_vertical=false}}, paramtype2 = "color",
tiles = {"mcl_core_grass_block_top.png", { name="default_dirt.png", color="white" }},
overlay_tiles = {"mcl_core_grass_block_top.png", "", {name="mcl_core_grass_block_side_overlay.png", tileable_vertical=false}},
palette = "mcl_core_palette_grass.png",
palette_index = 0,
color = "#5ac557",
is_ground_content = true, is_ground_content = true,
stack_max = 64, 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},
@ -332,31 +337,7 @@ minetest.register_node("mcl_core:dirt_with_grass", {
_mcl_blast_resistance = 3, _mcl_blast_resistance = 3,
_mcl_hardness = 0.6, _mcl_hardness = 0.6,
}) })
mcl_core.register_snowed_node("mcl_core:dirt_with_grass_snow", "mcl_core:dirt_with_grass") mcl_core.register_snowed_node("mcl_core:dirt_with_grass_snow", "mcl_core:dirt_with_grass", nil, nil, true)
-- Grass Block variant for dry biomes
minetest.register_node("mcl_core:dirt_with_dry_grass", {
_doc_items_create_entry = false,
tiles = {"default_dry_grass.png", "default_dirt.png", {name="default_dirt.png^default_dry_grass_side.png", tileable_vertical=false}},
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, not_in_creative_inventory=1},
drop = 'mcl_core:dirt',
sounds = mcl_sounds.node_sound_dirt_defaults({
footstep = {name="default_grass_footstep", gain=0.4},
}),
on_construct = mcl_core.on_snowable_construct,
_mcl_snowed = "mcl_core:dirt_with_dry_grass_snow",
_mcl_grass_palette_index = 1,
_mcl_blast_resistance = 3,
_mcl_hardness = 0.6,
})
mcl_core.register_snowed_node("mcl_core:dirt_with_dry_grass_snow", "mcl_core:dirt_with_dry_grass")
if minetest.get_modpath("doc") then
doc.add_entry_alias("nodes", "mcl_core:dirt_with_grass", "nodes", "mcl_core:dirt_with_dry_grass")
doc.add_entry_alias("nodes", "mcl_core:dirt_with_grass", "nodes", "mcl_core:dirt_with_dry_grass_snow")
end
minetest.register_node("mcl_core:grass_path", { minetest.register_node("mcl_core:grass_path", {
tiles = {"mcl_core_grass_path_top.png", "default_dirt.png", "mcl_core_grass_path_side.png"}, tiles = {"mcl_core_grass_path_top.png", "default_dirt.png", "mcl_core_grass_path_side.png"},

Binary file not shown.

Before

Width:  |  Height:  |  Size: 428 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 423 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 394 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 393 B

View File

@ -919,7 +919,7 @@ local function register_biomes()
-- Strata don't generate here. -- Strata don't generate here.
minetest.register_biome({ minetest.register_biome({
name = "MesaPlateauF_grasstop", name = "MesaPlateauF_grasstop",
node_top = "mcl_core:dirt_with_dry_grass", node_top = "mcl_core:dirt_with_grass",
depth_top = 1, depth_top = 1,
node_filler = "mcl_core:dirt", node_filler = "mcl_core:dirt",
depth_filler = 1, depth_filler = 1,
@ -985,7 +985,7 @@ local function register_biomes()
-- Grass plateau -- Grass plateau
minetest.register_biome({ minetest.register_biome({
name = "MesaPlateauFM_grasstop", name = "MesaPlateauFM_grasstop",
node_top = "mcl_core:dirt_with_dry_grass", node_top = "mcl_core:dirt_with_grass",
depth_top = 1, depth_top = 1,
node_filler = "mcl_core:coarse_dirt", node_filler = "mcl_core:coarse_dirt",
depth_filler = 2, depth_filler = 2,
@ -1035,7 +1035,7 @@ local function register_biomes()
-- Savanna -- Savanna
minetest.register_biome({ minetest.register_biome({
name = "Savanna", name = "Savanna",
node_top = "mcl_core:dirt_with_dry_grass", node_top = "mcl_core:dirt_with_grass",
depth_top = 1, depth_top = 1,
node_filler = "mcl_core:dirt", node_filler = "mcl_core:dirt",
depth_filler = 2, depth_filler = 2,
@ -1081,7 +1081,7 @@ local function register_biomes()
-- Otherwise identical to Savanna -- Otherwise identical to Savanna
minetest.register_biome({ minetest.register_biome({
name = "SavannaM", name = "SavannaM",
node_top = "mcl_core:dirt_with_dry_grass", node_top = "mcl_core:dirt_with_grass",
depth_top = 1, depth_top = 1,
node_filler = "mcl_core:coarse_dirt", node_filler = "mcl_core:coarse_dirt",
depth_filler = 3, depth_filler = 3,
@ -1514,7 +1514,7 @@ local function register_biomelike_ores()
minetest.register_ore({ minetest.register_ore({
ore_type = "sheet", ore_type = "sheet",
ore = "mcl_core:coarse_dirt", ore = "mcl_core:coarse_dirt",
wherein = {"mcl_core:dirt_with_dry_grass", "mcl_core:dirt"}, wherein = {"mcl_core:dirt_with_grass", "mcl_core:dirt"},
column_height_max = 1, column_height_max = 1,
column_midpoint_factor = 0.0, column_midpoint_factor = 0.0,
y_min = mcl_vars.mg_overworld_min, y_min = mcl_vars.mg_overworld_min,
@ -1526,7 +1526,7 @@ local function register_biomelike_ores()
minetest.register_ore({ minetest.register_ore({
ore_type = "blob", ore_type = "blob",
ore = "mcl_core:coarse_dirt", ore = "mcl_core:coarse_dirt",
wherein = {"mcl_core:dirt_with_dry_grass", "mcl_core:dirt"}, wherein = {"mcl_core:dirt_with_grass", "mcl_core:dirt"},
clust_scarcity = 1500, clust_scarcity = 1500,
clust_num_ores = 25, clust_num_ores = 25,
clust_size = 7, clust_size = 7,
@ -1537,7 +1537,7 @@ local function register_biomelike_ores()
minetest.register_ore({ minetest.register_ore({
ore_type = "sheet", ore_type = "sheet",
ore = "mcl_core:coarse_dirt", ore = "mcl_core:coarse_dirt",
wherein = {"mcl_core:dirt_with_dry_grass", "mcl_core:dirt"}, wherein = {"mcl_core:dirt_with_grass", "mcl_core:dirt"},
column_height_max = 1, column_height_max = 1,
column_midpoint_factor = 0.0, column_midpoint_factor = 0.0,
y_min = mcl_vars.mg_overworld_min, y_min = mcl_vars.mg_overworld_min,
@ -1549,7 +1549,7 @@ local function register_biomelike_ores()
minetest.register_ore({ minetest.register_ore({
ore_type = "blob", ore_type = "blob",
ore = "mcl_core:coarse_dirt", ore = "mcl_core:coarse_dirt",
wherein = {"mcl_core:dirt_with_dry_grass", "mcl_core:dirt"}, wherein = {"mcl_core:dirt_with_grass", "mcl_core:dirt"},
clust_scarcity = 1800, clust_scarcity = 1800,
clust_num_ores = 65, clust_num_ores = 65,
clust_size = 15, clust_size = 15,
@ -2251,7 +2251,7 @@ local function register_decorations()
}) })
minetest.register_decoration({ minetest.register_decoration({
deco_type = "schematic", deco_type = "schematic",
place_on = {"mcl_core:dirt_with_dry_grass", "mcl_core:dirt"}, place_on = {"mcl_core:dirt_with_grass", "mcl_core:dirt"},
sidelen = 16, sidelen = 16,
noise_params = { noise_params = {
offset = 0.015, offset = 0.015,
@ -2270,7 +2270,7 @@ local function register_decorations()
}) })
minetest.register_decoration({ minetest.register_decoration({
deco_type = "schematic", deco_type = "schematic",
place_on = {"mcl_core:dirt_with_dry_grass", "mcl_core:dirt"}, place_on = {"mcl_core:dirt_with_grass", "mcl_core:dirt"},
sidelen = 16, sidelen = 16,
noise_params = { noise_params = {
offset = 0.008, offset = 0.008,
@ -2565,7 +2565,7 @@ local function register_decorations()
for a=1, 7 do for a=1, 7 do
minetest.register_decoration({ minetest.register_decoration({
deco_type = "schematic", deco_type = "schematic",
place_on = {"mcl_core:dirt_with_dry_grass", "mcl_core:dirt", "mcl_core:coarse_dirt"}, place_on = {"mcl_core:dirt_with_grass", "mcl_core:dirt", "mcl_core:coarse_dirt"},
sidelen = 16, sidelen = 16,
fill_ratio = 0.0002, fill_ratio = 0.0002,
biomes = {"Savanna", "SavannaM"}, biomes = {"Savanna", "SavannaM"},
@ -2872,7 +2872,7 @@ local function register_decorations()
num_spawn_by = 1, num_spawn_by = 1,
}) })
local dry_index = minetest.registered_nodes["mcl_core:dirt_with_dry_grass"]._mcl_grass_palette_index local dry_index = minetest.registered_nodes["mcl_core:dirt_with_grass"]._mcl_grass_palette_index
-- Doubletall grass -- Doubletall grass
local register_doubletall_grass = function(offset, scale, biomes, param2) local register_doubletall_grass = function(offset, scale, biomes, param2)
@ -3435,7 +3435,7 @@ local function register_decorations()
-- Dead bushes -- Dead bushes
minetest.register_decoration({ minetest.register_decoration({
deco_type = "simple", deco_type = "simple",
place_on = {"group:sand", "mcl_core:podzol", "mcl_core:dirt", "mcl_core:dirt_with_dry_grass", "mcl_core:coarse_dirt", "group:hardened_clay"}, place_on = {"group:sand", "mcl_core:podzol", "mcl_core:dirt", "mcl_core:dirt_with_grass", "mcl_core:coarse_dirt", "group:hardened_clay"},
sidelen = 16, sidelen = 16,
noise_params = { noise_params = {
offset = 0.0, offset = 0.0,
@ -3453,7 +3453,7 @@ local function register_decorations()
}) })
minetest.register_decoration({ minetest.register_decoration({
deco_type = "simple", deco_type = "simple",
place_on = {"group:sand", "mcl_core:dirt", "mcl_core:dirt_with_dry_grass", "mcl_core:coarse_dirt"}, place_on = {"group:sand", "mcl_core:dirt", "mcl_core:dirt_with_grass", "mcl_core:coarse_dirt"},
sidelen = 16, sidelen = 16,
noise_params = { noise_params = {
offset = 0.1, offset = 0.1,