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

Decoration API: Add flag for placement on liquid surface #3274

Closed
wants to merge 1 commit into from
Closed

Decoration API: Add flag for placement on liquid surface #3274

wants to merge 1 commit into from

Conversation

paramat
Copy link
Contributor

@paramat paramat commented Oct 21, 2015

Add findLiquidSurface() function to mapgen.cpp
Update lua_api.txt

screenshot_20151021_130024

Currently a mess is made if water level is changed in mgv5/mgv7. Water lily and papyrus schematics appear at the wrong altitude, the water node placed by the waterlily schematic causes floods. This reminded me to add the long-overdue option of placing decorations on a liquid surface.

The new findLiquidSurface() function searches downwards through a mapchunk column and returns the level of the first liquid node found, if ground is found first the function returns -31000 disabling the decoration placement, this is to prevent decorations being placed under overhangs and in dark places.

Placing waterlilies this way does not allow random rotation, so a follow-up commit could add optional random rotation to simple decorations.

Keeping the waterlilies in shallow water will be another issue but can be solved using biome definitions (making swamp biomes shallower). Anyway it's not absolutely certain we will stop using schematics for waterlilies.

Works for schematic decorations too:

screenshot_20151021_130559

@paramat paramat added enhancement @ Mapgen Maintenance Tasks to keep the codebase and related parts in order, including architectural improvements labels Oct 21, 2015
@paramat
Copy link
Contributor Author

paramat commented Oct 21, 2015

screenshot_20151021_182758

Updated due to decorations being found under overhangs.

The new findLiquidSurface() function searches downwards through a mapchunk column and returns the level of the first liquid node found, if ground is found first the function returns -31000 disabling the decoration placement, this is to prevent decorations being placed under overhangs and in dark places, see screenshot of test above.

Add findLiquidSurface() function to mapgen.cpp
Update lua_api.txt
@paramat
Copy link
Contributor Author

paramat commented Oct 23, 2015

@paramat paramat closed this Oct 23, 2015
@paramat paramat deleted the waterdeco branch October 25, 2015 23:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Maintenance Tasks to keep the codebase and related parts in order, including architectural improvements @ Mapgen
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant