Skip to content

Commit

Permalink
Added age tracking
Browse files Browse the repository at this point in the history
  • Loading branch information
koisama committed Jun 24, 2016
1 parent b88bd0b commit b867ed5
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 2 deletions.
Binary file modified Assemblies/RWNumbers.dll
Binary file not shown.
1 change: 1 addition & 0 deletions Languages/English/Keyed/Keys.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
<koisama.Interaction>Prisoner Interaction</koisama.Interaction>
<koisama.Interaction.description>How should wardens treat this prisoner.</koisama.Interaction.description>
<koisama.MedicalCare>Medical Care</koisama.MedicalCare>
<koisama.Age>Age</koisama.Age>

<koisama.pawntype.Colonists>Colonists</koisama.pawntype.Colonists>
<koisama.pawntype.Enemies>Enemies</koisama.pawntype.Enemies>
Expand Down
14 changes: 13 additions & 1 deletion Source/kNumbers/KListObject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ public enum objectType
ControlPrisonerInteraction,
CurrentJob,
AnimalMilkFullness,
AnimalWoolGrowth
AnimalWoolGrowth,
Age
}

public objectType oType;
Expand Down Expand Up @@ -108,6 +109,7 @@ public KListObject(objectType type, string defName, object dObject)
minWidthDesired = 120f;
break;

case objectType.Age:
case objectType.AnimalMilkFullness:
case objectType.AnimalWoolGrowth:
case objectType.Stat:
Expand Down Expand Up @@ -397,6 +399,16 @@ public void Draw(Rect rect, ThingWithComps ownerPawn)
if (ownerPawn is Pawn) DrawNeed(rect, ownerPawn as Pawn);
break;

case objectType.Age:
Text.Anchor = TextAnchor.MiddleCenter;
string ageValue = ((ownerPawn as Pawn).ageTracker.AgeBiologicalYears.ToString());
Widgets.Label(rect, ageValue);
if (Mouse.IsOver(rect))
{
GUI.DrawTexture(rect, TexUI.HighlightTex);
}
break;

case objectType.Gear:
DrawGear(rect, ownerPawn);
break;
Expand Down
20 changes: 19 additions & 1 deletion Source/kNumbers/MainTabWindow_Numbers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,10 @@ orderby p.GetStatValue((StatDef)sortObject.displayObject, true) ascending
this.things = tempPawns.Where(p=>p is Pawn).OrderBy(p => (p as Pawn).guest.interactionMode).ToList();
break;

case KListObject.objectType.Age:
this.things = tempPawns.Where(p => p is Pawn).OrderBy(p => (p as Pawn).ageTracker.AgeBiologicalYearsFloat).ToList();
break;

case KListObject.objectType.ControlMedicalCare:
this.things = tempPawns.Where(p => p is Pawn).OrderBy(p => (p as Pawn).playerSettings.medCare).ToList();
break;
Expand Down Expand Up @@ -562,7 +566,8 @@ public void PresetOptionsMaker()
public void OtherOptionsMaker()
{
List<FloatMenuOption> list = new List<FloatMenuOption>();


//equipment bearers
if (new[] { pawnType.Colonists, pawnType.Prisoners, pawnType.Enemies, pawnType.Corpses }.Contains(chosenPawnType))
{
Action action = delegate
Expand All @@ -574,6 +579,18 @@ public void OtherOptionsMaker()
list.Add(new FloatMenuOption("koisama.Equipment".Translate(), action, MenuOptionPriority.Medium, null, null));
}

//all living things
if (new[] { pawnType.Colonists, pawnType.Prisoners, pawnType.Enemies, pawnType.Animals, pawnType.WildAnimals, pawnType.Guests }.Contains(chosenPawnType))
{
Action action = delegate
{
KListObject kl = new KListObject(KListObject.objectType.Age, "koisama.Age".Translate(), null);
if (fits(kl.minWidthDesired))
kList.Add(kl);
};
list.Add(new FloatMenuOption("koisama.Age".Translate(), action, MenuOptionPriority.Medium, null, null));
}

if (chosenPawnType == pawnType.Prisoners) {
Action action = delegate
{
Expand Down Expand Up @@ -611,6 +628,7 @@ public void OtherOptionsMaker()
list.Add(new FloatMenuOption("WoolGrowth".Translate(), action2, MenuOptionPriority.Medium, null, null));
}

//healable
if (new[] { pawnType.Colonists, pawnType.Prisoners, pawnType.Animals }.Contains(chosenPawnType))
{
Action action = delegate
Expand Down

0 comments on commit b867ed5

Please sign in to comment.