summaryrefslogtreecommitdiff
path: root/src/player.h
diff options
context:
space:
mode:
authorSmallJoker <SmallJoker@users.noreply.github.com>2019-08-07 19:16:31 +0200
committerGitHub <noreply@github.com>2019-08-07 19:16:31 +0200
commite462a9a5ef46776d974203bb44e0b89e8c980b29 (patch)
tree4562ef5587bd896890d843877031d5818de19bbc /src/player.h
parent003af7421352ec1b8ba0d230b807862e1e4cc7e9 (diff)
downloadminetest-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.h6
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: