mirror of
https://gitgud.io/c0ffeeeeeeee/rimworld-animations.git
synced 2026-06-19 03:46:00 +00:00
Compare commits
No commits in common. "c3ee13de833cf90c1755097ed27736b7f9642f37" and "319979b0f3c7fd4479761cb2c7f790754999aa80" have entirely different histories.
c3ee13de83
...
319979b0f3
10 changed files with 20 additions and 81 deletions
Binary file not shown.
|
|
@ -107,27 +107,6 @@
|
|||
</keyframes>
|
||||
</value>
|
||||
</li>
|
||||
|
||||
<li MayRequire="shauaputa.rimnudeworld">
|
||||
<key>RimNude_Penis</key>
|
||||
<value>
|
||||
<workerClass>Rimworld_Animations.AnimationWorker_KeyframesExtended</workerClass>
|
||||
<keyframes>
|
||||
<li Class="Rimworld_Animations.ExtendedKeyframe">
|
||||
<tick>0</tick>
|
||||
<angle>-30</angle>
|
||||
<visible>true</visible>
|
||||
<rotation>East</rotation>
|
||||
</li>
|
||||
<li Class="Rimworld_Animations.ExtendedKeyframe">
|
||||
<tick>400</tick>
|
||||
<angle>-600</angle>
|
||||
<visible>true</visible>
|
||||
<rotation>East</rotation>
|
||||
</li>
|
||||
</keyframes>
|
||||
</value>
|
||||
</li>
|
||||
</animationParts>
|
||||
</AnimationDef>
|
||||
</Defs>
|
||||
|
|
@ -38,28 +38,18 @@
|
|||
|
||||
<contexts>
|
||||
<li Class="Rimworld_Animations.GroupAnimationContext_RJWSex">
|
||||
<priority>1</priority>
|
||||
<interactionDefs>
|
||||
<li>Sex_Anal</li>
|
||||
<li>Sex_Vaginal</li>
|
||||
</interactionDefs>
|
||||
</li>
|
||||
<li Class="Rimworld_Animations.GroupAnimationContext_RJWSex">
|
||||
<priority>1</priority>
|
||||
<actorShift>1</actorShift>
|
||||
<interactionDefs>
|
||||
<li>Sex_Reverse_Anal</li>
|
||||
<li>Sex_Reverse_Vaginal</li>
|
||||
</interactionDefs>
|
||||
</li>
|
||||
|
||||
<li Class="Rimworld_Animations.GroupAnimationContext_RJWSex">
|
||||
<priority>0</priority>
|
||||
<interactionDefs>
|
||||
<!-- all other contexts go here -->
|
||||
<!-- the ones that don't make sense but play an animation anyway -->
|
||||
</interactionDefs>
|
||||
</li>
|
||||
</contexts>
|
||||
|
||||
<offsetDefs>
|
||||
|
|
|
|||
|
|
@ -10,16 +10,7 @@ namespace Rimworld_Animations
|
|||
public abstract class BaseGroupAnimationContext
|
||||
{
|
||||
public int actorShift = 0;
|
||||
public int priority = 0;
|
||||
public abstract bool CanAnimationBeUsed(List<Pawn> actors);
|
||||
public virtual int AnimationReorder()
|
||||
{
|
||||
return actorShift;
|
||||
}
|
||||
public virtual int AnimationPriority()
|
||||
{
|
||||
return priority;
|
||||
}
|
||||
public abstract bool CanAnimationBeUsed(List<Pawn> actors, out int reorder);
|
||||
public abstract string DebugMessage();
|
||||
|
||||
//cool class for designating contexts for animations
|
||||
|
|
|
|||
|
|
@ -15,10 +15,12 @@ namespace Rimworld_Animations
|
|||
|
||||
public List<InteractionDef> interactionDefs;
|
||||
|
||||
public override bool CanAnimationBeUsed(List<Pawn> actors)
|
||||
public override bool CanAnimationBeUsed(List<Pawn> actors, out int reorder)
|
||||
{
|
||||
|
||||
JobDriver_SexBaseInitiator latestSexBaseInitiator = (actors.FindLast(x => x.jobs?.curDriver is JobDriver_SexBaseInitiator).jobs.curDriver as JobDriver_SexBaseInitiator);
|
||||
reorder = base.actorShift;
|
||||
|
||||
|
||||
return interactionDefs.Contains(latestSexBaseInitiator.Sexprops.dictionaryKey);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,50 +16,24 @@ namespace Rimworld_Animations
|
|||
public List<AnimationOffsetDef> offsetDefs;
|
||||
|
||||
|
||||
public bool canAnimationBeUsed(List<Pawn> actors)
|
||||
public bool canAnimationBeUsed(List<Pawn> actors, out int reorder)
|
||||
{
|
||||
|
||||
if (RJWAnimationSettings.debugMode)
|
||||
{
|
||||
Log.Message("[anims] Checking if " + defName + " is valid animation");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
foreach (BaseGroupAnimationContext context in contexts)
|
||||
{
|
||||
if (context.CanAnimationBeUsed(actors))
|
||||
if (context.CanAnimationBeUsed(actors, out reorder))
|
||||
{
|
||||
//find all where context matches actors
|
||||
return true;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public int Priority(List<Pawn> actors, out int reorder)
|
||||
{
|
||||
int priority = -999999999;
|
||||
reorder = 0;
|
||||
|
||||
foreach (BaseGroupAnimationContext context in contexts)
|
||||
{
|
||||
if (context.CanAnimationBeUsed(actors))
|
||||
{
|
||||
if (context.AnimationPriority() > priority)
|
||||
{
|
||||
//get highest priority context for fitting animation
|
||||
priority = context.AnimationPriority();
|
||||
reorder = context.AnimationReorder();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return priority;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public List<AnimationDef> GetAllAnimationsForActor(int actor, int seed, int reorder = 0)
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ namespace Rimworld_Animations
|
|||
public static bool Prefix(PawnRenderTree __instance, Dictionary<PawnRenderNodeTagDef, PawnRenderNode> ___nodesByTag, PawnRenderNode node, ref PawnDrawParms parms, ref Matrix4x4 matrix, ref bool __result)
|
||||
{
|
||||
/*
|
||||
* Facing offsets fix
|
||||
* Facing fix
|
||||
*/
|
||||
//find lowest parent that is animating, or nothing if not animating
|
||||
PawnRenderNode animatingNode = node;
|
||||
|
|
|
|||
|
|
@ -44,6 +44,7 @@ namespace Rimworld_Animations
|
|||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//there is no graphic hediff variants appropriate
|
||||
|
|
@ -62,6 +63,7 @@ namespace Rimworld_Animations
|
|||
//do graphicvariantsfor
|
||||
variants = GraphicHediffVariantsFor(this.tree.pawn);
|
||||
}
|
||||
|
||||
//call this in case variants wasn't set, and there is no graphic hediff variants appropriate; it'll set variants based on default
|
||||
base.EnsureMaterialsInitialized();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ 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)
|
||||
|
|
|
|||
|
|
@ -84,15 +84,15 @@ namespace Rimworld_Animations {
|
|||
|
||||
int reorder2 = 0;
|
||||
|
||||
//find all, reorder randomly, then find max priority context
|
||||
GroupAnimationDef result = DefDatabase<GroupAnimationDef>.AllDefsListForReading
|
||||
.FindAll((GroupAnimationDef x) => x.canAnimationBeUsed(participants))
|
||||
.OrderBy(_ => Rand.Int)
|
||||
.MaxBy((GroupAnimationDef x) => x.Priority(participants, out reorder2));
|
||||
|
||||
DefDatabase<GroupAnimationDef>.AllDefsListForReading.TryRandomElement((GroupAnimationDef x) =>
|
||||
x.canAnimationBeUsed(participants, out reorder2), out GroupAnimationDef result);
|
||||
|
||||
reorder = reorder2;
|
||||
return result;
|
||||
if (result != null) return result;
|
||||
|
||||
return null;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue