Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion About/About.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<name>Numbers</name>
<author>koisama</author>
<url>https://ludeon.com/forums/index.php?topic=16558.0</url>
<targetVersion>0.16.1393</targetVersion>
<targetVersion>0.17.1532</targetVersion>
<description>
Adds a customizable general overview tab, allowing you to see any stats on all your colonists or prisoners in a single window.
</description>
Expand Down
10 changes: 5 additions & 5 deletions Defs/MainTabDefs/kNumbers.xml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<?xml version="1.0" encoding="utf-8" ?>
<MainTabDefs>
<MainButtonDefs>

<MainTabDef>
<MainButtonDef>
<defName>kNumbersOverviewTab</defName>
<label>Numbers</label>
<description>See every possible stat on every colonist or prisoner in a single table.</description>
<windowClass>kNumbers.MainTabWindow_Numbers</windowClass>
<tabWindowClass>kNumbers.MainTabWindow_Numbers</tabWindowClass>
<order>20</order>
</MainTabDef>
</MainButtonDef>

</MainTabDefs>
</MainButtonDefs>
93 changes: 38 additions & 55 deletions Source/kNumbers/KListObject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,33 +63,33 @@ public enum objectType
public void ExposeData()
{

Scribe_Values.LookValue<objectType>(ref oType, "oType");
Scribe_Values.LookValue<float>(ref minWidthDesired, "minWidthDesired");
Scribe_Values.LookValue<string>(ref this.label, "label");
Scribe_Values.Look<objectType>(ref oType, "oType");
Scribe_Values.Look<float>(ref minWidthDesired, "minWidthDesired");
Scribe_Values.Look<string>(ref this.label, "label");

switch (oType)
{
case objectType.Stat:
StatDef tempObjectS = (StatDef)displayObject;
Scribe_Defs.LookDef(ref tempObjectS, "displayObject");
Scribe_Defs.Look(ref tempObjectS, "displayObject");
displayObject = tempObjectS;
break;

case objectType.Skill:
SkillDef tempObjectK = (SkillDef)displayObject;
Scribe_Defs.LookDef(ref tempObjectK, "displayObject");
Scribe_Defs.Look(ref tempObjectK, "displayObject");
displayObject = tempObjectK;
break;

case objectType.Need:
NeedDef tempObjectN = (NeedDef)displayObject;
Scribe_Defs.LookDef(ref tempObjectN, "displayObject");
Scribe_Defs.Look(ref tempObjectN, "displayObject");
displayObject = tempObjectN;
break;

case objectType.Capacity:
PawnCapacityDef tempObjectCap = (PawnCapacityDef)displayObject;
Scribe_Defs.LookDef(ref tempObjectCap, "displayObject");
Scribe_Defs.Look(ref tempObjectCap, "displayObject");
displayObject = tempObjectCap;
break;

Expand Down Expand Up @@ -249,7 +249,7 @@ private void DrawGear(Rect rect, ThingWithComps ownerPawn)
Pawn p1 = (ownerPawn is Pawn) ? (ownerPawn as Pawn) : (ownerPawn as Corpse).InnerPawn;
if (p1.RaceProps.Animal) return;
if (p1.equipment != null)
foreach(ThingWithComps thing in p1.equipment.AllEquipment)
foreach(ThingWithComps thing in p1.equipment.AllEquipmentListForReading)
{
Rect rect2 = new Rect(x, 0, gWidth, gHeight);
DrawThing(rect2, thing, p1);
Expand Down Expand Up @@ -290,26 +290,26 @@ private void DrawThing(Rect rect, Thing thing, Pawn selPawn)
Apparel ap = thing as Apparel;
if (ap != null)
{
Apparel unused;
action = delegate
{
selPawn.apparel.TryDrop(ap, out unused, selPawn.Position, true);
{
Apparel unused;
selPawn.apparel.TryDrop(ap, out unused, selPawn.Position, true);
};
}
else if (eq != null && selPawn.equipment.AllEquipment.Contains(eq))
else if (eq != null && selPawn.equipment.AllEquipmentListForReading.Contains(eq))
{
ThingWithComps unused;
action = delegate
{
selPawn.equipment.TryDropEquipment(eq, out unused, selPawn.Position, true);
{
ThingWithComps unused;
selPawn.equipment.TryDropEquipment(eq, out unused, selPawn.Position, true);
};
}
else if (!thing.def.destroyOnDrop)
{
Thing unused;
action = delegate
{
selPawn.inventory.innerContainer.TryDrop(thing, selPawn.Position, selPawn.Map, ThingPlaceMode.Near, out unused);
{
Thing unused;
selPawn.inventory.innerContainer.TryDrop(thing, selPawn.Position, selPawn.Map, ThingPlaceMode.Near, out unused);
};
}
list.Add(new FloatMenuOption("DropThing".Translate(), action, MenuOptionPriority.Default, null, null));
Expand Down Expand Up @@ -427,7 +427,7 @@ public void Draw(Rect rect, ThingWithComps ownerPawn)


// I stole this one line from Fluffy's Medical Tab. THANKS FLUFFY!
string capValue = (p.health.capacities.GetEfficiency(cap) * 100f).ToString("F0") + "%";
string capValue = (p.health.capacities.GetLevel(cap) * 100f).ToString("F0") + "%";
GUI.color = effLabel.Second;
Widgets.Label(rect, capValue);
GUI.color = Color.white;
Expand Down Expand Up @@ -488,39 +488,22 @@ public void Draw(Rect rect, ThingWithComps ownerPawn)

case objectType.ControlPrisonerInteraction:
if (ownerPawn is Pawn)
{
if (Mouse.IsOver(rect))
{
GUI.DrawTexture(rect, TexUI.HighlightTex);
}
float x = 8f;
{
if (Mouse.IsOver(rect)) { GUI.DrawTexture(rect, TexUI.HighlightTex); }
float x = 8f;

GUI.BeginGroup(rect);
IEnumerator enumerator = Enum.GetValues(typeof(PrisonerInteractionMode)).GetEnumerator();
try
{
while (enumerator.MoveNext())
{
PrisonerInteractionMode prisonerInteractionMode = (PrisonerInteractionMode)((byte)enumerator.Current);
if (Widgets.RadioButton(new Vector2(x, 3f), (ownerPawn as Pawn).guest.interactionMode == prisonerInteractionMode))
{
(ownerPawn as Pawn).guest.interactionMode = prisonerInteractionMode;
}
TooltipHandler.TipRegion(new Rect(x, 0f, 30f, 30f), new TipSignal(prisonerInteractionMode.GetLabel()));
x += 30f;
}
}
finally
{
IDisposable disposable = enumerator as IDisposable;
if (disposable != null)
{
disposable.Dispose();
}
}
GUI.EndGroup();
}
break;
GUI.BeginGroup(rect);

foreach (var prisonerInteractionMode in DefDatabase<PrisonerInteractionModeDef>.AllDefs)
{
if (Widgets.RadioButton(new Vector2(x, 3f), (ownerPawn as Pawn).guest.interactionMode == prisonerInteractionMode)) { (ownerPawn as Pawn).guest.interactionMode = prisonerInteractionMode; }
TooltipHandler.TipRegion(new Rect(x, 0f, 30f, 30f), new TipSignal(prisonerInteractionMode.GetLabel()));
x += 30f;
}

GUI.EndGroup();
}
break;

case objectType.ControlMedicalCare:
if (ownerPawn is Pawn) MedicalCareSetter(rect, ref (ownerPawn as Pawn).playerSettings.medCare);
Expand All @@ -530,9 +513,9 @@ public void Draw(Rect rect, ThingWithComps ownerPawn)
Text.Anchor = TextAnchor.MiddleCenter;
if (ownerPawn is Pawn && ((Pawn)ownerPawn).ageTracker.CurLifeStage.milkable)
{
var comp = ((Pawn)ownerPawn).AllComps.Where<ThingComp>(x => x is CompMilkable).FirstOrDefault();
var comp = ownerPawn.AllComps.OfType<CompMilkable>().FirstOrDefault();
if(comp != null)
value = ((CompMilkable)comp).Fullness.ToStringPercent();
value = comp.Fullness.ToStringPercent();
}

Widgets.Label(rect, value);
Expand All @@ -542,9 +525,9 @@ public void Draw(Rect rect, ThingWithComps ownerPawn)
Text.Anchor = TextAnchor.MiddleCenter;
if (ownerPawn is Pawn && ((Pawn)ownerPawn).ageTracker.CurLifeStage.shearable)
{
var comp = ((Pawn)ownerPawn).AllComps.Where<ThingComp>(x => x is CompShearable).FirstOrDefault();
var comp = ownerPawn.AllComps.OfType<CompShearable>().FirstOrDefault();
if (comp != null)
value = ((CompShearable)comp).Fullness.ToStringPercent();
value = comp.Fullness.ToStringPercent();
}

Widgets.Label(rect, value);
Expand Down
Loading