aboutsummaryrefslogtreecommitdiff
path: root/src/environment.cpp
AgeCommit message (Collapse)Author
2022-05-17Merge branch 'master' of https://github.com/minetest/minetestElias Fleckenstein
2022-01-30Abort raycasts that go out-of-bounds (#12006)sfan5
2020-11-28Merged MinetestElias Fleckenstein
2020-11-04Revert "Make Lint Happy"Elias Fleckenstein
This reverts commit ad148587dcf5244c2d2011dba339786c765c54c4.
2020-11-04Make Lint HappyElias Fleckenstein
2020-10-19Added ThroughWalls, InventoryActions API and AutoTotemElias Fleckenstein
2020-08-18Allow the ABM time budget to be configurable.Lars
2020-08-14Some UpdatesElias Fleckenstein
2020-08-01Added BrightNightElias Fleckenstein
2020-04-11Move serveractiveobject & unitsaoLoic Blot
Move serverobject.{cpp,h} to server/serveractiveobject.{cpp,h} Move UnitSAO class to dedicated files
2020-04-11scriptapi: Sort out ServerEnvironment / Environment distinction properlysfan5
The API implementation is shared between CSM and SSM. Functions should retrieve a plain env when they do not need any server-specific functions.
2019-08-10Merge pull request #8776 from osjc/FixGetNodeJozef Behran
Finish getNode cleanup
2018-08-16Raycast: export exact pointing location (#6304)Dániel Juhász
* Return intersection point in node coordinates. * Clarify 'intersection_point' documentation
2018-02-10Node definition manager refactor (#7016)Dániel Juhász
* 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-01-12Revert "Add an active object step time budget #6721"Lars Hofhansl
This reverts commit 9c669016d1578a5c62f932c6ccb7a2b4b1e21f0a. See #6907
2017-12-06Add an active object step time budget #6721Lars Hofhansl
This can be set via the active_object_interval option.
2017-09-04World start time: Add setting for this, default unchangedparamat
2017-08-20Modernize code: very last fixes (#6290)Loïc Blot
Last modernization fixes
2017-07-07Expose getPointedThing to LuaDániel Juhász
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-06-17Cpp11 initializers 2 (#5999)Loïc Blot
* 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-16C++11 patchset 9: move hardcoded init parameters to class definitions (part ↵Loïc Blot
1) (#5984) * C++11 patchset 9: move hardcoded init parameters to class definitions C++11 introduced the possibility to define the default values directly in class definitions, do it on current code Also remove some unused attributes * CollisionInfo::bouncy * collisionMoveResult::collides_xy * collisionMoveResult::standing_on_unloaded * Clouds::speed * More constructor cleanups + some variables removal * remove only write guiFormSpecMenu::m_old_tooltip * move header included inside defintions in genericobject.h * remove some unused since years exception classes * remove unused & empty debug_stacks_init * remove unused & empty content_nodemeta_serialize_legacy * remove forgotten useless bool (bouncy) in collision.cpp code
2017-04-25Rename Scripting API files for consistencyShadowNinja
2017-04-19Fix various copy instead of const ref reported by cppcheck (#5615)Loïc Blot
* Also remove InventoryList::peekItem unused function * Fix some post increment to preincrement reported by cppcheck
2017-04-06LINT: Switch whitelist check from egrep to awkLoïc Blot
Bonus: make CI happy with the last rules fix
2017-03-17[CSM] Add core.get_timeofday & core.get_day_count env calls (#5401)Loïc Blot
* [CSM] Add core.get_timeofday & core.get_day_count env calls * [CSM] Add core.get_node_level, core.get_node_max_level, core.find_node_near
2017-03-13[CSM] Client side moddingLoic Blot
* rename GameScripting to ServerScripting * Make getBuiltinLuaPath static serverside * Add on_shutdown callback * Add on_receiving_chat_message & on_sending_chat_message callbacks * ScriptApiBase: use IGameDef instead of Server This permits to share common attribute between client & server * Enable mod security in client side modding without conditions
2017-01-08Move ServerEnvironment to dedicated cpp/header filesLoic Blot
* also cleanup some unneeded inclusions
2017-01-08Move ClientEnvironment to dedicated cpp/header filesLoic Blot
2017-01-08Get neighbor from same map block if possible in ABMHandler (#4998)lhofhansl
2017-01-04Fixes for using std:vector in ABMHander and further perf improvementsLars Hofhansl
2017-01-04Use std::vector instead of std::map in class ABMHandlerRogier-5
2017-01-04Improve getPointedThing() (#4346)Dániel Juhász
* 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-01Breath cheat fix: server sideLoic Blot
Breath is now handled server side. Changing this behaviour required some modifications to core: * Ignore TOSERVER_BREATH package, marking it as obsolete * Clients doesn't send the breath to server anymore * Use PlayerSAO pointer instead of peer_id in Server::SendPlayerBreath to prevent a useless lookup (little perf gain) * drop a useless static_cast in emergePlayer
2016-12-24Move PP() and PP2() macros to basic_macros.hRogier
Instead of redefining them everywhere.
2016-12-24Process ABMs in a spherical volume instead of cubicLars Hofhansl
Increase active_block_range default to a 3 mapblock radius.
2016-10-30PlayerSAO/LocalPlayer refactor: (#4612)Ner'zhul
* Create UnitSAO, a common part between PlayerSAO & LuaEntitySAO * Move breath to PlayerSAO & LocalPlayer * Migrate m_yaw from (Remote)Player & LuaEntitySAO to UnitSAO * Migrate m_yaw from Player to LocalPlayer for client * Move some functions outside of player class to PlayerSAO/RemotePlayer or LocalPlayer depending on which class needs it * Move pitch to LocalPlayer & PlayerSAO * Move m_position from Player to LocalPlayer * Move camera_barely_in_ceiling to LocalPlayer as it's used only there * use PlayerSAO::m_base_position for Server side positions * remove a unused variable * ServerActiveObject::setPos now uses const ref * use ServerEnv::loadPlayer unconditionnaly as it creates RemotePlayer only if it's not already loaded * Move hp from Player to LocalPlayer * Move m_hp from LuaEntitySAO to UnitSAO * Use m_hp from PlayerSAO/UnitSAO instead of RemotePlayer
2016-10-20Changes to static object storage limit and error messageparamat
Move static object storage force-delete message from errorstream to warningstream. Increase 'max objects per block' setting to 64. Add missing spaces in warning code.
2016-10-13Attached particle spawnersraymoo
2016-10-09Environment cleanupLoic Blot
* Move client list to ServerEnvironment and use RemotePlayer members instead of Player * ClientEnvironment only use setLocalPlayer to specify the current player * Remove ClientEnvironment dead code on player list (in fact other players are CAO not Player objects) * Drop LocalPlayer::getPlayer(xxx) functions which aren't used. * Improve a little bit performance by using const ref list for ClientEnvironment::getPlayerNames() & Client::getConnectedPlayerNames() * Drop isLocal() function from (Local)Player which is not needed anymore because of previous changes This change permits to cleanup shared client list which is very old code. ClientEnvironment doesn't use player list anymore, it only contains the local player, as addPlayer is only called from Client constructor client side. Clients are only CAO on client side, this cleanup permit to remove confusion about player list.
2016-10-08Move RemotePlayer code to its own cpp/headerLoic Blot
2016-10-08RemotePlayer/LocalPlayer Player base class proper separation (code cleanup) ↵Loic Blot
(patch 3 of X) * remove IGameDef from Player class, only LocalPlayer has it now * move many attributes/functions only used by LocalPlayer from Player to LocalPlayer * move many attributes/functions only used by RemotePlayer from Player to RemotePlayer * make some functions const * hudGetHotbarSelectedImage now returns const ref * RemotePlayer getHotbarSelectedImage now returns const ref * various code style fixes
2016-10-08More code cleanup (UNORDERED + RemotePlayer/LocalPlayer)Loic Blot
* ClientEnvironment now uses UNORDERED MAP for active objects * Use RemotePlayer and LocalPlayer everywhere it's possible * Minor code style fixes * Drop Client::getBreath() unused function
2016-10-08Player/LocalPlayer/RemotePlayer inheritance cleanup (part 2 on X)Loic Blot
* Server/Client Environments now have an helper to cast Player object in the right type to use it * Server: use RemotePlayer everywhere and remove previous added casts * Client: use LocalPlayer where needed * Environment: remove unused functions (getPlayers(), getRandomConnectedPlayer(), getNearestConnectedPlayer())
2016-10-05Replace various std::map with UNORDERED_MAP + various cleanupsLoic Blot
This is part 2 for 5f084cd98d7b3326b51320455364337539710efd Other improvements: * Use the defined ItemGroupList when used * make Client::checkPrivilege const * inline some trivial functions * Add ActiveObjectMap typedef * Add SettingsEntries typedef
2016-06-11Make node timers more efficientEkdohibs
2016-04-28Handle particle spawners in env and delete expired idsobneq
Rebased by Zeno (2016-04-2016)
2016-03-19Allow NodeTimer, ABM and block mgmt interval changes.Auke Kok
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.
2016-03-09Avoid try/catch for settings.Auke Kok
We can just test for the presence of these settings nicely here, no need to use a try / catch construct.
2016-03-09Add consistent monotonic day counter - get_day_count()Auke Kok
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.
2016-03-07Add minetest.register_lbm() to run code on block load onlyest31