예제 #1
0
        public static void DebugDrawPredatorFoodSource()
        {
            Pawn pawn = Find.Selector.SingleSelectedThing as Pawn;

            if (pawn != null && TryFindBestFoodSourceFor(pawn, pawn, desperate: true, out Thing foodSource, out ThingDef _, canRefillDispenser: false, canUseInventory: false))
            {
                GenDraw.DrawLineBetween(pawn.Position.ToVector3Shifted(), foodSource.Position.ToVector3Shifted());
                if (!(foodSource is Pawn))
                {
                    Pawn pawn2 = BestPawnToHuntForPredator(pawn, forceScanWholeMap: true);
                    if (pawn2 != null)
                    {
                        GenDraw.DrawLineBetween(pawn.Position.ToVector3Shifted(), pawn2.Position.ToVector3Shifted());
                    }
                }
            }
        }
예제 #2
0
 public override void PostDrawExtraSelectionOverlays()
 {
     if (!this.IsOperated && Building == null)
     {
         return;
     }
     if (Building != null)
     {
         float range = this.AttackVerb.verbProps.range;
         if (range < 90f)
         {
             GenDraw.DrawRadiusRing(Operator.Position, range);
         }
         float num = this.AttackVerb.verbProps.EffectiveMinRange(true);
         if (num < 90f && num > 0.1f)
         {
             GenDraw.DrawRadiusRing(Operator.Position, num);
         }
     }
     if (this.WarmingUp && GenSight.LineOfSight(Operator.Position, this.CurrentTarget.Cell, this.Operator.Map, true, null, 0, 0))
     {
         int degreesWide = (int)((float)this.burstWarmupTicksLeft * 0.5f);
         DrawAimPie(Operator, this.CurrentTarget, degreesWide, (float)Props.TurretDef.size.x * 0.5f);
     }
     if (this.burstCooldownTicksLeft > 0)
     {
         GenDraw.DrawCooldownCircle(TurretPos, Mathf.Min(0.5f, (float)this.burstCooldownTicksLeft * 0.002f));
     }
     if (this.forcedTarget.IsValid && (!this.forcedTarget.HasThing || this.forcedTarget.Thing.Spawned))
     {
         Vector3 vector;
         if (this.forcedTarget.HasThing)
         {
             vector = this.forcedTarget.Thing.TrueCenter();
         }
         else
         {
             vector = this.forcedTarget.Cell.ToVector3Shifted();
         }
         Vector3 a = TurretPos;
         vector.y = AltitudeLayer.MetaOverlays.AltitudeFor();
         a.y      = vector.y;
         GenDraw.DrawLineBetween(a, vector, CompTurretGun.ForcedTargetLineMat);
     }
 }
예제 #3
0
 public static void SelectedUpdate(this Designator_Place @this)
 {
     GenDraw.DrawNoBuildEdgeLines();
     if (!ArchitectCategoryTab.InfoRect.Contains(UI.MousePositionOnUIInverted))
     {
         IntVec3 intVec = UI.MouseCell();
         if (@this.PlacingDef is TerrainDef)
         {
             GenUI.RenderMouseoverBracket();
             return;
         }
         Color ghostCol;
         if (@this.CanDesignateCell(intVec).Accepted)
         {
             ghostCol = new Color(0.5f, 1f, 0.6f, 0.4f);
         }
         else
         {
             ghostCol = new Color(1f, 0f, 0f, 0.4f);
         }
         DrawGhost(@this, ghostCol);
         if (@this.CanDesignateCell(intVec).Accepted&& @this.PlacingDef.specialDisplayRadius > 0.01f)
         {
             GenDraw.DrawRadiusRing(UI.MouseCell(), @this.PlacingDef.specialDisplayRadius);
             if ((@this.PlacingDef as ThingDef)?.building?.turretGunDef?.Verbs?.FirstOrDefault()?.requireLineOfSight == true)
             {
                 var   map   = Find.VisibleMap;
                 float range = ((ThingDef)@this.PlacingDef).building.turretGunDef.Verbs[0].range;
                 foreach (var cell in GenRadial.RadialCellsAround(intVec, range, false))
                 {
                     if (GenSight.LineOfSight(intVec, cell, map, true) != GenSight.LineOfSight(cell, intVec, map, true))
                     {
                         CellRenderer.RenderCell(cell, 0f);
                     }
                     if (GenSight.LineOfSight(intVec, cell, map, true))
                     {
                         CellRenderer.RenderCell(cell, 0.6f);
                         continue;
                     }
                 }
             }
         }
         GenDraw.DrawInteractionCell((ThingDef)@this.PlacingDef, intVec, placingRotGet(@this));
     }
 }
예제 #4
0
        // Working under the assumption that
        //  A. The rendering function will always be single threaded (if not this needs to be an array of threadID length)
        //  B. A single pawn will never have more than 16 headlayers at once (this number could be decreased... but what would it change?)

        private static void DrawHeadApparel(PawnRenderer renderer, Mesh mesh, Vector3 rootLoc, Vector3 headLoc, Vector3 headOffset, Rot4 bodyFacing, Quaternion quaternion, bool portrait, ref bool hideHair)
        {
            var apparelGraphics = renderer.graphics.apparelGraphics;
            var headwearSize    = 0;
            int i = 0;

            // Using a manual loop without a List or an Array prevents allocation or MoveNext() functions being called, especially since this array should normally be quite small.
            for (i = 0; i < apparelGraphics.Count; i++)
            {
                if (apparelGraphics[i].sourceApparel.def.apparel.LastLayer.GetModExtension <ApparelLayerExtension>()?.IsHeadwear ?? false)
                {
                    headwearGraphics[headwearSize++] = i; // Store index to apparelrecord instead of the actual apparel
                }
            }

            if (headwearSize == 0)
            {
                return;
            }

            var interval    = YOffsetIntervalClothes / headwearSize;
            var headwearPos = headLoc;

            for (i = 0; i < headwearSize; i++)
            {
                var apparelRecord = apparelGraphics[headwearGraphics[i]]; // originalArray[indexWeFoundApparelRecordAt]

                if (!apparelRecord.sourceApparel.def.apparel.hatRenderedFrontOfFace)
                {
                    headwearPos.y += interval;
                    hideHair       = true;
                    var apparelMat = apparelRecord.graphic.MatAt(bodyFacing);
                    apparelMat = renderer.graphics.flasher.GetDamagedMat(apparelMat);
                    GenDraw.DrawMeshNowOrLater(mesh, headwearPos, quaternion, apparelMat, portrait);
                }
                else
                {
                    var maskMat = apparelRecord.graphic.MatAt(bodyFacing);
                    maskMat = renderer.graphics.flasher.GetDamagedMat(maskMat);
                    var maskLoc = rootLoc + headOffset;
                    maskLoc.y += !(bodyFacing == north) ? YOffsetPostHead : YOffsetBehind;
                    GenDraw.DrawMeshNowOrLater(mesh, maskLoc, quaternion, maskMat, portrait);
                }
            }
        }
 public override void DrawExtraSelectionOverlays()
 {
     if (powerComp == null || !powerComp.PowerOn)
     {
         return;
     }
     base.DrawExtraSelectionOverlays();
     isSelected = true;
     GenDraw.DrawFieldEdges(drawnCells);
     for (int i = 0; i < trackedPawns.Count; i++)
     {
         if (trackedPawns == null)
         {
             continue;
         }
         GenDraw.DrawCooldownCircle(trackedPawns[i].DrawPos - Altitudes.AltIncVect, .5f);
     }
 }
예제 #6
0
        public override void DrawGhost(ThingDef def, IntVec3 center, Rot4 rot, Color ghostCol, Thing thing = null)
        {
            Map map = Find.CurrentMap;
            var ext = def.GetModExtension <ModExtension_WorkIORange>();

            if (ext == null || ext.InputCellResolver == null)
            {
                Debug.LogWarning("inputCellResolver not found.");
                return;
            }

            ext.InputCellResolver.InputCell(def, center, def.Size, map, rot).ForEach(c =>
                                                                                     GenDraw.DrawFieldEdges(new List <IntVec3>().Append(c), ext.InputCellResolver.GetColor(c, map, rot, CellPattern.InputCell)));
            ext.InputCellResolver.InputZoneCells(def, center, def.Size, map, rot)
            .Select(c => new { Cell = c, Color = ext.InputCellResolver.GetColor(c, map, rot, CellPattern.InputZone) })
            .GroupBy(a => a.Color)
            .ForEach(g => GenDraw.DrawFieldEdges(g.Select(a => a.Cell).ToList(), g.Key));
        }
 public void DrawHighlight(LocalTargetInfo target)
 {
     if (Props.range > 0f)
     {
         if (Props.requiresLineOfSight)
         {
             GenDraw.DrawRadiusRing(selectedTarget.Cell, Props.range, Color.white, (IntVec3 c) => GenSight.LineOfSight(selectedTarget.Cell, c, parent.pawn.Map) && CanPlaceSelectedTargetAt(c));
         }
         else
         {
             GenDraw.DrawRadiusRing(selectedTarget.Cell, Props.range);
         }
     }
     if (target.IsValid)
     {
         GenDraw.DrawTargetHighlight(target);
     }
 }
예제 #8
0
        public override void DrawGhost(ThingDef def, IntVec3 center, Rot4 rot, Color ghostCol, Thing thing = null)
        {
            List <IntVec3> field;

            if (thing == null || thing is Blueprint)
            {
                Map     currentMap = Find.CurrentMap;
                IntVec3 start      = WindowUtility.FindEnd(center, rot, def.size, false);
                IntVec3 end        = WindowUtility.FindEnd(center, rot, def.size, true);
                field = WindowUtility.GetWindowObfuscation(def.size, center, rot, currentMap, start, end).ToList();
            }
            else
            {
                var window = thing as Building_Window;
                field = window.EffectArea;
            }
            GenDraw.DrawFieldEdges(field);
        }
예제 #9
0
        public override void Draw()
        {
            base.Draw();

            GenDraw.FillableBarRequest fillableBarRequest = default(GenDraw.FillableBarRequest);

            fillableBarRequest.center      = this.DrawPos + Vector3.up;
            fillableBarRequest.size        = new Vector2(1.6f, 0.2f);
            fillableBarRequest.fillPercent = this.progress;
            fillableBarRequest.filledMat   = barFilledMat;
            fillableBarRequest.unfilledMat = barUnfilledMat;
            fillableBarRequest.margin      = 0.15f;
            fillableBarRequest.rotation    = this.Rotation.Rotated(RotationDirection.Clockwise);



            GenDraw.DrawFillableBar(fillableBarRequest);
        }
예제 #10
0
        public override void DrawBrows(Vector3 drawLoc, Quaternion headQuat, bool portrait)
        {
            Material browMat = this.CompFace.FaceMaterial.BrowMatAt(this.HeadFacing);

            if (browMat == null)
            {
                return;
            }

            Mesh eyeMesh = this.CompFace.EyeMeshSet.Mesh.MeshAt(this.HeadFacing);

            GenDraw.DrawMeshNowOrLater(
                eyeMesh,
                drawLoc + this.EyeOffset(this.HeadFacing),
                headQuat,
                browMat,
                portrait);
        }
예제 #11
0
 public override void PostDraw()
 {
     if (RimBees_Settings.RB_Ben_ShowProgress)
     {
         Building_BroodChamber broodchamber = this.parent as Building_BroodChamber;
         var progress = broodchamber.tickCounter / ((float)broodchamber.ticksToDays * broodchamber.daysTotal);
         GenDraw.DrawFillableBar(new GenDraw.FillableBarRequest
         {
             center      = parent.DrawPos + CompBeeHouse.ProgressBarOffset,
             size        = CompBeeHouse.ProgressBarSize,
             fillPercent = progress,
             margin      = 0.1f,
             rotation    = Rot4.North,
             filledMat   = CompBeeHouse.FilledMat,
             unfilledMat = CompBeeHouse.UnfilledMat,
         });
     }
 }
예제 #12
0
        public static void Listener(Building_TurretGun __instance)
        {
            CompRemotelyControlledTurret crt = __instance.TryGetComp <CompRemotelyControlledTurret>();

            //Si pas de controlleur alors on ne peut pas controller la tourelle
            if (crt == null || crt.controller == null)
            {
                return;
            }
            CompSkyMind csm = __instance.TryGetComp <CompSkyMind>();

            CompSurrogateOwner csc = crt.controller.TryGetComp <CompSurrogateOwner>();

            if (csm != null && csm.connected && crt.controller != null && csc != null && csc.skyCloudHost != null && csc.skyCloudHost.Map == __instance.Map)
            {
                GenDraw.DrawLineBetween(__instance.TrueCenter(), csc.skyCloudHost.TrueCenter(), SimpleColor.Red);
            }
        }
        public static void DrawMeditationFociAffectedByBuildingOverlay(Map map, ThingDef def, Faction faction, IntVec3 pos, Rot4 rotation)
        {
            int num = 0;

            foreach (Thing item in GetMeditationFociAffectedByBuilding(map, def, faction, pos, rotation))
            {
                if (num++ > 10)
                {
                    break;
                }
                CompToggleDrawAffectedMeditationFoci compToggleDrawAffectedMeditationFoci = item.TryGetComp <CompToggleDrawAffectedMeditationFoci>();
                if (compToggleDrawAffectedMeditationFoci == null || compToggleDrawAffectedMeditationFoci.Enabled)
                {
                    GenAdj.OccupiedRect(pos, rotation, def.size);
                    GenDraw.DrawLineBetween(GenThing.TrueCenter(pos, rotation, def.size, def.Altitude), item.TrueCenter(), SimpleColor.Red);
                }
            }
        }
        public override AcceptanceReport AllowsPlacing(BuildableDef checkingDef, IntVec3 loc, Rot4 rot, Map map, Thing thingToIgnore = null, Thing thing = null)
        {
            ThingDef thingDef = (ThingDef)checkingDef;

            tmpCells.Clear();
            int num = GenRadial.NumCellsInRadius(thingDef.building.instrumentRange);

            for (int i = 0; i < num; i++)
            {
                IntVec3 intVec = loc + GenRadial.RadialPattern[i];
                if (Building_MusicalInstrument.IsAffectedByInstrument(thingDef, loc, intVec, map))
                {
                    tmpCells.Add(intVec);
                }
            }
            GenDraw.DrawFieldEdges(tmpCells);
            return(true);
        }
예제 #15
0
파일: Debug.cs 프로젝트: SmashPhil/Vehicles
 /// <summary>
 /// Draw paths from original settlement position to new position when moving settlement to coastline
 /// </summary>
 public static void DebugSettlementPaths()
 {
     if (VehicleHarmony.drawPaths && VehicleHarmony.debugLines.NullOrEmpty())
     {
         return;
     }
     if (VehicleHarmony.drawPaths)
     {
         foreach (WorldPath wp in VehicleHarmony.debugLines)
         {
             wp.DrawPath(null);
         }
     }
     foreach (Pair <int, int> t in VehicleHarmony.tiles)
     {
         GenDraw.DrawWorldRadiusRing(t.First, t.Second);
     }
 }
        private void DrawBoxAround(int diameter, SimpleColor color = SimpleColor.White)
        {
            float y = AltitudeLayer.MetaOverlays.AltitudeFor();

            int diameterMinusOne = diameter - 1;
            int radius           = diameterMinusOne / 2;
            int radiusPlusOne    = radius + 1;

            Vector3 vector  = new Vector3((float)(Position.x - radius), y, (float)(Position.z - radius));
            Vector3 vector2 = new Vector3((float)(Position.x + radiusPlusOne), y, (float)(Position.z - radius));
            Vector3 vector3 = new Vector3((float)(Position.x + radiusPlusOne), y, (float)(Position.z + radiusPlusOne));
            Vector3 vector4 = new Vector3((float)(Position.x - radius), y, (float)(Position.z + radiusPlusOne));

            GenDraw.DrawLineBetween(vector, vector2, color);
            GenDraw.DrawLineBetween(vector2, vector3, color);
            GenDraw.DrawLineBetween(vector3, vector4, color);
            GenDraw.DrawLineBetween(vector4, vector, color);
        }
        private static void RenderFacepaint(PawnRenderer instance, bool hideFacepaint, RotDrawMode bodyDrawType, bool headStump, Rot4 headFacing, Vector3 baseDrawPos, Quaternion quaternion, bool portrait)
        {
            var pawn = instance.graphics.pawn;

            if (bodyDrawType != RotDrawMode.Dessicated && !headStump &&
                pawn.GetComp <CompFacepaint>() is CompFacepaint facepaintComp)
            {
                Mesh mesh = instance.graphics.HairMeshSet.MeshAt(headFacing);
                if (facepaintComp.facepaintGraphicOne != null)
                {
                    GenDraw.DrawMeshNowOrLater(mesh, baseDrawPos - new Vector3(0, 0.0007f, 0), quaternion, facepaintComp.facepaintGraphicOne.MatAt(headFacing), portrait);
                }
                if (facepaintComp.facepaintGraphicTwo != null)
                {
                    GenDraw.DrawMeshNowOrLater(mesh, baseDrawPos - new Vector3(0, 0.0005f, 0), quaternion, facepaintComp.facepaintGraphicTwo.MatAt(headFacing), portrait);
                }
            }
        }
예제 #18
0
        public static void DrawLinesToPotentialThingsToLinkTo(ThingDef myDef, IntVec3 myPos, Rot4 myRot, Map map)
        {
            CompProperties_Facility compProperties = myDef.GetCompProperties <CompProperties_Facility>();
            Vector3 a = GenThing.TrueCenter(myPos, myRot, myDef.size, myDef.Altitude);

            for (int i = 0; i < compProperties.linkableBuildings.Count; i++)
            {
                foreach (Thing item in map.listerThings.ThingsOfDef(compProperties.linkableBuildings[i]))
                {
                    CompAffectedByFacilities compAffectedByFacilities = item.TryGetComp <CompAffectedByFacilities>();
                    if (compAffectedByFacilities != null && compAffectedByFacilities.CanPotentiallyLinkTo(myDef, myPos, myRot))
                    {
                        GenDraw.DrawLineBetween(a, item.TrueCenter());
                        compAffectedByFacilities.DrawRedLineToPotentiallySupplantedFacility(myDef, myPos, myRot);
                    }
                }
            }
        }
예제 #19
0
        public override void DrawGhost(ThingDef def, IntVec3 center, Rot4 rot, Color ghostCol, Thing thing = null)
        {
            if (!ModsConfig.RoyaltyActive)
            {
                return;
            }
            FocusStrengthOffset_BuildingDefs focusStrengthOffset_BuildingDefs = ((CompProperties_MeditationFocus)((def.IsFrame || def.IsBlueprint) ? ((ThingDef)def.entityDefToBuild).CompDefFor <CompMeditationFocus>() : def.CompDefFor <CompMeditationFocus>())).offsets.OfType <FocusStrengthOffset_BuildingDefs>().FirstOrDefault();

            if (focusStrengthOffset_BuildingDefs != null)
            {
                GenDraw.DrawRadiusRing(center, focusStrengthOffset_BuildingDefs.radius, RingColor);
                List <Thing> forCell = Find.CurrentMap.listerBuldingOfDefInProximity.GetForCell(center, focusStrengthOffset_BuildingDefs.radius, focusStrengthOffset_BuildingDefs.defs);
                for (int i = 0; i < forCell.Count && i < focusStrengthOffset_BuildingDefs.maxBuildings; i++)
                {
                    GenDraw.DrawLineBetween(GenThing.TrueCenter(center, Rot4.North, def.size, def.Altitude), forCell[i].TrueCenter(), SimpleColor.Green);
                }
            }
        }
예제 #20
0
        public override void PostDraw()
        {
            base.PostDraw();

            if (this.ShowBar)
            {
                GenDraw.FillableBarRequest r = new GenDraw.FillableBarRequest();
                r.center = this.parent.DrawPos + Vector3.up * 0.1f + Vector3.back * this.parent.def.size.z / 4.0f;
                r.size   = new Vector2(this.parent.RotatedSize.x, BarThick);
                //r.center = new Vector3(this.parent.DrawPos.x, 0.1f, 1.0f - r.size.y / 2.0f);
                //Log.Message(this.parent.DrawPos.ToString());
                r.fillPercent = this.StoredWaterVolume / this.MaxWaterVolume;
                r.filledMat   = BarFilledMat;
                r.unfilledMat = BarUnfilledMat;
                r.margin      = 0.15f;
                GenDraw.DrawFillableBar(r);
            }
        }
예제 #21
0
 public static void DrawExtraSelectionOverlays_Postfix(Thing __instance)
 {
     if (__instance?.def?.defName != null)
     {
         if (__instance.def.HasComp(typeof(CompGlower)))
         {
             CompGlower glower = __instance.TryGetComp <CompGlower>();
             if (LightRadiusSettings.innerLight)
             {
                 GenDraw.DrawRadiusRing(__instance.Position, glower.Props.glowRadius * 0.91f - 2f);
             }
             if (LightRadiusSettings.outerLight)
             {
                 GenDraw.DrawRadiusRing(__instance.Position, glower.Props.glowRadius * 0.91f - 0.5f);
             }
         }
     }
 }
        public override void DrawGhost(ThingDef def, IntVec3 center, Rot4 rot, Color ghostCol, Thing thing = null)
        {
            base.DrawGhost(def, center, rot, ghostCol);

            if (def.GetModExtension <DefModExtension_DroneStation>().SquareJobRadius > 0)
            {
                int            squareAreaRadius = def.GetModExtension <DefModExtension_DroneStation>().SquareJobRadius;
                List <IntVec3> list             = new List <IntVec3>((squareAreaRadius * 2 + 1) * (squareAreaRadius * 2 + 1));
                for (int i = -squareAreaRadius; i <= squareAreaRadius; i++)
                {
                    for (int j = -squareAreaRadius; j <= squareAreaRadius; j++)
                    {
                        list.Add(new IntVec3(i, 0, j) + center);
                    }
                }
                GenDraw.DrawFieldEdges(list);
            }
        }
예제 #23
0
        // Token: 0x06002189 RID: 8585 RVA: 0x000CB488 File Offset: 0x000C9688
        public override void DrawHighlight(LocalTargetInfo target)
        {
            AbilityDef def = this.ability.def;

            this.DrawRadius();
            if (this.CanHitTarget(target) && this.IsApplicableTo(target, false))
            {
                if (def.HasAreaOfEffect)
                {
                    if (target.IsValid)
                    {
                        GenDraw.DrawTargetHighlight(target);
                        GenDraw.DrawRadiusRing(target.Cell, def.EffectRadius, Verb_CastAbility.RadiusHighlightColor, null);
                    }
                }
                else
                {
                    GenDraw.DrawTargetHighlight(target);
                }
            }
            if (target.IsValid)
            {
                this.ability.DrawEffectPreviews(target);
            }
            this.verbProps.DrawRadiusRing(this.caster.Position);
            if (target.IsValid)
            {
                GenDraw.DrawTargetHighlight(target);
                bool      flag;
                float     num = this.HighlightFieldRadiusAroundTarget(out flag);
                ShootLine shootLine;
                if (num > 0.2f && this.TryFindShootLineFromTo(this.caster.Position, target, out shootLine))
                {
                    if (flag)
                    {
                        GenExplosion.RenderPredictedAreaOfEffect(shootLine.Dest, num);
                        return;
                    }
                    GenDraw.DrawFieldEdges((from x in GenRadial.RadialCellsAround(shootLine.Dest, num, true)
                                            where x.InBounds(Find.CurrentMap)
                                            select x).ToList <IntVec3>());
                }
            }
        }
예제 #24
0
        static void _DebugFoodSearchFromMouse_Update()
        {
            IntVec3 root = Verse.UI.MouseCell();
            Pawn    pawn = Find.Selector.SingleSelectedThing as Pawn;

            if (pawn == null)
            {
                return;
            }
            if (pawn.Map != Find.VisibleMap)
            {
                return;
            }
            {
                //TODO: fix broken lines
                if (bestFoodSource != null)
                {
                    GenDraw.DrawLineBetween(pawn.Position.ToVector3Shifted(), bestFoodSource.Position.ToVector3Shifted(), SimpleColor.Yellow);
                }
                if (bestFoodSourceFromMouse != null)
                {
                    GenDraw.DrawLineBetween(root.ToVector3Shifted(), bestFoodSourceFromMouse.Position.ToVector3Shifted(), SimpleColor.Yellow);
                }
                if (pawnB != null && null != pawnA && pawnA != pawnB)
                {
                    GenDraw.DrawLineBetween(pawnA.Position.ToVector3Shifted(), pawnB.Position.ToVector3Shifted(), SimpleColor.Green);
                }
            }

            //duck tape
            try
            {
                if (getter.playerSettings != null && getter.playerSettings.AreaRestrictionInPawnCurrentMap != null)
                {
                    GenDraw.DrawFieldEdges(getter.playerSettings.AreaRestrictionInPawnCurrentMap.ActiveCells.ToList(), Color.red);
                }
            }
            catch (Exception)
            {
#if DEBUG
                Log.Warning("DrawFieldEdges() failed");
#endif
            }
        }
        public static void DebugDraw()
        {
            if (!DebugViewSettings.drawStealDebug)
            {
                StealAIDebugDrawer.debugDrawLord = null;
                return;
            }
            Lord lord = StealAIDebugDrawer.debugDrawLord;

            StealAIDebugDrawer.debugDrawLord = StealAIDebugDrawer.FindHostileLord();
            if (StealAIDebugDrawer.debugDrawLord == null)
            {
                return;
            }
            StealAIDebugDrawer.CheckInitDebugDrawGrid();
            float num = StealAIUtility.StartStealingMarketValueThreshold(StealAIDebugDrawer.debugDrawLord);

            if (lord != StealAIDebugDrawer.debugDrawLord)
            {
                foreach (IntVec3 intVec in Find.CurrentMap.AllCells)
                {
                    StealAIDebugDrawer.debugDrawGrid[intVec] = (StealAIDebugDrawer.TotalMarketValueAround(intVec, Find.CurrentMap, StealAIDebugDrawer.debugDrawLord.ownedPawns.Count) > num);
                }
            }
            foreach (IntVec3 c in Find.CurrentMap.AllCells)
            {
                if (StealAIDebugDrawer.debugDrawGrid[c])
                {
                    CellRenderer.RenderCell(c, 0.5f);
                }
            }
            StealAIDebugDrawer.tmpToSteal.Clear();
            for (int i = 0; i < StealAIDebugDrawer.debugDrawLord.ownedPawns.Count; i++)
            {
                Pawn  pawn = StealAIDebugDrawer.debugDrawLord.ownedPawns[i];
                Thing thing;
                if (StealAIUtility.TryFindBestItemToSteal(pawn.Position, pawn.Map, 7f, out thing, pawn, StealAIDebugDrawer.tmpToSteal))
                {
                    GenDraw.DrawLineBetween(pawn.TrueCenter(), thing.TrueCenter());
                    StealAIDebugDrawer.tmpToSteal.Add(thing);
                }
            }
            StealAIDebugDrawer.tmpToSteal.Clear();
        }
예제 #26
0
        public static void DebugDrawPredatorFoodSource()
        {
            Pawn     pawn     = Find.Selector.SingleSelectedThing as Pawn;
            Thing    thing    = default(Thing);
            ThingDef thingDef = default(ThingDef);

            if (pawn != null && FoodUtility.TryFindBestFoodSourceFor(pawn, pawn, true, out thing, out thingDef, false, false, false, true, false, false))
            {
                GenDraw.DrawLineBetween(pawn.Position.ToVector3Shifted(), thing.Position.ToVector3Shifted());
                if (!(thing is Pawn))
                {
                    Pawn pawn2 = FoodUtility.BestPawnToHuntForPredator(pawn);
                    if (pawn2 != null)
                    {
                        GenDraw.DrawLineBetween(pawn.Position.ToVector3Shifted(), pawn2.Position.ToVector3Shifted());
                    }
                }
            }
        }
예제 #27
0
        public override void DrawExtraSelectionOverlays()
        {
            base.DrawExtraSelectionOverlays();

            GenDraw.DrawCircleOutline(GreenhouseCell.ToVector3Shifted(), 0.45f, SimpleColor.Cyan);

            var room = GreenhouseRoom;

            if (GetRoomError(room) != null)
            {
                return;
            }

            cells.Clear();
            cells.AddRange(room.Cells);
            cells.Add(Position);

            GenDraw.DrawFieldEdges(cells, Color.green);
        }
 public override void Draw()
 {
     base.Draw();
     if (!Empty)
     {
         Vector3 drawPos = DrawPos;
         drawPos.y += 3f / 70f;
         drawPos.z += 0.25f;
         GenDraw.FillableBarRequest r = default(GenDraw.FillableBarRequest);
         r.center      = drawPos;
         r.size        = BarSize;
         r.fillPercent = (float)wortCount / 25f;
         r.filledMat   = BarFilledMat;
         r.unfilledMat = BarUnfilledMat;
         r.margin      = 0.1f;
         r.rotation    = Rot4.North;
         GenDraw.DrawFillableBar(r);
     }
 }
예제 #29
0
        public static void DebugDraw()
        {
            if (!DebugViewSettings.drawStealDebug)
            {
                debugDrawLord = null;
                return;
            }
            Lord lord = debugDrawLord;

            debugDrawLord = FindHostileLord();
            if (debugDrawLord == null)
            {
                return;
            }
            CheckInitDebugDrawGrid();
            float num = StealAIUtility.StartStealingMarketValueThreshold(debugDrawLord);

            if (lord != debugDrawLord)
            {
                foreach (IntVec3 allCell in Find.CurrentMap.AllCells)
                {
                    debugDrawGrid[allCell] = TotalMarketValueAround(allCell, Find.CurrentMap, debugDrawLord.ownedPawns.Count) > num;
                }
            }
            foreach (IntVec3 allCell2 in Find.CurrentMap.AllCells)
            {
                if (debugDrawGrid[allCell2])
                {
                    CellRenderer.RenderCell(allCell2);
                }
            }
            tmpToSteal.Clear();
            for (int i = 0; i < debugDrawLord.ownedPawns.Count; i++)
            {
                Pawn pawn = debugDrawLord.ownedPawns[i];
                if (StealAIUtility.TryFindBestItemToSteal(pawn.Position, pawn.Map, 7f, out var item, pawn, tmpToSteal))
                {
                    GenDraw.DrawLineBetween(pawn.TrueCenter(), item.TrueCenter());
                    tmpToSteal.Add(item);
                }
            }
            tmpToSteal.Clear();
        }
예제 #30
0
 static void Postfix(Thing __instance)
 {
     if (__instance is Pawn)
     {
         Pawn pawn = (Pawn)__instance;
         if (pawn.RemoteControlLink() != null)
         {
             if (pawn.IsHacked())
             {
                 GenDraw.DrawRadiusRing(pawn.RemoteControlLink().Position, Utilities.GetRemoteControlRadius(pawn.RemoteControlLink()));
             }
             else
             {
                 GenDraw.DrawRadiusRing(pawn.Position, Utilities.GetRemoteControlRadius(pawn));
             }
             GenDraw.DrawLineBetween(pawn.Position.ToVector3Shifted(), pawn.RemoteControlLink().Position.ToVector3Shifted());
         }
     }
 }