Пример #1
0
 public override void PostSpawnSetup(bool respawningAfterLoad)
 {
     base.PostSpawnSetup(respawningAfterLoad);
     this.stoneComp         = this.parent.GetComp <CompExtinguishable>();
     this.refuelableComp    = this.parent.GetComp <CompRefuelable>();
     this.breakdownableComp = this.parent.GetComp <CompBreakdownable>();
 }
 public override void Initialize(CompProperties props)
 {
     base.Initialize(props);
     this.Refuel(this.Props.fuelCapacity);
     //this.fuel = this.Props.fuelCapacity;
     stoneComp = this.parent.GetComp <CompExtinguishable>();
 }
Пример #3
0
 public override void SpawnSetup(Map map, bool respawningAfterLoad)
 {
     base.SpawnSetup(map, respawningAfterLoad);
     extinguishComp          = base.GetComp <CompExtinguishable>();
     lightableRefuelableComp = base.GetComp <CompLightableRefuelable>();
     this.breakdownableComp  = base.GetComp <CompBreakdownable>();
 }
        protected override IEnumerable <Toil> MakeNewToils()
        {
            //Tools.Warn("make new toil", true);

            this.FailOnDespawnedOrNull(TargetIndex.A);
            this.FailOn(delegate
            {
                CompExtinguishable compExtinguishable = null;
                compExtinguishable = job.targetA.Thing.TryGetComp <CompExtinguishable>();

                return(!(compExtinguishable != null && compExtinguishable.WantsFlick()));
            });
            yield return(Toils_Goto.GotoThing(TargetIndex.A, PathEndMode.Touch));

            yield return(Toils_General.Wait(15).FailOnCannotTouch(TargetIndex.A, PathEndMode.Touch));

            Toil finalize = new Toil();

            finalize.initAction = delegate
            {
                Pawn           actor          = finalize.actor;
                ThingWithComps thingWithComps = (ThingWithComps)actor.CurJob.targetA.Thing;
                for (int i = 0; i < thingWithComps.AllComps.Count; i++)
                {
                    //Tools.Warn("Found "+i+" comp",true);
                    if (thingWithComps.AllComps[i] is CompExtinguishable compExtinguishable && compExtinguishable.WantsFlick())
                    {
                        //Tools.Warn("found extinguish", true);
                        compExtinguishable.DoFlick();
                    }
                }
            };
            finalize.defaultCompleteMode = ToilCompleteMode.Instant;
            yield return(finalize);
        }
        /*
         * public override void PostExposeData()
         * {
         *  base.PostExposeData();
         *  Scribe_Values.Look<float>(ref this.fuel, "fuel", 0f, false);
         *  //Scribe_Values.Look<float>(ref configuredTargetFuelLevel, "configuredTargetFuelLevel", -1f, false);
         * }
         */

        public override void PostSpawnSetup(bool respawningAfterLoad)
        {
            base.PostSpawnSetup(respawningAfterLoad);
            this.stoneComp = this.parent.GetComp <CompExtinguishable>();
            LaniusMod      = ModCompatibilityCheck.LaniusIsActive;
            //this.refuelableComp = this.parent.GetComp<CompRefuelable>();
            //this.breakdownableComp = this.parent.GetComp<CompBreakdownable>();
        }
        public void SetComp()
        {
            if (parentBuilding == null)
            {
                return;
            }

            compExtinguishable      = parentBuilding.TryGetComp <CompExtinguishable>();
            compLightableRefuelable = parentBuilding.TryGetComp <CompLightableRefuelable>();
        }
Пример #7
0
        public static bool WantsToBeOn(Thing t)
        {
            CompExtinguishable compExtinguishable = t.TryGetComp <CompExtinguishable>();

            if (compExtinguishable != null && !compExtinguishable.SwitchIsOn)
            {
                return(false);
            }
            CompSchedule compSchedule = t.TryGetComp <CompSchedule>();

            return(compSchedule == null || compSchedule.Allowed);
        }
Пример #8
0
        /*
         * public override void PostExposeData()
         * {
         *  base.PostExposeData();
         *  Scribe_Values.Look<float>(ref this.fuel, "fuel", 0f, false);
         *  //Scribe_Values.Look<float>(ref configuredTargetFuelLevel, "configuredTargetFuelLevel", -1f, false);
         * }
         */

        public override void PostSpawnSetup(bool respawningAfterLoad)
        {
            base.PostSpawnSetup(respawningAfterLoad);

            extinguishableComp = parent.GetComp <CompExtinguishable>();
            //variousGlowComp = parent.GetComp<CompVariousGlow>();
            //refuelableComp = this.parent.GetComp<CompLightableRefuelable>();
            //refuelableComp = this.parent.GetComp<CompRefuelable>();
            //lastStatus = variousGlowComp.MyGlowWay(FuelPercentOfMax);
            LaniusMod = ModCompatibilityCheck.LaniusIsActive;

            //this.breakdownableComp = this.parent.GetComp<CompBreakdownable>();
        }
Пример #9
0
        //public float MyFuelPercentOfMax => FuelPercentOfMax;

        public override void Initialize(CompProperties props)
        {
            base.Initialize(props);
            //Refuel(Props.fuelCapacity);
            //this.fuel = this.Props.fuelCapacity;

            extinguishableComp = parent.GetComp <CompExtinguishable>();
            //variousGlowComp = parent.GetComp<CompVariousGlow>();
            //refuelableComp = this.parent.GetComp<CompRefuelable>();

            //refuelableComp = this.parent.GetComp<CompLightableRefuelable>();
            //lastStatus = variousGlowComp.MyGlowWay(FuelPercentOfMax);
        }
        public override Job JobOnThing(Pawn pawn, Thing thing, bool forced = false)
        {
            if (thing.def == myDef)
            {
                CompExtinguishable comp = thing.TryGetComp <CompExtinguishable>();
                if (comp == null || !comp.SwitchIsOn)
                {
                    return(null);
                }
            }

            return(base.JobOnThing(pawn, thing, forced));
        }
Пример #11
0
        public override bool HasJobOnThing(Pawn pawn, Thing t, bool forced = false)
        {
            if (t.Faction != pawn.Faction)
            {
                //Log.Warning("strike! bench not mine");
                return(false);
            }
            Building building = t as Building;

            if (building == null)
            {
                //Log.Warning("strike! building null");
                return(false);
            }
            // HERE IF IT FAILS
            if (building.IsForbidden(pawn))
            {
                // Log.Warning("strike! forbiden");
                return(false);
            }
            LocalTargetInfo target = building;

            if (!pawn.CanReserve(target, 1, -1, null, forced))
            {
                //Log.Warning("strike! cant reserver");
                return(false);
            }
            CompExtinguishable comp = null;

            comp = building.TryGetComp <CompExtinguishable>();
            if (comp == null)
            {
                //Tools.Warn("extinguish comp null",true);
                return(false);
            }

            if (building.IsBurning())
            {
                //Tools.Warn("builiding on fire", true);
                return(false);
            }

            if (!comp.WantsFlick())
            {
                //Tools.Warn("no work needed", true);
                return(false);
            }

            return(true);
        }
Пример #12
0
        public override void PostSpawnSetup(bool respawningAfterLoad)
        {
            stoneComp = parent.GetComp <CompExtinguishable>();
            if (stoneComp == null && MyDebug)
            {
                Log.Warning("could not find extinguish comp");
            }

            fuelComp = parent.GetComp <CompLightableRefuelable>();
            if (fuelComp == null && MyDebug)
            {
                Log.Warning("could not find fuel comp");
            }

            updateProps();

            base.PostSpawnSetup(respawningAfterLoad);
        }
        public override void PostSpawnSetup(bool respawningAfterLoad)
        {
            stoneComp = this.parent.GetComp <CompExtinguishable>();
            if (stoneComp == null)
            {
                Tools.Warn("could not find extinguish comp", true);
            }

            fuelComp = parent.GetComp <CompLightableRefuelable>();
            if (fuelComp == null)
            {
                Tools.Warn("could not find fuel comp", true);
            }

            updateProps();

            base.PostSpawnSetup(respawningAfterLoad);
        }
Пример #14
0
        public override void PostSpawnSetup(bool respawningAfterLoad)
        {
            //protected CompExtinguishable stoneComp;
            stoneComp = parent.TryGetComp <CompExtinguishable>();
            if (!HasStoneCampfireComp)
            {
                if (MyDebug)
                {
                    Log.Warning("could not find extinguish comp");
                }

                regularComp = parent.TryGetComp <CompRefuelable>();
                if (!HasRegularCampfireComp)
                {
                    if (MyDebug)
                    {
                        Log.Warning("could not find refuelable comp");
                    }
                }
            }

            base.PostSpawnSetup(respawningAfterLoad);
        }
Пример #15
0
 public override void PostSpawnSetup(bool respawningAfterLoad)
 {
     compExtinguishable = parent.TryGetComp <CompExtinguishable>();
 }
Пример #16
0
 public override void PostSpawnSetup(bool respawningAfterLoad)
 {
     base.PostSpawnSetup(respawningAfterLoad);
     comp = MyBuilding.TryGetComp <CompExtinguishable>();
 }
 public override void PostSpawnSetup(bool respawningAfterLoad)
 {
     base.PostSpawnSetup(respawningAfterLoad);
     stoneComp = parent.GetComp <CompExtinguishable>();
 }