Commit Graph

591 Commits

Author SHA1 Message Date
est31 a9213fd12c Protocol 25: Repurpose string field for access denial
Send it always, and make client use it as fallback for unknown reason strings.

This gives us future-proof-ness.
2015-07-17 07:01:24 +02:00
est31 bf7174f3f9 Server kicks: make messages configurable, cache wstring 2015-07-17 06:37:16 +02:00
nerzhul f9dbec6edf Kick players when shutting down server and there is a crash due to a Lua stack exception 2015-07-16 20:27:42 +02:00
kwolekr 1a1774a105 Fix damage flash when damage disabled 2015-07-10 15:58:57 -04:00
est31 b0784ba871 Use UTF-8 instead of narrow
Use wide_to_utf8 and utf8_to_wide instead of wide_to_narrow and narrow_to_wide at almost all places.
Only exceptions: test functions for narrow conversion, and chat, which is done in a separate commit.
2015-07-08 10:12:44 +02:00
kwolekr 7b171ea2be Fix code style from recent commits and add misc. optimizations 2015-07-02 23:14:30 -04:00
rubenwardy 0d65ee878c Add Lua errors to error dialog 2015-06-29 04:47:35 +02:00
est31 3d43df99f1 Return to ignore 2015-06-24 22:47:41 +02:00
TeTpaAka 17ba584fe2 Fix bug when craft input isn't replaced 2015-06-22 19:30:35 +02:00
TeTpaAka c0335f7d13 Add some missing getter functions to the lua API
ObjectRef:
get_properties
get_armor_groups
get_animation
get_attach
get_bone_position

Players:
get_physics_override
hud_get_hotbar_itemcount
hud_get_hotbar_image
hud_get_hotbar_selected_image
get_sky
get_day_night_ratio
get_local_animation
get_eye_offset

Global:
minetest.get_gen_notify
minetest.get_noiseparams
2015-05-28 16:46:35 +02:00
rubenwardy 603297cc35 Add texture overriding 2015-05-19 21:27:07 +02:00
est31 497299afd6 Lower log level for unexpected behaviour
Its a possible mistake to log in to a server with twice the same name.
Before, it triggered a server wide error message, now it logs to actionstream.
2015-05-19 00:55:58 +02:00
ShadowNinja 3a8c788880 Add mod security
Due to compatibility concerns, this is temporarily disabled.
2015-05-16 18:32:31 -04:00
est31 82e35edff5 Make early protocol auth mechanism generic, and add SRP
Adds everything needed for SRP (and everything works too),
but still deactivated, as protocol v25 init packets aren't final yet.
Can be activated by changing the LATEST_PROTOCOL_VERSION header to 25
inside networkprotocol.h.
2015-05-11 18:40:27 +02:00
est31 33c11415bf Gracefully handle PacketErrors 2015-05-08 06:51:03 +02:00
est31 ccc09abc2d Protocol 25: wstring -> string for custom access denial reasons
Also fix std::logic_error when server::DenyAccess() is used with only two arguments.
2015-04-22 14:10:39 +02:00
kwolekr 479f38973e Schematics: Refactor NodeResolver and add NodeResolveMethod
NodeResolver name lists now belong to the NodeResolver object instead of
the associated NodeDefManager.  In addition to minimizing unnecessary
abstraction and overhead, this move permits NodeResolvers to look up nodes
that they had previously set pending for resolution.  So far, this
functionality has been used in the case of schematics for
serialization/deserialization.
2015-04-16 16:27:05 -04:00
Ner'zhul ce8a9ed94b Fix a rare crash case un SendPlayerHP
If the player is disconnected while Lua API is doing a l_punch call, for example, the playersao is NULL and the server crash. Fix it.
2015-04-11 10:07:23 +02:00
Loic Blot 5132908f4b TOCLIENT_ACTIVE_OBJECT_MESSAGES: channel must be 1 for unreliable message 2015-04-07 14:28:36 +02:00
Loic Blot 8804c47e59 TOCLIENT_ACTIVE_OBJECT_REMOVE_ADD can be unreliable, catch PacketError exception.
Also set the packet size at creation not when pushing rawString, no functional change
2015-04-05 11:39:38 +02:00
est31 334e70455b Crafting speedup
This greatly increases crafting performance, especially in worlds with many mods.

