diff --git a/1.3/Assemblies/Outposts.dll b/1.3/Assemblies/Outposts.dll index b7395064..260a1b0e 100644 Binary files a/1.3/Assemblies/Outposts.dll and b/1.3/Assemblies/Outposts.dll differ diff --git a/Source/Outposts/Outpost.cs b/Source/Outposts/Outpost.cs index c8e2e5da..7abbbe12 100644 --- a/Source/Outposts/Outpost.cs +++ b/Source/Outposts/Outpost.cs @@ -190,26 +190,6 @@ public override bool ShouldRemoveMapNow(out bool alsoRemoveWorldObject) return false; } - public static string CheckSkill(IEnumerable pawns, SkillDef skill, int minLevel) - { - return pawns.Sum(p => p.skills.GetSkill(skill).Level) < minLevel ? "Outposts.NotSkilledEnough".Translate(skill.skillLabel, minLevel) : null; - } - - public static IEnumerable MakeThings(ThingDef thingDef, int count, ThingDef stuff = null) - { - while (count > thingDef.stackLimit) - { - var temp = ThingMaker.MakeThing(thingDef, stuff); - temp.stackCount = thingDef.stackLimit; - yield return temp; - count -= thingDef.stackLimit; - } - - var temp2 = ThingMaker.MakeThing(thingDef, stuff); - temp2.stackCount = count; - yield return temp2; - } - public void Deliver(IEnumerable items) { var map = Find.Maps.Where(m => m.IsPlayerHome).OrderByDescending(m => Find.WorldGrid.ApproxDistanceInTiles(m.Parent.Tile, Tile)).First(); @@ -526,12 +506,11 @@ public Pawn RemovePawn(Pawn p) public override string GetInspectString() => base.GetInspectString() + - Line(def.LabelCap) + - Line("Outposts.Contains".Translate(occupants.Count)) + - Line(Packing ? "Outposts.Packing".Translate(ticksTillPacked.ToStringTicksToPeriodVerbose().Colorize(ColoredText.DateTimeColor)).RawText : ProductionString()) + - Line(Ext?.RelevantSkills?.Count > 0 ? RelevantSkillDisplay() : ""); - - public static string Line(string input) => input.NullOrEmpty() ? "" : "\n" + input; + def.LabelCap.Line() + + "Outposts.Contains".Translate(occupants.Count).Line() + + "Outposts.Packing".Translate(ticksTillPacked.ToStringTicksToPeriodVerbose().Colorize(ColoredText.DateTimeColor)).Line(Packing) + + ProductionString().Line(!Packing) + + RelevantSkillDisplay().Line(Ext?.RelevantSkills?.Count > 0); public virtual string ProductionString() { diff --git a/Source/Outposts/OutpostExtension.cs b/Source/Outposts/OutpostExtension.cs index 4265b759..3174eab4 100644 --- a/Source/Outposts/OutpostExtension.cs +++ b/Source/Outposts/OutpostExtension.cs @@ -21,6 +21,7 @@ public class OutpostExtension : DefModExtension public List ResultOptions; public int TicksPerProduction = 15 * 60000; public int TicksToPack = 7 * 60000; + public int TicksToSetUp = -1; public List RelevantSkills => new HashSet(RequiredSkills.SelectOrEmpty(rq => rq.Skill) @@ -40,7 +41,7 @@ public class ResultOption public int Amount(List pawns) => Mathf.RoundToInt((BaseAmount + AmountPerPawn * pawns.Count + (AmountsPerSkills?.Sum(x => x.Amount(pawns)) ?? 0)) * OutpostsMod.Settings.ProductionMultiplier); - public IEnumerable Make(List pawns) => Outpost.MakeThings(Thing, Amount(pawns)); + public IEnumerable Make(List pawns) => Thing.Make(Amount(pawns)); public string Explain(List pawns) => $"{Amount(pawns)}x {Thing.LabelCap}"; } diff --git a/Source/Outposts/Utils.cs b/Source/Outposts/Utils.cs index 8fb02d2d..67533504 100644 --- a/Source/Outposts/Utils.cs +++ b/Source/Outposts/Utils.cs @@ -1,7 +1,9 @@ using System; using System.Collections.Generic; using System.Linq; +using RimWorld; using RimWorld.Planet; +using UnityEngine; using Verse; namespace Outposts @@ -20,7 +22,29 @@ public static IEnumerable SelectOrEmpty(this IEnumera public static IEnumerable SelectManyOrEmpty(this IEnumerable source, Func> selector) => source is null ? Enumerable.Empty() : source.SelectMany(selector); - public static string Line(this string input) => input.NullOrEmpty() ? "" : "\n" + input; + public static string Line(this string input, bool show = true) => !show || input.NullOrEmpty() ? "" : "\n" + input; + public static string Line(this TaggedString input, bool show = true) => !show || input.NullOrEmpty() ? "" : "\n" + input.RawText; + + public static IEnumerable Make(this ThingDef thingDef, int count, ThingDef stuff = null) + { + count = Mathf.RoundToInt(count * OutpostsMod.Settings.ProductionMultiplier); + while (count > thingDef.stackLimit) + { + var temp = ThingMaker.MakeThing(thingDef, stuff); + temp.stackCount = thingDef.stackLimit; + yield return temp; + count -= thingDef.stackLimit; + } + + var temp2 = ThingMaker.MakeThing(thingDef, stuff); + temp2.stackCount = count; + yield return temp2; + } + + public static string CheckSkill(this IEnumerable pawns, SkillDef skill, int minLevel) + { + return pawns.Sum(p => p.skills.GetSkill(skill).Level) < minLevel ? "Outposts.NotSkilledEnough".Translate(skill.skillLabel, minLevel) : null; + } } public class Dialog_RenameOutpost : Dialog_Rename