mirror of
https://github.com/360NENZ/Taiga74164-Akebi-GC.git
synced 2025-01-09 10:49:23 +08:00
Fixed stuff that was pointed out to me
This commit is contained in:
parent
d1ab2ce916
commit
93a93e3352
@ -9,12 +9,10 @@
|
|||||||
|
|
||||||
namespace cheat::feature
|
namespace cheat::feature
|
||||||
{
|
{
|
||||||
//bool isAutoRunEnabled = false;
|
|
||||||
|
|
||||||
AutoRun::AutoRun() : Feature(),
|
AutoRun::AutoRun() : Feature(),
|
||||||
NF(f_Enabled, "Auto Run", "Player::AutoRun", false),
|
NF(f_Enabled, "Auto Run", "Player::AutoRun", false),
|
||||||
NF(f_Speed, "Speed", "Player::AutoRun",1.0f),
|
NF(f_Speed, "Speed", "Player::AutoRun",1.0f)
|
||||||
NF(f_CameraRelative, "Relative to camera", "Player::AutoRun" , false)
|
|
||||||
{
|
{
|
||||||
events::GameUpdateEvent += MY_METHOD_HANDLER(AutoRun::OnGameUpdate);
|
events::GameUpdateEvent += MY_METHOD_HANDLER(AutoRun::OnGameUpdate);
|
||||||
}
|
}
|
||||||
@ -29,7 +27,6 @@ namespace cheat::feature
|
|||||||
{
|
{
|
||||||
ConfigWidget("Enable", f_Enabled);
|
ConfigWidget("Enable", f_Enabled);
|
||||||
ConfigWidget("Auto Run speed", f_Speed, 0.01f, 0.01f, 1000.0f, "Speed of character \n Not recommended going above 5");
|
ConfigWidget("Auto Run speed", f_Speed, 0.01f, 0.01f, 1000.0f, "Speed of character \n Not recommended going above 5");
|
||||||
ConfigWidget("Movement relative to camera", f_CameraRelative);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AutoRun::NeedStatusDraw() const
|
bool AutoRun::NeedStatusDraw() const
|
||||||
@ -47,7 +44,7 @@ namespace cheat::feature
|
|||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
void enableAutoRun(float speed, bool cameraRelative) {
|
void enableAutoRun(float speed) {
|
||||||
|
|
||||||
auto& manager = game::EntityManager::instance();
|
auto& manager = game::EntityManager::instance();
|
||||||
auto avatarEntity = manager.avatar();
|
auto avatarEntity = manager.avatar();
|
||||||
@ -55,11 +52,6 @@ namespace cheat::feature
|
|||||||
auto baseMove = avatarEntity->moveComponent();
|
auto baseMove = avatarEntity->moveComponent();
|
||||||
auto rigidBody = avatarEntity->rigidbody();
|
auto rigidBody = avatarEntity->rigidbody();
|
||||||
|
|
||||||
app::Rigidbody_set_detectCollisions(rigidBody, true, nullptr);
|
|
||||||
|
|
||||||
auto cameraEntity = game::Entity(reinterpret_cast<app::BaseEntity*>(manager.mainCamera()));
|
|
||||||
auto relativeEntity = cameraRelative ? &cameraEntity : avatarEntity;
|
|
||||||
|
|
||||||
if (baseMove == nullptr)
|
if (baseMove == nullptr)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -69,15 +61,13 @@ namespace cheat::feature
|
|||||||
if (renderer::IsInputLocked())
|
if (renderer::IsInputLocked())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
app::Vector3 dir = {};
|
auto cameraEntity = game::Entity(reinterpret_cast<app::BaseEntity*>(manager.mainCamera()));
|
||||||
dir = dir + relativeEntity->forward();
|
auto relativeEntity = &cameraEntity;
|
||||||
|
|
||||||
|
app::Vector3 dir = relativeEntity->forward();
|
||||||
app::Vector3 prevPos = avatarEntity->relativePosition();
|
app::Vector3 prevPos = avatarEntity->relativePosition();
|
||||||
if (IsVectorZero(prevPos))
|
|
||||||
return;
|
|
||||||
|
|
||||||
float deltaTime = app::Time_get_deltaTime(nullptr);
|
float deltaTime = app::Time_get_deltaTime(nullptr);
|
||||||
|
|
||||||
app::Vector3 newPos = prevPos + dir * speed * deltaTime;
|
app::Vector3 newPos = prevPos + dir * speed * deltaTime;
|
||||||
|
|
||||||
avatarEntity->setRelativePosition(newPos);
|
avatarEntity->setRelativePosition(newPos);
|
||||||
@ -86,8 +76,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();
|
||||||
bool cameraRelative = f_CameraRelative.value();
|
enableAutoRun(speed);
|
||||||
enableAutoRun(speed, cameraRelative);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -10,8 +10,7 @@ namespace cheat::feature
|
|||||||
public:
|
public:
|
||||||
config::Field<config::Toggle<Hotkey>> f_Enabled;
|
config::Field<config::Toggle<Hotkey>> f_Enabled;
|
||||||
config::Field<float> f_Speed;
|
config::Field<float> f_Speed;
|
||||||
config::Field<bool> f_CameraRelative;
|
|
||||||
|
|
||||||
static AutoRun& GetInstance();
|
static AutoRun& GetInstance();
|
||||||
|
|
||||||
const FeatureGUIInfo& GetGUIInfo() const override;
|
const FeatureGUIInfo& GetGUIInfo() const override;
|
||||||
@ -23,6 +22,6 @@ namespace cheat::feature
|
|||||||
void OnGameUpdate();
|
void OnGameUpdate();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
AutoRun();
|
AutoRun();
|
||||||
};
|
};
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user