Beispiel #1
0
        // Token: 0x0600014D RID: 333 RVA: 0x0000D51C File Offset: 0x0000B91C
        public override Job JobOnThing(Pawn pawn, Thing t, bool forced = false)
        {
            Job result;

            if (t.def.defName != "HoloDisk")
            {
                result = null;
            }
            else if (!ReservationUtility.CanReserveAndReach(pawn, t, (Verse.AI.PathEndMode) 2, (Verse.Danger) 3, 1, 1, null, false))
            {
                result = null;
            }
            else
            {
                HoloEmitter holoEmitter = this.FindEmitter(pawn, t);
                if (holoEmitter == null)
                {
                    result = null;
                }
                else if (holoEmitter.GetComp <CompHoloEmitter>().SimPawn != null)
                {
                    result = null;
                }
                else
                {
                    result = new Job(JobDefOfHoloEmitters.LoadIntoEmitter, t, holoEmitter)
                    {
                        count = 1
                    };
                }
            }
            return(result);
        }
Beispiel #2
0
        public override Job JobOnThing(Pawn pawn, Thing t, bool forced = false)
        {
            Job result;

            if (t.def.defName != "RD_HoloDisk")
            {
                result = null;
            }
            else if (!ReservationUtility.CanReserveAndReach(pawn, t, PathEndMode.Touch, Danger.Deadly, 1, 1, null, false))
            {
                result = null;
            }
            else
            {
                HoloEmitter holoEmitter = this.FindEmitter(pawn, t);
                if (holoEmitter == null)
                {
                    result = null;
                }
                else if (holoEmitter.GetComp <CompHoloEmitter>().SimPawn != null)
                {
                    result = null;
                }
                else
                {
                    result = new Job(JobDefOfReconAndDiscovery.RD_LoadIntoEmitter, t, holoEmitter)
                    {
                        count = 1
                    };
                }
            }
            return(result);
        }
Beispiel #3
0
        // Token: 0x06000118 RID: 280 RVA: 0x0000B64C File Offset: 0x00009A4C
        public override IEnumerable <FloatMenuOption> CompFloatMenuOptions(Pawn selPawn)
        {
            List <FloatMenuOption> list = new List <FloatMenuOption>();

            if (this.pawn != null)
            {
                string Label  = "Format Occupant";
                Action action = delegate()
                {
                    DamageInfo value = new DamageInfo(DamageDefOf.ExecutionCut, 1000, -1f, instigator: selPawn);
                    this.pawn.Kill(new DamageInfo?(value));
                    this.pawn.Corpse.Destroy(0);
                    this.pawn = null;
                };
                FloatMenuOption floatMenuOption = new FloatMenuOption(Label, action, (MenuOptionPriority)4);
                string          Label2          = "Remove Occupant";
                Action          action2         = delegate()
                {
                    DamageInfo value = new DamageInfo(DamageDefOf.ExecutionCut, 1000, -1f, instigator: selPawn);
                    this.pawn.Kill(new DamageInfo?(value));
                    this.pawn.Corpse.Position = this.parent.Position.RandomAdjacentCell8Way();
                    this.pawn = null;
                };
                FloatMenuOption floatMenuOption2 = new FloatMenuOption(Label2, action2, (MenuOptionPriority)4);
                if (selPawn != this.pawn)
                {
                    list.Add(floatMenuOption);
                    list.Add(floatMenuOption2);
                }
            }
            else if (selPawn.health.hediffSet.HasHediff(HediffDef.Named("Holographic"))) // (selPawn.story.traits.HasTrait(TraitDef.Named("Holographic")))
            {
                string Label  = "Transfer to this emitter";
                Action action = delegate()
                {
                    foreach (Thing thing in this.parent.Map.listerBuildings.AllBuildingsColonistOfDef(ThingDef.Named("HolographicEmitter")))
                    {
                        HoloEmitter holoEmitter = thing as HoloEmitter;
                        if (holoEmitter == null)
                        {
                            break;
                        }
                        if (holoEmitter.GetComp <CompHoloEmitter>().SimPawn == selPawn)
                        {
                            holoEmitter.GetComp <CompHoloEmitter>().SimPawn = null;
                            this.pawn = selPawn;
                            this.parent.Map.areaManager.AllAreas.Remove(this.pawn.playerSettings.AreaRestriction);
                            this.MakeValidAllowedZone();
                            break;
                        }
                    }
                };
                FloatMenuOption floatMenuOption2 = new FloatMenuOption(Label, action, (MenuOptionPriority)4);
                if (this.pawn == null)
                {
                    list.Add(floatMenuOption2);
                }
            }
            return(list);
        }
