Commit Graph

928 Commits

Author SHA1 Message Date
DS ed632f3854
Safely handle block deletion (#13315)
Co-authored-by: Jude Melton-Houghton <jwmhjwmh@gmail.com>
2023-03-24 12:34:44 +01:00
luk3yx 5fa63a0b0c
Fix server-side formspec state keeping issue (#13332) 2023-03-19 20:23:11 +01:00
rubenwardy 39f4d26177
Add minetest.get_player_window_information() (#12367) 2023-02-27 22:58:41 +00:00
sofar 2083252c05
Sky: transmit body_orbit_tilt to client. (#13193)
This obsoletes the current client-side setting entirely. The server can
transmit the tilt to the client directly and will send 0.0f as default
value.

Co-authored-by: x2048 <codeforsmile@gmail.com>
Co-authored-by: sfan5 <sfan5@live.de>
2023-02-26 01:08:33 +01:00
sfan5 8fded9d990
Disable Prometheus in singleplayer mode 2023-01-14 13:11:15 +01:00
x2048 6d45c243f8
Add dynamic exposure correction (#12959)
* Add uniform for frame delta time
* Adjust exposure in logarithmic (EV) space
* Add network support and LUA API
* Add testing mod
2023-01-06 22:33:25 +01:00
lhofhansl 1e7804aaf6
Allow saturation to be controlled by the server. (#13075) 2022-12-25 16:15:32 -08:00
Jude Melton-Houghton d13b12b791
Store `MapEditEvent` blocks in a vector (#13071) 2022-12-24 12:21:59 -05:00
Jude Melton-Houghton 7701e70dc9 Make MapEditEvent more complete
SetBlocksNotSent is no longer used.
2022-12-24 08:24:59 -05:00
Jude Melton-Houghton 7c21347a40 Rename "mod metadata" to "mod storage" everywhere 2022-11-24 17:58:25 -05:00
Jude Melton-Houghton aaa05f901a Add mod storage PostgreSQL backend 2022-11-10 18:56:48 +01:00
Abdou-31 d1b80b462e
Fix typos and en_US/en_GB inconsistency in various files (#12902) 2022-11-09 11:57:19 -05:00
Loïc Blot 322c8cf270
Reduce exposure of various internals (#12885)
* refactoring(StaticObjectList): don't expose m_active and m_stored anymore

This prevents our old crap code where anyone can access to StaticObjectList. use proper modifiers. It also permits to do a short cleanup on MapBlock using a helper

* refactoring(MapBlock): reduce a bit exposed m_active_blocks variable

* refactoring: MapBlock::m_node_timers is now private

We already had various helpers to perform this privatization, just use it. Also factorize the MapBlock stepping code for timers using already existing code and importing them from ServerEnvironment to MapBlock.

It's currently done pretty straight forward without any inheritance as MapBlock is just used everywhere, maybe in a future we'll have ServerMapBlock over MapBlock. Currently for a simple function let's just use proper objects and add a comment warning

* refactoring(Server): fix duplicated function for add/remove node

* refactoring(guiFormSpecMenu): add removeAll function to prevent duplicated code

* refactoring(ShadowRenderer) + perf: code quality  + increase performance

* All callers are already using the point and we should never test a function with nullptr node, it's a bug. Removed workaround which was hacky and fix the bug
* Drop clientmap lookup from shadowrendered, just use directly its
  pointer and forbid to push it in the generic list
* Reduce memory pressure on the renderShadowObject by preventing
  deallocating and reallocating multiple vectors on each node

* refactoring(MapBlock): reduce exposure of MapBlock::m_static_objects

It's not complete as some parts of the code are pretty nested, but it's better than before :)

* fix: better working on new functions & drop unwanted 2 lines

Co-authored-by: Jude Melton-Houghton <jwmhjwmh@gmail.com>

Co-authored-by: Jude Melton-Houghton <jwmhjwmh@gmail.com>
2022-11-03 17:35:31 +01:00
Jude Melton-Houghton b38ffdec27
Implement vector and node conversion in Lua (#12609)
Co-authored-by: sfan5 <sfan5@live.de>
2022-10-18 18:01:44 -04:00
savilli 907dcdcf7b
Add unittests for item movement code (#11885) 2022-09-27 16:22:11 -04:00
Jude Melton-Houghton f4a01f3a5d
Avoid duplication of mod metadata in memory (#12562)
Co-authored-by: sfan5 <sfan5@live.de>
2022-09-26 17:03:43 -04:00
Herman Semenov 038da00e79
Code optimizations / refactor (#12704)
Co-authored-by: SmallJoker <SmallJoker@users.noreply.github.com>
Co-authored-by: sfan5 <sfan5@live.de>
2022-09-06 11:21:09 +01:00
rubenwardy 2d10fa7867
Prevent loading a world with unresolved dependencies (#12542) 2022-08-19 12:31:36 +01:00
rubenwardy 4648d8f499
Deprecate loading a world with unresolved dependencies (#12541)
Co-authored-by: sfan5 <sfan5@live.de>
2022-07-17 14:45:20 +01:00
Lexi Hale 20bd6bdb68
Animated particlespawners and more (#11545)
Co-authored-by: Lars Mueller <appgurulars@gmx.de>
Co-authored-by: sfan5 <sfan5@live.de>
Co-authored-by: Dmitry Kostenko <codeforsmile@gmail.com>
2022-07-13 11:57:12 +02:00
SmallJoker e51f474613
Sounds: Various little improvements (#12486)
Use SimpleSoundSpec where reasonable (OpenAL)
Ensure the sound IDs do not underflow or get overwritten -> loop in u16
Proper use of an enum.
2022-07-09 22:32:24 +02:00
SmallJoker 051181fa6e
Enforce limits of settings that could cause buggy behaviour (#12450)
Enforces the setting value bounds that are currently only limited by the GUI (settingtypes.txt).
2022-07-09 22:32:08 +02:00
Wuzzy 142928e944
Allow to set maximum star opacity at daytime (#11663) 2022-07-02 19:57:48 +01:00
SmallJoker a463620edb
Re-order sound-related code (#12382)
Dropped ServerSoundParams -> moved to ServerPlayingSound. This gets rid of the duplicated
'fade' and 'pitch' values on server-side where only one was used anyway.
SimpleSoundSpec is the basic sound without positional information, hence 'loop' is included.

Recursively added PROTOCOL_VERSION to most functions to reduce the versioning mess in the
future. Per-type version numbers are kept for now as a safety rope in a special case.
2022-06-20 21:56:12 +02:00
Lars Müller f4a53f7ee6
No damage effects on hp_max change (#11846) 2022-06-11 20:00:40 +02:00
sfan5 261a8db9dd Optimize Server::sendMetadataChanged a bit
The distance check also never worked as intended, now fixed.
2022-05-29 14:00:19 +02:00
sfan5 f195db2d14 Add API function to invoke player respawn
closes #12272
2022-05-29 14:00:19 +02:00
rubenwardy 4e9e230e34
Deprecate game.conf name, use title instead (#12030) 2022-05-21 16:23:30 +01:00
sfan5 ec9f157512 Use native packer to transfer globals into async env(s) 2022-05-10 22:37:42 +02:00
sfan5 f5a8593b11
Add more Prometheus metrics (#12274) 2022-05-09 21:20:58 +02:00
sfan5 1fa4f58080 Cache serialized mapblocks during sending
This reduces the
(absolute) time spent in Server::SendBlocks() from 700ms to 300ms
(relative) share of MapBlock::serialize() from 80% to 60%
in a test setup with 10 players and many block changes
2022-05-08 19:12:10 +02:00
paradust7 0704ca0550
Make logging cost free when there is no output target (#12247)
The logging streams now do almost no work when there is no output target for them.

For example, if LL_VERBOSE has no output targets, then `verbosestream << x` will return a StreamProxy with a null target. Any further `<<` operations applied to it will do nothing.
2022-05-04 20:55:01 +02:00
sfan5 e7659883cc Async environment for mods to do concurrent tasks (#11131) 2022-05-02 20:56:06 +02:00
sfan5 56a558baf8 Refactor some Lua API functions in preparation for async env 2022-05-02 20:54:55 +02:00
sfan5 a65f6f07f3 Clean up some auth packet handling related code 2022-04-28 20:05:26 +02:00
Jude Melton-Houghton 0b5b2b2633
Disentangle map implementations (#12148)
Fixes violation of Liskov substitution principle
Fixes #12144
2022-04-07 21:58:04 +02:00
x2048 0f25fa7af6
Add API to control shadow intensity from the game/mod (#11944)
* Also Disable shadows when sun/moon is hidden. Fixes #11972.
2022-03-26 16:58:26 +01:00
sfan5 04bd253390 Move the codebase to C++14 2022-02-26 14:39:41 +01:00
sfan5 c31b301722 Clean up ClientReady packet handling
fixes #12073
2022-02-17 23:20:33 +01:00
Lars Müller b9ee29a945
Send HUD flags only if changed 2022-02-08 19:28:32 +01:00
Jude Melton-Houghton 1c73902005 Clean up ClientInterface locking 2022-02-03 11:43:51 +01:00
sfan5 91c6728eb8 Add game name to server status string 2022-01-28 17:15:10 +01:00
Alex 7c93b2d7a3
Give the ASCII console splash a facelift 2022-01-15 17:45:33 +01:00
sfan5 379473b670 Improve situation around race condition with dynamic_add_media during client join 2022-01-15 17:45:08 +01:00
savilli 72b14bd994
Don't call on_dieplayer callback two times (#11874) 2022-01-15 17:44:55 +01:00
Jude Melton-Houghton bf22569019
Use a database for mod storage (#11763) 2022-01-07 20:28:49 +02:00
sfan5 0ea8df4d64
Socket-related cleanups
Improve error handling on Windows and reduce the size of the `Address` class
2021-12-29 23:01:26 +01:00
sfan5 ff934d538c
Fix various code & correctness issues (#11815) 2021-12-05 14:40:30 +01:00
Wuzzy fe7195badb Make /status message easier to read 2021-10-15 18:13:57 +02:00
ROllerozxa 6fedee16f0
Readd TGA to the list of valid texture formats. (#11598) 2021-09-15 11:12:24 +01:00
sfan5 766e885a1b
Clean up/improve some scriptapi error handling code 2021-09-10 23:16:46 +02:00
Jude Melton-Houghton 7423c4c11e
Send to clients node metadata that changed to become empty (#11597) 2021-09-10 23:16:34 +02:00
sfan5 bbfae0cc67
Dynamic_Add_Media v2 (#11550) 2021-09-09 16:51:35 +02:00
savilli 3f1adb49ae
Remove redundant on_dieplayer calls 2021-08-28 12:14:16 +02:00
hecks 1e2b638881 Remove unsupported formats from the media enumerator 2021-07-29 22:42:47 +02:00
sfan5 6e8aebf432
Add bold, italic and monospace font styling for HUD text elements (#11478)
Co-authored-by: Elias Fleckenstein <eliasfleckenstein@web.de>
2021-07-27 19:11:46 +02:00
SmallJoker a8b7c8ff38 Server: Ignore whitespace-only chat messages 2021-06-22 19:47:18 +02:00
Wuzzy cafad6ac03 Translate builtin (#10693)
This PR is the second attempt to translate builtin.
Server-sent translation files can be added to `builtin/locale/`, whereas client-side translations depend on gettext.
2021-03-05 16:29:48 +01:00
SmallJoker 375bcd65c1
Send attachments instantly before set_pos (#10235) 2021-02-12 20:54:06 +01:00
SmallJoker d287da184c Server: properly delete ServerMap on interrupted startups
A static mod error (e.g. typo) would abort the initialization but never free ServerMap
2021-02-05 18:38:34 +01:00
sfan5 674d67f312 Encode high codepoints as surrogates to safely transport wchar_t over network
fixes #7643
2021-02-02 20:46:08 +01:00
sfan5 c834d2ab25 Drop wide/narrow conversion functions
The only valid usecase for these is interfacing with OS APIs
that want a locale/OS-specific multibyte encoding.
But they weren't used for that anywhere, instead UTF-8 is pretty
much assumed when it comes to that.
Since these are only a potential source of bugs and do not fulfil
their purpose at all, drop them entirely.
2021-02-02 20:46:08 +01:00
sfan5 40ad976753 Revise dynamic_add_media API to better accomodate future changes 2021-02-01 23:00:13 +01:00
sfan5 a01a02f7a1 Preserve immortal group for players when damage is disabled 2021-01-31 20:38:12 +01:00
sfan5 112a6adb10
Cache client IP in RemoteClient so it can always be retrieved (#10887)
specifically: after the peer has already disappeared
2021-01-31 20:36:47 +01:00
SmallJoker 37a05ec8d6 Settings: Proper priority hierarchy
Remove old defaults system
Introduce priority-based fallback list
Use new functions for map_meta special functions
Change groups to use end tags

Unittest changes:
 * Adapt unittest to the new code
 * Compare Settings objects
2021-01-29 17:32:35 +01:00
Lars e638056523 Allow configuring block disk and net compression. Change default disk level. 2020-12-15 10:15:25 -08:00
Pierre-Yves Rollo 81c66d6efb Minimap as HUD element with API control
Features:
 * Define Minimap available modes (surface/radar, scale) from Lua, using player:set_minimap_modes()
 * New HUD elements for displaying minimap with custom size and placing
 * New minimap mode for displaying a texture instead of the map
2020-10-04 15:24:34 +02:00
SmallJoker 947466ab28 (se)SerializeString: Include max length in the name
This commit clarifies the maximal length of the serialized strings.
It will avoid accidental use of serializeString() when a larger string can be expected.

Removes unused Wide String serialization functions
2020-10-01 09:52:59 +02:00
luk3yx 09af0c5946
Remove null bytes from TOCLIENT_BLOCKDATA (#10433) 2020-09-26 15:31:54 +02:00
Buckaroo Banzai c6e3050357
Correct erroneous reported max lag with prometheus (#10427)
Co-authored-by: BuckarooBanzay <BuckarooBanzay@users.noreply.github.com>
2020-09-25 18:52:42 +02:00
rubenwardy 9ec75d7765
Clean up server-side translations, remove global variable (#10075) 2020-09-16 14:51:11 +01:00
Desour f27cf47779 Properly handle mod-errors in on_shutdown 2020-08-24 19:55:25 +03:00
DS 98faeac5a7
Load media from subfolders (#9065) 2020-08-20 22:25:29 +02:00
Hugues Ross 3ce03d1c2a
Sanitize world directory names on create. Keep original name separate (#9432)
Blacklisted characters are replaced by '_' in the path. The display name is stored in world.mt, and duplicate file names are resolved by adding an incrementing suffix (_1, _2, _3, etc).
2020-07-28 19:16:57 +02:00
sfan5 2424dfe007
Server pushing media at runtime (#9961) 2020-06-13 19:03:26 +02:00
sfan5 471e567657 Value copy / allocation optimizations mostly in server, SAO and serialize code 2020-05-27 21:58:40 +02:00
sfan5 10c3002aea Optimize particlespawner sending by not sending to distant players 2020-05-23 22:52:21 +02:00
sfan5 9d6e7e48d6 Implement spawning particles with node texture appearance 2020-05-23 22:52:21 +02:00
sfan5 1357ea1da2
Cleanup of particle & particlespawner structures and code (#9893) 2020-05-22 13:23:25 +02:00
Vitaliy 82e4137893
Cache liquid alternative IDs (#8053) 2020-05-20 22:52:10 +01:00
Wuzzy 6e1372bd89
Add support for statbar “off state” icons (#9462)
This adds support for optional “off state” icons for statbars. “off state icons” can be used to denote the lack of something, like missing hearts or bubbles.

Add "off state" textures to the builtin statbars.

Co-authored-by: SmallJoker <mk939@ymail.com>
2020-05-11 21:40:45 +02:00
Loïc Blot 454dbf83a9
Server class code cleanups (#9769)
* Server::overrideDayNightRatio doesn't require to return bool
There is no sense to sending null player, the caller should send a valid object

* Server::init: make private & cleanup
This function is always called before start() and loads some variables which can be loaded in constructor directly.
Make it private and call it directly in start

* Split Server inventory responsibility to a dedicated object

This splits permit to found various historical issues:
* duplicate lookups on player connection
* sending inventory to non related player when a player connects
* non friendly lookups on detached inventories ownership

This reduce the detached inventory complexity and also increased the
lookup performance in a quite interesting way for servers with thousands
of inventories.
2020-05-07 22:38:41 +02:00
SmallJoker cad5b987ad Sky API: Rename *_tint to fog_*_tint for consistency 2020-05-05 08:37:04 +02:00
ANAND e0ea87f1f3
set_fov: Add support for time-based transitions (#9705) 2020-05-02 12:52:11 +02:00
Loic Blot 56bababcdf Add MetricsBackend with prometheus counter support 2020-04-29 07:48:08 +02:00
EvidenceB Kidscode cee3c5e73d
Add server side translations capability (#9733)
* Add server side translations capability
2020-04-25 07:20:00 +02:00
Maksim 23c6d0c31f
Android: fix handling non-latin characters on older Android devices (#9309) 2020-04-17 23:46:30 +02:00
Hugues Ross 5cf6318117
Refactor texture overrides and add new features (#9600)
* Refactor texture overrides, and add new features:

- Texture overrides can support multiple targets in one line
- Texture override files can have comment lines
- Item images/wield images can be overridden

* Formatting changes

* Address soime feedback

- Pass vectors by const reference
- Log syntax errors as warnings
- Remove 'C' prefix from TextureOverrideSource

* Simplify override target checks with an inline helper function

* make linter happy

* Apply feedback suggestions

Co-Authored-By: rubenwardy <rw@rubenwardy.com>

* Remove remaining != 0 checks

* Update copyright notice

Co-authored-by: sfan5 <sfan5@live.de>
Co-authored-by: rubenwardy <rw@rubenwardy.com>
2020-04-14 20:41:29 +02:00
Loic Blot 894a34aef4 Move PlayerSAO to dedicated files 2020-04-11 16:07:17 +02:00
Loic Blot 6d43736172 Move serveractiveobject & unitsao
Move serverobject.{cpp,h} to server/serveractiveobject.{cpp,h}
Move UnitSAO class to dedicated files
2020-04-11 16:07:17 +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
sfan5 de73f989eb
Overall improvements to log messages (#9598)
Hide some unnecessarily verbose ones behind --trace or disable them entirely.
Remove duplicate ones. Improve their contents in some places.
2020-04-08 20:13:23 +02:00
Maksim 0cb34ce158
Fix 2 log messages when player joined to game (#9477) 2020-03-08 18:24:32 +01:00
Jordach 946c03c69b set_sky improvements, set_sun, set_moon and set_stars 2020-03-05 20:12:19 +01:00
sfan5 91eef646a5 Script API: Check that SAOs are still usable before attempting to use them 2020-02-11 19:21:12 +01:00
sfan5 ace3c76112 Improve core.sound_play with ephemeral sounds and player exclusion 2020-02-01 20:31:41 +01:00
Lejo 37f771a95b Fix the player information version_string return value (#8616)
* Give more player information

* Correct lua_api.txt

* Correct keys in lua_api.txt

* Improve Code

* Only Bugfix+ser_vers

* Correct doc

* Fix double
2019-12-20 19:16:29 +01:00
Pierre-Yves Rollo cf7fda0083 Add z-index management to HUD 2019-12-06 20:31:26 +00:00
sfan5 c10952b574 Rework packet receiving in ServerThread
Notably it tries to receive all queued packets
between server steps, not just one.
2019-11-19 20:27:20 +01:00