code:
:: Widgets Machine Actions Generation [widget]
<<widget "generateActionsMachine">>
<<set $combat to 1>>
<<if _targetlist is undefined>>
	<<getTargetList>>
<</if>>

		<<leftActionInitMachine>>

		<<rightActionInitMachine>>

		<<feetActionInitMachine>>

	<<if ($mouthuse is 0 and !($dissociation lte 1 and $orgasmdown lte 0 and ($pain lt 100 or $willpowerpain is undefined)))>>

			<<mouthActionInit>>

	<</if>>

<</widget>>

<<widget "leftActionInitMachine">>
<<set $lefttarget to "machine">>
<<switch $leftarm>>
<<case 0>>
	<<if $orgasmdown gte 1>>
		<<set _leftOptions to "orgasm">>
		Your left arm is free, but you can't stop the spasms.
	<<elseif $pain gte 100 and $willpowerpain is 0>>
		<<set _leftOptions to "pain">>
		Your left arm is free, but hurts to move.
	<<elseif $dissociation gte 2>>
		<<set _leftOptions to "unreal">>
		Your left arm is free, but doesn't feel real.
	<<else>>
		<<if _targetYourself is true and _targetnumber gt 1>>
			<<set _targetlistarms["Yourself"] to "self">>
		<</if>>
		<<if $combatControls isnot "radio" and _targetnumber gt 1>>
			Target:
			<<listbox "$lefttarget" autoselect>>
				<<optionsfrom _targetlistarms>>
			<</listbox>>

		<</if>>
		<<set _leftOptions to "free">>
		Your left arm is free.
		<<if $combatControls is "radio" and _targetnumber gt 1>>

			Target:
			<<listbox "$lefttarget" autoselect>>
				<<optionsfrom _targetlistarms>>
			<</listbox>>

		<</if>>
	<</if>>
<<case "mechgrappled">>
	<<if $orgasmdown gte 1>>
		<<set _leftOptions to "bound">>
		Your left arm jerks against its bonds.
	<<elseif $pain gte 100 and $willpowerpain is 0>>
		<<set _leftOptions to "bound">>
		Your left arm is held in a painful bind.
	<<elseif $dissociation gte 2>>
		<<set _leftOptions to "bound">>
		Your left arm lies limp in its bonds.
	<<else>>
		<<set _leftOptions to "mech">>
		Your left arm is held down.
	<</if>>
<<case "swarmgrappled">>
	<<set $_changetype to true>><<leftActionInitSwarm>>
<<case "bound">>
	<<if $orgasmdown gte 1>>
		<<set _leftOptions to "bound">>
		Your left arm jerks against its bonds.
	<<elseif $pain gte 100 and $willpowerpain is 0>>
		<<set _leftOptions to "bound">>
		Your left arm is held in a painful bind.
	<<elseif $dissociation gte 2>>
		<<set _leftOptions to "bound">>
		Your left arm lies limp in its bonds.
	<<else>>
		<<set _leftOptions to "bound">>
		Your left arm is bound and helpless.
	<</if>><<if $combatControls is "radio">>
<</if>>
<<case "trapped">>
	<<set $_changetype to true>><<leftActionInitVore>>
<<case "grappled" "penis" "othervagina" "vagina" "coverpenis" "anus" "behind">>
	<<set $_changetype to true>><<leftActionInit>>
<<case "struggle">>
	<<set $_changetype to true>><<leftActionInitStruggle>>
<<default>>
	<<set $_changetype to true>><<leftActionInitTentacle>>
<</switch>>
<<if $_changetype isnot true>>
	<<leftActionsMachine>>
	<<if Object.keys(_leftaction).length gt 0>>
		<<if !(Object.values(_leftaction).includes($leftactiondefault))>>
			<<set $leftactiondefault to "rest">>
		<</if>>
		<<set $leftaction to $leftactiondefault>>
		<<set _textColor to combatListColor('leftaction', (Object.values(_leftaction).includes($leftaction) ? $leftaction : Object.values(_leftaction)[0]), "Machine")>>

			<<generateCombatActionOthers _leftaction "leftaction" _textColor $leftaction "Machine">>

		<<if $combatControls.includes("ists")>>

				<<leftactionDifficulty>>

		<</if>>
	<</if>>
	<<set $lastOptions.left to clone(_leftOptions)>>
<</if>>
<</widget>>

<<widget "leftactionDifficultyMachine">>/* Just so things don't break. */
<</widget>>

<<widget "leftActionsMachine">>
<<set _leftaction to {}>>
<<switch _leftOptions>>
<<case "free">>
	<<if $machine.arm_chains>>
		<<if $machine.arm_chains.use isnot "inert" and $machine.arm_chains.use isnot "destroyed">>
			<<set _leftaction["Pull on the chains"] to "chain_struggle">>
		<</if>>
	<</if>>
	<<if $machine.tattoo>>
		<<if $machine.tattoo.use isnot "inert" and $machine.tattoo.use isnot "destroyed">>
			<<set _leftaction["Whack the tattoo gun"] to "whack">>
		<</if>>
	<</if>>
	<<if $machine.vaginal>>
		<<if $machine.vaginal.use isnot "inert" and $machine.vaginal.use isnot "destroyed">>
			<<set _leftaction["Whack the phallic machine"] to "vaginal_whack">>
			<<set _leftaction["Push the phallic machine away"] to "vaginal_push">>
		<</if>>
	<</if>>
	<<if $machine.anal>>
		<<if $machine.anal.use isnot "inert" and $machine.anal.use isnot "destroyed">>
			<<set _leftaction["Whack the small phallic machine"] to "anal_whack">>
			<<set _leftaction["Push the small phallic machine away"] to "anal_push">>
		<</if>>
	<</if>>
	<<set _leftaction["Rest"] to "rest">>
<<case "mech">>
	<<if $machine.arm_chains>>
		<<if $machine.arm_chains.use isnot "inert" and $machine.arm_chains.use isnot "destroyed">>
			<<set _leftaction["Pull on the chains"] to "chain_struggle">>
		<</if>>
	<</if>>
	<<set _leftaction["Rest"] to "rest">>
<<case "orgasm">>
	<<set _leftaction["Fold"] to "leftfold">>
	<<set _leftaction["Grip"] to "leftgrip">>
<<case "pain">>
	<<set _leftaction["Struggle"] to "leftstruggleweak">>
	<<set _leftaction["Protect"] to "leftprotect">>
<<case "unreal">>
	<<set _leftaction["Poke yourself"] to "leftpoke">>
	<<set _leftaction["Keep your arms out of the way"] to "leftcurl">>
<</switch>>
<</widget>>

<<widget "rightActionInitMachine">>
<<set $righttarget to "machine">>
<<switch $rightarm>>
<<case 0>>
	<<if $orgasmdown gte 1>>
		<<set _rightOptions to "orgasm">>
		Your right arm is free, but you can't stop the spasms.
	<<elseif $pain gte 100 and $willpowerpain is 0>>
		<<set _rightOptions to "pain">>
		Your right arm is free, but hurts to move.
	<<elseif $dissociation gte 2>>
		<<set _rightOptions to "unreal">>
		Your right arm is free, but doesn't feel real.
	<<else>>
		<<if _targetYourself is true and _targetnumber gt 1>>
			<<set _targetlistarms["Yourself"] to "self">>
		<</if>>
		<<if $combatControls isnot "radio" and _targetnumber gt 1>>
			Target:
			<<listbox "$righttarget" autoselect>>
				<<optionsfrom _targetlistarms>>
			<</listbox>>

		<</if>>
		<<set _rightOptions to "free">>
		Your right arm is free.
		<<if $combatControls is "radio" and _targetnumber gt 1>>

			Target:
			<<listbox "$righttarget" autoselect>>
				<<optionsfrom _targetlistarms>>
			<</listbox>>

		<</if>>
	<</if>>
<<case "mechgrappled">>
	<<if $orgasmdown gte 1>>
		<<set _rightOptions to "bound">>
		Your right arm jerks against its bonds.
	<<elseif $pain gte 100 and $willpowerpain is 0>>
		<<set _rightOptions to "bound">>
		Your right arm is held in a painful bind.
	<<elseif $dissociation gte 2>>
		<<set _rightOptions to "bound">>
		Your right arm lies limp in its bonds.
	<<else>>
		<<set _rightOptions to "mech">>
		Your right arm is held down.
	<</if>>
<<case "swarmgrappled">>
	<<set $_changetype to true>><<rightActionInitSwarm>>
<<case "bound">>
	<<if $orgasmdown gte 1>>
		<<set _rightOptions to "bound">>
		Your right arm jerks against its bonds.
	<<elseif $pain gte 100 and $willpowerpain is 0>>
		<<set _rightOptions to "bound">>
		Your right arm is held in a painful bind.
	<<elseif $dissociation gte 2>>
		<<set _rightOptions to "bound">>
		Your right arm lies limp in its bonds.
	<<else>>
		<<set _rightOptions to "bound">>
		Your right arm is bound and helpless.
	<</if>><<if $combatControls is "radio">>
<</if>>
<<case "trapped">>
	<<set $_changetype to true>><<rightActionInitVore>>
<<case "grappled" "penis" "othervagina" "vagina" "coverpenis" "anus" "behind">>
	<<set $_changetype to true>><<rightActionInit>>
<<case "struggle">>
	<<set $_changetype to true>><<rightActionInitStruggle>>
<<default>>
	<<set $_changetype to true>><<rightActionInitTentacle>>
<</switch>>
<<if $_changetype isnot true>>
	<<rightActionsMachine>>
	<<if Object.keys(_rightaction).length gt 0>>
		<<if !(Object.values(_rightaction).includes($rightactiondefault))>>
			<<set $rightactiondefault to "rest">>
		<</if>>
		<<set $rightaction to $rightactiondefault>>
		<<set _textColor to combatListColor('rightaction', (Object.values(_rightaction).includes($rightaction) ? $rightaction : Object.values(_rightaction)[0]), "Machine")>>

			<<generateCombatActionOthers _rightaction "rightaction" _textColor $rightaction "Machine">>

		<<if $combatControls.includes("ists")>>

				<<rightactionDifficulty>>

		<</if>>
	<</if>>
	<<set $lastOptions.right to clone(_rightOptions)>>
<</if>>
<</widget>>

<<widget "rightactionDifficultyMachine">>/* Don't think about it, just accept. */
<</widget>>

<<widget "rightActionsMachine">>
<<set _rightaction to {}>>
<<switch _rightOptions>>
<<case "free">>
	<<if $machine.arm_chains>>
		<<if $machine.arm_chains.use isnot "inert" and $machine.arm_chains.use isnot "destroyed">>
			<<set _rightaction["Pull on the chains"] to "chain_struggle">>
		<</if>>
	<</if>>
	<<if $machine.tattoo>>
		<<if $machine.tattoo.use isnot "inert" and $machine.tattoo.use isnot "destroyed">>
			<<set _rightaction["Whack the tattoo gun"] to "whack">>
		<</if>>
	<</if>>
	<<if $machine.vaginal>>
		<<if $machine.vaginal.use isnot "inert" and $machine.vaginal.use isnot "destroyed">>
			<<set _rightaction["Whack the phallic machine"] to "vaginal_whack">>
			<<set _rightaction["Push the phallic machine away"] to "vaginal_push">>
		<</if>>
	<</if>>
	<<if $machine.anal>>
		<<if $machine.anal.use isnot "inert" and $machine.anal.use isnot "destroyed">>
			<<set _rightaction["Whack the small phallic machine"] to "anal_whack">>
			<<set _rightaction["Push the small phallic machine away"] to "anal_push">>
		<</if>>
	<</if>>
	<<set _rightaction["Rest"] to "rest">>
<<case "mech">>
	<<if $machine.arm_chains>>
		<<if $machine.arm_chains.use isnot "inert" and $machine.arm_chains.use isnot "destroyed">>
			<<set _rightaction["Pull on the chains"] to "chain_struggle">>
		<</if>>
	<</if>>
	<<set _rightaction["Rest"] to "rest">>
<<case "orgasm">>
	<<set _rightaction["Fold"] to "rightfold">>
	<<set _rightaction["Grip"] to "rightgrip">>
<<case "pain">>
	<<set _rightaction["Struggle"] to "rightstruggleweak">>
	<<set _rightaction["Protect"] to "rightprotect">>
<<case "unreal">>
	<<set _rightaction["Poke yourself"] to "rightpoke">>
	<<set _rightaction["Keep your arms out of the way"] to "rightcurl">>
<</switch>>
<</widget>>

<<widget "feetActionInitMachine">>
<<if $dissociation lte 1 and $orgasmdown lte 0 and ($pain lt 100 or $willpowerpain is undefined)>>
	<<set $feettarget to "machine">>
	<<switch $feetuse>>
	<<case 0>>
		<<if _targetYourself is true and _targetnumber gt 1>>
			<<set _targetlistall["Yourself"] to "self">>
		<</if>>
		<<if $combatControls isnot "radio" and _targetnumber gt 1>>
			<<if ($leftleg is "grappled" and $rightleg is "grappled") or ($leftleg is "bound" and $rightleg is "bound")>>
			<<else>>
				Target:
				<<listbox "$feettarget" autoselect>>
					<<optionsfrom _targetlistall>>
				<</listbox>>

			<</if>>
		<</if>>
		<<if $leftleg is 0 and $rightleg is 0>>
			<<set _feetOptions to "free">>
			Your legs are free.
		<<elseif $leftleg is "grappled" or $rightleg is "grappled">>
			<<set $_changetype to true>><<feetActionInitTentacle>>
		<<elseif $leftleg is "bound" and $rightleg is "bound">>
			<<set $_changetype to true>><<feetActionInitTentacle>>
		<<else>>
			<<set _feetOptions to "free">>
			Your legs are free.
		<</if>>
		<<if $combatControls is "radio" and _targetnumber gt 1 and _feetOptions.toLowerCase().includes("free")>>

			Target:
			<<listbox "$feettarget" autoselect>>
				<<optionsfrom _targetlistall>>
			<</listbox>>

		<</if>>
		<<if _targetnumber is 1>>
			<<set $feettarget to _firsttarget>>
		<</if>>
	<<case "mechgrappled">>
		<<set _feetOptions to "mech">>
		Your legs are chained.
	<<case "bound" "penis" "othervagina" "walk" "run" "none">>
		<<set $_changetype to true>><<feetActionInit>>
	<<default>>
		<<set $_changetype to true>><<feetActionInitTentacle>>
	<</switch>>
	<<if $lastOptions.feet isnot _feetOptions>>
		<<set _feetGold to true>>
	<</if>>
	<<if $_changetype isnot true>>
		<<feetActionsMachine>>
		<<if Object.keys(_feetaction).length gt 0>>
			<<if !(Object.values(_feetaction).includes($feetactiondefault))>>
				<<set $feetactiondefault to "rest">>
			<</if>>
			<<set $feetaction to $feetactiondefault>>
			<<set _textColor to combatListColor('feetaction', (Object.values(_feetaction).includes($feetaction) ? $feetaction : Object.values(_feetaction)[0]), "Machine")>>

				<<generateCombatActionOthers _feetaction "feetaction" _textColor $feetaction "Machine">>

			<<if $combatControls.includes("ists")>>

					<<feetactionDifficulty>>

			<</if>>
		<</if>>
		<<set $lastOptions.feet to clone(_feetOptions)>>
	<</if>>
<<else>>
	<<timed 100ms>>
		<<run jQuery("#feetaction").remove();>>
	<</timed>>
<</if>>
<</widget>>

<<widget "feetactionDifficultyMachine">> /* Sometimes in life, there's not much we can do. */
<</widget>>

<<widget "feetActionsMachine">>
<<set _feetaction to {}>>
<<switch _feetOptions>>
<<case "free">>
	<<if $machine.leg_chains>>
		<<if $machine.leg_chains.use isnot "inert" and $machine.leg_chains.use isnot "destroyed">>
			<<set _feetaction["Pull on the chains"] to "chain_struggle">>
		<</if>>
	<</if>>
	<<if $machine.tattoo>>
		<<if $machine.tattoo.use isnot "inert" and $machine.tattoo.use isnot "destroyed">>
			<<set _feetaction["Kick the tattoo gun"] to "whack">>
		<</if>>
	<</if>>
	<<if $machine.vaginal>>
		<<if $machine.vaginal.use isnot "inert" and $machine.vaginal.use isnot "destroyed">>
			<<set _feetaction["Kick the phallic machine"] to "vaginal_whack">>
			<<set _feetaction["Push the phallic machine away"] to "vaginal_push">>
		<</if>>
	<</if>>
	<<if $machine.anal>>
		<<if $machine.anal.use isnot "inert" and $machine.anal.use isnot "destroyed">>
			<<set _feetaction["Kick the small phallic machine"] to "anal_whack">>
			<<set _feetaction["Push the small phallic machine away"] to "anal_push">>
		<</if>>
	<</if>>
	<<set _feetaction["Rest"] to "rest">>
<<case "mech">>
	<<if $machine.leg_chains>>
		<<if $machine.leg_chains.use isnot "inert" and $machine.leg_chains.use isnot "destroyed">>
			<<set _feetaction["Pull against the chains"] to "chain_struggle">>
		<</if>>
	<</if>>
	<<set _feetaction["Rest"] to "rest">>
<</switch>>
<</widget>>

:: Machine Actions [widget]
<<widget "machine_actions">>

<<willpowerpain>>
<<willpowerorgasm>>
<<actioncarry>>
<<actioncarrydrop>>

<<combatstate>>
<<carryblock>>

<<if $trance lte 0 and $panicparalysis is 0 and $panicviolence is 0 and $combatControls isnot "disabled">>
	<<generateActionsMachine>>
<</if>>

<<if $trance lte 0 and $dissociation lte 1 and $panicparalysis is 0 and $panicviolence is 0
and $orgasmdown lte 0 and ($pain lt 100 or $willpowerpain is undefined) and $combatControls is "disabled">>

<<if $leftarm is 0>>

	Your left arm is free.

	<<if $machine.arm_chains>>
		<<if $machine.arm_chains.use isnot "inert" and $machine.arm_chains.use isnot "destroyed">>
			<<if $leftactiondefault is "chain_struggle">>
				| Pull on the chains <<radiobutton "$leftaction" "chain_struggle" checked>>
			<<else>>
				| Pull on the chains <<radiobutton "$leftaction" "chain_struggle">>
			<</if>>
		<</if>>
	<</if>>
	<<if $machine.tattoo>>
		<<if $machine.tattoo.use isnot "inert" and $machine.tattoo.use isnot "destroyed">>
			<<if $leftactiondefault is "whack">>
				| Whack the tattoo gun <<radiobutton "$leftaction" "whack" checked>>
			<<else>>
				| Whack the tattoo gun <<radiobutton "$leftaction" "whack">>
			<</if>>
		<</if>>
	<</if>>
	<<if $machine.vaginal>>
		<<if $machine.vaginal.use isnot "inert" and $machine.vaginal.use isnot "destroyed">>
			<<if $leftactiondefault is "vaginal_whack">>
				| Whack the phallic machine <<radiobutton "$leftaction" "vaginal_whack" checked>>
			<<else>>
				| Whack the phallic machine <<radiobutton "$leftaction" "vaginal_whack">>
			<</if>>
			<<if $leftactiondefault is "vaginal_push">>
				| Push the phallic machine away <<radiobutton "$leftaction" "vaginal_push" checked>>
			<<else>>
				| Push the phallic machine away <<radiobutton "$leftaction" "vaginal_push">>
			<</if>>
		<</if>>
	<</if>>
	<<if $machine.anal>>
		<<if $machine.anal.use isnot "inert" and $machine.anal.use isnot "destroyed">>
			<<if $leftactiondefault is "anal_whack">>
				| Whack the small phallic machine <<radiobutton "$leftaction" "anal_whack" checked>>
			<<else>>
				| Whack the small phallic machine <<radiobutton "$leftaction" "anal_whack">>
			<</if>>
			<<if $leftactiondefault is "anal_push">>
				| Push the phallic machine away <<radiobutton "$leftaction" "anal_push" checked>>
			<<else>>
				| Push the phallic machine away <<radiobutton "$leftaction" "anal_push">>
			<</if>>
		<</if>>
	<</if>>
	<<if $leftactiondefault is "rest">>
		| Rest <<radiobutton "$leftaction" "rest" checked>>
	<<else>>
		| Rest <<radiobutton "$leftaction" "rest">>
	<</if>>
<<elseif $leftarm is "mechgrappled">>

	Your left arm is held down.

	<<if $machine.arm_chains>>
		<<if $machine.arm_chains.use isnot "inert" and $machine.arm_chains.use isnot "destroyed">>
			<<if $leftactiondefault is "chain_struggle">>
				| Pull on the chains <<radiobutton "$leftaction" "chain_struggle" checked>>
			<<else>>
				| Pull on the chains <<radiobutton "$leftaction" "chain_struggle">>
			<</if>>
		<</if>>
	<</if>>
	<<if $leftactiondefault is "rest">>
		| Rest <<radiobutton "$leftaction" "rest" checked>>
	<<else>>
		| Rest <<radiobutton "$leftaction" "rest">>
	<</if>>
<<elseif $leftarm is "bound">>

	Your left arm is bound.

<</if>>

<<if $rightarm is 0>>

	Your right arm is free.

	<<if $machine.arm_chains>>
		<<if $machine.arm_chains.use isnot "inert" and $machine.arm_chains.use isnot "destroyed">>
			<<if $rightactiondefault is "chain_struggle">>
				| Pull on the chains <<radiobutton "$rightaction" "chain_struggle" checked>>
			<<else>>
				| Pull on the chains <<radiobutton "$rightaction" "chain_struggle">>
			<</if>>
		<</if>>
	<</if>>
	<<if $machine.tattoo>>
		<<if $machine.tattoo.use isnot "inert" and $machine.tattoo.use isnot "destroyed">>
			<<if $rightactiondefault is "whack">>
				| Whack the tattoo gun <<radiobutton "$rightaction" "whack" checked>>
			<<else>>
				| Whack the tattoo gun <<radiobutton "$rightaction" "whack">>
			<</if>>
		<</if>>
	<</if>>
	<<if $machine.vaginal>>
		<<if $machine.vaginal.use isnot "inert" and $machine.vaginal.use isnot "destroyed">>
			<<if $rightactiondefault is "vaginal_whack">>
				| Whack the phallic machine <<radiobutton "$rightaction" "vaginal_whack" checked>>
			<<else>>
				| Whack the phallic machine <<radiobutton "$rightaction" "vaginal_whack">>
			<</if>>
			<<if $rightactiondefault is "vaginal_push">>
				| Push the phallic machine away <<radiobutton "$rightaction" "vaginal_push" checked>>
			<<else>>
				| Push the phallic machine away <<radiobutton "$rightaction" "vaginal_push">>
			<</if>>
		<</if>>
	<</if>>
	<<if $machine.anal>>
		<<if $machine.anal.use isnot "inert" and $machine.anal.use isnot "destroyed">>
			<<if $rightactiondefault is "anal_whack">>
				| Whack the small phallic machine <<radiobutton "$rightaction" "anal_whack" checked>>
			<<else>>
				| Whack the small phallic machine <<radiobutton "$rightaction" "anal_whack">>
			<</if>>
			<<if $rightactiondefault is "anal_push">>
				| Push the small phallic machine away <<radiobutton "$rightaction" "anal_push" checked>>
			<<else>>
				| Push the small phallic machine away <<radiobutton "$rightaction" "anal_push">>
			<</if>>
		<</if>>
	<</if>>
	<<if $rightactiondefault is "rest">>
		| Rest <<radiobutton "$rightaction" "rest" checked>>
	<<else>>
		| Rest <<radiobutton "$rightaction" "rest">>
	<</if>>
<<elseif $rightarm is "mechgrappled">>

	Your right arm is chained.

	<<if $machine.arm_chains>>
		<<if $machine.arm_chains.use isnot "inert" and $machine.arm_chains.use isnot "destroyed">>
			<<if $rightactiondefault is "chain_struggle">>
				| Pull on the chains <<radiobutton "$rightaction" "chain_struggle" checked>>
			<<else>>
				| Pull on the chains <<radiobutton "$rightaction" "chain_struggle">>
			<</if>>
		<</if>>
	<</if>>
	<<if $rightactiondefault is "rest">>
		| Rest <<radiobutton "$rightaction" "rest" checked>>
	<<else>>
		| Rest <<radiobutton "$rightaction" "rest">>
	<</if>>
<<elseif $rightarm is "bound">>

	Your right arm is bound.

<</if>>

<<if $feetuse is 0>>

	Your legs are free.

	<<if $machine.leg_chains>>
		<<if $machine.leg_chains.use isnot "inert" and $machine.leg_chains.use isnot "destroyed">>
			<<if $feetactiondefault is "chain_struggle">>
				| Pull on the chains <<radiobutton "$feetaction" "chain_struggle" checked>>
			<<else>>
				| Pull on the chains <<radiobutton "$feetaction" "chain_struggle">>
			<</if>>
		<</if>>
	<</if>>
	<<if $machine.tattoo>>
		<<if $machine.tattoo.use isnot "inert" and $machine.tattoo.use isnot "destroyed">>
			<<if $feetactiondefault is "whack">>
				| Kick the tattoo gun <<radiobutton "$feetaction" "whack" checked>>
			<<else>>
				| Kick the tattoo gun <<radiobutton "$feetaction" "whack">>
			<</if>>
		<</if>>
	<</if>>
	<<if $machine.vaginal>>
		<<if $machine.vaginal.use isnot "inert" and $machine.vaginal.use isnot "destroyed">>
			<<if $feetactiondefault is "vaginal_whack">>
				| Kick the phallic machine <<radiobutton "$feetaction" "vaginal_whack" checked>>
			<<else>>
				| Kick the phallic machine <<radiobutton "$feetaction" "vaginal_whack">>
			<</if>>
			<<if $feetactiondefault is "vaginal_push">>
				| Push the phallic machine away <<radiobutton "$feetaction" "vaginal_push" checked>>
			<<else>>
				| Push the phallic machine away <<radiobutton "$feetaction" "vaginal_push">>
			<</if>>
		<</if>>
	<</if>>
	<<if $machine.anal>>
		<<if $machine.anal.use isnot "inert" and $machine.anal.use isnot "destroyed">>
			<<if $feetactiondefault is "anal_whack">>
				| Kick the small phallic machine <<radiobutton "$feetaction" "anal_whack" checked>>
			<<else>>
				| Kick the small phallic machine <<radiobutton "$feetaction" "anal_whack">>
			<</if>>
			<<if $feetactiondefault is "anal_push">>
				| Push the small phallic machine away <<radiobutton "$feetaction" "anal_push" checked>>
			<<else>>
				| Push the small phallic machine away <<radiobutton "$feetaction" "anal_push">>
			<</if>>
		<</if>>
	<</if>>
	<<if $feetactiondefault is "rest">>
		| Rest <<radiobutton "$feetaction" "rest" checked>>
	<<else>>
		| Rest <<radiobutton "$feetaction" "rest">>
	<</if>>
<<elseif $feetuse is "mechgrappled">>

	Your legs are chained.

	<<if $machine.leg_chains>>
		<<if $machine.leg_chains.use isnot "inert" and $machine.leg_chains.use isnot "destroyed">>
			<<if $feetactiondefault is "chain_struggle">>
				| Pull against the chains <<radiobutton "$feetaction" "chain_struggle" checked>>
			<<else>>
				| Pull against the chains <<radiobutton "$feetaction" "chain_struggle">>
			<</if>>
		<</if>>
	<</if>>
	<<if $feetactiondefault is "rest">>
		| Rest <<radiobutton "$feetaction" "rest" checked>>
	<<else>>
		| Rest <<radiobutton "$feetaction" "rest">>
	<</if>>
