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 damage virtual in the api doc #383

Merged
merged 4 commits into from
Jul 11, 2024
Merged

Conversation

Mr-Auto
Copy link
Contributor

@Mr-Auto Mr-Auto commented May 17, 2024

No description provided.

@estebanfer
Copy link
Contributor

Does this break compatibility with the previos movable:damage() function when called from lua?

@Mr-Auto
Copy link
Contributor Author

Mr-Auto commented May 17, 2024

Does this break compatibility with the previos movable:damage() function when called from lua?

No, you can still call it like:

entity:damage(damage_dealer_uid, damage_amount, stun_time, velocity_x, velocity_y)
entity:damage(damage_dealer_uid, damage_amount, stun_time, velocity_x, velocity_y, iframes)
entity:damage(damage_dealer, damage_amount, damage_flags, velocity, unknown_damage_phase, stun_amount, iframes, unknown_is_final)

unless i missed something? can't test the current overlunky version right now

@estebanfer
Copy link
Contributor

Ah I see, yeah it should work I think

/// NoDoc
bool broken_damage(uint32_t damage_dealer_uid, int8_t damage_amount, uint16_t stun_time, float velocity_x, float velocity_y, std::optional<uint8_t> iframes)
{
auto dealer = get_entity_ptr(damage_dealer_uid);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

One think i worry about, this should check if the uid is -1 vs get_entity_ptr returning nullptr
As the first one is probably intended, when the second might be not

@Dregu Dregu merged commit 2cebb57 into spelunky-fyi:main Jul 11, 2024
10 checks passed
@Mr-Auto Mr-Auto deleted the damage-fix branch July 20, 2024 14:44
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.

3 participants