Compare commits

...

5 commits

Author SHA1 Message Date
c0ffee
8a93f3b087 set extended keyframe to default invisible for bugged hand anims 2024-05-03 12:58:47 -07:00
c0ffee
e639ae8fb8 Further debug logging for animations 2024-05-03 10:51:59 -07:00
c0ffee
7596fe86c6 patch for graphic variant workers not rendering at all 2024-05-03 08:43:34 -07:00
c0ffee
775d3d913e debug logging info 2024-05-03 07:35:55 -07:00
c0ffee
eead6ae7ca null ref checks for jobs 2024-05-03 06:54:32 -07:00
9 changed files with 97 additions and 44 deletions

8
.gitignore vendored
View file

@ -348,3 +348,11 @@ healthchecksdb
/Source/Patches/OtherModPatches/HarmonyPatch_AlienRace.cs
/Source/Patches/ThingAnimationPatches/HarmonyPatch_ThingDrawAt.cs
/Defs/AnimationDefs/Animations_SexToys.xml
/1.5/Defs/AnimationDefs/BasicBestiality/HumanRotatedOffset.xml
/1.5/Defs/AnimationDefs/BasicBestiality/BasicBestiality4v1.xml
/1.5/Defs/AnimationDefs/BasicBestiality/BasicBestiality3v1.xml
/1.5/Defs/AnimationDefs/BasicBestiality/BasicBestiality2v1.xml
/1.5/Defs/AnimationDefs/BasicBestiality/BasicBestiality1v1.xml
/1.5/Defs/AnimationDefs/BasicBestiality/!BasicBestiality.xml
/1.5/Defs/TestDoNotPush
/1.5/Textures/AnimationProps/BEV

View file

@ -19,11 +19,6 @@ namespace Rimworld_Animations
public bool canAnimationBeUsed(List<Pawn> actors)
{
if (RJWAnimationSettings.debugMode)
{
Log.Message("[anims] Checking if " + defName + " is valid animation");
}
if (!contexts.NullOrEmpty())
{
foreach (BaseGroupAnimationContext context in contexts)

View file

@ -14,6 +14,6 @@ namespace Rimworld_Animations
public Rot4 rotation = Rot4.North;
public SoundDef sound = null;
public VoiceTagDef voice = null;
public bool visible = true;
public bool visible = false;
}
}

View file