<</if>>

<</if>>

<<if $images is 1>>

	<<timed 100ms>>
	<<combatimg>>

	<</timed>>
<</if>>

<<setupMidOrgasm>>

<</widget>>


code:
:: Machine Effects [widget]
<<widget "machine_effects">>
<<set $pain -= 1>>

<<if $trance gte 1 or $dissociation gte 2>>
	<<if $position is "stalk">>
		You wander in a daze, unaware of your surroundings.
	<<else>>
		You stare straight ahead, your body passive and compliant.
	<</if>>
<</if>>

<<if $underwater is 1>>
	<<set $underwatertime += 1>>
	<<if $underwatertime lte 5>>
		You are underwater, and cannot speak.
	<<elseif $underwatertime lte 10>>
		You are underwater, and cannot breathe.
		<<gstress>><<stress 1>>
	<<elseif $underwatertime lte 15>>
		You are underwater, and cannot breathe.
		<<gstress>><<stress 2>>
	<<elseif $underwatertime lte 20>>
		You are underwater, and cannot breathe.
		<<gtrauma>><<gstress>><<stress 4>><<trauma 2>>
	<<else>>
		You are suffocating beneath the water.
		<<set $pain += 20>><<gtrauma>><<gstress>><<stress 6>><<trauma 4>>

	<</if>>
<</if>>

<<effectspain>>
<<effectsorgasm>>
<<effectsdissociation>>

<<if $leftaction is "rest">>
	<<set $leftactiondefault to "rest">><<set $leftaction to 0>>
<</if>>

<<if $rightaction is "rest">>
	<<set $rightactiondefault to "rest">><<set $rightaction to 0>>
<</if>>

<<if $leftaction is "chain_struggle" and $rightaction is "chain_struggle">>
	<<set $leftaction to 0>><<set $leftactiondefault to "chain_struggle">><<set $rightaction to 0>><<set $rightactiondefault to "chain_struggle">>
	<<defiance 5>><<set $machine.arm_chains.health -= 2>>
	You pull both arms against the chains. You feel something give, but they tighten in response.

<<elseif $leftaction is "chain_struggle">>
	<<set $leftaction to 0>><<set $leftactiondefault to "chain_struggle">>
	You pull against the chains with your left arm. You feel something give, but they tighten in response.

<<elseif $rightaction is "chain_struggle">>
	<<set $rightaction to 0>><<set $rightactiondefault to "chain_struggle">>
	You pull against the chains with your right arm. You feel something give, but they tighten in response.

<</if>>

<<if $leftaction is "whack" and $rightaction is "whack">>
	<<set $leftactiondefault to "whack">><<set $leftaction to 0>><<set $rightactiondefault to "whack">><<set $rightaction to 0>>
	<<defiance 10>><<set $machine.tattoo.health -= 2>><<machine_violent_arms>>
	<<if $machine.tattoo.use isnot "ready">>
		You whack the tattoo gun with both hands, knocking it away from you.
		<<set $machine.tattoo.use to "ready">>
		<<set $machine.tattoo.state to "ready">>
	<<else>>
		You whack the tattoo gun with both hands.
	<</if>>
	<<set $attackstat += 2>>
	<<if $physique gte random(1, $physiquemax)>>
		You feel something snap behind the metal.<<set $machine.tattoo.health -= 2>>
	<</if>>

<<elseif $leftaction is "whack">>
	<<set $leftactiondefault to "whack">><<set $leftaction to 0>>
	<<defiance 5>><<set $machine.tattoo.health -= 1>><<machine_violent_arms>>
	<<if $machine.tattoo.use isnot "ready">>
		You whack the tattoo gun, knocking it away from you.
		<<set $machine.tattoo.use to "ready">>
		<<set $machine.tattoo.state to "ready">>
	<<else>>
		You whack the tattoo gun.
	<</if>>
	<<set $attackstat += 1>>
	<<if $physique gte random(1, $physiquemax)>>
		You feel something snap behind the metal.<<set $machine.tattoo.health -= 1>>
	<</if>>

<<elseif $rightaction is "whack">>
	<<set $rightactiondefault to "whack">><<set $rightaction to 0>>
	<<defiance 5>><<set $machine.tattoo.health -= 1>><<machine_violent_arms>>
	<<if $machine.tattoo.use isnot "ready">>
		You whack the tattoo gun, knocking it away from you.
		<<set $machine.tattoo.use to "ready">>
		<<set $machine.tattoo.state to "ready">>
	<<else>>
		You whack the tattoo gun.
	<</if>>
	<<set $attackstat += 1>>
	<<if $physique gte random(1, $physiquemax)>>
		You feel something snap behind the metal.<<set $machine.tattoo.health -= 1>>
	<</if>>

<</if>>

<<if $leftaction is "vaginal_whack" and $rightaction is "vaginal_whack">>
	<<set $leftactiondefault to "vaginal_whack">><<set $leftaction to 0>><<set $rightactiondefault to "vaginal_whack">><<set $rightaction to 0>>
	<<defiance 10>><<set $machine.vaginal.health -= 2>><<machine_violent_arms>>
	<<if $machine.vaginal.use isnot "ready" and $physique gte random(1, 40000)>>
		You whack the phallic machine with both hands, knocking it away from you.
		<<set $machine.vaginal.use to "ready">>
		<<set $machine.vaginal.state to "ready">>
	<<else>>
		You whack the phallic machine with both hands.
	<</if>>
	<<set $attackstat += 2>>
	<<if $physique gte random(1, $physiquemax)>>
		You feel something snap behind the silicon.<<set $machine.vaginal.health -= 2>>
	<</if>>

<<elseif $leftaction is "vaginal_whack">>
	<<set $leftactiondefault to "vaginal_whack">><<set $leftaction to 0>>
	<<defiance 5>><<set $machine.vaginal.health -= 1>><<machine_violent_arms>>
	<<if $machine.vaginal.use isnot "ready" and $physique gte random(1, 50000)>>
		You whack the phallic machine, knocking it away from you.
		<<set $machine.vaginal.use to "ready">>
		<<set $machine.vaginal.state to "ready">>
	<<else>>
		You whack the phallic machine.
	<</if>>
	<<set $attackstat += 1>>
	<<if $physique gte random(1, $physiquemax)>>
		You feel something snap behind the silicon.<<set $machine.vaginal.health -= 1>>
	<</if>>

<<elseif $rightaction is "vaginal_whack">>
	<<set $rightactiondefault to "vaginal_whack">><<set $rightaction to 0>>
	<<defiance 5>><<set $machine.vaginal.health -= 1>><<machine_violent_arms>>
	<<if $machine.vaginal.use isnot "ready" and $physique gte random(1, 50000)>>
		You whack the phallic machine, knocking it away from you.
		<<set $machine.vaginal.use to "ready">>
		<<set $machine.vaginal.state to "ready">>
	<<else>>
		You whack the phallic machine.
	<</if>>
	<<set $attackstat += 1>>
	<<if $physique gte random(1, $physiquemax)>>
		You feel something snap behind the metal.<<set $machine.vaginal.health -= 1>>
	<</if>>

<</if>>

<<if $leftaction is "vaginal_push" and $rightaction is "vaginal_push">>
	<<set $leftaction to 0>><<set $leftactiondefault to "vaginal_push">><<set $rightaction to 0>><<set $rightactiondefault to "vaginal_push">>
	<<brat 5>><<machine_violent_arms>>
	<<if random(1, 3) is 3>>
		<<set $machine.vaginal.health -= 1>>
	<</if>>
	<<if $machine.vaginal.state is "penetrated">>
		You try to push the phallic machine away with both hands, but its hammering is too ferocious.
	<<elseif $machine.vaginal.state is "imminent">>
		<<set $machine.vaginal.state to "ready">>
		<<set $machine.vaginal.use to "ready">>
		<<set $vaginastate to 0>><<set $vaginause to 0>>
		You push the phallic machine with both hands, forcing it away from your <<pussy>>.
	<<elseif $machine.vaginal.state is "entrance">>
		<<set $machine.vaginal.state to "ready">>
		<<set $machine.vaginal.use to "ready">>
		<<set $vaginastate to 0>><<set $vaginause to 0>>
		You push the phallic machine with both hands, forcing it away from your <<pussy>>.
	<<else>>
		You push the phallic machine with both hands, trying to keep it away from your <<pussy>>.
	<</if>>
<<elseif $leftaction is "vaginal_push">>
	<<set $leftaction to 0>><<set $leftactiondefault to "vaginal_push">>
	<<brat 5>><<machine_violent_arms>>
	<<if random(1, 6) is 6>>
		<<set $machine.vaginal.health -= 1>>
	<</if>>
	<<if $machine.vaginal.state is "penetrated">>
		You try to push the phallic machine away with your left hand, but its hammering is too ferocious.
	<<elseif $machine.vaginal.state is "imminent">>
		<<set $machine.vaginal.state to "entrance">>
		<<set $vaginastate to "entrance">>
		You push the phallic machine with your left hand, forcing it away from your <<pussy>>.
	<<elseif $machine.vaginal.state is "entrance">>
		<<set $machine.vaginal.state to "ready">>
		<<set $machine.vaginal.use to "ready">>
		<<set $vaginause to 0>><<set $vaginastate to 0>>
		You push the phallic machine with your left hand, forcing it away from your <<pussy>>.
	<<else>>
		You push the phallic machine with your left hand, trying to keep it away from your <<pussy>>.
	<</if>>
