Commit Graph

212 Commits

Author SHA1 Message Date
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
Loïc Blot
ab128e03ff C++11 patchset 6: forbid object copy using assigment/copy function deleters (#5945)
C++11 implement function deleting, it's generally used to prevent some object copy
In script API use this function removal on ScriptApiBase instead of ScriptApiClient/Server/MainMenu, this affect all ScriptApis
Move DISABLE_CLASS_COPY with constructor, the deleted function permit to replace function in its original place
2017-06-10 13:49:15 +02:00
Loïc Blot
a98baef5e4 C++11 patchset 2: remove util/cpp11.h and util/cpp11_container.h (#5821) 2017-06-04 21:00:04 +02:00
Loïc Blot
c6d5441105 Properly remove SAO when worldedges are overtaken (#5889)
* LuaEntitySAO: Remove beyond outermost mapchunk edges

Based on a commit by, and with help from, nerzhul.
Add 2 functions to class Mapgen:
A function to calculate actual mapgen edges, called from the Mapgen constructor.
A function called indirectly from content_sao.cpp per entity step to check SAO
position is within mapgen edges.

* Calculate borders from params not mapgen, which is not available everytime
2017-06-03 19:57:02 +02:00
SmallJoker
d99b6fed55 Time: Change old u32 timestamps to 64-bit (#5818)
MacOSX build fix + cleanups
2017-05-26 14:03:36 +02:00
Loïc Blot
29ab20c272 Player data to Database (#5475)
* Player data to Database

Add player data into databases (SQLite3 & PG only)

PostgreSQL & SQLite: better POO Design for databases

Add --migrate-players argument to server + deprecation warning

* Remove players directory if empty
2017-04-23 14:35:08 +02:00
Auke Kok
cca58fe0fd Add on_flood() callback.
This callback is called if a liquid definitely floods a non-air
node on the map. The callback arguments are (pos, oldnode, newnode)
and can return a `bool` value indicating whether flooding the
node should be cancelled (`return true` will prevent the node
from flooding).

Documentation is added, the callback function was tested with a
modified minetest_game.

Note that `return true` will likely cause the node's `on_flood()`
callback to be called every second until the node gets removed,
so care must be taken to prevent many callbacks from using this
return value. The current default liquid update interval is 1.0
seconds, which isn't unmanageable.

The larger aim of this patch is to remove the lava cooling ABM,
which is a significant cost to idle servers that have lava on their
map. This callback will be much more efficient.
2017-04-22 01:23:51 +01:00
Dániel Juhász
57e5aa6628 Light update for map blocks
This is not really different from the light update of a voxel
manipulator. This update does not assume that the lighting was correct
before, therefore it is useful for correction.

Also expose this function to the Lua API for light correction, and
allow voxel manipulators not to update the light.
2017-04-20 05:39:14 +02:00
Loïc Blot
f98bbe193e Fix various copy instead of const ref reported by cppcheck (part 3) (#5616)
* Also remove 2 non declared but defined functions
* Make some functions around const ref changes const
2017-04-20 00:12:52 +02:00
Loïc Blot
cf37a55690 Fix various variables passed by copy instead of const ref (#5610)
Pointed by cppcheck
2017-04-19 00:36:30 +02:00
paramat
ec0c4d33db Map generation limit: Make per-world
The setting limits map generation but affects nothing else.
Add 'mapgen_limit' to global mapgen parameters.
Move 'blockpos_over_mapgen_limit()' to the only place it is called
from: map.cpp.
Allow teleportation to any part of the world even if over the set
mapgen limit.
Simplify the reading of this limit in mgvalleys.
Remove the 'map_generation_limit' setting.
2017-03-27 03:18:09 +01:00
Lars Hofhansl
ba4b704ebf Allow server side occlusion culling. 2017-03-11 18:11:19 -08:00
Dániel Juhász
ab371cc934 Light calculation: New bulk node lighting code
This commit introduces a new bulk node lighting algorithm to minimize
lighting bugs during l-system tree generation, schematic placement and
non-mapgen-object lua voxelmanip light calculation.

If the block above the changed area is not loaded, it gets loaded to avoid
lighting bugs.
Light is updated as soon as write_to_map is called on a voxel manipulator,
therefore update_map does nothing.
2017-03-11 02:06:18 +00:00
Dániel Juhász
3f8261830e Improve getPointedThing() (#4346)
* Improved getPointedThing()

The new algorithm checks every node exactly once.
Now the point and normal vector of the collision is also returned in the
PointedThing (currently they are not used outside of the function).
Now the CNodeDefManager keeps the union of all possible nodeboxes, so
the raycast won't miss any nodes. Also if there are only small
nodeboxes, getPointedThing() is exceptionally fast.
Also adds unit test for VoxelLineIterator.

* Cleanup, code move

This commit moves getPointedThing() and
Client::getSelectedActiveObject() to ClientEnvironment.
The map nodes now can decide which neighbors they are connecting to
(MapNode::getNeighbors()).
2017-01-04 19:18:40 +01:00
Dániel Juhász
c071efaa43 Improved lighting
This commit rewrites the procedure that is responsible for light
updating.

this commit
-provides iterative solutions for unlighting and light spreading
-introduces a new priority queue-like container for the iteration
-creates per-node MapBlock caching to reduce retrieving MapBlocks from
the map
-calculates with map block positions and in-block relative node
coordinates
-skips light updating if it is not necessary since the node's new light
will be the same as its old light was
2016-10-27 08:04:42 +02:00
Loic Blot
155288ee98 use unordered containers where possible (patch 4 on X)
Also remove some unused parameters/functions
2016-10-06 22:37:26 +02: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
Ekdohibs
559dd99469 Make node timers more efficient 2016-06-11 23:35:17 +01:00
kwolekr
c56d7fe0eb Add DISABLE_CLASS_COPY macro (and use it)
Use this macro to disallow copying of an object using the assignment
operator or copy constructor.  This catches otherwise silent-but-deadly
mistakes such as "ServerMap map = env->getMap();" at compile time.

If so desired, it is still possible to copy a class, but it now requires
an explicit call to memcpy or std::copy.
2015-10-27 22:05:08 -04:00
kwolekr
0850d3bb93 Add emerge completion callback mechanism
Major refactor of emerge.cpp and Map::init/finishBlockMake
2015-10-04 16:27:50 -04:00
est31
a8e238ed06 Add count based unload limit for mapblocks 2015-08-13 07:56:07 +02:00
kwolekr
b785577f03 Add core.find_nodes_with_meta() script API 2015-05-05 16:21:59 -04: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
ShadowNinja
e9eda2b0d0 Don't start a server for map migration 2015-03-06 00:20:45 -05:00
ShadowNinja
708337dfc2 Clean up database API and save the local map on an interval 2015-03-06 00:20:45 -05:00
Loic Blot
06f328207f ABMHandler and player_collisions use sequential read/write. Switch from std::list to std::vector
* Also remove dead code Map::unloadUnusedData which is dead since a long time
2015-03-04 17:02:36 +01:00
Loic Blot
3c91ad8fc2 Replace std::list by std::vector into timerUpdate calls 2015-02-17 15:08:37 +01:00
Loic Blot
718bcafd51 Replace std::list by std::vector into ServerMap::listAllLoadableBlocks ServerMap::listAllLoadedBlocks and their database backends.
This adds a speedup on database migration and /clearobjects command
2015-02-17 14:35:44 +01:00
Craig Robbins
805c8e51e5 Create empty default constructor for MapNode 2015-01-18 13:39:50 +10:00
kwolekr
9736548720 Add ability to delete MapBlocks from map
Also add a Lua API and chatcommand for this
2015-01-15 16:48:56 -05:00
kwolekr
2d849b0a19 Shorten ManualMapVoxelManipulator to MMVManip 2015-01-05 02:42:27 -05:00
kwolekr
cc3ab5efa5 LuaVoxelManip: Remove blank allocator 2014-12-29 01:31:37 -05:00
kwolekr
8334100fe1 LuaVoxelManip: Add option to allocate blank data 2014-12-27 23:09:36 -05:00
Craig Robbins
082256a9f8 Do not allow the m_transforming_liquid queue to increase until all RAM is consumed 2014-12-18 03:32:19 +10:00
ShadowNinja
b1965ac209 Clean up rollback 2014-11-19 16:21:59 -05:00
Craig Robbins
5b8855e83c Remove most exceptions from getNode() (and variants) 2014-11-14 18:05:34 +10:00
kwolekr
9e4e7072da Update Mapgen VoxelManipulator on buffer invalidation 2014-09-01 15:12:22 -04:00
sfan5
eec456be63 Move MapBlock (de)serializing code out of Database class 2014-07-12 17:38:17 +02:00
kwolekr
a2e1b0fc7f Don't copy back already generated blocks on map generation 2014-07-07 01:51:04 -04:00
kwolekr
8b3ed78e53 Don't unload blocks if save failed
Improve error handling in saveBlock()
2014-07-07 01:20:25 -04:00
sapier
b3a2ef1a91 Remove MapVoxelManipulator not really used by anyone 2014-06-23 00:13:41 +02:00
sapier
9d57413af0 Minor stability improvements in block emerge handling 2014-06-15 18:18:57 +02:00
proller
0279f32db7 Remove liquid_finite and weather 2014-04-18 21:56:48 +04:00
kwolekr
89f7dc1efd ServerEnvironment: Remove direct dependency on EmergeManager 2014-02-09 16:36:30 -05:00
kwolekr
5a34f40d80 Huge overhaul of the entire MapgenParams system
MapgenParams is no longer a polymorphic class, eliminating the need for messy and bug-prone reallocations.
Separation between the common and mapgen-specific parameters is now strongly defined.
Mapgen parameters objects are now properly encapsulated within the proper subsystems.
2014-02-03 22:50:14 -05:00
ShadowNinja
0fd5c61c00 Revert "Improve (re)spawn, add cache_block_before_spawn and max_spawn_height settings"
The commit didn't work because the blocks weren't loaded yet.

This reverts commit 22dbbf0a6fc9547f0dbdb7f6076337b8c6acd48b.

Conflicts:
	minetest.conf.example
2014-01-06 21:25:10 -05:00
kwolekr
7a4c1e7327 Update mapgen params in ServerMap after Mapgen init 2013-12-14 10:49:20 -05:00
sweetbomber
22dbbf0a6f Improve (re)spawn, add cache_block_before_spawn and max_spawn_height settings 2013-12-05 16:09:02 -05:00
Novatux
d879a539cd Add minetest.swap_node 2013-11-30 18:37:56 +01:00
MetaDucky
5be786c804 Fixed potential NULL pointer and leak when setting node metadata 2013-11-29 23:35:16 -05:00
kwolekr
e396fb2984 Actually fix weather
The real problem was that MapBlocks were not activated before getting sent to the client
2013-11-17 01:59:04 -05:00
kwolekr
9bccd75e34 Weather: Clean up getHeat/getHumidity somewhat 2013-09-16 23:33:53 -04:00
Kahrl
95e4a93b1b Add license headers and remove useless includes 2013-09-10 16:09:30 +02:00
Ilya Zhuravlev
58841ef12f Add dummy and LevelDB database backends 2013-09-09 22:50:50 +02:00
Kahrl
4e1f50035e Omnicleanup: header cleanup, add ModApiUtil shared between game and mainmenu 2013-08-14 21:03:33 +02:00
kwolekr
c06caa14c3 Decoration: Fix schematic probability mess with new MTS file version 2013-08-11 15:34:49 -04:00
proller
3aedfac968 Weather support 2013-07-27 23:21:48 +04:00
kwolekr
2c0b51795e Fix issue of VManip occasionally not blitting back blocks, and pitch black lighting bug 2013-06-27 22:35:35 -04:00
kwolekr
d6ac3d8d9a Add LuaVoxelManip 2013-06-27 22:35:35 -04:00
Kahrl
e988df0fbd Add and implement setting max_clearobjects_extra_loaded_blocks.
Now Environment::clearAllObjects() unloads unused blocks in an interval
defined by max_clearobjects_extra_loaded_blocks (default 4096).
2013-06-03 20:09:32 +02:00
Mukul Sati
ca7043e52d Set of changes to build mineTest using Visual Studio 11.0. These affect
the following:
1. String concatenation in guiMainMenu.cpp - it is required for all
individual strings to be of the same type <unicode/non-unicode>; adding
explicit L qualifier before the other strings.
2. Correcting type of BlockMakeData to struct in place of class forward
declarations. This information is used for name decoration by Visual
Studio, leading to linker errors in case of mismatches.
3. Windows headers define max as a macro somewhere, leading to a compile
time error in profiler.h; using () around function to prevent macro match
from occurring.
2013-03-24 00:53:10 +04:00
Ilya Zhuravlev
6a1670dbc3 Migrate to STL containers/algorithms. 2013-03-11 19:08:39 -04:00
kwolekr
979ca23f1e Merge pull request #482 from proller/liquid
finite liquid
2013-02-25 20:52:24 -08:00
kwolekr
67c59645ec Misc. cleanup and minor fixes 2013-02-25 23:08:33 -05:00
kwolekr
5ec5b1cbd6 Add multi-Emerge thread support 2013-02-25 23:08:26 -05:00
kwolekr
b9d8e59bbf Add emerge.cpp, initial EmergeThread changes
- Neatly placed all emerge related code into a new file, emerge.cpp
- Greatly cleaned up the code in EmergeThread::Thread()
- Reworked Emerge queue.  Now an actual std::queue of v3s16 block positions
- Removed the completely unnecessary map of peer ids requesting blocks
2013-02-25 22:56:18 -05:00
Sfan5
6d0ea26c2d Update Copyright Years 2013-02-24 20:15:24 +01:00
PilzAdam
497ff1ecd6 Change Minetest-c55 to Minetest 2013-02-24 18:49:03 +01:00
proller
b90e431fc7 new adjustable finite liquid 2013-02-24 18:39:07 +04:00
kwolekr
91e88196c7 Make mapgen factory setup more elegant, add mapgen_v6.h 2013-01-23 16:16:49 -05:00
kwolekr
631a835e07 Finish and clean up mapgen configuration 2013-01-21 21:41:37 +02:00
kwolekr
11afcbff69 The new mapgen, noise functions, et al. 2013-01-21 21:41:33 +02:00
Perttu Ahola
0190f9b077 Experimental-ish rollback functionality 2012-07-27 02:27:18 +03:00
darkrose
cd6becd442 Implement node timers 2012-07-23 08:18:37 +03:00
Perttu Ahola
9f031a6759 Optimize headers 2012-06-17 04:03:39 +03:00
Perttu Ahola
d0ea6f9920 Properly and efficiently use split utility headers 2012-06-17 02:40:36 +03:00
Perttu Ahola
037b259197 Switch the license to be LGPLv2/later, with small parts still remaining as GPLv2/later, by agreement of major contributors 2012-06-05 18:54:07 +03:00
Kahrl
704782c95b WIP node metadata, node timers 2012-06-03 22:31:00 +03:00
Perttu Ahola
a6ca7eb29d Area-based MapEditEvent ignore and that put to use for on_generate too 2012-03-29 01:22:08 +03:00
Perttu Ahola
02c035c548 Reduce EnvRef:set_node() time tenfold by postponing the dayNightDiff update until it is actually needed 2012-03-29 00:28:48 +03:00
Perttu Ahola
58bed83d03 Move ClientMap to clientmap.{h,cpp} 2012-03-16 00:25:18 +02:00
Kahrl
807a0d313b MapBlockMesh, mesh animation system, urgent mesh updates, athmospheric light, removed footprints 2012-03-15 21:45:44 +02:00
Kahrl
157a4cf18c Node placement / mineral / serialization / iron freq / node_dig callback
- Node placement code moved to Lua
- Mineral system removed (added default:stone_with_coal and default:stone_with_iron).
- MapBlock and MapNode serialization updated.
- Mapgen: Frequency of iron increased.
- node_dig callback and related changes.
2012-01-22 17:24:50 +02:00
Perttu Ahola
842eb5da28 Replace old active block random node modifying things with actual ActiveBlockModifiers 2011-11-29 19:13:56 +02:00
Perttu Ahola
ba762bcd49 Clean mapnode.h and fix other files accordingly 2011-11-29 19:13:44 +02:00
Perttu Ahola
c6fd2986d4 GameDef compiles 2011-11-29 19:13:42 +02:00
Perttu Ahola
abceeee92f Create framework for getting rid of global definitions of node/tool/item/whatever types 2011-11-29 19:13:41 +02:00
Perttu Ahola
78f4142f4f Add /clearobjects 2011-10-18 00:01:50 +03:00
Perttu Ahola
b0481b9db1 Fix chest not working after walked away and came back 2011-10-17 01:04:22 +03:00
Perttu Ahola
061d4b4202 Merge branch 'view_bobbing_and_vielded_tool' 2011-09-26 15:10:02 +03:00
darkrose
582e450bad added locking chests - clean patch 2011-09-22 19:11:48 +10:00
Kahrl
baf7da9d4a Collected and moved existing camera infrastructure from game.cpp to camera.cpp and camera.h. Introduced configuration settings 'fov' which chooses the camera's (vertical) field of view and 'view_bobbing' which currently does nothing. Other code refactored to not expect the FOV to be a build time constant. 2011-09-08 01:08:47 +02:00
Kahrl
c0b35fa429 Removed unused camera_position and camera_direction fields from Client. Moved ClientEnvironment::drawPostFx to ClientMap::renderPostFx -- this will make the camera management classes easier to write, as ClientMap already knows the camera position but ClientEnvironment doesn't and has to be told about it. This also eliminates the need for Client::getEnv(). Made the post effect color a content feature defined in content_mapnode.h. 2011-09-07 19:21:28 +02:00
JacobF
d670c831c2 These numbers were well exceeding 2^32... 2011-09-04 17:01:28 -04:00
JacobF
d1a16f24cf Initial sqlite3 maps.
* The map will reside in world/map.sqlite
* It will load from the sectors folder but will not save there
2011-09-02 19:07:14 -04:00
Perttu Ahola
71f5d4b344 Fixed objects being sometimes not able to be stored statically in a block when block has been unloaded 2011-07-01 21:04:40 +03:00
Perttu Ahola
dd22ea051a map unloading is now a whole lot better 2011-06-27 00:27:17 +03:00
Perttu Ahola
3fccc67eb7 fixed block unloading from memory (a better fix coming next) 2011-06-26 21:53:11 +03:00
Perttu Ahola
bb940a946d even more code refactoring 2011-06-26 02:34:36 +03:00
Perttu Ahola
2915bd5518 more reorganizing of map code 2011-06-26 01:31:43 +03:00