Sexlab Release Redux
Version 2.2.2
By davisev5225
 
What does it do? It triggers the player to automatically start a Sexlab masturbation scene when above a certain arousal value. MCM configurable, both the arousal value and the polling interval (how often it checks your arousal level). Scenes are selected by tag, so it should support custom animation packs as long as they are properly registered with the Sexlab Framework.

NEW IN 1.9: NPCs can now automatically masturbate as well! Hooray!
 
Why does it exist? I can't speak for the original author, but I picked up working on this because I use a couple different mods that have consequences for public sex (including masturbation), and I liked the idea of having another way to trigger these consequences.
 
This is a patched version of Sexlab Release v1.3 by rangedphoenix, located here:
http://www.loverslab.com/files/file/790-sexlab-release-v13/

Credits:
rangedphoenix (original mod)
davisev5225 (these updates)
naaitsab (code contribution)
wpg97541 (code contribution)
vjnmrf6 - gamesource.ru (Russian translation for version 2.1)

Requires:
Sexlab
Sexlab Aroused Redux
(and all their associated dependencies)
 
Optional (these don't have to be installed if you don't want them):
Devious Devices - Assets
Devious Devices - Integration

Permissions:
This code used to be free for any LoversLab user to use, reference, or otherwise incorporate into their own works as long as those works are released to the public on LoversLab and so long as I received appropriate credit, but due to certain Russian players not respecting those requirements, I no longer provide the source code, since I am unencumbered by other mod permissions.

This mod may not be released, in part or in whole, anywhere except LoversLab.  You may not re-publish this mod without my express permission, nor may you "revive" or otherwise attempt to re-introduce this mod or incorporate functionality that is so similar in nature as to appear identical into any other mods without my express permission.  Should you be unable to contact me for any reason, I still retain my rights as content creator - those rights do not cease to be just because I do not respond.  The only person who may choose to use or re-introduce my work on this mod is rangedphoenix, since this is based upon their work.

Most importantly: Distributing any content based on my code, even just as a reference, behind any scheme that does not allow a user to directly download it from LoversLab without having to join a "club", group, or perform any other actions beyond a direct download is prohibited.  I do not consider such schemes to be "free distribution", despite the staff's insistence that the lack of a paywall makes it free.

Changes:
(+ = Addition; * = Change; - = Removal)

Version 2.2.2
+ Added an option to use Sexlab gender instead of game gender.  You people with dick-girls disgust me, but there you go.  Have fun.  >.<

Version 2.2.1
* I discovered a small bug in the ESP that may cause the mod to stop working and spam the Papyrus log.  Specifically, it was an undeclared property.  This has been fixed.
  (If the mod has stopped working for you, and you cannot find a reason why, you need to make a clean save.  Short version: Delete mod, load game, save game, clean save, install newest version, load cleaned save, configure and have fun.)

Version 2.2
* Fixed the "Aroused Interval" MCM variable so that it actually functions now.
* Corrected some issues with the optional Devious Devices integration that were stopping masturbation scenes when they shouldn't have.

Version 2.1.1
+ Added a Russian translation by vjnmrf6 of gamesource.ru.

Version 2.1
+ New translation file for the MCM! Feel free to submit translations for your native language - if SkyUI supports your language, I'll happily bundle it for you and credit you for translating.
+ Added an option to configure how much log spam you receive.
* Fixed a few more bugs with animations playing too often.

Version 2.0
+ New "Optional Mods" section. Shows if optional mods are enabled or not. Currently just Devious Devices (Assets & Integration). I recommend using the button to re-scan for optional plugins after every mod update, PARTICULARLY if it has been reset to defaults.
+ New debug options, including the ability to turn off log spam if you like. (Please note: support will not be provided if you do not provide a Papyrus log with the "verbose" option selected.)
* Fixed the chastity belt masturbation scene. DDI recently stopped registering their animations to Sexlab, causing the old method to break.
* Fixed the player character masturbating on EVERY scan if they are wearing a chastity belt. Now there's a configurable cool-down timer for use when belted.
* These changes once again required a reset to defaults. Sorry! (All future MCM changes will require a reset to defaults, too, just to prevent any weird-ness with variables and such.)

Version 1.91
* Small bugfix: Fixed the code so it loops properly. Oops!

Version 1.9
+ Huge change! Now NPCs can masturbate as well! Huge thanks to wpg97541 for writing the original NPC code, of which I copied quite a bit (including the new MCM layout). Used with assumed permission, see http://www.loverslab.com/topic/27588-sexlab-release-v13/?p=866807 for details.
* This required an update to the MCM, your settings will be reset to default. You will need to manually re-enable this mod's functions in the MCM.
* If you have any issues with the update, please try installing to a clean (or cleaned) save. I did have some trouble getting the MCM to properly update.

Version 1.8
+ Player will now lower their weapons and/or hands before firing any idle animations. This fixes an issue where, when an animation was played in the middle of combat, the player would be unable to fight again until they opened their inventory and switched out an equipped weapon or spell.

Version 1.7
* Relying on a boolean value seems to be unreliable, as it has still been glitching to always return true. Rewrote the script to no longer use it.

Version 1.6
* For some odd reason, a variable I was declaring and using "AlreadyInScene" was always returning true in some cases. I can't figure out why, so instead, it is now "PlayerAlreadyInScene". This seems to fix the issue.
+ Some code commenting to help people read what is going on. Figured it might be useful.

Version 1.5
+ More checks for existing scenes (and other things that we shouldn't interrupt): GetCurrentScene(), IsMovementControlsEnabled(), IsOnMount(), IsMenuOpen("Dialogue Menu"), IsSwimming().

Version 1.4
+ Now checks Sexlab.IsActorActive() before starting a scene. Doesn't start scene if true. This should prevent accidentally interrupting other Sexlab scenes.

Version 1.3
+ Now properly accounts for armbinders and yokes if they are currently equipped, and uses appropriate animations from Devious Devices - Integration.
+ Now randomly selects between 2 different aroused animations when it can't trigger a scene.

Version 1.2
+ Now, when player is wearing a chastity, it will use a belted masturbation scene instead of just preventing a scene outright. (Thanks, naaitsab!)
+ Added a short aroused (DDZazHornyA) animation when it can't trigger a scene (such as in the middle of combat) - only available if you use Devious Devices - Integration (only tested on 3.0beta1).
* Implemented proper mod file dependency checks, instead of my previous "dirty" method. This should prevent annoying Papyrus log errors.

Version 1.1
* Re-wrote the chastity check to look for keyword "zad_DeviousBelt" instead of just checking if slot 49 is filled.
* This should make it compatible with other mods that use slot 49.
* Devious Devices - Assets is NOT required for this mod to function - it checks for the keyword string instead of referencing the mod directly.

Version 1.0 (Initial Release)
+ Check to see if the player is wearing anything in slot 49 (chastity belt slot), and prevent scene trigger if they are.