tweaks
This commit is contained in:
parent
bf8570287a
commit
a3f53f79fe
Binary file not shown.
|
@ -17,7 +17,7 @@ namespace Rimworld_Animations {
|
||||||
public PawnGraphicSet Graphics;
|
public PawnGraphicSet Graphics;
|
||||||
|
|
||||||
//public CompProperties_BodyAnimator Props => (CompProperties_BodyAnimator)(object)base.props;
|
//public CompProperties_BodyAnimator Props => (CompProperties_BodyAnimator)(object)base.props;
|
||||||
|
string bodyTypeDef;
|
||||||
public bool isAnimating {
|
public bool isAnimating {
|
||||||
get {
|
get {
|
||||||
return Animating;
|
return Animating;
|
||||||
|
@ -114,6 +114,8 @@ namespace Rimworld_Animations {
|
||||||
}
|
}
|
||||||
public void StartAnimation(AnimationDef anim, List<Pawn> actors, int actor, bool mirror = false, bool shiver = false, bool fastAnimForQuickie = false) {
|
public void StartAnimation(AnimationDef anim, List<Pawn> actors, int actor, bool mirror = false, bool shiver = false, bool fastAnimForQuickie = false) {
|
||||||
|
|
||||||
|
bodyTypeDef = (pawn.story?.bodyType != null) ? pawn.story.bodyType.ToString() : "";
|
||||||
|
|
||||||
actorsInCurrentAnimation = actors;
|
actorsInCurrentAnimation = actors;
|
||||||
|
|
||||||
if (anim.actors.Count <= actor)
|
if (anim.actors.Count <= actor)
|
||||||
|
@ -352,46 +354,60 @@ namespace Rimworld_Animations {
|
||||||
|
|
||||||
public void calculateDrawValues() {
|
public void calculateDrawValues() {
|
||||||
|
|
||||||
/*if(Find.TickManager.TickRateMultiplier > 1 && (lastDrawFrame + 1 >= RealTime.frameCount || RealTime.deltaTime < 0.05f)) {
|
|
||||||
return;
|
deltaPos.y = clip.layer.AltitudeFor();
|
||||||
}*/
|
|
||||||
|
|
||||||
deltaPos = new Vector3(clip.BodyOffsetX.Evaluate(clipPercent) * (mirror ? -1 : 1), clip.layer.AltitudeFor(), clip.BodyOffsetZ.Evaluate(clipPercent));
|
bool adjustOffsetX = false, adjustOffsetZ = false, adjustBodyAngle = false, adjustHeadAngle = false, adjustGenitalAngle = false;
|
||||||
|
if(clip.BodyOffsetX.Any())
|
||||||
string bodyTypeDef = (pawn.story?.bodyType != null) ? pawn.story.bodyType.ToString() : "";
|
{
|
||||||
|
deltaPos.x = clip.BodyOffsetX.Evaluate(clipPercent) * (mirror ? -1 : 1);
|
||||||
if (AnimationSettings.offsets != null && AnimationSettings.offsets.ContainsKey(CurrentAnimation.defName + pawn.def.defName + bodyTypeDef + ActorIndex)) {
|
adjustOffsetX = true;
|
||||||
deltaPos.x += AnimationSettings.offsets[CurrentAnimation.defName + pawn.def.defName + bodyTypeDef + ActorIndex].x * (mirror ? -1 : 1);
|
}
|
||||||
deltaPos.z += AnimationSettings.offsets[CurrentAnimation.defName + pawn.def.defName + bodyTypeDef + ActorIndex].y;
|
if(clip.BodyOffsetZ.Any())
|
||||||
|
{
|
||||||
|
deltaPos.z = clip.BodyOffsetZ.Evaluate(clipPercent);
|
||||||
|
adjustOffsetZ = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bodyAngle = (clip.BodyAngle.Evaluate(clipPercent) + (quiver || shiver ? ((Rand.Value * AnimationSettings.shiverIntensity) - (AnimationSettings.shiverIntensity / 2f)) : 0f)) * (mirror ? -1 : 1);
|
if (AnimationSettings.offsets != null && AnimationSettings.offsets.ContainsKey(CurrentAnimation.defName + pawn.def.defName + bodyTypeDef + ActorIndex)) {
|
||||||
headAngle = clip.HeadAngle.Evaluate(clipPercent) * (mirror ? -1 : 1);
|
if(adjustOffsetX)
|
||||||
|
deltaPos.x += AnimationSettings.offsets[CurrentAnimation.defName + pawn.def.defName + bodyTypeDef + ActorIndex].x * (mirror ? -1 : 1);
|
||||||
|
|
||||||
if (controlGenitalAngle) {
|
if(adjustOffsetZ)
|
||||||
|
deltaPos.z += AnimationSettings.offsets[CurrentAnimation.defName + pawn.def.defName + bodyTypeDef + ActorIndex].y;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(clip.BodyAngle.Any())
|
||||||
|
{
|
||||||
|
adjustBodyAngle = true;
|
||||||
|
bodyAngle = (clip.BodyAngle.Evaluate(clipPercent) + (quiver || shiver ? ((Rand.Value * AnimationSettings.shiverIntensity) - (AnimationSettings.shiverIntensity / 2f)) : 0f)) * (mirror ? -1 : 1);
|
||||||
|
}
|
||||||
|
if(clip.HeadAngle.Any())
|
||||||
|
{
|
||||||
|
adjustHeadAngle = true;
|
||||||
|
headAngle = clip.HeadAngle.Evaluate(clipPercent) * (mirror ? -1 : 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (controlGenitalAngle && clip.GenitalAngle.Any()) {
|
||||||
|
|
||||||
|
adjustGenitalAngle = true;
|
||||||
genitalAngle = clip.GenitalAngle.Evaluate(clipPercent) * (mirror ? -1 : 1);
|
genitalAngle = clip.GenitalAngle.Evaluate(clipPercent) * (mirror ? -1 : 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (AnimationSettings.rotation != null && AnimationSettings.rotation.ContainsKey(CurrentAnimation.defName + pawn.def.defName + bodyTypeDef + ActorIndex)) {
|
if (AnimationSettings.rotation != null && AnimationSettings.rotation.ContainsKey(CurrentAnimation.defName + pawn.def.defName + bodyTypeDef + ActorIndex)) {
|
||||||
float offsetRotation = AnimationSettings.rotation[CurrentAnimation.defName + pawn.def.defName + bodyTypeDef + ActorIndex] * (Mirror ? -1 : 1);
|
float offsetRotation = AnimationSettings.rotation[CurrentAnimation.defName + pawn.def.defName + bodyTypeDef + ActorIndex] * (Mirror ? -1 : 1);
|
||||||
genitalAngle += offsetRotation;
|
if (adjustGenitalAngle) genitalAngle += offsetRotation;
|
||||||
bodyAngle += offsetRotation;
|
if (adjustBodyAngle) bodyAngle += offsetRotation;
|
||||||
headAngle += offsetRotation;
|
if (adjustHeadAngle) headAngle += offsetRotation;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//don't go past 360 or less than 0
|
//don't go past 360 or less than 0
|
||||||
|
AnimationUtility.Clamp0to360(ref bodyAngle);
|
||||||
if (bodyAngle < 0) bodyAngle = 360 - ((-1f*bodyAngle) % 360);
|
AnimationUtility.Clamp0to360(ref headAngle);
|
||||||
if (bodyAngle > 360) bodyAngle %= 360;
|
AnimationUtility.Clamp0to360(ref genitalAngle);
|
||||||
|
|
||||||
|
|
||||||
if (headAngle < 0) headAngle = 360 - ((-1f * headAngle) % 360);
|
|
||||||
if (headAngle > 360) headAngle %= 360;
|
|
||||||
|
|
||||||
if (genitalAngle < 0) genitalAngle = 360 - ((-1f * genitalAngle) % 360);
|
|
||||||
if (genitalAngle > 360) genitalAngle %= 360;
|
|
||||||
|
|
||||||
|
|
||||||
bodyFacing = mirror ? new Rot4((int)clip.BodyFacing.Evaluate(clipPercent)).Opposite : new Rot4((int)clip.BodyFacing.Evaluate(clipPercent));
|
bodyFacing = mirror ? new Rot4((int)clip.BodyFacing.Evaluate(clipPercent)).Opposite : new Rot4((int)clip.BodyFacing.Evaluate(clipPercent));
|
||||||
|
@ -409,8 +425,6 @@ namespace Rimworld_Animations {
|
||||||
Vector2 bodyScale = (pawn.story?.bodyType?.bodyGraphicScale != null ? pawn.story.bodyType.bodyGraphicScale : Vector2.one);
|
Vector2 bodyScale = (pawn.story?.bodyType?.bodyGraphicScale != null ? pawn.story.bodyType.bodyGraphicScale : Vector2.one);
|
||||||
headBob.z *= bodyScale.x;
|
headBob.z *= bodyScale.x;
|
||||||
|
|
||||||
lastDrawFrame = RealTime.frameCount;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Vector3 getPawnHeadPosition() {
|
public Vector3 getPawnHeadPosition() {
|
||||||
|
|
|
@ -23,9 +23,11 @@ namespace Rimworld_Animations {
|
||||||
InteractionWithExtension interaction = InteractionHelper.GetWithExtension(sexProps.dictionaryKey);
|
InteractionWithExtension interaction = InteractionHelper.GetWithExtension(sexProps.dictionaryKey);
|
||||||
|
|
||||||
participants =
|
participants =
|
||||||
participants.OrderBy(p =>
|
participants.OrderBy(p =>
|
||||||
p.jobs.curDriver is rjw.JobDriver_Sex
|
p.jobs.curDriver is rjw.JobDriver_Sex &&
|
||||||
&& !(p.jobs.curDriver as rjw.JobDriver_Sex).Sexprops.isReceiver)
|
((p.jobs.curDriver as rjw.JobDriver_Sex).Sexprops.dictionaryKey.defName.ToLower().Contains("reverse") ?
|
||||||
|
(p.jobs.curDriver as rjw.JobDriver_Sex).Sexprops.isReceiver :
|
||||||
|
!(p.jobs.curDriver as rjw.JobDriver_Sex).Sexprops.isReceiver))
|
||||||
.OrderBy(p => rjw.xxx.can_fuck(p))
|
.OrderBy(p => rjw.xxx.can_fuck(p))
|
||||||
.ToList();
|
.ToList();
|
||||||
|
|
||||||
|
@ -322,5 +324,13 @@ namespace Rimworld_Animations {
|
||||||
|
|
||||||
return regularPos;
|
return regularPos;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void Clamp0to360(ref float angle)
|
||||||
|
{
|
||||||
|
|
||||||
|
if (angle < 0) angle = 360 - ((-1f * angle) % 360);
|
||||||
|
if (angle > 360) angle %= 360;
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue