Skip to content

Commit

Permalink
Add "Notarget" effect
Browse files Browse the repository at this point in the history
  • Loading branch information
ScriptedSnark committed Mar 31, 2024
1 parent cf0651f commit 1cd58d4
Show file tree
Hide file tree
Showing 7 changed files with 93 additions and 4 deletions.
8 changes: 4 additions & 4 deletions GSChaos/CChaos.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -260,10 +260,6 @@ void CChaos::FeatureInit()
RegisterChaosFeature<CFeatureNuke>();
RegisterChaosFeature<CFeaturePlusDuck>();
RegisterChaosFeature<CFeatureMonsterWorldspawn>();

if (!g_bEncrypted && !g_bPreSteamPipe)
RegisterChaosFeature<CFeatureSpawnFastrun>();

RegisterChaosFeature<CFeatureWorldHallucination>();
RegisterChaosFeature<CFeatureGiveOneHP>();
RegisterChaosFeature<CFeatureTakeOneHP>();
Expand All @@ -275,8 +271,12 @@ void CChaos::FeatureInit()
RegisterChaosFeature<CFeatureSqueakShephard>();
RegisterChaosFeature<CFeatureSqueakShephards>();
RegisterChaosFeature<CFeatureBoost>();
RegisterChaosFeature<CFeatureNotarget>();
RegisterChaosFeature<CFeatureNice>();

if (!g_bEncrypted && !g_bPreSteamPipe)
RegisterChaosFeature<CFeatureSpawnFastrun>();

RegisterChaosFeature<CFeatureCombineEffects>(); // must be last!!!

for (CChaosFeature* i : gChaosFeatures)
Expand Down
40 changes: 40 additions & 0 deletions GSChaos/CFeatureNotarget.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#include "includes.h"

void CFeatureNotarget::Init()
{
CChaosFeature::Init();
}

void CFeatureNotarget::ActivateFeature()
{
CChaosFeature::ActivateFeature();
(*sv_player)->v.flags |= FL_NOTARGET;
}

void CFeatureNotarget::DeactivateFeature()
{
CChaosFeature::DeactivateFeature();
(*sv_player)->v.flags &= ~FL_NOTARGET;
}

void CFeatureNotarget::OnFrame(double time)
{
if (!IsActive())
return;

if (!(*sv_player))
return;

(*sv_player)->v.flags |= FL_NOTARGET;
}

void CFeatureNotarget::ResetStates()
{
if ((*sv_player)->v.flags & FL_NOTARGET)
(*sv_player)->v.flags &= ~FL_NOTARGET;
}

const char* CFeatureNotarget::GetFeatureName()
{
return "Notarget";
}
39 changes: 39 additions & 0 deletions GSChaos/CFeatureNotarget.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/**
* Copyright - ScriptedSnark, 2024.
* CFeatureNotarget.h
*
* Project (GSChaos) header file
* Authors: ScriptedSnark.
* Do not delete this comment block. Respect others' work!
*/

#ifdef CFEATURENOTARGET_H_RECURSE_GUARD
#error Recursive header files inclusion detected in CFeatureNotarget.h
#else //CFEATURENOTARGET_H_RECURSE_GUARD

#define CFEATURENOTARGET_H_RECURSE_GUARD

#ifndef CFEATURENOTARGET_H_GUARD
#define CFEATURENOTARGET_H_GUARD
#pragma once

#ifdef __cplusplus

class CFeatureNotarget : public CChaosFeature
{
void Init() override;
void ActivateFeature() override;
void DeactivateFeature() override;
void OnFrame(double time) override;
const char* GetFeatureName() override;
void ResetStates() override;
};

#else //!__cplusplus
#error C++ compiler required to compile CFeatureNotarget.h
#endif //__cplusplus

#endif //CFEATURENOTARGET_H_GUARD

#undef CFEATURENOTARGET_H_RECURSE_GUARD
#endif //CFEATURENOTARGET_H_RECURSE_GUARD
2 changes: 2 additions & 0 deletions GSChaos/GSChaos.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@
<ClCompile Include="CFeatureNoclip.cpp" />
<ClCompile Include="CFeatureNodeGraphRebuilding.cpp" />
<ClCompile Include="CFeatureNoHUD.cpp" />
<ClCompile Include="CFeatureNotarget.cpp" />
<ClCompile Include="CFeatureNothing.cpp" />
<ClCompile Include="CFeatureFly.cpp" />
<ClCompile Include="CFeatureForgotCSS.cpp" />
Expand Down Expand Up @@ -277,6 +278,7 @@
<ClInclude Include="CFeatureNoclip.h" />
<ClInclude Include="CFeatureNodeGraphRebuilding.h" />
<ClInclude Include="CFeatureNoHUD.h" />
<ClInclude Include="CFeatureNotarget.h" />
<ClInclude Include="CFeatureNothing.h" />
<ClInclude Include="CFeatureFly.h" />
<ClInclude Include="CFeatureForgotCSS.h" />
Expand Down
6 changes: 6 additions & 0 deletions GSChaos/GSChaos.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,9 @@
<ClCompile Include="..\external\StackWalker.cpp">
<Filter>StackWalker</Filter>
</ClCompile>
<ClCompile Include="CFeatureNotarget.cpp">
<Filter>Effects</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="includes.h" />
Expand Down Expand Up @@ -667,6 +670,9 @@
<ClInclude Include="..\external\StackWalker.h">
<Filter>StackWalker</Filter>
</ClInclude>
<ClInclude Include="CFeatureNotarget.h">
<Filter>Effects</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<Filter Include="Hooking">
Expand Down
1 change: 1 addition & 0 deletions GSChaos/includes.h
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ extern bool g_bEncrypted;
#include "CFeatureSqueakShephard.h"
#include "CFeatureSqueakShephards.h"
#include "CFeatureBoost.h"
#include "CFeatureNotarget.h"

#include "CFeatureCombineEffects.h"
//========================
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ If you don't want to play with this feature, rename `twitch.ini` to `twitch_DISA
> Squeak Shephard Ambush
> Boost
> Nice
> Notarget
> Combine Effects ( 3 in 1 )
```

Expand Down

0 comments on commit 1cd58d4

Please sign in to comment.