From 1bfc3c1eb934bcaa2226042e9b494041b7a722cd Mon Sep 17 00:00:00 2001 From: Perttu Ahola Date: Sat, 26 Nov 2011 14:03:56 +0200 Subject: Player movement speed and node access distance checking --- src/player.h | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) (limited to 'src/player.h') diff --git a/src/player.h b/src/player.h index e133c7afb..9476a9be3 100644 --- a/src/player.h +++ b/src/player.h @@ -207,12 +207,22 @@ public: /* ServerActiveObject interface */ u8 getType() const - {return ACTIVEOBJECT_TYPE_PLAYER;} + {return ACTIVEOBJECT_TYPE_PLAYER;} virtual void setPos(v3f pos) - { setPosition(pos); } + { + setPosition(pos); + // Movement caused by this command is always valid + m_last_good_position = pos; + m_last_good_position_age = 0; + } virtual void moveTo(v3f pos, bool continuous) - { setPosition(pos); } + { + setPosition(pos); + // Movement caused by this command is always valid + m_last_good_position = pos; + m_last_good_position_age = 0; + } virtual std::string getDescription(){return getName();} // Returns a reference @@ -222,7 +232,10 @@ public: virtual bool addToInventory(InventoryItem *item); virtual void setHP(s16 hp_); virtual s16 getHP(); - + + v3f m_last_good_position; + float m_last_good_position_age; + private: }; -- cgit v1.2.3