add Projectile::velocity

thanks to Bott for suggesting
This commit is contained in:
Kae 2024-06-09 15:25:23 +10:00
parent 5a99d7b245
commit fc50600303
3 changed files with 8 additions and 0 deletions

View File

@ -137,6 +137,10 @@ RectF Projectile::metaBoundBox() const {
return m_config->boundBox; return m_config->boundBox;
} }
Vec2F Projectile::velocity() const {
return m_movementController->velocity();
}
pair<ByteArray, uint64_t> Projectile::writeNetState(uint64_t fromVersion) { pair<ByteArray, uint64_t> Projectile::writeNetState(uint64_t fromVersion) {
return m_netGroup.writeNetState(fromVersion); return m_netGroup.writeNetState(fromVersion);
} }

View File

@ -37,6 +37,8 @@ public:
Vec2F position() const override; Vec2F position() const override;
RectF metaBoundBox() const override; RectF metaBoundBox() const override;
Vec2F velocity() const;
bool ephemeral() const override; bool ephemeral() const override;
ClientEntityMode clientEntityMode() const override; ClientEntityMode clientEntityMode() const override;
bool masterOnly() const override; bool masterOnly() const override;

View File

@ -1361,6 +1361,8 @@ namespace LuaBindings {
return playerEntity->velocity(); return playerEntity->velocity();
else if (auto vehicleEntity = as<Vehicle>(entity)) else if (auto vehicleEntity = as<Vehicle>(entity))
return vehicleEntity->velocity(); return vehicleEntity->velocity();
else if (auto projectileEntity = as<Projectile>(entity))
return projectileEntity->velocity();
return {}; return {};
} }