Commit Graph

422 Commits (e98d421aff046a2d9a9b87516779603dc170b209)

Author SHA1 Message Date
MoNTE48 e98d421aff Merge remote-tracking branch 'upstream/stable-0.4' into sync 2019-04-01 20:18:54 +02:00
sfan5 0658caec09 Completely disable SQLite so it can be omitted (#120)
* Completely disable SQLite so it can be omitted

* Remove old auto-migration code

* Show error when loading sqlite3 world in Main Menu
2018-07-19 12:13:47 +02:00
paramat 63276e2a8b SAO limits: Allow SAOs to exist outside the set 'mapgen limit' 2018-06-03 17:32:00 +02:00
sfan5 ca3da992d7 Fix blocks written by vmanip not being marked as modified
This bug can be triggered by e.g. calling minetest.place_schematic()
and stopping the server immediately afterwards.
2018-06-03 17:31:59 +02:00
Maksim Gamarnik 35770f4abb Merge Minetest 0.4.16 2017-06-06 23:03:34 +03:00
Loïc Blot 7365f2ec60 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 4f1a88aaaf Time: Change old `u32` timestamps to 64-bit (#5818)
MacOSX build fix + cleanups
2017-05-26 14:03:36 +02:00
ShadowNinja dc73e2cec8 Clean up getTime helpers
This increases size of the getTime return values to 64 bits.
It also removes the TimeGetter classes since the getTime functions
are now very precise.
2017-04-28 14:43:18 -04:00
ShadowNinja b41838b8ef Rename Scripting API files for consistency 2017-04-25 13:41:36 -04:00
Loïc Blot 799890d946 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 f106e1cb0b 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 fc3bfe1c00 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 118cdbc26e 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 db34330121 Fix various variables passed by copy instead of const ref (#5610)
Pointed by cppcheck
2017-04-19 00:36:30 +02:00
paramat 1bb70a78a9 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
paramat 50dc82ddf9 Map generation limit: Rewrite
The previous implementation applied the setting to blockpos_over_limit(),
objectpos_over_limit() and in createSector(), causing many bugs near the
world edge.

First revert the previous implementation.
Rename blockpos_over_limit() to blockpos_over_max_limit() for clarity.
Add a new function to mapblock.h called blockpos_over_mapgen_limit() that
checks against the map_generation_limit setting, and call this only from
the code that decides where mapgen stops.
Use MAX_MAP_GENERATION_LIMIT in objectpos_over_limit() to reduce the
chance of bugs, there is no need to use map_generation_limit here.
2017-03-20 18:34:18 +00:00
Loïc Blot 32d85e68c6 Update server min protocol version to v24 (#5411)
* Update server min protocol version to v24

It's based on @sfan5 stats. See https://kitsunemimi.pw/tmp/serverlist_stats_2017-03-17.txt

v24 was bumped 25/08/14 and 0.4.11 was released 25/12/14

* Drop protocol v23 and lesser code
2017-03-19 08:44:29 +01:00
Lars Hofhansl 38224d47bf Allow server side occlusion culling. 2017-03-11 18:11:19 -08:00
Dániel Juhász fe21088bca 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
paramat 9bf1cdcb35 Voxelmanip: Do not emerge or blit to blocks over map gen limit
Placing a structure that extends into mapblocks that extend past
map_gen_limit causes a crash. For example a sapling growing at the
world edge which adds leaves beyond the edge, or placing a structure
using the lua voxelmanip, or placing a schematic or l-system tree.

Do not run the 'load_if_inexistent' block of code if the mapblock
is over limit, this also marks the mapblock with the flag
VMANIP_BLOCK_DATA_INEXIST which later prevents blitting back those
mapblocks.

This fix therefore uses existing functionality by having the same
effect as the 'load_if_inexistent' bool being false.
2017-02-18 22:47:24 +00:00
Dániel Juhász 3c4bd88430 Lighting: Update lighting at block loading
This commit updates mapblocks' light if necessary when they are loaded.
This removes ghost lighting.
2017-02-13 00:05:49 +00:00
Maksim Gamarnik e05f7db82f Updated to Minetest ver. 0.4.15 2017-01-30 00:44:07 +02:00
red-001 4fa41de084 Remove `mathconstants.h` and use the correct way to get `M_PI` in MSVC. (#5072) 2017-01-20 23:19:41 +01:00
paramat 6713bafd04 Map generation limit: Cache as 'const' not 'const static' 2017-01-08 21:18:11 +00:00
paramat 24169eeb26 Map generation limit: Fix checks for block/sector over-limit
Fix the maths that check if any part of a mapblock or sector is over the
set map_generation_limit.
Therefore avoid the loading of any over-limit blocks that were previously
generated when map_generation_limit was larger. The set limit can vary
for a world because it is not yet a per-world mapgen parameter, even when
it is sometimes it will be changed deliberately.
Therefore avoid a player being returned to world centre if they re-enter
a world while being over-limit.

Fix the createSector() crash caused by a mob spawning over-limit in an
over-limit mapblock
2017-01-08 21:18:11 +00:00
Dániel Juhász 46aff27445 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
Rogier 18bdc18f75 Move PP() and PP2() macros to basic_macros.h
Instead of redefining them everywhere.
2016-12-24 00:32:50 +00:00
MillersMan b4f4850171 Liquids: Update flow on block load
When loading a block add liquid-nodes that might flow away or spread to
neighbours to the transforming_liquid queue.
2016-12-07 04:06:00 +00:00
MillersMan 406dbf5ddf Liquids: Preserve flow state if 'ignore' is a neighbour
Prevent waterfalls from falling down or streams from flowing away when the
source node is in an unloaded block - Nodes near a CONTENT_IGNORE node will
be interpreted as if the ignored node is a liquid node that just supports
the current state of the nodes in question.
2016-12-07 03:54:32 +00:00
MillersMan 49a579467a Map::isValidPosition: Return false instead of throwing exception 2016-12-07 03:51:44 +00:00
Dániel Juhász 93e067c39e Cleanup 2016-10-27 08:04:42 +02:00
Dániel Juhász 703c121576 Use node lighting for liquid spreading
This commit modifies the liquid transforming procedure to light and
unlight nodes instead of whole map blocks.
2016-10-27 08:04:42 +02:00
Dániel Juhász 7f8545d2d7 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
sfan5 27e269a90a Ensure leveldb is always used as default backend (#36) 2016-10-19 03:20:03 +03:00
kwolekr 7af0dede5f 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 f270619d3f Make node timers more efficient 2016-06-11 23:35:17 +01:00
Loic Blot 18ba60faf3 Implement a PostgreSQL backend 2016-05-22 11:34:47 +02:00
Loic Blot 41392521fe DB::loadBlock copy removal & DB backend cleanup
* Remove the copy from db::loadBlock by using a pointer to the destination
* cleanup db backend, the child backend doesn't have to set their functions as virtual
2016-05-17 06:52:16 +02:00
Maksim Gamarnik 0b19e56113 Merge remote-tracking branch 'upstream1/master' 2016-04-01 00:33:55 +03:00
gregorycu 40b2edfe09 Remove expensive copy of ContentFeatures 2016-03-30 11:38:42 -04:00
Maksim Gamarnik 2520ca3ed1 Merge branch 'master' of https://github.com/minetest/minetest 2016-01-31 20:57:03 +02:00
paramat f8b91ab5f6 Liquid flow: Prevent water spreading on ignore 2016-01-20 00:37:00 +00:00
paramat ce609f9e68 Liquids: Flow into and destroy 'floodable' nodes
Add new node property 'floodable', default false
Define "air" as floodable = true in C++ and lua
2016-01-07 05:57:19 +00:00
Maksim Gamarnik 919be490f9 Update
Sync all Minetest commits
2015-11-10 13:49:24 +02:00
ShadowNinja 85dbe50ec1 Rename macros with two leading underscores
These names are reserved for the compiler/library implementations.
2015-10-14 02:39:37 -04:00
ShadowNinja 29e8adeadc Use warningstream for log messages with WARNING
Remove DTIME macro and its uses, too
2015-10-14 01:36:48 -04:00
kwolekr 8c2bf6e89b Add emerge completion callback mechanism
Major refactor of emerge.cpp and Map::init/finishBlockMake
2015-10-04 16:27:50 -04:00
kwolekr 3079eaa37e Define and use limit constants for Irrlicht fixed-width types 2015-10-04 04:00:16 -04:00
kwolekr 23316c9f92 Add /emergeblocks command and core.emerge_area() Lua API 2015-09-23 15:56:24 -04:00
Maksim Gamarnik 9247f32e0e LGPL 2.1 to 3.0 on all files 2015-08-14 01:26:28 +03:00