mirror of
https://gitgud.io/AbstractConcept/rimworld-animations-patch.git
synced 2024-08-15 00:43:27 +00:00
v2.0.6
- Fixed an issue where body addons with custom sizes were not scaling correctly - Added additional debugging option which disables the patching of c0ffeeee's animation system - to be used to assist in determining if bugs or other issues are related to this patching
This commit is contained in:
parent
003b67fb97
commit
e139ff14fb
14 changed files with 60 additions and 29 deletions
|
@ -85,7 +85,7 @@ namespace Rimworld_Animations_Patch
|
|||
// Replacement patch for AlienRace to draw the body addons
|
||||
public static bool Prefix_DrawAddons(PawnRenderFlags renderFlags, Vector3 vector, Vector3 headOffset, Pawn pawn, Quaternion quat, Rot4 rotation)
|
||||
{
|
||||
if (!(pawn.def is ThingDef_AlienRace alienProps) || renderFlags.FlagSet(PawnRenderFlags.Invisible)) return false;
|
||||
if (!(pawn.def is ThingDef_AlienRace alienProps) || renderFlags.FlagSet(PawnRenderFlags.Invisible)) return true;
|
||||
|
||||
// Get actor components and body addons
|
||||
List<AlienPartGenerator.BodyAddon> bodyAddons = alienProps.alienRace.generalSettings.alienPartGenerator.bodyAddons;
|
||||
|
@ -99,8 +99,7 @@ namespace Rimworld_Animations_Patch
|
|||
{ ApparelAnimationUtility.TryToDrawApparelOnFloor(pawn); }
|
||||
|
||||
// Exit clauses
|
||||
if (BasicSettings.useLegacyAnimationSystem || AnimationPatchUtility.ShouldNotAnimatePawn(pawn) || sexDataComp == null)
|
||||
{ return true; }
|
||||
if (BasicSettings.useLegacyAnimationSystem || AnimationPatchUtility.ShouldNotAnimatePawn(pawn) || sexDataComp == null) return true;
|
||||
|
||||
// Get available hands
|
||||
int handsAvailableCount = sexDataComp.GetNumberOfHands();
|
||||
|
@ -146,26 +145,13 @@ namespace Rimworld_Animations_Patch
|
|||
}
|
||||
|
||||
float combinedAngle = MathUtility.ClampAngle(bodyAngle + bodyAddonAngle);
|
||||
|
||||
Vector3 vector_ = vector;
|
||||
Vector3 headOffset_ = bodyAddonDatum.alignsWithHead ? headOffset : Vector3.zero;
|
||||
Vector3 bodyAddonOffset_ = bodyAddonDatum.GetOffset(apparentRotation).RotatedBy(angle: bodyAngle);
|
||||
|
||||
if (pawn.ageTracker.Adult == false)
|
||||
{
|
||||
float bodySize = AnimationPatchUtility.GetBodySize(pawn);
|
||||
addonGraphic.drawSize = new Vector2(1.5f * bodySize, 1.5f * bodySize); // Doesn't seem to be a need to scale by body part draw size (re: Orassians)
|
||||
|
||||
Vector2 multi = AnimationPatchUtility.GetRaceSpecificOffsetMultipliers(pawn, bodyAddon.bodyPart);
|
||||
bodyAddonOffset_.x *= bodySize * multi.x;
|
||||
bodyAddonOffset_.z *= bodySize * multi.y;
|
||||
}
|
||||
|
||||
Vector3 bodyAddonPosition = vector_ + headOffset_ + bodyAddonOffset_;
|
||||
Vector3 bodyAddonPosition = vector + (bodyAddonDatum.alignsWithHead ? headOffset : Vector3.zero) + bodyAddonDatum.GetOffset(apparentRotation).RotatedBy(angle: bodyAngle);
|
||||
|
||||
// Draw the addon if visible
|
||||
if (canDraw)
|
||||
{
|
||||
addonGraphic.drawSize = AnimationPatchUtility.DetermineDrawSize(pawn, alienComp, bodyAddon, bodyAddonDatum, renderFlags.FlagSet(PawnRenderFlags.Portrait));
|
||||
|
||||
GenDraw.DrawMeshNowOrLater(mesh: addonGraphic.MeshAt(rot: apparentRotation),
|
||||
loc: bodyAddonPosition,
|
||||
quat: Quaternion.AngleAxis(angle: combinedAngle, axis: Vector3.up),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue