From 24c7cceecc510c62c25cc4ce98d3e850142ce15e Mon Sep 17 00:00:00 2001 From: Causeless Date: Sun, 5 Nov 2023 11:34:39 +0000 Subject: [PATCH] Expose orbitdirection to lua --- Lua/LuaBindingsManagers.cpp | 1 + Managers/SceneMan.cpp | 18 ++++++++++++++++-- Managers/SceneMan.h | 6 ++++++ 3 files changed, 23 insertions(+), 2 deletions(-) diff --git a/Lua/LuaBindingsManagers.cpp b/Lua/LuaBindingsManagers.cpp index 5d6c39341..47b844f11 100644 --- a/Lua/LuaBindingsManagers.cpp +++ b/Lua/LuaBindingsManagers.cpp @@ -277,6 +277,7 @@ namespace RTE { .property("SceneHeight", &SceneMan::GetSceneHeight) .property("SceneWrapsX", &SceneMan::SceneWrapsX) .property("SceneWrapsY", &SceneMan::SceneWrapsY) + .property("SceneOrbitDirection", &SceneMan::GetSceneOrbitDirection) .property("LayerDrawMode", &SceneMan::GetLayerDrawMode, &SceneMan::SetLayerDrawMode) .property("GlobalAcc", &SceneMan::GetGlobalAcc) .property("OzPerKg", &SceneMan::GetOzPerKg) diff --git a/Managers/SceneMan.cpp b/Managers/SceneMan.cpp index c3ea9ea16..d19671d16 100644 --- a/Managers/SceneMan.cpp +++ b/Managers/SceneMan.cpp @@ -421,13 +421,27 @@ bool SceneMan::SceneWrapsY() const ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +Directions SceneMan::GetSceneOrbitDirection() const { + if (m_pCurrentScene) { + SLTerrain *terrain = m_pCurrentScene->GetTerrain(); + if (terrain) { + return terrain->GetOrbitDirection(); + } + } + + return Directions::Up; +} + +///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + SLTerrain * SceneMan::GetTerrain() { // RTEAssert(m_pCurrentScene, "Trying to get terrain matter before there is a scene or terrain!"); - if (m_pCurrentScene) + if (m_pCurrentScene) { return m_pCurrentScene->GetTerrain(); + } - return 0; + return nullptr; } ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/Managers/SceneMan.h b/Managers/SceneMan.h index 3f190631b..7ce6479fc 100644 --- a/Managers/SceneMan.h +++ b/Managers/SceneMan.h @@ -344,6 +344,12 @@ class SceneMan : public Singleton, public Serializable { bool SceneWrapsY() const; + /// + /// Gets the orbit direction for the current scene. + /// + /// The orbit direction for the current scene. + Directions GetSceneOrbitDirection() const; + ////////////////////////////////////////////////////////////////////////////////////////// // Method: GetTerrain //////////////////////////////////////////////////////////////////////////////////////////