17 ref array<ref SCR_ClothingLoadoutData> Clothings = {};
18 ref array<ref SCR_WeaponLoadoutData> Weapons = {};
20 float LoadoutPlayerSupplyAllocationCost;
31 int clothingCount = instance.Clothings.Count();
32 snapshot.SerializeInt(clothingCount);
35 for (
int i = 0; i < clothingCount; ++i)
37 snapshot.SerializeInt(instance.Clothings[i].SlotIdx);
38 prefab = instance.Clothings[i].ClothingPrefab;
39 snapshot.SerializeString(prefab);
42 int weaponCount = instance.Weapons.Count();
43 snapshot.SerializeInt(weaponCount);
44 for (
int i = 0; i < weaponCount; ++i)
46 snapshot.SerializeBool(instance.Weapons[i].Active);
47 snapshot.SerializeInt(instance.Weapons[i].SlotIdx);
48 prefab = instance.Weapons[i].WeaponPrefab;
49 snapshot.SerializeString(prefab);
51 int attachmentsCount = instance.Weapons[i].Attachments.Count();
52 snapshot.SerializeInt(attachmentsCount);
53 for (
int nAttachment = 0; nAttachment < attachmentsCount; ++nAttachment)
55 prefab = instance.Weapons[i].Attachments[nAttachment];
56 snapshot.SerializeString(prefab);
60 snapshot.SerializeFloat(instance.LoadoutCost);
61 snapshot.SerializeFloat(instance.LoadoutPlayerSupplyAllocationCost);
62 snapshot.SerializeInt(instance.FactionIndex);
76 snapshot.SerializeInt(clothingCount);
77 instance.Clothings.Clear();
79 SCR_ClothingLoadoutData clothingData;
80 for (
int i = 0; i < clothingCount; ++i)
82 clothingData =
new SCR_ClothingLoadoutData();
84 snapshot.SerializeInt(clothingData.SlotIdx);
87 snapshot.SerializeString(prefab);
88 clothingData.ClothingPrefab = prefab;
90 instance.Clothings.Insert(clothingData);
94 snapshot.SerializeInt(weaponCount);
95 instance.Weapons.Clear();
98 for (
int i = 0; i < weaponCount; ++i)
102 snapshot.SerializeBool(weaponData.Active);
103 snapshot.SerializeInt(weaponData.SlotIdx);
106 snapshot.SerializeString(prefab);
107 weaponData.WeaponPrefab = prefab;
109 int attachmentsCount;
110 snapshot.SerializeInt(attachmentsCount);
111 weaponData.Attachments.Reserve(attachmentsCount);
112 for (
int nAttachment = 0; nAttachment < attachmentsCount; ++nAttachment)
114 snapshot.SerializeString(prefab);
115 weaponData.Attachments.Insert(prefab);
118 instance.Weapons.Insert(weaponData);
121 snapshot.SerializeFloat(instance.LoadoutCost);
122 snapshot.SerializeFloat(instance.LoadoutPlayerSupplyAllocationCost);
123 snapshot.SerializeInt(instance.FactionIndex);
136 snapshot.SerializeBytes(clothingCount, 4);
137 packet.Serialize(clothingCount, 32);
140 for (
int i = 0; i < clothingCount; ++i)
143 snapshot.EncodeInt(packet);
146 snapshot.SerializeString(prefab);
147 packet.SerializeResourceName(prefab);
151 snapshot.SerializeBytes(weaponCount, 4);
152 packet.Serialize(weaponCount, 32);
154 for (
int i = 0; i < weaponCount; ++i)
157 snapshot.EncodeBool(packet);
160 snapshot.EncodeInt(packet);
163 snapshot.SerializeString(prefab);
164 packet.SerializeResourceName(prefab);
167 int attachmentsCount;
168 snapshot.SerializeBytes(attachmentsCount, 4);
169 packet.Serialize(attachmentsCount, 32);
170 for (
int nAttachment = 0; nAttachment < attachmentsCount; ++nAttachment)
172 snapshot.SerializeString(prefab);
173 packet.SerializeResourceName(prefab);
177 snapshot.EncodeFloat(packet);
178 snapshot.EncodeFloat(packet);
179 snapshot.EncodeInt(packet);
191 packet.Serialize(clothingCount, 32);
192 snapshot.SerializeBytes(clothingCount, 4);
195 for (
int i = 0; i < clothingCount; ++i)
198 snapshot.DecodeInt(packet);
201 packet.SerializeResourceName(prefab);
202 snapshot.SerializeString(prefab);
206 packet.Serialize(weaponCount, 32);
207 snapshot.SerializeBytes(weaponCount, 4);
209 for (
int i = 0; i < weaponCount; ++i)
212 snapshot.DecodeBool(packet);
215 snapshot.DecodeInt(packet);
218 packet.SerializeResourceName(prefab);
219 snapshot.SerializeString(prefab);
222 int attachmentsCount;
223 packet.Serialize(attachmentsCount, 32);
224 snapshot.SerializeBytes(attachmentsCount, 4);
225 for (
int nAttachment = 0; nAttachment < attachmentsCount; ++nAttachment)
227 packet.SerializeResourceName(prefab);
228 snapshot.SerializeString(prefab);
232 snapshot.DecodeFloat(packet);
233 snapshot.DecodeFloat(packet);
234 snapshot.DecodeInt(packet);
247 Print(
"Cannot use SCR_PlayerLoadoutData as a property",
LogLevel.ERROR);
259 Print(
"Cannot use SCR_PlayerLoadoutData as a property",
LogLevel.ERROR);