Let's talk about tags substitution again. Today I'm working on that huge sex scene script (which is very simple to review

), and once again look at huge checks that I had to come up with to make sure we show the best possible picture. How should it really work:
Partner_hidden logic:1) If we use partner_hidden, it should have greater priority than location. Ie if we don't have partner_hidden+wildness, and we don't have that combination, we should try to show partner_hidden+simple_bg OR partner_hidden+no_bg.
2) If there are NO partner_hidden pictures with proper action and simple/no bg, then we try to show after_sex instead with proper location, or simple bg/no bg if there is no a proper location picture.
3) If we don't have even them, we have no choice but ignore partner_hidden tag, and show best possible pictures without it.
Location and actions logic:1) If we don't have needed location, we should try to show simple_bg OR no_bg with needed actions.
2) For actions that don't have a picture (usually foot and handjob, but there could be more for rare chars) we show after_sex with needed location instead.
3) If there are no perfect location pictures, or even simple_bg/no_bg pictures, we should try to show after_sex with needed location, and if we don't have them, after_sex + no_bg/simple_bg.
5) Finally, if we don't have even pictures from 3), we show closest possible location, ie if we have indoors+living room+anal, let's try to show indoors+anal at very least.
This is complex as hell, but it should provide the best possible sex picture. Currently function that does it is far from showing the best possible one.