Commit Graph

100 Commits

Author SHA1 Message Date
Loïc Blot
9a17b65f26 VoxelManip cleanups (const ref, const move) + function removal (#6169)
* VoxelManip cleanups (const ref, const move) permitting to improve a little bit performance

* VoxelArea: precalculate extent (performance enhancement)

This permits to reduce extend high cost to zero and drop many v3s16 object creation/removal to calculate extent
It rebalance the client thread update to updateFastFaceRow instead of MapBlockMesh generation
This will also benefits to mapgen
2017-07-26 07:35:09 +02:00
paramat
8299e4b67e Biomes/decorations/ores: Make relative to 'water_level' setting
Add 'biome_zero_level' argument to 'generateBiomes()', 'deco_zero_level'
argument to 'placeAllDecos()' and 'ore_zero_level' to 'placeAllOres()'
to allow mapgens to vertically shift the registered biomes, decorations
and ores per-mapchunk.
Will also allow many realm possibilities in future mapgens.
2017-07-11 01:14:24 +01:00
Paramat
2e53801fc0 Mapgen: Remove unnecessary 'this->' from constructors (#6069) 2017-06-30 15:32:35 +02:00
Loïc Blot
8f7785771b Cpp11 initializers 2 (#5999)
* C++11 patchset 10: continue cleanup on constructors

* Drop obsolete bool MainMenuData::enable_public (setting is called with cURL in server loop)

* More classes cleanup

* More classes cleanup + change NULL tests to boolean tests
2017-06-17 19:11:28 +02:00
paramat
212945c7a3 Mgv6 mudflow: Also check for 'ignore' nodes
Previously, when removing decorations we searched upwards and removed until we
found air or water. However, the node above the decoration can be 'ignore' if
a stacked decoration extends into the volume above the mapchunk. The result
could be a problematic column of air placed in the volume of 'ignore'. The
unnecessary placing of air also slows the function.

Add a check for 'ignore' nodes when removing decorations.
2017-06-16 02:17:25 +01:00
paramat
f55816f93a Mgv6 mudflow: Avoid partially removed stacked decorations
Recently we started to remove decorations if the dirt below was flowed away,
but this did not check for stacked decorations, causing them to have only
their lowest node removed.
Also, placed mud could partially bury stacked decorations.

Remove 'old_is_water' bool which on testing is never true.
Add new function 'moveMud()' to reduce indentation.
Remove stacked decoration nodes above a removed decoration.
Remove stacked decorations partially buried in placed mud.
2017-06-15 00:38:08 +01:00
Casimir
0e58168fe5 Mapgen v6: Use snow blocks in tundra and remove them from taiga (#5827)
* Mapgen v6: Use snow blocks in tundra and remove them from taiga

* Use snowblocks in tundra above dirt with snow
2017-06-04 09:37:30 +02:00
paramat
210a339dce Mapgen files: Update and correct copyright credits 2017-05-26 20:46:03 +01:00
Paramat
5b338638e0 Mgv6 mudflow: Remove decoration if 'dirt with grass' below flows away (#5798)
Mudflow of a neighbouring mapchunk extends into a mapchunk's edge, and could
remove 'dirt with grass' from under a decoration, creating unsupported
decorations.

Remove any decoration above if a 'dirt with grass' node is removed by mudflow.
2017-05-25 12:46:34 +02:00
paramat
a901a56859 Dungeongen: Add and improve parameters
Add:
Bool for 'only_in_ground'.
Min and max corridor length.
Min and max room size with X, Y, Z components.
Min and max large room size with X, Y, Z components.

'only_in_ground = false' allows core mapgens to create structures
in air and water using dungeongen.
Corridor length parameters replace a fixed random range.
Room size parameters replace the former system where one parameter
'roomsize' was added to fixed random ranges.

All parameters are set for no change to current dungeon behaviour.

Remove some now-redundant and long-unused code.
2017-02-26 06:46:14 +00:00
paramat
047168ca83 Mgv6: Add fallback node for gravel
Gravel now falls back to stone.
Gravel is not a particularly fundamental node, allowing it to fall back
to stone frees up subgames from having to include a gravel node.
Non-blob-ore gravel is only present in mgv6 as extremely rare 'gravel
biomes'.
2017-02-04 07:21:23 +00:00
paramat
8e4c11406e Mgv6: Add stairs to desert stone dungeons
As with the other mapgens, now that wide stairs in dungeons are
possible we can now finally add stairs to desert stone dungeons.
Re-order some lines.
2017-02-04 07:21:23 +00:00
paramat
ea12da939f Mapgen: Remove unused 'flat' and 'trees' flags from mg_flags
When the 'flat' and 'trees' flags were moved into mgv6_spflags they
were left in mg_flags in an attempt to support old mgv6 worlds. However
their appearence in mg_flags causes confusion, also, later, old-world
support was found to be broken for mgv6 worlds with 'notrees'.

This commit cleans up the mess and comes a month after a thread warning
of the change, and explaining the required action, was posted in the
news subforum. Only old mgv6 worlds with 'flat' or 'notrees' are
affected, a small minority of worlds, the required action being
correctly setting these flags in mgv6_spflags.

Disable a section of the 'map settings manager' unit test which is to
be changed as it is causing problems for pull requests.
2016-08-04 06:58:42 +01:00
kwolekr
3c63c3044d Add MapSettingsManager and new mapgen setting script API functions
This commit refactors the majority of the Mapgen settings system.
- MapgenParams is now owned by MapSettingsManager, itself a part of ServerMap,
  instead of the EmergeManager.
- New Script API functions added:
    core.get_mapgen_setting
    core.get_mapgen_setting_noiseparams,
    core.set_mapgen_setting, and
    core.set_mapgen_setting_noiseparams.
- minetest.get/set_mapgen_params are deprecated by the above new functions.
- It is now possible to view and modify any arbitrary mapgen setting from a mod,
  rather than the base MapgenParams structure.
- MapgenSpecificParams has been removed.
2016-07-03 15:38:36 -04:00
paramat
04fb10914c Dungeons: Generalise use, add capabilities, various modifications
- Generalise node names to c_wall and c_alt_wall
- Remove 'mossratio' and instead disable alt_wall loop if
  c_alt_wall == CONTENT_IGNORE
- Use one generalised 3D noise for alternative wall nodes and in
  mgv6 create moss distribution similar to the previous

- Rename rarity noise to density noise and enable the option of multiple
  dungeons per chunk determined by the value. Recreate previous distribution
- Add parameters for min and max rooms per dungeon
- Add dungeon y limits

- Integrate river water properly

Generalisation is needed now that we have sandstone and desert stone
dungeons by default and can choose any node for alternative structure.
The current code is based around cobble dungeons with mossycobble
alternative nodes, the 2 noises controlling the alternative nodes
are based on wetness.

Enabling multiple dungeons per chunk with definable number of rooms
allows the option of very dense and complex underground structures
that could interconnect to create megastructures.
Y limits are added to be consistent with other mapgen elements, and
enable locaton of dungeon or megastructure realms as part of our
'stacked realms' philosophy.
2016-06-17 04:42:42 +01:00
kwolekr
c8fd232678 Dungeongen: Remove dependency on Mapgen 2016-05-27 23:23:58 -04:00
kwolekr
a605d69092 Cavegen: Remove CavesV6 dependency on Mapgen 2016-05-27 23:23:58 -04:00
kwolekr
bf25837617 Cavegen: Rename CaveV6 to CavesV6
- Add comment explaining why it exists
- Remove unused 'flooded' variable
- Rename shadowed variable
- Fix some code style
2016-05-27 23:23:58 -04:00
kwolekr
ebe638c32d Mapgen V6: Synchronize spflags with defaultsettings
This fixes an issue where trees are omitted from Mapgen V6 maps on
configurations that explicitly defined the mgv6_spflags setting.
2016-05-10 22:44:18 -04:00
paramat
4adbd69a37 FindSpawnPos: Let mapgens decide what spawn altitude is suitable
To avoid spawn search failing in new specialised mapgens
Increase spawn search range to 4000 nodes
Add getSpawnLevelAtPoint() functions to EmergeManager, class Mapgen
and all mapgens
Remove getGroundLevelAtPoint() functions from all mapgens except mgv6
(possibly to be re-added later in the correct form to return actual
ground level)
Make mgvalleys flag names consistent with other mapgens
Remove now unused 'vertical spawn range' setting
2016-02-09 07:14:45 +00:00
paramat
8fc8cb819b Mapgen: Various fixes and improvements
Lua_api.txt: Document 'minetest.registered_biomes'
Minimal: Remove 'mapgen_air' alias
Cavegen: Add fallback node for 'mapgen_ice'
Dungeongen: Add fallback node for 'mapgen_river_water_source'
Mgv5: Remove unnecessary '#include util/directiontables.h'
Add missing 'this->'s in makeChunk()
Mgv6: Edit empty line formatting
Remove leading spaces in makeChunk()
Add missing spaces after 'for' and 'if'
Mgv7: Edit empty line formatting
2016-01-11 01:32:20 +00:00
paramat
49073ba2c3 Mapgen: Add propagate_shadow bool to calcLighting
To terminate unwanted shadows from floatlands or realms above
Also add to LuaVoxelManip calc_lighting for use in mapgen mods
Remove the 2 argument calcLighting, mapgens now use the 5
argument form to specify the volumes for propagateSunlight and
spreadLight
In mgsinglenode replace calcLighting with setLighting and
clean-up use of tabs and spaces
2015-12-07 03:18:24 +00:00
paramat
d7bbe81726 Mapgen: Add global 'decorations' flag
Flag is set by default in MapgenParams
The global 'trees' flag remains but is now
undocumented and unset by default in MapgenParams
Add mgv6_spflag 'trees' set by default in
defaultsettings.cpp to affect new worlds only
This is automatically backwards
compatible for existing worlds
2015-11-21 00:10:08 +00:00
paramat
4434498367 Mgv6: Move global mapgen flag 'flat' into mgv6 spflags
Add mgv6 spflag 'flat'
Global flag is kept for backwards compatibility but is now undocumented
2015-11-13 04:25:08 +00:00
paramat
7504cdcfbf Mapgen: Use mapgen-specific names for constants in headers
Update copyright years in all mapgens
Add myself to copyright notices in mgv5 and mgv7
2015-10-09 05:51:47 +01:00
kwolekr
f0cd5da687 Define and use limit constants for Irrlicht fixed-width types 2015-10-04 04:00:16 -04:00
est31
452df1c723 Various style cleanups + unused code removal
-> Don't pass pointer to whole IGameDef to NodeMetadata constructors
	and deserializers, but only to IItemDefManager, which is needed
-> Remove the unused content_mapnode_get_new_name() method
-> Fix style for MapBlock::deSerialize and MapBlock::deSerialize_pre22,
	improving accuracy of error messages a bit
-> Fix style at other serialisation methods too
-> Improve accuracy of some comments
2015-09-19 20:57:29 +02:00
paramat
fe994946b7 Mgv5/6/7: Re-add #include profiler.h as commented-out option 2015-09-19 02:27:21 +01:00
rubenwardy
ec796b8e81 Add map limit config option 2015-08-02 14:27:04 +02:00
Loic Blot
fa7fe510d9 Remove profiler.h include where it's not needed. Remove some unreachable and very old code 2015-07-21 08:10:43 +02:00
paramat
66ea356e68 Mgv6/treegen: (Re)Add fallback nodes for compatibility with subgames 2015-07-13 19:41:26 +01:00
paramat
2da1503780 Mgv6: Don't create air gap in tundra at y = 48 in custom high terrain 2015-06-18 04:18:15 +01:00
paramat
f16ebbfecf Mgv6: Enable snowbiomes by default. Double biome noise spread. 3 octaves, 0.5 persistence for humidity 2015-05-26 02:08:06 +01:00
paramat
02805af36e Mapgen v5/6/7: Cleanup node resolver and aliases 2015-05-12 04:40:53 +01:00
paramat
a5f942c3c0 Mgv6: Fix taiga, allow pine tree spawning on snowblocks 2015-04-12 05:52:41 +01:00
paramat
75cbd80e5b Mgv6: Add optional snow biomes 2015-04-12 04:27:26 +01:00
Craig Robbins
9527984dbc Move globals from main.cpp to more sane locations
Move debug streams to log.cpp|h

Move GUI-related globals to clientlauncher

Move g_settings and g_settings_path to settings.cpp|h

Move g_menuclouds to clouds.cpp|h

Move g_profiler to profiler.cpp|h
2015-04-01 23:04:25 +10:00
paramat
37a6297025 Mgv6: Use heightmap in placeTreesAndJungleGrass() 2015-03-23 21:55:01 +00:00
paramat
22730bbc0c Mgv6: Remove addDirtGravelBlobs, replaced by blob ore in Minetest Game
Desert stone above y = -32 not water_level
Remove unused generateExperimental()
2015-03-18 10:55:58 +00:00
paramat
29e46d6b29 Mgv6: Fix uninitialised heightmap used by cavegen 2015-03-11 06:04:07 +00:00
Craig Robbins
d4e210ee95 Ensure that heightmap is initialized before use
Without this, cavegen will use values in the heightmap before they are initialized.
2015-03-10 18:46:28 +10:00
paramat
d463000595 Heightmaps: Fix uninitialised values in mgv5/mgv6. findGroundLevel: Return -MAP_GENERATION_LIMIT if surface not found 2015-03-08 03:54:03 +00:00
ngosang
f6e4c5d9cf Respect game mapgen flags and save world noise params 2015-03-07 15:53:39 -05:00
Craig Robbins
ced6d20295 For usages of assert() that are meant to persist in Release builds (when NDEBUG is defined), replace those usages with persistent alternatives 2015-03-07 22:41:47 +10:00
Craig Robbins
daa1c30b35 Fix mapgen using unitialised height map values 2015-03-06 01:42:55 +10:00
Craig Robbins
9e67579315 Fix memory leak in MapgenV6 2015-03-05 15:17:37 +10:00
paramat
773aa8c57b Mgv6: Add heightmap. Do not make large caves that are entirely above ground 2015-03-02 02:13:43 +00:00
kwolekr
38bd9e93a2 Fix all warnings and remove -Wno-unused-but-set cflag 2015-01-18 23:29:19 -05:00
kwolekr
4a57ef12a1 Mapgen V6: Re-enable liquid flowing 2015-01-07 19:27:09 -05:00
kwolekr
7233a1228e Lighting: Fix nearly all issues
The cause of a single light source seemingly being lit without spread
was due to its creation in the +Y mapblock boundary layer during map
generation, which was ignored as the overtop.  This overtop explicitly
needs to be omitted during sunlight propagation, however.  To accomplish
this, Mapgen::calcLighting() was split into separate functions taking
separate parameters.
Additionally, do not diminish light too early during spread.  This fixes the
output inconsistency between Map::updateLighting and Mapgen::calcLighting.
2015-01-04 02:42:31 -05:00