Persist entity session state in checkpoints
This commit is contained in:
parent
4b8e622e75
commit
6bcf6444b9
8 changed files with 191 additions and 8 deletions
|
|
@ -765,6 +765,15 @@ public class ActionGameManager : MonoBehaviour
|
|||
PositionZ = entity.Position.z,
|
||||
DirectionX = entity.Direction.x,
|
||||
DirectionY = entity.Direction.y,
|
||||
VelocityX = entity.Velocity.x,
|
||||
VelocityY = entity.Velocity.y,
|
||||
TargetEntityIndex = entity.Target?.Value == null ? -1 : zone.Entities.IndexOf(entity.Target.Value),
|
||||
IsActive = entity.Active,
|
||||
HeatsinksEnabled = entity.HeatsinksEnabled,
|
||||
OverrideShutdown = entity.OverrideShutdown,
|
||||
TractorPower = entity.TractorPower,
|
||||
Heatstroke = entity.Heatstroke,
|
||||
Hypothermia = entity.Hypothermia,
|
||||
CorporationLegacyId = entity.Faction?.ID.ToString("D") ?? "",
|
||||
HullItemDefinitionLegacyId = entity.Hull?.ItemId == Guid.Empty ? "" : entity.Hull.ItemId.ToString("D"),
|
||||
Equipment = ProjectEquippedSlots(entity.Equipment),
|
||||
|
|
@ -777,10 +786,24 @@ public class ActionGameManager : MonoBehaviour
|
|||
WeaponGroups = entity.WeaponGroups?
|
||||
.Select(group => (IReadOnlyList<int>)group.items.Select(item => entity.Equipment.IndexOf(item)).Where(index => index >= 0).ToArray())
|
||||
.ToArray() ?? Array.Empty<IReadOnlyList<int>>(),
|
||||
StatGrids = ProjectEntityStatGrids(entity)
|
||||
StatGrids = ProjectEntityStatGrids(entity),
|
||||
ActiveConsumables = ProjectActiveConsumables(entity)
|
||||
};
|
||||
}
|
||||
|
||||
private static AetheriaRuntimeActiveConsumableCommit[] ProjectActiveConsumables(Entity entity)
|
||||
{
|
||||
return entity.ActiveConsumables?
|
||||
.Select(effect => new AetheriaRuntimeActiveConsumableCommit
|
||||
{
|
||||
ItemDefinitionLegacyId = effect.Item?.ItemId == Guid.Empty ? "" : effect.Item.ItemId.ToString("D"),
|
||||
Quality = effect.Item?.Quality ?? 1.0,
|
||||
RemainingDuration = effect.RemainingDuration,
|
||||
Duration = effect.Duration
|
||||
})
|
||||
.ToArray() ?? Array.Empty<AetheriaRuntimeActiveConsumableCommit>();
|
||||
}
|
||||
|
||||
private static AetheriaRuntimeEntityStatGridCommit[] ProjectEntityStatGrids(Entity entity)
|
||||
{
|
||||
return new[]
|
||||
|
|
|
|||
|
|
@ -67,6 +67,7 @@ public abstract class Entity
|
|||
private List<Radiator> _heatsinks = new List<Radiator>();
|
||||
|
||||
private List<ConsumableItemEffect> _activeConsumables = new List<ConsumableItemEffect>();
|
||||
public IReadOnlyList<ConsumableItemEffect> ActiveConsumables => _activeConsumables;
|
||||
|
||||
protected bool _active;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue