Preserve generated equipment rotation
This commit is contained in:
parent
f8460a3a05
commit
01f0d69b8d
15 changed files with 78 additions and 20 deletions
|
|
@ -56,7 +56,7 @@ namespace GameCult.Aetheria.State.Verse
|
|||
|
||||
private static AetheriaRuntimeLoadoutItemSlotCommit Clone(AetheriaRuntimeLoadoutItemSlotCommit source, int quantity) => new()
|
||||
{
|
||||
X = source.X, Y = source.Y,
|
||||
X = source.X, Y = source.Y, Rotation = source.Rotation ?? "None",
|
||||
Item = new AetheriaRuntimeLoadoutItemCommit
|
||||
{
|
||||
ItemKey = source.Item.ItemKey, Quality = source.Item.Quality, Durability = source.Item.Durability,
|
||||
|
|
|
|||
|
|
@ -845,16 +845,22 @@ namespace GameCult.Aetheria.State.Verse
|
|||
[MessagePackObject(true)]
|
||||
public sealed class AetheriaRuntimeLoadoutItemSlotSnapshot
|
||||
{
|
||||
public AetheriaRuntimeLoadoutItemSlotSnapshot(int x, int y, AetheriaRuntimeLoadoutItemSnapshot item)
|
||||
public AetheriaRuntimeLoadoutItemSlotSnapshot(
|
||||
int x,
|
||||
int y,
|
||||
AetheriaRuntimeLoadoutItemSnapshot item,
|
||||
string rotation = "None")
|
||||
{
|
||||
X = x;
|
||||
Y = y;
|
||||
Item = item;
|
||||
Rotation = rotation ?? "None";
|
||||
}
|
||||
|
||||
public int X { get; set; }
|
||||
public int Y { get; set; }
|
||||
public AetheriaRuntimeLoadoutItemSnapshot Item { get; set; }
|
||||
public string Rotation { get; set; }
|
||||
}
|
||||
|
||||
[MessagePackObject(true)]
|
||||
|
|
@ -1017,7 +1023,8 @@ namespace GameCult.Aetheria.State.Verse
|
|||
int quantity,
|
||||
bool enabled,
|
||||
bool overrideShutdown,
|
||||
double temperature = 0)
|
||||
double temperature = 0,
|
||||
string rotation = "None")
|
||||
{
|
||||
X = x;
|
||||
Y = y;
|
||||
|
|
@ -1028,6 +1035,7 @@ namespace GameCult.Aetheria.State.Verse
|
|||
Enabled = enabled;
|
||||
OverrideShutdown = overrideShutdown;
|
||||
Temperature = temperature;
|
||||
Rotation = rotation ?? "None";
|
||||
}
|
||||
|
||||
public int X { get; set; }
|
||||
|
|
@ -1039,6 +1047,7 @@ namespace GameCult.Aetheria.State.Verse
|
|||
public bool Enabled { get; set; }
|
||||
public bool OverrideShutdown { get; set; }
|
||||
public double Temperature { get; set; }
|
||||
public string Rotation { get; set; }
|
||||
}
|
||||
|
||||
[MessagePackObject(true)]
|
||||
|
|
|
|||
|
|
@ -954,7 +954,9 @@ namespace GameCult.Aetheria.State.Verse
|
|||
var enabled = ReadFieldBool(ref reader, slotFields, 5, true);
|
||||
var overrideShutdown = ReadFieldBool(ref reader, slotFields, 6);
|
||||
var temperature = ReadFieldDouble(ref reader, slotFields, 7);
|
||||
SkipRemaining(ref reader, slotFields, 8);
|
||||
var rotation = ReadFieldString(ref reader, slotFields, 8);
|
||||
if (string.IsNullOrWhiteSpace(rotation)) rotation = "None";
|
||||
SkipRemaining(ref reader, slotFields, 9);
|
||||
slots[slot] = new AetheriaRuntimeEntityItemSlotSnapshot(
|
||||
position.X,
|
||||
position.Y,
|
||||
|
|
@ -964,7 +966,8 @@ namespace GameCult.Aetheria.State.Verse
|
|||
quantity <= 0 ? 1 : quantity,
|
||||
enabled,
|
||||
overrideShutdown,
|
||||
temperature);
|
||||
temperature,
|
||||
rotation);
|
||||
}
|
||||
|
||||
return slots;
|
||||
|
|
@ -1532,8 +1535,10 @@ namespace GameCult.Aetheria.State.Verse
|
|||
var slotFields = reader.ReadArrayHeader();
|
||||
var position = ReadFieldGridCoord(ref reader, slotFields, 0);
|
||||
var item = ReadFieldLoadoutItem(ref reader, slotFields, 1);
|
||||
SkipRemaining(ref reader, slotFields, 2);
|
||||
return new AetheriaRuntimeLoadoutItemSlotSnapshot(position.X, position.Y, item);
|
||||
var rotation = ReadFieldString(ref reader, slotFields, 2);
|
||||
if (string.IsNullOrWhiteSpace(rotation)) rotation = "None";
|
||||
SkipRemaining(ref reader, slotFields, 3);
|
||||
return new AetheriaRuntimeLoadoutItemSlotSnapshot(position.X, position.Y, item, rotation);
|
||||
}
|
||||
|
||||
private static GridCoord ReadFieldGridCoord(ref MessagePackReader reader, int fields, int index)
|
||||
|
|
|
|||
|
|
@ -1983,6 +1983,7 @@ namespace GameCult.Aetheria.State.Verse
|
|||
{
|
||||
X = slot?.X ?? 0,
|
||||
Y = slot?.Y ?? 0,
|
||||
Rotation = slot?.Rotation ?? "None",
|
||||
Item = new AetheriaRuntimeLoadoutItemCommit
|
||||
{
|
||||
ItemKey = item?.ItemKey ?? "",
|
||||
|
|
|
|||
|
|
@ -1031,7 +1031,8 @@ namespace GameCult.Aetheria.State.Verse
|
|||
slot.Item.Quantity,
|
||||
slot.Item.Enabled,
|
||||
slot.Item.OverrideShutdown,
|
||||
slot.Item.Temperature))
|
||||
slot.Item.Temperature,
|
||||
slot.Rotation ?? "None"))
|
||||
.ToArray();
|
||||
}
|
||||
|
||||
|
|
@ -1059,7 +1060,8 @@ namespace GameCult.Aetheria.State.Verse
|
|||
slot.Item.Quantity,
|
||||
slot.Item.Enabled,
|
||||
slot.Item.OverrideShutdown,
|
||||
slot.Item.Temperature)))
|
||||
slot.Item.Temperature),
|
||||
slot.Rotation ?? "None"))
|
||||
.ToArray();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -150,6 +150,9 @@ namespace GameCult.Aetheria.State.Verse
|
|||
|
||||
[Key(2)]
|
||||
public AetheriaRuntimeLoadoutItemCommit Item { get; set; } = new AetheriaRuntimeLoadoutItemCommit();
|
||||
|
||||
[Key(3)]
|
||||
public string Rotation { get; set; } = "None";
|
||||
}
|
||||
|
||||
[MessagePackObject]
|
||||
|
|
@ -420,6 +423,7 @@ namespace GameCult.Aetheria.State.Verse
|
|||
{
|
||||
X = slot.X,
|
||||
Y = slot.Y,
|
||||
Rotation = slot.Rotation ?? "None",
|
||||
Item = CloneItem(slot.Item)
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue