Put Licentia Parts back in, but commented out so I dont forget

This commit is contained in:
Vegapnk 2024-05-30 08:52:58 +02:00
parent 90653ddc9e
commit ee2be0375c
5 changed files with 105 additions and 4 deletions

View file

@ -0,0 +1,32 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Verse;
namespace RJW_Genes
{
public class MapUtility
{
/// <summary>
/// Checks if the pawn is on the players home map.
///
/// Reason is that drones should only be punished for absence of queen if they are on the map and there is no queen.
/// If they are on a mission, transport-pod etc. they should not get boni or mali.
/// </summary>
/// <param name="pawn">The pawn for which to check map-presence.</param>
/// <returns>True if the pawn is on the home-map, False otherwise.</returns>
public static bool PawnIsOnHomeMap(Pawn pawn)
{
if (Find.Maps.NullOrEmpty() || !Find.Maps.Where(mapCandidate => mapCandidate.IsPlayerHome).Any())
{
return false;
}
Map homeMap = Find.Maps.Where(mapCandidate => mapCandidate.IsPlayerHome).First();
return
homeMap != null && pawn != null
&& pawn.Spawned
&& pawn.Map == homeMap;
}
}
}

View file

@ -29,6 +29,17 @@ namespace RJW_Genes
// I could have done some transpiler stuff, but that is scary and might need to be adjusted quite a lot // I could have done some transpiler stuff, but that is scary and might need to be adjusted quite a lot
// Hence, I simply re-book the nutrition back to the giver in the Postfix. That should be robust and easy. // Hence, I simply re-book the nutrition back to the giver in the Postfix. That should be robust and easy.
/*
TODO: Move this back in, once Licentia is 1.5 compatible. It should not drastically change.
if (GeneUtility.IsGenerousDonor(giver))
{
float donatedNutrition = CumflationHelper.CalculateNutritionAmount(giver, cumAmount);
// TODO: In theory, there could be something weird happening if the donor has food less than X and the "IgnoreThermodynamics" is set on.
// Then it can happen that the donor ends up with more food than he had before cumshot, but I think that is somewhat funny given that you have ignore Thermodynamics on.
Need_Food inflatorFood = giver.needs.TryGetNeed<Need_Food>();
inflatorFood.CurLevel += donatedNutrition;
}
*/
} }
} }
} }

View file

@ -0,0 +1,56 @@
//using LicentiaLabs;
using Verse;
// TODO: Re-Introduce this once Licentia is 1.5
// It should be rather simple
namespace RJW_Genes
{
/// <summary>
/// This Gene adds Licentia-Labs Elasticised Hediff to a Pawn.
/// Note: I had a HarmonyPatch first, similar to skipping cumflation, but the Stretching Logic is called quite a lot and for both pawns actually.
/// Hence, I think choosing the Elasticiced Hediff was good as then everything is covered by "Licentia-Logic".
/// </summary>
public class Gene_Elasticity : Gene
{
private const int RESET_INTERVAL = 60000; // 60k should be 1 day
/*
public override void PostAdd()
{
base.PostAdd();
// Doing it like this will add the hediff with a severity of ~0.5, but it will decay.
// Hence we check with the Ticks to update.
this.pawn.health.AddHediff(Licentia.HediffDefs.Elasticised);
ResetSeverity();
}
public override void Tick()
{
base.Tick();
if (pawn.IsHashIntervalTick(RESET_INTERVAL))
ResetSeverity();
}
public override void PostRemove()
{
Hediff candidate = pawn.health.hediffSet.GetFirstHediffOfDef(Licentia.HediffDefs.Elasticised);
if (candidate != null)
{
pawn.health.RemoveHediff(candidate);
}
base.PostRemove();
}
private void ResetSeverity(float severity = 0.7f)
{
Hediff candidate = pawn.health.hediffSet.GetFirstHediffOfDef(Licentia.HediffDefs.Elasticised);
if (candidate != null)
{
candidate.Severity = severity;
}
}
*/
}
}

View file

@ -33,15 +33,15 @@ namespace RJW_Genes
if (!other.RaceProps.Humanlike) if (!other.RaceProps.Humanlike)
return (ThoughtState)false; return (ThoughtState)false;
// Pawns that have not "met" wont give each other Mali
// Known-Each-Other is a key-word for Rimworld that shows they have had any interaction and stored each other in relations.
if (!RelationsUtility.PawnsKnowEachOther(pawn, other)) if (!RelationsUtility.PawnsKnowEachOther(pawn, other))
return (ThoughtState)false; return (ThoughtState)false;
// If the pawn is not on Map (e.g. caravan), no mali // If the pawn is not on Map (e.g. caravan), no mali
if (!MapUtility.PawnIsOnHomeMap(pawn))
return (ThoughtState)false;
// Do nothing for pawns that also have pheromones // Do nothing for pawns that also have pheromones
if (GeneUtility.HasGeneNullCheck(pawn, GeneDefOf.rjw_genes_aphrodisiac_pheromones)) if (GeneUtility.HasGeneNullCheck(pawn, GeneDefOf.rjw_genes_aphrodisiac_pheromones))
return (ThoughtState)false; return (ThoughtState)false;
// Actual Logic: // Actual Logic:

View file

@ -60,9 +60,11 @@
<Compile Include="Common\Defs\ModExtensionHelper.cs" /> <Compile Include="Common\Defs\ModExtensionHelper.cs" />
<Compile Include="Common\Either.cs" /> <Compile Include="Common\Either.cs" />
<Compile Include="Common\Helpers\LaborState.cs" /> <Compile Include="Common\Helpers\LaborState.cs" />
<Compile Include="Common\Helpers\MapUtility.cs" />
<Compile Include="Common\ModLog.cs" /> <Compile Include="Common\ModLog.cs" />
<Compile Include="Common\Defs\TickIntervalExtension.cs" /> <Compile Include="Common\Defs\TickIntervalExtension.cs" />
<Compile Include="Common\Patches\PatchImplants.cs" /> <Compile Include="Common\Patches\PatchImplants.cs" />
<Compile Include="Genes\Damage\Gene_Elasticity.cs" />
<Compile Include="Genes\Patches\PatchLitteredBirth.cs" /> <Compile Include="Genes\Patches\PatchLitteredBirth.cs" />
<Compile Include="Common\Patches\PatchGetParents.cs" /> <Compile Include="Common\Patches\PatchGetParents.cs" />
<Compile Include="Common\Patches\PatchPregnancyHelper.cs" /> <Compile Include="Common\Patches\PatchPregnancyHelper.cs" />