Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New Effect: Shunt Boost #3633

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions ChaosMod/ChaosMod.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@
<ClCompile Include="Effects\db\Misc\MiscNoSky.cpp" />
<ClCompile Include="Effects\db\Misc\MiscRampJam.cpp" />
<ClCompile Include="Effects\db\Misc\MiscFakeCrash.cpp" />
<ClCompile Include="Effects\db\Misc\MiscShuntBoost.cpp" />
<ClCompile Include="Effects\db\Misc\MiscSolidProps.cpp" />
<ClCompile Include="Effects\db\Misc\MiscSpinningProps.cpp" />
<ClCompile Include="Effects\db\Misc\MiscRandomWaypoint.cpp" />
Expand Down
47 changes: 47 additions & 0 deletions ChaosMod/Effects/db/Misc/MiscShuntBoost.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#include <stdafx.h>

#define PI 3.14159265

static void OnStart()
{
std::vector<Entity> entities;

for (Ped ped : GetAllPeds())
{
if (!IS_PED_IN_ANY_VEHICLE(ped, false))
entities.push_back(ped);
}

for (Vehicle veh : GetAllVehs())
{
entities.push_back(veh);
}

for (Object prop : GetAllProps())
{
entities.push_back(prop);
}

for (Entity ent : entities)
{
float rot = GET_ENTITY_HEADING(ent);
Vector3 velocity = GET_ENTITY_VELOCITY(ent);
float len = std::max(velocity.Length(), 3.f);
float y = sin((360 - rot) * PI / 180) * len * 2.5f;
float x = cos((360 - rot) * PI / 180) * len * 2.5f;
if (g_Random.GetRandomInt(0, 1))
x = -x;
else
y = -y;

SET_ENTITY_VELOCITY(ent, velocity.x + x, velocity.y + y, velocity.z);
}
}

// clang-format off
REGISTER_EFFECT(OnStart, nullptr, nullptr, EffectInfo
{
.Name = "Shunt Boost",
.Id = "misc_shunt_boost"
}
);
1 change: 1 addition & 0 deletions ConfigApp/Effects.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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_shunt_boost", new EffectInfo("Shunt Boost", EffectCategory.Misc) },
};
}
}
Loading