tweaks to handling of animation context

This commit is contained in:
Platinum 2020-06-02 13:20:38 -07:00
parent 6ebd521519
commit 4adc4a6906
6 changed files with 301 additions and 287 deletions

View file

@ -19,23 +19,26 @@ namespace Rimworld_Animations {
//aggressors last
participants = participants.OrderBy(p => p.jobs.curDriver is rjw.JobDriver_SexBaseInitiator).ToList();
//fucked first, fucking second
participants = participants.OrderBy(p => rjw.xxx.can_fuck(p)).ToList();
if(rjw.RJWPreferenceSettings.Malesex == rjw.RJWPreferenceSettings.AllowedSex.Nohomo) {
participants = participants.OrderBy(x => rjw.xxx.is_male(x)).ToList();
}
//animal anims don't matter who is initiator
participants = participants.OrderBy(p => rjw.xxx.is_animal(p)).ToList();
List<Pawn> localParticipants = new List<Pawn>(participants);
IEnumerable<AnimationDef> options = DefDatabase<AnimationDef>.AllDefs.Where((AnimationDef x) => {
if (x.actors.Count != localParticipants.Count) {
return false;
}
for (int i = 0; i < x.actors.Count; i++) {
if((x.actors[i].blacklistedRaces != null) && x.actors[i].blacklistedRaces.Contains(localParticipants[i].def.defName)) {
if (rjw.RJWPreferenceSettings.Malesex == rjw.RJWPreferenceSettings.AllowedSex.Nohomo) {
if (rjw.xxx.is_male(localParticipants[i]) && x.actors[i].isFucked) {
return false;
}
}
if ((x.actors[i].blacklistedRaces != null) && x.actors[i].blacklistedRaces.Contains(localParticipants[i].def.defName)) {
if (rjw.RJWSettings.DevMode) {
Log.Message(x.defName.ToStringSafe() + " not selected -- " + localParticipants[i].def.defName.ToStringSafe() + " " + localParticipants[i].Name.ToStringSafe() + " is blacklisted");
}

View file

@ -38,6 +38,8 @@ namespace Rimworld_Animations {
private bool mirror = false, quiver = false, shiver = false;
private int actor;
private int lastDrawFrame = -1;
private int animTicks = 0, stageTicks = 0, clipTicks = 0;
private int curStage = 0;
private float clipPercent = 0;
@ -259,6 +261,10 @@ namespace Rimworld_Animations {
public void calculateDrawValues() {
if(Find.TickManager.TickRateMultiplier > 1 && (lastDrawFrame + 1 >= RealTime.frameCount || RealTime.deltaTime < 0.05f)) {
return;
}
deltaPos = new Vector3(clip.BodyOffsetX.Evaluate(clipPercent) * (mirror ? -1 : 1), clip.layer.AltitudeFor(), clip.BodyOffsetZ.Evaluate(clipPercent));
if (AnimationSettings.offsets != null && AnimationSettings.offsets.ContainsKey(CurrentAnimation.defName + pawn.def.defName + ActorIndex)) {
@ -307,6 +313,8 @@ namespace Rimworld_Animations {
}
headBob = new Vector3(0, 0, clip.HeadBob.Evaluate(clipPercent));
lastDrawFrame = RealTime.frameCount;
}
public Vector3 getPawnHeadPosition() {

View file

@ -77,10 +77,8 @@ namespace Rimworld_Animations {
Vector2 bodyOffset = (portrait ? offset?.portraitBodyTypes ?? offset?.bodyTypes : offset?.bodyTypes)?.FirstOrDefault(predicate: to => to.bodyType == pawn.story.bodyType)
?.offset ?? Vector2.zero;
Vector2 crownOffset = (portrait ? offset?.portraitCrownTypes ?? offset?.crownTypes : offset?.crownTypes)?.FirstOrDefault(predicate: to => to.crownType == alienComp.crownType)
?.offset ?? Vector2.zero;
Vector2 bodyOffset = ((!portrait) ? offset?.bodyTypes : (offset?.portraitBodyTypes ?? offset?.bodyTypes))?.FirstOrDefault((AlienPartGenerator.BodyTypeOffset to) => to.bodyType == pawn.story.bodyType)?.offset ?? Vector2.zero;
Vector2 crownOffset = ((!portrait) ? offset?.crownTypes : (offset?.portraitCrownTypes ?? offset?.crownTypes))?.FirstOrDefault((AlienPartGenerator.CrownTypeOffset to) => to.crownType == alienComp.crownType)?.offset ?? Vector2.zero;
//Defaults for tails
//south 0.42f, -0.3f, -0.22f