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

Unable to set custom sprites to springs #2701

Closed
Sevenberry opened this issue Dec 14, 2023 · 3 comments · Fixed by #2646
Closed

Unable to set custom sprites to springs #2701

Sevenberry opened this issue Dec 14, 2023 · 3 comments · Fixed by #2646

Comments

@Sevenberry
Copy link

Sevenberry commented Dec 14, 2023

0.7 Nighties
Expected Behavior -
Spring will apply the texture given in the editor to the spring in-game.
Actual Behavior -
Spring will automatically revert back to the default sprite depending on object type, AKA the sprite change does not apply in game.

@Brockengespenst
Copy link
Contributor

Quick and dirty solution could be adding:

std::string custom_sprite { };
if (mapping.get("sprite", custom_sprite))
{
  if (!custom_sprite.empty())
  {
    change_sprite(custom_sprite);
  }
}

to the constructor that takes the mapping as argument, right after parse_type(mapping);, but this does work for the constructor that just takes the Vector and a type. I have not yet figured out in which cases the latter one is called, so in a first basic test, the solution above did its job. But I assume there might exist a cleaner solution.

@Vankata453
Copy link
Member

The issue is actually a result of a bad quirk in the MovingSprite code, which #2646 fixes. Such custom sprite validity checks are already performed in MovingSprite initializers.

@Brockengespenst
Copy link
Contributor

Well, I should have read the linked issue more in detail than just checking the code diff. :-) Thanks for clarification.

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

Successfully merging a pull request may close this issue.

4 participants