Skip to content

Commit

Permalink
added multipliers for art and code unit progress calculations
Browse files Browse the repository at this point in the history
  • Loading branch information
mladjo97 committed Jul 31, 2019
1 parent 3e11ef4 commit c3c10d3
Showing 1 changed file with 11 additions and 12 deletions.
23 changes: 11 additions & 12 deletions AutoEnder/AutoEnderBehaviour.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,15 @@ namespace AutoEnder
public class AutoEnderBehaviour : ModBehaviour
{
private bool _isActive = false;
private const float _artDifference = 1.36f;
private readonly Timer _timer = new Timer(1000);
private readonly Timer _timer = new Timer(250);

public override void OnActivate()
{
Console.LogInfo("Activated Auto-Ender by github.com/mladjo97");
_isActive = true;

/*
* Set the timer to be invoked for project update
* Set the timer to be invoked for project update
*/
_timer.Elapsed += UpdateProjects;
_timer.AutoReset = true;
Expand Down Expand Up @@ -53,8 +52,7 @@ private void UpdateProjects(object sender, ElapsedEventArgs e)
designDocument.PromoteAction();
}
}



/*
* Auto-end (skip) the alpha phase for contract projects
*/
Expand All @@ -64,17 +62,18 @@ private void UpdateProjects(object sender, ElapsedEventArgs e)
{
if (!alpha.InBeta && !alpha.InDelay && alpha.contract != null)
{
if (alpha.CodeProgress >= alpha.contract.CodeUnits && alpha.ArtProgress >= alpha.contract.ArtUnits)
{
alpha.PromoteAction();
}
/*
* Because art asset contracts don't have any code requirements
*/
else if (alpha.contract.CodeUnits < 1 && alpha.ArtProgress >= (alpha.contract.ArtUnits - _artDifference))
* There are different multipliers applied on more complex projects
* so there are different calculations for unit progress
*/
float actualCodeProgress = alpha.CodeProgress * alpha.CodeDevTime;
float actualArtProgress = alpha.ArtProgress * alpha.ArtDevTime;

if (actualCodeProgress >= alpha.contract.CodeUnits && actualArtProgress >= alpha.contract.ArtUnits)
{
alpha.PromoteAction();
}

}
}

Expand Down

0 comments on commit c3c10d3

Please sign in to comment.