Closed metalgearsloth closed 2 years ago
Remember that if you want to properly serialize this, you have to account for the fact that the CurTime will be different when deserializing, so the NextTick time will have to be offset by the MapLoader. The best option I can think of is to serialize the value as the remaining time, so that CurTime can just be added to it to calculate NextTime again when loading.
Adding a typeserializer for times that need offsetting should be easy enough.
One of the difficulties with robust toolbox is that pausing isn't global and is map based. This means some entities may be paused and others not and we're starting to use pausing more and more over time (e.g. SS14 has 2 out of 3 basic maps paused).
This is handled in a few different ways in SS14:
The best way to do this would be to use timespans but instead have the time difference on the entity unpaused event and then systems manually add the time to the relevant entity. This means we can avoid dirtying the component as much as possible, only needing to do it when the timer starts / ends / the entity is unpaused. For example:
MetadataSystem will also need a method to get the amount of time an entity has been paused. This is because some stuff like UI will need to know the actual time difference (for example interaction cooldown) to know what to subtract.
Also I think pausing on the client still isn't synced correctly in all instances so that may also need fixing first.