Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix undefined attributes on StructureController #474

Merged
merged 3 commits into from
Dec 19, 2023

Conversation

shanemadden
Copy link
Collaborator

Fixes #458

  • hits/hitMax: Added coalesce from undefined to 0, as 0 is another value that the game uses for invulnerable structures in addition to undefined. This matches the current behavior when in release mode.
  • upgradeBlocked, progress, progressTotal, ticksToDowngrade: 0 values wouldn't make sense for some of these, and all have cases where you'd expect them to be undefined. Added Option<> wrap around returns for each.
  • safeModeAvailable, isPowerEnabled: seems like these already coalesce to sane values when undefined: https://github.com/screeps/engine/blob/204f95545d8946782e65911abbcd020a256f1cd7/src/game/structures.js#L186-L198

@shanemadden shanemadden marked this pull request as ready for review December 18, 2023 23:23
@shanemadden shanemadden merged commit 73420a8 into rustyscreeps:main Dec 19, 2023
10 checks passed
@shanemadden shanemadden deleted the controller-undefined-attrs branch December 19, 2023 02:22
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.

hits/hitsMax are either 0 or undefined on controllers
1 participant