feat(block): add lava as a fluid and its contact with water - #152
Open
xRookieFight wants to merge 2 commits into
Open
feat(block): add lava as a fluid and its contact with water#152xRookieFight wants to merge 2 commits into
xRookieFight wants to merge 2 commits into
Conversation
xRookieFight
force-pushed
the
feat/lava
branch
from
September 3, 2026 10:38
01f9ed4 to
713b3b6
Compare
xRookieFight
force-pushed
the
feat/lava
branch
from
September 3, 2026 11:14
713b3b6 to
10d7bcf
Compare
nepinhum
requested changes
Sep 3, 2026
| // mix_into resolves one fluid arriving where the other already is. Lava | ||
| // arriving in water sets into stone; water arriving in lava makes obsidian of | ||
| // a source and cobblestone of anything flowing. | ||
| fn (mut m LiquidManager) mix_into(arriving LiquidState, existing LiquidState, x int, y int, z int) { |
Member
There was a problem hiding this comment.
lava -> stone branch is unreachable and its test hides that
| } | ||
|
|
||
| // place_lava does the same for a lava source. | ||
| fn (mut h Hub) place_lava(x int, y int, z int) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
The liquid engine only knew about water. Lava existed as a block constant nobody flowed, and the code that cared about standing in it only ever matched the still source id.
WaterStateis nowLiquidState, carrying which fluid the cell holds. The spread engine is unchanged in shape; what differs per fluid is how far it reaches (decay 1 for water, 2 for lava, so overworld lava stops three cells out), how fast it moves (lava steps once every six liquid ticks), and that only water forms a new source between two of them.liquid_statesis built once and shared, so gameplay code asksis_lava_id/is_water_idinstead of comparing against the still source id. Lava damage, drowning, mining-underwater and the "is this safe to stand on" spawn check all now see flowing cells too - previously a player standing in flowing lava took nothing.place_lavamirrorsplace_waterthrough the same per-world task.The existing water tests are unchanged apart from the renames, so the water behaviour they pin is provably the same.
Related issue
Fixes #124
Checklist
v -check .is cleanv test server/block,server/session/blocks_test.v,break_animation_test.vare greenpub/capitalized exports, no import cycles, minimal comments)world_call/wr.submit/WorldTx), never through a global Hub actorBuckets are untouched: there is no in-game placement path for water either yet, so lava follows the same API-only route until there is one.