Commit Graph

198 Commits (e98d421aff046a2d9a9b87516779603dc170b209)

Author SHA1 Message Date
MoNTE48 e98d421aff Merge remote-tracking branch 'upstream/stable-0.4' into sync 2019-04-01 20:18:54 +02:00
paramat 63276e2a8b SAO limits: Allow SAOs to exist outside the set 'mapgen limit' 2018-06-03 17:32:00 +02:00
sfan5 c6f24f4f31 Refine movement anticheat again (#7004)
* Account for walking speed in vertical dir
* Avoid undefined behaviour due to division-by-zero
2018-06-03 17:32:00 +02:00
sfan5 678c9e2648 Apply physics overrides correctly during anticheat calculations (#6970) 2018-06-03 17:32:00 +02:00
sfan5 8e3a110314 ServerEnv: Clean up object lifecycle handling (#6414)
* ServerEnv: Clean up object lifecycle handling
2018-06-03 17:31:59 +02:00
Maksim Gamarnik 35770f4abb Merge Minetest 0.4.16 2017-06-06 23:03:34 +03:00
Loïc Blot 7365f2ec60 Properly remove SAO when worldedges are overtaken (#5889)
* LuaEntitySAO: Remove beyond outermost mapchunk edges

Based on a commit by, and with help from, nerzhul.
Add 2 functions to class Mapgen:
A function to calculate actual mapgen edges, called from the Mapgen constructor.
A function called indirectly from content_sao.cpp per entity step to check SAO
position is within mapgen edges.

* Calculate borders from params not mapgen, which is not available everytime
2017-06-03 19:57:02 +02:00
paramat 701d48a1be Revert custom player collision box and step height commits
These caused inability to pass through 2 node high spaces or step up onto slabs
or steps when a new client connected to an older server.
2017-05-09 03:52:28 +01:00
paramat 59ef3b8ef4 Player properties: Set correct default collisionbox
Recent commit b6f4a9c7e1a4f0bac66fd6f6ff844425ac775975 removed a hardcoded
player collisionbox which resulted on falling back to an incorrect default.
This stopped players walking through 2-node high spaces and made the player
slightly wider.

Improve docs for custom player collisionbox feature and reformat nearby lines.
2017-05-07 06:10:13 +01:00
TeTpaAka 8434302604 Make the player collisionbox settable 2017-05-06 15:41:05 -04:00
Sapier 1851ad2946 Use stepheight from CAO instead of hardcoded value 2017-05-06 21:18:17 +02:00
ShadowNinja b41838b8ef Rename Scripting API files for consistency 2017-04-25 13:41:36 -04:00
Loïc Blot 799890d946 Player data to Database (#5475)
* Player data to Database

Add player data into databases (SQLite3 & PG only)

PostgreSQL & SQLite: better POO Design for databases

Add --migrate-players argument to server + deprecation warning

* Remove players directory if empty
2017-04-23 14:35:08 +02:00
paramat 809ac7f70c Sneak glitch: Set default to false
The 'sneak glitch' physics override now controls whether a player can
use the new move code replications of the old sneak side-effects:
sneak ladders and 2 node sneak jump. This completes our intention to
replicate the old sneak side-effects in new code and provide them as
an option that is disabled by default.
2017-04-22 01:23:57 +01:00
paramat afe086801d Sneak: Add option for old move code
Temporary option for the old move code for specific old sneak behaviour.
Enabled by setting the added 'new move' physics override to false.
By default 'new move' is true.
2017-04-17 10:13:05 +01:00
Loïc Blot b581e6948e Partial damage cheat fix: node damages server side (#4981)
* Damage cheat fix: server side

* Lava/Node damages overtime server side
* lava hurt interval is only for old protocol
2017-04-15 09:25:43 +02:00
Ekdohibs 01dc95278b Fix problems when overriding the hand:
- If the hand can dig a node the item wielded can't, allow to dig it anyway.
- Fix the API callbacks from setting the hand instead of the wielded item.
2017-04-06 21:27:29 -07:00
presstabstart 7c200612fd Fix multiple death messages (#5305)
Fix multiple death messages (#3565) and damage server logs after death.
2017-04-06 20:32:50 -07:00
Loïc Blot 32d85e68c6 Update server min protocol version to v24 (#5411)
* Update server min protocol version to v24

It's based on @sfan5 stats. See https://kitsunemimi.pw/tmp/serverlist_stats_2017-03-17.txt

v24 was bumped 25/08/14 and 0.4.11 was released 25/12/14

* Drop protocol v23 and lesser code
2017-03-19 08:44:29 +01:00
Loic Blot 045cc40d91 [CSM] Client side modding
* 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-03-13 23:56:05 +01:00
Auke Kok 18a9f842c1 Do not increase breath if at full breath.
Prevents the server from sending TOCLIENT_BREATH packets
every 0.5seconds, if there is no reason to.
2017-03-11 17:00:40 -08:00
Ekdohibs 391ec2abaf Fix anticheat resetting client position after the client is teleported
Previously, m_move_pool could accomodate the client moving from the new
position to the old one, and the server accepted the client to go back
to its old position. However, it couldn't then accomodate the client
moving from its old to its new position, and therefore would reset position
to the old position. Thus, by emptying m_move_pool after a teleport, the
server no longer accepts the client to go back to its old position. A
drawback is however that a laggy client *will* trigger a few
"moved_too_fast" anticheats before being told about its new position.

Don't report player cheated if caused by lag.

Fixes #5118
2017-02-01 15:03:57 +00:00
Maksim Gamarnik e05f7db82f Updated to Minetest ver. 0.4.15 2017-01-30 00:44:07 +02:00
sapier 99c27fa817 Make entity on_punch have same signature and behaviour as player on_punch 2017-01-28 15:57:54 +01:00
Loïc Blot b24578ef70 Implement player attribute backend (#4155)
* This backend permit mods to store extra players attributes to a common interface.
* Add the obj:set_attribute(attr, value) Lua call
* Add the obj:get_attribute(attr) Lua call

Examples:
* player:set_attribute("home:home", "10,25,-78")
* player:get_attribute("default:mana")

Attributes are saved as a json in the player file in extended_attributes
key

They are saved only if a modification on the attributes occurs and loaded
when emergePlayer is called (they are attached to PlayerSAO).
2017-01-27 08:59:30 +01:00
Loïc Blot 576308cb1d Revert "Detach the player from entities on death." (#5087) 2017-01-21 17:30:55 +01:00
sapier 8df666f56e Add Entity get_texture_mod() to Lua API
Send texture modifier to clients connecting later too
2017-01-21 17:01:02 +01:00
red-001 9f6e715c65 Detach the player from entities on death. (#5077) 2017-01-21 16:11:55 +01:00
red-001 4fa41de084 Remove `mathconstants.h` and use the correct way to get `M_PI` in MSVC. (#5072) 2017-01-20 23:19:41 +01:00
SmallJoker cdc4049881 Fix MSVC build Build broken by 98e36d7 2017-01-19 20:19:53 +01:00
Loic Blot c808bc4a39 Optimize SAO getStaticData by using std::string pointer instead of return copy
Signed-off-by: Loic Blot <loic.blot@unix-experience.fr>
2017-01-13 21:56:24 +01:00
Rogier e992e9457e Cleanup content_sao by factorizing similar code parts
Signed-off-by: Loic Blot <loic.blot@unix-experience.fr>
2017-01-13 21:56:24 +01:00
Rogier 1386ba186e Performance fix + SAO factorization
Original credits goes to @Rogier-5

* Merge common attributes between LuaEntitySAO & PlayerSAO to UnitSAO
* Make some functions const
* Improve some lists performance by returning const ref

Signed-off-by: Loic Blot <loic.blot@unix-experience.fr>
2017-01-11 15:53:56 +01:00
Ner'zhul 14a094c1a2 Environment & IGameDef code refactoring (#4985)
* Environment code refactoring
* Cleanup includes & class declarations in client & server environment to improve build speed
* ServerEnvironment::m_gamedef is now a pointer to Server instead of IGameDef, permitting to cleanup many casts.
* Cleanup IGameDef
  * Move ITextureSource* IGameDef::getTextureSource() to Client only.
  * Also move ITextureSource *IGameDef::tsrc() helper
  * drop getShaderSource, getSceneManager, getSoundManager & getCamera abstract call
  * drop unused emerge() call
  * cleanup server unused functions (mentionned before)
* Drop one unused parameter from ContentFeatures::updateTextures
* move checkLocalPrivilege to Client
* Remove some unnecessary casts
* create_formspec_menu: remove IWritableTextureSource pointer, as client already knows it
* Fix some comments
* Change required IGameDef to Server/Client pointers
* Previous change that game.cpp sometimes calls functions with Client + InventoryManager + IGameDef in same functions but it's the same objects
* Remove duplicate Client pointer in GUIFormSpecMenu::GUIFormSpecMenu
* drop ClientMap::sectorWasDrawn which is unused
2017-01-09 20:39:22 +01:00
Loic Blot 295d6102c0 Breath cheat fix: server side
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
2017-01-01 23:11:26 +01:00
lhofhansl 52bf98ff4c Optimize/adjust blocks/ActiveObjects sent at the server based on client settings. (#4811)
Optimize/adjust blocks and active blocks sent at the server based on client settings.
2016-11-30 18:13:14 +10:00
TeTpaAka 116d887dd0 Wieldhand: Allow overriding the hand 2016-11-26 03:49:30 +00:00
Rogier-5 c3c16a3f35 Fix mob deserialization errors in the client (#4743)
The problem was seen while using the mobf mod package.

The problem happens when the server serializes entity attachments.
Sometimes, such attachments no longer exist. The serialization code
skips those. However, the total number of attachments was serialized
earlier.  Therefore the client expects more than it gets, and logs a
serialization error.
2016-11-10 13:42:49 +01:00
Ner'zhul c8fb80f660 PlayerSAO saving fix (#4734)
PlayerSAO::disconnected() function was historical and remove the link between SAO and RemotePlayer session. With previous attributes linked to RemotePlayer saving was working. But now attributes are read from SAO not RemotePlayer and the current serialize function verify SAO exists to save the player attributes.

Because PlayerSAO::disconnected marks playersao for removal, only mark playerSAO for removal and let PlayerSAO::removingFromEnvironment do the correct saving behaviour and all the disconnection process instead of doing a partial removal and let the server loop doing the RemotePlayer cleanup and remove some saved attributes...
2016-11-05 10:25:30 +01:00
Loic Blot 4abc944397 Fix overloading problems mentioned by clang 2016-10-30 16:30:55 +01:00
Ner'zhul 4d9f4685ff PlayerSAO/LocalPlayer refactor: (#4612)
* 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-30 14:53:26 +01:00
raymoo 6e0388ece4 Attached particle spawners 2016-10-13 17:33:16 +02:00
Loic Blot d014961e52 Move RemotePlayer code to its own cpp/header 2016-10-08 22:27:44 +02:00
Foghrye4 5f714c5c6f Prevent attached models from disappearing during parent reload (#4128) 2016-10-08 14:51:25 +02:00
Loic Blot aca9ff5961 Player/LocalPlayer/RemotePlayer inheritance cleanup (part 1 on X)
* LocalPlayer take ownership of maxHudId as it's the only caller
* RemotePlayer take ownership of day night ratio as it's the only user
* Pass getPlayerControl as const reference to prevent object copy on each call (perf improvement in ObjectRef::l_get_player_control call)
* getPlayerSAO is now only RemotePlayer call
* get/setHotbarItemCount is now RemotePlayer owned
* Server: Use RemotePlayer instead of Player object on concerned call to properly fix the object type
* PlayerSAO now uses RemotePlayer instead of Player because it's only server side
* ObjectRef::getplayer also returns RemotePlayer as it's linked with PlayerSAO
2016-10-08 11:36:28 +02:00
Loic Blot d33797e079 use unordered containers where possible (patch 4 on X)
Also remove some unused parameters/functions
2016-10-06 22:37:26 +02:00
SmallJoker e30df98803 Anticheat: Use the physics_override modifiers aswell 2016-09-09 01:03:36 -04:00
Rogier-5 ff78eac229 Add infotext containing entity type (e.g. mobs:cow) to unknown entities (#4431)
If a mod is disabled, or upgraded without sufficient backward compatibility,
then entities it has put into the world become unknown, and continue moving
around, but are completely unrecognisable.

This change allows the player to see their type, and therefore which mod is
or was responsible.
2016-08-11 00:22:32 +02:00
Maksim Gamarnik d7c0fad71f Merge Minetest commits 2016-02-11 22:35:23 +02:00
nerzhul c4bf66116d v2d & aabbox3d<f32> & sky cleanups
* Sky: rename Box => m_box and inline getBoundingBox
* Uniformize aabbox3d<f32> to aabb3f
2016-02-11 16:55:15 +01:00