1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-08-11 17:51:04 +00:00

Implement adding velocity to player from Lua

The intended usecase is knockback, but there's potential for more.
This commit is contained in:
sfan5 2019-07-16 14:00:42 +02:00
parent b19400aa74
commit cf64054390
14 changed files with 105 additions and 2 deletions

View file

@ -149,6 +149,11 @@ public:
bool getAutojump() const { return m_autojump; }
inline void addVelocity(const v3f &vel)
{
added_velocity += vel;
}
private:
void accelerate(const v3f &target_speed, const f32 max_increase_H,
const f32 max_increase_V, const bool use_pitch);
@ -194,6 +199,7 @@ private:
float m_zoom_fov = 0.0f;
bool m_autojump = false;
float m_autojump_time = 0.0f;
v3f added_velocity = v3f(0.0f, 0.0f, 0.0f); // cleared on each move()
GenericCAO *m_cao = nullptr;
Client *m_client;