public void SetQuality(QualityCategory q, ArtGenerationContext source) { this.qualityInt = q; CompArt compArt = this.parent.TryGetComp <CompArt>(); if (compArt != null) { compArt.InitializeArt(source); } }
public virtual void Notify_CorpseBuried(Pawn worker) { CompArt comp = base.GetComp <CompArt>(); if (comp != null && !comp.Active) { comp.JustCreatedBy(worker); comp.InitializeArt(this.Corpse.InnerPawn); } base.Map.mapDrawer.MapMeshDirty(base.Position, MapMeshFlag.Things | MapMeshFlag.Buildings); }
public void CompleteConstruction(Pawn worker) { resourceContainer.ClearAndDestroyContents(); Map map = base.Map; Destroy(); if (this.GetStatValue(StatDefOf.WorkToBuild) > 150f && def.entityDefToBuild is ThingDef && ((ThingDef)def.entityDefToBuild).category == ThingCategory.Building) { SoundDefOf.Building_Complete.PlayOneShot(new TargetInfo(base.Position, map)); } ThingDef thingDef = def.entityDefToBuild as ThingDef; Thing thing = null; if (thingDef != null) { thing = ThingMaker.MakeThing(thingDef, base.Stuff); thing.SetFactionDirect(base.Faction); CompQuality compQuality = thing.TryGetComp <CompQuality>(); if (compQuality != null) { QualityCategory q = QualityUtility.GenerateQualityCreatedByPawn(worker, SkillDefOf.Construction); compQuality.SetQuality(q, ArtGenerationContext.Colony); QualityUtility.SendCraftNotification(thing, worker); } CompArt compArt = thing.TryGetComp <CompArt>(); if (compArt != null) { if (compQuality == null) { compArt.InitializeArt(ArtGenerationContext.Colony); } compArt.JustCreatedBy(worker); } thing.HitPoints = Mathf.CeilToInt((float)HitPoints / (float)base.MaxHitPoints * (float)thing.MaxHitPoints); GenSpawn.Spawn(thing, base.Position, map, base.Rotation, WipeMode.FullRefund); Building b; if ((b = thing as Building) != null) { worker.GetLord()?.AddBuilding(b); } } else { map.terrainGrid.SetTerrain(base.Position, (TerrainDef)def.entityDefToBuild); FilthMaker.RemoveAllFilth(base.Position, map); } worker.records.Increment(RecordDefOf.ThingsConstructed); if (thing != null && thing.GetStatValue(StatDefOf.WorkToBuild) >= 9500f) { TaleRecorder.RecordTale(TaleDefOf.CompletedLongConstructionProject, worker, thing.def); } }
public virtual void Notify_CorpseBuried(Pawn worker) { CompArt comp = GetComp <CompArt>(); if (comp != null && !comp.Active) { comp.JustCreatedBy(worker); comp.InitializeArt(Corpse.InnerPawn); } base.Map.mapDrawer.MapMeshDirty(base.Position, MapMeshFlag.Things | MapMeshFlag.Buildings); worker.records.Increment(RecordDefOf.CorpsesBuried); TaleRecorder.RecordTale(TaleDefOf.BuriedCorpse, worker, (Corpse != null) ? Corpse.InnerPawn : null); }
public void CompleteConstruction(Pawn worker) { this.resourceContainer.ClearAndDestroyContents(DestroyMode.Vanish); Map map = base.Map; this.Destroy(DestroyMode.Vanish); if (this.GetStatValue(StatDefOf.WorkToBuild, true) > 150.0 && base.def.entityDefToBuild is ThingDef && ((ThingDef)base.def.entityDefToBuild).category == ThingCategory.Building) { SoundDefOf.BuildingComplete.PlayOneShot(new TargetInfo(base.Position, map, false)); } ThingDef thingDef = base.def.entityDefToBuild as ThingDef; Thing thing = null; if (thingDef != null) { thing = ThingMaker.MakeThing(thingDef, base.Stuff); thing.SetFactionDirect(base.Faction); CompQuality compQuality = thing.TryGetComp <CompQuality>(); if (compQuality != null) { int level = worker.skills.GetSkill(SkillDefOf.Construction).Level; compQuality.SetQuality(QualityUtility.RandomCreationQuality(level), ArtGenerationContext.Colony); } CompArt compArt = thing.TryGetComp <CompArt>(); if (compArt != null) { if (compQuality == null) { compArt.InitializeArt(ArtGenerationContext.Colony); } compArt.JustCreatedBy(worker); } thing.HitPoints = Mathf.CeilToInt((float)this.HitPoints / (float)base.MaxHitPoints * (float)thing.MaxHitPoints); GenSpawn.Spawn(thing, base.Position, map, base.Rotation, false); } else { map.terrainGrid.SetTerrain(base.Position, (TerrainDef)base.def.entityDefToBuild); FilthMaker.RemoveAllFilth(base.Position, map); } if (thingDef != null && (thingDef.passability == Traversability.Impassable || thingDef.Fillage == FillCategory.Full) && (thing == null || !(thing is Building_Door))) { foreach (IntVec3 item in GenAdj.CellsOccupiedBy(base.Position, base.Rotation, base.def.Size)) { foreach (Thing item2 in map.thingGrid.ThingsAt(item).ToList()) { if (item2 is Plant) { item2.Destroy(DestroyMode.KillFinalize); } else if (item2.def.category == ThingCategory.Item || item2 is Pawn) { GenPlace.TryMoveThing(item2, item2.Position, item2.Map); } } } } worker.records.Increment(RecordDefOf.ThingsConstructed); if (thing != null && thing.GetStatValue(StatDefOf.WorkToBuild, true) >= 10000.0) { TaleRecorder.RecordTale(TaleDefOf.CompletedLongConstructionProject, worker, thing.def); } }
// Token: 0x060000D7 RID: 215 RVA: 0x000066F8 File Offset: 0x000048F8 public void CompleteConstruction(Pawn worker) { Map map = base.Map; bool flag = this.GetStatValue(StatDefOf.WorkToBuild, true) > 150f && this.def.entityDefToBuild is ThingDef && ((ThingDef)this.def.entityDefToBuild).category == ThingCategory.Building; if (flag) { SoundDefOf.Building_Complete.PlayOneShot(new TargetInfo(base.Position, map, false)); } ThingDef thingDef = this.def.entityDefToBuild as ThingDef; Thing thing = null; bool flag2 = thingDef != null; if (flag2) { thing = ThingMaker.MakeThing(thingDef, base.Stuff); thing.SetFactionDirect(base.Faction); CompQuality compQuality = thing.TryGetComp <CompQuality>(); bool flag3 = compQuality != null; if (flag3) { int relevantSkillLevel = 1; compQuality.SetQuality(QualityUtility.GenerateQualityCreatedByPawn(relevantSkillLevel, false), ArtGenerationContext.Colony); } CompArt compArt = thing.TryGetComp <CompArt>(); bool flag4 = compArt != null; if (flag4) { bool flag5 = compQuality == null; if (flag5) { compArt.InitializeArt(ArtGenerationContext.Colony); } compArt.JustCreatedBy(worker); } thing.HitPoints = Mathf.CeilToInt((float)this.HitPoints / (float)base.MaxHitPoints * (float)thing.MaxHitPoints); GenSpawn.Spawn(thing, base.Position, map, base.Rotation, WipeMode.FullRefund, false); } else { map.terrainGrid.SetTerrain(base.Position, (TerrainDef)this.def.entityDefToBuild); FilthMaker.RemoveAllFilth(base.Position, map); } bool flag6 = thingDef != null && (thingDef.passability == Traversability.Impassable || thingDef.Fillage == FillCategory.Full) && (thing == null || !(thing is Building_Door)); if (flag6) { foreach (IntVec3 c in GenAdj.CellsOccupiedBy(base.Position, base.Rotation, this.def.Size)) { foreach (Thing thing2 in map.thingGrid.ThingsAt(c).ToList <Thing>()) { bool flag7 = thing2 is Plant; if (flag7) { thing2.Destroy(DestroyMode.KillFinalize); } else { bool flag8 = thing2.def.category == ThingCategory.Item || thing2 is Pawn; if (flag8) { GenPlace.TryPlaceThing(thing2, thing2.Position, thing2.Map, ThingPlaceMode.Near, null, null, default(Rot4)); } } } } } worker.records.Increment(RecordDefOf.ThingsConstructed); }