Example #1
0
        public static void DrawLinesToPotentialThingsToLinkTo(ThingDef myDef, IntVec3 myPos, Rot4 myRot, Map map)
        {
            nearDrowingList.Clear();
            Vector3 pointingPos = GenThing.TrueCenter(myPos, myRot, myDef.size, myDef.Altitude);

            foreach (Thing thing in GenRadial.RadialDistinctThingsAround(myPos, map, range, true))
            {
                CompResonancePowerPlant comp = thing.TryGetComp <CompResonancePowerPlant>();
                if (comp != null)
                {
                    nearDrowingList.Add(comp);
                }
            }
            foreach (Thing thing in GenRadial.RadialDistinctThingsAround(myPos + myRot.FacingCell, map, range, true))
            {
                CompResonancePowerPlant comp = thing.TryGetComp <CompResonancePowerPlant>();
                if (comp != null)
                {
                    nearDrowingList.Add(comp);
                }
            }
            foreach (CompResonancePowerPlant comp in nearDrowingList)
            {
                if (comp.CanBeActive)
                {
                    GenDraw.DrawLineBetween(pointingPos, comp.parent.TrueCenter());
                }
                else
                {
                    GenDraw.DrawLineBetween(pointingPos, comp.parent.TrueCenter(), CompAffectedByFacilities.InactiveFacilityLineMat);
                }
            }
        }
Example #2
0
        // Verse.GhostDrawer
        public static bool HeronDoorGhostHandler(IntVec3 center, Rot4 rot, ThingDef thingDef, Graphic baseGraphic,
                                                 Color ghostCol, AltitudeLayer drawAltitude)
        {
            if (thingDef is DoorExpandedDef def && def.fixedPerspective)
            {
                Graphic graphic = GhostUtility.GhostGraphicFor(baseGraphic, thingDef, ghostCol);
                //Graphic graphic = Traverse.Create(typeof(GhostDrawer)).Method("GhostGraphicFor", new object[] { thingDef.graphic, thingDef, ghostCol }).GetValue<Graphic>();
                Vector3 loc = GenThing.TrueCenter(center, rot, thingDef.Size, drawAltitude.AltitudeFor());

                for (int i = 0; i < 2; i++)
                {
                    bool flipped = (i != 0) ? true : false;
                    Building_DoorExpanded.DrawParams(def, loc, rot, out var mesh, out var matrix, mod: 0,
                                                     flipped: flipped);
                    Graphics.DrawMesh(mesh: mesh, matrix: matrix, material: graphic.MatAt(rot: rot, thing: null),
                                      layer: 0);
                }

                if (thingDef?.PlaceWorkers?.Count > 0)
                {
                    for (int i = 0; i < thingDef.PlaceWorkers.Count; i++)
                    {
                        thingDef.PlaceWorkers[index : i]
                        .DrawGhost(def : thingDef, center : center, rot : rot, ghostCol : ghostCol);
                    }
                }

                return(false);
            }

            return(true);
        }
        public override void DrawGhost(ThingDef def, IntVec3 loc, Rot4 rot, Color ghostCol)
        {
            Graphic baseGraphic = GraphicDatabase.Get <Graphic_Single>("Things/Building/Security/ProjectorTower_ProjectorOff", ShaderDatabase.Cutout, new Vector2(3.5f, 3.5f), Color.white);
            Graphic graphic     = GhostUtility.GhostGraphicFor(baseGraphic, def, ghostCol);

            graphic.DrawFromDef(GenThing.TrueCenter(loc, rot, def.Size, AltitudeLayer.MetaOverlays.AltitudeFor()), rot, def, 0f);
        }
        public override void LordJobTick()
        {
            base.LordJobTick();


            var alter = spot.GetFirstThing <Building_SkavenAlter>(Map);

            if (alter == null)
            {
                return;
            }

            Rand.PushState(alter.thingIDNumber);
            try
            {
                foreach (IntVec3 cell in alter.PeripheralCells)
                {
                    var pos = GenThing.TrueCenter(cell, alter.Rotation, alter.RotatedSize, alter.def.Altitude);
                    CellRenderer.RenderSpot(pos, Rand.Range(0, 1f));
                }
            }
            finally
            {
                Rand.PopState();
            }
        }
Example #5
0
 public override void Tick()
 {
     if (this.destroyTick <= Find.TickManager.TicksGame)
     {
         this.Destroy(DestroyMode.Vanish);
     }
     this.graphicRotation += this.graphicRotationSpeed;
     if (!this.DestroyedOrNull())
     {
         Map     map      = base.Map;
         IntVec3 position = base.Position;
         if (Find.TickManager.TicksGame % 10 == 0)
         {
             FleckMaker.ThrowSmoke(GenThing.TrueCenter(this) + new Vector3(0f, 0f, 0.1f), map, 1f);
         }
         if (Find.TickManager.TicksGame % 300 == 0)
         {
             OPBombardment opbombardment = (OPBombardment)GenSpawn.Spawn(DefDatabase <ThingDef> .GetNamed("OPBombardment", true), position, map, WipeMode.Vanish);
             opbombardment.duration   = 120;
             opbombardment.instigator = this;
             opbombardment.weaponDef  = ThingDefOf.OrbitalTargeterBombardment;
             opbombardment.StartStrike();
             if (!this.DestroyedOrNull())
             {
                 this.Destroy(DestroyMode.Vanish);
             }
         }
     }
 }
 public static bool Patch_Pawn_PreApplyDamage_Prefix(
     ref Pawn __instance,
     ref DamageInfo dinfo,
     out bool absorbed)
 {
     if (((DamageInfo) ref dinfo).get_Def() != DamageDefOf.SurgicalCut && ((DamageInfo) ref dinfo).get_Def() != DamageDefOf.ExecutionCut && ((DamageInfo) ref dinfo).get_Def() != DamageDefOf.EMP && ((DamageInfo) ref dinfo).get_Def() != DamageDefOf.Stun && __instance.health != null && ((HediffSet)((Pawn_HealthTracker)__instance.health).hediffSet).HasHediff(MFHediffDefOf.MFBastionHigh, false) && ((HediffSet)((Pawn_HealthTracker)__instance.health).hediffSet).GetFirstHediffOfDef(MFHediffDefOf.MFBastionHigh, false) is ShieldHediff firstHediffOfDef)
     {
         if (firstHediffOfDef.broken)
         {
             firstHediffOfDef.ResetBrokenCooldown();
         }
         else if (firstHediffOfDef.AbsorbDamage(dinfo))
         {
             if (firstHediffOfDef.broken)
             {
                 SoundStarter.PlayOneShot((SoundDef)SoundDefOf.EnergyShield_Broken, SoundInfo.op_Implicit(new TargetInfo(((Thing)__instance).get_Position(), ((Thing)__instance).get_Map(), false)));
                 MoteMaker.MakeStaticMote(GenThing.TrueCenter((Thing)__instance), ((Thing)__instance).get_Map(), (ThingDef)ThingDefOf.Mote_ExplosionFlash, 12f);
             }
             else
             {
                 SoundStarter.PlayOneShot((SoundDef)SoundDefOf.EnergyShield_AbsorbDamage, SoundInfo.op_Implicit(new TargetInfo(((Thing)__instance).get_Position(), ((Thing)__instance).get_Map(), false)));
                 MoteMaker.MakeStaticMote(GenThing.TrueCenter((Thing)__instance), ((Thing)__instance).get_Map(), (ThingDef)ThingDefOf.Mote_ExplosionFlash, 6f);
             }
             if (!firstHediffOfDef.broken)
             {
                 firstHediffOfDef.ResetHitCooldown();
             }
             absorbed = true;
             return(false);
         }
     }
     absorbed = false;
     return(true);
 }
Example #7
0
        public static void DrawDropSpotShadow(ShipBase ship, int ticks, ShipBase_Traveling travelingShip = null)
        {
            if (ticks < 0)
            {
                ticks = 0;
            }

            Vector3 result = GenThing.TrueCenter(ship);

            if (travelingShip != null)
            {
                result = travelingShip.Position.ToVector3ShiftedWithAltitude(AltitudeLayer.Skyfaller);
            }
            result  += DropShipUtility.drawOffsetFor(ship, ticks, true);
            result.y = Altitudes.AltitudeFor(AltitudeLayer.Shadows);

            Color white = Color.white;

            white.a = Mathf.InverseLerp(200f, 150f, (float)ticks);

            DropShipUtility.shadowPropertyBlock.SetColor(Shader.PropertyToID("Cutout"), white);
            Matrix4x4 matrix = default(Matrix4x4);

            matrix.SetTRS(result, ship.compShip.parent.Rotation.AsQuat, new Vector3(1f, 1f, 1f));
            Graphics.DrawMesh(ship.compShip.parent.Graphic.MeshAt(ship.compShip.parent.Rotation), matrix, ship.compShip.dropShadow.MatSingle, 0, null, 0, DropShipUtility.shadowPropertyBlock);
        }
 public override void PostDraw()
 {
     base.PostDraw();
     if (ShowNow)
     {
         this.Graphic.Draw(GenThing.TrueCenter(this.parent.Position, this.parent.Rotation, this.parent.def.size, this.Props.Altitude), this.parent.Rotation, this.parent);
     }
 }
Example #9
0
 public override void PostDraw()
 {
     if (parent.Rotation == Rot4.South)
     {
         this.Graphic.Draw(GenThing.TrueCenter(this.parent.Position, this.parent.Rotation, this.parent.def.size, Props.Altitude), this.parent.Rotation, this.parent, 0f);
         return;
     }
 }
Example #10
0
        public static Vector3 ThrowResult(Thing Caster, Thing thingToPush, int pushDist, out bool collision)
        {
            Vector3 vector = GenThing.TrueCenter(thingToPush);
            Vector3 result = vector;
            bool    flag   = false;


            /*
             * int num = pushDist;
             * int num2 = pushDist;
             * if (vector.x > GenThing.TrueCenter(Caster).x)
             * {
             *  num2 = -num2;
             * }
             * if (vector.z > GenThing.TrueCenter(Caster).z)
             * {
             *  num = -num;
             * }
             * if (vector.x == GenThing.TrueCenter(Caster).x)
             * {
             *  num2 = 0;
             * }
             * if (vector.z == GenThing.TrueCenter(Caster).z)
             * {
             *  num = 0;
             * }
             *
             * num += Rand.RangeInclusive(-pushDist, pushDist) / (num != 0 ? 3 : 2);
             * num2 += Rand.RangeInclusive(-pushDist, pushDist) / (num2 != 0 ? 3 : 2);
             */

            //    Vector3 vector2 = new Vector3(vector.x + (float)num2, 0f, vector.z + (float)num);

            Pawn  caster = Caster as Pawn;
            float num    = 0f;

            if ((thingToPush.DrawPos - caster.DrawPos).MagnitudeHorizontalSquared() > 0.001f)
            {
                num = (thingToPush.DrawPos - caster.DrawPos).AngleFlat();
            }

            IntVec3 vector2 = GenerateShrapnelLocation(caster.Position, num, pushDist);

            if (RCellFinder.TryFindRandomCellNearWith(vector2, x => GenSight.LineOfSight(caster.Position, x, Caster.Map) && GenGrid.Standable(x, Caster.Map), Caster.Map, out vector2))
            {
                result = vector2.ToVector3Shifted();
            }
            else
            {
                if (thingToPush is Pawn)
                {
                    flag = true;
                }
            }
            collision = flag;
            return(result);
        }
        // Token: 0x0600000B RID: 11 RVA: 0x000024A4 File Offset: 0x000006A4
        public override void TickRare()
        {
            base.TickRare();
            bool shouldSendAlert = this.shouldSendAlert;

            if (shouldSendAlert)
            {
                MoteMaker.ThrowMetaIcon(IntVec3Utility.ToIntVec3(GenThing.TrueCenter(this)), base.Map, ThingDefOf.Mote_IncapIcon);
            }
        }
Example #12
0
        // Token: 0x060000BC RID: 188 RVA: 0x00009754 File Offset: 0x00007954
        private void Initialize()
        {
            bool spawned = base.Pawn.Spawned;
            bool flag    = spawned && base.Pawn.Map != null;

            if (flag)
            {
                MoteMaker.ThrowLightningGlow(GenThing.TrueCenter(base.Pawn), base.Pawn.Map, 3f);
            }
        }
Example #13
0
 public override void PostDraw()
 {
     if (drawOnlySouth && parent.Rotation == Rot4.South)
     {
         Graphic.Draw(GenThing.TrueCenter(parent.Position, parent.Rotation, parent.def.size, Props.Altitude), parent.Rotation, parent, 0f);
     }
     else
     {
         Graphic.Draw(GenThing.TrueCenter(parent.Position, parent.Rotation, parent.def.size, Props.Altitude), parent.Rotation, parent, 0f);
     }
 }
 /// <summary>
 /// 绘制
 /// </summary>
 public override void PostDraw()
 {
     base.PostDraw();
     if (Props.gas == null || Props.gas.Count == 0)
     {
         return;
     }
     for (int i = 0; i < Props.gas.Count; i++)
     {
         Props.gas[i].graphicData.Graphic.Draw(GenThing.TrueCenter(parent.Position, parent.Rotation, parent.def.size, Props.gas[i].altitudeLayer.AltitudeFor()), parent.Rotation, parent, 0f);
     }
 }
Example #15
0
 public static void DrawGhostVehicle(IntVec3 center, Rot8 rot, ThingDef thingDef, Graphic baseGraphic, Color ghostCol, AltitudeLayer drawAltitude, Thing thing = null)
 {
     if (thingDef is VehicleBuildDef def)
     {
         VehicleDef vehicleDef = def.thingToSpawn;
         if (vehicleDef.GetSortedCompProperties <CompProperties_Cannons>() is CompProperties_Cannons props)
         {
             Vector3 loc = GenThing.TrueCenter(center, rot, def.Size, drawAltitude.AltitudeFor());
             vehicleDef.DrawGhostCannonTextures(loc, rot, ghostCol);
         }
     }
 }
Example #16
0
        public static void DrawGhostThing_NewTmp(IntVec3 center, Rot4 rot, ThingDef thingDef, Graphic baseGraphic, Color ghostCol, AltitudeLayer drawAltitude,
                                                 Thing thing = null, bool drawPlaceWorkers = true)
        {
            if (baseGraphic == null)
            {
                baseGraphic = thingDef.graphic;
            }
            Graphic graphic = baseGraphic;
            Vector3 loc     = GenThing.TrueCenter(center, rot, thingDef.Size, drawAltitude.AltitudeFor());

            DrawShadow(graphic, loc, rot, thingDef);
        }
Example #17
0
        public void HitShield(Projectile proj)
        {
            this.lastInterceptAngle = Vector3Utility.AngleToFlat(proj.DrawPos, GenThing.TrueCenter(this.parent));
            this.lastIntercepted    = Find.TickManager.TicksGame;
            float dmg = proj.DamageAmount;

            if (proj.def.projectile.damageDef == DamageDefOf.EMP)
            {
                dmg *= zzShieldHurtRate_EMP;
                dmg += ShieldEnergyCurrent * zzShieldHurtRateExtra_EMP;
            }
            else if (proj.def.projectile.damageDef == DamageDefOf.Flame)
            {
                dmg *= zzShieldHurtRate_Flame;
            }

            dmg = Mathf.Max(0, dmg * zzShieldHurtRate);

            //判定为爆炸弹丸
            if (proj.def.projectile.explosionRadius != 0)
            {
                //受到伤害取决于弹丸威力*伤害半径^2
                dmg *= Mathf.Max(1f, proj.def.projectile.explosionRadius * proj.def.projectile.explosionRadius) * zzShieldHurtRate_AOE;

                MoteMaker.ThrowMicroSparks(this.parent.DrawPos, this.parent.Map);
                GenExplosion.DoExplosion(proj.Position, this.parent.Map, Mathf.Min(proj.def.projectile.explosionRadius * 0.66f, 3f),
                                         DefDatabase <DamageDef> .GetNamed("zz_ShieldExplosion", true),
                                         null, -1, -1f, null, null, null, null, null, 0f, 1, false, null, 0f, 1, 0f, false, null, null);
                //Log.Message("爆炸伤害:"+ dmg * proj.def.projectile.explosionRadius+" = "+ dmg+" * "+ proj.def.projectile.explosionRadius);
            }
            //判定为普通弹丸
            else
            {
                //还用旧的伤害效果
                //On hit effects
                MoteMaker.ThrowLightningGlow(proj.ExactPosition, this.parent.Map, 0.5f);
                //On hit sound
                ShieldManagerMapComp.HitSoundDef.PlayOneShot((SoundInfo) new TargetInfo(proj.Position, proj.Map, false));
                //Log.Message("子弹伤害:" + dmg );
            }

            if (dmg >= 0)
            {
                ShieldEnergyCurrent -= dmg;
                if (CanAddMote())
                {
                    ThrowDamageMote(dmg, parent.Map, proj.Position.ToVector3(), "-" + dmg.ToString("F0") + "/ " + ShieldEnergyCurrent.ToString("F0"));
                }
            }

            proj.Destroy();
        }
Example #18
0
        // Token: 0x06000031 RID: 49 RVA: 0x00003C28 File Offset: 0x00001E28
        public void Reset()
        {
            Pawn wearer = base.Wearer;

            if (wearer.Spawned)
            {
                SoundStarter.PlayOneShot(SoundDefOf.EnergyShield_Reset, new TargetInfo(wearer.Position, wearer.Map, false));
                MoteMaker.ThrowLightningGlow(GenThing.TrueCenter(wearer), wearer.Map, 3f);
            }
            this.ticksToReset = -1;
            this.energy       = this.EnergyOnReset;
            this.ActiveCamo   = false;
            this.CamoState    = 0;
        }
Example #19
0
        /// <summary>Called after the parent's graphic is drawn.</summary>
        public override void PostDraw()
        {
            Building_Casket chamber = (Building_Casket)parent;

            if (chamber.HasAnyContents)
            {
                foreach (Pawn pawn in chamber.GetDirectlyHeldThings().OfType <Pawn>())
                {
                    if (pawn != null)
                    {
                        pawn.Rotation = Rot4.South;
                        pawn.DrawAt(GenThing.TrueCenter(parent.Position, Rot4.South, parent.def.size, Props.Altitude) + Offset);
                    }
                }
            }
        }
        public static void _Postfix(Designator_Place __instance)
        {
            if (!TableDiner.settings.displayRing)
            {
                return;
            }

            //work our way through the tree to a thingDef, and check if it's an eat surface.
            ThingDef td = __instance.PlacingDef as ThingDef;

            if (td != null && td.surfaceType == SurfaceType.Eat)
            {
                //we draw a custom circle, because GenDraw.DrawRadiusRing is limited in it's radius.
                Graphics.DrawMesh(TableDiner.tableCircle, Matrix4x4.TRS(GenThing.TrueCenter(UI.MouseCell(), TableDiner.modInstance.lastRotation, td.size, 0) + Vector3.up * 10, Quaternion.identity, new Vector3(TableDiner.settings.tableDistance, TableDiner.settings.tableDistance, TableDiner.settings.tableDistance)), TableDinerGlobal.circleMaterialBP, 0);
            }
        }
        // Token: 0x0600002B RID: 43 RVA: 0x00002B34 File Offset: 0x00000D34
        public static bool Patch_Pawn_PreApplyDamage_Prefix(ref Pawn __instance, ref DamageInfo dinfo, out bool absorbed)
        {
            bool flag  = dinfo.Def != DamageDefOf.SurgicalCut && dinfo.Def != DamageDefOf.ExecutionCut && dinfo.Def != DamageDefOf.EMP && dinfo.Def != DamageDefOf.Stun;
            bool flag2 = flag && __instance.health != null && __instance.health.hediffSet.HasHediff(MFHediffDefOf.MFBastionHigh, false);

            if (flag2)
            {
                ShieldHediff shieldHediff = __instance.health.hediffSet.GetFirstHediffOfDef(MFHediffDefOf.MFBastionHigh, false) as ShieldHediff;
                bool         flag3        = shieldHediff != null;
                if (flag3)
                {
                    bool broken = shieldHediff.broken;
                    if (broken)
                    {
                        shieldHediff.ResetBrokenCooldown();
                    }
                    else
                    {
                        bool flag4 = shieldHediff.AbsorbDamage(dinfo);
                        bool flag5 = flag4;
                        if (flag5)
                        {
                            bool broken2 = shieldHediff.broken;
                            if (broken2)
                            {
                                SoundDefOf.EnergyShield_Broken.PlayOneShot(new TargetInfo(__instance.Position, __instance.Map, false));
                                MoteMaker.MakeStaticMote(GenThing.TrueCenter(__instance), __instance.Map, ThingDefOf.Mote_ExplosionFlash, 12f);
                            }
                            else
                            {
                                SoundDefOf.EnergyShield_AbsorbDamage.PlayOneShot(new TargetInfo(__instance.Position, __instance.Map, false));
                                MoteMaker.MakeStaticMote(GenThing.TrueCenter(__instance), __instance.Map, ThingDefOf.Mote_ExplosionFlash, 6f);
                            }
                            bool flag6 = !shieldHediff.broken;
                            if (flag6)
                            {
                                shieldHediff.ResetHitCooldown();
                            }
                            absorbed = true;
                            return(false);
                        }
                    }
                }
            }
            absorbed = false;
            return(true);
        }
        public static void RenderAnticipatedWirePieceConnecting(IntVec3 userPos, Rot4 rotation, IntVec2 thingSize, Thing transmitter)
        {
            Vector3 vector = GenThing.TrueCenter(userPos, rotation, thingSize, AltitudeLayer.MapDataOverlay.AltitudeFor());

            if (userPos != transmitter.Position)
            {
                Vector3 vector2 = transmitter.TrueCenter();
                vector2.y = AltitudeLayer.MapDataOverlay.AltitudeFor();
                Vector3    pos    = (vector + vector2) / 2f;
                Vector3    v      = vector2 - vector;
                Vector3    s      = new Vector3(1f, 1f, v.MagnitudeHorizontal());
                Quaternion q      = Quaternion.LookRotation(vector2 - vector);
                Matrix4x4  matrix = default(Matrix4x4);
                matrix.SetTRS(pos, q, s);
                Graphics.DrawMesh(MeshPool.plane10, matrix, PipeOverlayMats.MatConnectorAnticipated, 0);
            }
        }
Example #23
0
        public static Vector3 DrawPosAt(ShipBase ship, int ticks, ShipBase_Traveling travelingShip = null)
        {
            if (ticks < 0)
            {
                ticks = 0;
            }

            Vector3 result = GenThing.TrueCenter(ship);

            if (travelingShip != null)
            {
                result = GenThing.TrueCenter(travelingShip.Position, travelingShip.containingShip.Rotation, travelingShip.containingShip.def.size, Altitudes.AltitudeFor(AltitudeLayer.MetaOverlays));
            }
            result += DropShipUtility.drawOffsetFor(ship, ticks, false);

            return(result);
        }
Example #24
0
        // Token: 0x06000030 RID: 48 RVA: 0x00003B44 File Offset: 0x00001D44
        public void Break()
        {
            Pawn wearer = base.Wearer;

            if (wearer != null && (wearer?.Map) != null)
            {
                SoundStarter.PlayOneShot(SoundDefOf.EnergyShield_Broken, new TargetInfo(wearer.Position, wearer.Map, false));
                MoteMaker.MakeStaticMote(GenThing.TrueCenter(wearer), wearer.Map, ThingDefOf.Mote_ExplosionFlash, 12f);
                for (int i = 0; i < 6; i++)
                {
                    MoteMaker.ThrowDustPuff(GenThing.TrueCenter(wearer) + Vector3Utility.HorizontalVectorFromAngle((float)Rand.Range(0, 360)) * Rand.Range(0.3f, 0.6f), wearer.Map, Rand.Range(0.8f, 1.2f));
                }
            }
            this.energy       = 0f;
            this.ticksToReset = this.StartingTicksToReset;
            this.ActiveCamo   = false;
            this.CamoState    = 2;
        }
Example #25
0
        public override void DrawAt(Vector3 drawLoc, bool flip = false)
        {
            float pos = Traverse.Create(this).Property <float>("TimeInAnimation").Value;

            CompShip comp = Ship;

            if (comp == null)
            {
                return;
            }

            float num = 0f;

            if (def.skyfaller.rotateGraphicTowardsDirection)
            {
                num = angle;
            }
            if (def.skyfaller.angleCurve != null)
            {
                angle = def.skyfaller.angleCurve.Evaluate(pos);
            }
            if (def.skyfaller.rotationCurve != null)
            {
                num += def.skyfaller.rotationCurve.Evaluate(pos);
            }
            if (def.skyfaller.xPositionCurve != null)
            {
                drawLoc.x += def.skyfaller.xPositionCurve.Evaluate(pos);
            }
            if (def.skyfaller.zPositionCurve != null)
            {
                drawLoc.z += def.skyfaller.zPositionCurve.Evaluate(pos);
            }

            comp.Sprite.Draw(drawLoc, num);

            if (ShadowMaterial != null)
            {
                drawLoc.z = GenThing.TrueCenter(this).z;

                DrawDropSpotShadow(drawLoc, Rotation, ShadowMaterial, def.skyfaller.shadowSize, ticksToImpact);
            }
        }
