Commit Graph

64 Commits

Author SHA1 Message Date
sfan5 054c5dfaa3 scriptapi: Sort out ServerEnvironment / Environment distinction properly
The API implementation is shared between CSM and SSM.
Functions should retrieve a plain env when they do not
need any server-specific functions.
2020-04-11 13:12:51 +02:00
Loïc Blot f648fb76ae
Drop genericobject.{cpp,h} (#9629)
* Drop genericobject.{cpp,h}

This file is not for generic object but for ActiveObject message passing.
Put ownership of the various commands to the right objects and cleanup the related code.

* Protect ServerActiveObject::m_messages_out

* typo fix
2020-04-10 19:49:20 +02:00
SmallJoker fae6242d4e Send cumulated inventory changes only each step (#8856)
Applies to player and detached inventories
2019-09-09 19:19:54 +02:00
SmallJoker 539f016c1b
Better F6 profiler (#8750)
Update the profiler names to make more sense of what they actually represent
Move the profiler code from header to its source file
Use monospace font to align lines
Format the statistics line to align better with surrounding values
Refresh the profiler each 3 seconds (roughly)
2019-08-13 19:56:55 +02:00
Jozef Behran 86d7f84b89 Merge pull request #8776 from osjc/FixGetNode
Finish getNode cleanup
2019-08-10 19:45:44 +02:00
Lars Hofhansl 0971a14a57 Improve ABM time budget handling. #8645 2019-07-07 23:23:00 -07:00
Loïc Blot 70672e1cb7
Force player save before kicking on player shutdown (#8157) 2019-02-03 09:11:45 +01:00
Paul Ouellette 3fce27ece5 Fix some misspellings (#8104) 2019-01-16 13:39:13 +01:00
Loïc Blot 022b1eca0b
Make sqlite3 default auth & player backends for new worlds (#8043)
* Make sqlite3 default auth & player backends for new worlds

Also notify about auth backend depreciation
2019-01-04 12:55:07 +01:00
Loïc Blot 0717719073 Player file directory must be only created when using file backend.
Also ensure on each player save that the directory exists
2019-01-04 10:06:46 +01:00
Loïc Blot eda35100b6
Add an activeobject manager to hold active objects (#7939)
* Add an activeobject manager to hold active objects
* Add unittests
2018-12-13 20:18:54 +01:00
CoderForTheBetter faa358e797 Add Lua methods 'set_rotation()' and 'get_rotation()' (#7395)
* Adds Lua methods 'set_rotation()' and 'get_rotation'. Also changed some method names to be more clear. Instead of an f32 being sent over network for yaw, now a v3f is sent for rotation on xyz axes. Perserved Lua method set_yaw/setyaw so that old mods still work, other wise to set yaw they would need to switch to set_rotation(0, yaw, 0).
2018-11-28 09:38:50 +01:00
Ben Deutsch 153fb211ac Replace auth.txt with SQLite auth database (#7279)
* Replace auth.txt with SQLite auth database
2018-08-05 13:13:38 +02:00
nOOb3167 9537cfd3f8 Add a MSVC / Windows compatible snprintf function (#7353)
Use sizeof where applicable for mt_snprintf
2018-07-22 21:56:06 +02:00
Lars Hofhansl 25cc5d1a32 Optimize ABM checks.
See #7555

Cache (up to 64) node types for each active block.
Check this cache first to see whether any ABM needs to be triggered for a block.
2018-07-21 03:09:39 -07:00
lhofhansl 94cd2bfeac Revert 6587 - Optimize entity-entity collision (#7539) 2018-07-08 21:30:55 +01:00
rubenwardy 91615f9588 Add player:get_meta(), deprecate player attributes (#7202)
* Add player:get_meta(), deprecate player attributes
2018-04-06 10:52:29 +02:00
Loïc Blot 392e80e3f1
Huge LBM lookup performance improvement on mapblock loading (#7195)
* Huge LBM lookup performance improvement on mapblock loading
2018-04-04 10:56:46 +02:00
Vitaliy 528908a4c3 Optimize entity-entity collision (#6587)
* Add IrrLicht type aliases
* Add hash for IrrLicht vector
* Add object map
2018-04-03 08:23:46 +02:00
Loic Blot 95ce5583a9
ServerEnvironment::loadDefaultMeta: Loading default meta is only possible for ServerEnv itself 2018-03-16 08:52:42 +01: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
Loic Blot 2c860a6a42 ServerEnvironment & StaticObject cleanups
* isFreeServerActiveObjectId is now part of ServerEnvironment
* getFreeServerActiveObjectId is now part of ServerEnvironment
* StaticObject constructor now take ServerActiveObject instead of type + string. This permits to remove a big string copy in some code parts
2018-03-09 23:27:26 +01:00
paramat 359a940dde SAO limits: Allow SAOs to exist outside the set 'mapgen limit' 2018-02-26 17:21:45 +00:00
Dániel Juhász 3face01a20 Node definition manager refactor (#7016)
* Rename IWritableNodeDefManager to NodeDefManager
* Make INodeDefManager functions const
* Use "const *NodeDefManager" instead of "*INodeDefManager"
* Remove unused INodeDefManager class
* Merge NodeDefManager and CNodeDefManager
* Document NodeDefManager
2018-02-10 21:04:16 +01:00
Loïc Blot 584d00a01c
Add minetest.bulk_set_node call + optimize Environment::set_node call (#6958)
* Add minetest.bulk_set_node call + experimental mod unittest

* Optimize set_node function to prevent triple lookup on contentfeatures

Do only one lookup for old, and try to merge old and new lookup if node is same than previous node

* Add benchmark function + optimize vector population to have real results
2018-01-30 00:30:02 +01:00
Lars Hofhansl fad263dec9 Revert "Add an active object step time budget #6721"
This reverts commit 9c669016d1.
See #6907
2018-01-12 23:47:39 -08:00
Dániel Juhász 2153965cf9 Line_of_sight: Improve using VoxelLineIterator
This commit rewrites line_of_sight with VoxelLineIterator.
Stepsize is no longer needed, the results will be always accurate.
2017-12-26 21:51:32 +00:00
Lars Hofhansl 9c669016d1 Add an active object step time budget #6721
This can be set via the active_object_interval option.
2017-12-06 12:21:54 -08:00
Lars Hofhansl 5a03b1f5f9 Optionally extend the active object in a players camera direction.
See #6667

By setting active_object_send_range_blocks > active_block_range a server admin
can allow clients to retrieve active objects futher out from the player at
relatively low cost to the server
(only objects in the players' view cone are considered).
2017-12-03 17:52:05 -08:00
paramat 912ba1e47f Clearobjects: Send progress messages to terminal using actionstream
Change default mode to 'quick' as 'full' can lock up a server for a
long time.
2017-11-24 05:38:53 +00:00
Vitaliy 20a85d76d9 Move files to subdirectories (#6599)
* Move files around
2017-11-08 23:56:20 +01:00
Loïc Blot be10c0893e Make Player::peer_id server-side only and add getters and setters (#6478)
* Make Player::peer_id server-side only and add getters and setters

Player::peer_id has no sense client side, move it to server, make it private and add setter and getter
Also add some PEER_ID_INEXISTENT instead of harcoded 0
2017-09-30 12:00:05 +02:00
Loïc Blot ad7daf7b52 Add session_t typedef + remove unused functions (#6470)
* Add session_t typedef + remove unused functions

u16 peer_id is used everywhere, to be more consistent and permit some evolutions on this type in the future (i'm working on a PoC), uniformize u16 peer_id to SessionId peer_id
2017-09-27 19:47:36 +02:00
sfan5 04839f233f ServerEnv: Clean up object lifecycle handling (#6414)
* ServerEnv: Clean up object lifecycle handling
2017-09-15 12:19:01 +02:00
Kahrl 17fd5fe935 Make INodeDefManager::getIds return a vector, not a set 2017-09-12 19:31:46 +02:00
Loïc Blot bd6b90359c Remove DSTACK support (#6346)
Debugstacks is not useful, we don't really use it, the DebugStack is not pertinent, gdb and lldb are better if we really want to debug.
2017-08-30 08:09:41 +02:00
Loïc Blot 88b436e6a9 Code modernization: subfolders (#6283)
* Code modernization: subfolders

Modernize various code on subfolders client, network, script, threading, unittests, util

* empty function
* default constructor/destructor
* for range-based loops
* use emplace_back instead of push_back
* C++ STL header style
* Make connection.cpp readable in a pointed place + typo
2017-08-19 22:23:47 +02:00
Loïc Blot 7528986e44 Code modernization: src/p*, src/q*, src/r*, src/s* (partial) (#6282)
* Code modernization: src/p*, src/q*, src/r*, src/s* (partial)

* empty function
* default constructor/destructor
* for range-based loops
* use emplace_back instead of push_back
* C++ STL header style
* Spelling: vertice -> vertex
2017-08-19 14:25:35 +02:00
Loïc Blot fd3afbced5 Optimize headers (part 2) (#6272)
* Optimize headers (part 2)

* less debug.h in headers
* less remoteplayer.h for everybody

* Cleanup (part 2)

* camera.h: mesh.h
* mapgen.h: mapnode.h
* serverenvironment.h: mapblock.h
* nodedef.h: shader.h
2017-08-18 19:25:07 +02:00
Loic Blot bb1c711586
ServerEnvironment::step: modernize loops
Use various ranged-based for loops in ServerEnvironment::step
Also set ServerObject::getBasePosition const to be compliant
ServerEnvironment::deleteParticleSpawner: use a const iterator
2017-08-11 09:57:27 +02:00
JRottm 8325d7f482 Start off newly generated worlds early at sunrise, 5:15am (#6211)
Gives starting singleplayer games this subtle "dawn of a new world" feel.
I would have set it even earlier (up to 4:45am), but I was worried that in
some pre-existing games the player could be overwhelmed by hostile
mobs right at the start, seriously changing gameplay.

It's just the default, individual games should be able to override it, and
for public servers it's irrelevant anyway, because only the first player to
set foot in the world will notice, and that's usually the server admin.
2017-08-05 21:08:21 +02:00
Loic Blot befc3bba3d
LBM: use range based for and fixed a loop variable overloading in applyLBMs 2017-07-24 08:26:19 +02:00
Loic Blot a8c405b04e
LBM content mapping map doesn't need to be ordered, use std::unordered_map
Also rename helper to lbm_map instead of container_map
2017-07-18 08:23:37 +02:00
Dániel Juhász 3caad3f3c9 Expose getPointedThing to Lua
This commit introduces Raycast, a Lua user object, which can be
used to perform a raycast on the map. The ray is continuable, so one can
also get hidden nodes (for example to see trough glass).
2017-07-07 22:28:23 +01:00
Loïc Blot 4faaadc8d5 Cpp11 patchset 11: continue working on constructor style migration (#6004) 2017-06-18 19:55:15 +02:00
Loïc Blot 65819f3b9f Use thread_local instead from some static settings (#5955)
thread_local permits to limit variable lifetime to thread duration. Use it on each setting place which uses static to cache variable result only for thread lifetime. This permits to keep the same performance level & reconfigure server from MT gui in those various variables places.

Add thread_local to undersampling calculation too.
2017-06-11 13:58:43 +02:00
paramat 842acbfad2 (Re)spawn players within 'mapgen_limit'
Previously, findSpawnPos() did not take the 'mapgen_limit' setting into account,
a small limit often resulted in a spawn out in the void.
Use the recently added 'calcMapgenEdges()' to get max spawn range through a new
mapgenParams function 'getSpawnRangeMax()'.

Previously, when a player respawned into a world, 'objectpos_over_limit()' was
used as a check, which was inaccurate.
Use the recently added 'saoPosOverLimit()' to get exact mapgen edges.

Also fix default value of 'm_sao_limit_min'.
2017-06-11 02:11:08 +01: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 4d5ce8478c Enhance ABM performance a little bit by removing two std::set copy (#5815)
* Enhance ABM performance a little bit by removing two std::set copy

* ActiveBlockModifier::getTriggerContents now returns a const ref
* ActiveBlockModifier::getRequiredNeighbors now returns a const ref
* ActiveBlockModifier::getRequiredNeighbors is now purely virtual

* Little code style fix
2017-05-25 16:43:55 +02:00
SmallJoker 674400523e Mainmenu: Fix issues while trying to enable all mods (#5770) 2017-05-19 07:45:47 +02:00