Expand UseDelay to support multiple delays per entity; fix bible healing and bag pickup (#27234)

* Upgraded UseDelay to support multiple delays per entity

* Implement secondary delay for bibles.
Also some improvements to make it work nicely.

* Documentation is good

* Reserve the previous change; now Storage uses the special ID and Bible uses the default.

* .0

* Added VV support to UseDelayInfo

* Serialize better

* No register, just setlength
This commit is contained in:
Tayrtahn
2024-04-25 22:25:52 -04:00
committed by GitHub
parent 0aee198adf
commit b292905216
7 changed files with 193 additions and 62 deletions

View File

@@ -22,6 +22,7 @@ public sealed class HandsUIController : UIController, IOnStateEntered<GameplaySt
[Dependency] private readonly IPlayerManager _player = default!;
[UISystemDependency] private readonly HandsSystem _handsSystem = default!;
[UISystemDependency] private readonly UseDelaySystem _useDelay = default!;
private readonly List<HandsContainer> _handsContainers = new();
private readonly Dictionary<string, int> _handContainerIndices = new();
@@ -450,15 +451,15 @@ public sealed class HandsUIController : UIController, IOnStateEntered<GameplaySt
foreach (var hand in container.GetButtons())
{
if (!_entities.TryGetComponent(hand.Entity, out UseDelayComponent? useDelay) ||
useDelay is not { DelayStartTime: var start, DelayEndTime: var end })
if (!_entities.TryGetComponent(hand.Entity, out UseDelayComponent? useDelay))
{
hand.CooldownDisplay.Visible = false;
continue;
}
var delay = _useDelay.GetLastEndingDelay((hand.Entity.Value, useDelay));
hand.CooldownDisplay.Visible = true;
hand.CooldownDisplay.FromTime(start, end);
hand.CooldownDisplay.FromTime(delay.StartTime, delay.EndTime);
}
}
}