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

Unify wield item handling (#8677)

This moves the wield item functions to Player and the tool utils for range calculation
Also 'local_inventory' was removed due to redundancy in Client
This commit is contained in:
SmallJoker
2019-08-07 19:16:31 +02:00
committed by GitHub
parent 003af74213
commit e462a9a5ef
14 changed files with 154 additions and 249 deletions

View File

@@ -219,7 +219,7 @@ class PlayerSAO : public UnitSAO
public:
PlayerSAO(ServerEnvironment *env_, RemotePlayer *player_, session_t peer_id_,
bool is_singleplayer);
~PlayerSAO();
ActiveObjectType getType() const
{ return ACTIVEOBJECT_TYPE_PLAYER; }
ActiveObjectType getSendType() const
@@ -272,16 +272,13 @@ public:
/*
Inventory interface
*/
Inventory* getInventory();
const Inventory* getInventory() const;
Inventory *getInventory() const;
InventoryLocation getInventoryLocation() const;
std::string getWieldList() const;
void setInventoryModified() {}
std::string getWieldList() const { return "main"; }
u16 getWieldIndex() const;
ItemStack getWieldedItem() const;
ItemStack getWieldedItemOrHand() const;
bool setWieldedItem(const ItemStack &item);
int getWieldIndex() const;
void setWieldIndex(int i);
/*
PlayerSAO-specific
@@ -355,7 +352,6 @@ private:
RemotePlayer *m_player = nullptr;
session_t m_peer_id = 0;
Inventory *m_inventory = nullptr;
// Cheat prevention
LagPool m_dig_pool;
@@ -371,7 +367,6 @@ private:
IntervalLimiter m_drowning_interval;
IntervalLimiter m_node_hurt_interval;
int m_wield_index = 0;
bool m_position_not_sent = false;
// Cached privileges for enforcement