Example #26
0
        // Token: 0x06000022 RID: 34 RVA: 0x00002BAC File Offset: 0x00000DAC
        public static void DrawGhostThing(IntVec3 center, Rot4 rot, ThingDef thingDef, Graphic ghostGraphic,
                                          AltitudeLayer drawAltitude)
        {
            var vector = GenThing.TrueCenter(center, rot, thingDef.Size, drawAltitude.AltitudeFor());

            ghostGraphic.DrawFromDef(vector, rot, thingDef);
            foreach (var compProperties in thingDef.comps)
            {
                compProperties.DrawGhost(center, rot, thingDef, ghostGraphic.Color, drawAltitude);
            }

            if (thingDef.PlaceWorkers == null)
            {
                return;
            }

            foreach (var placeWorker in thingDef.PlaceWorkers)
            {
                placeWorker.DrawGhost(thingDef, center, rot, ghostGraphic.Color);
            }
        }
Example #27
0
        public static void DrawGhostThing(IntVec3 center, Rot4 rot, ThingDef thingDef, Graphic baseGraphic, Color ghostCol, AltitudeLayer drawAltitude)
        {
            if (baseGraphic == null)
            {
                baseGraphic = thingDef.graphic;
            }
            Graphic graphic = GhostUtility.GhostGraphicFor(baseGraphic, thingDef, ghostCol);
            Vector3 loc     = GenThing.TrueCenter(center, rot, thingDef.Size, drawAltitude.AltitudeFor());

            graphic.DrawFromDef(loc, rot, thingDef, 0f);
            for (int i = 0; i < thingDef.comps.Count; i++)
            {
                thingDef.comps[i].DrawGhost(center, rot, thingDef, ghostCol, drawAltitude);
            }
            if (thingDef.PlaceWorkers != null)
            {
                for (int j = 0; j < thingDef.PlaceWorkers.Count; j++)
                {
                    thingDef.PlaceWorkers[j].DrawGhost(thingDef, center, rot, ghostCol);
                }
            }
        }
Example #28
0
        /*
         * public static void BaseHeadOffsetAtPostfix(PawnRenderer __instance, ref Vector3 __result)
         * {
         *  Pawn pawn = Traverse.Create(root: __instance).Field(name: "pawn").GetValue<Pawn>();
         *  Vector2 offset = Vector2.zero;
         *  if (pawn.InBed() && pawn.CurrentBed() is Building_XenomorphCocoon cocoonthing)
         *  {
         *      //   Log.Message(string.Format("true"));
         *      if (cocoonthing.Rotation == Rot4.North)
         *      {
         *          __result.z -= 0.5f;
         *      }
         *  }
         *  else
         *  {
         *      //   Log.Message(string.Format("false"));
         *  }
         *  __result.x += offset.x;
         *  __result.z += offset.y;
         * }
         */
        public static Vector3 PushResult(Thing Caster, Thing thingToPush, int pushDist, out bool collision)
        {
            Vector3 vector = GenThing.TrueCenter(thingToPush);
            Vector3 result = vector;
            bool    flag   = false;

            for (int i = 1; i <= pushDist; i++)
            {
                int  num   = i;
                int  num2  = i;
                bool flag2 = vector.x < GenThing.TrueCenter(Caster).x;
                if (flag2)
                {
                    num = -num;
                }
                bool flag3 = vector.z < GenThing.TrueCenter(Caster).z;
                if (flag3)
                {
                    num2 = -num2;
                }
                Vector3 vector2 = new Vector3(vector.x + (float)num, 0f, vector.z + (float)num2);
                bool    flag4   = GenGrid.Standable(IntVec3Utility.ToIntVec3(vector2), Caster.Map);
                if (flag4)
                {
                    result = vector2;
                }
                else
                {
                    bool flag5 = thingToPush is Pawn;
                    if (flag5)
                    {
                        flag = true;
                        break;
                    }
                }
            }
            collision = flag;
            return(result);
        }
Example #29
0
 /// <summary>
 ///  called after the parent's graphic is drawn
 /// </summary>
 public override void PostDraw()
 {
     Graphic.Draw(GenThing.TrueCenter(parent.Position, parent.Rotation, parent.def.size, Props.Altitude) + Offset,
                  parent.Rotation, parent);
 }
Example #30
0
 public void DrawCallOff()
 {
     GraphicOff.Draw(GenThing.TrueCenter(parent.Position, parent.Rotation, parent.def.size, Props.Altitude), parent.Rotation, parent, 0f);
 }