private void DrawGhostThing(IntVec3 cell, Thing thing) { Graphic baseGraphic = thing.Graphic.ExtractInnerGraphicFor(thing); Color color = this.CanReinstall(thing, cell).Accepted ? Designator_Place.CanPlaceColor : Designator_Place.CannotPlaceColor; GhostDrawer.DrawGhostThing(cell, this.GetRotation(thing), thing.def, baseGraphic, color, AltitudeLayer.Blueprint, thing); }
public void DrawGhost(IntVec3 origin) { IntVec3 cell = origin + Position; if (_thingDef != null) { // normal thingdef graphic if (_thingDef.graphicData.linkFlags == LinkFlags.None) { GhostDrawer.DrawGhostThing(cell, _rotation, _thingDef, null, Resources.ghostColor(CanPlace(origin)), AltitudeLayer.Blueprint); } // linked thingdef graphic else { Material material; Color color = Resources.ghostColor(CanPlace(origin)); int hash = color.GetHashCode() * _rotation.GetHashCode(); if (!_cachedMaterials.TryGetValue(hash, out material)) { // get a colored version (ripped from GhostDrawer.DrawGhostThing) Graphic_Linked graphic = (Graphic_Linked)_thingDef.graphic.GetColoredVersion(ShaderDatabase.Transparent, color, Color.white); // atlas contains all possible link graphics Material atlas = graphic.MatSingle; // loop over cardinal directions, and set the correct bits (e.g. 1, 2, 4, 8). int linkInt = 0; int dirInt = 1; for (int i = 0; i < 4; i++) { if (blueprint.ShouldLinkWith(Position + GenAdj.CardinalDirections[i], _thingDef)) { linkInt += dirInt; } dirInt *= 2; } // translate int to bitmask (flags) LinkDirections linkSet = (LinkDirections)linkInt; // get and cache the final material material = MaterialAtlasPool.SubMaterialFromAtlas(atlas, linkSet); _cachedMaterials.Add(hash, material); } // draw the thing. Vector3 position = (cell).ToVector3ShiftedWithAltitude(AltitudeLayer.MetaOverlays); Graphics.DrawMesh(MeshPool.plane10, position, Quaternion.identity, material, 0); } } else { Vector3 position = (cell).ToVector3ShiftedWithAltitude(AltitudeLayer.MetaOverlays); Graphics.DrawMesh(MeshPool.plane10, position, Quaternion.identity, Resources.ghostFloorMaterial(CanPlace(origin)), 0); } }
public override void Draw() { base.Draw(); DropShipUtility.DrawDropSpotShadow(this, this.drawTickOffset); if (Find.Targeter.IsTargeting && Find.Selector.IsSelected(this)) { GhostDrawer.DrawGhostThing(UI.MouseCell(), this.Rotation, this.def, null, new Color(0.5f, 1f, 0.6f, 0.4f), AltitudeLayer.Blueprint); } }
protected virtual void DrawGhost(Color ghostCol) { ThingDef def; if ((def = (PlacingDef as ThingDef)) != null) { MeditationUtility.DrawMeditationFociAffectedByBuildingOverlay(base.Map, def, Faction.OfPlayer, UI.MouseCell(), placingRot); } GhostDrawer.DrawGhostThing(UI.MouseCell(), placingRot, (ThingDef)PlacingDef, null, ghostCol, AltitudeLayer.Blueprint); }
public override void Tick() { base.Tick(); this.pather.PatherTick(); if (this.IsTargeting) { GhostDrawer.DrawGhostThing(UI.MouseCell(), this.WorldShipData[0].Ship.Rotation, this.WorldShipData[0].Ship.def, null, new Color(0.5f, 1f, 0.6f, 0.4f), AltitudeLayer.Blueprint); } this.BurnFuel(); }
protected override void DrawGhost(Color ghostCol) { ThingDef def; if ((def = (PlacingDef as ThingDef)) != null) { MeditationUtility.DrawMeditationFociAffectedByBuildingOverlay(base.Map, def, Faction.OfPlayer, UI.MouseCell(), placingRot); } Graphic baseGraphic = ThingToInstall.Graphic.ExtractInnerGraphicFor(ThingToInstall); GhostDrawer.DrawGhostThing(UI.MouseCell(), placingRot, (ThingDef)PlacingDef, baseGraphic, ghostCol, AltitudeLayer.Blueprint, ThingToInstall); }
public override void Tick() { base.Tick(); if (Find.Targeter.IsTargeting) { if (this.isTargeting) { GhostDrawer.DrawGhostThing(UI.MouseCell(), this.ships[0].Rotation, this.ships[0].def, null, new Color(0.5f, 1f, 0.6f, 0.4f), AltitudeLayer.Blueprint); } } else { this.isTargeting = false; } }
public override void TargeterUpdate() { ticksOpen++; LocalTargetInfo localTargetInfo = CurrentTargetUnderMouse(); if (localTargetInfo.IsValid) { IntVec3 cell = localTargetInfo.Cell; Vector3 position = new Vector3(cell.x, AltitudeLayer.Building.AltitudeFor(), cell.z).ToIntVec3().ToVector3Shifted(); VehiclePawn vehicleAtPos = MapHelper.VehicleInPosition(vehicle, Current.Game.CurrentMap, localTargetInfo.Cell, landingRotation); Color color = (vehicleAtPos != vehicle && MapHelper.VehicleBlockedInPosition(vehicle, Current.Game.CurrentMap, localTargetInfo.Cell, landingRotation)) || (targetValidator != null && !targetValidator(localTargetInfo)) ? Designator_Place.CannotPlaceColor : Designator_Place.CanPlaceColor; color.a = (Mathf.PingPong(ticksOpen, PingPongTickLength / 1.5f) / PingPongTickLength) + 0.25f; GhostDrawer.DrawGhostThing(cell, landingRotation, vehicle.VehicleDef.buildDef, vehicle.VehicleDef.buildDef.graphic, color, AltitudeLayer.Blueprint); } }
public override void Tick() { base.Tick(); if (Find.Targeter.IsTargeting || Find.WorldTargeter.IsTargeting) { if (this.isTargeting) { GhostDrawer.DrawGhostThing(UI.MouseCell(), this.Rotation, this.def, null, new Color(0.5f, 1f, 0.6f, 0.4f), AltitudeLayer.Blueprint); } } else { this.isTargeting = false; } for (int i = 0; i < DropShipUtility.AllPawnsInShip(this).Count; i++) { Pawn pawn = DropShipUtility.AllPawnsInShip(this)[i]; float num = 0.6f; float num2 = RestUtility.PawnHealthRestEffectivenessFactor(pawn); num = 0.7f * num + 0.3f * num * num2; pawn.needs.rest.TickResting(num); } if (this.shipState == ShipState.Incoming) { this.drawTickOffset--; if (this.drawTickOffset <= 0) { this.drawTickOffset = 0; } this.refuelableComp.ConsumeFuel(this.refuelableComp.Props.fuelConsumptionRate / 60f); } if (ReadyForTakeoff && ActivatedLaunchSequence) { this.timeToLiftoff--; if (this.ShouldWait) { int num = GenDate.TicksPerHour; this.timeToLiftoff += num; this.timeWaited += num; if (this.timeWaited >= maxTimeToWait) { this.ShouldWait = false; this.timeToLiftoff = 0; } } if (this.timeToLiftoff == 0) { this.shipState = ShipState.Outgoing; this.ActivatedLaunchSequence = false; this.timeWaited = 0; } } if (shipState == ShipState.Outgoing) { this.drawTickOffset++; this.refuelableComp.ConsumeFuel(this.refuelableComp.Props.fuelConsumptionRate / 60f); if (this.Spawned) { ShipBase_Traveling travelingShip = new ShipBase_Traveling(this); GenSpawn.Spawn(travelingShip, this.Position, this.Map); this.DeSpawn(); } } }
protected override void DrawGhost(Color ghostCol) { Graphic baseGraphic = ThingToInstall.Graphic.ExtractInnerGraphicFor(ThingToInstall); GhostDrawer.DrawGhostThing(UI.MouseCell(), placingRot, (ThingDef)PlacingDef, baseGraphic, ghostCol, AltitudeLayer.Blueprint); }
protected virtual void DrawGhost(Color ghostCol) { GhostDrawer.DrawGhostThing(UI.MouseCell(), this.placingRot, (ThingDef)this.PlacingDef, null, ghostCol, AltitudeLayer.Blueprint); }
private static bool TargetValidator(IntVec3 c, Map map, CompTargetable_Tent t) { if (!c.InBounds(map) || !c.Standable(map)) { return(false); } if (!c.Walkable(map)) { return(false); } t.HandleRotation(); t.GetPlacements(c); CellRect cellRect = new CellRect(c.x - 2, c.z - 2, 5, 4); List <IntVec3> clist = new List <IntVec3>(); Color color = new Color(1f, 1f, 1f, 0.4f); List <IntVec3> everything = new List <IntVec3>(); everything.AddRange(t.wallCells); everything.AddRange(t.doorCells); foreach (IntVec3 current in everything) { if (!current.InBounds(map)) { return(false); } if (!GenConstruct.CanPlaceBlueprintAt(ThingDefOf.Wall, current, Rot4.North, map, false, null).Accepted) { color = new Color(1f, 0f, 0f, 0.4f); } if (current.GetFirstItem(map) != null || current.GetFirstPawn(map) != null || current.GetFirstHaulable(map) != null) { color = new Color(1f, 0f, 0f, 0.4f); } Building building = current.GetFirstBuilding(map); if (building != null) { if (building.def.IsEdifice()) { color = new Color(1f, 0f, 0f, 0.4f); } } Plant plant = current.GetPlant(map); if (plant != null) { if (plant.def.plant.IsTree) { color = new Color(1f, 0f, 0f, 0.4f); } } } foreach (IntVec3 doorCell in t.doorCells) { GhostDrawer.DrawGhostThing(doorCell, t.placingRot, ThingDef.Named("TentDoor"), null, color, AltitudeLayer.Blueprint); } GenDraw.DrawFieldEdges(t.wallCells, color); return(true); }
protected virtual void DrawGhost(Color ghostCol) { #pragma warning disable CS0618 GhostDrawer.DrawGhostThing(UI.MouseCell(), Rot4.North, stuffDef, null, ghostCol, AltitudeLayer.Blueprint); #pragma warning restore CS0618 }
public override void Tick() { base.Tick(); if (Find.Targeter.IsTargeting || Find.WorldTargeter.IsTargeting) { if (this.IsTargeting) { GhostDrawer.DrawGhostThing(UI.MouseCell(), this.Rotation, this.def, null, new Color(0.5f, 1f, 0.6f, 0.4f), AltitudeLayer.Blueprint); } } else { this.IsTargeting = false; } for (int i = 0; i < DropShipUtility.AllPawnsInShip(this).Count; i++) { Pawn pawn = DropShipUtility.AllPawnsInShip(this)[i]; float num = 0.6f; num = 0.7f * num + 0.3f * num; pawn.needs.rest.TickResting(num); } if (this.shipState == ShipState.Incoming) { this.drawTickOffset--; if (this.drawTickOffset <= 0) { this.drawTickOffset = 0; } this.ConsumeFuel(); } if (ReadyForTakeoff && ActivatedLaunchSequence) { this.timeToLiftoff--; if (this.ShouldWait) { int num = GenDate.TicksPerHour; this.timeToLiftoff += num; this.timeWaited += num; if (this.timeWaited >= maxTimeToWait) { this.ShouldWait = false; this.timeToLiftoff = 0; } } if (this.timeToLiftoff == 0) { this.shipState = ShipState.Outgoing; this.ActivatedLaunchSequence = false; this.timeWaited = 0; } } if (shipState == ShipState.Outgoing) { this.drawTickOffset++; this.ConsumeFuel(); if (this.Spawned) { ShipBase_Traveling travelingShip = new ShipBase_Traveling(this, this.LaunchAsFleet, ShipArrivalAction.StayOnWorldMap); Map curMap = this.Map; IntVec3 curPos = this.Position; //GenSpawn.Spawn(travelingShip, curPos, curMap, this.Rotation, false); this.DeSpawn(); //Log.Message(GenAdj.CellsOccupiedBy(curPos, Rot4.North, def.Size).Count().ToString()); //foreach (IntVec3 current in GenAdj.CellsOccupiedBy(curPos, Rot4.North, def.Size)) //{ // Log.Message("A: " + curMap.thingGrid.ThingsAt(current).ToList<Thing>().Count.ToString()); // foreach (Thing current2 in curMap.thingGrid.ThingsAt(current).ToList<Thing>()) // { // if (current2.def == null) Log.Message("NoDef?"); // Log.Message("B"); // if (GenSpawn.SpawningWipes(def, current2.def)) // { // Log.Message("Destroyng:" + current2.Label); // current2.Destroy(DestroyMode.Vanish); // } // } //} GenSpawn.Spawn(travelingShip, curPos, curMap, this.Rotation, WipeMode.Vanish, false); } } }
public override void DrawGhost(IntVec3 at, Color color) { GhostDrawer.DrawGhostThing(at, rot, def, def.graphic, color, AltitudeLayer.Blueprint); }
protected virtual void DrawGhost(Color ghostCol) { GhostDrawer.DrawGhostThing(UI.MouseCell(), Rot4.North, stuffDef, null, ghostCol, AltitudeLayer.Blueprint); }