Exemplo n.º 1
0
        public static TaleData_Thing GenerateRandom()
        {
            ThingDef thingDef = DefDatabase <ThingDef> .AllDefs.Where(delegate(ThingDef d)
            {
                bool arg_36_0;
                if (d.comps != null)
                {
                    arg_36_0 = d.comps.Any((CompProperties cp) => cp.compClass == typeof(CompArt));
                }
                else
                {
                    arg_36_0 = false;
                }
                return(arg_36_0);
            }).RandomElement <ThingDef>();

            ThingDef             thingDef2   = GenStuff.RandomStuffFor(thingDef);
            Thing                thing       = ThingMaker.MakeThing(thingDef, thingDef2);
            ArtGenerationContext source      = (Rand.Value >= 0.5f) ? ArtGenerationContext.Outsider : ArtGenerationContext.Colony;
            CompQuality          compQuality = thing.TryGetComp <CompQuality>();

            if (compQuality != null && compQuality.Quality < thing.TryGetComp <CompArt>().Props.minQualityForArtistic)
            {
                compQuality.SetQuality(thing.TryGetComp <CompArt>().Props.minQualityForArtistic, source);
            }
            thing.TryGetComp <CompArt>().InitializeArt(source);
            return(TaleData_Thing.GenerateFrom(thing));
        }
Exemplo n.º 2
0
        public static TaleData_Thing GenerateFrom(Thing t)
        {
            TaleData_Thing taleData_Thing = new TaleData_Thing();

            taleData_Thing.thingID  = t.thingIDNumber;
            taleData_Thing.thingDef = t.def;
            taleData_Thing.stuff    = t.Stuff;
            t.TryGetQuality(out taleData_Thing.quality);
            CompArt compArt = t.TryGetComp <CompArt>();

            if (compArt != null && compArt.Active)
            {
                taleData_Thing.title = compArt.Title;
            }
            return(taleData_Thing);
        }
        public static TaleData_Thing GenerateRandom()
        {
            ThingDef thingDef = (from d in DefDatabase <ThingDef> .AllDefs
                                 where d.comps != null && d.comps.Any((CompProperties cp) => cp.compClass == typeof(CompArt))
                                 select d).RandomElement();
            ThingDef             thingDef2   = GenStuff.RandomStuffFor(thingDef);
            Thing                thing       = ThingMaker.MakeThing(thingDef, thingDef2);
            ArtGenerationContext source      = (ArtGenerationContext)((Rand.Value < 0.5) ? 1 : 0);
            CompQuality          compQuality = thing.TryGetComp <CompQuality>();

            if (compQuality != null && (int)compQuality.Quality < (int)thing.TryGetComp <CompArt>().Props.minQualityForArtistic)
            {
                compQuality.SetQuality(thing.TryGetComp <CompArt>().Props.minQualityForArtistic, source);
            }
            thing.TryGetComp <CompArt>().InitializeArt(source);
            return(TaleData_Thing.GenerateFrom(thing));
        }
Exemplo n.º 4
0
 public override void GenerateTestData()
 {
     base.GenerateTestData();
     thingData = TaleData_Thing.GenerateRandom();
 }
Exemplo n.º 5
0
 public Tale_SinglePawnAndThing(Pawn pawn, Thing item)
     : base(pawn)
 {
     thingData = TaleData_Thing.GenerateFrom(item);
 }