-
Notifications
You must be signed in to change notification settings - Fork 4
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
feat: add utility functions to set sprite order #318
base: development
Are you sure you want to change the base?
Conversation
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.
Need to print a warning when there is a queue cycle
I think that the fact that our So, the function should in fact be: function setOrder( _script, _sprite, _behind ) This way whenever the Alternatively we allow the This ensures that we don't end up adding sprites to an entity in an order that wasn't meant for those sprites. |
@LordMidas I actually agree, I think that simpler approach has all the utility of the more complex one without more strange edge cases |
Do we have a use case for this? |
Yeah e.g. in Reforged we add cape sprites to some Ancient Dead leaders. That cape has to appear above the armor but behind the helmet, so it needs to be added to the entity behind the entity's helmet sprite. The only way to do that right now would be to hook the function onInit()
{
local addSprite = this.addSprite;
this.addSprite = function( _sprite )
{
if (_sprite == "armor")
{
local ret = addSprite(_sprite);
this.addSprite("rf_cape");
return ret;
}
return addSprite(_sprite);
}
this.skeleton.onInit();
this.addSprite = addSprite;
} WIth this new method you set the order of that sprite to be behind behind I have so far found myself to be more open to the switcheroo method above, so probably we don't need this new spriteOrder functionality. I think we should postpone it to 1.4.0 at least for now. |
I've had to do this in layered items as well, it does have use cases though they are admittedly uncommon. I'm okay with postponing this too |
To be looked at after we finish port to Modern Hooks.