refactor: Statically typed almost everything#420
Merged
elementbound merged 6 commits intofoxssake:mainfrom Mar 5, 2025
Merged
Conversation
elementbound
reviewed
Mar 5, 2025
addons/netfox/tick-interpolator.gd
Outdated
| _state_to = _PropertySnapshot.new() | ||
|
|
||
| for property in properties: | ||
| for property: String in properties: |
Contributor
There was a problem hiding this comment.
@gk98s fyi this breaks in Godot 4.1 which is supported by netfox
elementbound
reviewed
Mar 5, 2025
| # Calculate rtt bounds | ||
| var rtt_min = sorted_samples.front().get_rtt() | ||
| var rtt_max = sorted_samples.back().get_rtt() | ||
| var rtt_min: Variant = sorted_samples.front().get_rtt() |
Contributor
There was a problem hiding this comment.
Typing these as variants does not add much extra info - in these cases it's better to cast them to their known types.
elementbound
reviewed
Mar 5, 2025
| return | ||
|
|
||
| var sample = _awaiting_samples[idx] as NetworkClockSample | ||
| var sample: NetworkClockSample = _awaiting_samples[idx] as NetworkClockSample |
Contributor
There was a problem hiding this comment.
You can just use :=, since the value is already cast to the right type
elementbound
reviewed
Mar 5, 2025
|
|
||
| func make_patch(data: _PropertySnapshot) -> _PropertySnapshot: | ||
| var result: Dictionary = {} | ||
| var result := {} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Swapped Strings to StringNames where possible(StringNames are much faster), statically typed functions and variables that weren't already statically typed for improved performance.