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

BMSBK - Minor cleanup and add functions #252

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

BMSBK - Minor cleanup and add functions #252

wants to merge 2 commits into from

Conversation

dyceron
Copy link
Contributor

@dyceron dyceron commented Dec 22, 2024

Adds functions to BMSBK

Copy link

codecov bot commented Dec 22, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 76.92%. Comparing base (9c509cf) to head (183cabd).

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.
📢 Have feedback on the report? Share it here.


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")
Copy link
Member

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]
Copy link
Member

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

Copy link
Contributor Author

@dyceron dyceron Dec 22, 2024

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)

Copy link
Member

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.

Copy link
Contributor

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:
Copy link
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants