public static bool CanDesignateThing_Prefix(ref Thing t, ref AcceptanceReport __result)
        {
            CompHiddenable cmp = t.TryGetCompHiddenable();

            if (cmp != null && cmp.hidden)
            {
                __result = false;
                return(false);
            }

            return(true);
        }
Example #2
0
 public static bool fowIsVisible(this Thing _this, bool forRender = false)
 {
     if (_this.Spawned)
     {
         if (_this.def.isSaveable && !_this.def.saveCompressible)
         {
             CompHiddenable comp = _this.TryGetCompHiddenable();
             if (comp != null)
             {
                 return(!comp.hidden);
             }
         }
         return(forRender || (_this.Map != null && _this.fowInKnownCell()));
     }
     return(true);
 }
        private void performSetup()
        {
            if (!setup)
            {
                setup = true;

                // Init sub-components.
                ThingCategory thingCategory = parent.def.category;

                compComponentsPositionTracker               = new CompComponentsPositionTracker();
                compComponentsPositionTracker.parent        = parent;
                compComponentsPositionTracker.mainComponent = this;

                compHiddenable               = new CompHiddenable();
                compHiddenable.parent        = parent;
                compHiddenable.mainComponent = this;

                compHideFromPlayer               = new CompHideFromPlayer();
                compHideFromPlayer.parent        = parent;
                compHideFromPlayer.mainComponent = this;

                if (thingCategory == ThingCategory.Building)
                {
                    compViewBlockerWatcher               = new CompViewBlockerWatcher();
                    compViewBlockerWatcher.parent        = parent;
                    compViewBlockerWatcher.mainComponent = this;
                }
                if (thingCategory == ThingCategory.Pawn ||
                    thingCategory == ThingCategory.Building)
                {
                    compFieldOfViewWatcher               = new CompFieldOfViewWatcher();
                    compFieldOfViewWatcher.parent        = parent;
                    compFieldOfViewWatcher.mainComponent = this;
                }
            }
        }