public static void DesignatorRotate(Designator_Place designator, RotationDirection direction)
        {
            Rot4 rotation = GetDesignatorRotation(designator);

            rotation.Rotate(direction);
            SetDesignatorRotation(designator, rotation);
        }
        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);
            }
        }
Exemple #3
0
 public static void SelectedUpdate(this Designator_Place @this)
 {
     GenDraw.DrawNoBuildEdgeLines();
     if (!ArchitectCategoryTab.InfoRect.Contains(UI.MousePositionOnUIInverted))
     {
         IntVec3 intVec = UI.MouseCell();
         if (@this.PlacingDef is TerrainDef)
         {
             GenUI.RenderMouseoverBracket();
             return;
         }
         Color ghostCol;
         if (@this.CanDesignateCell(intVec).Accepted)
         {
             ghostCol = new Color(0.5f, 1f, 0.6f, 0.4f);
         }
         else
         {
             ghostCol = new Color(1f, 0f, 0f, 0.4f);
         }
         DrawGhost(@this, ghostCol);
         if (@this.CanDesignateCell(intVec).Accepted&& @this.PlacingDef.specialDisplayRadius > 0.01f)
         {
             GenDraw.DrawRadiusRing(UI.MouseCell(), @this.PlacingDef.specialDisplayRadius);
             if ((@this.PlacingDef as ThingDef)?.building?.turretGunDef?.Verbs?.FirstOrDefault()?.requireLineOfSight == true)
             {
                 var   map   = Find.VisibleMap;
                 float range = ((ThingDef)@this.PlacingDef).building.turretGunDef.Verbs[0].range;
                 foreach (var cell in GenRadial.RadialCellsAround(intVec, range, false))
                 {
                     if (GenSight.LineOfSight(intVec, cell, map, true) != GenSight.LineOfSight(cell, intVec, map, true))
                     {
                         CellRenderer.RenderCell(cell, 0f);
                     }
                     if (GenSight.LineOfSight(intVec, cell, map, true))
                     {
                         CellRenderer.RenderCell(cell, 0.6f);
                         continue;
                     }
                 }
             }
         }
         GenDraw.DrawInteractionCell((ThingDef)@this.PlacingDef, intVec, placingRotGet(@this));
     }
 }
Exemple #4
0
        static bool Prefix(ref ThingDef __result, Designator des)
        {
            Designator_Place designator_Place = des as Designator_Place;

            if (designator_Place != null)
            {
                BuildableDef placingDef = designator_Place.PlacingDef;
                if (placingDef is ThingDef && !placingDef.MadeFromStuff)
                {
                    __result = (placingDef as ThingDef);
                    return(false);
                }
                // vanilla logic
                if (placingDef.costList.Count > 0)
                {
                    __result = placingDef.costList.MaxBy((ThingDefCountClass c) => c.thingDef.BaseMarketValue * (float)c.count).thingDef;
                    return(false);
                }
            }
            __result = null;
            return(false);
        }
Exemple #5
0
 public static void SelectedUpdate_Postfix(Designator_Place __instance)
 {
     if (!ArchitectCategoryTab.InfoRect.Contains(UI.MousePositionOnUIInverted))
     {
         ThingDef thingDef = __instance.PlacingDef as ThingDef;
         if (thingDef?.defName != null)
         {
             if (thingDef.HasComp(typeof(CompGlower)) && thingDef.selectable)
             {
                 CompProperties_Glower glowerProps = thingDef.GetCompProperties <CompProperties_Glower>();
                 if (LightRadiusSettings.innerLight)
                 {
                     GenDraw.DrawRadiusRing(UI.MouseCell(), glowerProps.glowRadius * 0.91f - 2f);
                 }
                 if (LightRadiusSettings.outerLight)
                 {
                     GenDraw.DrawRadiusRing(UI.MouseCell(), glowerProps.glowRadius * 0.91f - 0.5f);
                 }
             }
         }
     }
 }
 public static Rot4 GetDesignatorRotation(Designator_Place designator)
 {
     return((Rot4)designator_place_placingRotation_FI.GetValue(designator));
 }
 public static void SetDesignatorRotation(Designator_Place designator, Rot4 rotation)
 {
     designator_place_placingRotation_FI.SetValue(designator, rotation);
 }