<<elseif $rightaction is "vaginal_push">>
	<<set $rightaction to 0>><<set $rightactiondefault to "vaginal_push">>
	<<brat 5>><<machine_violent_arms>>
	<<if random(1, 6) is 6>>
		<<set $machine.vaginal.health -= 1>>
	<</if>>
	<<if $machine.vaginal.state is "penetrated">>
		You try to push the phallic machine away with your right hand, but its hammering is too ferocious.
	<<elseif $machine.vaginal.state is "imminent">>
		<<set $machine.vaginal.state to "entrance">>
		<<set $vaginastate to "entrance">>
		You push the phallic machine with your right hand, forcing it away from your <<pussy>>.
	<<elseif $machine.vaginal.state is "entrance">>
		<<set $machine.vaginal.state to "ready">>
		<<set $machine.vaginal.use to "ready">>
		<<set $vaginause to 0>><<set $vaginastate to 0>>
		You push the phallic machine with your right hand, forcing it away from your <<pussy>>.
	<<else>>
		You push the phallic machine with your right hand, trying to keep it away from your <<pussy>>.
	<</if>>
<</if>>

<<if $leftaction is "anal_whack" and $rightaction is "anal_whack">>
	<<set $leftactiondefault to "anal_whack">><<set $leftaction to 0>><<set $rightactiondefault to "anal_whack">><<set $rightaction to 0>>
	<<defiance 10>><<set $machine.anal.health -= 2>><<machine_violent_arms>>
	<<if $machine.anal.use isnot "ready" and $physique gte random(1, 40000)>>
		You whack the small phallic machine with both hands, knocking it away from you.
		<<set $machine.anal.use to "ready">>
		<<set $machine.anal.state to "ready">>
	<<else>>
		You whack the small phallic machine with both hands.
	<</if>>
	<<set $attackstat += 2>>
	<<if $physique gte random(1, $physiquemax)>>
		You feel something snap behind the silicon.<<set $machine.anal.health -= 2>>
	<</if>>

<<elseif $leftaction is "anal_whack">>
	<<set $leftactiondefault to "anal_whack">><<set $leftaction to 0>>
	<<defiance 5>><<set $machine.anal.health -= 1>><<machine_violent_arms>>
	<<if $machine.anal.use isnot "ready" and $physique gte random(1, 50000)>>
		You whack the small phallic machine, knocking it away from you.
		<<set $machine.anal.use to "ready">>
		<<set $machine.anal.state to "ready">>
	<<else>>
		You whack the small phallic machine.
	<</if>>
	<<set $attackstat += 1>>
	<<if $physique gte random(1, $physiquemax)>>
		You feel something snap behind the silicon.<<set $machine.anal.health -= 1>>
	<</if>>

<<elseif $rightaction is "anal_whack">>
	<<set $rightactiondefault to "anal_whack">><<set $rightaction to 0>>
	<<defiance 5>><<set $machine.anal.health -= 1>><<machine_violent_arms>>
	<<if $machine.anal.use isnot "ready" and $physique gte random(1, 50000)>>
		You whack the small phallic machine, knocking it away from you.
		<<set $machine.anal.use to "ready">>
		<<set $machine.anal.state to "ready">>
	<<else>>
		You whack the small phallic machine.
	<</if>>
	<<set $attackstat += 1>>
	<<if $physique gte random(1, $physiquemax)>>
		You feel something snap behind the metal.<<set $machine.anal.health -= 1>>
	<</if>>

<</if>>

<<if $leftaction is "anal_push" and $rightaction is "anal_push">>
	<<set $leftaction to 0>><<set $leftactiondefault to "anal_push">><<set $rightaction to 0>><<set $rightactiondefault to "anal_push">>
	<<brat 5>><<machine_violent_arms>>
	<<if random(1, 3) is 3>>
		<<set $machine.anal.health -= 1>>
	<</if>>
	<<if $machine.anal.state is "penetrated">>
		You try to push the small phallic machine away with both hands, but its hammering is too ferocious.
	<<elseif $machine.anal.state is "imminent">>
		<<set $machine.anal.state to "ready">>
		<<set $machine.anal.use to "ready">>
		<<set $anusstate to 0>><<set $anususe to 0>>
		You push the small phallic machine with both hands, forcing it away from your <<bottom>>.
	<<elseif $machine.anal.state is "entrance">>
		<<set $machine.anal.state to "ready">>
		<<set $machine.anal.use to "ready">>
		<<set $anusstate to 0>><<set $anususe to 0>>
		You push the small phallic machine with both hands, forcing it away from your <<bottom>>.
	<<else>>
		You push the small phallic machine with both hands, trying to keep it away from your <<bottom>>.
	<</if>>
<<elseif $leftaction is "anal_push">>
	<<set $leftaction to 0>><<set $leftactiondefault to "anal_push">>
	<<brat 5>><<machine_violent_arms>>
	<<if random(1, 6) is 6>>
		<<set $machine.anal.health -= 1>>
	<</if>>
	<<if $machine.anal.state is "penetrated">>
		You try to push the small phallic machine away with your left hand, but its hammering is too ferocious.
	<<elseif $machine.anal.state is "imminent">>
		<<set $machine.anal.state to "entrance">>
		<<set $anusstate to "entrance">>
		You push the small phallic machine with your left hand, forcing it away from your <<bottom>>.
	<<elseif $machine.anal.state is "entrance">>
		<<set $machine.anal.state to "ready">>
		<<set $machine.anal.use to "ready">>
		<<set $anususe to 0>><<set $anusstate to 0>>
		You push the small phallic machine with your left hand, forcing it away from your <<bottom>>.
	<<else>>
		You push the small phallic machine with your left hand, trying to keep it away from your <<bottom>>.
	<</if>>
<<elseif $rightaction is "anal_push">>
	<<set $rightaction to 0>><<set $rightactiondefault to "anal_push">>
	<<brat 5>><<machine_violent_arms>>
	<<if random(1, 6) is 6>>
		<<set $machine.anal.health -= 1>>
	<</if>>
	<<if $machine.anal.state is "penetrated">>
		You try to push the small phallic machine away with your right hand, but its hammering is too ferocious.
	<<elseif $machine.anal.state is "imminent">>
		<<set $machine.anal.state to "entrance">>
		<<set $anusstate to "entrance">>
		You push the small phallic machine with your right hand, forcing it away from your <<bottom>>.
	<<elseif $machine.anal.state is "entrance">>
		<<set $machine.anal.state to "ready">>
		<<set $machine.anal.use to "ready">>
		<<set $anususe to 0>><<set $anusstate to 0>>
		You push the small phallic machine with your right hand, forcing it away from your <<bottom>>.
	<<else>>
		You push the small phallic machine with your right hand, trying to keep it away from your <<bottom>>.
	<</if>>
<</if>>

<<if $feetaction is "rest">>
	<<set $feetaction to "rest">><<set $feetactiondefault to "rest">>
<</if>>

<<if $feetaction is "chain_struggle">>
	<<set $feetaction to 0>><<set $feetactiondefault to "chain_struggle">>
	<<defiance 5>><<set $machine.leg_chains.health -= 1>>
	You pull against the chains holding your legs. You feel something give, but they tighten in response.

<</if>>

<<if $feetaction is "whack">>
	<<set $feetactiondefault to "whack">><<set $feetaction to 0>>
	<<defiance 5>><<set $machine.tattoo.health -= 1>><<machine_violent_legs>>
	<<if $machine.tattoo.use isnot "ready">>
		You kick the tattoo gun, knocking it away from you.
		<<set $machine.tattoo.use to "ready">>
		<<set $machine.tattoo.state to "ready">>
	<<else>>
		You kick the tattoo gun.
	<</if>>
	<<set $attackstat += 1>>
	<<if $physique gte random(1, $physiquemax)>>
		You feel something snap behind the metal.<<set $machine.tattoo.health -= 1>>
	<</if>>

<</if>>

<<if $feetaction is "vaginal_whack">>
	<<set $feetactiondefault to "vaginal_whack">><<set $feetaction to 0>>
	<<defiance 5>><<set $machine.vaginal.health -= 1>><<machine_violent_legs>>
	<<if random(1, 6) is 6>>
		<<set $machine.vaginal.health -= 1>>
	<</if>>
	<<if $machine.vaginal.use isnot "ready" and $physique gte random(1, 50000)>>
		You kick the phallic machine, knocking it away from you.
		<<set $machine.vaginal.use to "ready">>
		<<set $machine.vaginal.state to "ready">>
	<<else>>
		You kick the phallic machine.
	<</if>>
	<<set $attackstat += 1>>
	<<if $physique gte random(1, $physiquemax)>>
		You feel something snap behind the silicon.<<set $machine.vaginal.health -= 1>>
	<</if>>

<</if>>

