Skip to content

fix(ResourcesLib): prevent value calculation from overwriting stored resource data#1

Open
DevAryanPro wants to merge 1 commit intotelebothost:mainfrom
DevAryanPro:main
Open

fix(ResourcesLib): prevent value calculation from overwriting stored resource data#1
DevAryanPro wants to merge 1 commit intotelebothost:mainfrom
DevAryanPro:main

Conversation

@DevAryanPro
Copy link
Copy Markdown

Fixed critical bug in ResourcesLib where value() method with enabled growth
was overwriting actual stored resource values with calculated growth values.

Changes:

  • Modified value() method to use _calcValue() directly instead of getValue()
  • This prevents the internal _set() call that was corrupting stored data
  • Growth calculations now return computed values without modifying base storage

Impact:

  • Resolves issue where resource values would reset to 0 after growth calculations
  • Ensures add() operations work correctly with growth features enabled
  • Maintains accurate base value storage while providing correct calculated values

Test results before fix:

  • Old Value: 600, Added: 100, New Value: 0 ❌
  • After fix: Values now persist correctly through operations

…resource data

Fixed critical bug in ResourcesLib where value() method with enabled growth 
was overwriting actual stored resource values with calculated growth values.

Changes:
- Modified value() method to use _calcValue() directly instead of getValue()
- This prevents the internal _set() call that was corrupting stored data
- Growth calculations now return computed values without modifying base storage

Impact:
- Resolves issue where resource values would reset to 0 after growth calculations
- Ensures add() operations work correctly with growth features enabled
- Maintains accurate base value storage while providing correct calculated values

Test results before fix:
- Old Value: 600, Added: 100, New Value: 0 ❌
- After fix: Values now persist correctly through operations
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant