add StartDelay bool to actions (#33026)
* add StartDelay bool to actions * forgot summary
This commit is contained in:
@@ -213,14 +213,7 @@ namespace Content.Server.Ghost
|
||||
|
||||
private void OnMapInit(EntityUid uid, GhostComponent component, MapInitEvent args)
|
||||
{
|
||||
if (_actions.AddAction(uid, ref component.BooActionEntity, out var act, component.BooAction)
|
||||
&& act.UseDelay != null)
|
||||
{
|
||||
var start = _gameTiming.CurTime;
|
||||
var end = start + act.UseDelay.Value;
|
||||
_actions.SetCooldown(component.BooActionEntity.Value, start, end);
|
||||
}
|
||||
|
||||
_actions.AddAction(uid, ref component.BooActionEntity, component.BooAction);
|
||||
_actions.AddAction(uid, ref component.ToggleGhostHearingActionEntity, component.ToggleGhostHearingAction);
|
||||
_actions.AddAction(uid, ref component.ToggleLightingActionEntity, component.ToggleLightingAction);
|
||||
_actions.AddAction(uid, ref component.ToggleFoVActionEntity, component.ToggleFoVAction);
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -280,6 +280,8 @@
|
||||
checkCanInteract: false
|
||||
checkConsciousness: false
|
||||
event: !type:WakeActionEvent
|
||||
startDelay: true
|
||||
useDelay: 2
|
||||
|
||||
- type: entity
|
||||
id: ActionActivateHonkImplant
|
||||
|
||||
@@ -79,6 +79,7 @@
|
||||
icon: Interface/Actions/scream.png
|
||||
checkCanInteract: false
|
||||
event: !type:BooActionEvent
|
||||
startDelay: true
|
||||
useDelay: 120
|
||||
|
||||
- type: entity
|
||||
|
||||
Reference in New Issue
Block a user