public float WestOffset(ExtraPartEntry Entry)
 {
     if (Entry.WestOffset != 0)
     {
         return(Entry.WestOffset);
     }
     return(this.pprops.WestOffset);
 }
 public float SouthOffset(ExtraPartEntry Entry)
 {
     if (Entry.SouthOffset != 0)
     {
         return(Entry.SouthOffset);
     }
     return(this.pprops.SouthOffset);
 }
        public float NorthOffset(ExtraPartEntry Entry)
        {
            float result = 0;

            if (Entry.NorthOffset != 0)
            {
                result += Entry.NorthOffset;
                return(result);
            }
            result += this.pprops.NorthOffset;
            return(this.pprops.NorthOffset);
        }
 public override void PostSpawnSetup(bool respawningAfterLoad)
 {
     base.PostSpawnSetup(respawningAfterLoad);
     if (!this.pprops.ExtrasEntries.NullOrEmpty())
     {
         extraPartEntry          = this.pprops.ExtrasEntries.RandomElementByWeight((ExtraPartEntry x) => x.commonality);
         this.extraGraphicPath   = extraPartEntry.extraTexPath;
         this.shader             = ShaderDatabase.LoadShader(extraPartEntry.shaderType.shaderPath);
         this.useSecondaryColor  = extraPartEntry.UseSecondaryColor;
         this.ExtraUseBodyOffset = extraPartEntry.UseBodytypeOffsets;
     }
     pauldronInitialized = true;
 }
        public float GetAltitudeOffset(Rot4 rotation, ExtraPartEntry partEntry)
        {
            VisibleAccessoryDefExtension myDef = parent.def.GetModExtension <VisibleAccessoryDefExtension>() ?? new VisibleAccessoryDefExtension();

            myDef.Validate();
            float offset = _OffsetFactor * myDef.order;

            offset = offset + (_SubOffsetFactor * myDef.sublayer);

            bool   flag = Find.Selector.SingleSelectedThing == pawn && Prefs.DevMode && DebugSettings.godMode;
            string direction;

            if (!onHead)
            {
                if (rotation == Rot4.North)
                {
                    offset += _BodyOffset;
                    if (myDef.northtop)
                    {
                        offset += _HairOffset;
                        offset += NorthOffset(partEntry);
                    }
                    else
                    {
                        offset += myDef.NorthOffset;
                        offset += NorthOffset(partEntry);
                    }
                    direction = "North";
                }
                else if (rotation == Rot4.West)
                {
                    offset   += _BodyOffset;
                    offset   += myDef.WestOffset;
                    offset   += WestOffset(partEntry);
                    direction = "West";
                }
                else if (rotation == Rot4.East)
                {
                    offset   += _BodyOffset;
                    offset   += myDef.EastOffset;
                    offset   += EastOffset(partEntry);
                    direction = "East";
                }
                else if (rotation == Rot4.South)
                {
                    offset   += _BodyOffset;
                    offset   += myDef.SouthOffset;
                    offset   += SouthOffset(partEntry);
                    direction = "South";
                }
                else
                {
                    offset   += _BodyOffset;
                    direction = "Unknown";
                }
            }
            else
            {
                if (rotation == Rot4.North)
                {
                    offset   += _BodyOffset;
                    direction = "North";
                }
                else
                {
                    offset += _HeadOffset;
                }
                direction = "Other";
            }
            if (flag)
            {
                //    Log.Message(string.Format("{0}'s {1}, {2} offset: {3}, DrawPos.y: {4}", this.pawn.Label, parent.def.label, direction, offset, pawn.Drawer.DrawPos.y));
            }

            return(offset);
        }