diff --git a/Defs/AnimationDefs/Animations_vanilla.xml b/Defs/AnimationDefs/Animations_vanilla.xml index 7aa950d..7657f83 100644 --- a/Defs/AnimationDefs/Animations_vanilla.xml +++ b/Defs/AnimationDefs/Animations_vanilla.xml @@ -471,6 +471,7 @@
  • Human
  • true + true true @@ -622,6 +623,7 @@ 2 2 0 + 90
  • 59 @@ -641,6 +643,7 @@ 2 2 0 + 90
  • @@ -698,6 +701,7 @@ 2 2 0 + 90
  • 14 @@ -717,6 +721,7 @@ 2 2 0 + 90
  • @@ -801,6 +806,7 @@ 2 2 0 + 90
  • 7 @@ -849,6 +855,7 @@ 2 2 0 + 90
  • @@ -1968,8 +1975,6 @@
  • Vaginal
  • - -
  • @@ -1986,6 +1991,7 @@
  • Human
  • true + true
    @@ -2178,30 +2184,33 @@ 180 180 0 - -0.263 + -0.363 2 2 0 + 0
  • 33 180 180 0 - -0.213 + -0.313 2 2 0.045 + 0
  • 1 180 180 0 - -0.263 + -0.363 2 2 0 + 0
  • @@ -2256,30 +2265,33 @@ 180 180 0 - -0.263 + -0.363 2 2 0 + 0
  • 13 180 180 0 - -0.213 + -0.313 2 2 0.045 + 0
  • 1 180 180 0 - -0.263 + -0.363 2 2 0 + 0
  • @@ -2420,17 +2432,18 @@ 180 180 0 - -0.263 + -0.363 2 2 0 + 0
  • 10 180 180 0 - -0.213 + -0.313 2 2 0.045 @@ -2440,7 +2453,7 @@ 180 180 0 - -0.263 + -0.363 2 2 0 @@ -2451,7 +2464,7 @@ 180 180 0 - -0.263 + -0.363 2 2 0 @@ -2461,7 +2474,7 @@ 180 180 0 - -0.213 + -0.313 2 2 0.045 @@ -2471,7 +2484,7 @@ 180 180 0 - -0.263 + -0.363 2 2 0 @@ -2482,7 +2495,7 @@ 180 180 0 - -0.263 + -0.363 2 2 0 @@ -2492,7 +2505,7 @@ 180 180 0 - -0.213 + -0.313 2 2 0.045 @@ -2502,7 +2515,7 @@ 180 180 0 - -0.263 + -0.363 2 2 0 @@ -2512,7 +2525,7 @@ 180 180 0 - -0.263 + -0.363 2 2 0 @@ -2522,10 +2535,11 @@ 180 180 0 - -0.263 + -0.363 2 2 0 + 0
  • diff --git a/Rimworld-Animations.csproj b/Rimworld-Animations.csproj index f56b6d4..e5762cf 100644 --- a/Rimworld-Animations.csproj +++ b/Rimworld-Animations.csproj @@ -88,10 +88,12 @@ + + diff --git a/Source/Actors/Actor.cs b/Source/Actors/Actor.cs index 0afae8c..2cb548c 100644 --- a/Source/Actors/Actor.cs +++ b/Source/Actors/Actor.cs @@ -15,6 +15,7 @@ namespace Rimworld_Animations { public string gender; public bool isFucking = false; public bool isFucked = false; + public bool controlGenitalAngle = false; public Vector3 offset = new Vector2(0, 0); } } diff --git a/Source/AnimationUtility.cs b/Source/AnimationUtility.cs index 1056a62..9563ef0 100644 --- a/Source/AnimationUtility.cs +++ b/Source/AnimationUtility.cs @@ -78,7 +78,7 @@ namespace Rimworld_Animations { //TESTING ANIMATIONS ONLY REMEMBER TO COMMENT OUT BEFORE PUSH /* - if (x.defName != "Test") + if (x.defName != "Cowgirl") return false; */ diff --git a/Source/Animations/Clips/PawnAnimationClip.cs b/Source/Animations/Clips/PawnAnimationClip.cs index 6fc767d..746c3f4 100644 --- a/Source/Animations/Clips/PawnAnimationClip.cs +++ b/Source/Animations/Clips/PawnAnimationClip.cs @@ -14,6 +14,7 @@ namespace Rimworld_Animations { public Dictionary SoundEffects = new Dictionary(); public Dictionary quiver = new Dictionary(); + public SimpleCurve GenitalAngle = new SimpleCurve(); public SimpleCurve BodyAngle = new SimpleCurve(); public SimpleCurve HeadAngle = new SimpleCurve(); public SimpleCurve HeadBob = new SimpleCurve(); @@ -60,9 +61,14 @@ namespace Rimworld_Animations { if (frame.headBob.HasValue) HeadBob.Add((float)frame.atTick / (float)duration, frame.headBob.Value, true); + if (frame.genitalAngle.HasValue) + GenitalAngle.Add((float)frame.atTick / (float)duration, frame.genitalAngle.Value, true); + if (frame.soundEffect != null) { SoundEffects.Add((int)frame.atTick, frame.soundEffect); } + + } else { if (frame.bodyAngle.HasValue) @@ -86,6 +92,9 @@ namespace Rimworld_Animations { if (frame.headBob.HasValue) HeadBob.Add((float)keyframePosition / (float)duration, frame.headBob.Value, true); + if (frame.genitalAngle.HasValue) + GenitalAngle.Add((float)keyframePosition / (float)duration, frame.genitalAngle.Value, true); + if (frame.soundEffect != null) { SoundEffects.Add(keyframePosition, frame.soundEffect); } diff --git a/Source/Animations/Keyframes/PawnKeyframe.cs b/Source/Animations/Keyframes/PawnKeyframe.cs index 69b0a78..685009e 100644 --- a/Source/Animations/Keyframes/PawnKeyframe.cs +++ b/Source/Animations/Keyframes/PawnKeyframe.cs @@ -11,6 +11,8 @@ namespace Rimworld_Animations { public float? bodyAngle; public float? headAngle; + public float? genitalAngle; + public float? bodyOffsetZ; public float? bodyOffsetX; diff --git a/Source/Comps/CompBodyAnimator.cs b/Source/Comps/CompBodyAnimator.cs index c364693..4cf8102 100644 --- a/Source/Comps/CompBodyAnimator.cs +++ b/Source/Comps/CompBodyAnimator.cs @@ -43,9 +43,11 @@ namespace Rimworld_Animations { private float clipPercent = 0; public Vector3 anchor, deltaPos, headBob; - public float bodyAngle, headAngle; + public float bodyAngle, headAngle, genitalAngle; public Rot4 headFacing, bodyFacing; + public bool controlGenitalAngle = false; + private AnimationDef anim; private AnimationStage stage => anim.animationStages[curStage]; private PawnAnimationClip clip => (PawnAnimationClip)stage.animationClips[actor]; @@ -117,6 +119,8 @@ namespace Rimworld_Animations { quiver = false; this.shiver = shiver && AnimationSettings.rapeShiver; + controlGenitalAngle = anim.actors[actor].controlGenitalAngle; + //tick once for initialization tickAnim(); @@ -191,6 +195,17 @@ namespace Rimworld_Animations { //play sound effect if(rjw.RJWSettings.sounds_enabled && clip.SoundEffects.ContainsKey(clipTicks) && AnimationSettings.soundOverride) { SoundDef.Named(clip.SoundEffects[clipTicks]).PlayOneShot(new TargetInfo(pawn.Position, pawn.Map)); + + if (AnimationSettings.applySemenOnAnimationOrgasm && (pawn?.jobs?.curDriver is JobDriver_Sex) && clip.SoundEffects[clipTicks] == "Cum") { + + Pawn partner = (pawn.jobs.curDriver as JobDriver_Sex)?.Partner; + + if(anim.sexTypes.Contains((pawn.jobs.curDriver as JobDriver_Sex).sexType)) { + SemenHelper.calculateAndApplySemen(pawn, partner, (pawn.jobs.curDriver as JobDriver_Sex).sexType); + } + + } + } if(AnimationSettings.orgasmQuiver && clip.quiver.ContainsKey(clipTicks)) { quiver = clip.quiver[clipTicks]; @@ -218,6 +233,11 @@ namespace Rimworld_Animations { if (headAngle < 0) headAngle = 360 - ((-1f * headAngle) % 360); if (headAngle > 360) headAngle %= 360; + if (controlGenitalAngle) { + genitalAngle = clip.GenitalAngle.Evaluate(clipPercent) * (mirror ? -1 : 1); + if (genitalAngle < 0) genitalAngle = 360 - ((-1f * genitalAngle) % 360); + if (genitalAngle > 360) genitalAngle %= 360; + } bodyFacing = mirror ? new Rot4((int)clip.BodyFacing.Evaluate(clipPercent)).Opposite : new Rot4((int)clip.BodyFacing.Evaluate(clipPercent)); @@ -231,6 +251,7 @@ namespace Rimworld_Animations { headFacing = headFacing.Opposite; } headBob = new Vector3(0, 0, clip.HeadBob.Evaluate(clipPercent)); + } public Vector3 getPawnHeadPosition() { diff --git a/Source/Patches/HarmonyPatch_AlienRace.cs b/Source/Patches/HarmonyPatch_AlienRace.cs index aeb7602..8399413 100644 --- a/Source/Patches/HarmonyPatch_AlienRace.cs +++ b/Source/Patches/HarmonyPatch_AlienRace.cs @@ -126,10 +126,16 @@ namespace Rimworld_Animations { quat: Quaternion.AngleAxis(angle: num, axis: Vector3.up) * headQuatInAnimation, mat: alienComp.addonGraphics[index: i].MatAt(rot: pawnAnimator.headFacing), drawNow: portrait); } + else { + Quaternion addonRotation = quat; + if (AnimationSettings.controlGenitalRotation && pawnAnimator.controlGenitalAngle && ba.hediffGraphics[0] != null && (ba.hediffGraphics[0].path.Contains("Penis") || ba.hediffGraphics[0].path.Contains("penis"))) { + addonRotation = Quaternion.AngleAxis(angle: pawnAnimator.genitalAngle, axis: Vector3.up); + } + GenDraw.DrawMeshNowOrLater(mesh: alienComp.addonGraphics[index: i].MeshAt(rot: rotation), loc: vector + offsetVector.RotatedBy(angle: Mathf.Acos(f: Quaternion.Dot(a: Quaternion.identity, b: quat)) * 2f * 57.29578f), - quat: Quaternion.AngleAxis(angle: num, axis: Vector3.up) * quat, mat: alienComp.addonGraphics[index: i].MatAt(rot: rotation), drawNow: portrait); + quat: Quaternion.AngleAxis(angle: num, axis: Vector3.up) * addonRotation, mat: alienComp.addonGraphics[index: i].MatAt(rot: rotation), drawNow: portrait); } diff --git a/Source/Patches/HarmonyPatch_PawnRotation.cs b/Source/Patches/HarmonyPatch_PawnRotation.cs new file mode 100644 index 0000000..9fb95ef --- /dev/null +++ b/Source/Patches/HarmonyPatch_PawnRotation.cs @@ -0,0 +1,28 @@ +using HarmonyLib; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Verse; + +namespace Rimworld_Animations { + [HarmonyPatch(typeof(Thing), "Rotation", MethodType.Getter)] + public static class HarmonyPatch_PawnRotation { + + public static bool Prefix(Thing __instance, ref Rot4 __result) { + + if(!(__instance is Pawn) || (__instance as Pawn)?.TryGetComp() == null || !(__instance as Pawn).TryGetComp().isAnimating) { + return true; + } + + Pawn pawn = (__instance as Pawn); + __result = pawn.TryGetComp().bodyFacing; + + return false; + + + } + + } +} diff --git a/Source/Patches/rjwPatches/HarmonyPatch_DrawSemen.cs b/Source/Patches/rjwPatches/HarmonyPatch_DrawSemen.cs new file mode 100644 index 0000000..2d291d3 --- /dev/null +++ b/Source/Patches/rjwPatches/HarmonyPatch_DrawSemen.cs @@ -0,0 +1,22 @@ +/* + * Todo: Ask to make SemenSplatch and DrawSemen public + * + * + * using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using rjw; +using HarmonyLib; + +namespace Rimworld_Animations { + [HarmonyPatch("DrawSemen")] + public static class HarmonyPatch_DrawSemen { + + public static void Prefix(ref Dictionary) { + + } + + } +}*/ diff --git a/Source/Settings/AnimationSettings.cs b/Source/Settings/AnimationSettings.cs index 905d7e1..fa95143 100644 --- a/Source/Settings/AnimationSettings.cs +++ b/Source/Settings/AnimationSettings.cs @@ -9,16 +9,18 @@ using UnityEngine; namespace Rimworld_Animations { public class AnimationSettings : ModSettings { - public static bool orgasmQuiver, rapeShiver, soundOverride = true, hearts = true; + public static bool orgasmQuiver, rapeShiver, soundOverride = true, hearts = true, controlGenitalRotation = false, applySemenOnAnimationOrgasm = false; public static float shiverIntensity = 2f; public override void ExposeData() { base.ExposeData(); + Scribe_Values.Look(ref controlGenitalRotation, "controlGenitalRotation", false); Scribe_Values.Look(ref orgasmQuiver, "orgasmQuiver"); Scribe_Values.Look(ref rapeShiver, "rapeShiver"); Scribe_Values.Look(ref hearts, "heartsOnLovin"); + Scribe_Values.Look(ref applySemenOnAnimationOrgasm, "applySemenOnOrgasm", false); Scribe_Values.Look(ref soundOverride, "rjwAnimSoundOverride", true); Scribe_Values.Look(ref shiverIntensity, "shiverIntensity", 2f); @@ -39,6 +41,8 @@ namespace Rimworld_Animations { listingStandard.Begin(inRect); listingStandard.CheckboxLabeled("Enable Sound Override", ref AnimationSettings.soundOverride); + listingStandard.CheckboxLabeled("Control Genital Rotation", ref AnimationSettings.controlGenitalRotation); + listingStandard.CheckboxLabeled("Apply semen on animation orgasm", ref AnimationSettings.applySemenOnAnimationOrgasm); listingStandard.CheckboxLabeled("Enable Orgasm Quiver", ref AnimationSettings.orgasmQuiver); listingStandard.CheckboxLabeled("Enable Rape Shiver", ref AnimationSettings.rapeShiver); listingStandard.CheckboxLabeled("Enable hearts during lovin'", ref AnimationSettings.hearts);