1.5 update

This commit is contained in:
Jaaldabaoth 2024-05-24 00:33:37 +02:00
parent 7d9e399a47
commit e6db43f31d
231 changed files with 95 additions and 6968 deletions

View file

@ -1,68 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using RimWorld.Planet;
using Verse;
using RimWorld;
namespace RJW_Genes
{
public class Alert_CriticalFertilin : Alert
{
private List<GlobalTargetInfo> Targets
{
get
{
this.CalculateTargets();
return this.targets;
}
}
public override string GetLabel()
{
if (this.Targets.Count == 1)
{
return "AlertLowFertilin".Translate() + ": " + this.targetLabels[0];
}
return "AlertLowFertilin".Translate();
}
private void CalculateTargets()
{
this.targets.Clear();
this.targetLabels.Clear();
if (!ModsConfig.BiotechActive)
{
return;
}
foreach (Pawn pawn in PawnsFinder.AllMapsCaravansAndTravelingTransportPods_Alive)
{
if (pawn.RaceProps.Humanlike && pawn.Faction == Faction.OfPlayer)
{
Pawn_GeneTracker genes = pawn.genes;
Gene_LifeForce gene_Lifeforce = (genes != null) ? genes.GetFirstGeneOfType<Gene_LifeForce>() : null;
if (gene_Lifeforce != null && gene_Lifeforce.Active && gene_Lifeforce.Value < gene_Lifeforce.MinLevelForAlert)
{
this.targets.Add(pawn);
this.targetLabels.Add(pawn.NameShortColored.Resolve());
}
}
}
}
public override TaggedString GetExplanation()
{
return "AlertLowFertilinDesc".Translate() + ":\n" + this.targetLabels.ToLineList(" - ");
}
public override AlertReport GetReport()
{
return AlertReport.CulpritsAre(this.Targets);
}
private List<GlobalTargetInfo> targets = new List<GlobalTargetInfo>();
private List<string> targetLabels = new List<string>();
}
}

View file

@ -1,83 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Verse;
using RimWorld;
using UnityEngine;
namespace RJW_Genes
{
//Copied from GeneGizmo_ResourceHemogen, with small modifications
public class GeneGizmo_ResourceLifeForce : GeneGizmo_Resource
{
public GeneGizmo_ResourceLifeForce(Gene_Resource gene, List<IGeneResourceDrain> drainGenes, Color barColor, Color barhighlightColor) : base(gene, drainGenes, barColor, barhighlightColor)
{
this.draggableBar = true;
}
public override GizmoResult GizmoOnGUI(Vector2 topLeft, float maxWidth, GizmoRenderParms parms)
{
return base.GizmoOnGUI(topLeft, maxWidth, parms);
}
protected override string GetTooltip()
{
this.tmpDrainGenes.Clear();
string text = string.Format("{0}: {1} / {2}\n", this.gene.ResourceLabel.CapitalizeFirst().Colorize(ColoredText.TipSectionTitleColor), this.gene.ValueForDisplay, this.gene.MaxForDisplay);
if (this.gene.pawn.IsColonistPlayerControlled || this.gene.pawn.IsPrisonerOfColony)
{
if (this.gene.targetValue <= 0f)
{
text += "NeverSeekFertilin";
}
else
{
text = text + ("SeekFertilinBelow" + ": ") + this.gene.PostProcessValue(this.gene.targetValue);
}
}
if (!this.drainGenes.NullOrEmpty<IGeneResourceDrain>())
{
float num = 0f;
foreach (IGeneResourceDrain geneResourceDrain in this.drainGenes)
{
if (geneResourceDrain.CanOffset)
{
this.tmpDrainGenes.Add(new Pair<IGeneResourceDrain, float>(geneResourceDrain, geneResourceDrain.ResourceLossPerDay));
num += geneResourceDrain.ResourceLossPerDay;
}
}
if (num != 0f)
{
string text2 = (num < 0f) ? "RegenerationRate".Translate() : "DrainRate".Translate();
text = string.Concat(new string[]
{
text,
"\n\n",
text2,
": ",
"PerDay".Translate(Mathf.Abs(this.gene.PostProcessValue(num))).Resolve()
});
foreach (Pair<IGeneResourceDrain, float> pair in this.tmpDrainGenes)
{
text = string.Concat(new string[]
{
text,
"\n - ",
pair.First.DisplayLabel.CapitalizeFirst(),
": ",
"PerDay".Translate(this.gene.PostProcessValue(-pair.Second).ToStringWithSign()).Resolve()
});
}
}
}
if (!this.gene.def.resourceDescription.NullOrEmpty())
{
text = text + "\n\n" + this.gene.def.resourceDescription.Formatted(this.gene.pawn.Named("PAWN")).Resolve();
}
return text;
}
private List<Pair<IGeneResourceDrain, float>> tmpDrainGenes = new List<Pair<IGeneResourceDrain, float>>();
}
}