Skip to content

Commit 7f25823

Browse files
authored
Allow "liquid" and "flowingliquid" drawtypes even if liquidtype=none (#10737)
1 parent eb8af61 commit 7f25823

File tree

5 files changed

+57
-68
lines changed

5 files changed

+57
-68
lines changed

games/devtest/mods/testnodes/drawtypes.lua

Lines changed: 54 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -350,68 +350,72 @@ minetest.register_node("testnodes:plantlike_rooted_degrotate", {
350350
})
351351

352352
-- Demonstrative liquid nodes, source and flowing form.
353-
minetest.register_node("testnodes:liquid", {
354-
description = S("Source Liquid Drawtype Test Node"),
355-
drawtype = "liquid",
356-
paramtype = "light",
357-
tiles = {
358-
"testnodes_liquidsource.png",
359-
},
360-
special_tiles = {
361-
{name="testnodes_liquidsource.png", backface_culling=false},
362-
{name="testnodes_liquidsource.png", backface_culling=true},
363-
},
364-
use_texture_alpha = true,
365-
366-
367-
walkable = false,
368-
liquidtype = "source",
369-
liquid_range = 1,
370-
liquid_viscosity = 0,
371-
liquid_alternative_flowing = "testnodes:liquid_flowing",
372-
liquid_alternative_source = "testnodes:liquid",
373-
groups = { dig_immediate = 3 },
374-
})
375-
minetest.register_node("testnodes:liquid_flowing", {
376-
description = S("Flowing Liquid Drawtype Test Node"),
377-
drawtype = "flowingliquid",
378-
paramtype = "light",
379-
paramtype2 = "flowingliquid",
380-
tiles = {
381-
"testnodes_liquidflowing.png",
382-
},
383-
special_tiles = {
384-
{name="testnodes_liquidflowing.png", backface_culling=false},
385-
{name="testnodes_liquidflowing.png", backface_culling=false},
386-
},
387-
use_texture_alpha = true,
353+
-- DRAWTYPE ONLY, NO LIQUID PHYSICS!
354+
-- Liquid ranges 0 to 8
355+
for r = 0, 8 do
356+
minetest.register_node("testnodes:liquid_"..r, {
357+
description = S("Source Liquid Drawtype Test Node, Range @1", r),
358+
drawtype = "liquid",
359+
paramtype = "light",
360+
tiles = {
361+
"testnodes_liquidsource_r"..r..".png^[colorize:#FFFFFF:100",
362+
},
363+
special_tiles = {
364+
{name="testnodes_liquidsource_r"..r..".png^[colorize:#FFFFFF:100", backface_culling=false},
365+
{name="testnodes_liquidsource_r"..r..".png^[colorize:#FFFFFF:100", backface_culling=true},
366+
},
367+
use_texture_alpha = true,
368+
369+
370+
walkable = false,
371+
liquid_range = r,
372+
liquid_viscosity = 0,
373+
liquid_alternative_flowing = "testnodes:liquid_flowing_"..r,
374+
liquid_alternative_source = "testnodes:liquid_"..r,
375+
groups = { dig_immediate = 3 },
376+
})
377+
minetest.register_node("testnodes:liquid_flowing_"..r, {
378+
description = S("Flowing Liquid Drawtype Test Node, Range @1", r),
379+
drawtype = "flowingliquid",
380+
paramtype = "light",
381+
paramtype2 = "flowingliquid",
382+
tiles = {
383+
"testnodes_liquidflowing_r"..r..".png^[colorize:#FFFFFF:100",
384+
},
385+
special_tiles = {
386+
{name="testnodes_liquidflowing_r"..r..".png^[colorize:#FFFFFF:100", backface_culling=false},
387+
{name="testnodes_liquidflowing_r"..r..".png^[colorize:#FFFFFF:100", backface_culling=false},
388+
},
389+
use_texture_alpha = true,
390+
391+
392+
walkable = false,
393+
liquid_range = r,
394+
liquid_viscosity = 0,
395+
liquid_alternative_flowing = "testnodes:liquid_flowing_"..r,
396+
liquid_alternative_source = "testnodes:liquid_"..r,
397+
groups = { dig_immediate = 3 },
398+
})
388399

400+
end
389401

390-
walkable = false,
391-
liquidtype = "flowing",
392-
liquid_range = 1,
393-
liquid_viscosity = 0,
394-
liquid_alternative_flowing = "testnodes:liquid_flowing",
395-
liquid_alternative_source = "testnodes:liquid",
396-
groups = { dig_immediate = 3 },
397-
})
402+
-- Waving liquid test (drawtype only)
398403
minetest.register_node("testnodes:liquid_waving", {
399404
description = S("Waving Source Liquid Drawtype Test Node"),
400405
drawtype = "liquid",
401406
paramtype = "light",
402407
tiles = {
403-
"testnodes_liquidsource.png^[brighten",
408+
"testnodes_liquidsource.png^[colorize:#0000FF:127",
404409
},
405410
special_tiles = {
406-
{name="testnodes_liquidsource.png^[brighten", backface_culling=false},
407-
{name="testnodes_liquidsource.png^[brighten", backface_culling=true},
411+
{name="testnodes_liquidsource.png^[colorize:#0000FF:127", backface_culling=false},
412+
{name="testnodes_liquidsource.png^[colorize:#0000FF:127", backface_culling=true},
408413
},
409414
use_texture_alpha = true,
410415
waving = 3,
411416

412417

413418
walkable = false,
414-
liquidtype = "source",
415419
liquid_range = 1,
416420
liquid_viscosity = 0,
417421
liquid_alternative_flowing = "testnodes:liquid_flowing_waving",
@@ -424,27 +428,24 @@ minetest.register_node("testnodes:liquid_flowing_waving", {
424428
paramtype = "light",
425429
paramtype2 = "flowingliquid",
426430
tiles = {
427-
"testnodes_liquidflowing.png^[brighten",
431+
"testnodes_liquidflowing.png^[colorize:#0000FF:127",
428432
},
429433
special_tiles = {
430-
{name="testnodes_liquidflowing.png^[brighten", backface_culling=false},
431-
{name="testnodes_liquidflowing.png^[brighten", backface_culling=false},
434+
{name="testnodes_liquidflowing.png^[colorize:#0000FF:127", backface_culling=false},
435+
{name="testnodes_liquidflowing.png^[colorize:#0000FF:127", backface_culling=false},
432436
},
433437
use_texture_alpha = true,
434438
waving = 3,
435439

436440

437441
walkable = false,
438-
liquidtype = "flowing",
439442
liquid_range = 1,
440443
liquid_viscosity = 0,
441444
liquid_alternative_flowing = "testnodes:liquid_flowing_waving",
442445
liquid_alternative_source = "testnodes:liquid_waving",
443446
groups = { dig_immediate = 3 },
444447
})
445448

446-
447-
448449
-- Invisible node
449450
minetest.register_node("testnodes:airlike", {
450451
description = S("Airlike Drawtype Test Node"),

games/devtest/mods/testnodes/liquids.lua

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@ for d=0, 8 do
1212
alpha = 192,
1313
paramtype = "light",
1414
walkable = false,
15-
pointable = false,
16-
diggable = false,
1715
buildable_to = true,
1816
is_ground_content = false,
1917
liquidtype = "source",
@@ -34,8 +32,6 @@ for d=0, 8 do
3432
paramtype = "light",
3533
paramtype2 = "flowingliquid",
3634
walkable = false,
37-
pointable = false,
38-
diggable = false,
3935
buildable_to = true,
4036
is_ground_content = false,
4137
liquidtype = "flowing",
@@ -56,8 +52,6 @@ for d=0, 8 do
5652
alpha = 192,
5753
paramtype = "light",
5854
walkable = false,
59-
pointable = false,
60-
diggable = false,
6155
buildable_to = true,
6256
is_ground_content = false,
6357
liquidtype = "source",
@@ -78,8 +72,6 @@ for d=0, 8 do
7872
paramtype = "light",
7973
paramtype2 = "flowingliquid",
8074
walkable = false,
81-
pointable = false,
82-
diggable = false,
8375
buildable_to = true,
8476
is_ground_content = false,
8577
liquidtype = "flowing",

games/devtest/mods/testnodes/properties.lua

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,6 @@ minetest.register_node("testnodes:liquid_nojump", {
118118
paramtype = "light",
119119
pointable = false,
120120
liquids_pointable = true,
121-
diggable = false,
122121
buildable_to = true,
123122
is_ground_content = false,
124123
post_effect_color = {a = 70, r = 255, g = 0, b = 200},
@@ -148,7 +147,6 @@ minetest.register_node("testnodes:liquidflowing_nojump", {
148147
paramtype2 = "flowingliquid",
149148
pointable = false,
150149
liquids_pointable = true,
151-
diggable = false,
152150
buildable_to = true,
153151
is_ground_content = false,
154152
post_effect_color = {a = 70, r = 255, g = 0, b = 200},

src/client/content_mapblock.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -513,10 +513,10 @@ f32 MapblockMeshGenerator::getCornerLevel(int i, int k)
513513
count++;
514514
} else if (content == CONTENT_AIR) {
515515
air_count++;
516-
if (air_count >= 2)
517-
return -0.5 * BS + 0.2;
518516
}
519517
}
518+
if (air_count >= 2)
519+
return -0.5 * BS + 0.2;
520520
if (count > 0)
521521
return sum / count;
522522
return 0;

src/nodedef.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -788,14 +788,12 @@ void ContentFeatures::updateTextures(ITextureSource *tsrc, IShaderSource *shdsrc
788788
solidness = 0;
789789
break;
790790
case NDT_LIQUID:
791-
assert(liquid_type == LIQUID_SOURCE);
792791
if (tsettings.opaque_water)
793792
alpha = 255;
794793
solidness = 1;
795794
is_liquid = true;
796795
break;
797796
case NDT_FLOWINGLIQUID:
798-
assert(liquid_type == LIQUID_FLOWING);
799797
solidness = 0;
800798
if (tsettings.opaque_water)
801799
alpha = 255;
@@ -1596,7 +1594,7 @@ static void removeDupes(std::vector<content_t> &list)
15961594
void NodeDefManager::resolveCrossrefs()
15971595
{
15981596
for (ContentFeatures &f : m_content_features) {
1599-
if (f.liquid_type != LIQUID_NONE) {
1597+
if (f.liquid_type != LIQUID_NONE || f.drawtype == NDT_LIQUID || f.drawtype == NDT_FLOWINGLIQUID) {
16001598
f.liquid_alternative_flowing_id = getId(f.liquid_alternative_flowing);
16011599
f.liquid_alternative_source_id = getId(f.liquid_alternative_source);
16021600
continue;

0 commit comments

Comments
 (0)