@ -11,50 +11,45 @@ namespace Rimworld_Animations {
[HarmonyPatch(typeof(JobDriver_SexBaseInitiator), "Start")]
static class HarmonyPatch_JobDriver_SexBaseInitiator_Start {
public static void Postfix(ref JobDriver_SexBaseInitiator __instance) {
/*
These particular jobs need special code
don't play anim for now
*/
if(__instance is JobDriver_Masturbate || __instance is JobDriver_ViolateCorpse) {
return;
}
if(!RJWAnimationSettings.PlayAnimForNonsexualActs && NonSexualAct(__instance))
{
return;
}
Pawn pawn = __instance.pawn;
Pawn partner = __instance.Target as Pawn;
Building_Bed bed = __instance.Bed;
if (partner?.jobs?.curDriver is JobDriver_SexBaseReciever partnerSexBaseReceiver) {
Pawn Target = __instance.Target as Pawn;
int preAnimDuration = __instance.duration;
List<Pawn> participants = partnerSexBaseReceiver.parteners.Append(partner).ToList();
GroupAnimationDef groupAnimation = AnimationUtility.FindGroupAnimation(participants, out int reorder);
if (groupAnimation != null)
{
Thing anchor;
if (bed != null) anchor = bed;
else anchor = partner;
Thing anchor = (Thing)__instance.Bed ?? partner;
AnimationUtility.StartGroupAnimation(participants, groupAnimation, reorder, anchor);
int animTicks = AnimationUtility.GetAnimationLength(pawn);
foreach(Pawn participant in participants)
{
(participant.jobs.curDriver as JobDriver_Sex).ticks_left = animTicks;
(participant.jobs.curDriver as JobDriver_Sex).sex_ticks = animTicks;
(participant.jobs.curDriver as JobDriver_Sex).orgasmStartTick = animTicks;
(participant.jobs.curDriver as JobDriver_Sex).duration = animTicks;
if (RJWAnimationSettings.debugMode)
{
Log.Message("Participant: " + participant.Name);
Log.Message("JobDriver: " + participant.CurJobDef.defName);
}
//null ref check for pawns that might have lost their jobs or become null for some reason
if (participant?.jobs?.curDriver is JobDriver_Sex participantJobDriver)
{
participantJobDriver.ticks_left = animTicks;
participantJobDriver.sex_ticks = animTicks;
participantJobDriver.orgasmStartTick = animTicks;
participantJobDriver.duration = animTicks;
}
}
}
}
@ -92,7 +87,8 @@ namespace Rimworld_Animations {
}
//stop partner's other partners (threesome pawns) animating
if (__instance.Partner.jobs.curDriver is JobDriver_SexBaseReciever partnerReceiverJob)
//added null ref checks for instances when pawns get nulled or lose their jobs
if (__instance.Partner?.jobs?.curDriver is JobDriver_SexBaseReciever partnerReceiverJob)
{
foreach(Pawn pawn in partnerReceiverJob.parteners)
{

View file

@ -31,13 +31,6 @@ namespace Rimworld_Animations
return true;
}
//set graphic variant nodes to invisible when not animating
if (node is PawnRenderNode_GraphicVariants)
{
__result = false;
return false;
}
return true;
}

View file

@ -18,14 +18,13 @@ namespace Rimworld_Animations
if (parms.Portrait) return false;
//don't draw if not visible at tick
if (node.AnimationWorker is AnimationWorker_KeyframesExtended extendedAnimator
&& !extendedAnimator.visibleAtTick(node.tree.AnimationTick))
if (node.AnimationWorker is AnimationWorker_KeyframesExtended extendedAnimator)
{
return false;
return extendedAnimator.visibleAtTick(node.tree.AnimationTick);
}
return true;
//don't draw at all if not animating
return false;
}
protected override Material GetMaterial(PawnRenderNode node, PawnDrawParms parms)
{

View file

@ -44,6 +44,12 @@ namespace Rimworld_Animations {
//each participant gets their own unique extendedanimatoranchor, important for scribe_deep saving
List<AnimationDef> allAnimationsForPawn = groupAnimationDef.GetAllAnimationsForActor(i, seed, reorder);
BaseExtendedAnimatorAnchor animatorAnchor = new ExtendedAnimatorAnchor_Thing(anchor);
if (RJWAnimationSettings.debugMode)
{
Log.Message("Now playing animation: " + groupAnimationDef.defName);
}
participants[i].TryGetComp<CompExtendedAnimator>().PlayGroupAnimation(allAnimationsForPawn, position, rotation, animatorAnchor);
}
}

View file

@ -143,6 +143,12 @@
<Content Include="1.5\Assemblies\0MultiplayerAPI.dll" />
<Content Include="1.5\Assemblies\Rimworld-Animations.dll" />
<Content Include="1.5\Assemblies\RJW.dll" />
<Content Include="1.5\Defs\AnimationDefs\BasicBestiality\!BasicBestiality.xml" />
<Content Include="1.5\Defs\AnimationDefs\BasicBestiality\BasicBestiality1v1.xml" />
<Content Include="1.5\Defs\AnimationDefs\BasicBestiality\BasicBestiality2v1.xml" />
<Content Include="1.5\Defs\AnimationDefs\BasicBestiality\BasicBestiality3v1.xml" />
<Content Include="1.5\Defs\AnimationDefs\BasicBestiality\BasicBestiality4v1.xml" />
<Content Include="1.5\Defs\AnimationDefs\BasicBestiality\HumanRotatedOffset.xml" />
<Content Include="1.5\Defs\AnimationDefs\Cowgirl\AnimationPropDef_Cowgirl_Xray.xml" />
<Content Include="1.5\Defs\AnimationDefs\Cowgirl\Cowgirl_Stage1.xml" />
<Content Include="1.5\Defs\AnimationDefs\Cowgirl\Cowgirl_Stage2_1.xml" />
@ -178,6 +184,56 @@
<Content Include="1.5\Defs\AnimationDefs\Missionary\Stage6.xml" />
<Content Include="1.5\Defs\AnimationPropDefs\AnimationPropDef_Hand.xml" />
<Content Include="1.5\Defs\OffsetDefs\OffsetDef_Placeholder.xml" />
<Content Include="1.5\Defs\TestDoNotPush\AnimationDefs\Doggystyle Condom\AnimationPropDef_BEV.xml" />
<Content Include="1.5\Defs\TestDoNotPush\AnimationDefs\Doggystyle Condom\Doggystyle Intro1.xml" />
<Content Include="1.5\Defs\TestDoNotPush\AnimationDefs\Doggystyle Condom\Doggystyle Intro2.xml" />
<Content Include="1.5\Defs\TestDoNotPush\AnimationDefs\Doggystyle Condom\Doggystyle Intro3.xml" />
<Content Include="1.5\Defs\TestDoNotPush\AnimationDefs\Doggystyle Condom\Doggystyle1.xml" />
<Content Include="1.5\Defs\TestDoNotPush\AnimationDefs\Doggystyle Condom\Doggystyle2.xml" />
<Content Include="1.5\Defs\TestDoNotPush\AnimationDefs\Doggystyle Condom\Doggystyle3.xml" />
<Content Include="1.5\Defs\TestDoNotPush\AnimationDefs\Doggystyle Condom\Doggystyle4.xml" />
<Content Include="1.5\Defs\TestDoNotPush\AnimationDefs\Doggystyle Condom\Doggystyle5.xml" />
<Content Include="1.5\Defs\TestDoNotPush\AnimationDefs\Doggystyle Condom\Doggystyle6.xml" />
<Content Include="1.5\Defs\TestDoNotPush\AnimationDefs\Doggystyle Condom\Doggystyle7.xml" />
<Content Include="1.5\Defs\TestDoNotPush\AnimationDefs\Doggystyle Condom\Doggystyle8.xml" />
<Content Include="1.5\Defs\TestDoNotPush\AnimationDefs\Doggystyle Condom\GroupAnimation_Doggystyle_Condom_BEV.xml" />
<Content Include="1.5\Defs\TestDoNotPush\AnimationDefs\Doggystyle Condom\OffsetDef_Doggystyle_BEV_Bottom.xml" />
<Content Include="1.5\Defs\TestDoNotPush\AnimationDefs\Doggystyle Condom\OffsetDef_Doggystyle_BEV_Top.xml" />
<Content Include="1.5\Defs\TestDoNotPush\AnimationDefs\Doggystyle Condom\TexPathVariants_Doggystyle_BEV.xml" />
<Content Include="1.5\Defs\TestDoNotPush\AnimationProps\BEV\Condom\Condom.png" />
<Content Include="1.5\Defs\TestDoNotPush\AnimationProps\BEV\Condom\CondomOpened.png" />
<Content Include="1.5\Defs\TestDoNotPush\AnimationProps\BEV\Condom\CondomUnused.png" />
<Content Include="1.5\Defs\TestDoNotPush\AnimationProps\BEV\Condom\CondomWithCumStages\CondomWithCumStage1.png" />
<Content Include="1.5\Defs\TestDoNotPush\AnimationProps\BEV\Condom\CondomWithCumStages\CondomWithCumStage10.png" />
<Content Include="1.5\Defs\TestDoNotPush\AnimationProps\BEV\Condom\CondomWithCumStages\CondomWithCumStage11.png" />
<Content Include="1.5\Defs\TestDoNotPush\AnimationProps\BEV\Condom\CondomWithCumStages\CondomWithCumStage2.png" />
<Content Include="1.5\Defs\TestDoNotPush\AnimationProps\BEV\Condom\CondomWithCumStages\CondomWithCumStage3.png" />
<Content Include="1.5\Defs\TestDoNotPush\AnimationProps\BEV\Condom\CondomWithCumStages\CondomWithCumStage4.png" />
<Content Include="1.5\Defs\TestDoNotPush\AnimationProps\BEV\Condom\CondomWithCumStages\CondomWithCumStage5.png" />
<Content Include="1.5\Defs\TestDoNotPush\AnimationProps\BEV\Condom\CondomWithCumStages\CondomWithCumStage6.png" />
<Content Include="1.5\Defs\TestDoNotPush\AnimationProps\BEV\Condom\CondomWithCumStages\CondomWithCumStage7.png" />
<Content Include="1.5\Defs\TestDoNotPush\AnimationProps\BEV\Condom\CondomWithCumStages\CondomWithCumStage8.png" />
<Content Include="1.5\Defs\TestDoNotPush\AnimationProps\BEV\Condom\CondomWithCumStages\CondomWithCumStage9.png" />
<Content Include="1.5\Defs\TestDoNotPush\AnimationProps\BEV\Condom\CondomWithPenis.png" />
<Content Include="1.5\Defs\TestDoNotPush\AnimationProps\BEV\Condom\UsedCondom.png" />
<Content Include="1.5\Defs\TestDoNotPush\AnimationProps\BEV\Cum\Cum_Drop.png" />
<Content Include="1.5\Defs\TestDoNotPush\AnimationProps\BEV\Cum\Cum_Drop_Flipped.png" />
<Content Include="1.5\Defs\TestDoNotPush\AnimationProps\BEV\Cum\Cum_Splash.png" />
<Content Include="1.5\Defs\TestDoNotPush\AnimationProps\BEV\Cum\Image1.png" />
<Content Include="1.5\Defs\TestDoNotPush\AnimationProps\BEV\Cum\Image2.png" />
<Content Include="1.5\Defs\TestDoNotPush\AnimationProps\BEV\Cum\Image3.png" />
<Content Include="1.5\Defs\TestDoNotPush\AnimationProps\BEV\Cum\Image4.png" />
<Content Include="1.5\Defs\TestDoNotPush\AnimationProps\BEV\Cum\Image5.png" />
<Content Include="1.5\Defs\TestDoNotPush\AnimationProps\BEV\Cum\Image6.png" />
<Content Include="1.5\Defs\TestDoNotPush\AnimationProps\BEV\Cum\Image7.png" />
<Content Include="1.5\Defs\TestDoNotPush\AnimationProps\BEV\Food\Grape.png" />
<Content Include="1.5\Defs\TestDoNotPush\AnimationProps\BEV\Food\VineofGrapes.png" />
<Content Include="1.5\Defs\TestDoNotPush\AnimationProps\BEV\Hands\Hand.png" />
<Content Include="1.5\Defs\TestDoNotPush\AnimationProps\BEV\Hands\HandClean.png" />
<Content Include="1.5\Defs\TestDoNotPush\AnimationProps\BEV\Misc\Image1.png" />
<Content Include="1.5\Defs\TestDoNotPush\AnimationProps\BEV\Misc\Phone.png" />
<Content Include="1.5\Defs\TestDoNotPush\AnimationProps\BEV\Penis\Penis.png" />
<Content Include="1.5\Defs\TestDoNotPush\AnimationProps\BEV\Water\Drop.png" />
<Content Include="1.5\Defs\TexPathVariantsDefs\TexPathVariants_XrayPenis_Human.xml" />
<Content Include="1.5\Defs\AnimationDefs\TestAnimation1.xml" />
<Content Include="1.5\Defs\AnimationDefs\TestAnimation2.xml" />