public static bool TryDrawFiringCone(IntVec3 centre, Rot4 rot, float distance, float arc) { if (arc < 360) { if (distance > GenRadial.MaxRadialPatternRadius) { if (!(bool)NonPublicFields.GenDraw_maxRadiusMessaged.GetValue(null)) { Log.Error("Cannot draw radius ring of radius " + distance + ": not enough squares in the precalculated list.", false); NonPublicFields.GenDraw_maxRadiusMessaged.SetValue(null, true); } return(false); } var ringDrawCells = (List <IntVec3>)NonPublicFields.GenDraw_ringDrawCells.GetValue(null); ringDrawCells.Clear(); int num = GenRadial.NumCellsInRadius(distance); for (int i = 0; i < num; i++) { var curCell = centre + GenRadial.RadialPattern[i]; if (curCell.WithinFiringArcOf(centre, rot, arc)) { ringDrawCells.Add(curCell); } } GenDraw.DrawFieldEdges(ringDrawCells); return(true); } return(false); }
// Token: 0x06004769 RID: 18281 RVA: 0x00216080 File Offset: 0x00214480 public override void DrawGhost(ThingDef def, IntVec3 center, Rot4 rot, Color ghostCol, Thing thing = null) { var unused = Find.CurrentMap; // drawit(center.ToVector3()+new Vector3(0.5f,0,1),7f, MaterialPool.MatFrom(GenDraw.LineTexPath, ShaderDatabase.Transparent, Color.red)); GenDraw.DrawFieldEdges(CellsAround(center, Find.CurrentMap), Color.magenta); }
public override void DrawGhost(ThingDef def, IntVec3 center, Rot4 rot, Color ghostCol, Thing thing = null) { if (def.hasInteractionCell) { GenDraw.DrawFieldEdges(ShootingRangeUtility.RangeArea(def, center, rot).ToList()); } }
public static void DrawStrikePreview(IntVec3 start, IntVec3 end, Map map, int bombCount, float explosionRadius) { if (start == end) { GenExplosion.RenderPredictedAreaOfEffect(start, explosionRadius); return; } int index = 0; tempCells.Clear(); foreach (var cell in GeneratePoints(start, end, bombCount)) { tempCells.Add(cell); int t = (int)(Time.unscaledTime * 6f); t = t % bombCount; bool drawRadius = t == index; bool thickRoof = cell.GetRoof(map)?.isThickRoof ?? false; if (explosionRadius > 0 && drawRadius && !thickRoof) { GenExplosion.RenderPredictedAreaOfEffect(cell, explosionRadius); } index++; } GenDraw.DrawFieldEdges(tempCells, Color.red); }
public void Draw(int colorSeed) { Color color = colors[(colorSeed % colors.Length)]; var cells = this.Plants.Select((Plant arg) => arg.Position).ToList(); GenDraw.DrawFieldEdges(cells, color); }
public override void DrawGhost(ThingDef def, IntVec3 center, Rot4 rot) { var vecNorth = center + IntVec3.North.RotatedBy(rot); var vecSouth = center + IntVec3.South.RotatedBy(rot); if (!vecNorth.InBounds() || !vecSouth.InBounds()) { return; } GenDraw.DrawFieldEdges(new List <IntVec3> { vecNorth }, new Color(1f, 0.7f, 0f, 0.5f)); GenDraw.DrawFieldEdges(new List <IntVec3> { vecSouth }, Color.white); var controlledRoom = vecNorth.GetRoom(); var otherRoom = vecSouth.GetRoom(); if (controlledRoom == null || otherRoom == null) { return; } if (!controlledRoom.UsesOutdoorTemperature) { GenDraw.DrawFieldEdges(controlledRoom.Cells.ToList(), new Color(1f, 0.7f, 0f, 0.5f)); } }
public override void DrawGhost(ThingDef def, IntVec3 center, Rot4 rot, Color ghostCol) { Map currentMap = Find.CurrentMap; IntVec3 intVec = center + IntVec3.South.RotatedBy(rot); IntVec3 intVec2 = center + IntVec3.North.RotatedBy(rot); List <IntVec3> list = new List <IntVec3>(); list.Add(intVec); GenDraw.DrawFieldEdges(list, GenTemperature.ColorSpotCold); list = new List <IntVec3>(); list.Add(intVec2); GenDraw.DrawFieldEdges(list, GenTemperature.ColorSpotHot); RoomGroup roomGroup = intVec2.GetRoomGroup(currentMap); RoomGroup roomGroup2 = intVec.GetRoomGroup(currentMap); if (roomGroup != null && roomGroup2 != null) { if (roomGroup == roomGroup2 && !roomGroup.UsesOutdoorTemperature) { GenDraw.DrawFieldEdges(roomGroup.Cells.ToList(), new Color(1f, 0.7f, 0f, 0.5f)); } else { if (!roomGroup.UsesOutdoorTemperature) { GenDraw.DrawFieldEdges(roomGroup.Cells.ToList(), GenTemperature.ColorRoomHot); } if (!roomGroup2.UsesOutdoorTemperature) { GenDraw.DrawFieldEdges(roomGroup2.Cells.ToList(), GenTemperature.ColorRoomCold); } } } }
public override void DrawExtraSelectionOverlays() { base.DrawExtraSelectionOverlays(); var room = this.GetRoom(); if (room == null) { return; } if (room.isPrisonCell) { return; } if (room.RegionCount < 20 && !room.TouchesMapEdge) { foreach (var current in room.Cells) { guestField.Add(current); } var color = guestFieldColor; color.a = Pulser.PulseBrightness(1f, 0.6f); GenDraw.DrawFieldEdges(guestField, color); guestField.Clear(); } }
private static void DrawSelectionBracketFor(object obj) { Zone zone = obj as Zone; if (zone != null) { GenDraw.DrawFieldEdges(zone.Cells); } Thing thing = obj as Thing; if (thing != null) { CellRect?customRectForSelector = thing.CustomRectForSelector; if (customRectForSelector.HasValue) { SelectionDrawerUtility.CalculateSelectionBracketPositionsWorld(bracketLocs, thing, customRectForSelector.Value.CenterVector3, new Vector2(customRectForSelector.Value.Width, customRectForSelector.Value.Height), selectTimes, Vector2.one); } else { SelectionDrawerUtility.CalculateSelectionBracketPositionsWorld(bracketLocs, thing, thing.DrawPos, thing.RotatedSize.ToVector2(), selectTimes, Vector2.one); } int num = 0; for (int i = 0; i < 4; i++) { Quaternion rotation = Quaternion.AngleAxis(num, Vector3.up); Graphics.DrawMesh(MeshPool.plane10, bracketLocs[i], rotation, SelectionBracketMat, 0); num -= 90; } } }
public override void DrawGhost(IntVec3 center, Rot4 rot, ThingDef thingDef, Color ghostCol, AltitudeLayer drawAltitude, Thing thing = null) { base.DrawGhost(center, rot, thingDef, ghostCol, drawAltitude, thing); var list = CellsWithinRange(center).ToList(); GenDraw.DrawFieldEdges(list, this.ghostColor); }
public override void DrawGhost(ThingDef def, IntVec3 center, Rot4 rot) { CellRect cellRect = GenAdj.OccupiedRect(center, rot, def.size); cellRect = cellRect.ExpandedBy(1); GenDraw.DrawFieldEdges(cellRect.Cells.ToList(), Color.white); }
private void TickMethod() { GenDraw.DrawFieldEdges(new List <IntVec3>(1) { Position }, Color.magenta); }
public void PatherTick() { if (!pawn.Drafted) { return; } if (VehicleMod.settings.debug.debugDrawBumpers) { GenDraw.DrawFieldEdges(bumperCells); } if (WillCollideWithPawnAt(pawn.Position)) { if (!FailedToFindCloseUnoccupiedCellRecently()) { if (CellFinder.TryFindBestPawnStandCell(pawn, out IntVec3 intVec, true) && intVec != pawn.Position) { pawn.Position = intVec; ResetToCurrentPosition(); if (moving && TrySetNewPath()) { TryEnterNextPathCell(); return; } } else { failedToFindCloseUnoccupiedCellTicks = Find.TickManager.TicksGame; } } return; }
public override void Tick() { base.Tick(); if (ticks > 240) { Destroy(); } if (!Spawned) { return; } ticks++; if (ticks == 59) { affected = new List <Pawn>(); } if (!startBomb) { return; } GenDraw.DrawFieldEdges(MagNowCellsAround(self.Position, Map, range * ((ticks - 60) * 1f / 180f)), new Color(0.4f, 0.4f, 0.8f)); foreach (var ic in MagNowCellsAround(self.Position, Map, range * ((ticks - 60) * 1f / 180f))) { foreach (var th in Map.thingGrid.ThingsAt(ic)) { if (th is not Pawn pawn) { continue; } if (affected.Contains(pawn) || pawn == self) { continue; } if (pawn.Faction.HostileTo(self.Faction)) { var dinfo = new DamageInfo(DefDatabase <DamageDef> .GetNamed("Mag"), damage, 0, -1, self, null, null, DamageInfo.SourceCategory.ThingOrUnknown, pawn); pawn.TakeDamage(dinfo); var hediff_Magnetize = (Hediff_Volt4Skill)HediffMaker.MakeHediff(HediffDef.Named("Volt4Skill"), self); hediff_Magnetize.level = (int)self.GetLevel(); hediff_Magnetize.damage = 3; pawn.health.AddHediff(hediff_Magnetize); WarframeStaticMethods.ShowDamageAmount(pawn, damage.ToString("f0")); pawn.stances.stunner.StunFor((int)(180 * (1 + (self.GetLevel() * 1f / 30f))), self); } affected.Add(pawn); } } }
public override void PostDrawExtraSelectionOverlays() { var cells = new List <IntVec3>(); var root = parent.Position; for (var i = 0; i < span; i++) { var currentMap = Find.CurrentMap; if (currentMap == null) { continue; } var tempCell = root + GenRadial.ManualRadialPattern[i]; if (tempCell.InBounds(currentMap)) { cells.Add(tempCell); } } if (cells.Count > 0) { GenDraw.DrawFieldEdges(cells, Color.cyan); } }
public void TargeterUpdate() { if (targetingVerb != null) { targetingVerb.verbProps.DrawRadiusRing(targetingVerb.caster.Position); LocalTargetInfo targ = CurrentTargetUnderMouse(mustBeHittableNowIfNotMelee: true); if (targ.IsValid) { GenDraw.DrawTargetHighlight(targ); bool needLOSToCenter; float num = targetingVerb.HighlightFieldRadiusAroundTarget(out needLOSToCenter); if (num > 0.2f && targetingVerb.TryFindShootLineFromTo(targetingVerb.caster.Position, targ, out ShootLine resultingLine)) { if (needLOSToCenter) { GenExplosion.RenderPredictedAreaOfEffect(resultingLine.Dest, num); } else { GenDraw.DrawFieldEdges((from x in GenRadial.RadialCellsAround(resultingLine.Dest, num, useCenter: true) where x.InBounds(Find.CurrentMap) select x).ToList()); } } } } if (action != null) { LocalTargetInfo targ2 = CurrentTargetUnderMouse(mustBeHittableNowIfNotMelee: false); if (targ2.IsValid) { GenDraw.DrawTargetHighlight(targ2); } } }
public override void DrawLandingTarget(IntVec3 cell, Rot4 rot) { List <IntVec3> cells = RunwayCells(cell, rot).ToList(); Color highlightColor = cells.Any(c => !ValidCell(Find.CurrentMap, c)) ? Color.red : Color.white; GenDraw.DrawFieldEdges(cells, highlightColor); }
public override void PostDrawExtraSelectionOverlays() { base.PostDrawExtraSelectionOverlays(); GenDraw.DrawFieldEdges(new List <IntVec3> { CurrentCell }, Color.yellow); }
public override void PostDraw() { if (placingMoisturePump) { GenDraw.DrawFieldEdges(moisturePumpCells.ToList(), Color.blue); } }
public override void DrawGhost(ThingDef def, IntVec3 center, Rot4 rot) { Map visibleMap = Find.VisibleMap; IntVec3 intVec = center + IntVec3.South.RotatedBy(rot); IntVec3 intVec2 = center + IntVec3.North.RotatedBy(rot); List <IntVec3> list = new List <IntVec3>(); list.Add(intVec); GenDraw.DrawFieldEdges(list, Color.white); list = new List <IntVec3>(); list.Add(intVec2); GenDraw.DrawFieldEdges(list, Color.white); RoomGroup roomGroup = intVec2.GetRoomGroup(visibleMap); RoomGroup roomGroup2 = intVec.GetRoomGroup(visibleMap); if (roomGroup != null && roomGroup2 != null) { if (roomGroup == roomGroup2 && !roomGroup.UsesOutdoorTemperature) { GenDraw.DrawFieldEdges(roomGroup.Cells.ToList(), Color.white); } else { if (!roomGroup.UsesOutdoorTemperature) { GenDraw.DrawFieldEdges(roomGroup.Cells.ToList(), Color.white); } if (!roomGroup2.UsesOutdoorTemperature) { GenDraw.DrawFieldEdges(roomGroup2.Cells.ToList(), Color.white); } } } }
public override void DrawGhost(ThingDef def, IntVec3 center, Rot4 rot, Color ghostCol, Thing thing = null) { //base.DrawGhost(def, center, rot, ghostCol, thing); IntVec3 inputCell = center; IntVec3 outputCell = center; //outputCell = center + rot.FacingCell; inputCell = center + rot.Opposite.FacingCell; //Not shure how i should sopport the angeled one bool isRight = false; if (thing != null && !thing.def.IsBlueprint) { isRight = (thing as Building_ItemPuller).Getright; } if (def.IsBlueprint) { outputCell = def.entityDefToBuild.GetModExtension <ModExtension_Puller>().GetOutputCell(center, rot, isRight); } else { outputCell = def.GetModExtension <ModExtension_Puller>().GetOutputCell(center, rot, isRight); } GenDraw.DrawFieldEdges(new List <IntVec3> { inputCell }, Common.CommonColors.inputCell); GenDraw.DrawFieldEdges(new List <IntVec3> { outputCell }, Common.CommonColors.outputCell); }
public override void DrawGhost(ThingDef def, IntVec3 loc, Rot4 rot, Color ghostCol) { GenDraw.DrawFieldEdges(CompPowerPlantWater.GroundCells(loc, rot).ToList <IntVec3>(), Color.white); Color color = (!this.WaterCellsPresent(loc, rot, Find.CurrentMap)) ? Designator_Place.CannotPlaceColor.ToOpaque() : Designator_Place.CanPlaceColor.ToOpaque(); GenDraw.DrawFieldEdges(CompPowerPlantWater.WaterCells(loc, rot).ToList <IntVec3>(), color); bool flag = false; CellRect cellRect = CompPowerPlantWater.WaterUseRect(loc, rot); PlaceWorker_WatermillGenerator.waterMills.AddRange(Find.CurrentMap.listerBuildings.AllBuildingsColonistOfDef(ThingDefOf.WatermillGenerator).Cast <Thing>()); PlaceWorker_WatermillGenerator.waterMills.AddRange(from t in Find.CurrentMap.listerThings.ThingsInGroup(ThingRequestGroup.Blueprint) where t.def.entityDefToBuild == ThingDefOf.WatermillGenerator select t); PlaceWorker_WatermillGenerator.waterMills.AddRange(from t in Find.CurrentMap.listerThings.ThingsInGroup(ThingRequestGroup.BuildingFrame) where t.def.entityDefToBuild == ThingDefOf.WatermillGenerator select t); foreach (Thing thing in PlaceWorker_WatermillGenerator.waterMills) { GenDraw.DrawFieldEdges(CompPowerPlantWater.WaterUseCells(thing.Position, thing.Rotation).ToList <IntVec3>(), new Color(0.2f, 0.2f, 1f)); if (cellRect.Overlaps(CompPowerPlantWater.WaterUseRect(thing.Position, thing.Rotation))) { flag = true; } } PlaceWorker_WatermillGenerator.waterMills.Clear(); Color color2 = (!flag) ? Designator_Place.CanPlaceColor.ToOpaque() : new Color(1f, 0.6f, 0f); if (!flag || Time.realtimeSinceStartup % 0.4f < 0.2f) { GenDraw.DrawFieldEdges(CompPowerPlantWater.WaterUseCells(loc, rot).ToList <IntVec3>(), color2); } }
public override void DrawExtraSelectionOverlays() { base.DrawExtraSelectionOverlays(); GenDraw.DrawFieldEdges(new List <IntVec3> { OutputSlot }, Color.yellow); }
/// <summary> /// Draw Overlay when Selected or Placing. /// /// Here we just draw a red cell towards the South. To indicate Exhaust. /// </summary> /// <param name="def">The Thing's Def</param> /// <param name="center">Location</param> /// <param name="rot">Rotation</param> /// <param name="ghostCol">Ghost Color</param> public override void DrawGhost(ThingDef def, IntVec3 center, Rot4 rot, Color ghostCol, Thing thing = null) { if (def == null) { return; } //var size = def.size; List <IntVec3> list = new List <IntVec3>(); IntVec3 iterator = new IntVec3(center.x, center.y, center.z); //for (int dx = 0; dx < size.x; dx++) for (int dx = 0; dx < def.size.x; dx++) { //IntVec3 intVec = iterator + IntVec3.South.RotatedBy(rot); //list.Add(intVec); list.Add(iterator + IntVec3.South.RotatedBy(rot)); iterator += IntVec3.East.RotatedBy(rot); } GenDraw.DrawFieldEdges(list, Color.red); }
public override AcceptanceReport AllowsPlacing(BuildableDef checkingDef, IntVec3 loc, Rot4 rot, Map map, Thing thingToIgnore = null) { IntVec3 loc2 = loc; loc2 = loc + GenAdj.CardinalDirections[rot.AsInt]; Building edifice = loc2.GetEdifice(map); Building spaceOccupied = loc.GetEdifice(map); GenDraw.DrawFieldEdges(new List <IntVec3> { loc2 }); if (edifice == null) { return("PlacementOnWall".Translate()); } if (edifice.def == null) { return("PlacementOnWall".Translate()); } if ((edifice.def.graphicData.linkFlags & LinkFlags.Wall) == LinkFlags.None) { return("PlacementOnWall".Translate()); } return(AcceptanceReport.WasAccepted); }
public override void DrawGhost(ThingDef def, IntVec3 center, Rot4 rot, Color ghostCol, Thing thing = null) { _ = Find.CurrentMap; GenDraw.DrawFieldEdges(new List <IntVec3> { center + def.interactionCellOffset }); }
public override void DrawGhost(ThingDef def, IntVec3 center, Rot4 rot, Color ghostCol, Thing thing = null) { Map currentMap = Find.CurrentMap; IntVec3 intVec = center + IntVec3.South.RotatedBy(rot); IntVec3 intVec2 = center + IntVec3.North.RotatedBy(rot); GenDraw.DrawFieldEdges(new List <IntVec3> { intVec }, GenTemperature.ColorSpotCold); GenDraw.DrawFieldEdges(new List <IntVec3> { intVec2 }, GenTemperature.ColorSpotHot); RoomGroup roomGroup = intVec2.GetRoomGroup(currentMap); RoomGroup roomGroup2 = intVec.GetRoomGroup(currentMap); if (roomGroup == null || roomGroup2 == null) { return; } if (roomGroup == roomGroup2 && !roomGroup.UsesOutdoorTemperature) { GenDraw.DrawFieldEdges(roomGroup.Cells.ToList(), new Color(1f, 0.7f, 0f, 0.5f)); return; } if (!roomGroup.UsesOutdoorTemperature) { GenDraw.DrawFieldEdges(roomGroup.Cells.ToList(), GenTemperature.ColorRoomHot); } if (!roomGroup2.UsesOutdoorTemperature) { GenDraw.DrawFieldEdges(roomGroup2.Cells.ToList(), GenTemperature.ColorRoomCold); } }
public override void DrawGhost(ThingDef def, IntVec3 center, Rot4 rot, Color ghostCol) { List <IntVec3> result = new List <IntVec3>(); result.Add(center + new IntVec3(0, 0, -2)); GenDraw.DrawFieldEdges(result); }
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.TargetCellResolver == null) { Debug.LogWarning("targetCellResolver not found."); return; } var machine = center.GetThingList(map).Where(t => t.def == def).SelectMany(t => Option(t as IRange)).FirstOption(); if (machine.HasValue) { machine.Value.GetAllTargetCells().Select(c => new { Cell = c, Color = ext.TargetCellResolver.GetColor(c, map, rot, CellPattern.Instance) }) .GroupBy(a => a.Color) .ForEach(g => GenDraw.DrawFieldEdges(g.Select(a => a.Cell).ToList(), g.Key)); } else { var min = ext.TargetCellResolver.GetRangeCells(def, center, def.size, map, rot, ext.TargetCellResolver.MinRange()); var max = ext.TargetCellResolver.GetRangeCells(def, center, def.size, map, rot, ext.TargetCellResolver.MaxRange()); min.Select(c => new { Cell = c, Color = ext.TargetCellResolver.GetColor(c, map, rot, CellPattern.BlurprintMin) }) .Concat(max.Select(c => new { Cell = c, Color = ext.TargetCellResolver.GetColor(c, map, rot, CellPattern.BlurprintMax) })) .GroupBy(a => a.Color) .ForEach(g => GenDraw.DrawFieldEdges(g.Select(a => a.Cell).ToList(), g.Key)); } map.listerThings.ThingsOfDef(def).SelectMany(t => Option(t as IRange)).Where(r => r.Position != center).ForEach(r => r.GetAllTargetCells().Select(c => new { Cell = c, Color = ext.TargetCellResolver.GetColor(c, map, rot, CellPattern.OtherInstance) }) .GroupBy(a => a.Color) .ForEach(g => GenDraw.DrawFieldEdges(g.Select(a => a.Cell).ToList(), g.Key))); }
public void DebugDraw() { if (ShipHarmony.debug && Find.TickManager.TicksGame < this.debug_lastTraverseTick + 60) { float a = 1f - (float)(Find.TickManager.TicksGame - this.debug_lastTraverseTick) / 60f; GenDraw.DrawFieldEdges(this.Cells.ToList <IntVec3>(), new Color(0f, 0f, 1f, a)); } }