Skip to content

Commit

Permalink
New Effect: Reckless Drivers
Browse files Browse the repository at this point in the history
  • Loading branch information
Veloscocity committed Nov 15, 2023
1 parent ff54810 commit 0c79b91
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 2 deletions.
1 change: 1 addition & 0 deletions ChaosMod/ChaosMod.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@
<ClCompile Include="Effects\db\Peds\PedsMinions.cpp" />
<ClCompile Include="Effects\db\Peds\PedsSpawnAngryJimmy.cpp" />
<ClCompile Include="Effects\db\Peds\PedsSpawnRoastingLamar.cpp" />
<ClCompile Include="Effects\db\Peds\PedsReckless.cpp" />
<ClCompile Include="Effects\db\Player\PlayerCopyForce.cpp" />
<ClCompile Include="Effects\db\Player\PlayerAFK.cpp" />
<ClCompile Include="Effects\db\Peds\PedsReflectiveDamage.cpp" />
Expand Down
3 changes: 2 additions & 1 deletion ChaosMod/Effects/db/Peds/PedsNearbyFlee.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ static void OnStart()
REGISTER_EFFECT(OnStart, nullptr, nullptr, EffectInfo
{
.Name = "All Nearby Peds Are Fleeing",
.Id = "peds_flee"
.Id = "peds_flee",
.IncompatibleWith = { "peds_reckless" }
}
);
38 changes: 38 additions & 0 deletions ChaosMod/Effects/db/Peds/PedsReckless.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#include <stdafx.h>

static std::unordered_map<Ped, bool> crazyPeds;

static void OnTick()
{
for (auto ped : GetAllPeds())
{
if (ped == PLAYER_PED_ID() || !IS_PED_IN_ANY_VEHICLE(ped, false) || crazyPeds[ped])
continue;

Vector3 vec = GET_ENTITY_COORDS(ped, false);
TASK_SMART_FLEE_COORD(ped, vec.x, vec.y, vec.z, 9999.f, -1, false, false);
// TASK_VEHICLE_DRIVE_WANDER(ped, veh, 100.f, 0x423C0B6C);

SET_DRIVE_TASK_DRIVING_STYLE(ped, 0x423C0A6C);
SET_DRIVE_TASK_MAX_CRUISE_SPEED(ped, 200.f);
SET_DRIVER_ABILITY(ped, 1.f);
SET_DRIVER_AGGRESSIVENESS(ped, 1.f);

crazyPeds[ped] = true;
}
}

static void OnStop()
{
crazyPeds.clear();
}

// clang-format off
REGISTER_EFFECT(nullptr, OnStop, OnTick, EffectInfo
{
.Name = "Reckless Drivers",
.Id = "peds_reckless",
.IsTimed = true,
.IncompatibleWith = { "traffic_gtao" }
}
);
3 changes: 2 additions & 1 deletion ChaosMod/Effects/db/Vehs/VehsGTAOTraffic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ REGISTER_EFFECT(nullptr, nullptr, OnTick, EffectInfo
{
.Name = "Traffic Magnet",
.Id = "traffic_gtao",
.IsTimed = true
.IsTimed = true,
.IncompatibleWith = { "peds_reckless" }
}
);
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) },
{ "peds_reckless", new EffectInfo("Reckless Drivers", EffectCategory.Peds, true) },
};
}
}

0 comments on commit 0c79b91

Please sign in to comment.