public override IEnumerable <string> ConfigErrors(ThingDef parentDef) { using (IEnumerator <string> enumerator = base.ConfigErrors(parentDef).GetEnumerator()) { if (enumerator.MoveNext()) { string err = enumerator.Current; yield return(err); /*Error: Unable to find new state assignment for yield return*/; } } if (parentDef.tickerType != TickerType.Normal) { yield return("CompProximityFuse needs tickerType " + TickerType.Rare + " or faster, has " + parentDef.tickerType); /*Error: Unable to find new state assignment for yield return*/; } if (parentDef.CompDefFor <CompExplosive>() == null) { yield return("CompProximityFuse requires a CompExplosive"); /*Error: Unable to find new state assignment for yield return*/; } yield break; IL_0158: /*Error near IL_0159: Unexpected return in MoveNext()*/; }
protected override void ApplyPatch(HarmonyInstance harmony = null) { ThingDef _ThingDef = ThingDef.Named("NanoMaterial"); CompProperties _CompPoperties = _ThingDef.CompDefFor <EnhancedDevelopment.Prometheus.Fabrication.Comp_Fabricated>(); EnhancedDevelopment.Prometheus.Fabrication.CompProperties_Fabricated _CastedProperties = _CompPoperties as EnhancedDevelopment.Prometheus.Fabrication.CompProperties_Fabricated; _CastedProperties.RequiredMaterials = 5; _CastedProperties.RequiredPower = 55; }
public override IEnumerable <string> ConfigErrors(ThingDef parentDef) { foreach (string item in base.ConfigErrors(parentDef)) { yield return(item); } if (parentDef.tickerType != TickerType.Normal) { yield return(string.Concat("CompProximityFuseByThingRequestGroup needs tickerType ", TickerType.Rare, " or faster, has ", parentDef.tickerType)); } if (parentDef.CompDefFor <CompExplosive>() == null) { yield return("CompProximityFuseByThingRequestGroup requires a CompExplosive"); } }
public override IEnumerable <string> ConfigErrors(ThingDef parentDef) { foreach (string err in base.ConfigErrors(parentDef)) { yield return(err); } if (parentDef.tickerType != TickerType.Normal) { yield return(string.Concat(new object[] { "CompProximityFuse needs tickerType ", TickerType.Rare, " or faster, has ", parentDef.tickerType })); } if (parentDef.CompDefFor <CompExplosive>() == null) { yield return("CompProximityFuse requires a CompExplosive"); } }
private void Produce(int amount, float chance, ThingDef resource, ThingDef rareResource, ThoughtDef stageThought) { MemoryThoughtHandler thoughts = Pawn.needs?.mood?.thoughts?.memories; EtherState etherState = Pawn.GetEtherState(); HatchingTicker = 0; var thingCount = 0; var rareThingCount = 0; Aspect infusedAspect = Pawn.GetAspectTracker()?.GetAspect(AspectDefOf.MutagenInfused); int?sIndex = infusedAspect?.StageIndex; for (var i = 0; i < amount; i++) { bool shouldProduceRare; switch (sIndex) { case null: shouldProduceRare = Rand.RangeInclusive(0, 100) <= chance; break; case 0: shouldProduceRare = true; break; case 1: shouldProduceRare = false; break; case 2: return; //produce nothing default: throw new ArgumentOutOfRangeException(sIndex.Value.ToString()); } if (shouldProduceRare && rareResource != null) { rareThingCount++; } else { thingCount++; } } Thing thing = ThingMaker.MakeThing(resource); thing.stackCount = thingCount; Color?skinColor = Pawn.GetHighestInfluence()?.GetSkinColorOverride(Pawn); //dont want wool thats mostly human-skin colored if (resource.thingCategories.Contains(PMThingCategoryDefOf.Textiles) && resource.CompDefFor <CompColorable>() != null && skinColor.HasValue) { thing.SetColor(skinColor.Value); } if (thing.stackCount > 0) { GenPlace.TryPlaceThing(thing, Pawn.PositionHeld, Pawn.Map, ThingPlaceMode.Near); } if (rareResource != null) { Thing rareThing = ThingMaker.MakeThing(rareResource); rareThing.stackCount = rareThingCount; if (rareResource.thingCategories.Contains(PMThingCategoryDefOf.Textiles) && resource.CompDefFor <CompColorable>() != null && skinColor.HasValue) { thing.SetColor(skinColor.Value); } if (rareThing.stackCount > 0) { GenPlace.TryPlaceThing(rareThing, Pawn.PositionHeld, Pawn.Map, ThingPlaceMode.Near); } } if (etherState == EtherState.None) { if (Rand.RangeInclusive(0, 100) <= bondChance) { GiveEtherState(EtherState.Bond); etherState = EtherState.Bond; Find.LetterStack.ReceiveLetter( "LetterHediffFromEtherBondLabel".Translate(Pawn).CapitalizeFirst(), "LetterHediffFromEtherBond".Translate(Pawn).CapitalizeFirst(), LetterDefOf.NeutralEvent, Pawn); } else if (Rand.RangeInclusive(0, 100) <= brokenChance) { GiveEtherState(EtherState.Broken); etherState = EtherState.Broken; Find.LetterStack.ReceiveLetter( "LetterHediffFromEtherBrokenLabel".Translate(Pawn).CapitalizeFirst(), "LetterHediffFromEtherBroken".Translate(Pawn).CapitalizeFirst(), LetterDefOf.NeutralEvent, Pawn); } } if (stageThought != null) { thoughts?.TryGainMemory(stageThought); } ThoughtDef addThought; switch (etherState) { case EtherState.None: addThought = Props.genderAversion == Pawn.gender ? Props.wrongGenderThought ?? Props.thought : Props.thought; break; case EtherState.Broken: addThought = Props.etherBrokenThought; break; case EtherState.Bond: addThought = Props.etherBondThought; break; default: throw new ArgumentOutOfRangeException(); } if (addThought != null) { thoughts?.TryGainMemory(addThought); } if (etherState == EtherState.None) { brokenChance += 0.5f; bondChance += 0.2f; } totalProduced += rareThingCount + thingCount; }
public static void ColoriseTextileAnimalProduct(Thing thing, ThingWithComps parent) { if (!(parent is Pawn)) { return; } Pawn pawn = parent as Pawn; ThingDef resource = thing.def; Color? skinColor = pawn.GetAspectTracker()?.GetAspect <Aspects.ColorationAspect>()?.ColorSet?.skinColor; if (skinColor.HasValue && resource.thingCategories.Contains(PMThingCategoryDefOf.Textiles) && resource.CompDefFor <CompColorable>() != null) { thing.SetColor(skinColor.Value); } }
public override void DrawGhost(ThingDef def, IntVec3 center, Rot4 rot, Color ghostCol, Thing thing = null) { FocusStrengthOffset_ArtificialBuildings focusStrengthOffset_ArtificialBuildings = ((CompProperties_MeditationFocus)def.CompDefFor <CompMeditationFocus>()).offsets.OfType <FocusStrengthOffset_ArtificialBuildings>().FirstOrDefault(); if (focusStrengthOffset_ArtificialBuildings != null) { MeditationUtility.DrawArtificialBuildingOverlay(center, def, Find.CurrentMap, focusStrengthOffset_ArtificialBuildings.radius); } }
public override void DrawGhost(ThingDef def, IntVec3 center, Rot4 rot, Color ghostCol, Thing thing = null) { if (!ModsConfig.RoyaltyActive) { return; } FocusStrengthOffset_BuildingDefs focusStrengthOffset_BuildingDefs = ((CompProperties_MeditationFocus)((def.IsFrame || def.IsBlueprint) ? ((ThingDef)def.entityDefToBuild).CompDefFor <CompMeditationFocus>() : def.CompDefFor <CompMeditationFocus>())).offsets.OfType <FocusStrengthOffset_BuildingDefs>().FirstOrDefault(); if (focusStrengthOffset_BuildingDefs != null) { GenDraw.DrawRadiusRing(center, focusStrengthOffset_BuildingDefs.radius, RingColor); List <Thing> forCell = Find.CurrentMap.listerBuldingOfDefInProximity.GetForCell(center, focusStrengthOffset_BuildingDefs.radius, focusStrengthOffset_BuildingDefs.defs); for (int i = 0; i < forCell.Count && i < focusStrengthOffset_BuildingDefs.maxBuildings; i++) { GenDraw.DrawLineBetween(GenThing.TrueCenter(center, Rot4.North, def.size, def.Altitude), forCell[i].TrueCenter(), SimpleColor.Green); } } }