improving context by using rjw's new sexprops

This commit is contained in:
Platinum 2020-07-14 12:12:09 -07:00
parent a890f7ccd7
commit cd7a778f07
5 changed files with 74 additions and 9 deletions

View file

@ -14,11 +14,13 @@ namespace Rimworld_Animations {
Note: always make the list in this order:
Female pawns, animal female pawns, male pawns, animal male pawns
*/
public static AnimationDef tryFindAnimation(ref List<Pawn> participants, rjw.xxx.rjwSextype sexType = 0) {
public static AnimationDef tryFindAnimation(ref List<Pawn> participants, rjw.xxx.rjwSextype sexType = 0, rjw.SexProps sexProps = null) {
//aggressors last
participants = participants.OrderBy(p => p.jobs.curDriver is rjw.JobDriver_SexBaseInitiator).ToList();
participants = participants.OrderBy(p => p == sexProps.Giver).ToList();
participants = participants.OrderByDescending(p => rjw.GenderHelper.GetSex(p) == rjw.GenderHelper.Sex.futa).ToList();
//pawns that can fuck last
@ -30,7 +32,6 @@ namespace Rimworld_Animations {
IEnumerable<AnimationDef> options = DefDatabase<AnimationDef>.AllDefs.Where((AnimationDef x) => {
if (x.actors.Count != localParticipants.Count) {
return false;
}
@ -191,7 +192,15 @@ namespace Rimworld_Animations {
//if the animation not for initiators, but an initiator is playing it
if (x.actors[i].initiator && !(localParticipants[i].jobs.curDriver is rjw.JobDriver_SexBaseInitiator)) {
if(sexProps != null) {
if(x.actors[i].initiator && localParticipants[i] == sexProps.Reciever) {
initiatorsAlignWithSexType = false;
}
}
else if (x.actors[i].initiator && !(localParticipants[i].jobs.curDriver is rjw.JobDriver_SexBaseInitiator)) {
initiatorsAlignWithSexType = false;
}
}
@ -203,7 +212,15 @@ namespace Rimworld_Animations {
//if the animation not for initiators, but an initiator is playing it
if (x.actors[i].initiator && !(localParticipants[i].jobs.curDriver is rjw.JobDriver_SexBaseInitiator)) {
if (sexProps != null) {
if (x.actors[i].initiator && localParticipants[i] == sexProps.Giver) {
initiatorsAlignWithSexType = false;
}
}
else if (x.actors[i].initiator && !(localParticipants[i].jobs.curDriver is rjw.JobDriver_SexBaseInitiator)) {
initiatorsAlignWithSexType = false;
}
}

View file

@ -55,15 +55,15 @@ namespace Rimworld_Animations {
bool quickie = (__instance is JobDriver_SexQuick) && AnimationSettings.fastAnimForQuickie;
if (bed != null) {
RerollAnimations(Target, __instance.duration, bed as Thing, __instance.sexType, quickie);
RerollAnimations(Target, __instance.duration, bed as Thing, __instance.sexType, quickie, sexProps: __instance.Sexprops);
}
else {
RerollAnimations(Target, __instance.duration, sexType: __instance.sexType, fastAnimForQuickie: quickie);
RerollAnimations(Target, __instance.duration, sexType: __instance.sexType, fastAnimForQuickie: quickie, sexProps: __instance.Sexprops);
}
}
}
public static void RerollAnimations(Pawn pawn, int duration, Thing bed = null, xxx.rjwSextype sexType = xxx.rjwSextype.None, bool fastAnimForQuickie = false) {
public static void RerollAnimations(Pawn pawn, int duration, Thing bed = null, xxx.rjwSextype sexType = xxx.rjwSextype.None, bool fastAnimForQuickie = false, rjw.SexProps sexProps = null) {
if(pawn == null || !(pawn.jobs?.curDriver is JobDriver_SexBaseReciever)) {
Log.Message("Error: Tried to reroll animations when pawn isn't sexing");
@ -76,7 +76,7 @@ namespace Rimworld_Animations {
pawnsToAnimate = pawnsToAnimate.Append(pawn).ToList();
}
AnimationDef anim = AnimationUtility.tryFindAnimation(ref pawnsToAnimate, sexType);
AnimationDef anim = AnimationUtility.tryFindAnimation(ref pawnsToAnimate, sexType, sexProps);
if (anim != null) {