diff options
author | SmallJoker <SmallJoker@users.noreply.github.com> | 2019-08-07 19:16:31 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-08-07 19:16:31 +0200 |
commit | e462a9a5ef46776d974203bb44e0b89e8c980b29 (patch) | |
tree | 4562ef5587bd896890d843877031d5818de19bbc /src/player.h | |
parent | 003af7421352ec1b8ba0d230b807862e1e4cc7e9 (diff) | |
download | minetest-e462a9a5ef46776d974203bb44e0b89e8c980b29.tar.gz minetest-e462a9a5ef46776d974203bb44e0b89e8c980b29.tar.bz2 minetest-e462a9a5ef46776d974203bb44e0b89e8c980b29.zip |
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
Diffstat (limited to 'src/player.h')
-rw-r--r-- | src/player.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/player.h b/src/player.h index 05b6fcbb5..b0c3b2574 100644 --- a/src/player.h +++ b/src/player.h @@ -173,6 +173,11 @@ public: PlayerSettings &getPlayerSettings() { return m_player_settings; } static void settingsChangedCallback(const std::string &name, void *data); + // Returns non-empty `selected` ItemStack. `hand` is a fallback, if specified + ItemStack &getWieldedItem(ItemStack *selected, ItemStack *hand) const; + void setWieldIndex(u16 index); + u16 getWieldIndex() const { return m_wield_index; } + u32 keyPressed = 0; HudElement* getHud(u32 id); @@ -185,6 +190,7 @@ public: protected: char m_name[PLAYERNAME_SIZE]; v3f m_speed; + u16 m_wield_index = 0; std::vector<HudElement *> hud; private: |