@@ -3,7 +3,7 @@ class EPF_HitZoneContainerComponentSaveDataClass : EPF_ComponentSaveDataClass
3
3
{
4
4
[Attribute (desc : "If set, only the explictly selected hitzones are persisted." )]
5
5
ref array < string > m_aHitzoneFilter ;
6
- };
6
+ }
7
7
8
8
[EDF_DbName .Automatic ()]
9
9
class EPF_HitZoneContainerComponentSaveData : EPF_ComponentSaveData
@@ -19,12 +19,12 @@ class EPF_HitZoneContainerComponentSaveData : EPF_ComponentSaveData
19
19
m_aHitzones = {};
20
20
21
21
array < HitZone > outHitZones ();
22
- hitZoneContainer .GetAllHitZones (outHitZones );
22
+ hitZoneContainer .GetAllHitZonesInHierarchy (outHitZones );
23
23
24
- foreach (HitZone hitZone : outHitZones )
24
+ foreach (int idx , HitZone hitZone : outHitZones )
25
25
{
26
26
EPF_PersistentHitZone persistentHitZone ();
27
- persistentHitZone .m_sName = hitZone .GetName ();
27
+ persistentHitZone .m_sName = string . Format ( "z%1_%2" , idx , hitZone .GetName () );
28
28
persistentHitZone .m_fHealth = hitZone .GetHealthScaled ();
29
29
30
30
if (settings .m_bTrimDefaults && float .AlmostEqual (persistentHitZone .m_fHealth , 1.0 )) continue ;
@@ -44,7 +44,7 @@ class EPF_HitZoneContainerComponentSaveData : EPF_ComponentSaveData
44
44
45
45
array < HitZone > outHitZones ();
46
46
HitZoneContainerComponent hitZoneContainer = HitZoneContainerComponent .Cast (component );
47
- hitZoneContainer .GetAllHitZones (outHitZones );
47
+ hitZoneContainer .GetAllHitZonesInHierarchy (outHitZones );
48
48
49
49
bool tryIdxAcces = outHitZones .Count () >= m_aHitzones .Count ();
50
50
@@ -56,16 +56,16 @@ class EPF_HitZoneContainerComponentSaveData : EPF_ComponentSaveData
56
56
if (tryIdxAcces )
57
57
{
58
58
HitZone idxHitZone = outHitZones .Get (idx );
59
-
60
- if ( idxHitZone . GetName () == persistentHitZone . m_sName ) hitZone = idxHitZone ;
59
+ if ( string . Format ( "z%1_%2" , idx , idxHitZone . GetName ()) == persistentHitZone . m_sName )
60
+ hitZone = idxHitZone ;
61
61
}
62
62
63
63
// Iterate all hitzones to hopefully find the right one
64
64
if (!hitZone )
65
65
{
66
- foreach (HitZone findHitZone : outHitZones )
66
+ foreach (int hitIdx , HitZone findHitZone : outHitZones )
67
67
{
68
- if (findHitZone .GetName () == persistentHitZone .m_sName )
68
+ if (string . Format ( "z%1_%2" , hitIdx , findHitZone .GetName () ) == persistentHitZone .m_sName )
69
69
{
70
70
hitZone = findHitZone ;
71
71
break ;
@@ -75,7 +75,7 @@ class EPF_HitZoneContainerComponentSaveData : EPF_ComponentSaveData
75
75
76
76
if (!hitZone )
77
77
{
78
- Debug .Error (string .Format ("'%1' unable to find hitZone with name '%2'. Ignored." , component , persistentHitZone .m_sName ));
78
+ Debug .Error (string .Format ("'%1' unable to find hitZone '%2'. Ignored." , component , persistentHitZone .m_sName ));
79
79
continue ;
80
80
}
81
81
@@ -118,7 +118,7 @@ class EPF_HitZoneContainerComponentSaveData : EPF_ComponentSaveData
118
118
119
119
return true;
120
120
}
121
- };
121
+ }
122
122
123
123
class EPF_PersistentHitZone
124
124
{
@@ -130,4 +130,4 @@ class EPF_PersistentHitZone
130
130
{
131
131
return m_sName == other .m_sName && float .AlmostEqual (m_fHealth , other .m_fHealth );
132
132
}
133
- };
133
+ }
0 commit comments