Approved by @kwolekr.

Introduces a hash-type-layered fall-through mechanism, where every layer specifies one hash algorithm,
and the "deeper the fall", the more collisions to expect for the algorithm. One Craft definition
only resides at one layer, which improves speed for lower layers (and a complete fail), due to most
craft definitions residing at high layers.

Due to the fall-through design, the undocumented behaviour that later craft recipes
override older ones had to be weaked up a bit, but craft recipes with the same hash and layer
will still override.
2015-04-05 09:25:46 +02:00
Loic Blot 470de10de3 Fix players spawned at (0,0,0) in some rare cases instead of static_spawnpoint, if set
Approved by: @kwoelkr
2015-04-03 09:44:36 +02:00
Craig Robbins 9527984dbc Move globals from main.cpp to more sane locations
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
2015-04-01 23:04:25 +10:00
Loic Blot 1fe4256462 Connection::Receive(): receive Network Packet instead of SharedBuffer<u8>.
Because we get a Buffer<u8> from ConnectionEvent, don't convert it to SharedBuffer<u8> and return it to Server/Client::Receive which will convert it to NetworkPacket
Instead, put the Buffer<u8> directly to NetworkPacket and return it to packet processing
This remove a long existing memory copy
Also check the packet size directly into Connection::Receive instead of packet processing
2015-03-31 11:01:08 +02:00
ShadowNinja 93fcab952b Clean up and tweak build system
* Combine client and server man pages.
  * Update unit test options and available databases in man page.
  * Add `--worldname` to man page.
  * Fix a bunch of places where `"Minetest"` was used directly instead of `PROJECT_NAME`.
  * Disable server build by default on all operating systems.
  * Make `ENABLE_FREETYPE` not fail if FreeType isn't found.
  * Enable LevelDB, Redis, and FreeType detection by default.
  * Remove the `VERSION_PATCH_ORIG` hack.
  * Add option to search for and use system JSONCPP.
  * Remove broken LuaJIT version detection.
  * Rename `DISABLE_LUAJIT` to `ENABLE_LUAJIT`.
  * Rename `minetest_*` variables in `version.{h,cpp}` to `g_*`.
  * Clean up style of CMake files.
2015-03-27 15:00:48 -04:00
Loic Blot 7851c4f7a2 Don't send an InventoryAction at each setInventoryModified, we only need one SendInventory per inventory modification
Client doesn't like to receive multiples SendInventory for one action, this can trigger glitches on clients (sometimes due to incorrect UDP packet ordering due to UDP protocol)

This fix issue #2544
2015-03-24 14:13:17 +01:00
est31 538036d004 Fix game minetest.conf default settings
This was a regression introduced by f6e4c5d9cf .
2015-03-18 13:03:02 -04:00
Loic Blot 7685969274 Server::step throw is never catched in minetestserver
Replace it with an errorstream + assert for server

