From fc506003035c86914a2d18069871731696b2f173 Mon Sep 17 00:00:00 2001 From: Kae <80987908+Novaenia@users.noreply.github.com> Date: Sun, 9 Jun 2024 15:25:23 +1000 Subject: [PATCH] add Projectile::velocity thanks to Bott for suggesting --- source/game/StarProjectile.cpp | 4 ++++ source/game/StarProjectile.hpp | 2 ++ source/game/scripting/StarWorldLuaBindings.cpp | 2 ++ 3 files changed, 8 insertions(+) diff --git a/source/game/StarProjectile.cpp b/source/game/StarProjectile.cpp index b3f5184..1503f4c 100644 --- a/source/game/StarProjectile.cpp +++ b/source/game/StarProjectile.cpp @@ -137,6 +137,10 @@ RectF Projectile::metaBoundBox() const { return m_config->boundBox; } +Vec2F Projectile::velocity() const { + return m_movementController->velocity(); +} + pair Projectile::writeNetState(uint64_t fromVersion) { return m_netGroup.writeNetState(fromVersion); } diff --git a/source/game/StarProjectile.hpp b/source/game/StarProjectile.hpp index 6719a21..2aec4b4 100644 --- a/source/game/StarProjectile.hpp +++ b/source/game/StarProjectile.hpp @@ -37,6 +37,8 @@ public: Vec2F position() const override; RectF metaBoundBox() const override; + Vec2F velocity() const; + bool ephemeral() const override; ClientEntityMode clientEntityMode() const override; bool masterOnly() const override; diff --git a/source/game/scripting/StarWorldLuaBindings.cpp b/source/game/scripting/StarWorldLuaBindings.cpp index ba4322d..08a7a43 100644 --- a/source/game/scripting/StarWorldLuaBindings.cpp +++ b/source/game/scripting/StarWorldLuaBindings.cpp @@ -1361,6 +1361,8 @@ namespace LuaBindings { return playerEntity->velocity(); else if (auto vehicleEntity = as(entity)) return vehicleEntity->velocity(); + else if (auto projectileEntity = as(entity)) + return projectileEntity->velocity(); return {}; }