add StartDelay bool to actions (#33026)
* add StartDelay bool to actions * forgot summary
This commit is contained in:
@@ -76,6 +76,11 @@ public abstract partial class BaseActionComponent : Component
|
||||
// TODO serialization
|
||||
public (TimeSpan Start, TimeSpan End)? Cooldown;
|
||||
|
||||
/// <summary>
|
||||
/// If true, the action will have an initial cooldown applied upon addition.
|
||||
/// </summary>
|
||||
[DataField] public bool StartDelay = false;
|
||||
|
||||
/// <summary>
|
||||
/// Time interval between action uses.
|
||||
/// </summary>
|
||||
|
||||
@@ -813,6 +813,9 @@ public abstract class SharedActionsSystem : EntitySystem
|
||||
if (action.AttachedEntity != null)
|
||||
RemoveAction(action.AttachedEntity.Value, actionId, action: action);
|
||||
|
||||
if (action.StartDelay && action.UseDelay != null)
|
||||
SetCooldown(actionId, action.UseDelay.Value);
|
||||
|
||||
DebugTools.AssertOwner(performer, comp);
|
||||
comp ??= EnsureComp<ActionsComponent>(performer);
|
||||
action.AttachedEntity = performer;
|
||||
|
||||
@@ -130,9 +130,6 @@ public sealed partial class SleepingSystem : EntitySystem
|
||||
RaiseLocalEvent(ent, ref ev);
|
||||
_blindableSystem.UpdateIsBlind(ent.Owner);
|
||||
_actionsSystem.AddAction(ent, ref ent.Comp.WakeAction, WakeActionId, ent);
|
||||
|
||||
// TODO remove hardcoded time.
|
||||
_actionsSystem.SetCooldown(ent.Comp.WakeAction, _gameTiming.CurTime, _gameTiming.CurTime + TimeSpan.FromSeconds(2f));
|
||||
}
|
||||
|
||||
private void OnSpeakAttempt(Entity<SleepingComponent> ent, ref SpeakAttemptEvent args)
|
||||
|
||||
Reference in New Issue
Block a user