Beispiel #4
0
        // Token: 0x06000125 RID: 293 RVA: 0x0000BEC0 File Offset: 0x0000A2C0
        public override Job JobOnThing(Pawn pawn, Thing t, bool forced = false)
        {
            Corpse corpse = t as Corpse;
            Job    result;

            Log.Message("start");
            if (corpse != null)
            {
                Log.Message("a");
                if (corpse.InnerPawn.Faction != Faction.OfPlayer || !corpse.InnerPawn.RaceProps.Humanlike)
                {
                    Log.Message("fail a");
                    result = null;
                }
                else if (!HaulAIUtility.PawnCanAutomaticallyHaul(pawn, t, forced))
                {
                    Log.Message("fail b");
                    result = null;
                }
                else
                {
                    HoloEmitter holoEmitter = this.FindEmitter(pawn, corpse);
                    if (holoEmitter == null)
                    {
                        Log.Message("fail c");
                        result = null;
                    }
                    else if (holoEmitter.GetComp <CompHoloEmitter>().SimPawn != null)
                    {
                        Log.Message("fail f");
                        result = null;
                    }
                    else
                    {
                        Log.Message("win ");
                        result = new Job(JobDefOfHoloEmitters.ScanAtEmitter, t, holoEmitter)
                        {
                            count = corpse.stackCount
                        };
                    }
                }
            }
            else
            {
                Log.Message("fail ");
                result = null;
            }
            return(result);
        }
Beispiel #5
0
        private HoloEmitter FindEmitter(Pawn p, Thing corpse)
        {
            IEnumerable <ThingDef> enumerable = from def in DefDatabase <ThingDef> .AllDefs
                                                where typeof(HoloEmitter).IsAssignableFrom(def.thingClass)
                                                select def;

            foreach (ThingDef singleDef in enumerable)
            {
                Predicate <Thing> predicate   = (Thing x) => ((HoloEmitter)x).GetComp <CompHoloEmitter>().SimPawn == null && ReservationUtility.CanReserve(p, x, 1, -1, null, false);
                HoloEmitter       holoEmitter = (HoloEmitter)GenClosest.ClosestThingReachable(p.Position, p.Map, ThingRequest.ForDef(singleDef), PathEndMode.InteractionCell, TraverseParms.For(p, Danger.Deadly, TraverseMode.ByPawn, false), 9999f, predicate, null, 0, -1, false, RegionType.Set_Passable, false);
                if (holoEmitter != null)
                {
                    return(holoEmitter);
                }
            }
            return(null);
        }
        public override IEnumerable <FloatMenuOption> CompFloatMenuOptions(Pawn selPawn)
        {
            List <FloatMenuOption> list = new List <FloatMenuOption>();

            if (this.pawn != null)
            {
                FloatMenuOption floatMenuOption = new FloatMenuOption("RD_FormatOccupant".Translate(), delegate()
                {
                    DamageInfo value = new DamageInfo(DamageDefOf.ExecutionCut, 1000, -1f, -1f, selPawn, null, null, 0);
                    this.pawn.Kill(new DamageInfo?(value));
                    this.pawn.Corpse.Destroy(DestroyMode.Vanish);
                    this.pawn = null;
                });
                if (selPawn != this.pawn)
                {
                    list.Add(floatMenuOption);
                }
            }
            else if (selPawn.story.traits.HasTrait(TraitDef.Named("RD_Holographic")))
            {
                FloatMenuOption floatMenuOption2 = new FloatMenuOption("RD_TransferToThisEmitter".Translate(), delegate()
                {
                    foreach (Thing thing in this.parent.Map.listerBuildings.AllBuildingsColonistOfDef(ThingDef.Named("RD_HolographicEmitter")))
                    {
                        HoloEmitter holoEmitter = thing as HoloEmitter;
                        if (holoEmitter == null)
                        {
                            break;
                        }
                        if (holoEmitter.GetComp <CompHoloEmitter>().SimPawn == selPawn)
                        {
                            holoEmitter.GetComp <CompHoloEmitter>().SimPawn = null;
                            this.pawn = selPawn;
                            this.parent.Map.areaManager.AllAreas.Remove(this.pawn.playerSettings.AreaRestriction);
                            this.MakeValidAllowedZone();
                            break;
                        }
                    }
                });
                if (this.pawn == null)
                {
                    list.Add(floatMenuOption2);
                }
            }
            return(list);
        }
Beispiel #7
0
        public override Job JobOnThing(Pawn pawn, Thing t, bool forced = false)
        {
            Corpse corpse = t as Corpse;
            Job    result;

            if (corpse != null)
            {
                if (corpse.InnerPawn.Faction != Faction.OfPlayer || !corpse.InnerPawn.RaceProps.Humanlike)
                {
                    result = null;
                }
                else if (!HaulAIUtility.PawnCanAutomaticallyHaul(pawn, t, forced))
                {
                    result = null;
                }
                else
                {
                    HoloEmitter holoEmitter = this.FindEmitter(pawn, corpse);
                    if (holoEmitter == null)
                    {
                        result = null;
                    }
                    else if (holoEmitter.GetComp <CompHoloEmitter>().SimPawn != null)
                    {
                        result = null;
                    }
                    else
                    {
                        result = new Job(JobDefOfReconAndDiscovery.RD_ScanAtEmitter, t, holoEmitter)
                        {
                            count = corpse.stackCount
                        };
                    }
                }
            }
            else
            {
                result = null;
            }
            return(result);
        }