Allow "liquid" and "flowingliquid" drawtypes even if liquidtype=none (#10737)

This commit is contained in:
Wuzzy 2021-01-21 00:51:24 +01:00 committed by GitHub
parent eb8af614a5
commit 7f25823bd4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 55 additions and 66 deletions

@ -350,68 +350,72 @@ minetest.register_node("testnodes:plantlike_rooted_degrotate", {
}) })
-- Demonstrative liquid nodes, source and flowing form. -- Demonstrative liquid nodes, source and flowing form.
minetest.register_node("testnodes:liquid", { -- DRAWTYPE ONLY, NO LIQUID PHYSICS!
description = S("Source Liquid Drawtype Test Node"), -- Liquid ranges 0 to 8
for r = 0, 8 do
minetest.register_node("testnodes:liquid_"..r, {
description = S("Source Liquid Drawtype Test Node, Range @1", r),
drawtype = "liquid", drawtype = "liquid",
paramtype = "light", paramtype = "light",
tiles = { tiles = {
"testnodes_liquidsource.png", "testnodes_liquidsource_r"..r..".png^[colorize:#FFFFFF:100",
}, },
special_tiles = { special_tiles = {
{name="testnodes_liquidsource.png", backface_culling=false}, {name="testnodes_liquidsource_r"..r..".png^[colorize:#FFFFFF:100", backface_culling=false},
{name="testnodes_liquidsource.png", backface_culling=true}, {name="testnodes_liquidsource_r"..r..".png^[colorize:#FFFFFF:100", backface_culling=true},
}, },
use_texture_alpha = true, use_texture_alpha = true,
walkable = false, walkable = false,
liquidtype = "source", liquid_range = r,
liquid_range = 1,
liquid_viscosity = 0, liquid_viscosity = 0,
liquid_alternative_flowing = "testnodes:liquid_flowing", liquid_alternative_flowing = "testnodes:liquid_flowing_"..r,
liquid_alternative_source = "testnodes:liquid", liquid_alternative_source = "testnodes:liquid_"..r,
groups = { dig_immediate = 3 }, groups = { dig_immediate = 3 },
}) })
minetest.register_node("testnodes:liquid_flowing", { minetest.register_node("testnodes:liquid_flowing_"..r, {
description = S("Flowing Liquid Drawtype Test Node"), description = S("Flowing Liquid Drawtype Test Node, Range @1", r),
drawtype = "flowingliquid", drawtype = "flowingliquid",
paramtype = "light", paramtype = "light",
paramtype2 = "flowingliquid", paramtype2 = "flowingliquid",
tiles = { tiles = {
"testnodes_liquidflowing.png", "testnodes_liquidflowing_r"..r..".png^[colorize:#FFFFFF:100",
}, },
special_tiles = { special_tiles = {
{name="testnodes_liquidflowing.png", backface_culling=false}, {name="testnodes_liquidflowing_r"..r..".png^[colorize:#FFFFFF:100", backface_culling=false},
{name="testnodes_liquidflowing.png", backface_culling=false}, {name="testnodes_liquidflowing_r"..r..".png^[colorize:#FFFFFF:100", backface_culling=false},
}, },
use_texture_alpha = true, use_texture_alpha = true,
walkable = false, walkable = false,
liquidtype = "flowing", liquid_range = r,
liquid_range = 1,
liquid_viscosity = 0, liquid_viscosity = 0,
liquid_alternative_flowing = "testnodes:liquid_flowing", liquid_alternative_flowing = "testnodes:liquid_flowing_"..r,
liquid_alternative_source = "testnodes:liquid", liquid_alternative_source = "testnodes:liquid_"..r,
groups = { dig_immediate = 3 }, groups = { dig_immediate = 3 },
}) })
end
-- Waving liquid test (drawtype only)
minetest.register_node("testnodes:liquid_waving", { minetest.register_node("testnodes:liquid_waving", {
description = S("Waving Source Liquid Drawtype Test Node"), description = S("Waving Source Liquid Drawtype Test Node"),
drawtype = "liquid", drawtype = "liquid",
paramtype = "light", paramtype = "light",
tiles = { tiles = {
"testnodes_liquidsource.png^[brighten", "testnodes_liquidsource.png^[colorize:#0000FF:127",
}, },
special_tiles = { special_tiles = {
{name="testnodes_liquidsource.png^[brighten", backface_culling=false}, {name="testnodes_liquidsource.png^[colorize:#0000FF:127", backface_culling=false},
{name="testnodes_liquidsource.png^[brighten", backface_culling=true}, {name="testnodes_liquidsource.png^[colorize:#0000FF:127", backface_culling=true},
}, },
use_texture_alpha = true, use_texture_alpha = true,
waving = 3, waving = 3,
walkable = false, walkable = false,
liquidtype = "source",
liquid_range = 1, liquid_range = 1,
liquid_viscosity = 0, liquid_viscosity = 0,
liquid_alternative_flowing = "testnodes:liquid_flowing_waving", liquid_alternative_flowing = "testnodes:liquid_flowing_waving",
@ -424,18 +428,17 @@ minetest.register_node("testnodes:liquid_flowing_waving", {
paramtype = "light", paramtype = "light",
paramtype2 = "flowingliquid", paramtype2 = "flowingliquid",
tiles = { tiles = {
"testnodes_liquidflowing.png^[brighten", "testnodes_liquidflowing.png^[colorize:#0000FF:127",
}, },
special_tiles = { special_tiles = {
{name="testnodes_liquidflowing.png^[brighten", backface_culling=false}, {name="testnodes_liquidflowing.png^[colorize:#0000FF:127", backface_culling=false},
{name="testnodes_liquidflowing.png^[brighten", backface_culling=false}, {name="testnodes_liquidflowing.png^[colorize:#0000FF:127", backface_culling=false},
}, },
use_texture_alpha = true, use_texture_alpha = true,
waving = 3, waving = 3,
walkable = false, walkable = false,
liquidtype = "flowing",
liquid_range = 1, liquid_range = 1,
liquid_viscosity = 0, liquid_viscosity = 0,
liquid_alternative_flowing = "testnodes:liquid_flowing_waving", liquid_alternative_flowing = "testnodes:liquid_flowing_waving",
@ -443,8 +446,6 @@ minetest.register_node("testnodes:liquid_flowing_waving", {
groups = { dig_immediate = 3 }, groups = { dig_immediate = 3 },
}) })
-- Invisible node -- Invisible node
minetest.register_node("testnodes:airlike", { minetest.register_node("testnodes:airlike", {
description = S("Airlike Drawtype Test Node"), description = S("Airlike Drawtype Test Node"),

@ -12,8 +12,6 @@ for d=0, 8 do
alpha = 192, alpha = 192,
paramtype = "light", paramtype = "light",
walkable = false, walkable = false,
pointable = false,
diggable = false,
buildable_to = true, buildable_to = true,
is_ground_content = false, is_ground_content = false,
liquidtype = "source", liquidtype = "source",
@ -34,8 +32,6 @@ for d=0, 8 do
paramtype = "light", paramtype = "light",
paramtype2 = "flowingliquid", paramtype2 = "flowingliquid",
walkable = false, walkable = false,
pointable = false,
diggable = false,
buildable_to = true, buildable_to = true,
is_ground_content = false, is_ground_content = false,
liquidtype = "flowing", liquidtype = "flowing",
@ -56,8 +52,6 @@ for d=0, 8 do
alpha = 192, alpha = 192,
paramtype = "light", paramtype = "light",
walkable = false, walkable = false,
pointable = false,
diggable = false,
buildable_to = true, buildable_to = true,
is_ground_content = false, is_ground_content = false,
liquidtype = "source", liquidtype = "source",
@ -78,8 +72,6 @@ for d=0, 8 do
paramtype = "light", paramtype = "light",
paramtype2 = "flowingliquid", paramtype2 = "flowingliquid",
walkable = false, walkable = false,
pointable = false,
diggable = false,
buildable_to = true, buildable_to = true,
is_ground_content = false, is_ground_content = false,
liquidtype = "flowing", liquidtype = "flowing",

@ -118,7 +118,6 @@ minetest.register_node("testnodes:liquid_nojump", {
paramtype = "light", paramtype = "light",
pointable = false, pointable = false,
liquids_pointable = true, liquids_pointable = true,
diggable = false,
buildable_to = true, buildable_to = true,
is_ground_content = false, is_ground_content = false,
post_effect_color = {a = 70, r = 255, g = 0, b = 200}, post_effect_color = {a = 70, r = 255, g = 0, b = 200},
@ -148,7 +147,6 @@ minetest.register_node("testnodes:liquidflowing_nojump", {
paramtype2 = "flowingliquid", paramtype2 = "flowingliquid",
pointable = false, pointable = false,
liquids_pointable = true, liquids_pointable = true,
diggable = false,
buildable_to = true, buildable_to = true,
is_ground_content = false, is_ground_content = false,
post_effect_color = {a = 70, r = 255, g = 0, b = 200}, post_effect_color = {a = 70, r = 255, g = 0, b = 200},

@ -513,10 +513,10 @@ f32 MapblockMeshGenerator::getCornerLevel(int i, int k)
count++; count++;
} else if (content == CONTENT_AIR) { } else if (content == CONTENT_AIR) {
air_count++; air_count++;
}
}
if (air_count >= 2) if (air_count >= 2)
return -0.5 * BS + 0.2; return -0.5 * BS + 0.2;
}
}
if (count > 0) if (count > 0)
return sum / count; return sum / count;
return 0; return 0;

@ -788,14 +788,12 @@ void ContentFeatures::updateTextures(ITextureSource *tsrc, IShaderSource *shdsrc
solidness = 0; solidness = 0;
break; break;
case NDT_LIQUID: case NDT_LIQUID:
assert(liquid_type == LIQUID_SOURCE);
if (tsettings.opaque_water) if (tsettings.opaque_water)
alpha = 255; alpha = 255;
solidness = 1; solidness = 1;
is_liquid = true; is_liquid = true;
break; break;
case NDT_FLOWINGLIQUID: case NDT_FLOWINGLIQUID:
assert(liquid_type == LIQUID_FLOWING);
solidness = 0; solidness = 0;
if (tsettings.opaque_water) if (tsettings.opaque_water)
alpha = 255; alpha = 255;
@ -1596,7 +1594,7 @@ static void removeDupes(std::vector<content_t> &list)
void NodeDefManager::resolveCrossrefs() void NodeDefManager::resolveCrossrefs()
{ {
for (ContentFeatures &f : m_content_features) { for (ContentFeatures &f : m_content_features) {
if (f.liquid_type != LIQUID_NONE) { if (f.liquid_type != LIQUID_NONE || f.drawtype == NDT_LIQUID || f.drawtype == NDT_FLOWINGLIQUID) {
f.liquid_alternative_flowing_id = getId(f.liquid_alternative_flowing); f.liquid_alternative_flowing_id = getId(f.liquid_alternative_flowing);
f.liquid_alternative_source_id = getId(f.liquid_alternative_source); f.liquid_alternative_source_id = getId(f.liquid_alternative_source);
continue; continue;