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 new file mode 100644 index 000000000..10801bf0f --- /dev/null +++ b/ChaosMod/Effects/db/Misc/MiscGrounded.cpp @@ -0,0 +1,39 @@ +#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); + 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); + } +} + +// 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 b03e5efe6..85828c5ad 100644 --- a/ConfigApp/Effects.cs +++ b/ConfigApp/Effects.cs @@ -415,6 +415,7 @@ public enum EffectTimedType { "screen_realfp", new EffectInfo("Real First Person", EffectCategory.Screen, true) }, { "screen_hueshift", new EffectInfo("Hue Shift", EffectCategory.Screen, true) }, { "player_copyforce", new EffectInfo("Use The Force", EffectCategory.Player, true, true) }, + { "misc_grounded", new EffectInfo("Grounded", EffectCategory.Misc, true) }, }; } }