Update useSlave scenes
The goal of this MR was to update the useSlave scenes (as lightly as possible) so that they would use getSlave($AS)
where $AS = $activeSlave.ID
, per svorn's suggestion. Works well in testing. This avoids making updates to a copy of an object (the $activeSlave
system we love to hate) that then goes out of sync, and should be a much better way of handling the situation.
I found two limitations, @svornost. One was <<setLocalPronouns getSlave($AS)>>
does not work, but it wasn't an issue to leave that as $activeSlave
since there was no updating being done. The other is that getSlave($AS).inflationType
is not a valid drop in replacement for a block of SC text, it had to be <<= getSlave($AS).inflationType>>
. You probably knew that, but just posting it here for anyone else that takes up the technique. I had to test each scene for places it was just printing "getSlave($AS).inflationType" instead of the value it contained.
It's probably not critical, but I added the update pronoun widget to the few passages that did not have it.
I also took this opportunity to move the files to a central location. One of them is a series of widgets in it's own file and a few are actually passages with their own control over the back button, so I moved each category to their own folder.
I tested both pregnancy and inflationType and found that they are correctly set as well with this MR.
Merge request reports
Activity
I don't think we even need the pronoun check at all to be honest, since these are always called from interact and that sets pronouns itself. edit: ahh, seems some are used for fucktoy in main, so better to have the checks, yeah.
And yeah, a local would work, good point. Printing the function works fine too though it seems, so I'll probably just leave it.
Edited by lowercasedonkey
Fixes broken fuckdoll scenes per Blank's observation in !6336 (merged). They were the only useSlave scenes that were in widgets, so I'm moving them into the same format as everything else and updating the few places that used them.
edit: and there is a block in surgeryDegredation that indicates agents should be treated as though they are not available for surgeries etc, so I'm gating that in the UI:
Edited by lowercasedonkey@svornost sorry to ping you, but I'm examining some other areas and came across this:
<<set _slave = $activeSlave = $eventSlave>>
I know it makes sense, transitive property and all, but I didn't think we could do that in SC?edit: oh wait, this is the thing you wrote. I guess you like it then. and the _slave thing updates activeSlave, so you need AS Dump?
edit2: reason I'm asking is I'm looking at how hard it would be to phase out AS Dump altogether.
Edited by lowercasedonkeyYeah, that was me being lazy as hell because I'd already written a passage with _slave and then realized that I needed $activeSlave set properly too. Not really a pattern I recommend ;)
Edited by svornost
mentioned in commit d80bb124
I'm a tad bit worried about how this will scale with large slave arrays and how many times it gets called. May be valid to go for an inbetween like the special roles have and use a copy of the object just to run checks off of while making changes directly.
Why not use just $slaves[index]? Refresh my memory please.
I proposed
slaves[
AS] but @svornost preferred the function call, maybe he can explain. The function is stupid light though, I don't think scaling would be any issue whatsoever. In particular, we only need this system for SC passages. There's no reason to use $activeSlave in JS.