mirror of
				https://github.com/vegapnk/RJW-Genes.git
				synced 2024-08-15 00:23:31 +00:00 
			
		
		
		
	Put Licentia Parts back in, but commented out so I dont forget
This commit is contained in:
		
							parent
							
								
									90653ddc9e
								
							
						
					
					
						commit
						ee2be0375c
					
				
					 5 changed files with 105 additions and 4 deletions
				
			
		
							
								
								
									
										32
									
								
								Source/Common/Helpers/MapUtility.cs
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										32
									
								
								Source/Common/Helpers/MapUtility.cs
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,32 @@
 | 
			
		|||
using System;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using System.Linq;
 | 
			
		||||
using Verse;
 | 
			
		||||
 | 
			
		||||
namespace RJW_Genes
 | 
			
		||||
{
 | 
			
		||||
    public class MapUtility
 | 
			
		||||
    {
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// Checks if the pawn is on the players home map. 
 | 
			
		||||
        /// 
 | 
			
		||||
        /// Reason is that drones should only be punished for absence of queen if they are on the map and there is no queen.
 | 
			
		||||
        /// If they are on a mission, transport-pod etc. they should not get boni or mali. 
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        /// <param name="pawn">The pawn for which to check map-presence.</param>
 | 
			
		||||
        /// <returns>True if the pawn is on the home-map, False otherwise.</returns>
 | 
			
		||||
        public static bool PawnIsOnHomeMap(Pawn pawn)
 | 
			
		||||
        {
 | 
			
		||||
            if (Find.Maps.NullOrEmpty() || !Find.Maps.Where(mapCandidate => mapCandidate.IsPlayerHome).Any())
 | 
			
		||||
            {
 | 
			
		||||
                return false;
 | 
			
		||||
            }
 | 
			
		||||
            Map homeMap = Find.Maps.Where(mapCandidate => mapCandidate.IsPlayerHome).First();
 | 
			
		||||
            return
 | 
			
		||||
                homeMap != null && pawn != null
 | 
			
		||||
                && pawn.Spawned
 | 
			
		||||
                && pawn.Map == homeMap;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue