Ejemplo n.º 1
0
        protected float GetAltitudeOffset(Rot4 rotation)
        {
            VisibleAccessoryDefExtension myDef = def.GetModExtension <VisibleAccessoryDefExtension>() ?? new VisibleAccessoryDefExtension();

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

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

            string direction;

            if (!onHead)
            {
                if (rotation == Rot4.North)
                {
                    offset += _BodyOffset;
                    if (myDef.northtop)
                    {
                        offset += _HairOffset;
                    }
                    else
                    {
                        offset += myDef.NorthOffset;
                    }
                    direction = "North";
                }
                else if (rotation == Rot4.West)
                {
                    offset   += _BodyOffset;
                    offset   += myDef.WestOffset;
                    direction = "West";
                }
                else if (rotation == Rot4.East)
                {
                    offset   += _BodyOffset;
                    offset   += myDef.EastOffset;
                    direction = "East";
                }
                else if (rotation == Rot4.South)
                {
                    offset   += _BodyOffset;
                    offset   += myDef.SouthOffset;
                    direction = "South";
                }
                else
                {
                    offset   += _BodyOffset;
                    direction = "Unknown";
                }
            }
            else
            {
                if (rotation == Rot4.North)
                {
                    offset   += _BodyOffset;
                    direction = "North";
                }
                else
                {
                    offset += _HeadOffset;
                }
                direction = "Other";
            }

            /*
             * if (Wearer.Map!=null)
             * {
             *  bool flag = Find.Selector.SingleSelectedThing == Wearer;
             *  if (flag)
             *  {
             *      Log.Message(string.Format("{0}'s {1}, {2} offset: {3}, DrawPos.y: {4}", this.Wearer.Label, this.def.label, direction, offset, Wearer.Drawer.DrawPos.y));
             *  }
             * }
             */
            return(offset);
        }
        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);
        }