fix: remove duplicate old code in weapon_selector _on_select
- Remove duplicate code block that used 'ammo' instead of 'ammo_burn' - The old code was left behind after adding try/except wrapper
This commit is contained in:
parent
32a858a3f5
commit
ab266e9da9
|
|
@ -261,20 +261,6 @@ class WeaponSelectorDialog(QDialog):
|
||||||
self.preview_name.setText(str(weapon.name) if weapon.name else "Unknown")
|
self.preview_name.setText(str(weapon.name) if weapon.name else "Unknown")
|
||||||
self.preview_cost.setText("Error")
|
self.preview_cost.setText("Error")
|
||||||
self.ok_btn.setEnabled(False)
|
self.ok_btn.setEnabled(False)
|
||||||
|
|
||||||
# Calculate cost per shot
|
|
||||||
decay_pec = Decimal(str(weapon.decay))
|
|
||||||
ammo = Decimal(str(weapon.ammo))
|
|
||||||
cost_per_shot = (decay_pec / Decimal("100")) + (ammo * Decimal("0.0001"))
|
|
||||||
|
|
||||||
# Update preview
|
|
||||||
self.preview_name.setText(weapon.name)
|
|
||||||
self.preview_damage.setText(str(weapon.damage))
|
|
||||||
self.preview_decay.setText(f"{weapon.decay} PEC")
|
|
||||||
self.preview_ammo.setText(str(weapon.ammo))
|
|
||||||
self.preview_cost.setText(f"{cost_per_shot:.4f} PED")
|
|
||||||
|
|
||||||
self.ok_btn.setEnabled(True)
|
|
||||||
|
|
||||||
def _on_double_click(self, item):
|
def _on_double_click(self, item):
|
||||||
"""Double-click to select immediately."""
|
"""Double-click to select immediately."""
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue