Commit Graph

28 Commits

Author SHA1 Message Date
sfan5 2da1eee394
Fix broken `BiomeGen` abstraction (#11107) 2021-03-23 15:43:26 +01:00
Lars f1d72d212a Avoid generating the same chunk more than once with multiple emerge threads. 2020-11-26 20:31:20 -08:00
Paramat 4ba5046308
Add 'ores' global mapgen flag (#10276) 2020-09-03 01:28:40 +01:00
sfan5 3c65d1acec Give the Mapgen on each EmergeThread its own Biome/Ore/Deco/SchemManager copy 2020-05-05 19:26:59 +02:00
LNJ 307d7376cf
Fix 'the the' typos in comments (#9554) 2020-04-04 15:52:41 +02:00
SmallJoker cde2a7f6f2
Settings: Add get_flags API for mapgen flags (mg_flags, mgv6_spflags, ...) (#9284)
Unified flags handling in C++ and Lua Settings API
     -> Reading only, for now. Writing can be implemented later, if needed.
API function to read the currently active flags
     -> was impossible from Lua

Co-authored-by: Wuzzy <wuzzy2@mail.ru>
2020-01-25 16:56:54 +01:00
paramat ec5f591014 Dungeons: Move duplicated y limit checks to generation function 2019-11-23 01:41:27 +00:00
Paramat 97764600e2
Randomwalk cave liquids: Remove deprecated 'lava depth' parameter (#9105)
Low-disruption first step towards removing the hardcoded cave liquid
code. Since MT 5.0.0 cave liquids can be defined and located by
biome definitions instead.
In games that do not yet use biome definitions to define and locate
cave liquids (MTGame does), lava will now appear below
y = water_level - 256 instead of below 'lava depth' (usually y = -256).
Therefore no change in most mapgens if using the default 'lava depth'.
2019-11-18 23:40:01 +00:00
Paramat 2a74727857
Randomwalk caves: Add parameters for number, proportion flooded. Allow small caves (#8928)
Add mapgen parameters to set the range of the random number of
randomwalk caves per mapchunk, and to set the proportion that are
flooded with liquids.
Default values are, for now, unchanged from the previous hardcoded
values.

Add parameters to allow small randomwalk caves
Disabled by default for now as they have never been present in the
non-mgv6 mapgens.
2019-11-08 03:09:43 +00:00
Paramat 7379aa74cf
Dungeons: Settable density noise, move number calculation to mapgens (#8473)
Add user-settable noise parameters for dungeon density to each mapgen,
except V6 which hardcodes this noise parameter.

Move the calculation of number of dungeons generated in a mapchunk out
of dungeongen.cpp and into mapgen code, to allow mapgens to generate
any desired number of dungeons in a mapchunk, instead of being forced
to have number of dungeons determined by a density noise.

This is more flexible and allows mapgens to use dungeon generation to
create custom structures, such as occasional mega-dungeons.
2019-06-01 20:50:43 +01:00
Loïc Blot b55fc3d773 mapgen: drop mapgen id from child mapgens.
This id must be owned by the child mapgen and never be set to a misc value by a developer

Also use nullptr in some places
2019-03-31 20:49:39 +02:00
Paramat aafbdd442f
Valleys mapgen code rewrite (#8101)
Shorter, simpler, clearer and more consistent with other mapgens,
while preserving functionality.
Base terrain shape is unchanged.
With the 'vary river depth' option disabled, river surface level
is unchanged.
Behaviour of the 4 heat/humidity/river depth options is very
slightly changed due to bugfixes and code cleanup (the mapgen is
'unstable').
Apply heat and humidity gradients above water_level instead of
above y = 0.
2019-03-14 00:27:16 +00:00
Treer 84a5fa01ff Fix Mapgen Valleys getSpawnLevelAtPoint() (#7756) 2018-10-03 00:50:21 +01:00
Paramat 8516f28458
Change mapgen order to ores > dungeons > decorations (#7656)
Previously dungeons > decorations > ores.
Decorations depend on the node they are placed on, and ore types are
increasingly able to place large continuous volumes of nodes, such as
strata. Decorations are increasingly being used underground.

The new order avoids a node being changed by ore generation after a
decoration has been placed on it.
The new order also avoids ores appearing in the walls of a dungeon if
the wall nodes match the local stone node.
2018-08-20 18:24:53 +01:00
Paramat bc9bb63aed
Mgvalleys: Make river depth variation and humidity drop optional (#7532)
Add 2 new mapgen flags to make river depth variation and humidity drop
with altitude independently optional, instead of both being enabled by
the 'humid rivers' flag.

Simplify and clarify related code by removing a low priority
optimisation regarding 't_heat'.
Remove unnecessary optimisation bools and use spflags directly instead.
Improve and fix documentation in settingtypes.txt.
A few minor code cleanups.
2018-07-18 03:34:05 +01:00
Paramat 0b23253447
Mapgen flags: Add 'biomes' global mapgen flag (#7355)
Previously the only way to disable biomes was to 'clear' the registered
biomes in a mod, but this method causes large amounts of unnecessary
processing:
1. Calculation of 4 2D noises.
2. Looping through all nodes of a mapchunk replacing nodes with identical
nodes.
The new flag disables those operations.
2018-06-08 23:24:36 +01:00
Paramat 54606e103d
Mapgen caves: Re-order generation to fix cavern bug
Previously, caverns confused tunnel generation causing biome top and filler
nodes to appear in caverns.
Split 'generateCaves()' into 2 functions to separate tunnel and large
randomwalk cave generation.
In each mapgen re-order cave generation to generate tunnels before caverns.
2018-04-29 07:20:46 +01:00
Paramat 534971ccd0
Mgvalleys: Code cleanup
Split some long lines.
Edit comments.
Remove unnecessary comments and unnecessary commented-out code.
Use std::fmax/fmin instead of MYMAX/MYMIN.
Remove scope-limiting braces.
Consistently define literals as floats, except in noise parameters.
Cleanup literals in noise parameters.
Remove unnecessary 'near_cavern' line.
Reduce max spawn y to be consistent with other mapgens.
2018-04-24 01:34:48 +01:00
Paramat 12a8f8826d
Mgvalleys: Use shared tunnel / cavern code instead of internal
Caverns first appeared in mgvalleys and were later added to other
mapgens as shared code. Now this shared code can replace mgvalley's
internal cavern code.
Also use shared tunnel code instead of internal code.

Changes to mapgen that will affect existing worlds (mgvalleys is not
stable):

Single lava and water sources not added in tunnels.
Previous caverns are unchanged but an equal number of new ones are
added at a distance from the previous.
From y = -256 to 192 nodes below, where the caverns taper at their
upper limit, they will have a slightly different shape as the taper
is now linear.
2018-04-21 22:50:36 +01:00
Paramat 746ca41f58
Biome API / dungeons: Add biome-defined dungeon nodes
Add new biome fields 'node_dungeon', 'node_dungeon_alt', 'node_dungeon_stair'.
If 'node_dungeon' is not defined dungeons fall back to classic behaviour.

Remove messy and imprecise dungeon material code from 'generateBiomes()'.
Code deciding dungeon materials is now in 'generateDungeons()' and uses the
biome at mapchunk centre for more precision.

Remove hardcoded 'MG_STONE' types as long intended.
2018-04-07 22:09:54 +01:00
Paramat 32d456bd2d
Biome API / cavegen: Add definable cave liquid for a biome (#7192)
Add 'node_cave_liquid' as a new field in biome registration.
If field is absent cave liquids fall back to classic behaviour.
2018-04-05 17:21:41 +01:00
Loïc Blot 67a4cb7d8a Fix various clang-tidy reported performance-type-promotion-in-math-fn 2018-04-03 18:16:17 +02:00
Loïc Blot 2481ea27ce
Fix many issues reported by clang-tidy (#7189)
* Fix many issues reported by clang-tidy

We have many issues in code related to some performance to float <-> double.
Clang-tidy reported it in performance-type-promotion-in-math-fn

I fixed many of them. It's not ready for a promote to blocking

Also fix some value which should be const-ref
2018-04-02 23:51:08 +02:00
Loic Blot 12d1e4ff04 VoxelArea: add_{x,y,z,p} must be static
Fix some documentations issues
Use getNodeNoCheck(v3s16, ...) in some cases instead of getNodeNoCheck(x, y, z, ...)
2018-03-09 23:27:26 +01:00
Gael-de-Sailly b952d42000 MapgenValleys: Fixed submarine valleys shape 2018-03-03 22:59:26 +00:00
paramat 2bc7c5ff93 Dungeons: Add Y limits in all mapgens
Preserve the upper limit used in mgvalleys.
2018-02-20 15:25:37 +00:00
paramat 142474196a Mapgen folder: Update and improve copyright information of files 2018-01-15 04:42:08 +00:00
Vitaliy 20a85d76d9 Move files to subdirectories (#6599)
* Move files around
2017-11-08 23:56:20 +01:00