-
Notifications
You must be signed in to change notification settings - Fork 11
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
BMSBK - Minor cleanup and add functions #252
base: main
Are you sure you want to change the base?
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #252 +/- ##
==========================================
+ Coverage 76.85% 76.92% +0.06%
==========================================
Files 78 78
Lines 3876 3887 +11
==========================================
+ Hits 2979 2990 +11
Misses 897 897 ☔ View full report in Codecov by Sentry. |
|
||
def test_changing_weakness(surface_bmsbk: Bmsbk): | ||
original_type = surface_bmsbk.get_block_group(1).types[0].block_type | ||
new_type = surface_bmsbk.set_block_type(1, "bomb") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
set_block_type
returns nothing, so this is not doing what you're expecting
return self.raw.block_groups[block_group] | ||
|
||
def set_block_type(self, block_group: int, block_type: str) -> Container: | ||
weakness = self.get_block_group(block_group).types[0] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is this magical 0
? Is types
always a 1-length vector? Maybe add some comments or asserts
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes types is always length 1. Might not be the best name for the field. This is how it looks for the entries.
Container:
unk_bool = True
types = ListContainer:
Container:
block_type = u'power_beam' (total 10)
blocks = ListContainer:
Container:
pos = ListContainer:
-1800.0
2000.0
0.0
unk2 = 0
unk3 = 0
respawn_time = 5.0
model_name = u'sg_casca111' (total 11)
vignette_name = u'' (total 0)
Container:
pos = ListContainer:
-1700.0
2000.0
0.0
unk2 = 0
unk3 = 0
respawn_time = 5.0
model_name = u'sg_casca112' (total 11)
vignette_name = u'' (total 0)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm... I remember something in Dread about supporting multiple tile types/groups in a single "Block spawner" and it could have different types.
Easier to just not do that. The construct definition could just assert it's always size 1 and not use a list. Or as the simplest way, just add an assertion that len(self.get_block_group(block_group).types) == 1
in case something funny happens.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
either is fine by mii
def get_block_group(self, block_group: int) -> Container: | ||
return self.raw.block_groups[block_group] | ||
|
||
def set_block_type(self, block_group: int, block_type: str) -> Container: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
block_type
should certainly be an enum
Adds functions to BMSBK