Commit Graph

436 Commits

Author SHA1 Message Date
sfan5
f66ed2c27f Fix local animation not instantly updating after being set 2022-01-19 23:30:18 +01:00
savilli
72b14bd994
Don't call on_dieplayer callback two times (#11874) 2022-01-15 17:44:55 +01:00
sfan5
5eb45e1ea0
Restore pass-through of direction keys (#11924)
This moves relevant code into the PlayerControl class and gets rid of separate keyPressed variable.
2022-01-09 18:46:36 +01: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
savilli
0fa54531d4
Fix check that denies new clients from a singleplayer session 2021-12-28 14:08:21 +01:00
JosiahWI
7f6306ca96
Restore GCC 5 compatibility (#11778) 2021-12-28 14:05:49 +01:00
SmallJoker
57a59ae92d
Network: Delete copy constructor and use std::move instead (#11642)
This is a follow-up change which disables class copies where possible to avoid unnecessary memory movements.
2021-12-01 20:22:33 +01:00
Wuzzy
6910c8d920
Fix number of tool uses being off by 1..32767 (#11110) 2021-10-31 22:33:33 +00:00
sfan5
660e63dbae
Fix item duplication if player dies during interact callback (alternative) (#11662) 2021-10-25 20:30:27 +02:00
sfan5
fe5cb2cdfb Remove broken timeout behaviour
Code that relies on `resend_count` was added in 7ea4a03 and 247a1eb, but never worked.
This was fixed in #11607 which caused the problem to surface.
Hence undo the first commit entirely and change the logic of the second.
2021-10-12 20:13:09 +02:00
savilli
6ea558f8ac
Fix player HP desync between client and server 2021-10-12 20:12:49 +02:00
SmallJoker
d51d0f3a5a
Various code improvements
* Camera: Fix division by 0 after view bobbing
* Remove ignored constness
* Connection: Improve window size range limits
2021-09-27 17:45:44 +02:00
sfan5
e0529da5c8 Fix trivial typos 2021-09-19 13:54:20 +02:00
sfan5
fd8a8501bc
Shave off buffer copies in networking code (#11607) 2021-09-17 18:14:25 +02:00
sfan5
b480a3e9fd Fix broken handling of NodemetaChanged packets
fixes #11610
2021-09-12 14:42:01 +02:00
sfan5
75bf9b75ca
Make sure relevant std::stringstreams are set to binary 2021-09-11 21:06:57 +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
NeroBurner
1d69a23ba4
Joystick sensitivity for player movement (#11262)
This commit deprecates the forward, backward, left, and right binary
inputs currently used for player movement in the PlayerControl struct.
In their place, it adds the movement_speed and movement_direction
values, which represents the player movement is a polar coordinate
system.

movement_speed is a scalar from 0.0 to 1.0. movement_direction is
an angle from 0 to +-Pi:

	       FWD
	        0
	        _
	 LFT   / \   RGT
	-Pi/2 |   | +Pi/2
	       \_/
	       +-Pi
	       BCK

Boolean movement bits will still be set for server telegrams and
Lua script invocations to provide full backward compatibility.
When generating these values from an analog input, a direction is
considered active when it is 22.5 degrees away from either
orthogonal axis.

Co-authored-by: Markus Koch <markus@notsyncing.net>
Co-authored-by: sfan5 <sfan5@live.de>
2021-08-27 20:24:24 +02:00
SmallJoker
0c1e9603db
HUD: Reject and warn on invalid stat types (#11548)
This comes into play on older servers which do not know the "stat" type.
Warnings are only logged once to avoid spam within globalstep callbacks
2021-08-21 20:04:04 +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
Wuzzy
63fc728a84
Require 'basic_debug' priv to view gameplay-relevant debug info, require 'debug' priv to view wireframe (#9315)
Fixes #7245.
2021-06-24 21:21:19 +03:00
Lars Müller
88d1fcfe23
Block & report player self-interaction (#11137) 2021-03-30 21:49:50 +02:00
Elias Fleckenstein
492110a640
Check for duplicate login in TOSERVER_INIT handler (#11017)
i.e. checks for duplicate logins before sending all media data to the client.
2021-03-19 21:45:29 +01:00
SmallJoker
176f5866cb Protect dropping from far node inventories
Also changes if/if to switch/case
2021-03-07 17:18:02 +01:00
SmallJoker
fc864029b9 Protect per-player detached inventory actions 2021-03-07 17:18:02 +01:00
sfan5
593d5f4465 Clean up ClientEvent hudadd/hudchange internals 2021-03-06 23:02:10 +01:00
savilli
3edb1ddb81
Fix hud_change and hud_remove after hud_add (#10997) 2021-02-26 21:21:20 +01:00
SmallJoker
7832b6843e
Server-side authority for attached players (#10952)
The server must have authority about attachments. This commit ignores any player movement packets as long they're attached.
2021-02-15 20:41:19 +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
SmallJoker
7ebd5da9cd Server GotBlocks(): Lock clients to avoid multithreading issues 2021-02-02 19:10:35 +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
rubenwardy
4c76239818
Remove dead code (#10845) 2021-01-22 15:09:26 +00:00
sfan5
74762470b2 Fix some minor code issues all over the place 2020-12-24 13:44:54 +01:00
DS
6f8a1c99d5
Documentation for highest formspec_version[] and changelog (#10592) 2020-12-18 19:38:07 +01:00
sfan5
ad58ece180 serverpackethandler: Minor log message fixes
closes #10434
2020-11-12 21:08:26 +01:00
rubenwardy
7589cbe086
Fix object interaction distance not being checked (#10547) 2020-11-09 11:55:15 +01:00
red-001
0abb3e89fa
Block attempts to connect to the client (#10589)
A Minetest peer initiates a connection by sending a packet with an invalid peer_id, for whatever reason the code for doing this ran on both the client and the server meaning you could connect to a client if you knew what the address:port tuple it was listening on.
2020-11-02 22:21:03 +01:00
SmallJoker
f46509d5e2
Remove unused functions reported by cppcheck (#10463)
Run unused functions reported by cppcheck

This change removes a few (but not all) unused functions.
Some unused helper functions were not removed due to their complexity and potential of future use.
2020-10-05 09:07:33 +02: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
SmallJoker
0d128ab344
Inventory: Protect Craft and Drop actions (#10353)
Change dangerous pointer to unique_ptr for automated deletion.
2020-09-07 21:19:38 +02:00
Lejo
6dcc9e6331
Prevent interacting with items out of the hotbar (#10359) 2020-09-04 20:50:33 +02:00
HybridDog
f5df70764d
[2] Code cleanup in serverpackethandler (#9349)
* Code cleanup in serverpackethandler

* do not define p_under unless a node is pointed
* use switch-case and reduce indentation
2020-09-01 08:08:18 +02:00
Lars Müller
3693b6871e
Prevent players accessing inventories of other players (#10341) 2020-08-29 16:41:03 +01:00
David CARLIER
cf5547227d
Complete Haiku platform support. (#10311)
Fixing linkage/libraries missing issue.
Implements missing platform specifics.
2020-08-23 15:39:32 +02:00
ANAND
291a6b70d6 Allow binding dig, place actions to keys; remove LMB/RMB hardcoding
Co-authored-by: Sam Caulfield <sam@samcaulfield.com>
2020-08-15 12:19:20 +03:00
Lejo
715a123a33
Add PUT and DELETE request + specific method value to HTTP API (#9909) 2020-07-29 23:16:21 +02:00
sfan5
8ca602150d
Replace std::list<session_t> in networking code (#10215) 2020-07-23 19:47:58 +02:00
Lejo
1dd6c8ed7f
Add reconnect button on error: Too many players (#9405) 2020-07-12 09:47:52 +02:00
v-rob
b1ff04e06d
Formspec: Make dropdowns optionally return event based on index, not value (#9496) 2020-07-10 12:11:26 +02:00
Lars Müller
e7e065f553
Exposing the zoom key to Lua API (#9903)
Co-authored-by: Raul Ferriz <raul.ferriz@gmail.com>
2020-06-13 22:46:20 +02:00
sfan5
2424dfe007
Server pushing media at runtime (#9961) 2020-06-13 19:03:26 +02:00
sfan5
9d6e7e48d6 Implement spawning particles with node texture appearance 2020-05-23 22:52:21 +02:00
sorcerykid
15ba75e4cf Add on_authplayer callback and 'last_login' to on_joinplayer (#9574)
Replace on_auth_fail callback with more versatile on_authplayer
    Better clarify account login process in Lua API documentation
    Change initial timestamp for newly registered accounts to -1
2020-05-23 13:25:29 +02:00
sfan5
1357ea1da2
Cleanup of particle & particlespawner structures and code (#9893) 2020-05-22 13:23:25 +02:00
sfan5
a08251a61e Log protocol ver on mismatched client connect too 2020-05-16 12:03:36 +02:00
sfan5
d76785b4c7
network: Replace a fatal_error with just error logging 2020-05-14 21:18:26 +02: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
sfan5
d1c6cc72cc
Server: Improve some log messages (#9820) 2020-05-05 17:05:11 +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
sfan5
ac368af4fe
Allow connection info to be missing from minetest.get_player_information() (#9739)
fixes #9352
This reverts commit 23c907befe.
2020-05-01 21:44:28 +02:00
EvidenceB Kidscode
cee3c5e73d
Add server side translations capability (#9733)
* Add server side translations capability
2020-04-25 07:20:00 +02:00
sfan5
8ef239b448
Improve protocol-level receiving code (#9617) 2020-04-20 23:22:00 +02:00
HybridDog
7b57d3f613
serverpackethandler: Reduce pkt->getPeerId() invocations and more (#9689) 2020-04-18 17:19:53 +02:00
DS
0ac999ded7
Add scroll_container formspec element (redo) (#9101)
New formspec elements:

 - `scroll_container[<X>,<Y>;<W>,<H>;<scrollbar name>;<orientation>;<scroll factor>]`
 - `scroll_container_end[]`

Other elements can be embedded in this element. Scrollbar must be placed manually.
2020-04-13 10:50:07 +02:00
Loic Blot
894a34aef4 Move PlayerSAO 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
sfan5
3494475df1
Miscellaneous networking improvements (#9611)
fixes #2862
2020-04-08 20:12:58 +02:00
SmallJoker
a0998754a7
Connection: Fix deadlock in debug mode (#9550) 2020-03-26 19:13:50 +01:00
Wuzzy
625b100593
Add comments for translators (#9510)
* Add translator comments for "special" strings

* Add translator comments for some "tricky" strings
2020-03-20 09:41:07 +01:00
SmallJoker
23c907befe Workaround for get_player_information
'-1' as value is handled as an error. If there are no RTT updates upon fast connect, set_player_information returned nil.
2020-03-08 13:21:15 +01:00
sfan5
9ca0b3739c
Fix memory leak in protocol 38 set_sky 2020-03-05 22:36:21 +01:00
sfan5
e774d8ca2f Fixes around ServerActiveObject on_punch handling 2020-03-05 22:04:23 +01:00
Jordach
946c03c69b set_sky improvements, set_sun, set_moon and set_stars 2020-03-05 20:12:19 +01:00
Warr1024
244121b964
Allow texture modifiers in hotbar textures. (#9271) 2020-02-26 10:26:24 +01:00
sfan5
ace3c76112 Improve core.sound_play with ephemeral sounds and player exclusion 2020-02-01 20:31:41 +01:00
Hugues Ross
680aaa1bd5 Make clipping of formspec elements more consistent (#9262) 2020-01-16 18:41:07 +00:00
DS
8f73ec6c6c Formspec: make bgcolor element less confusing and allow setting fullscreen color (#8996) 2019-12-08 18:59:30 +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
sfan5
4d668f32a6 Call on_secondary_use when object is right-clicked 2019-11-10 13:12:31 +01:00
DS
5506e97ed8 Formspec: draw order and clipping for all elements (#8740) 2019-11-07 20:11:01 +01:00
sfan5
d77ea76476
Fix broken build
The variable name changed but this didn't cause merge conflicts, so it wasn't caught before.
2019-09-23 00:28:26 +02:00
sfan5
70f9e1aafa
Punchwear (improved) (#8959) 2019-09-22 22:12:21 +02:00
SmallJoker
5fa614d97e
Wieldhand: Specify which ItemStack to use (#8961)
Makes 'get_wield_item' to return the "main" ItemStack
2019-09-21 11:44:24 +02:00
Anand S
47da640d77 Add support for per-player FOV overrides and multipliers 2019-09-19 20:14:16 +02:00
sfan5
5c9983400f Remove incorrect MutexAutoLock
The line declared a variable "m_con" instead of locking m_con.
getClient() doesn't need this anyway, so remove it.
2019-09-19 16:46:41 +02:00
SmallJoker
1de4ca1f9d Built-in formspecs: Force version 1 2019-09-14 20:42:54 +02:00
ANAND
81c7f0ae04 Send ActiveObjects once right after Init2 2019-09-14 20:16:55 +02:00
SmallJoker
9acd36bf99 Formspecs: Introduce formspec_version to mods 2019-09-14 19:43:08 +02:00
SmallJoker
23677be951 Load CSM environment after the restrictions are known
Safety-guards for CSM callbacks to abort on a bad implementation
Only run callbacks when the mods are loaded (and with it: builtin)

Duplication checks inside constructors
2019-09-14 19:42:25 +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
0b4f424f41
Inventory: Send dirty lists where appropriate (#8742)
This change reduces the amount of sent data towards clients. Inventory lists that are already known to the player are skipped, saving quite some data over time.

Raises protocol version to 38 to ensure correct backwards-compatible code.
2019-08-24 19:07:38 +02:00
sfan5
13b22e2afb Remove unused function in ReliablePacketBuffer 2019-08-16 20:03:53 +02:00
sfan5
428a4c86e3 Minor refactor of IncomingSplitBuffer 2019-08-16 20:03:53 +02:00