<<if $feetaction is "vaginal_push">>
	<<set $feetaction to 0>><<set $feetactiondefault to "vaginal_push">>
	<<brat 5>><<machine_violent_legs>>
	<<if $machine.vaginal.state is "penetrated">>
		You try to push the phallic machine away with your feet, but it doesn't relent.
	<<elseif $machine.vaginal.state is "imminent">>
		<<set $machine.vaginal.state to "entrance">>
		<<set $vaginastate to "entrance">>
		You push the phallic machine with your feet, forcing it away from your <<pussy>>.
	<<elseif $machine.vaginal.state is "entrance">>
		<<set $machine.vaginal.state to "ready">>
		<<set $machine.vaginal.use to "ready">>
		<<set $vaginause to 0>><<set $vaginastate to 0>>
		You push the phallic machine with your feet, forcing it away from your <<pussy>>.
	<<else>>
		You push the phallic machine with your feet, trying to keep it away from your <<pussy>>.
	<</if>>

<</if>>

<<if $feetaction is "anal_whack">>
	<<set $feetactiondefault to "anal_whack">><<set $feetaction to 0>>
	<<defiance 5>><<set $machine.anal.health -= 1>><<machine_violent_legs>>
	<<if random(1, 6) is 6>>
		<<set $machine.anal.health -= 1>>
	<</if>>
	<<if $machine.anal.use isnot "ready" and $physique gte random(1, 50000)>>
		You kick the small phallic machine, knocking it away from you.
		<<set $machine.anal.use to "ready">>
		<<set $machine.anal.state to "ready">>
	<<else>>
		You kick the small phallic machine.
	<</if>>
	<<set $attackstat += 1>>
	<<if $physique gte random(1, $physiquemax)>>
		You feel something snap behind the silicon.<<set $machine.anal.health -= 1>>
	<</if>>

<</if>>

<<if $feetaction is "anal_push">>
	<<set $feetaction to 0>><<set $feetactiondefault to "anal_push">>
	<<brat 5>><<machine_violent_legs>>
	<<if $machine.anal.state is "penetrated">>
		You try to push the small phallic machine away with your feet, but it continues to hammer your <<bottom>>.
	<<elseif $machine.anal.state is "imminent">>
		<<set $machine.anal.state to "entrance">>
		<<set $anusstate to "entrance">>
		You push the small phallic machine with your feet, forcing it away from your <<bottom>>.
	<<elseif $machine.anal.state is "entrance">>
		<<set $machine.anal.state to "ready">>
		<<set $machine.anal.use to "ready">>
		<<set $anususe to 0>><<set $anusstate to 0>>
		You push the small phallic machine with your feet, forcing it away from your <<bottom>>.
	<<else>>
		You push the small phallic machine with your feet, trying to keep it away from your <<bottom>>.
	<</if>>

<</if>>

<<if $machine.tattoo>>
	<<if $machine.tattoo.health lte 0 and $machine.tattoo.use isnot "destroyed">>
		<<set $machine.number -= 1>>
		<<set $machine_stat += 1>>
		<<set $machine.tattoo.use to "destroyed">>
		<<set $machine.tattoo.state to "destroyed">>
		Sparks fly, and the tattoo gun shudders to a halt.

	<</if>>
<</if>>

<<if $machine.vaginal>>
	<<if $machine.vaginal.health lte 0 and $machine.vaginal.use isnot "destroyed">>
		<<set $machine.number -= 1>>
		<<set $machine_stat += 1>>
		<<set $machine.vaginal.use to "destroyed">>
		<<set $machine.vaginal.state to "destroyed">>
		Sparks fly, and the phallic machine shudders to a halt.

		<<machine_vaginal_disable>>
	<</if>>
<</if>>

<<if $machine.anal>>
	<<if $machine.anal.health lte 0 and $machine.anal.use isnot "destroyed">>
		<<set $machine.number -= 1>>
		<<set $machine_stat += 1>>
		<<set $machine.anal.use to "destroyed">>
		<<set $machine.anal.state to "destroyed">>
		Sparks fly, and the small phallic machine shudders to a halt.

		<<machine_anal_disable>>
	<</if>>
<</if>>

<<if $machine.arm_chains>>
	<<if $machine.arm_chains.health lte 0 and $machine.arm_chains.use isnot "destroyed">>
		<<set $machine_stat += 1>>
		<<set $machine.arm_chains.use to "destroyed">>
		<<set $machine.arm_chains.state to "destroyed">>
		Sparks fly from the rails above, and the chains holding your arms slacken.

		<<machine_arm_chains_disable>>
	<</if>>
<</if>>

<<if $machine.leg_chains>>
	<<if $machine.leg_chains.health lte 0 and $machine.leg_chains.use isnot "destroyed">>
		<<set $machine_stat += 1>>
		<<set $machine.leg_chains.use to "destroyed">>
		<<set $machine.leg_chains.state to "destroyed">>
		Sparks fly from the rails above, and the chains holding your legs slacken.

		<<machine_leg_chains_disable>>
	<</if>>
<</if>>

<</widget>>

<<widget "machine_violent_arms">>
<<set _machine_arms to 1>>
<</widget>>

<<widget "machine_violent_legs">>
<<set _machine_legs to 1>>
<</widget>>

repo_name: Area/degrees

license: mit


code:
:: Widgets Machine [widget]
<<widget "machine_init">>
<<combatinit>>
<<set $enemytype to "machine">>
<<set $machine to {}>>
<<set $machine.number to 0>>
<<for _i = 0; _i < $args.length; _i++>>
	<<set $machine[$args[_i]] to {}>>
	<<set $machine[$args[_i]].health to $machine_health>>
	<<set $machine[$args[_i]].ammo to $machine_ammo>>
	<<set $machine[$args[_i]].hack to 0>>
	<<set $machine[$args[_i]].state to "ready">>
	<<set $machine[$args[_i]].use to "ready">>
	<<if $args[_i] isnot "arm_chains" and $args[_i] isnot "leg_chains">>
		<<set $machine.number += 1>>
	<</if>>
<</for>>
<<set $leftactiondefault to "rest">>
<<set $rightactiondefault to "rest">>
<<set $feetactiondefault to "rest">>
<</widget>>

<<widget "machine_damage">>
<<if $machine[$args[0]].health gte $machine_health>>
	sturdy
<<elseif $machine[$args[0]].health gte ($machine_health * 0.8)>>
	dented
<<elseif $machine[$args[0]].health gte ($machine_health * 0.6)>>
	dented
<<elseif $machine[$args[0]].health gte ($machine_health * 0.4)>>
	fractured
<<elseif $machine[$args[0]].health gte ($machine_health * 0.2)>>
	cracked
<<elseif $machine[$args[0]].health gte ($machine_health * 0.1)>>
	cracked
<<else>>
	ruined
<</if>>
<</widget>>

<<widget "machine_end">>
	<<unset $machine>>
	<<unset $machine_health>>
	<<unset $machine_ammo>>
	<<endcombat>>
<</widget>>

