48 lines
1.8 KiB
Markdown
48 lines
1.8 KiB
Markdown
# 2026-02-09 - Lemontropia Suite Development
|
|
|
|
## Bug Fixes - Armor System Serialization
|
|
|
|
### Issue 1: JSON Serialization Error
|
|
**Problem:** "Decimal is not JSON serializable" when saving loadouts with new armor system.
|
|
|
|
**Root Cause:** The `to_dict` method in `LoadoutConfig` wasn't handling:
|
|
- `current_armor_protection` (ProtectionProfile object)
|
|
- `current_armor_pieces` (list of ArmorPiece objects)
|
|
- `current_armor_decay` (Decimal)
|
|
|
|
**Fix:** Updated `to_dict` to properly serialize these fields before JSON serialization.
|
|
|
|
**Commit:** `0c843df`
|
|
|
|
### Issue 2: Armor Decay Not Loaded Into Session
|
|
**Problem:** Warning "Cost tracking not available for file-based loadouts" and armor decay not showing in HUD.
|
|
|
|
**Root Cause:**
|
|
1. `_get_current_config` wasn't including new armor fields when creating LoadoutConfig
|
|
2. `from_dict` wasn't deserializing new armor fields
|
|
3. `_set_config` wasn't restoring new armor fields when loading
|
|
|
|
**Fix:**
|
|
- Updated `_get_current_config` to include new armor fields
|
|
- Updated `from_dict` to deserialize `current_armor_protection`, `current_armor_pieces`, `current_armor_decay`
|
|
- Updated `_set_config` to restore new armor fields
|
|
- Updated `_on_loadout_selected_for_session` to extract cost data for JSON-based loadouts
|
|
|
|
**Commit:** `8308425`
|
|
|
|
## Technical Details
|
|
|
|
### Files Modified
|
|
- `ui/loadout_manager.py` - Serialization/deserialization fixes
|
|
- `ui/main_window.py` - Cost extraction for session start
|
|
|
|
### Key Changes
|
|
1. `to_dict` now handles complex objects manually instead of using `asdict()` blindly
|
|
2. `from_dict` converts Decimals and reconstructs ProtectionProfile/ArmorPiece objects
|
|
3. Session startup now extracts costs from both database and JSON loadouts
|
|
|
|
## Testing Status
|
|
- JSON serialization fixed
|
|
- Armor decay now flows from LoadoutManager → JSON file → Session
|
|
- Need to verify live cost tracking in HUD during gameplay
|