mirror of
https://gitgud.io/c0ffeeeeeeee/rimworld-animations.git
synced 2024-08-15 00:43:45 +00:00
Added rotation to offsets, also added keyed translations for mod menu and offset configuration menu
This commit is contained in:
parent
66f84a00f3
commit
7f5e2e1a63
22 changed files with 362 additions and 224 deletions
Binary file not shown.
Binary file not shown.
|
@ -3,7 +3,6 @@
|
||||||
<Rimworld_Animations.GroupAnimationDef>
|
<Rimworld_Animations.GroupAnimationDef>
|
||||||
<defName>TestGroupAnimation1</defName>
|
<defName>TestGroupAnimation1</defName>
|
||||||
<numActors>2</numActors>
|
<numActors>2</numActors>
|
||||||
<canMirror>True</canMirror>
|
|
||||||
<animationStages>
|
<animationStages>
|
||||||
<li Class="Rimworld_Animations.AnimationStage_LoopRandomSelectChance">
|
<li Class="Rimworld_Animations.AnimationStage_LoopRandomSelectChance">
|
||||||
<loops>10</loops>
|
<loops>10</loops>
|
||||||
|
|
|
@ -3,11 +3,12 @@
|
||||||
<Rimworld_Animations.AnimationOffsetDef>
|
<Rimworld_Animations.AnimationOffsetDef>
|
||||||
<defName>GroinToAppropriateHeight</defName>
|
<defName>GroinToAppropriateHeight</defName>
|
||||||
<offsets>
|
<offsets>
|
||||||
<li Class="Rimworld_Animations.AnimationOffset_Single">
|
<li Class="Rimworld_Animations.AnimationOffset_Single" MayRequire="erdelf.HumanoidAlienRaces,dianawinters.Orassans">
|
||||||
<races>
|
<races>
|
||||||
<li>Alien_Orassan</li>
|
<li>Alien_Orassan</li>
|
||||||
</races>
|
</races>
|
||||||
<offset>(0, 0, 5)</offset>
|
<offset>(0, 0, 5)</offset>
|
||||||
|
<rotation>90</rotation>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<li Class="Rimworld_Animations.AnimationOffset_BodyType">
|
<li Class="Rimworld_Animations.AnimationOffset_BodyType">
|
||||||
|
@ -15,7 +16,7 @@
|
||||||
<li>Human</li>
|
<li>Human</li>
|
||||||
</races>
|
</races>
|
||||||
<offsets>
|
<offsets>
|
||||||
<li><bodyType>Hulk</bodyType><offset>(0, 0, 0.5)</offset></li>
|
<li><bodyType>Hulk</bodyType><offset>(0, 0, 0.5)</offset><rotation>90</rotation></li>
|
||||||
<li><bodyType>Thin</bodyType><offset>(0, 0, 0.3)</offset></li>
|
<li><bodyType>Thin</bodyType><offset>(0, 0, 0.3)</offset></li>
|
||||||
<li><bodyType>Female</bodyType><offset>(0, 0, 0.4)</offset></li>
|
<li><bodyType>Female</bodyType><offset>(0, 0, 0.4)</offset></li>
|
||||||
</offsets>
|
</offsets>
|
||||||
|
|
|
@ -13,21 +13,20 @@ namespace Rimworld_Animations
|
||||||
|
|
||||||
public List<BaseAnimationOffset> offsets;
|
public List<BaseAnimationOffset> offsets;
|
||||||
|
|
||||||
public Vector3 FindOffset(Pawn pawn)
|
public bool FindOffset(Pawn pawn, out BaseAnimationOffset offset)
|
||||||
{
|
{
|
||||||
foreach (BaseAnimationOffset animOffset in offsets)
|
foreach (BaseAnimationOffset animOffset in offsets)
|
||||||
{
|
{
|
||||||
if (animOffset.appliesToPawn(pawn)) {
|
if (animOffset.appliesToPawn(pawn)) {
|
||||||
|
|
||||||
Vector3? offset = animOffset.getOffset(pawn);
|
offset = animOffset;
|
||||||
return (offset == null ? Vector3.zero : (Vector3)offset);
|
return true;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return Vector3.zero;
|
offset = null;
|
||||||
}
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,6 +18,11 @@ namespace Rimworld_Animations
|
||||||
{
|
{
|
||||||
return offsets.Find(x => x.bodyType == pawn.story.bodyType)?.offset;
|
return offsets.Find(x => x.bodyType == pawn.story.bodyType)?.offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override int? getRotation(Pawn pawn)
|
||||||
|
{
|
||||||
|
return offsets.Find(x => x.bodyType == pawn.story.bodyType)?.rotation;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,5 +26,19 @@ namespace Rimworld_Animations
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override int? getRotation(Pawn pawn)
|
||||||
|
{
|
||||||
|
|
||||||
|
if (pawn.gender == Gender.Female)
|
||||||
|
{
|
||||||
|
return offsetsFemale.Find(x => x.bodyType == pawn.story.bodyType)?.rotation;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return offsetsMale.Find(x => x.bodyType == pawn.story.bodyType)?.rotation;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,10 +12,16 @@ namespace Rimworld_Animations
|
||||||
{
|
{
|
||||||
|
|
||||||
public Vector3 offset;
|
public Vector3 offset;
|
||||||
|
public int? rotation;
|
||||||
|
|
||||||
public override Vector3? getOffset(Pawn pawn)
|
public override Vector3? getOffset(Pawn pawn)
|
||||||
{
|
{
|
||||||
return offset;
|
return offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override int? getRotation(Pawn pawn)
|
||||||
|
{
|
||||||
|
return rotation;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,6 +15,8 @@ namespace Rimworld_Animations
|
||||||
|
|
||||||
public abstract Vector3? getOffset(Pawn pawn);
|
public abstract Vector3? getOffset(Pawn pawn);
|
||||||
|
|
||||||
|
public abstract int? getRotation(Pawn pawn);
|
||||||
|
|
||||||
public bool appliesToPawn(Pawn pawn)
|
public bool appliesToPawn(Pawn pawn)
|
||||||
{
|
{
|
||||||
return races.Contains(pawn.def);
|
return races.Contains(pawn.def);
|
||||||
|
|
|
@ -12,6 +12,7 @@ namespace Rimworld_Animations
|
||||||
public class BodyTypeOffset
|
public class BodyTypeOffset
|
||||||
{
|
{
|
||||||
public BodyTypeDef bodyType;
|
public BodyTypeDef bodyType;
|
||||||
|
public int rotation = 0;
|
||||||
public Vector3 offset;
|
public Vector3 offset;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,7 @@ namespace Rimworld_Animations
|
||||||
|
|
||||||
public bool canAnimationBeUsed(List<Pawn> actors, out int reorder)
|
public bool canAnimationBeUsed(List<Pawn> actors, out int reorder)
|
||||||
{
|
{
|
||||||
if (AnimationSettings.debugMode)
|
if (RJWAnimationSettings.debugMode)
|
||||||
{
|
{
|
||||||
Log.Message("[anims] Checking if " + defName + " is valid animation");
|
Log.Message("[anims] Checking if " + defName + " is valid animation");
|
||||||
}
|
}
|
||||||
|
@ -51,12 +51,23 @@ namespace Rimworld_Animations
|
||||||
return animations;
|
return animations;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Vector3? GetOffset(int actor, Pawn pawn, int reorder = 0)
|
public bool GetOffset(int actor, Pawn pawn, out Vector3? position, out int? rotation, int reorder = 0)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
position = null;
|
||||||
|
rotation = null;
|
||||||
|
|
||||||
//element at or default to stop errors
|
//element at or default to stop errors
|
||||||
if (offsetDefs == null) return null;
|
if (offsetDefs == null) return false;
|
||||||
if ((actor + reorder) % numActors >= offsetDefs.Count) return null;
|
if ((actor + reorder) % numActors >= offsetDefs.Count) return false;
|
||||||
return offsetDefs[(actor + reorder) % numActors].FindOffset(pawn);
|
if (offsetDefs[(actor + reorder) % numActors].FindOffset(pawn, out BaseAnimationOffset animationOffset))
|
||||||
|
{
|
||||||
|
position = animationOffset.getOffset(pawn);
|
||||||
|
rotation = animationOffset.getRotation(pawn);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,6 +19,7 @@ namespace Rimworld_Animations {
|
||||||
|
|
||||||
private List<AnimationDef> animationQueue;
|
private List<AnimationDef> animationQueue;
|
||||||
private BaseExtendedAnimatorAnchor anchor;
|
private BaseExtendedAnimatorAnchor anchor;
|
||||||
|
private int? rotation;
|
||||||
private Vector3? offset;
|
private Vector3? offset;
|
||||||
private bool isAnimating = false;
|
private bool isAnimating = false;
|
||||||
|
|
||||||
|
@ -51,6 +52,18 @@ namespace Rimworld_Animations {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int? Rotation
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return rotation;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
this.rotation = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public int AnimationLength
|
public int AnimationLength
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
|
@ -68,6 +81,15 @@ namespace Rimworld_Animations {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public AnimationDef CurrentAnimation {
|
||||||
|
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return IsAnimating ? animationQueue[0] : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public Vector3 getAnchor()
|
public Vector3 getAnchor()
|
||||||
{
|
{
|
||||||
return anchor.getDrawPos();
|
return anchor.getDrawPos();
|
||||||
|
@ -135,17 +157,18 @@ namespace Rimworld_Animations {
|
||||||
pawn.Drawer.renderer.SetAnimation(null);
|
pawn.Drawer.renderer.SetAnimation(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void PlayGroupAnimation(List<AnimationDef> groupAnimation, Vector3? offset)
|
public void PlayGroupAnimation(List<AnimationDef> groupAnimation, Vector3? positionOffset, int? rotationOffset)
|
||||||
{
|
{
|
||||||
this.Offset = offset;
|
this.Offset = positionOffset;
|
||||||
|
this.Rotation = rotationOffset;
|
||||||
animationQueue = groupAnimation;
|
animationQueue = groupAnimation;
|
||||||
PlayNextAnimation();
|
PlayNextAnimation();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void PlayGroupAnimation(List<AnimationDef> groupAnimation, Vector3? offset, BaseExtendedAnimatorAnchor anchor)
|
public void PlayGroupAnimation(List<AnimationDef> groupAnimation, Vector3? positionOffset, int? rotationOffset, BaseExtendedAnimatorAnchor anchor)
|
||||||
{
|
{
|
||||||
this.anchor = anchor;
|
this.anchor = anchor;
|
||||||
PlayGroupAnimation(groupAnimation, offset);
|
PlayGroupAnimation(groupAnimation, positionOffset, rotationOffset);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void PostExposeData()
|
public override void PostExposeData()
|
||||||
|
|
|
@ -2,12 +2,13 @@
|
||||||
using Verse;
|
using Verse;
|
||||||
using RimWorld;
|
using RimWorld;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
using System.Windows;
|
||||||
|
|
||||||
namespace Rimworld_Animations {
|
namespace Rimworld_Animations {
|
||||||
class MainTabWindow_OffsetConfigure : MainTabWindow
|
class MainTabWindow_OffsetConfigure : MainTabWindow
|
||||||
{
|
{
|
||||||
|
|
||||||
public override Vector2 RequestedTabSize => new Vector2(505, 380);
|
public override Vector2 RequestedTabSize => new Vector2(505, 450);
|
||||||
public override void DoWindowContents(Rect inRect) {
|
public override void DoWindowContents(Rect inRect) {
|
||||||
|
|
||||||
Rect position = new Rect(inRect.x, inRect.y, inRect.width, inRect.height);
|
Rect position = new Rect(inRect.x, inRect.y, inRect.width, inRect.height);
|
||||||
|
@ -16,15 +17,87 @@ namespace Rimworld_Animations {
|
||||||
Listing_Standard listingStandard = new Listing_Standard();
|
Listing_Standard listingStandard = new Listing_Standard();
|
||||||
listingStandard.Begin(position);
|
listingStandard.Begin(position);
|
||||||
|
|
||||||
listingStandard.Label("Animation Manager");
|
listingStandard.Label("RimAnims_AnimManager".Translate());
|
||||||
|
|
||||||
listingStandard.GapLine();
|
listingStandard.GapLine();
|
||||||
|
|
||||||
|
|
||||||
|
if (Find.Selector.SingleSelectedThing is Pawn curPawn
|
||||||
|
&& curPawn.TryGetComp<CompExtendedAnimator>(out CompExtendedAnimator extendedAnimator)
|
||||||
|
&& extendedAnimator.IsAnimating)
|
||||||
|
{
|
||||||
|
//Pawn info about their body, race
|
||||||
|
Vector3 offsetPosition = extendedAnimator.Offset != null ? (Vector3)extendedAnimator.Offset : Vector3.zero;
|
||||||
|
int offsetRotation = extendedAnimator.Rotation != null ? (int)extendedAnimator.Rotation : 0;
|
||||||
|
|
||||||
|
string pawnDef = curPawn.def.defName;
|
||||||
|
string bodyTypeDef = (curPawn.story?.bodyType != null) ? curPawn.story.bodyType.ToString() : "None";
|
||||||
|
string genderDef = curPawn.gender.ToString();
|
||||||
|
string currentAnimation = extendedAnimator.CurrentAnimation != null ? extendedAnimator.CurrentAnimation.defName : "None";
|
||||||
|
|
||||||
|
listingStandard.Label(curPawn.Name + ": " + curPawn.def.defName + ", " + bodyTypeDef + ", " + genderDef + ", Animation: " + currentAnimation);
|
||||||
|
|
||||||
|
if (curPawn.def.defName == "Human")
|
||||||
|
{
|
||||||
|
listingStandard.Label("RimAnims_Warning".Translate());
|
||||||
|
}
|
||||||
|
|
||||||
|
float posX = offsetPosition.x, posY = offsetPosition.y, posZ = offsetPosition.z;
|
||||||
|
int rot = offsetRotation;
|
||||||
|
|
||||||
|
float.TryParse(listingStandard.TextEntryLabeled("X: ", posX.ToString()), out posX);
|
||||||
|
posX = listingStandard.Slider(posX, -2, 2);
|
||||||
|
|
||||||
|
float.TryParse(listingStandard.TextEntryLabeled("Y: ", offsetPosition.y.ToString()), out posY);
|
||||||
|
posY = listingStandard.Slider(posY, -2, 2);
|
||||||
|
|
||||||
|
float.TryParse(listingStandard.TextEntryLabeled("Z: ", posZ.ToString()), out posZ);
|
||||||
|
posZ = listingStandard.Slider(posZ, -2, 2);
|
||||||
|
|
||||||
|
int.TryParse(listingStandard.TextEntryLabeled("Rotation: ", rot.ToString()), out rot);
|
||||||
|
rot = (int)listingStandard.Slider(rot, -180, 180);
|
||||||
|
|
||||||
|
listingStandard.GapLine();
|
||||||
|
Vector3 newOffsetVector = new Vector3(posX, posY, posZ);
|
||||||
|
|
||||||
|
string offset = "<li>";
|
||||||
|
offset += bodyTypeDef != "None" ? "<bodyType>" + bodyTypeDef + "</bodyType>" : "";
|
||||||
|
offset += newOffsetVector != Vector3.zero ? "<offset>(" + posX + ", " + posY + ", " + posZ + ")</offset>" : "";
|
||||||
|
offset += rot != 0 ? "<rotation>" + rot + "</rotation>" : "";
|
||||||
|
offset += "</li>";
|
||||||
|
|
||||||
|
listingStandard.Label("Appropriate Offset value for " + currentAnimation + ", " + pawnDef + ", " + bodyTypeDef + ", " + genderDef + ": ");
|
||||||
|
listingStandard.Label(offset);
|
||||||
|
|
||||||
|
if (listingStandard.ButtonText("RimAnims_CopyToClipboard".Translate()))
|
||||||
|
{
|
||||||
|
|
||||||
|
GUIUtility.systemCopyBuffer = offset;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
extendedAnimator.Offset = newOffsetVector;
|
||||||
|
extendedAnimator.Rotation = rot;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
else
|
||||||
|
{
|
||||||
|
listingStandard.Label("Select a pawn currently in an animation to change their offsets");
|
||||||
|
}
|
||||||
|
|
||||||
|
listingStandard.End();
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
if (curPawn.TryGetComp<CompExtendedAnimator> animator) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
if (Find.Selector.SingleSelectedThing is Pawn curPawn) {
|
|
||||||
|
|
||||||
if (CompBodyAnimator.IsAnimating(curPawn)) {
|
|
||||||
|
|
||||||
CompBodyAnimator compBodyAnimator = curPawn.TryGetComp<CompBodyAnimator>();
|
CompBodyAnimator compBodyAnimator = curPawn.TryGetComp<CompBodyAnimator>();
|
||||||
AnimationDef def = compBodyAnimator.CurrentAnimation;
|
AnimationDef def = compBodyAnimator.CurrentAnimation;
|
||||||
int ActorIndex = compBodyAnimator.ActorIndex;
|
int ActorIndex = compBodyAnimator.ActorIndex;
|
||||||
|
@ -104,33 +177,5 @@ namespace Rimworld_Animations {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
listingStandard.Label("Select a pawn currently in an animation to change their offsets");
|
|
||||||
}
|
|
||||||
*/
|
*/
|
||||||
listingStandard.End();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void PreOpen() {
|
|
||||||
base.PreOpen();
|
|
||||||
if(AnimationSettings.offsets == null) {
|
|
||||||
if (AnimationSettings.debugMode)
|
|
||||||
Log.Message("New offsets");
|
|
||||||
AnimationSettings.offsets = new Dictionary<string, Vector2>();
|
|
||||||
}
|
|
||||||
|
|
||||||
if(AnimationSettings.rotation == null) {
|
|
||||||
if (AnimationSettings.debugMode)
|
|
||||||
Log.Message("New rotation");
|
|
||||||
AnimationSettings.rotation = new Dictionary<string, float>();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void PostClose() {
|
|
||||||
base.PostClose();
|
|
||||||
|
|
||||||
LoadedModManager.GetMod<RJW_Animations>().WriteSettings();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -16,7 +16,7 @@ namespace Rimworld_Animations {
|
||||||
|
|
||||||
public override void FinalizeInit() {
|
public override void FinalizeInit() {
|
||||||
base.FinalizeInit();
|
base.FinalizeInit();
|
||||||
OffsetMainButtonDefOf.OffsetManager.buttonVisible = AnimationSettings.offsetTab;
|
OffsetMainButtonDefOf.OffsetManager.buttonVisible = RJWAnimationSettings.offsetTab;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -5,20 +5,23 @@ using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using UnityEngine;
|
||||||
using Verse;
|
using Verse;
|
||||||
|
|
||||||
namespace Rimworld_Animations
|
namespace Rimworld_Animations
|
||||||
{
|
{
|
||||||
/*
|
|
||||||
[HarmonyPatch(typeof(JobDriver_Sex), "SexTick")]
|
[HarmonyPatch(typeof(JobDriver_Sex), "setup_ticks")]
|
||||||
public class HarmonyPatch_JobDriver_Sex
|
public class HarmonyPatch_JobDriver_Sex
|
||||||
{
|
{
|
||||||
public static void Prefix(JobDriver_Sex __instance)
|
public static void Postfix(JobDriver_Sex __instance)
|
||||||
{
|
{
|
||||||
Pawn partner = __instance.Partner;
|
if (!RJWAnimationSettings.hearts)
|
||||||
|
{
|
||||||
|
__instance.ticks_between_hearts = int.MaxValue;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,7 @@ namespace Rimworld_Animations {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!AnimationSettings.PlayAnimForNonsexualActs && NonSexualAct(__instance))
|
if(!RJWAnimationSettings.PlayAnimForNonsexualActs && NonSexualAct(__instance))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -34,8 +34,6 @@ namespace Rimworld_Animations {
|
||||||
|
|
||||||
Pawn Target = __instance.Target as Pawn;
|
Pawn Target = __instance.Target as Pawn;
|
||||||
|
|
||||||
bool quickie = (__instance is JobDriver_SexQuick) && AnimationSettings.fastAnimForQuickie;
|
|
||||||
|
|
||||||
int preAnimDuration = __instance.duration;
|
int preAnimDuration = __instance.duration;
|
||||||
|
|
||||||
|
|
||||||
|
@ -44,7 +42,11 @@ namespace Rimworld_Animations {
|
||||||
GroupAnimationDef groupAnimation = AnimationUtility.FindGroupAnimation(participants, out int reorder);
|
GroupAnimationDef groupAnimation = AnimationUtility.FindGroupAnimation(participants, out int reorder);
|
||||||
if (groupAnimation != null)
|
if (groupAnimation != null)
|
||||||
{
|
{
|
||||||
AnimationUtility.StartGroupAnimation(participants, groupAnimation, reorder, partner);
|
Thing anchor;
|
||||||
|
if (bed != null) anchor = bed;
|
||||||
|
else anchor = partner;
|
||||||
|
|
||||||
|
AnimationUtility.StartGroupAnimation(participants, groupAnimation, reorder, anchor);
|
||||||
int animTicks = AnimationUtility.GetAnimationLength(pawn);
|
int animTicks = AnimationUtility.GetAnimationLength(pawn);
|
||||||
|
|
||||||
foreach(Pawn participant in participants)
|
foreach(Pawn participant in participants)
|
||||||
|
|
78
1.5/Source/Patches/RJWPatches/RJWAnimationSettings.cs
Normal file
78
1.5/Source/Patches/RJWPatches/RJWAnimationSettings.cs
Normal file
|
@ -0,0 +1,78 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Verse;
|
||||||
|
using UnityEngine;
|
||||||
|
using RimWorld;
|
||||||
|
|
||||||
|
namespace Rimworld_Animations {
|
||||||
|
|
||||||
|
public class RJWAnimationSettings : ModSettings {
|
||||||
|
|
||||||
|
public static bool orgasmQuiver, rapeShiver, soundOverride = true, hearts = true, controlGenitalRotation = false,
|
||||||
|
PlayAnimForNonsexualActs = true;
|
||||||
|
|
||||||
|
public static bool offsetTab = false, debugMode = false;
|
||||||
|
public static float shiverIntensity = 2f;
|
||||||
|
|
||||||
|
public override void ExposeData() {
|
||||||
|
|
||||||
|
base.ExposeData();
|
||||||
|
|
||||||
|
Scribe_Values.Look(ref debugMode, "RJWAnimations-AnimsDebugMode", false);
|
||||||
|
Scribe_Values.Look(ref offsetTab, "RJWAnimations-EnableOffsetTab", false);
|
||||||
|
Scribe_Values.Look(ref controlGenitalRotation, "RJWAnimations-controlGenitalRotation", false);
|
||||||
|
Scribe_Values.Look(ref orgasmQuiver, "RJWAnimations-orgasmQuiver");
|
||||||
|
Scribe_Values.Look(ref rapeShiver, "RJWAnimations-rapeShiver");
|
||||||
|
Scribe_Values.Look(ref hearts, "RJWAnimation-heartsOnLovin");
|
||||||
|
Scribe_Values.Look(ref PlayAnimForNonsexualActs, "RJWAnims-PlayAnimForNonsexualActs");
|
||||||
|
Scribe_Values.Look(ref soundOverride, "RJWAnimations-rjwAnimSoundOverride", true);
|
||||||
|
Scribe_Values.Look(ref shiverIntensity, "RJWAnimations-shiverIntensity", 2f);
|
||||||
|
//todo: save offsetsByDefName
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public class RJW_Animations : Mod {
|
||||||
|
|
||||||
|
public RJW_Animations(ModContentPack content) : base(content) {
|
||||||
|
GetSettings<RJWAnimationSettings>();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void DoSettingsWindowContents(Rect inRect) {
|
||||||
|
|
||||||
|
Listing_Standard listingStandard = new Listing_Standard();
|
||||||
|
listingStandard.Begin(inRect);
|
||||||
|
|
||||||
|
listingStandard.CheckboxLabeled("RimAnim_SoundOverride".Translate(), ref RJWAnimationSettings.soundOverride);
|
||||||
|
listingStandard.CheckboxLabeled("RimAnim_GenitalRotation".Translate(), ref RJWAnimationSettings.controlGenitalRotation);
|
||||||
|
listingStandard.CheckboxLabeled("RimAnim_OrgasmQuiver".Translate(), ref RJWAnimationSettings.orgasmQuiver);
|
||||||
|
listingStandard.CheckboxLabeled("RimAnim_RapeShiver".Translate(), ref RJWAnimationSettings.rapeShiver);
|
||||||
|
listingStandard.CheckboxLabeled("RimAnim_HeartsDuringLovin".Translate(), ref RJWAnimationSettings.hearts);
|
||||||
|
listingStandard.CheckboxLabeled("RimAnim_PlayNonsexual".Translate(), ref RJWAnimationSettings.PlayAnimForNonsexualActs);
|
||||||
|
listingStandard.CheckboxLabeled("RimAnim_AnimManagerTab".Translate(), ref RJWAnimationSettings.offsetTab);
|
||||||
|
listingStandard.Label("RimAnim_ShiverIntensity".Translate() + RJWAnimationSettings.shiverIntensity);
|
||||||
|
RJWAnimationSettings.shiverIntensity = listingStandard.Slider(RJWAnimationSettings.shiverIntensity, 0.0f, 12f);
|
||||||
|
|
||||||
|
listingStandard.CheckboxLabeled("RimAnim_DebugMode".Translate(), ref RJWAnimationSettings.debugMode);
|
||||||
|
|
||||||
|
|
||||||
|
listingStandard.End();
|
||||||
|
base.DoSettingsWindowContents(inRect);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void WriteSettings() {
|
||||||
|
base.WriteSettings();
|
||||||
|
OffsetMainButtonDefOf.OffsetManager.buttonVisible = RJWAnimationSettings.offsetTab;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string SettingsCategory() {
|
||||||
|
return "RimAnim_ModSettings".Translate();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -26,5 +26,25 @@ namespace Rimworld_Animations
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public override void TransformRotation(PawnRenderNode node, PawnDrawParms parms, ref Quaternion rotation)
|
||||||
|
{
|
||||||
|
|
||||||
|
if (node.AnimationWorker is AnimationWorker_KeyframesExtended
|
||||||
|
&& node.tree.pawn.TryGetComp<CompExtendedAnimator>(out CompExtendedAnimator extendedAnimator)
|
||||||
|
&& extendedAnimator.IsAnimating)
|
||||||
|
{
|
||||||
|
int? pawnRotation = extendedAnimator.Rotation;
|
||||||
|
if (pawnRotation != null)
|
||||||
|
{
|
||||||
|
Quaternion additionalRotation = Quaternion.AngleAxis((int)pawnRotation, Vector3.up);
|
||||||
|
rotation *= additionalRotation;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
base.TransformRotation(node, parms, ref rotation);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,98 +0,0 @@
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using Verse;
|
|
||||||
using UnityEngine;
|
|
||||||
using RimWorld;
|
|
||||||
|
|
||||||
namespace Rimworld_Animations {
|
|
||||||
|
|
||||||
public class AnimationSettings : ModSettings {
|
|
||||||
|
|
||||||
public static bool orgasmQuiver, rapeShiver, soundOverride = true, hearts = true, controlGenitalRotation = false, applySemenOnAnimationOrgasm = false, fastAnimForQuickie = false,
|
|
||||||
PlayAnimForNonsexualActs = true;
|
|
||||||
public static bool offsetTab = false, debugMode = false;
|
|
||||||
public static float shiverIntensity = 2f;
|
|
||||||
|
|
||||||
public static Dictionary<string, Vector2> offsets = new Dictionary<string, Vector2>();
|
|
||||||
public static Dictionary<string, float> rotation = new Dictionary<string, float>();
|
|
||||||
|
|
||||||
public override void ExposeData() {
|
|
||||||
|
|
||||||
base.ExposeData();
|
|
||||||
|
|
||||||
Scribe_Values.Look(ref debugMode, "RJWAnimations-AnimsDebugMode", false);
|
|
||||||
Scribe_Values.Look(ref offsetTab, "RJWAnimations-EnableOffsetTab", false);
|
|
||||||
Scribe_Values.Look(ref controlGenitalRotation, "RJWAnimations-controlGenitalRotation", false);
|
|
||||||
Scribe_Values.Look(ref orgasmQuiver, "RJWAnimations-orgasmQuiver");
|
|
||||||
Scribe_Values.Look(ref fastAnimForQuickie, "RJWAnimations-fastAnimForQuickie");
|
|
||||||
Scribe_Values.Look(ref rapeShiver, "RJWAnimations-rapeShiver");
|
|
||||||
Scribe_Values.Look(ref hearts, "RJWAnimation-heartsOnLovin");
|
|
||||||
Scribe_Values.Look(ref PlayAnimForNonsexualActs, "RJWAnims-PlayAnimForNonsexualActs");
|
|
||||||
Scribe_Values.Look(ref applySemenOnAnimationOrgasm, "RJWAnimations-applySemenOnOrgasm", false);
|
|
||||||
Scribe_Values.Look(ref soundOverride, "RJWAnimations-rjwAnimSoundOverride", true);
|
|
||||||
Scribe_Values.Look(ref shiverIntensity, "RJWAnimations-shiverIntensity", 2f);
|
|
||||||
//todo: save offsetsByDefName
|
|
||||||
|
|
||||||
Scribe_Collections.Look(ref offsets, "RJWAnimations-animationOffsets");
|
|
||||||
Scribe_Collections.Look(ref rotation, "RJWAnimations-rotationOffsets");
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//needs to be rewritten
|
|
||||||
//probably somewhere in options?
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public class RJW_Animations : Mod {
|
|
||||||
|
|
||||||
public RJW_Animations(ModContentPack content) : base(content) {
|
|
||||||
GetSettings<AnimationSettings>();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void DoSettingsWindowContents(Rect inRect) {
|
|
||||||
|
|
||||||
Listing_Standard listingStandard = new Listing_Standard();
|
|
||||||
listingStandard.Begin(inRect);
|
|
||||||
|
|
||||||
listingStandard.CheckboxLabeled("Enable Sound Override", ref AnimationSettings.soundOverride);
|
|
||||||
listingStandard.CheckboxLabeled("Control Genital Rotation", ref AnimationSettings.controlGenitalRotation);
|
|
||||||
listingStandard.CheckboxLabeled("Play Fast Animation for Quickie", ref AnimationSettings.fastAnimForQuickie);
|
|
||||||
listingStandard.CheckboxLabeled("Apply Semen on Animation Orgasm", ref AnimationSettings.applySemenOnAnimationOrgasm);
|
|
||||||
|
|
||||||
if(AnimationSettings.applySemenOnAnimationOrgasm) {
|
|
||||||
listingStandard.Label("Recommended--turn down \"Cum on body percent\" in RJW settings to about 33%");
|
|
||||||
}
|
|
||||||
|
|
||||||
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);
|
|
||||||
listingStandard.CheckboxLabeled("Play animation for nonsexual acts (handholding, makeout)", ref AnimationSettings.PlayAnimForNonsexualActs);
|
|
||||||
listingStandard.CheckboxLabeled("Enable Animation Manager Tab", ref AnimationSettings.offsetTab);
|
|
||||||
|
|
||||||
listingStandard.Label("Shiver/Quiver Intensity (default 2): " + AnimationSettings.shiverIntensity);
|
|
||||||
AnimationSettings.shiverIntensity = listingStandard.Slider(AnimationSettings.shiverIntensity, 0.0f, 12f);
|
|
||||||
|
|
||||||
listingStandard.CheckboxLabeled("Debug Mode", ref AnimationSettings.debugMode);
|
|
||||||
|
|
||||||
|
|
||||||
listingStandard.End();
|
|
||||||
base.DoSettingsWindowContents(inRect);
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void WriteSettings() {
|
|
||||||
base.WriteSettings();
|
|
||||||
OffsetMainButtonDefOf.OffsetManager.buttonVisible = AnimationSettings.offsetTab;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public override string SettingsCategory() {
|
|
||||||
return "RJW Animation Settings";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -31,20 +31,20 @@ namespace Rimworld_Animations {
|
||||||
for (int i = 0; i < participants.Count; i++)
|
for (int i = 0; i < participants.Count; i++)
|
||||||
{
|
{
|
||||||
|
|
||||||
Vector3? offset = groupAnimationDef.GetOffset(i, participants[i], reorder);
|
groupAnimationDef.GetOffset(i, participants[i], out Vector3? position, out int? rotation, reorder);
|
||||||
|
|
||||||
if (anchor is Pawn pawn && pawn == participants[i])
|
if (anchor is Pawn pawn && pawn == participants[i])
|
||||||
{
|
{
|
||||||
|
|
||||||
List<AnimationDef> allAnimationsForPawn = groupAnimationDef.GetAllAnimationsForActor(i, seed, reorder);
|
List<AnimationDef> allAnimationsForPawn = groupAnimationDef.GetAllAnimationsForActor(i, seed, reorder);
|
||||||
participants[i].TryGetComp<CompExtendedAnimator>().PlayGroupAnimation(allAnimationsForPawn, offset);
|
participants[i].TryGetComp<CompExtendedAnimator>().PlayGroupAnimation(allAnimationsForPawn, position, rotation);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//each participant gets their own unique extendedanimatoranchor, important for scribe_deep saving
|
//each participant gets their own unique extendedanimatoranchor, important for scribe_deep saving
|
||||||
List<AnimationDef> allAnimationsForPawn = groupAnimationDef.GetAllAnimationsForActor(i, seed, reorder);
|
List<AnimationDef> allAnimationsForPawn = groupAnimationDef.GetAllAnimationsForActor(i, seed, reorder);
|
||||||
BaseExtendedAnimatorAnchor animatorAnchor = new ExtendedAnimatorAnchor_Thing(anchor);
|
BaseExtendedAnimatorAnchor animatorAnchor = new ExtendedAnimatorAnchor_Thing(anchor);
|
||||||
participants[i].TryGetComp<CompExtendedAnimator>().PlayGroupAnimation(allAnimationsForPawn, offset, animatorAnchor);
|
participants[i].TryGetComp<CompExtendedAnimator>().PlayGroupAnimation(allAnimationsForPawn, position, rotation, animatorAnchor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -57,8 +57,8 @@ namespace Rimworld_Animations {
|
||||||
for (int i = 0; i < participants.Count; i++)
|
for (int i = 0; i < participants.Count; i++)
|
||||||
{
|
{
|
||||||
List<AnimationDef> allAnimationsForPawn = groupAnimationDef.GetAllAnimationsForActor(i, seed, reorder);
|
List<AnimationDef> allAnimationsForPawn = groupAnimationDef.GetAllAnimationsForActor(i, seed, reorder);
|
||||||
Vector3? offset = groupAnimationDef.GetOffset(i, participants[i], reorder);
|
groupAnimationDef.GetOffset(i, participants[i], out Vector3? position, out int? rotation, reorder);
|
||||||
participants[i].TryGetComp<CompExtendedAnimator>().PlayGroupAnimation(allAnimationsForPawn, offset);
|
participants[i].TryGetComp<CompExtendedAnimator>().PlayGroupAnimation(allAnimationsForPawn, position, rotation);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
21
Languages/English/Keyed/RJWAnimations-LanguageData.xml
Normal file
21
Languages/English/Keyed/RJWAnimations-LanguageData.xml
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
|
<LanguageData>
|
||||||
|
|
||||||
|
<!-- Mod menu -->
|
||||||
|
<RimAnim_ModSettings>RJW Animation Settings</RimAnim_ModSettings>
|
||||||
|
<RimAnim_SoundOverride>Enable Sound Override</RimAnim_SoundOverride>
|
||||||
|
<RimAnim_GenitalRotation>Control Genital Rotation</RimAnim_GenitalRotation>
|
||||||
|
<RimAnim_OrgasmQuiver>Enable Orgasm Quiver</RimAnim_OrgasmQuiver>
|
||||||
|
<RimAnim_RapeShiver>Enable Rape Shiver</RimAnim_RapeShiver>
|
||||||
|
<RimAnim_HeartsDuringLovin>Enable hearts during lovin'</RimAnim_HeartsDuringLovin>
|
||||||
|
<RimAnim_PlayNonsexual>Play animation for nonsexual acts (handholding, makeout)</RimAnim_PlayNonsexual>
|
||||||
|
<RimAnim_AnimManagerTab>Enable Animation Manager Tab</RimAnim_AnimManagerTab>
|
||||||
|
<RimAnim_ShiverIntensity>Shiver/Quiver Intensity (default 2): </RimAnim_ShiverIntensity>
|
||||||
|
<RimAnim_DebugMode>Debug Mode</RimAnim_DebugMode>
|
||||||
|
|
||||||
|
<!-- Main Tab Window -->
|
||||||
|
<RimAnims_Warning>Warning--You generally don't want to change human offsets, only alien offsets or animals</RimAnims_Warning>
|
||||||
|
<RimAnims_CopyToClipboard>Copy Offset to Clipboard</RimAnims_CopyToClipboard>
|
||||||
|
<RimAnims_AnimManager>Animation Manager</RimAnims_AnimManager>
|
||||||
|
|
||||||
|
</LanguageData>
|
|
@ -68,6 +68,10 @@
|
||||||
<HintPath>..\..\RimWorldWin64_Data\Managed\UnityEngine.CoreModule.dll</HintPath>
|
<HintPath>..\..\RimWorldWin64_Data\Managed\UnityEngine.CoreModule.dll</HintPath>
|
||||||
<Private>False</Private>
|
<Private>False</Private>
|
||||||
</Reference>
|
</Reference>
|
||||||
|
<Reference Include="UnityEngine.IMGUIModule">
|
||||||
|
<HintPath>..\..\RimWorldWin64_Data\Managed\UnityEngine.IMGUIModule.dll</HintPath>
|
||||||
|
<Private>False</Private>
|
||||||
|
</Reference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="1.5\Source\Actors\Actor.cs" />
|
<Compile Include="1.5\Source\Actors\Actor.cs" />
|
||||||
|
@ -122,7 +126,7 @@
|
||||||
<Compile Include="1.5\Source\PawnRenderNode\GraphicVariants\PawnRenderNode_GraphicVariants.cs" />
|
<Compile Include="1.5\Source\PawnRenderNode\GraphicVariants\PawnRenderNode_GraphicVariants.cs" />
|
||||||
<Compile Include="1.5\Source\PawnRenderNode\TexPathVariants.cs" />
|
<Compile Include="1.5\Source\PawnRenderNode\TexPathVariants.cs" />
|
||||||
<Compile Include="1.5\Source\RenderSubWorkers\PawnRenderSubWorker_ChangeOffset.cs" />
|
<Compile Include="1.5\Source\RenderSubWorkers\PawnRenderSubWorker_ChangeOffset.cs" />
|
||||||
<Compile Include="1.5\Source\Settings\AnimationSettings.cs" />
|
<Compile Include="1.5\Source\Patches\RJWPatches\RJWAnimationSettings.cs" />
|
||||||
<Compile Include="1.5\Source\Utilities\AnimationUtility.cs" />
|
<Compile Include="1.5\Source\Utilities\AnimationUtility.cs" />
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
@ -187,6 +191,7 @@
|
||||||
<Content Include="1.5\Textures\UI\MainTab.png" />
|
<Content Include="1.5\Textures\UI\MainTab.png" />
|
||||||
<Content Include="About\About.xml" />
|
<Content Include="About\About.xml" />
|
||||||
<Content Include="About\Manifest.xml" />
|
<Content Include="About\Manifest.xml" />
|
||||||
|
<Content Include="Languages\English\Keyed\RJWAnimations-LanguageData.xml" />
|
||||||
<Content Include="Languages\PortugueseBrazilian\DefInjected\MainButtonDef\MainButtonDef.xml" />
|
<Content Include="Languages\PortugueseBrazilian\DefInjected\MainButtonDef\MainButtonDef.xml" />
|
||||||
<Content Include="Languages\PortugueseBrazilian\DefInjected\Rimworld_Animations.AnimationDef\Animations_Beast.xml" />
|
<Content Include="Languages\PortugueseBrazilian\DefInjected\Rimworld_Animations.AnimationDef\Animations_Beast.xml" />
|
||||||
<Content Include="Languages\PortugueseBrazilian\DefInjected\Rimworld_Animations.AnimationDef\Animations_Lesbian.xml" />
|
<Content Include="Languages\PortugueseBrazilian\DefInjected\Rimworld_Animations.AnimationDef\Animations_Lesbian.xml" />
|
||||||
|
@ -197,6 +202,7 @@
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Folder Include="1.5\Source\Extensions\" />
|
<Folder Include="1.5\Source\Extensions\" />
|
||||||
<Folder Include="1.5\Source\Patches\OtherModPatches\" />
|
<Folder Include="1.5\Source\Patches\OtherModPatches\" />
|
||||||
|
<Folder Include="1.5\Source\Settings\" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
</Project>
|
</Project>
|
Loading…
Reference in a new issue