mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-12 03:48:56 +00:00
Profile editor - Removed delay in module override
Modules - Streamline update rules and properly honor them in timed updates
This commit is contained in:
1 parent
2eb4d615ae
commit
447a497945
7 files changed
+127
-79
No files matched your search
@@ -91,13 +91,13 @@ namespace Artemis.Core.Modules
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether this module's activation was due to an override, can only be true if <see cref="IsActivated" /> is
|
||||
/// true
|
||||
/// <see langword="true" />
|
||||
/// </summary>
|
||||
public bool IsActivatedOverride { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether this module should update if <see cref="IsActivatedOverride" /> is true
|
||||
/// <para>Defaults to <c>true</c></para>
|
||||
/// Gets whether this module should update if <see cref="IsActivatedOverride" /> is <see langword="true" />
|
||||
/// <para>Defaults to <see langword="true" /></para>
|
||||
/// </summary>
|
||||
public bool UpdateDuringActivationOverride { get; protected set; } = true;
|
||||
|
||||
@@ -138,6 +138,11 @@ namespace Artemis.Core.Modules
|
||||
/// </summary>
|
||||
public IEnumerable<ModuleTab> ModuleTabs { get; protected set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether updating this module is currently allowed
|
||||
/// </summary>
|
||||
public bool IsUpdateAllowed => IsActivated && (UpdateDuringActivationOverride || !IsActivatedOverride);
|
||||
|
||||
/// <summary>
|
||||
/// Called each frame when the module must update
|
||||
/// </summary>
|
||||
@@ -189,7 +194,7 @@ namespace Artemis.Core.Modules
|
||||
|
||||
internal virtual void InternalUpdate(double deltaTime)
|
||||
{
|
||||
if (!IsActivatedOverride || UpdateDuringActivationOverride)
|
||||
if (IsUpdateAllowed)
|
||||
Update(deltaTime);
|
||||
}
|
||||
|
||||
|
||||
@@ -141,7 +141,7 @@ namespace Artemis.Core.Modules
|
||||
|
||||
internal override void InternalUpdate(double deltaTime)
|
||||
{
|
||||
if (!IsActivatedOverride || UpdateDuringActivationOverride)
|
||||
if (IsUpdateAllowed)
|
||||
Update(deltaTime);
|
||||
|
||||
lock (this)
|
||||
|
||||
Reference in new issue
Block a user