<<widget "machine_combat">>
<<if $machine.tattoo>>
	<<switch $machine.tattoo.state>>
	<<case "ready">>
		<<if $position is "doggy">>
			<<set _machine_selection to random(1, 5)>>
			<<if _machine_selection is 1 and $machine.tattoo.back isnot 1>>
				<<set _machine_choice to "back">>
			<<elseif _machine_selection is 2 and $machine.tattoo.left_shoulder isnot 1>>
				<<set _machine_choice to "left_shoulder">>
			<<elseif _machine_selection is 3 and $machine.tattoo.left_cheek isnot 1>>
				<<set _machine_choice to "left_cheek">>
			<<elseif _machine_selection is 4 and $machine.tattoo.left_bottom isnot 1>>
				<<set _machine_choice to "left_bottom">>
			<<elseif $machine.tattoo.hack gte 3>>
				<<set $machine.tattoo.use to "inert">>
				<<set $machine.tattoo.state to "inert">>
				<<set $machine.number -= 1>>
				<<set $machine_stat += 1>>
				The tattoo gun darts around your body, before falling inert.
			<<else>>
				<<set _machine_choice to "hover">>
				<<set $machine.tattoo.hack += 1>>
				The tattoo gun points to each of your body parts in turn, as if making a decision.
			<</if>>
		<<else>>
			<<set _machine_selection to random(1, 8)>>
			<<if _machine_selection is 1 and $machine.tattoo.breasts isnot 1>>
				<<set _machine_choice to "breasts">>
			<<elseif _machine_selection is 2 and $machine.tattoo.forehead isnot 1>>
				<<set _machine_choice to "forehead">>
			<<elseif _machine_selection is 3 and $machine.tattoo.left_thigh isnot 1>>
				<<set _machine_choice to "left_thigh">>
			<<elseif _machine_selection is 4 and $machine.tattoo.pubic isnot 1>>
				<<set _machine_choice to "pubic">>
			<<elseif _machine_selection is 5 and $machine.tattoo.right_bottom isnot 1>>
				<<set _machine_choice to "right_bottom">>
			<<elseif _machine_selection is 6 and $machine.tattoo.right_cheek isnot 1>>
				<<set _machine_choice to "right_cheek">>
			<<elseif _machine_selection is 7 and $machine.tattoo.right_shoulder isnot 1>>
				<<set _machine_choice to "right_shoulder">>
			<<elseif _machine_selection is 8 and $machine.tattoo.right_thigh isnot 1>>
				<<set _machine_choice to "right_thigh">>
			<<else>>
				<<set _machine_choice to "hover">>
				<<set $machine.tattoo.hack += 1>>
				The <<machine_damage tattoo>> tattoo gun points to each of your body parts in turn, as if making a decision.
			<</if>>
		<</if>>
		<<if _machine_choice isnot "hover" and $machine.tattoo.use isnot "destroyed" and $machine.tattoo.use isnot "inert">>
			Accompanied by a whirring sound, the <<machine_damage tattoo>> tattoo gun hovers over your <<bodypart _machine_choice>>.
			<<set $machine.tattoo.use to _machine_choice>>
			<<set $machine.tattoo.state to "entrance">>
		<</if>>

	<<case "destroyed">>
		The tattoo gun twitches, but remains disabled.
	<<case "inert">>
		The tatoo gun remains motionless.
	<<case "entrance">>
		<<if !$skin[$machine.tattoo.use].pen>>
			The <<machine_damage tattoo>> tattoo gun presses against your <<bodypart $machine.tattoo.use>>. The whirring intensifies as it prepares to write.<<gstress>><<stress 6>>
			<<set $machine.tattoo.state to "imminent">>
		<<elseif $machine.tattoo.armed is 1>>
			The <<machine_damage tattoo>> tattoo gun beeps as a red light scans your skin. A canister opens on its underside.
			<<set $machine.tattoo.state to "foam">>
		<<else>>
			The <<machine_damage tattoo>> tattoo gun presses against your <<bodypart $machine.tattoo.use>>, but then withdraws. A red light runs over your skin, and the gun moves away.
			<<set $machine.tattoo[$machine.tattoo.use] to 1>>
			<<set $machine.tattoo.use to "ready">>
			<<set $machine.tattoo.state to "ready">>
			<<set $machine.tattoo.hack += 1>>
		<</if>>
	<<case "imminent">>
		The <<machine_damage tattoo>> tattoo gun writes on your <<bodypart $machine.tattoo.use>>: <<bodywriting_machine $machine.tattoo.use>><<ggpain>><<ggtrauma>><<ggstress>><<trauma 18>><<stress 18>><<pain 8>>

		<<set $machine.tattoo[$machine.tattoo.use] to 1>>
		<<set $machine.tattoo.ammo -= 1>>
		<<set $machine_tattoo_success to true>>/*Just controls NPC response following encounter in underground dungeon.*/
		<<if $machine.tattoo.ammo gte 1>>
			The <<machine_damage tattoo>> tattoo gun pulls away, but remains primed.
			<<set $machine.tattoo.use to $machine.tattoo.use to "ready">>
			<<set $machine.tattoo.state to "ready">>
		<<else>>
			The <<machine_damage tattoo>> tattoo gun pulls away, and falls inert.
			<<set $machine.tattoo.use to "inert">>
			<<set $machine.tattoo.state to "inert">>
			<<set $machine.number -= 1>>
			<<set $machine_stat += 1>>
		<</if>>
	<<case "foam">>
		The <<machine_damage tattoo>> tattoo gun sprays a pink foam over your <<bodypart $machine.tattoo.use>>. The ink of your <<tattoo $machine.tattoo.use>> runs away, clearing your skin.
		<<bodywriting_clear $machine.tattoo.use>>

		The <<machine_damage tattoo>> tattoo gun presses against your <<bodypart $machine.tattoo.use>>. The whirring intensifies as it prepares to write.
		<<set $machine.tattoo.state to "imminent">>
	<</switch>>

<</if>>
<<if $machine.vaginal>>
	<<if $machine.vaginal.ammo lte 0 and $machine.vaginal.state isnot "inert" and $machine.vaginal.state isnot "destroyed">>
		<<if $machine.vaginal.state is "penetrated">>
			The <<machine_damage vaginal>> phallic machine withdraws from your <<pussy>> with a plop, and shudders to a halt.
		<<elseif $machine.vaginal.state is "imminent" or $machine.vaginal.state is "entrance">>
			The <<machine_damage vaginal>> phallic machine stops menacing you <<pussy>>, and shudders to a halt.
		<<else>>
			The <<machine_damage vaginal>> phallic machine shudders to a halt.
		<</if>>
		<<set $machine.vaginal.use to "inert">>
		<<set $machine.vaginal.state to "inert">>
		<<set $machine.number -= 1>>
		<<machine_vaginal_disable>>
	<<else>>
		<<switch $machine.vaginal.state>>
		<<case "ready">>
			The <<machine_damage vaginal>> phallic machine prods your <<pussy>>.
			<<neutral 5>>
			<<set $vaginause to "machine">><<set $vaginastate to "entrance">><<set $machine.vaginal.use to "vagina">><<set $machine.vaginal.state to "entrance">>
		<<case "entrance">>
			<<if $worn.over_lower.exposed lte 1>>
				<<if $machine.vaginal.armed is 1>>
					A canister atop the <<machine_damage vaginal>> phallic machine opens, and sprays a pink foam over your $worn.over_lower.name, dissolving it.
					<<set $worn.over_lower.integrity -= 100>>
				<<else>>
					The <<machine_damage vaginal>> phallic machine tries to push through your $worn.over_lower.name, tearing the fabric.
					<<set $worn.over_lower.integrity -= 20>>
				<</if>>
			<<elseif $worn.lower.exposed lte 1>>
				<<if $machine.vaginal.armed is 1>>
					A canister atop the <<machine_damage vaginal>> phallic machine opens, and sprays a pink foam over your $worn.lower.name, dissolving it.
					<<set $worn.lower.integrity -= 100>>
				<<else>>
					The <<machine_damage vaginal>> phallic machine tries to push through your $worn.lower.name, tearing the fabric.
					<<set $worn.lower.integrity -= 20>>
				<</if>>
			<<elseif $worn.under_lower.exposed lte 0>>
				<<if $machine.vaginal.armed is 1>>
					A canister atop the <<machine_damage vaginal>> phallic machine opens, and sprays a pink foam over your $worn.under_lower.name, dissolving the fabric.
					<<set $worn.under_lower.integrity -= 100>>
				<<else>>
					The <<machine_damage vaginal>> phallic machine tries to push through your $worn.under_lower.name, tearing the fabric.
					<<set $worn.under_lower.integrity -= 20>>
				<</if>>
			<<elseif $worn.genitals.type.includes("chastity")>>
				<<if $machine.vaginal.armed is 1>>
					A canister atop the <<machine_damage vaginal>> phallic machine opens, and sprays a pink foam over your $worn.genitals.name, dissolving the fabric.
					<<set $worn.genitals.integrity -= 100>>
				<<else>>
					The <<machine_damage vaginal>> phallic machine tries to push through your $worn.genitals.name, tearing the fabric.
					<<set $worn.genitals.integrity -= 20>>
				<</if>>
			<<else>>
				The <<machine_damage vaginal>> phallic machine pushes against your <<pussy>>, about to penetrate.
				<<sex 5>>
				<<set $vaginastate to "imminent">><<set $machine.vaginal.state to "imminent">>
			<</if>>
		<<case "imminent">>
			<<if $player.virginity.vaginal isnot true>>
				<<sex 30>>
				<<violence 1>>
				<<set $vaginastate to "penetrated">><<set $machine.vaginal.state to "penetrated">><<vaginalstat>><<bruise vagina>><<violence 1>><<raped>><<vaginaraped>>
				The <<machine_damage vaginal>> phallic machine thrusts into your <<pussy>>.
			<<else>>
				<<sex 100>>
				<<bruise vagina>><<vaginalstat>><<raped>><<vaginaraped>>
				<<set $vaginastate to "penetrated">><<set $machine.vaginal.state to "penetrated">>
				The <<machine_damage vaginal>> phallic machine thrusts into your virgin pussy,
					<<if $sexStats.vagina.pregnancy.totalBirthEvents gt 0>>
						despite your lack of a hymen, you feel something inside you change as your virginity and purity are taken.<<violence 10>>
					<<else>>
						breaking your hymen and forever robbing you of your purity.<<violence 25>>
					<</if>>

			<</if>>
			<<takeVirginity "sex machine" "vaginal">>
		<<case "penetrated">>

			<<set $rng to random(1, 5)>>
			<<if $rng gte 5>>
				The <<machine_damage vaginal>> phallic machine fucks your <<pussy>> with a mechanical rhythm.
			<<elseif $rng is 4>>
				The <<machine_damage vaginal>> phallic machine shifts between each thrust into your <<pussy>>.
			<<elseif $rng is 3>>
				The <<machine_damage vaginal>> phallic machine pauses a moment, then assaults your <<pussy>> with a blur of thrusts.
				<<sex 30>>
			<<elseif $rng is 2>>
				The <<machine_damage vaginal>> phallic machine hammers your <<pussy>> faster than anything alive.
			<<else>>
				The <<machine_damage vaginal>> phallic machine pounds your <<pussy>> with a mechanical rhythm.
			<</if>>
			<<sex 30>><<bruise vagina>><<violence 1>>
			<<set $machine.vaginal.ammo -= 1>>
		<<case "destroyed">>
			The <<machine_damage vaginal>> phallic machine twitches, but remains immobile.
		<<case "inert">>
			The <<machine_damage vaginal>> phallic machine remains inert.
		<</switch>>
	<</if>>

