punish v6.8.18.0

This commit is contained in:
alydev 2025-10-09 07:47:19 +10:00
commit cfb4dea47e
316 changed files with 554088 additions and 0 deletions

View file

@ -0,0 +1,44 @@
using System;
namespace Questionable.Controller.Steps;
internal abstract class TaskExecutor<T> : ITaskExecutor where T : class, ITask
{
protected T Task { get; set; }
public InteractionProgressContext? ProgressContext { get; set; }
ITask ITaskExecutor.CurrentTask => Task;
public virtual bool WasInterrupted()
{
InteractionProgressContext progressContext = ProgressContext;
if (progressContext != null)
{
progressContext.Update();
return progressContext.WasInterrupted();
}
return false;
}
public Type GetTaskType()
{
return typeof(T);
}
protected abstract bool Start();
public bool Start(ITask task)
{
if (task is T task2)
{
Task = task2;
return Start();
}
throw new TaskException($"Unable to cast {task.GetType()} to {typeof(T)}");
}
public abstract ETaskResult Update();
public abstract bool ShouldInterruptOnDamage();
}