From 17de92a5ab965f5ef9627d14649e2777dec8d5b4 Mon Sep 17 00:00:00 2001 From: Hamish <134974775+Veloscocity@users.noreply.github.com> Date: Tue, 12 Sep 2023 07:04:04 -0400 Subject: [PATCH 1/3] New Effect: Grounded --- ChaosMod/Effects/db/Misc/MiscGrounded.cpp | 37 +++++++++++++++++++++++ ConfigApp/Effects.cs | 1 + 2 files changed, 38 insertions(+) create mode 100644 ChaosMod/Effects/db/Misc/MiscGrounded.cpp diff --git a/ChaosMod/Effects/db/Misc/MiscGrounded.cpp b/ChaosMod/Effects/db/Misc/MiscGrounded.cpp new file mode 100644 index 000000000..c4e3ac85e --- /dev/null +++ b/ChaosMod/Effects/db/Misc/MiscGrounded.cpp @@ -0,0 +1,37 @@ +#include + +static void OnTick() +{ + std::list entities; + for (auto ped : GetAllPeds()) + { + if (!IS_PED_IN_ANY_VEHICLE(ped, false)) + entities.push_back(ped); + } + for (auto veh : GetAllVehs()) + { + entities.push_back(veh); + } + + for (auto entity : entities) + { + if (!DOES_ENTITY_EXIST(entity)) + { + continue; + } + + Vector3 vel = GET_ENTITY_VELOCITY(entity); + + if (GET_ENTITY_HEIGHT_ABOVE_GROUND(entity) > 2.f && vel.z > -25.f) + SET_ENTITY_VELOCITY(entity, vel.x, vel.y, std::min(vel.z * 0.66f, vel.z - 1.33f)); + } +} + +// clang-format off +REGISTER_EFFECT(nullptr, nullptr, OnTick, EffectInfo + { + .Name = "Grounded", + .Id = "misc_grounded", + .IsTimed = true, + } +); \ No newline at end of file diff --git a/ConfigApp/Effects.cs b/ConfigApp/Effects.cs index 09d19fa67..821526a47 100644 --- a/ConfigApp/Effects.cs +++ b/ConfigApp/Effects.cs @@ -411,6 +411,7 @@ public enum EffectTimedType { "misc_fakeuturn", new EffectInfo("Fake U-Turn", EffectCategory.Misc) }, { "misc_esp", new EffectInfo("ESP", EffectCategory.Misc, true) }, { "screen_bouncyradar", new EffectInfo("Bouncy Radar", EffectCategory.Screen, true) }, + { "misc_grounded", new EffectInfo("Grounded", EffectCategory.Misc, true) }, }; } } From c8831abf91e7050efd2f39b2340e829658a2c7a3 Mon Sep 17 00:00:00 2001 From: Veloscocity Date: Wed, 25 Oct 2023 23:53:39 -0400 Subject: [PATCH 2/3] better grounded --- ChaosMod/Effects/db/Misc/MiscGrounded.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/ChaosMod/Effects/db/Misc/MiscGrounded.cpp b/ChaosMod/Effects/db/Misc/MiscGrounded.cpp index c4e3ac85e..afa44f65c 100644 --- a/ChaosMod/Effects/db/Misc/MiscGrounded.cpp +++ b/ChaosMod/Effects/db/Misc/MiscGrounded.cpp @@ -21,9 +21,11 @@ static void OnTick() } Vector3 vel = GET_ENTITY_VELOCITY(entity); - - if (GET_ENTITY_HEIGHT_ABOVE_GROUND(entity) > 2.f && vel.z > -25.f) - SET_ENTITY_VELOCITY(entity, vel.x, vel.y, std::min(vel.z * 0.66f, vel.z - 1.33f)); + float h = GET_ENTITY_HEIGHT_ABOVE_GROUND(entity); + if(h > 2.f && vel.z > -h/2) + SET_ENTITY_VELOCITY(entity, vel.x, vel.y, -h); + else if (h > 1.f && vel.z > 0) + SET_ENTITY_VELOCITY(entity, vel.x, vel.y, -0.1f); } } From f5cd36bcc12a28f5f4ba8c0a1c3f5d05505a270d Mon Sep 17 00:00:00 2001 From: Veloscocity Date: Thu, 26 Oct 2023 00:05:56 -0400 Subject: [PATCH 3/3] clang --- ChaosMod/ChaosMod.vcxproj | 1 + ChaosMod/Effects/db/Misc/MiscGrounded.cpp | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/ChaosMod/ChaosMod.vcxproj b/ChaosMod/ChaosMod.vcxproj index 6d21948f5..f73dbd549 100644 --- a/ChaosMod/ChaosMod.vcxproj +++ b/ChaosMod/ChaosMod.vcxproj @@ -108,6 +108,7 @@ + diff --git a/ChaosMod/Effects/db/Misc/MiscGrounded.cpp b/ChaosMod/Effects/db/Misc/MiscGrounded.cpp index afa44f65c..10801bf0f 100644 --- a/ChaosMod/Effects/db/Misc/MiscGrounded.cpp +++ b/ChaosMod/Effects/db/Misc/MiscGrounded.cpp @@ -21,8 +21,8 @@ static void OnTick() } Vector3 vel = GET_ENTITY_VELOCITY(entity); - float h = GET_ENTITY_HEIGHT_ABOVE_GROUND(entity); - if(h > 2.f && vel.z > -h/2) + float h = GET_ENTITY_HEIGHT_ABOVE_GROUND(entity); + if (h > 2.f && vel.z > -h / 2) SET_ENTITY_VELOCITY(entity, vel.x, vel.y, -h); else if (h > 1.f && vel.z > 0) SET_ENTITY_VELOCITY(entity, vel.x, vel.y, -0.1f);