@@ -327,6 +327,8 @@ private function createHardpoints(\App\Models\SC\Vehicle\Vehicle $vehicle, array
327327 $ hardpoints = [];
328328 $ this ->mapHardpoints (Arr::get ($ rawData , 'Vehicle.Parts ' , []), $ hardpoints );
329329
330+ $ hardpoints = array_reverse ($ hardpoints );
331+
330332 collect ($ entries )
331333 ->chunk (5 )
332334 ->each (function (Collection $ entries ) use ($ hardpoints , $ vehicle ) {
@@ -364,8 +366,8 @@ private function createHardpoints(\App\Models\SC\Vehicle\Vehicle $vehicle, array
364366 collect ($ hardpoints )
365367 // Create vehicle parts
366368 ->each (function ($ hardpoint ) use ($ vehicle ) {
367- $ isBaseBody = $ hardpoint ['class ' ] === 'Animated ' && ($ hardpoint ['damagemax ' ] ?? $ hardpoint [ ' damageMax ' ] ?? null ) === 0 ;
368- $ isPart = ! empty ($ hardpoint ['name ' ]) && isset ($ hardpoint ['damageMax ' ]) && $ hardpoint ['damageMax ' ] > $ this ->minPartDamage ;
369+ $ isBaseBody = $ hardpoint ['class ' ] === 'Animated ' && isset ($ hardpoint ['scopeContext ' ]) ;
370+ $ isPart = ! empty ($ hardpoint ['name ' ]) && isset ($ hardpoint ['damageMax ' ])/* && $hardpoint['damageMax'] > $this->minPartDamage*/ ;
369371
370372 if ($ isBaseBody || $ isPart ) {
371373 if (! empty ($ hardpoint ['parent ' ])) {
@@ -376,7 +378,7 @@ private function createHardpoints(\App\Models\SC\Vehicle\Vehicle $vehicle, array
376378 'name ' => $ hardpoint ['name ' ],
377379 ], [
378380 'parent_id ' => $ hardpoint ['parent ' ] ?? null ,
379- 'damage_max ' => $ hardpoint ['damageMax ' ],
381+ 'damage_max ' => $ hardpoint ['damageMax ' ] ?? 0 ,
380382 ]);
381383
382384 $ this ->parts ->push ($ hardpoint ['name ' ]);
@@ -432,7 +434,7 @@ private function createHardpoints(\App\Models\SC\Vehicle\Vehicle $vehicle, array
432434 private function mapHardpoints (array $ parts , array &$ out , ?string $ parent = null ): void
433435 {
434436 foreach ($ parts as $ part ) {
435- if (! isset ($ part ['name ' ])) {
437+ if (! isset ($ part ['name ' ]) || $ part === ' xmlParts ' ) {
436438 continue ;
437439 }
438440
@@ -445,7 +447,13 @@ private function mapHardpoints(array $parts, array &$out, ?string $parent = null
445447 unset($ part ['Parts ' ]);
446448 }
447449
448- unset($ part ['ItemPort ' ]['Connections ' ], $ part ['ItemPort ' ]['ControllerDef ' ], $ part ['ItemPort ' ]['Types ' ]);
450+ unset(
451+ $ part ['ItemPort ' ]['Connections ' ],
452+ $ part ['ItemPort ' ]['ControllerDef ' ],
453+ $ part ['ItemPort ' ]['Types ' ],
454+ $ part ['Effects ' ],
455+ $ part ['DamageBehaviors ' ],
456+ );
449457 $ out [strtolower ($ part ['name ' ])] = $ part ;
450458 }
451459 }
0 commit comments