1
0
mirror of https://github.com/luanti-org/luanti.git synced 2025-12-30 01:55:22 +01:00

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
This commit is contained in:
Loic Blot
2017-01-01 16:13:01 +01:00
parent a1346c916e
commit 52ba1f867e
13 changed files with 107 additions and 113 deletions

View File

@@ -20,6 +20,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#ifndef CONTENT_SAO_HEADER
#define CONTENT_SAO_HEADER
#include <util/numeric.h>
#include "serverobject.h"
#include "itemgroup.h"
#include "object_properties.h"
@@ -232,7 +233,7 @@ public:
void setHPRaw(s16 hp) { m_hp = hp; }
s16 readDamage();
u16 getBreath() const { return m_breath; }
void setBreath(const u16 breath);
void setBreath(const u16 breath, bool send = true);
void setArmorGroups(const ItemGroupList &armor_groups);
ItemGroupList getArmorGroups();
void setAnimation(v2f frame_range, float frame_speed, float frame_blend, bool frame_loop);
@@ -339,6 +340,10 @@ private:
v3s16 m_nocheat_dig_pos;
float m_nocheat_dig_time;
// Timers
IntervalLimiter m_breathing_interval;
IntervalLimiter m_drowning_interval;
int m_wield_index;
bool m_position_not_sent;
ItemGroupList m_armor_groups;