diff --git a/1.1/Assemblies/Rimworld-Animations.dll b/1.1/Assemblies/Rimworld-Animations.dll index de4b830..b0a3ccd 100644 Binary files a/1.1/Assemblies/Rimworld-Animations.dll and b/1.1/Assemblies/Rimworld-Animations.dll differ diff --git a/Source/Actors/Actor.cs b/Source/Actors/Actor.cs index eebe5ad..450c3d9 100644 --- a/Source/Actors/Actor.cs +++ b/Source/Actors/Actor.cs @@ -7,7 +7,7 @@ using UnityEngine; using Verse; namespace Rimworld_Animations { - public class Actor : IExposable { + public class Actor { public List defNames; public List requiredGenitals; public List raceOffsets; @@ -20,12 +20,5 @@ namespace Rimworld_Animations { public BodyTypeOffset bodyTypeOffset = new BodyTypeOffset(); public Vector3 offset = new Vector2(0, 0); - public Dictionary offsetsByDefName = new Dictionary(); - public Dictionary rotationByDefName = new Dictionary(); - - public void ExposeData() { - Scribe_Collections.Look(ref offsetsByDefName, "OffsetsSetInOptions", LookMode.Value, LookMode.Value); - Scribe_Collections.Look(ref rotationByDefName, "RotationOffsetsFromOptions", LookMode.Value, LookMode.Value); - } } } diff --git a/Source/AnimationUtility.cs b/Source/AnimationUtility.cs index e822d37..1c758de 100644 --- a/Source/AnimationUtility.cs +++ b/Source/AnimationUtility.cs @@ -80,8 +80,8 @@ namespace Rimworld_Animations { /* if (x.defName != "Doggystyle") return false; - */ + if (x.actors[i].isFucking && !rjw.xxx.can_fuck(localParticipants[i])) { Log.Message(x.defName.ToStringSafe() + " not selected -- " + localParticipants[i].def.defName.ToStringSafe() + " " + localParticipants[i].Name.ToStringSafe() + " can't fuck"); diff --git a/Source/Comps/CompBodyAnimator.cs b/Source/Comps/CompBodyAnimator.cs index e18113f..fb84d77 100644 --- a/Source/Comps/CompBodyAnimator.cs +++ b/Source/Comps/CompBodyAnimator.cs @@ -261,9 +261,9 @@ namespace Rimworld_Animations { deltaPos = new Vector3(clip.BodyOffsetX.Evaluate(clipPercent) * (mirror ? -1 : 1), clip.layer.AltitudeFor(), clip.BodyOffsetZ.Evaluate(clipPercent)); - if (CurrentAnimation?.actors[ActorIndex]?.offsetsByDefName != null && CurrentAnimation.actors[ActorIndex].offsetsByDefName.ContainsKey(pawn.def.defName)) { - deltaPos.x += CurrentAnimation.actors[ActorIndex].offsetsByDefName[pawn.def.defName].x * (mirror ? -1 : 1); - deltaPos.z += CurrentAnimation.actors[ActorIndex].offsetsByDefName[pawn.def.defName].y; + if (AnimationSettings.offsets != null && AnimationSettings.offsets.ContainsKey(CurrentAnimation.defName + pawn.def.defName + ActorIndex)) { + deltaPos.x += AnimationSettings.offsets[CurrentAnimation.defName + pawn.def.defName + ActorIndex].x * (mirror ? -1 : 1); + deltaPos.z += AnimationSettings.offsets[CurrentAnimation.defName + pawn.def.defName + ActorIndex].y; } @@ -274,8 +274,8 @@ namespace Rimworld_Animations { genitalAngle = clip.GenitalAngle.Evaluate(clipPercent) * (mirror ? -1 : 1); } - if (CurrentAnimation?.actors[ActorIndex]?.rotationByDefName != null && CurrentAnimation.actors[ActorIndex].rotationByDefName.ContainsKey(pawn.def.defName)) { - float offsetRotation = CurrentAnimation.actors[ActorIndex].rotationByDefName[pawn.def.defName] * (Mirror ? -1 : 1); + if (AnimationSettings.rotation != null && AnimationSettings.rotation.ContainsKey(CurrentAnimation.defName + pawn.def.defName + ActorIndex)) { + float offsetRotation = AnimationSettings.rotation[CurrentAnimation.defName + pawn.def.defName + ActorIndex] * (Mirror ? -1 : 1); genitalAngle += offsetRotation; bodyAngle += offsetRotation; headAngle += offsetRotation; diff --git a/Source/JobDrivers/JobDriver_SexBaseRecieverLovedForAnimation.cs b/Source/JobDrivers/JobDriver_SexBaseRecieverLovedForAnimation.cs index 30302e1..4b5d844 100644 --- a/Source/JobDrivers/JobDriver_SexBaseRecieverLovedForAnimation.cs +++ b/Source/JobDrivers/JobDriver_SexBaseRecieverLovedForAnimation.cs @@ -11,10 +11,15 @@ namespace Rimworld_Animations { public readonly TargetIndex ipartner = TargetIndex.A; public readonly TargetIndex ibed = TargetIndex.B; + public override bool TryMakePreToilReservations(bool errorOnFailed) { + + return base.TryMakePreToilReservations(errorOnFailed); + } + protected override IEnumerable MakeNewToils() { + + setup_ticks(); - parteners.Add(Partner);// add job starter, so this wont fail, before Initiator starts his job - //--Log.Message("[RJW]JobDriver_GettinLoved::MakeNewToils is called"); float partner_ability = xxx.get_sex_ability(Partner); @@ -30,6 +35,10 @@ namespace Rimworld_Animations { else if (pawn.relations.OpinionOf(Partner) > 60) ticks_between_hearts -= 25; + + parteners.Add(Partner);// add job starter, so this wont fail, before Initiator starts his job + //--Log.Message("[RJW]JobDriver_GettinLoved::MakeNewToils is called"); + this.FailOnDespawnedOrNull(ipartner); this.FailOn(() => !Partner.health.capacities.CanBeAwake); this.FailOn(() => pawn.Drafted); diff --git a/Source/MainTabWindows/MainTabWindow_OffsetConfigure.cs b/Source/MainTabWindows/MainTabWindow_OffsetConfigure.cs index 9516e3a..ab2a354 100644 --- a/Source/MainTabWindows/MainTabWindow_OffsetConfigure.cs +++ b/Source/MainTabWindows/MainTabWindow_OffsetConfigure.cs @@ -31,22 +31,22 @@ namespace Rimworld_Animations { if (curPawn.TryGetComp().isAnimating) { - Actor curActor = curPawn.TryGetComp().CurrentAnimation.actors[curPawn.TryGetComp().ActorIndex]; - + AnimationDef def = curPawn.TryGetComp().CurrentAnimation; + int ActorIndex = curPawn.TryGetComp().ActorIndex; float offsetX = 0, offsetZ = 0, rotation = 0; - if (curActor.offsetsByDefName.ContainsKey(curPawn.def.defName)) { - offsetX = curActor.offsetsByDefName[curPawn.def.defName].x; - offsetZ = curActor.offsetsByDefName[curPawn.def.defName].y; + if (AnimationSettings.offsets.ContainsKey(def.defName + curPawn.def.defName + ActorIndex)) { + offsetX = AnimationSettings.offsets[def.defName + curPawn.def.defName + ActorIndex].x; + offsetZ = AnimationSettings.offsets[def.defName + curPawn.def.defName + ActorIndex].y; } else { - curActor.offsetsByDefName.Add(curPawn.def.defName, new Vector2(0, 0)); + AnimationSettings.offsets.Add(def.defName + curPawn.def.defName + ActorIndex, new Vector2(0, 0)); } - if (curActor.rotationByDefName.ContainsKey(curPawn.def.defName)) { - rotation = curActor.rotationByDefName[curPawn.def.defName]; + if (AnimationSettings.rotation.ContainsKey(def.defName + curPawn.def.defName + ActorIndex)) { + rotation = AnimationSettings.rotation[def.defName + curPawn.def.defName + ActorIndex]; } else { - curActor.rotationByDefName.Add(curPawn.def.defName, 180); + AnimationSettings.rotation.Add(def.defName + curPawn.def.defName + ActorIndex, 0); } @@ -72,12 +72,13 @@ namespace Rimworld_Animations { rotation = 0; } - if (offsetX != curActor.offsetsByDefName[curPawn.def.defName].x || offsetZ != curActor.offsetsByDefName[curPawn.def.defName].y) { - curActor.offsetsByDefName[curPawn.def.defName] = new Vector2(offsetX, offsetZ); + if (offsetX != AnimationSettings.offsets[def.defName + curPawn.def.defName + ActorIndex].x || offsetZ != AnimationSettings.offsets[def.defName + curPawn.def.defName + ActorIndex].y) { + AnimationSettings.offsets[def.defName + curPawn.def.defName + ActorIndex] = new Vector2(offsetX, offsetZ); + } - if(rotation != curActor.rotationByDefName[curPawn.def.defName]) { - curActor.rotationByDefName[curPawn.def.defName] = rotation; + if(rotation != AnimationSettings.rotation[def.defName + curPawn.def.defName + ActorIndex]) { + AnimationSettings.rotation[def.defName + curPawn.def.defName + ActorIndex] = rotation; } } @@ -93,5 +94,24 @@ namespace Rimworld_Animations { base.DoWindowContents(inRect); } + + public override void PreOpen() { + base.PreOpen(); + if(AnimationSettings.offsets == null) { + Log.Message("New offsets"); + AnimationSettings.offsets = new Dictionary(); + } + + if(AnimationSettings.rotation == null) { + Log.Message("New rotation"); + AnimationSettings.rotation = new Dictionary(); + } + } + + public override void PostClose() { + base.PostClose(); + + LoadedModManager.GetMod().WriteSettings(); + } } } diff --git a/Source/MainTabWindows/OffsetMainButtonDefOf.cs b/Source/MainTabWindows/OffsetMainButtonDefOf.cs index 657a4c5..e7ad9eb 100644 --- a/Source/MainTabWindows/OffsetMainButtonDefOf.cs +++ b/Source/MainTabWindows/OffsetMainButtonDefOf.cs @@ -16,7 +16,6 @@ namespace Rimworld_Animations { static OffsetMainButtonDefOf() { DefOfHelper.EnsureInitializedInCtor(typeof(OffsetMainButtonDefOf)); - //OffsetManager.buttonVisible = false; } } diff --git a/Source/Settings/AnimationSettings.cs b/Source/Settings/AnimationSettings.cs index ff6cd6e..9640395 100644 --- a/Source/Settings/AnimationSettings.cs +++ b/Source/Settings/AnimationSettings.cs @@ -13,7 +13,8 @@ namespace Rimworld_Animations { public static bool orgasmQuiver, rapeShiver, soundOverride = true, hearts = true, controlGenitalRotation = false, applySemenOnAnimationOrgasm = false, fastAnimForQuickie = false; public static float shiverIntensity = 2f; - public static Dictionary offsetsByDefName; + public static Dictionary offsets = new Dictionary(); + public static Dictionary rotation = new Dictionary(); public override void ExposeData() { @@ -27,9 +28,16 @@ namespace Rimworld_Animations { Scribe_Values.Look(ref applySemenOnAnimationOrgasm, "applySemenOnOrgasm", false); Scribe_Values.Look(ref soundOverride, "rjwAnimSoundOverride", true); Scribe_Values.Look(ref shiverIntensity, "shiverIntensity", 2f); - //todo: save offsetsByDefName - + + Scribe_Collections.Look(ref offsets, "animationOffsets"); + Scribe_Collections.Look(ref rotation, "rotationOffsets"); + + + + //needs to be rewritten + //probably somewhere in options? + } } @@ -38,6 +46,7 @@ namespace Rimworld_Animations { public RJW_Animations(ModContentPack content) : base(content) { GetSettings(); + } public override void DoSettingsWindowContents(Rect inRect) {