Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unclear how to use paramtype2 = "flowingliquid" #15678

Open
SnoutBug opened this issue Jan 13, 2025 · 4 comments
Open

Unclear how to use paramtype2 = "flowingliquid" #15678

SnoutBug opened this issue Jan 13, 2025 · 4 comments
Labels
Bug Issues that were confirmed to be a bug @ Documentation Improvements or additions to documentation Low priority @ Script API

Comments

@SnoutBug
Copy link

Luanti version

Luanti 5.10.0 Flatpak

Operating system and version

Flatpak

CPU model

No response

GPU model

No response

Active renderer

No response

Summary

In the documentation it says:

  • paramtype2 = "flowingliquid"
    Used by drawtype = "flowingliquid" and liquidtype = "flowing"
    The liquid level and a flag of the liquid are stored in param2
    Bits 0-2: Liquid Level (0-7). The higher, the more liquid is in this node; see core.get_node_level, core.set_node_level and core.add_node_level to access/manipulate the content of this field

Though, following these instructions, I was not able to change the liquid level of the node.

Steps to reproduce

local flowing = core.registered_nodes["default:water_flowing"]

core.register_node("test_water:test",  {
    	name        = "test_water:test",
        description = "Test Water",
	paramtype2  = "flowingliquid",
	
	drawtype   = "flowingliquid", -- Used by drawtype = "flowingliquid"
	liquidtype = "source",        -- Flowing not needed here since condition is already met?
	
	tiles 		  = flowing.tiles,		-- As needed by drawtype - copy from water
	special_tiles     = flowing.special_tiles,
	use_texture_alpha = flowing.use_texture_alpha, 
	
	liquid_renewable = false,			-- Disallow any kind of spreading
	liquid_range     = 0,
	
	buildable_to = true,				-- For removing

        liquid_alternative_flowing = "test_water:test",	-- As requested in documentation

})

core.register_abm {
        nodenames = "test_water:test",
        neighbors = "air",
        interval  = 0.2,
        chance    = 0,
        action = function(pos, node, active_object_count, active_object_count_wider)
            core.set_node_level(pos, math.random(1,7)) -- This should make the liquid "dance"
        end,
}
@SnoutBug SnoutBug added the Unconfirmed bug Bug report that has not been confirmed to exist/be reproducible label Jan 13, 2025
@cx384
Copy link
Contributor

cx384 commented Jan 13, 2025

The documentation:

Used by drawtype = "flowingliquid" and liquidtype = "flowing"

What you use:

drawtype   = "flowingliquid",
liquidtype = "source",  

Difference: "source "~= "flowing"

Maybe the documentation could be improved to clearly indicate that the "and" means both?

Edit:
It happens here:
https://github.com/minetest/minetest/blob/2bfcd45b35d9e64cbbe54827c4d58d3b5082299a/src/mapnode.cpp#L477-L480

So it does only not work for liquidtype = "source"

@cx384 cx384 added Bug Issues that were confirmed to be a bug @ Script API and removed Unconfirmed bug Bug report that has not been confirmed to exist/be reproducible labels Jan 13, 2025
@SnoutBug
Copy link
Author

SnoutBug commented Jan 13, 2025

I see, that makes sense. Reading the comments I am guessing that this is supposed to change in the future?

Edit: is there a possible workaround you can imagine, so that I can use the smooth leveling of flowing liquids for any arbitrary node?

@sfan5 sfan5 added @ Documentation Improvements or additions to documentation Low priority labels Jan 13, 2025
@cx384
Copy link
Contributor

cx384 commented Jan 13, 2025

is there a possible workaround you can imagine, so that I can use the smooth leveling of flowing liquids for any arbitrary node?

Removing liquidtype = "source", or setting liquidtype = "none", should work. It is possible since #10737.
But note that the level appearance still depends on the adjacent nodes and liquid_range, so your liquid_range = 0, may not work well, and you have to place multiple flowing liquids next to each other, I think.

@SnoutBug
Copy link
Author

SnoutBug commented Jan 14, 2025

That works quite well. Thanks.

Though there are some remaining issues:

  1. The one you mentioned: the level is still dependent on liquid_range. I think this causes the liquid level to appear lower than it actually should be.
  2. Error message for liquids with liquid_range of 0 #12593 when not setting liquid_alternative_source. Setting this parameter (in the example above to test_water:test) seems to disable the leveling - or at least permanently fixing it at the maximum height which could also be caused by 1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Issues that were confirmed to be a bug @ Documentation Improvements or additions to documentation Low priority @ Script API
Projects
None yet
Development

No branches or pull requests

3 participants