fix: add new armor fields to LoadoutConfig and fix label references
- Added current_armor_set_name, current_armor_pieces, current_armor_protection, current_armor_decay to LoadoutConfig - Fixed armor_set_label reference to use armor_summary_label - Added hasattr checks for backward compatibility with old save files
This commit is contained in:
parent
67eaf2d6a7
commit
877ee96bcc
|
|
@ -158,6 +158,12 @@ class LoadoutConfig:
|
||||||
# Format: {tier_number: enhancer}
|
# Format: {tier_number: enhancer}
|
||||||
enhancers: Dict[int, 'NexusEnhancer'] = field(default_factory=dict)
|
enhancers: Dict[int, 'NexusEnhancer'] = field(default_factory=dict)
|
||||||
|
|
||||||
|
# New Armor System (API-based)
|
||||||
|
current_armor_set_name: str = "None"
|
||||||
|
current_armor_pieces: List[Any] = field(default_factory=list)
|
||||||
|
current_armor_protection: ProtectionProfile = field(default_factory=ProtectionProfile)
|
||||||
|
current_armor_decay: Decimal = Decimal("0")
|
||||||
|
|
||||||
# Settings
|
# Settings
|
||||||
shots_per_hour: int = 3600
|
shots_per_hour: int = 3600
|
||||||
hits_per_hour: int = 720
|
hits_per_hour: int = 720
|
||||||
|
|
@ -214,7 +220,7 @@ class LoadoutConfig:
|
||||||
def get_armor_decay_per_hit(self) -> Decimal:
|
def get_armor_decay_per_hit(self) -> Decimal:
|
||||||
"""Calculate armor decay cost per hit taken (in PED)."""
|
"""Calculate armor decay cost per hit taken (in PED)."""
|
||||||
# Use new armor system if available
|
# Use new armor system if available
|
||||||
if self.current_armor_decay > 0:
|
if hasattr(self, 'current_armor_decay') and self.current_armor_decay > 0:
|
||||||
return self.current_armor_decay
|
return self.current_armor_decay
|
||||||
|
|
||||||
# Legacy fallback
|
# Legacy fallback
|
||||||
|
|
@ -287,7 +293,7 @@ class LoadoutConfig:
|
||||||
def get_total_protection(self) -> ProtectionProfile:
|
def get_total_protection(self) -> ProtectionProfile:
|
||||||
"""Get total protection from equipped armor."""
|
"""Get total protection from equipped armor."""
|
||||||
# Use new armor system if available
|
# Use new armor system if available
|
||||||
if self.current_armor_protection.get_total() > 0:
|
if hasattr(self, 'current_armor_protection') and self.current_armor_protection.get_total() > 0:
|
||||||
return self.current_armor_protection
|
return self.current_armor_protection
|
||||||
|
|
||||||
# Legacy fallback
|
# Legacy fallback
|
||||||
|
|
@ -1672,7 +1678,7 @@ class LoadoutManagerDialog(QDialog):
|
||||||
self.current_armor_decay = data['total_decay_per_hit']
|
self.current_armor_decay = data['total_decay_per_hit']
|
||||||
|
|
||||||
# Update UI
|
# Update UI
|
||||||
self.armor_set_label.setText(f"✓ {data['name']}")
|
self.armor_summary_label.setText(f"✓ {data['name']}")
|
||||||
self.protection_summary_label.setText(
|
self.protection_summary_label.setText(
|
||||||
f"Total: {data['total_protection'].get_total():.1f} | Decay: {data['total_decay_per_hit']:.4f}/hit"
|
f"Total: {data['total_protection'].get_total():.1f} | Decay: {data['total_decay_per_hit']:.4f}/hit"
|
||||||
)
|
)
|
||||||
|
|
@ -1701,7 +1707,7 @@ class LoadoutManagerDialog(QDialog):
|
||||||
self.current_armor_decay = total_decay
|
self.current_armor_decay = total_decay
|
||||||
|
|
||||||
# Update UI
|
# Update UI
|
||||||
self.armor_set_label.setText(f"✓ Custom ({len(pieces)} pieces)")
|
self.armor_summary_label.setText(f"✓ Custom ({len(pieces)} pieces)")
|
||||||
self.protection_summary_label.setText(
|
self.protection_summary_label.setText(
|
||||||
f"Total: {total_prot.get_total():.1f} | Decay: {total_decay:.4f}/hit"
|
f"Total: {total_prot.get_total():.1f} | Decay: {total_decay:.4f}/hit"
|
||||||
)
|
)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue