public static bool ModifyCarriedThingDrawPosWorker(ref Vector3 drawPos, ref bool behind, ref bool flip, IntVec3 placeCell, Pawn pawn) { if (pawn.pather.Moving) { return(false); } Thing carriedThing = pawn.carryTracker.CarriedThing; if (carriedThing == null || !carriedThing.IngestibleNow) { return(false); } if (placeCell.IsValid && placeCell.AdjacentToCardinal(pawn.Position) && placeCell.HasEatSurface(pawn.Map) && carriedThing.def.ingestible.ingestHoldUsesTable) { drawPos = new Vector3((float)placeCell.x + 0.5f, drawPos.y, (float)placeCell.z + 0.5f); return(true); } if (carriedThing.def.ingestible.ingestHoldOffsetStanding != null) { HoldOffset holdOffset = carriedThing.def.ingestible.ingestHoldOffsetStanding.Pick(pawn.Rotation); if (holdOffset != null) { drawPos += holdOffset.offset; behind = holdOffset.behind; flip = holdOffset.flip; return(true); } } return(false); }
// Mostly copied from JobDriver_Ingest public override bool ModifyCarriedThingDrawPos(ref Vector3 drawPos, ref bool behind, ref bool flip) { var placeCell = job.GetTarget(SpotIndex).Cell; if (pawn.pather.Moving) { return(false); } Thing carriedThing = pawn.carryTracker.CarriedThing; if (carriedThing == null || !carriedThing.IngestibleNow) { return(false); } if (placeCell.IsValid && placeCell.AdjacentToCardinal(pawn.Position) && placeCell.HasEatSurface(pawn.Map) && carriedThing.def.ingestible.ingestHoldUsesTable) { drawPos = new Vector3((placeCell.x + pawn.Position.x) * 0.5f + 0.5f, drawPos.y, (placeCell.z + pawn.Position.z) * 0.5f + 0.5f); behind = pawn.Rotation != Rot4.South; return(true); } if (carriedThing.def.ingestible.ingestHoldOffsetStanding != null) { HoldOffset holdOffset = carriedThing.def.ingestible.ingestHoldOffsetStanding.Pick(pawn.Rotation); if (holdOffset != null) { drawPos += holdOffset.offset; behind = holdOffset.behind; flip = holdOffset.flip; return(true); } } return(false); }
public void ApplyStats(HoldOffset to) { to.flip = this.flip; to.behind = this.behind; if (this.offset != null) { to.offset = this.offset.ToVector3(); } }
public HoldOffsetStats(HoldOffset s) { if (s.offset != null) { this.offset = new Vector3Stats(s.offset); } this.flip = s.flip; this.behind = s.behind; }