feat: add utility functions to set sprite order#318
feat: add utility functions to set sprite order#318LordMidas wants to merge 4 commits intodevelopmentfrom
Conversation
Enduriel
left a comment
There was a problem hiding this comment.
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 |
6677ac8 to
ae825b7
Compare
To be looked at after we finish port to Modern Hooks.