This throw can be trigger by LuaError exception or ConnectionBindFailed exception in the following functions:
* EmergeThread::Thread()
* ScriptApiEnv::environment_Step()
* ScriptApiEnv::player_event()
* ServerThread::Thread()
2015-03-17 15:26:20 +01:00
Loic Blot bfc4652c66 Fix a little regression on SendActiveObjectMessages which send all TOCLIENT_ACTIVE_OBJECT_MESSAGES as reliable 2015-03-17 09:16:39 +01:00
kwolekr 699d42efc6 Revert "Server::step throw is never catched. Replace it with an errorstream + assert"
This reverts commit 5f8e48c63b.
2015-03-16 21:17:27 -04:00
Loic Blot 5f8e48c63b Server::step throw is never catched. Replace it with an errorstream + assert
This throw can be trigger by LuaError exception or ConnectionBindFailed exception in the following functions:
* EmergeThread::Thread()
* ScriptApiEnv::environment_Step()
* ScriptApiEnv::player_event()
* ServerThread::Thread()
2015-03-16 20:25:35 +01:00
Loic Blot e7736ffdd6 Move TOCLIENT_ACTIVE_OBJECT_REMOVE_ADD and TOCLIENT_ACTIVE_OBJECT_MESSAGES to private functions 2015-03-16 12:01:40 +01:00
Loic Blot b2801d8127 SendPlayerHPOrDie everytime at client connection, damage enabled or not, this will fix the player which stay dead at connection 2015-03-15 19:09:26 +01:00
Loic Blot 083c8c734e Replace NetworkPacket pointers to references 2015-03-13 22:01:49 +01:00
Loic Blot 74d34da6cb Prepare Protocol v25 init & authentication.
* TOSERVER_INIT and TOCLIENT_INIT renamed to _LEGACY
* TOSERVER_PASSWORD merged from dev-0.5, can use protocol v24 and v25
* TOCLIENT_ACCESS_DENIED merged from dev-0.5, can use protocol v24 and v25, with normalized strings an a custom id for custom errors
* new TOSERVER_INIT packet only send MT version, supported compressions, protocols and serialization, this permit to rework everything later without break the _INIT packet
* new TOSERVER_AUTH packet which auth the client
* new TOCLIENT_HELLO packet which send server serialization version atm
* new TOCLIENT_AUTH_ACCEPTED which is send when TOCLIENT_AUTH was okay. After this packet, the client load datas from servers, like after TOCLIENT_INIT_LEGACY packet
2015-03-13 20:23:03 +01:00
Loic Blot 126f36c2e6 Rename some packet and handlers to <packet>_Legacy name for compat layer between new network changes and old network clients 2015-03-13 13:40:48 +01:00
Loic Blot 4e63c977c7 Use the new Player::isDead function when it's the case 2015-03-13 08:57:58 +01:00
ngosang f6e4c5d9cf Respect game mapgen flags and save world noise params 2015-03-07 15:53:39 -05: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
Loic Blot aa474e4501 Server.cpp Use std::list instead of std::vector for playSound, fillMediaCache, sendRequestedMedia, sendMediaAnnouncement and related functions 2015-03-05 11:40:04 +01:00
Loic Blot 82482ecd9d Server::AsyncRunStep: buffered_messages now uses std::vector instead of std::list. * sendRemoveNode and sendAddNodes are also converted as a side effect 2015-03-05 11:23:54 +01:00
Loic Blot 365e4ae0fa Performance improvement: Use std::list instead of std::vector for request_media, Server::getModNames, Environment::m_simple_objects.
* Also remove unused Server::m_modspaths
2015-03-05 10:44:48 +01:00
Loic Blot b214cde5b4 Remove Queue class which uses std::list and use native std::queue 2015-03-05 16:49:51 +10:00
Loic Blot 2066655aae ClientInterface::getClientIDs doesn't need a std::list. Use a std::vector for better perfs 2015-03-04 16:30:24 +01:00
Loic Blot 7e088fdfe3 We always know playerSAO when calling SendInventory. Using it instead of searching it via peer_id 2015-03-04 15:28:33 +01:00
Loic Blot 40bf1d7b5f Send Position packet on event, don't check it at each AsyncRunStep.
* This permit to cleanup the player checking loop
2015-03-04 12:19:26 +01:00
Loic Blot 7f8f9785d7 ASyncRunStep doesn't need to lock when do setTimeOfDaySpeed.
* 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
2015-03-04 11:46:31 +01:00
Loic Blot 1b2f64473e Send Inventory packet on event, don't check it at each AsyncRunStep.
* Call UpdateCrafting into SendInventory because this functions is only called before SendInventory
* Use Player* instead of peer_id for UpdateCrafting because SendInventory already has the Player* pointer, then don't loop for searching Player* per peer_id
* m_env_mutex don't need to be used with this modification because it's already locked before the calls
2015-03-04 11:29:39 +01:00
Loic Blot 038d3a31df Remove unused m_wielded_item_not_sent 2015-03-03 17:36:54 +01:00
Loic Blot 7e56637ed0 Send Breath packet on event, don't check it at each AsyncRunStep 2015-03-03 16:33:20 +01:00