Exemplo n.º 1
0
        public override void SpawnSetup(Map map, bool respawningAfterLoad)
        {
            base.SpawnSetup(map, respawningAfterLoad);
            compRefuelable = GetComp <CompBioRefuelable>();
            forbiddable    = GetComp <CompForbiddable>();
            fillpct        = 0;
            histolysisPct  = 0;
            BioReactorDef reactorDef = def as BioReactorDef;

            if (reactorDef != null)
            {
                innerDrawOffset = ((BioReactorDef)def).innerDrawOffset;
                waterDrawCenter = ((BioReactorDef)def).waterDrawCenter;
                waterDrawSize   = ((BioReactorDef)def).waterDrawSize;
            }
        }
Exemplo n.º 2
0
 public override void ExposeData()
 {
     base.ExposeData();
     Scribe_Values.Look <ReactorState>(ref state, "state");
     Scribe_Values.Look <float>(ref fillpct, "fillpct");
     Scribe_Values.Look <float>(ref histolysisPct, "histolysisPct");
     if (Scribe.mode == LoadSaveMode.PostLoadInit)
     {
         BioReactorDef reactorDef = def as BioReactorDef;
         if (reactorDef != null)
         {
             innerDrawOffset = ((BioReactorDef)def).innerDrawOffset;
             waterDrawCenter = ((BioReactorDef)def).waterDrawCenter;
             waterDrawSize   = ((BioReactorDef)def).waterDrawSize;
         }
     }
     compRefuelable = GetComp <CompBioRefuelable>();
     forbiddable    = GetComp <CompForbiddable>();
 }
Exemplo n.º 3
0
        public static bool CanRefuel(Pawn pawn, Thing t, bool forced = false)
        {
            CompBioRefuelable compRefuelable = t.TryGetComp <CompBioRefuelable>();

            if (compRefuelable == null || compRefuelable.IsFull)
            {
                return(false);
            }
            bool flag = !forced;

            if (flag && !compRefuelable.ShouldAutoRefuelNow)
            {
                return(false);
            }
            if (!t.IsForbidden(pawn))
            {
                LocalTargetInfo target = t;
                if (pawn.CanReserve(target, 1, -1, null, forced))
                {
                    if (t.Faction != pawn.Faction)
                    {
                        return(false);
                    }
                    if (FindBestFuel(pawn, t) == null)
                    {
                        ThingFilter fuelFilter = t.TryGetComp <CompBioRefuelable>().FuelFilter;
                        JobFailReason.Is("NoFuelToRefuel".Translate(fuelFilter.Summary), null);
                        return(false);
                    }
                    if (t.TryGetComp <CompBioRefuelable>().Props.atomicFueling&& FindAllFuel(pawn, t) == null)
                    {
                        ThingFilter fuelFilter2 = t.TryGetComp <CompBioRefuelable>().FuelFilter;
                        JobFailReason.Is("NoFuelToRefuel".Translate(fuelFilter2.Summary), null);
                        return(false);
                    }
                    return(true);
                }
            }
            return(false);
        }