-
Notifications
You must be signed in to change notification settings - Fork 105
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added effects "Time Based Timer" and "Distance Based Timer"
- Loading branch information
Showing
9 changed files
with
160 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
ChaosMod/Effects/Condition/ConditionUsingDistanceTimer.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#include <stdafx.h> | ||
|
||
#include "Components/EffectDispatchTimer.h" | ||
#include "Effects/Condition/EffectCondition.h" | ||
|
||
static bool OnCondition() | ||
{ | ||
return ComponentExists<EffectDispatchTimer>() && GetComponent<EffectDispatchTimer>()->IsUsingDistanceBasedDispatch(); | ||
} | ||
|
||
REGISTER_EFFECT_CONDITION(EffectConditionType::UsingDistanceTimer, OnCondition); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#include <stdafx.h> | ||
|
||
#include "Components/EffectDispatchTimer.h" | ||
#include "Effects/Condition/EffectCondition.h" | ||
|
||
static bool OnCondition() | ||
{ | ||
return ComponentExists<EffectDispatchTimer>() && !GetComponent<EffectDispatchTimer>()->IsUsingDistanceBasedDispatch(); | ||
} | ||
|
||
REGISTER_EFFECT_CONDITION(EffectConditionType::UsingTimeTimer, OnCondition); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
/* | ||
Effects by Regynate | ||
*/ | ||
|
||
#include <stdafx.h> | ||
|
||
#include "Components/MetaModifiers.h" | ||
#include "Effects/Register/RegisterEffect.h" | ||
#include <Components/EffectDispatchTimer.h> | ||
|
||
static void OnStop() | ||
{ | ||
if (ComponentExists<MetaModifiers>()) | ||
GetComponent<MetaModifiers>()->OverrideTimerMode = TimerMode::None; | ||
GetComponent<MetaModifiers>()->DistanceToDispatchEffect = 0; | ||
GetComponent<MetaModifiers>()->TimeToDispatchEffect = 0; | ||
if (ComponentExists<EffectDispatchTimer>()) | ||
GetComponent<EffectDispatchTimer>()->ResetSavedPosition(); | ||
} | ||
|
||
static void OnTick_Time() | ||
{ | ||
if (ComponentExists<MetaModifiers>()) | ||
GetComponent<MetaModifiers>()->OverrideTimerMode = TimerMode::Time; | ||
|
||
int defaultDistance = ComponentExists<EffectDispatchTimer>() | ||
? GetComponent<EffectDispatchTimer>()->GetDefaultEffectSpawnDistance() | ||
: 0; | ||
GetComponent<MetaModifiers>()->TimeToDispatchEffect = defaultDistance ? defaultDistance / 10 : 30; | ||
} | ||
|
||
// clang-format off | ||
REGISTER_EFFECT(nullptr, OnStop, OnTick_Time, | ||
{ | ||
.Name = "Time Based Timer", | ||
.Id = "meta_timer_timebased", | ||
.IsTimed = true, | ||
.IncompatibleWith = { "meta_timer_distancebased" }, | ||
.ExecutionType = EffectExecutionType::Meta, | ||
.ConditionType = EffectConditionType::UsingDistanceTimer | ||
} | ||
); | ||
// clang-format on | ||
|
||
static void OnTick_Distance() | ||
{ | ||
if (ComponentExists<MetaModifiers>()) | ||
GetComponent<MetaModifiers>()->OverrideTimerMode = TimerMode::Distance; | ||
int defaultTime = | ||
ComponentExists<EffectDispatchTimer>() ? GetComponent<EffectDispatchTimer>()->GetDefaultEffectSpawnTime() : 0; | ||
GetComponent<MetaModifiers>()->DistanceToDispatchEffect = defaultTime ? defaultTime * 10 : 300; | ||
} | ||
|
||
static void OnStart_Distance() | ||
{ | ||
if (ComponentExists<EffectDispatchTimer>()) | ||
GetComponent<EffectDispatchTimer>()->ResetSavedPosition(); | ||
} | ||
|
||
// clang-format off | ||
REGISTER_EFFECT(OnStart_Distance, OnStop, OnTick_Distance, | ||
{ | ||
.Name = "Distance Based Timer", | ||
.Id = "meta_timer_distancebased", | ||
.IsTimed = true, | ||
.IncompatibleWith = { "meta_timer_timebased" }, | ||
.ExecutionType = EffectExecutionType::Meta, | ||
.ConditionType = EffectConditionType::UsingTimeTimer | ||
} | ||
); | ||
// clang-format on |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
enum class TimerMode | ||
{ | ||
None, | ||
Time, | ||
Distance | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters