mirror of
https://github.com/amevarashi/RJW-Sexperience.git
synced 2024-08-14 23:54:08 +00:00
Remove more code warnings
This commit is contained in:
parent
9589d3dda6
commit
3c548e6ae4
10 changed files with 155 additions and 177 deletions
|
@ -1,4 +1,5 @@
|
|||
using RimWorld;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using Verse;
|
||||
|
||||
namespace RJWSexperience.Ideology
|
||||
|
@ -22,7 +23,9 @@ namespace RJWSexperience.Ideology
|
|||
|
||||
public class PreceptComp_SelfTookThoughtTagged : PreceptComp_SelfTookMemoryThought
|
||||
{
|
||||
[SuppressMessage("Minor Code Smell", "S1104:Fields should not have public accessibility", Justification = "Field value loaded from XML")]
|
||||
public string tag;
|
||||
[SuppressMessage("Minor Code Smell", "S1104:Fields should not have public accessibility", Justification = "Field value loaded from XML")]
|
||||
public bool exclusive = false;
|
||||
|
||||
public PreceptComp_SelfTookThoughtTagged() { }
|
||||
|
@ -57,22 +60,18 @@ namespace RJWSexperience.Ideology
|
|||
}
|
||||
Pawn arg = ev.args.GetArg<Pawn>(HistoryEventArgsNames.Doer);
|
||||
Pawn partner = ev.args.GetArg<Pawn>(HistoryEventArgsNamesCustom.Partner);
|
||||
if (arg.needs != null && arg.needs.mood != null && (!this.onlyForNonSlaves || !arg.IsSlave))
|
||||
if (arg.needs?.mood != null && (!this.onlyForNonSlaves || !arg.IsSlave))
|
||||
{
|
||||
if (this.thought.minExpectationForNegativeThought != null && ExpectationsUtility.CurrentExpectationFor(arg).order < this.thought.minExpectationForNegativeThought.order)
|
||||
{
|
||||
return;
|
||||
}
|
||||
Thought_Memory thought_Memory = ThoughtMaker.MakeThought(this.thought, precept);
|
||||
Thought_KilledInnocentAnimal thought_KilledInnocentAnimal;
|
||||
Pawn animal;
|
||||
if ((thought_KilledInnocentAnimal = (thought_Memory as Thought_KilledInnocentAnimal)) != null && ev.args.TryGetArg<Pawn>(HistoryEventArgsNames.Victim, out animal))
|
||||
if (thought_Memory is Thought_KilledInnocentAnimal thought_KilledInnocentAnimal && ev.args.TryGetArg<Pawn>(HistoryEventArgsNames.Victim, out Pawn animal))
|
||||
{
|
||||
thought_KilledInnocentAnimal.SetAnimal(animal);
|
||||
}
|
||||
Thought_MemoryObservation thought_MemoryObservation;
|
||||
Corpse target;
|
||||
if ((thought_MemoryObservation = (thought_Memory as Thought_MemoryObservation)) != null && ev.args.TryGetArg<Corpse>(HistoryEventArgsNames.Subject, out target))
|
||||
if (thought_Memory is Thought_MemoryObservation thought_MemoryObservation && ev.args.TryGetArg<Corpse>(HistoryEventArgsNames.Subject, out Corpse target))
|
||||
{
|
||||
thought_MemoryObservation.Target = target;
|
||||
}
|
||||
|
@ -83,20 +82,20 @@ namespace RJWSexperience.Ideology
|
|||
|
||||
public class PreceptComp_KnowsMemoryThoughtTagged : PreceptComp_KnowsMemoryThought
|
||||
{
|
||||
[SuppressMessage("Minor Code Smell", "S1104:Fields should not have public accessibility", Justification = "Field value loaded from XML")]
|
||||
public string tag;
|
||||
[SuppressMessage("Minor Code Smell", "S1104:Fields should not have public accessibility", Justification = "Field value loaded from XML")]
|
||||
public bool exclusive = false;
|
||||
[SuppressMessage("Minor Code Smell", "S1104:Fields should not have public accessibility", Justification = "Field value loaded from XML")]
|
||||
public bool applyonpartner = false;
|
||||
|
||||
public PreceptComp_KnowsMemoryThoughtTagged() { }
|
||||
|
||||
public override void Notify_MemberWitnessedAction(HistoryEvent ev, Precept precept, Pawn member)
|
||||
{
|
||||
if (!applyonpartner)
|
||||
if (!applyonpartner && ev.args.TryGetArg(HistoryEventArgsNamesCustom.Partner, out Pawn pawn) && pawn == member)
|
||||
{
|
||||
if (ev.args.TryGetArg(HistoryEventArgsNamesCustom.Partner, out Pawn pawn))
|
||||
{
|
||||
if (pawn == member) return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (tag != null)
|
||||
{
|
||||
|
|
|
@ -1,19 +1,12 @@
|
|||
using System;
|
||||
using RimWorld;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using RimWorld;
|
||||
using Verse;
|
||||
|
||||
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
|
||||
namespace RJWSexperience.Ideology
|
||||
{
|
||||
public class PreceptDef_RequirementExtended : PreceptDef
|
||||
{
|
||||
public List<MemeDef> requiredAllMemes = new List<MemeDef>();
|
||||
}
|
||||
|
||||
|
||||
public class PreceptDef_RequirementExtended : PreceptDef
|
||||
{
|
||||
[SuppressMessage("Minor Code Smell", "S1104:Fields should not have public accessibility", Justification = "Field value loaded from XML")]
|
||||
public List<MemeDef> requiredAllMemes = new List<MemeDef>();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,12 +25,9 @@ namespace RJWSexperience.Ideology
|
|||
public static void Postfix(Pawn otherPawn, Pawn ___pawn, ref float __result)
|
||||
{
|
||||
Ideo ideo = ___pawn.Ideo;
|
||||
if (ideo != null)
|
||||
if (ideo?.HasPrecept(VariousDefOf.Incestuos_IncestOnly) == true && IdeoUtility.IsIncest(___pawn, otherPawn))
|
||||
{
|
||||
if (ideo.HasPrecept(VariousDefOf.Incestuos_IncestOnly) && IdeoUtility.IsIncest(___pawn, otherPawn))
|
||||
{
|
||||
__result *= 8f;
|
||||
}
|
||||
__result *= 8f;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -51,21 +48,17 @@ namespace RJWSexperience.Ideology
|
|||
{
|
||||
public static void Postfix(PreceptDef precept, bool checkDuplicates, ref IdeoFoundation __instance, ref AcceptanceReport __result)
|
||||
{
|
||||
if (precept is PreceptDef_RequirementExtended)
|
||||
if (precept is PreceptDef_RequirementExtended def && !def.requiredAllMemes.NullOrEmpty())
|
||||
{
|
||||
PreceptDef_RequirementExtended def = precept as PreceptDef_RequirementExtended;
|
||||
if (!def.requiredAllMemes.NullOrEmpty())
|
||||
for (int i = 0; i < def.requiredAllMemes.Count; i++)
|
||||
{
|
||||
for (int i = 0; i < def.requiredAllMemes.Count; i++)
|
||||
if (!__instance.ideo.memes.Contains(def.requiredAllMemes[i]))
|
||||
{
|
||||
if (!__instance.ideo.memes.Contains(def.requiredAllMemes[i]))
|
||||
{
|
||||
List<string> report = new List<string>();
|
||||
foreach (MemeDef meme in def.requiredAllMemes) report.Add(meme.LabelCap);
|
||||
List<string> report = new List<string>();
|
||||
foreach (MemeDef meme in def.requiredAllMemes) report.Add(meme.LabelCap);
|
||||
|
||||
__result = new AcceptanceReport("RequiresMeme".Translate() + ": " + report.ToCommaList());
|
||||
return;
|
||||
}
|
||||
__result = new AcceptanceReport("RequiresMeme".Translate() + ": " + report.ToCommaList());
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -124,9 +124,8 @@ namespace RJWSexperience.Ideology
|
|||
};
|
||||
get_banged.tickAction = delegate
|
||||
{
|
||||
if ((parteners.Count > 0) && (pawn.IsHashIntervalTick(ticks_between_hearts / parteners.Count)))
|
||||
if (pawn.IsHashIntervalTick(ticks_between_hearts))
|
||||
ThrowMetaIconF(pawn.Position, pawn.Map, FleckDefOf.Heart);
|
||||
if ((parteners.Count > 0) && pawn.IsHashIntervalTick(ticks_between_hearts / parteners.Count) && pawn.IsHashIntervalTick(ticks_between_hearts))
|
||||
ThrowMetaIconF(pawn.Position, pawn.Map, FleckDefOf.Heart);
|
||||
};
|
||||
get_banged.AddEndCondition(new Func<JobCondition>(() =>
|
||||
{
|
||||
|
|
|
@ -1,45 +1,40 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using RimWorld;
|
||||
using RimWorld;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using Verse;
|
||||
using rjw;
|
||||
|
||||
|
||||
namespace RJWSexperience.Ideology
|
||||
{
|
||||
public class RitualOutcomeComp_HediffBased : RitualOutcomeComp_QualitySingleOffset
|
||||
{
|
||||
HediffDef hediffDef = null;
|
||||
float minSeverity = 0;
|
||||
string roleId = "";
|
||||
public class RitualOutcomeComp_HediffBased : RitualOutcomeComp_QualitySingleOffset
|
||||
{
|
||||
[SuppressMessage("Minor Code Smell", "S1104:Fields should not have public accessibility", Justification = "Field value loaded from XML")]
|
||||
public HediffDef hediffDef = null;
|
||||
[SuppressMessage("Minor Code Smell", "S1104:Fields should not have public accessibility", Justification = "Field value loaded from XML")]
|
||||
public float minSeverity = 0;
|
||||
[SuppressMessage("Minor Code Smell", "S1104:Fields should not have public accessibility", Justification = "Field value loaded from XML")]
|
||||
public string roleId = "";
|
||||
|
||||
protected override string LabelForDesc => label;
|
||||
public override bool DataRequired => false;
|
||||
protected override string LabelForDesc => label;
|
||||
public override bool DataRequired => false;
|
||||
public override bool Applies(LordJob_Ritual ritual)
|
||||
{
|
||||
Pawn victim = null;
|
||||
foreach(RitualRole ritualRole in ritual.assignments.AllRolesForReading)
|
||||
{
|
||||
if (ritualRole != null && ritualRole.id.Contains(roleId))
|
||||
foreach (RitualRole ritualRole in ritual.assignments.AllRolesForReading)
|
||||
{
|
||||
if (ritualRole?.id.Contains(roleId) == true)
|
||||
{
|
||||
victim = ritual.assignments.FirstAssignedPawn(ritualRole);
|
||||
}
|
||||
}
|
||||
if (victim != null && hediffDef != null)
|
||||
{
|
||||
{
|
||||
Hediff hediff = victim.health.hediffSet.GetFirstHediffOfDef(hediffDef);
|
||||
if (hediff?.Severity >= minSeverity)
|
||||
{
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public override ExpectedOutcomeDesc GetExpectedOutcomeDesc(Precept_Ritual ritual, TargetInfo ritualTarget, RitualObligation obligation, RitualRoleAssignments assignments, RitualOutcomeComp_Data data)
|
||||
{
|
||||
|
@ -53,13 +48,14 @@ namespace RJWSexperience.Ideology
|
|||
positive = true
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public class RitualOutcomeComp_NeedBased : RitualOutcomeComp_QualitySingleOffset
|
||||
{
|
||||
NeedDef needDef = null;
|
||||
float minAvgNeed = 0;
|
||||
[SuppressMessage("Minor Code Smell", "S1104:Fields should not have public accessibility", Justification = "Field value loaded from XML")]
|
||||
public NeedDef needDef = null;
|
||||
[SuppressMessage("Minor Code Smell", "S1104:Fields should not have public accessibility", Justification = "Field value loaded from XML")]
|
||||
public float minAvgNeed = 0;
|
||||
|
||||
protected override string LabelForDesc => label;
|
||||
public override bool DataRequired => false;
|
||||
|
@ -71,9 +67,7 @@ namespace RJWSexperience.Ideology
|
|||
avgNeed += pawn.needs?.TryGetNeed(needDef)?.CurLevel ?? 0f;
|
||||
}
|
||||
avgNeed /= ritual.assignments.AllPawns.Count;
|
||||
if (avgNeed >= minAvgNeed) return true;
|
||||
|
||||
return false;
|
||||
return avgNeed >= minAvgNeed;
|
||||
}
|
||||
|
||||
public override ExpectedOutcomeDesc GetExpectedOutcomeDesc(Precept_Ritual ritual, TargetInfo ritualTarget, RitualObligation obligation, RitualRoleAssignments assignments, RitualOutcomeComp_Data data)
|
||||
|
@ -89,7 +83,4 @@ namespace RJWSexperience.Ideology
|
|||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -1,66 +1,69 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using rjw;
|
||||
using RimWorld;
|
||||
using RimWorld;
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using Verse;
|
||||
|
||||
|
||||
namespace RJWSexperience.Ideology
|
||||
{
|
||||
public class StatPart_GenderPrimacy : StatPart
|
||||
{
|
||||
public float modifier;
|
||||
public class StatPart_GenderPrimacy : StatPart
|
||||
{
|
||||
[SuppressMessage("Minor Code Smell", "S1104:Fields should not have public accessibility", Justification = "Field value loaded from XML")]
|
||||
public float modifier;
|
||||
|
||||
public override string ExplanationPart(StatRequest req)
|
||||
{
|
||||
Pawn pawn = req.Thing as Pawn;
|
||||
Ideo ideo = null;
|
||||
if (pawn != null) ideo = pawn.Ideo;
|
||||
float fact = 1f;
|
||||
if (ideo != null && !ideo.memes.NullOrEmpty()) for (int i = 0; i < ideo.memes.Count; i++)
|
||||
{
|
||||
if (ideo.memes[i] == MemeDefOf.MaleSupremacy)
|
||||
{
|
||||
if (pawn.gender == Gender.Male) fact = modifier;
|
||||
else if (pawn.gender == Gender.Female) fact = 1/modifier;
|
||||
break;
|
||||
}
|
||||
else if (ideo.memes[i] == MemeDefOf.FemaleSupremacy)
|
||||
{
|
||||
if (pawn.gender == Gender.Male) fact = 1/modifier;
|
||||
else if (pawn.gender == Gender.Female) fact = modifier;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return Keyed.MemeStatFactor(String.Format("{0:0.##}", fact * 100));
|
||||
}
|
||||
public override string ExplanationPart(StatRequest req)
|
||||
{
|
||||
if (!req.HasThing || !(req.Thing is Pawn pawn))
|
||||
return null;
|
||||
|
||||
public override void TransformValue(StatRequest req, ref float val)
|
||||
{
|
||||
Pawn pawn = req.Thing as Pawn;
|
||||
Ideo ideo = null;
|
||||
if (pawn != null) ideo = pawn.Ideo;
|
||||
if (ideo != null && !ideo.memes.NullOrEmpty()) for(int i=0; i< ideo.memes.Count; i++)
|
||||
{
|
||||
if (ideo.memes[i] == MemeDefOf.MaleSupremacy)
|
||||
{
|
||||
if (pawn.gender == Gender.Male) val *= modifier;
|
||||
else if (pawn.gender == Gender.Female) val /= modifier;
|
||||
break;
|
||||
}
|
||||
else if(ideo.memes[i] == MemeDefOf.FemaleSupremacy)
|
||||
{
|
||||
if (pawn.gender == Gender.Male) val /= modifier;
|
||||
else if (pawn.gender == Gender.Female) val *= modifier;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Ideo ideo = pawn.Ideo;
|
||||
float fact = 1f;
|
||||
if (ideo?.memes.NullOrEmpty() == false)
|
||||
{
|
||||
for (int i = 0; i < ideo.memes.Count; i++)
|
||||
{
|
||||
if (ideo.memes[i] == MemeDefOf.MaleSupremacy)
|
||||
{
|
||||
if (pawn.gender == Gender.Male) fact = modifier;
|
||||
else if (pawn.gender == Gender.Female) fact = 1 / modifier;
|
||||
break;
|
||||
}
|
||||
else if (ideo.memes[i] == MemeDefOf.FemaleSupremacy)
|
||||
{
|
||||
if (pawn.gender == Gender.Male) fact = 1 / modifier;
|
||||
else if (pawn.gender == Gender.Female) fact = modifier;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return Keyed.MemeStatFactor(String.Format("{0:0.##}", fact * 100));
|
||||
}
|
||||
|
||||
public override void TransformValue(StatRequest req, ref float val)
|
||||
{
|
||||
if (!req.HasThing || !(req.Thing is Pawn pawn))
|
||||
return;
|
||||
|
||||
Ideo ideo = pawn.Ideo;
|
||||
|
||||
if (ideo?.memes.NullOrEmpty() == false)
|
||||
{
|
||||
for (int i = 0; i < ideo.memes.Count; i++)
|
||||
{
|
||||
if (ideo.memes[i] == MemeDefOf.MaleSupremacy)
|
||||
{
|
||||
if (pawn.gender == Gender.Male) val *= modifier;
|
||||
else if (pawn.gender == Gender.Female) val /= modifier;
|
||||
break;
|
||||
}
|
||||
else if (ideo.memes[i] == MemeDefOf.FemaleSupremacy)
|
||||
{
|
||||
if (pawn.gender == Gender.Male) val /= modifier;
|
||||
else if (pawn.gender == Gender.Female) val *= modifier;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ namespace RJWSexperience.Ideology
|
|||
base.ThoughtInterval();
|
||||
if (recordIncrement != 0)
|
||||
{
|
||||
pawn.records.AddTo(recordDef, recordIncrement);
|
||||
pawn.records.AddTo(RecordDef, recordIncrement);
|
||||
recordIncrement = 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
using RimWorld;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
|
||||
namespace RJWSexperience.Ideology
|
||||
{
|
||||
|
@ -8,6 +9,7 @@ namespace RJWSexperience.Ideology
|
|||
/// </summary>
|
||||
public class ThoughtDef_Opinionbased : ThoughtDef
|
||||
{
|
||||
[SuppressMessage("Minor Code Smell", "S1104:Fields should not have public accessibility", Justification = "Field value loaded from XML")]
|
||||
public List<float> minimumValueforStage = new List<float>();
|
||||
}
|
||||
|
||||
|
@ -17,7 +19,7 @@ namespace RJWSexperience.Ideology
|
|||
public class Thought_Opinionbased : Thought_Memory
|
||||
{
|
||||
protected ThoughtDef_Opinionbased Def => (ThoughtDef_Opinionbased)def;
|
||||
protected List<float> minimumValueforStage => Def.minimumValueforStage;
|
||||
protected List<float> MinimumValueforStage => Def.minimumValueforStage;
|
||||
|
||||
public override int CurStageIndex
|
||||
{
|
||||
|
@ -25,9 +27,9 @@ namespace RJWSexperience.Ideology
|
|||
{
|
||||
float value = 0f;
|
||||
if (otherPawn != null) value = pawn.relations?.OpinionOf(otherPawn) ?? 0f;
|
||||
for (int i = minimumValueforStage.Count - 1; i > 0; i--)
|
||||
for (int i = MinimumValueforStage.Count - 1; i > 0; i--)
|
||||
{
|
||||
if (minimumValueforStage[i] < value) return i;
|
||||
if (MinimumValueforStage[i] < value) return i;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
using RimWorld;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
|
||||
namespace RJWSexperience.Ideology
|
||||
{
|
||||
|
@ -8,8 +9,11 @@ namespace RJWSexperience.Ideology
|
|||
/// </summary>
|
||||
public class ThoughtDef_Recordbased : ThoughtDef
|
||||
{
|
||||
[SuppressMessage("Minor Code Smell", "S1104:Fields should not have public accessibility", Justification = "Field value loaded from XML")]
|
||||
public RecordDef recordDef;
|
||||
[SuppressMessage("Minor Code Smell", "S1104:Fields should not have public accessibility", Justification = "Field value loaded from XML")]
|
||||
public List<float> minimumValueforStage = new List<float>();
|
||||
[SuppressMessage("Minor Code Smell", "S1104:Fields should not have public accessibility", Justification = "Field value loaded from XML")]
|
||||
public float increment;
|
||||
}
|
||||
|
||||
|
@ -19,17 +23,17 @@ namespace RJWSexperience.Ideology
|
|||
public class Thought_Recordbased : Thought_Memory
|
||||
{
|
||||
protected ThoughtDef_Recordbased Def => (ThoughtDef_Recordbased)def;
|
||||
protected RecordDef recordDef => Def.recordDef;
|
||||
protected List<float> minimumValueforStage => Def.minimumValueforStage;
|
||||
protected RecordDef RecordDef => Def.recordDef;
|
||||
protected List<float> MinimumValueforStage => Def.minimumValueforStage;
|
||||
|
||||
public override int CurStageIndex
|
||||
{
|
||||
get
|
||||
{
|
||||
float value = pawn?.records?.GetValue(recordDef) ?? 0f;
|
||||
for (int i = minimumValueforStage.Count - 1; i > 0; i--)
|
||||
float value = pawn?.records?.GetValue(RecordDef) ?? 0f;
|
||||
for (int i = MinimumValueforStage.Count - 1; i > 0; i--)
|
||||
{
|
||||
if (minimumValueforStage[i] < value) return i + 1;
|
||||
if (MinimumValueforStage[i] < value) return i + 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -1,35 +1,31 @@
|
|||
using System;
|
||||
using RimWorld;
|
||||
using rjw;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Verse;
|
||||
using RimWorld;
|
||||
using UnityEngine;
|
||||
using rjw;
|
||||
|
||||
using Verse;
|
||||
|
||||
namespace RJWSexperience.UI
|
||||
{
|
||||
public static class RJWUIUtility
|
||||
public static class RJWUIUtility
|
||||
{
|
||||
public const float FONTHEIGHT = 22f;
|
||||
public const float CARDHEIGHT = 110f;
|
||||
public const float LISTPAWNSIZE = 100f;
|
||||
public const float BASESAT = 0.40f;
|
||||
public const float ICONSIZE = 30f;
|
||||
|
||||
|
||||
public static void DrawQuirk(this Rect rect, Pawn pawn)
|
||||
{
|
||||
List<Quirk> quirks = Quirk.All.FindAll(x => pawn.Has(x));
|
||||
string quirkstr = quirks.Select(x => x.Key).ToCommaList();
|
||||
{
|
||||
List<Quirk> quirks = Quirk.All.FindAll(x => pawn.Has(x));
|
||||
string quirkstr = quirks.Select(x => x.Key).ToCommaList();
|
||||
string tooltip = "";
|
||||
|
||||
Widgets.Label(rect, "Quirks".Translate() + quirkstr);
|
||||
|
||||
if (Mouse.IsOver(rect))
|
||||
{
|
||||
{
|
||||
if (quirks.NullOrEmpty())
|
||||
{
|
||||
tooltip = "NoQuirks".Translate();
|
||||
|
@ -47,52 +43,50 @@ namespace RJWSexperience.UI
|
|||
}
|
||||
Widgets.DrawHighlight(rect);
|
||||
}
|
||||
|
||||
|
||||
TooltipHandler.TipRegion(rect, tooltip);
|
||||
}
|
||||
}
|
||||
|
||||
public static void DrawSexuality(this Rect rect, CompRJW comp)
|
||||
{
|
||||
{
|
||||
if (comp != null)
|
||||
{
|
||||
{
|
||||
string sexuality = Keyed.Sexuality[(int)comp.orientation];
|
||||
Widgets.Label(rect, Keyed.RS_Sexuality + ": " + sexuality);
|
||||
Widgets.DrawHighlightIfMouseover(rect);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static string GetRelationsString(this Pawn pawn, Pawn otherpawn)
|
||||
{
|
||||
{
|
||||
if (otherpawn != null)
|
||||
{
|
||||
{
|
||||
IEnumerable<PawnRelationDef> relations = pawn.GetRelations(otherpawn);
|
||||
if (!relations.EnumerableNullOrEmpty()) return relations.Select(x => x.GetGenderSpecificLabel(otherpawn)).ToCommaList().CapitalizeFirst();
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static void DrawBorder(this Rect rect, Texture border, float thickness = 1f)
|
||||
{
|
||||
GUI.DrawTexture(new Rect(rect.x,rect.y,rect.width, thickness), border);
|
||||
GUI.DrawTexture(new Rect(rect.x+rect.width-thickness,rect.y, thickness, rect.height), border);
|
||||
GUI.DrawTexture(new Rect(rect.x,rect.y+rect.height - thickness,rect.width, thickness), border);
|
||||
{
|
||||
GUI.DrawTexture(new Rect(rect.x, rect.y, rect.width, thickness), border);
|
||||
GUI.DrawTexture(new Rect(rect.x + rect.width - thickness, rect.y, thickness, rect.height), border);
|
||||
GUI.DrawTexture(new Rect(rect.x, rect.y + rect.height - thickness, rect.width, thickness), border);
|
||||
GUI.DrawTexture(new Rect(rect.x, rect.y, thickness, rect.height), border);
|
||||
}
|
||||
|
||||
public static string GetStatExplanation(Pawn pawn, StatDef stat, float val)
|
||||
{
|
||||
{
|
||||
if (!pawn.Dead)
|
||||
return stat.description + "\n" +
|
||||
stat.Worker.GetExplanationFull(StatRequest.For(pawn), ToStringNumberSense.Undefined, val);
|
||||
return stat.description + "\n" + stat.Worker.GetExplanationFull(StatRequest.For(pawn), ToStringNumberSense.Undefined, val);
|
||||
return "Dead".Translate();
|
||||
}
|
||||
}
|
||||
|
||||
public static string GetSexDays(int absticks, bool printUnknown = false)
|
||||
{
|
||||
{
|
||||
if (absticks != 0) return GenDate.ToStringTicksToDays(GenTicks.TicksAbs - absticks) + " " + Keyed.RS_Ago;
|
||||
else if (printUnknown) return Keyed.Unknown;
|
||||
else return "";
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue