Ejemplo n.º 1
0
        public override AcceptanceReport CanDesignateCell(IntVec3 c)
        {
            if (!c.InBounds())
            {
                return("OutOfBounds".Translate());
            }
            if (c.Fogged())
            {
                return("CannotPlaceInUndiscovered".Translate());
            }
            if (Find.DesignationManager.DesignationAt(c, SmoothWall.designationDef) != null)
            {
                return("TerrainBeingSmoothed".Translate());
            }
            // Must be mineable
            Thing mineable = MineUtility.MineableInCell(c);

            if (mineable == null)
            {
                return("MessageMustDesignateMineable".Translate());
            }
            // Must have associated stone blocks
            string   blocksDef   = "Blocks" + mineable.def.defName;
            ThingDef stoneBlocks = DefDatabase <ThingDef> .GetNamed(blocksDef, false);

            if (stoneBlocks == null)
            {
                return("MessageMustDesignateMineable".Translate());
            }
            return(AcceptanceReport.WasAccepted);
        }
Ejemplo n.º 2
0
		public override void DesignateSingleCell( IntVec3 c )
		{
			if( Find.DesignationManager.DesignationAt( c, DesignationDefOf.Mine ) != null )
				return;
			Thing mineable = MineUtility.MineableInCell( c );
			if( ( mineable == null )||( !mineable.def.building.isResourceRock ) )
				return;
			Find.DesignationManager.AddDesignation( new Designation( c, DesignationDefOf.Mine ) );
			MineAdjacentCellsAt( c );
		}
Ejemplo n.º 3
0
		public override AcceptanceReport CanDesignateCell( IntVec3 c )
		{
			if( !c.InBounds() )
				return "OutOfBounds".Translate();
			if( c.Fogged() )
				return "CannotPlaceInUndiscovered".Translate();
			if( Find.DesignationManager.DesignationAt( c, DesignationDefOf.Mine ) != null )
				return "SpaceAlreadyOccupied".Translate();
			Thing mineable = MineUtility.MineableInCell( c );
			if( ( mineable == null )||( !mineable.def.building.isResourceRock ) )
				return "MessageMustDesignateMineable".Translate();
			return AcceptanceReport.WasAccepted;
		}
Ejemplo n.º 4
0
		private void MineAdjacentCellsAt( IntVec3 at )
		{
			// Simple recursive function to designate all valid neighbouring cells
			//foreach( IntVec3 c in GenAdjFast.AdjacentCells8Way( ( TargetInfo )at ) )  //<-- Fails to report all cells???
			foreach( IntVec3 c in GenAdj.CellsAdjacent8Way( ( TargetInfo )at ) )
			{
				if( ( c.InBounds() )&&( Find.DesignationManager.DesignationAt( c, DesignationDefOf.Mine ) == null ) )
				{
					Thing mineable = MineUtility.MineableInCell( c );
					if( ( mineable != null )&&( mineable.def.building.isResourceRock ) )
					{
						Find.DesignationManager.AddDesignation( new Designation( c, DesignationDefOf.Mine) );
						MineAdjacentCellsAt( c );
					}
				}
			}
		}
Ejemplo n.º 5
0
        public override void DesignateSingleCell(IntVec3 c)
        {
            Thing mineable = MineUtility.MineableInCell(c);

            // Must be mineable
            if (mineable != null)
            {
                // Must have associated stone blocks
                string   blocksDef   = "Blocks" + mineable.def.defName;
                ThingDef stoneBlocks = DefDatabase <ThingDef> .GetNamed(blocksDef, false);

                if (stoneBlocks != null)
                {
                    if (Find.DesignationManager.DesignationAt(c, SmoothWall.designationDef) == null)
                    {
                        Find.DesignationManager.AddDesignation(new Designation(c, SmoothWall.designationDef));
                    }
                }
            }
        }
Ejemplo n.º 6
0
        public void FindAvailableVeins(Pawn pawn)
        {
            // find all veins designated to be mined
            availableVeins = Find.DesignationManager.DesignationsOfDef(DesignationDefOf.Mine).Select(designation => MineUtility.MineableInCell(designation.target.Cell));

            // needed to avoid null references if availableVeins == 0
            if (availableVeins.Count() > 0)
            {
                // could be reserved and reached
                availableVeins = availableVeins.Where(vein => pawn.CanReserveAndReach(vein, PathEndMode.Touch, pawn.NormalMaxDanger()));
            }
        }