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: Cocktail shaker #3569

Merged
merged 6 commits into from
Sep 30, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
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 @@ -103,6 +103,7 @@
<ClCompile Include="Effects\db\Misc\MiscAirstrike.cpp" />
<ClCompile Include="Effects\db\Misc\MiscBlackHole.cpp" />
<ClCompile Include="Effects\db\Misc\MiscBlackout.cpp" />
<ClCompile Include="Effects\db\Misc\MiscCocktail.cpp" />
<ClCompile Include="Effects\db\Misc\MiscEarthquake.cpp" />
<ClCompile Include="Effects\db\Misc\MiscFpsLimit.cpp" />
<ClCompile Include="Effects\db\Misc\MiscGhostWorld.cpp" />
Expand Down
47 changes: 47 additions & 0 deletions ChaosMod/Effects/db/Misc/MiscCocktail.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
//
// effect by veloscocity
//

#include <math.h>
#include <stdafx.h>
#include "Memory/Gravity.h"

#define PI 3.14159265

static float x, y;

static DWORD lastTick = 0;
static void OnStart()
{
Ped playerPed = PLAYER_PED_ID();
float rot = GET_ENTITY_HEADING(IS_PED_IN_ANY_VEHICLE(playerPed, false) ? GET_VEHICLE_PED_IS_IN(playerPed, false) : playerPed); //Shake perpendicular to the player
x = sin((360 - rot) * PI / 180) * 1.33;
y = -cos((360 - rot) * PI / 180) * 1.33;
}
static void OnTick()
{
DWORD curTick = GetTickCount();
if (lastTick < curTick - 500)
{
lastTick = curTick;
x = -x;
y = -y;
}

for (auto object : GetAllProps())
Memory::ApplyForceToEntityCenterOfMass(object, 1, y, x, 0, false, false, true, false);

for (auto veh : GetAllVehs())
Memory::ApplyForceToEntityCenterOfMass(veh, 1, y, x, 0, false, false, true, false);
Veloscocity marked this conversation as resolved.
Show resolved Hide resolved
}

// clang-format off
REGISTER_EFFECT(OnStart, nullptr, OnTick, EffectInfo
{
.Name = "Cocktail Shaker",
.Id = "cocktail_shaker",
.IsTimed = true,
.IsShortDuration = true,
Veloscocity marked this conversation as resolved.
Show resolved Hide resolved
.EffectCategory = EffectCategory::Gravity,
}
);
1 change: 1 addition & 0 deletions ConfigApp/Effects.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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) },
{ "cocktail_shaker", new EffectInfo("Cocktail Shaker", EffectCategory.Misc, true) },
pongo1231 marked this conversation as resolved.
Show resolved Hide resolved
};
}
}