<</if>>
<<if $machine.anal>>
	<<if $machine.anal.ammo lte 0 and $machine.anal.state isnot "inert" and $machine.anal.state isnot "destroyed">>
		<<if $machine.anal.state is "penetrated">>
			The <<machine_damage anal>> small phallic machine withdraws from your <<bottom>> with a plop, and shudders to a halt.
		<<elseif $machine.anal.state is "imminent" or $machine.anal.state is "entrance">>
			The <<machine_damage anal>> small phallic machine stops menacing you <<bottom>>, and shudders to a halt.
		<<else>>
			The <<machine_damage anal>> small phallic machine shudders to a halt.
		<</if>>
		<<set $machine.anal.use to "inert">>
		<<set $machine.anal.state to "inert">>
		<<set $machine.number -= 1>>
		<<machine_anal_disable>>
	<<else>>
		<<switch $machine.anal.state>>
		<<case "ready">>
			The <<machine_damage anal>> small phallic machine prods your <<bottom>>.
			<<neutral 5>>
			<<set $anususe to "machine">><<set $anusstate to "entrance">><<set $machine.anal.use to "anus">><<set $machine.anal.state to "entrance">>
		<<case "entrance">>
			<<if $worn.over_lower.exposed lte 1>>
				<<if $machine.anal.armed is 1>>
					A canister atop the <<machine_damage anal>> small phallic machine opens, and sprays a pink foam over your $worn.over_lower.name, dissolving it.
					<<set $worn.over_lower.integrity -= 100>>
				<<else>>
					The <<machine_damage anal>> small phallic machine tries to push through your $worn.over_lower.name, tearing the fabric.
					<<set $worn.over_lower.integrity -= 20>>
				<</if>>
			<<elseif $worn.lower.exposed lte 1>>
				<<if $machine.anal.armed is 1>>
					A canister atop the <<machine_damage anal>> small phallic machine opens, and sprays a pink foam over your $worn.lower.name, dissolving it.
					<<set $worn.lower.integrity -= 100>>
				<<else>>
					The <<machine_damage anal>> small phallic machine tries to push through your $worn.lower.name, tearing the fabric.
					<<set $worn.lower.integrity -= 20>>
				<</if>>
			<<elseif $worn.under_lower.exposed lte 0>>
				<<if $machine.anal.armed is 1>>
					A canister atop the <<machine_damage anal>> small phallic machine opens, and sprays a pink foam over your $worn.under_lower.name, dissolving the fabric.
					<<set $worn.under_lower.integrity -= 100>>
				<<else>>
					The <<machine_damage anal>> small phallic machine tries to push through your $worn.under_lower.name, tearing the fabric.<<set $worn.under_lower.integrity -= 20>>
				<</if>>
			<<elseif $worn.genitals.type.includes("chastity") and $worn.genitals.anal_shield is 1>>
				<<if $machine.anal.armed is 1>>
					A canister atop the <<machine_damage anal>> small phallic machine opens, and sprays a pink foam over your $worn.genitals.name, dissolving the fabric.
					<<set $worn.genitals.integrity -= 100>>
				<<else>>
					The <<machine_damage anal>> small phallic machine tries to push through your $worn.genitals.name, tearing the fabric.
					<<set $worn.genitals.integrity -= 20>>
				<</if>>
			<<else>>
				The <<machine_damage anal>> small phallic machine pushes against your <<bottom>>, about to penetrate.
				<<sex 5>>
				<<set $anusstate to "imminent">><<set $machine.anal.state to "imminent">>
			<</if>>
		<<case "imminent">>
			<<if $player.virginity.anal isnot true>>
				<<sex 30>>
				<<violence 1>>
				<<set $anusstate to "penetrated">><<set $machine.anal.state to "penetrated">><<analstat>><<bruise anus>><<violence 1>><<raped>><<anusraped>>
				The <<machine_damage anal>> small phallic machine thrusts into your <<bottom>>.
			<<else>>
				<<sex 100>>
				<<violence 25>>
				<<takeVirginity "sex machine" "anal">><<bruise anus>><<analstat>><<raped>><<anusraped>>
				<<set $anusstate to "penetrated">><<set $machine.anal.state to "penetrated">>
				The <<machine_damage anal>> small phallic machine thrusts into your virgin ass, violating you in a way you hadn't conceived of.
			<</if>>
		<<case "penetrated">>
			<<set $rng to random(1, 5)>>
			<<if $rng gte 5>>
				The <<machine_damage anal>> small phallic machine fucks your <<bottom>> with a mechanical rhythm.
			<<elseif $rng is 4>>
				The <<machine_damage anal>> small phallic machine vibrates against your <<prostate>> at the end of each thrust into your <<bottom>>, sending a tingling jolt through you.
				<<sex 30>>
			<<elseif $rng is 3>>
				The <<machine_damage anal>> small phallic machine is a blur as it fucks your <<bottom>> faster than anything living.
			<<elseif $rng is 2>>
				The <<machine_damage anal>> small phallic machine fucks your <<bottom>>, shifting between each thrust.
			<<else>>
				The <<machine_damage anal>> small phallic machine pounds your <<bottom>> with a mechanical rhythm.
			<</if>>
			<<sex 30>><<bruise anus>><<violence 1>>
			<<set $machine.anal.ammo -= 1>>
		<<case "destroyed">>
			The <<machine_damage anal>> small phallic machine twitches, but remains immobile.
		<<case "inert">>
			The <<machine_damage anal>> small phallic machine remains inert.
		<</switch>>
	<</if>>

<</if>>
<<if $machine.arm_chains>>
	<<if $machine.arm_chains.state is "ready">>
		<<if _machine_arms is 1>>
			The <<machine_damage arm_chains>> chains attached to your shackles retract, lifting your arms into the air and immobilising them.
			<<set $leftactiondefault to "chain_struggle">><<set $rightactiondefault to "chain_struggle">>
			<<set $machine.arm_chains.use to "grapple">>
			<<set $machine.arm_chains.state to "grapple">>
			<<if $leftarm isnot "bound">>
				<<set $leftarm to "mechgrappled">><<set $lefttarget to "machine">>
			<</if>>
			<<if $rightarm isnot "bound">>
				<<set $rightarm to "mechgrappled">><<set $righttarget to "machine">>
			<</if>>
		<<else>>
			The <<machine_damage arm_chains>> chains holding your arms resist your movements, but remain loose.
		<</if>>
	<<elseif $machine.arm_chains.state is "recovering">>
		The <<machine_damage arm_chains>> chains holding your arms twitch, but remain loose.
	<<elseif $machine.arm_chains.state is "destroyed">>
		The <<machine_damage arm_chains>> chains holding your arms remain loose.
	<<elseif $machine.arm_chains.state is "inert">>
		The <<machine_damage arm_chains>> chains holding your arms remain loose.
	<</if>>

<</if>>
<<if $machine.leg_chains>>
	<<if $machine.leg_chains.state is "ready">>
		<<if _machine_legs is 1>>
			The <<machine_damage leg_chains>> chains attached to your shackles retract, pulling on your legs and immobilising them.
			<<set $feetactiondefault to "chain_struggle">>
			<<set $feetuse to "mechgrappled">><<set $feettarget to "machine">>
			<<set $machine.leg_chains.use to "grapple">>
			<<set $machine.leg_chains.state to "grapple">>
			<<if $leftleg isnot "bound">>
				<<set $leftleg to "mechgrappled">>
			<</if>>
			<<if $rightleg isnot "bound">>
				<<set $rightleg to "mechgrappled">>
			<</if>>
		<<else>>
			The <<machine_damage leg_chains>> chains holding your legs resist your movements, but remain loose.
		<</if>>
	<<elseif $machine.leg_chains.state is "recovering">>
		The <<machine_damage leg_chains>> chains holding your legs twitch, but remain loose.
	<<elseif $machine.leg_chains.state is "destroyed">>
		The <<machine_damage leg_chains>> chains holding your legs remain loose.
	<<elseif $machine.leg_chains.state is "inert">>
		The <<machine_damage leg_chains>> chains holding your legs remain loose.
	<</if>>

<</if>>

<</widget>>

<<widget "machine_vaginal_disable">>
<<if $vaginause is "machine">>
	<<set $vaginause to 0>>
	<<set $vaginastate to 0>>
<</if>>
<</widget>>

<<widget "machine_anal_disable">>
<<if $anususe is "machine">>
	<<set $anususe to 0>>
	<<set $anusstate to 0>>
<</if>>
<</widget>>

<<widget "machine_arm_chains_disable">>
<<if $leftarm isnot "bound">>
	<<set $leftarm to 0>>
	<<set $leftactiondefault to "rest">>
<</if>>
<<if $rightarm isnot "bound">>
	<<set $rightarm to 0>>
	<<set $rightactiondefault to "rest">>
<</if>>
<</widget>>

<<widget "machine_leg_chains_disable">>
<<if $leftleg isnot "bound">>
	<<set $leftleg to 0>>
	<<set $feetuse to 0>>
	<<set $feetactiondefault to "rest">>
<</if>>
<<if $rightleg isnot "bound">>
	<<set $rightleg to 0>>
	<<set $feetuse to 0>>
	<<set $feetactiondefault to "rest">>
<</if>>
<</widget>>


code:
:: Machine State [widget]
<<widget "machine_state">>
<<if $arousal gte $arousalmax and $orgasmdown lte 0>>
	<<orgasm>>
<</if>>
<<sexcheck>>
<</widget>>