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

Add classes and functions to BMDEFS #266

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

Add classes and functions to BMDEFS #266

wants to merge 4 commits into from

Conversation

dyceron
Copy link
Contributor

@dyceron dyceron commented Jan 12, 2025

Adds new classes for accessing sound properties

Copy link

codecov bot commented Jan 12, 2025

Codecov Report

Attention: Patch coverage is 96.29630% with 4 lines in your changes missing coverage. Please review.

Project coverage is 78.10%. Comparing base (b0de65a) to head (3df5193).

Files with missing lines Patch % Lines
...c/mercury_engine_data_structures/formats/bmdefs.py 96.29% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #266      +/-   ##
==========================================
+ Coverage   77.62%   78.10%   +0.47%     
==========================================
  Files          79       79              
  Lines        4027     4133     +106     
==========================================
+ Hits         3126     3228     +102     
- Misses        901      905       +4     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.


@state_type.setter
def state_type(self, value: str) -> None:
self._raw.type = value
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could make the type an Enum instead of an arbitrary string, right? Because only DEATH or COMBAT should be accepted values.

return self._raw.priority

@priority.setter
def priority(self, value: str) -> None:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

value: int

def environment_sfx_volume(self, value: float) -> None:
self._raw.environment_sfx_volume = value

# inner_states and start_delay are only used for enemies
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then make a seperate child class (something something named like EnemySounds) inheriting from Sounds which has these extra methods.

return self._raw.inner_states

@inner_states.setter
def inner_states(self, value: dict[str, float]) -> None:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The str key in dict[str, float] should be restricted to valid values (RELAX and DEATH only?). We can use an enum here, do we? (I'm tired and my brain starts to mix programming languages. Using something like dict[InnerStatEnum, float] is doable but I don't know if it gets encoded properly without additional things)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would just need to change the make_dict(Float32l) to make_dict(Float32l, key_type=EnumAdapter(InnerStateEnum, StrId)) to decode/encode the way you'd like

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