#237 little code imporvements

This commit is contained in:
Callow 2022-07-13 11:36:47 +03:00
parent a827dba835
commit 858c47dc6e
2 changed files with 6 additions and 11 deletions

View File

@ -33,6 +33,7 @@ namespace cheat::feature
{ {
return f_Enabled; return f_Enabled;
} }
void AutoRun::DrawStatus() void AutoRun::DrawStatus()
{ {
ImGui::Text("Auto Run[%.01f]",f_Speed.value()); ImGui::Text("Auto Run[%.01f]",f_Speed.value());
@ -44,7 +45,7 @@ namespace cheat::feature
return instance; return instance;
} }
void enableAutoRun(float speed) { void EnableAutoRun(float speed) {
auto& manager = game::EntityManager::instance(); auto& manager = game::EntityManager::instance();
auto avatarEntity = manager.avatar(); auto avatarEntity = manager.avatar();
@ -52,13 +53,7 @@ namespace cheat::feature
auto baseMove = avatarEntity->moveComponent(); auto baseMove = avatarEntity->moveComponent();
auto rigidBody = avatarEntity->rigidbody(); auto rigidBody = avatarEntity->rigidbody();
if (baseMove == nullptr) if (baseMove == nullptr || rigidBody == nullptr || renderer::IsInputLocked())
return;
if (rigidBody == nullptr)
return;
if (renderer::IsInputLocked())
return; return;
auto cameraEntity = game::Entity(reinterpret_cast<app::BaseEntity*>(manager.mainCamera())); auto cameraEntity = game::Entity(reinterpret_cast<app::BaseEntity*>(manager.mainCamera()));
@ -76,7 +71,7 @@ namespace cheat::feature
void AutoRun::OnGameUpdate() { void AutoRun::OnGameUpdate() {
if (f_Enabled) { if (f_Enabled) {
float speed = f_Speed.value(); float speed = f_Speed.value();
enableAutoRun(speed); EnableAutoRun(speed);
} }
} }
} }

View File

@ -24,4 +24,4 @@ namespace cheat::feature
private: private:
AutoRun(); AutoRun();
}; };
} }