emipa606 / GradualRomance

A relationship mod for Rimworld
MIT License
1 stars 1 forks source link

Only calc modded secondary factors for humanlikes. #4

Closed thailyn closed 10 months ago

thailyn commented 10 months ago

This mod has additional computations for secondary lovin' and romance chance factors. Previously, these values were computed for any pawn in regards to any other pawn. This change makes it only perform these computations between two humanlike pawns. Non-humanlike pawns, such as animals, are missing some of the components used in these computations, leading to errors.

This is a bit of a "heavy handed" fix, as it just prevents this mod from performing those calculations when one or more of the pawns are non-humanlike. The individual AttractionCalculator classes that are throwing errors can also be updated to be more robust. However, this PR is a straightforward way to prevent errors being thrown when mousing over the relevant items in a pawn's social, and we aren't losing anything by not having these full calculations between a pawn and and animal or two animals.

Fixes #3.

emipa606 commented 10 months ago

Good catch, I made a slight change by moving the humanoid-checks to the CalculateAttraction-method in the AttractionUtility class instead to make it include other calls to that method. https://github.com/emipa606/GradualRomance/blob/49ef8eaa663037ddafdd75ee2d45bbbb646ba508/Source/Gradual%20Romance/AttractionUtility.cs#L745-L750