mirror of
https://gitgud.io/lutepickle/rjw_menstruation.git
synced 2024-08-14 22:46:52 +00:00
Optimized gizmo injection
This commit is contained in:
parent
55e55fbc35
commit
e67010239b
2 changed files with 15 additions and 31 deletions
|
@ -17,43 +17,27 @@ namespace RJW_Menstruation
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
List<Gizmo> gizmoList = __result.ToList();
|
|
||||||
|
|
||||||
|
|
||||||
if (__instance.ShouldShowWombGizmo())
|
if (__instance.ShouldShowWombGizmo())
|
||||||
{
|
{
|
||||||
AddWombGizmos(__instance, ref gizmoList);
|
__result = AddWombGizmos(__instance, __result);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//if (Configurations.EnableWombIcon && __instance.gender == Gender.Female)
|
private static IEnumerable<Gizmo> AddWombGizmos(Pawn __instance, IEnumerable<Gizmo> gizmos)
|
||||||
//{
|
|
||||||
// if (!__instance.IsAnimal())
|
|
||||||
// {
|
|
||||||
// AddWombGizmos(__instance, ref gizmoList);
|
|
||||||
// }
|
|
||||||
// else if (Configurations.EnableAnimalCycle)
|
|
||||||
// {
|
|
||||||
// AddWombGizmos(__instance, ref gizmoList);
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
__result = gizmoList;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private static void AddWombGizmos(Pawn __instance, ref List<Gizmo> gizmoList)
|
|
||||||
{
|
{
|
||||||
|
foreach (Gizmo gizmo in gizmos)
|
||||||
|
yield return gizmo;
|
||||||
|
|
||||||
HediffComp_Menstruation comp = __instance.GetMenstruationComp();
|
HediffComp_Menstruation comp = __instance.GetMenstruationComp();
|
||||||
if (comp != null) AddMenstruationGizmos(__instance, comp, ref gizmoList);
|
if (comp == null) yield break;
|
||||||
|
|
||||||
|
foreach (Gizmo gizmo in GetMenstruationGizmos(__instance, comp))
|
||||||
|
yield return gizmo;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void AddMenstruationGizmos(Pawn pawn, HediffComp_Menstruation comp, ref List<Gizmo> gizmolist)
|
public static List<Gizmo> GetMenstruationGizmos(Pawn pawn, HediffComp_Menstruation comp)
|
||||||
{
|
{
|
||||||
gizmolist.Add(CreateGizmo_WombStatus(pawn, comp));
|
return new List<Gizmo>() { CreateGizmo_WombStatus(pawn, comp) };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -13,15 +13,15 @@ using HarmonyLib;
|
||||||
|
|
||||||
namespace RJW_Menstruation.Sexperience
|
namespace RJW_Menstruation.Sexperience
|
||||||
{
|
{
|
||||||
[HarmonyPatch(typeof(Pawn_GetGizmos), "AddMenstruationGizmos")]
|
[HarmonyPatch(typeof(Pawn_GetGizmos), nameof(Pawn_GetGizmos.GetMenstruationGizmos))]
|
||||||
public static class GetGizmos_Patch
|
public static class GetGizmos_Patch
|
||||||
{
|
{
|
||||||
public static void Postfix(Pawn pawn, HediffComp_Menstruation comp, ref List<Gizmo> gizmolist)
|
public static void Postfix(Pawn pawn, HediffComp_Menstruation comp, ref List<Gizmo> __result)
|
||||||
{
|
{
|
||||||
gizmolist.Add(CreateGizmo_GatherCum(pawn, comp));
|
__result.Add(CreateGizmo_GatherCum(comp));
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Gizmo CreateGizmo_GatherCum(Pawn pawn, HediffComp_Menstruation comp)
|
private static Gizmo CreateGizmo_GatherCum(HediffComp_Menstruation comp)
|
||||||
{
|
{
|
||||||
Texture2D icon = TextureCache.GatherCum_Bucket;
|
Texture2D icon = TextureCache.GatherCum_Bucket;
|
||||||
string label = Keyed.RS_GatherCum;
|
string label = Keyed.RS_GatherCum;
|
||||||
|
|
Loading…
Reference in a new issue