// Copied from PawnRenderer private Rot4 LayingFacing() { if (Wearer == null) { return(Rot4.Random); } if (Wearer.GetPosture() == PawnPosture.LayingOnGroundFaceUp) { return(Rot4.South); } if (Wearer.RaceProps.Humanlike) { switch (Wearer.thingIDNumber % 4) { case 0: return(Rot4.South); case 1: return(Rot4.South); case 2: return(Rot4.East); case 3: return(Rot4.West); } } else { switch (Wearer.thingIDNumber % 4) { case 0: return(Rot4.South); case 1: return(Rot4.East); case 2: return(Rot4.West); case 3: return(Rot4.West); } } return(Rot4.Random); }
// Token: 0x06000023 RID: 35 RVA: 0x000029F0 File Offset: 0x00000BF0 public override void Tick() { base.Tick(); if (JPCooldownTicks > 0) { JPCooldownTicks--; } if (Settings.AllowSlowBurn) { if (Wearer == null) { JPSlowBurn = false; return; } if (!JPSlowBurn || !Wearer.Spawned || Wearer.GetPosture() == PawnPosture.LayingInBed || Wearer.GetPosture() == PawnPosture.LayingOnGroundFaceUp || Wearer.GetPosture() == PawnPosture.LayingOnGroundNormal) { return; } if (JPSlowBurnTicks > 0) { JPSlowBurnTicks--; return; } if (JPFuelAmount > 0) { JPFuelAmount--; JPSlowBurnTicks = JPUtility.GetSlowBurnTicks(JPFuelItem); return; } JPSlowBurn = false; Messages.Message( "JetPack.SBOutOfFuel".Translate(Wearer.LabelShort.CapitalizeFirst(), Label.CapitalizeFirst()), Wearer, MessageTypeDefOf.NeutralEvent, false); } else { JPSlowBurn = false; } }
public override void DrawWornExtras() { if (Wearer == null || !Wearer.Spawned) { return; } Building_Bed bed = Wearer.CurrentBed(); if (bed != null && !bed.def.building.bed_showSleeperBody && !onHead) { return; } //Since I haven't a head apparel item to test the drawing code against for now we throw an error (ONCE) and exit. if (this.onHead) { Log.ErrorOnce(string.Concat("CombatExtended :: Apparel_VisibleAccessory: The head drawing code is incomplete and the apparel '", this.Label, "' will not be drawn."), this.def.debugRandomId); return; } // compute drawVec, angle and Rot4 vars Rot4 rotation; Rot4 bedRotation = new Rot4(); float angle = 0; Vector3 drawVec = Wearer.Drawer.DrawPos; if (Wearer.GetPosture() != PawnPosture.Standing) { rotation = LayingFacing(); if (bed != null) { bedRotation = bed.Rotation; bedRotation.AsInt += 2; angle = bedRotation.AsAngle; AltitudeLayer altitude = (AltitudeLayer)((byte)Mathf.Max((int)bed.def.altitudeLayer, 14)); drawVec.y = Wearer.Position.ToVector3ShiftedWithAltitude(altitude).y; drawVec += bedRotation.FacingCell.ToVector3() * (-Wearer.Drawer.renderer.BaseHeadOffsetAt(Rot4.South).z); } else { drawVec.y = Wearer.Position.ToVector3ShiftedWithAltitude(AltitudeLayer.LayingPawn).y; if (Wearer.Downed) // Wearer.Spawned == false when Pawn.Dead == true. { float?newAngle = (((((Wearer.Drawer == null) ? null : Wearer.Drawer.renderer) == null) ? null : Wearer.Drawer.renderer.wiggler) == null) ? (float?)null : Wearer.Drawer.renderer.wiggler.downedAngle; if (newAngle != null) { angle = newAngle.Value; } } else { angle = rotation.FacingCell.AngleFlat; } } drawVec.y += 0.005f; } else { rotation = Wearer.Rotation; drawVec.y = Wearer.Position.ToVector3ShiftedWithAltitude(AltitudeLayer.Pawn).y; } drawVec.y += GetAltitudeOffset(rotation); // Get the graphic path string path = def.graphicData.texPath + "_" + ((Wearer == null) ? null : Wearer.story.bodyType.ToString()); Graphic graphic = GraphicDatabase.Get <Graphic_Multi>(path, ShaderDatabase.CutoutComplex, def.graphicData.drawSize, DrawColor); ApparelGraphicRecord apparelGraphic = new ApparelGraphicRecord(graphic, this); Material mat = apparelGraphic.graphic.MatAt(rotation); Vector3 s = new Vector3(1.5f, 1.5f, 1.5f); //mat.shader = ShaderDatabase.CutoutComplex; //mat.color = DrawColor; Matrix4x4 matrix = default(Matrix4x4); matrix.SetTRS(drawVec, Quaternion.AngleAxis(angle, Vector3.up), s); Graphics.DrawMesh(rotation == Rot4.West ? MeshPool.plane10Flip : MeshPool.plane10, matrix, mat, 0); }