summaryrefslogtreecommitdiff
path: root/src/environment.cpp
Commit message (Collapse)AuthorAge
* Handle particle spawners in env and delete expired idsobneq2016-04-28
| | | | Rebased by Zeno (2016-04-2016)
* Allow NodeTimer, ABM and block mgmt interval changes.Auke Kok2016-03-19
| | | | | | | | | | | | | | | | | | | | | | ABM's are hardcoded to run every 1.0s, NodeTimers are hard coded to run at every 1.0s. Block mgmt is running every 2.0sec. However, these timers can be better tuned for both higher and lower values by server owners. Some server owners want to, and have the resources to send more packets per second to clients, and so they may wish to send smaller updates sooner. Right now all ABM's are coalesced into 1.0 second intervals, resulting in large send queues to all clients. By reducing the amount of possible timers, one can get a far better response rate and lower the perception of lag. On the other side of the camp, some servers may want to increase these values, which again isn't easily doable. The global settings abm_interval and nodetimer_interval are set to current values by default. I've tested with 0.2/0.5 type values and noticed a greatly improved response and better scattering of nodetimers, as well as enjoying not faceplanting into doors with pressure plates anymore.
* Avoid try/catch for settings.Auke Kok2016-03-09
| | | | | We can just test for the presence of these settings nicely here, no need to use a try / catch construct.
* Add consistent monotonic day counter - get_day_count()Auke Kok2016-03-09
| | | | | | | | | | | | | | | | | | | | | | | | I've written several experimental bits of code that revolve around the need for a consistent calendar, but implementing one is extremely hard in mods due to time changes and mods overriding core.get_timeofday(), which will conflict. The second part of the problem is that doing this from a mod requires constant maintenance of a settings file. An implementation in core is trivial, however, and solves all of these problems at virtually no cost: No extra branches in server steps, and a single branch when minetest.set_time_of_day(), which is entirely reasonable. We store the day_count value in env_meta.txt. The use case is obvious: This change allows mods to create an actual virtual calendar, or properly account for seasonal changes, etc.. We add a "/days" chatcommand that displays the current day count. No permissions are needed. It can only retrieve the day count, not modify it.
* Add minetest.register_lbm() to run code on block load onlyest312016-03-07
|
* Cache some settingsrubenwardy2016-02-26
|
* Add '/clearobjects quick'Kahrl2016-02-11
|
* Fix time progressing too fastest312015-11-04
| | | | | Before, time progressed wrongly. This was due to a mistake in how m_time_of_day_f was calculated, and a regression of the last two commits.
* Time: use locks againest312015-11-04
| | | | | | | | | | | | | | | The Atomic implementation was only partially correct, and was very complex. Use locks for sake of simplicity, following KISS principle. Only remaining atomic operation use is time of day speed, because that really is only read + written. Also fixes a bug with m_time_conversion_skew only being decremented, never incremented (Regresion from previous commit). atomic.h changes: * Add GenericAtomic<T> class for non-integral types like floats. * Remove some last remainders from atomic.h of the volatile use.
* Time: Remove serverside getter, and use atomic operationsest312015-11-03
| | | | | | | | It isn't possible to use atomic operations for floats, so don't use them there. Having a lock is good out of other reasons too, because this way the float time and the integer time both match, and can't get different values in a race, e.g. when two setTimeofDay() get executed simultaneously.
* Environment: Time of day fixes and add serverside getterest312015-10-27
| | | | | | | | -> Put access to time variables under the time lock. -> Merge both time locks, there is no point to have two locks. -> Fix the lock being released too early in Environment::setTimeOfDay -> Add serverside getter so that you don't have to get the environment if you only have the server
* ABMs: Make catch-up behaviour optionalparamat2015-10-18
| | | | | Default is true for backwards compatibility Update lua_api.txt
* Rename macros with two leading underscoresShadowNinja2015-10-14
| | | | These names are reserved for the compiler/library implementations.
* Use warningstream for log messages with WARNINGShadowNinja2015-10-14
| | | | Remove DTIME macro and its uses, too
* Save and remove player by pointerLoic Blot2015-09-23
| | | | | | Why doing things simple ? Use pointer instead of strings to save players and remove them. Saving players by name does a lookup to find pointer we already have ! Idem with removePlayer Also remove unused removePlayer(peer_id), it's never called
* Little optimization on getAdded/Removed activeobjects per player loop.Loic Blot2015-09-19
| | | | | Use std::queue instead of std::set, we don't need such a heavy container. Don't convert position to int to convert it back to float in the next function.
* Fix object position border checkingest312015-09-16
| | | | | Borders have to be converted into BS format in order to be accurately comparable to object positions.
* Disallow placing entities outside safe boundariesest312015-09-15
| | | | | | | | | | | | Entity positions are serialized as F1000. Disallow placing entities outside safe borders with the minetest.add_entity call. Note that this patch only enforces those boundaries for placing entities, moving entities that move outside boundaries aren't affected. Thanks to @nanepiwo for pointing this out.
* Change m_client_event_queue's type to std::queueLoic Blot2015-09-08
| | | | | As indicated in its name, m_client_event_queue should be a queue. Change std::list to std::queue to improve the queue's performance.
* Change i++ to ++iDavid Jones2015-08-25
|
* Clean up threadingShadowNinja2015-08-23
| | | | | | | | | | | | | | | | | | | | * Rename everything. * Strip J prefix. * Change UpperCamelCase functions to lowerCamelCase. * Remove global (!) semaphore count mutex on OSX. * Remove semaphore count getter (unused, unsafe, depended on internal API functions on Windows, and used a hack on OSX). * Add `Atomic<type>`. * Make `Thread` handle thread names. * Add support for C++11 multi-threading. * Combine pthread and win32 sources. * Remove `ThreadStarted` (unused, unneeded). * Move some includes from the headers to the sources. * Move all of `Event` into its header (allows inlining with no new includes). * Make `Event` use `Semaphore` (except on Windows). * Move some porting functions into `Thread`. * Integrate logging with `Thread`. * Add threading test.
* SEnv: Remove static_exists from ActiveObjects in deleted blockskwolekr2015-08-16
|
* src/environment.cpp: Fix NULL pointer dereferenceBřetislav Štec2015-08-01
|
* Remove some old dead code. Fix some Clang warnings in SRP (ng->N... willLoic Blot2015-07-24
| | | | always evaluate to true.
* Optional reconnect functionalityest312015-07-23
| | | | | | Enable the server to request the client to reconnect. This can be done with the now extended minetest.request_shutdown([reason], [reconnect]) setting.
* Server kicks: make messages configurable, cache wstringest312015-07-17
|
* Kick players when shutting down server and there is a crash due to a Lua ↵nerzhul2015-07-16
| | | | stack exception
* Remove raw message output on AOM deserialization failurekwolekr2015-07-13
| | | | Improve TOCLIENT_ACTIVE_OBJECT_MESSAGES robustness for handling invalid data
* Generic CAO cleanups and renames for clarificationest312015-06-20
| | | | | | | | * Use enum for GENERIC_CMD_* * Rename m_attachements to attachement_parent_ids (public member and clearer name) * Rename GENERIC_CMD_SET_ATTACHMENT to GENERIC_CMD_ATTACH_TO * USHRT_MAX + 1 buffer sizes to prevent overflows as @kahrl suggested * Remove unneccessary m_id from GenericCAO (shadowing protected superclass member for no reason) as @kahrl suggested
* Make attached objects visible in 3rd person viewest312015-06-20
|
* Record MapBlock modification reasons as flags instead of stringskwolekr2015-05-17
| | | | | This improves performance of MapBlock::raiseModified by a factor of 6. Also, clean up mapblock.h a bit and inline small functions.
* Re-apply 972d17baea81ffe6d508b291ef97207a4822e1da...nerzhul2015-04-22
| | | | but not rename the container. Approved-By est31
* Revert "m_active_object_messages is used like a queue. Use std::queue ↵kwolekr2015-04-21
| | | | | | | | instead of std::list. Also rename to m_active_object_messages_queue" This reverts commit 972d17baea81ffe6d508b291ef97207a4822e1da. The commit being reverted was unauthorized. There had been no discussion, review, or sign-off prior to submittal to upstream.
* m_active_object_messages is used like a queue. Use std::queue instead of ↵Loic Blot2015-04-21
| | | | std::list. Also rename to m_active_object_messages_queue
* Use std::vector instead of std::set for Environment::getObjectsInsideRadiusLoic Blot2015-04-16
| | | | | We are only iterating sequentially, we don't need a set here Also use a vector reference instead of a copy
* Move globals from main.cpp to more sane locationsCraig Robbins2015-04-01
| | | | | | | | | | | | 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
* Fix usage of destroyed mutexkwolekr2015-03-31
| | | | | | Also fix a memory leak Fix overloaded virtual warning in Player::move() Remove some trailing whitespace
* Minor bug fix (lag between damage flash and hearts updating)Craig Robbins2015-03-17
|
* Fix various damage related bugs (client-side)Craig Robbins2015-03-17
| | | | E.g. spawning or teleporting into lava to become invinsible
* Use the new Player::isDead function when it's the caseLoic Blot2015-03-13
|
* For usages of assert() that are meant to persist in Release builds (when ↵Craig Robbins2015-03-07
| | | | NDEBUG is defined), replace those usages with persistent alternatives
* Fix issue #2441: crash on respawn, since a conversion std::list to ↵Loic Blot2015-03-05
| | | | | | | std::vector on Environment.cpp * Also change some std::list to std::vector for ClientMap::renderMap * Remove disabled code in ClientMap::renderMap, disabled since a long time
* Performance improvement: Use std::list instead of std::vector for ↵Loic Blot2015-03-05
| | | | | | request_media, Server::getModNames, Environment::m_simple_objects. * Also remove unused Server::m_modspaths
* Remove Queue class which uses std::list and use native std::queueLoic Blot2015-03-05
|
* Use std::vector instead of std::list in StaticObjectList and ↵Loic Blot2015-03-04
| | | | MutexedMap::getValues()
* ABMHandler and player_collisions use sequential read/write. Switch from ↵Loic Blot2015-03-04
| | | | | | std::list to std::vector * Also remove dead code Map::unloadUnusedData which is dead since a long time
* ASyncRunStep doesn't need to lock when do setTimeOfDaySpeed.Loic Blot2015-03-04
| | | | | * setTimeOfDaySpeed already lock a mutex when modify the value, we don't need to lock all environment. * add a fine grain lock for getTimeOfDay and setTimeOfDay to solve environment multithread modifications on this value
* Change many useless std::list into Environment class (m_players), ABMHandler ↵Loic Blot2015-02-17
| | | | | | and ActiveBlockList::update This improve looping performances.
* Replace std::list by std::vector into ServerMap::listAllLoadableBlocks ↵Loic Blot2015-02-17
| | | | | | ServerMap::listAllLoadedBlocks and their database backends. This adds a speedup on database migration and /clearobjects command
* SAO: re-add old ActiveObjectTypes for a future migration layerLoic Blot2015-02-17
|