- 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:
AbstractConcept 2023-02-10 23:31:45 -06:00
parent 003b67fb97
commit e139ff14fb
14 changed files with 60 additions and 29 deletions

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<ModMetaData> <ModMetaData>
<name>Rimworld-Animation Patch</name> <name>Rimworld-Animations Patch</name>
<author>AbstractConcept</author> <author>AbstractConcept</author>
<supportedVersions> <supportedVersions>
<li>1.4</li> <li>1.4</li>

View File

@ -1,3 +1,7 @@
Change log v 2.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
Change log v 2.0.5 Change log v 2.0.5
- Fixed an issue with the orgasm not filling in some circumstances - Fixed an issue with the orgasm not filling in some circumstances
- Fixed a bug with sex overdrive not applying correctly - Fixed a bug with sex overdrive not applying correctly

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Manifest> <Manifest>
<version>2.0.5</version> <version>2.0.6</version>
<downloadUri>https://gitgud.io/AbstractConcept/rimworld-animations-patch</downloadUri> <downloadUri>https://gitgud.io/AbstractConcept/rimworld-animations-patch</downloadUri>
</Manifest> </Manifest>

View File

@ -36,7 +36,7 @@
<rulePack> <rulePack>
<rulesStrings> <rulesStrings>
<li>sent-> [INITIATOR_nameDef] played with [INITIATOR_possessive] breasts.</li> <li>sent-> [INITIATOR_nameDef] played with [INITIATOR_possessive] breasts.</li>
<li>sent-> [INITIATOR_nameDef] tweaked [INITIATOR_possessive] nipples.</li> <li>sent-> [INITIATOR_nameDef] sighed as [INITIATOR_pronoun] tweaked [INITIATOR_possessive] nipples.</li>
</rulesStrings> </rulesStrings>
</rulePack> </rulePack>
</RulePackDef> </RulePackDef>

View File

@ -11,9 +11,11 @@
<chance_for_other_to_join_in_sex_desc>Note that setting this value to its maximum will not guarantee that this event will occur! It just maximises the chance of an invitation being made. All individuals involved must be attracted to / have a good opinion of each other, and the activity must not violate their traits or ideology. Set this value to zero to prevent these events from happening.</chance_for_other_to_join_in_sex_desc> <chance_for_other_to_join_in_sex_desc>Note that setting this value to its maximum will not guarantee that this event will occur! It just maximises the chance of an invitation being made. All individuals involved must be attracted to / have a good opinion of each other, and the activity must not violate their traits or ideology. Set this value to zero to prevent these events from happening.</chance_for_other_to_join_in_sex_desc>
<hide_names_for_sex> Hide names when getting some lovin'</hide_names_for_sex> <hide_names_for_sex> Hide names when getting some lovin'</hide_names_for_sex>
<hide_names_for_sex_desc>May be useful if you find the names of your pawns cover up too much of the action.</hide_names_for_sex_desc> <hide_names_for_sex_desc>May be useful if you find the names of your pawns cover up too much of the action.</hide_names_for_sex_desc>
<debug_mode> Turn on debugging console messages</debug_mode> <debug_mode> Turn on debugging mode with additional console messages</debug_mode>
<debug_mode_desc>Only required for debugging purposes.</debug_mode_desc> <debug_mode_desc>Only required for debugging purposes.</debug_mode_desc>
<use_legacy_animation_system> Use c0ffeeee's animation system</use_legacy_animation_system>
<use_legacy_animation_system_desc>Prevents the patching of c0ffeeee's original animation system - this will cause many features of this mod to stop working. Only to be used for debugging purposes.</use_legacy_animation_system_desc>
<rimworld_animation_patch_animation>Animation Options</rimworld_animation_patch_animation> <rimworld_animation_patch_animation>Animation Options</rimworld_animation_patch_animation>
<autoscale_delta_pos> Auto-scale animation offsets based on body size</autoscale_delta_pos> <autoscale_delta_pos> Auto-scale animation offsets based on body size</autoscale_delta_pos>

View File

@ -85,7 +85,7 @@ namespace Rimworld_Animations_Patch
// Replacement patch for AlienRace to draw the body addons // 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) 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 // Get actor components and body addons
List<AlienPartGenerator.BodyAddon> bodyAddons = alienProps.alienRace.generalSettings.alienPartGenerator.bodyAddons; List<AlienPartGenerator.BodyAddon> bodyAddons = alienProps.alienRace.generalSettings.alienPartGenerator.bodyAddons;
@ -99,8 +99,7 @@ namespace Rimworld_Animations_Patch
{ ApparelAnimationUtility.TryToDrawApparelOnFloor(pawn); } { ApparelAnimationUtility.TryToDrawApparelOnFloor(pawn); }
// Exit clauses // Exit clauses
if (BasicSettings.useLegacyAnimationSystem || AnimationPatchUtility.ShouldNotAnimatePawn(pawn) || sexDataComp == null) if (BasicSettings.useLegacyAnimationSystem || AnimationPatchUtility.ShouldNotAnimatePawn(pawn) || sexDataComp == null) return true;
{ return true; }
// Get available hands // Get available hands
int handsAvailableCount = sexDataComp.GetNumberOfHands(); int handsAvailableCount = sexDataComp.GetNumberOfHands();
@ -146,26 +145,13 @@ namespace Rimworld_Animations_Patch
} }
float combinedAngle = MathUtility.ClampAngle(bodyAngle + bodyAddonAngle); float combinedAngle = MathUtility.ClampAngle(bodyAngle + bodyAddonAngle);
Vector3 bodyAddonPosition = vector + (bodyAddonDatum.alignsWithHead ? headOffset : Vector3.zero) + bodyAddonDatum.GetOffset(apparentRotation).RotatedBy(angle: bodyAngle);
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_;
// Draw the addon if visible // Draw the addon if visible
if (canDraw) if (canDraw)
{ {
addonGraphic.drawSize = AnimationPatchUtility.DetermineDrawSize(pawn, alienComp, bodyAddon, bodyAddonDatum, renderFlags.FlagSet(PawnRenderFlags.Portrait));
GenDraw.DrawMeshNowOrLater(mesh: addonGraphic.MeshAt(rot: apparentRotation), GenDraw.DrawMeshNowOrLater(mesh: addonGraphic.MeshAt(rot: apparentRotation),
loc: bodyAddonPosition, loc: bodyAddonPosition,
quat: Quaternion.AngleAxis(angle: combinedAngle, axis: Vector3.up), quat: Quaternion.AngleAxis(angle: combinedAngle, axis: Vector3.up),

View File

@ -81,7 +81,10 @@ namespace Rimworld_Animations_Patch
listingStandard.CheckboxLabeled("hide_names_for_sex".Translate(), ref BasicSettings.hideNamesForSex, "hide_names_for_sex_desc".Translate()); listingStandard.CheckboxLabeled("hide_names_for_sex".Translate(), ref BasicSettings.hideNamesForSex, "hide_names_for_sex_desc".Translate());
listingStandard.CheckboxLabeled("debug_mode".Translate(), ref BasicSettings.debugMode, "debug_mode_desc".Translate()); listingStandard.CheckboxLabeled("debug_mode".Translate(), ref BasicSettings.debugMode, "debug_mode_desc".Translate());
if (BasicSettings.debugMode)
{ listingStandard.CheckboxLabeled("use_legacy_animation_system".Translate(), ref BasicSettings.useLegacyAnimationSystem, "use_legacy_animation_system_desc".Translate()); }
listingStandard.Gap(10f); listingStandard.Gap(10f);
listingStandard.Label("rimworld_animation_patch_animation".Translate()); listingStandard.Label("rimworld_animation_patch_animation".Translate());
listingStandard.Gap(5f); listingStandard.Gap(5f);

View File

@ -7,6 +7,7 @@ using HarmonyLib;
using Verse; using Verse;
using Rimworld_Animations; using Rimworld_Animations;
using rjw; using rjw;
using AlienRace;
namespace Rimworld_Animations_Patch namespace Rimworld_Animations_Patch
{ {
@ -184,6 +185,34 @@ namespace Rimworld_Animations_Patch
return 1f; return 1f;
} }
public static Vector2 DetermineDrawSize(Pawn pawn, AlienPartGenerator.AlienComp alienComp, AlienPartGenerator.BodyAddon bodyAddon, BodyAddonData bodyAddonData, bool isPortrait)
{
Vector2 drawSize = isPortrait && bodyAddon.drawSizePortrait != Vector2.zero ? bodyAddon.drawSizePortrait : bodyAddon.drawSize;
if (bodyAddon.scaleWithPawnDrawsize)
{
if (isPortrait && bodyAddonData.alignsWithHead)
{ drawSize *= alienComp.customPortraitHeadDrawSize; }
else if (bodyAddonData.alignsWithHead)
{ drawSize *= alienComp.customHeadDrawSize; }
else if (isPortrait)
{ drawSize *= alienComp.customPortraitDrawSize; }
else
{ drawSize *= alienComp.customDrawSize; }
}
if (ModsConfig.BiotechActive)
{ drawSize *= pawn.ageTracker.CurLifeStage.bodyWidth ?? 1.5f; }
else
{ drawSize *= 1.5f; }
return drawSize;
}
private static Dictionary<string, Vector3> raceSpecificChildMultipliers = new Dictionary<string, Vector3>() private static Dictionary<string, Vector3> raceSpecificChildMultipliers = new Dictionary<string, Vector3>()
{ {
{ "Alien_Orassan", new Vector3(1.4f, 1.4f, 1.4f) }, { "Alien_Orassan", new Vector3(1.4f, 1.4f, 1.4f) },

View File

@ -70,6 +70,16 @@ namespace Rimworld_Animations_Patch
return false; return false;
} }
public static RJWPreferenceSettings.Clothing GetClothingPreference(Pawn pawn)
{
var clothingPreference = pawn.IsInBed(out Building bed) ? RJWPreferenceSettings.sex_wear : ApparelSettings.apparelWornForQuickies;
if (xxx.has_quirk(pawn, "Endytophile"))
{ clothingPreference = RJWPreferenceSettings.Clothing.Clothed; }
return clothingPreference;
}
public static void DetermineApparelToKeepOn(Pawn pawn) public static void DetermineApparelToKeepOn(Pawn pawn)
{ {
if (pawn?.apparel?.WornApparel == null) return; if (pawn?.apparel?.WornApparel == null) return;
@ -81,10 +91,7 @@ namespace Rimworld_Animations_Patch
} }
ActorAnimationData animData = pawn.GetAnimationData(); ActorAnimationData animData = pawn.GetAnimationData();
var clothingPreference = pawn.IsInBed(out Building bed) ? RJWPreferenceSettings.sex_wear : ApparelSettings.apparelWornForQuickies; var clothingPreference = GetClothingPreference(pawn);
if (xxx.has_quirk(pawn, "Endytophile"))
{ clothingPreference = RJWPreferenceSettings.Clothing.Clothed; }
// Get naked for rituals and parties // Get naked for rituals and parties
bool undressForRitual = pawn.GetLord() != null && pawn.GetLord().LordJob is LordJob_Ritual; bool undressForRitual = pawn.GetLord() != null && pawn.GetLord().LordJob is LordJob_Ritual;