Beispiel #1
0
        private float GetInteractionWeight(Pawn initiator, Pawn recipient, Filter <PawnRelationDef> relationRestriction,
                                           bool mustBeColonist)
        {
            Pawn oHuman = FormerHumanUtilities.GetOriginalPawnOfFormerHuman(recipient);

            if (relationRestriction != null) //check any relationships if applicable
            {
                if (oHuman == null)
                {
                    if (mustBeColonist)
                    {
                        return(0);                //if there is no original pawn they can't be a colonist
                    }
                    if (!relationRestriction.isBlackList)
                    {
                        return
                            (0); //if the filter is a white list a blank original pawn can't pass it because there is no relationship
                    }
                    return(BaseInteractionChance);
                }


                foreach (PawnRelationDef pawnRelationDef in initiator.GetRelations(oHuman))
                {
                    if (relationRestriction.PassesFilter(pawnRelationDef))
                    {
                        return(BaseInteractionChance);
                    }
                }

                return(0); //none passed
            }

            return(BaseInteractionChance);
        }