Exemplo n.º 1
0
        // Token: 0x06000009 RID: 9 RVA: 0x000026FC File Offset: 0x000008FC
        internal static bool IsNearThingValid(Thing NearThing, Pawn pawn)
        {
            if (!(NearThing is Building))
            {
                return(false);
            }

            if (!NearThing.def.HasModExtension <ProximityDefs>())
            {
                return(false);
            }

            if (!ProximityGet.GetProxDisabled(NearThing.def))
            {
                return(true);
            }

            if (NearThing.IsBrokenDown() || NearThing.IsForbidden(pawn))
            {
                return(false);
            }

            var compFlickable = NearThing.TryGetComp <CompFlickable>();

            if (compFlickable != null && !compFlickable.SwitchIsOn)
            {
                return(false);
            }

            var compRefuelable = NearThing.TryGetComp <CompRefuelable>();

            if (compRefuelable != null && !compRefuelable.HasFuel)
            {
                return(false);
            }

            var compPowerTrader = NearThing.TryGetComp <CompPowerTrader>();

            if (compPowerTrader != null && !compPowerTrader.PowerOn)
            {
                return(false);
            }

            return(true);
        }