Start on Jobdriver, WIP

This commit is contained in:
Vegapnk 2024-07-16 18:22:17 +02:00
parent 05770a834e
commit 1e667e2730
7 changed files with 190 additions and 2 deletions

View file

@ -14,6 +14,14 @@
<li Class="HediffCompProperties_SeverityPerDay"> <li Class="HediffCompProperties_SeverityPerDay">
<severityPerDay>-0.5</severityPerDay> <severityPerDay>-0.5</severityPerDay>
</li> </li>
<li Class="RJW_Genes.HediffsCompProperties_ProcessCumbucketMTB">
<mtbDaysPerStage>
<li>0</li>
<li>0.5</li>
<li>0.25</li>
<li>0.1</li>
</mtbDaysPerStage>
</li>
</comps> </comps>
<stages> <stages>
<li> <li>

View file

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8" ?>
<Defs>
<!--========= General ============-->
<JobDef>
<defName>ProcessCumbucket</defName>
<driverClass>RJW_Genes.JobDriver_ProcessingCumbucket</driverClass>
<playerInterruptible>true</playerInterruptible>
<casualInterruptible>false</casualInterruptible>
<reportString>processing internal cumbucket.</reportString>
<suspendable>false</suspendable>
</JobDef>
</Defs>

View file

@ -0,0 +1,29 @@

using RimWorld;
using System;
using Verse;
namespace RJW_Genes
{
public class HediffComp_ProcessCumbucket : HediffComp
{
public HediffsCompProperties_ProcessCumbucketMTB Props
{
get
{
return (HediffsCompProperties_ProcessCumbucketMTB)this.props;
}
}
public override void CompPostTick(ref float severityAdjustment)
{
ModLog.Debug("Running HediffComp_ProcessCumbucket CompPostTick");
if (this.Props.mtbDaysPerStage[this.parent.CurStageIndex] > 0f && base.Pawn.IsHashIntervalTick(60) && Rand.MTBEventOccurs(this.Props.mtbDaysPerStage[this.parent.CurStageIndex], 60000f, 60f))
{
ModLog.Debug("Firing HediffComp_ProcessCumbucket CompPostTick");
this.Pawn.jobs.StartJob(JobMaker.MakeJob(DefDatabase<JobDef>.GetNamed("ProcessCumbucket")), lastJobEndCondition: Verse.AI.JobCondition.InterruptForced, resumeCurJobAfterwards: true);
}
}
}
}

View file

@ -0,0 +1,36 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Verse;
namespace RJW_Genes
{
public class HediffsCompProperties_ProcessCumbucketMTB : HediffCompProperties
{
public HediffsCompProperties_ProcessCumbucketMTB()
{
this.compClass = typeof(HediffsCompProperties_ProcessCumbucketMTB);
}
public override IEnumerable<string> ConfigErrors(HediffDef parentDef)
{
foreach (string text in base.ConfigErrors(parentDef))
{
yield return text;
}
if (this.mtbDaysPerStage == null)
{
yield return "mtbDaysPerStage is not defined";
}
else if (this.mtbDaysPerStage.Count != parentDef.stages.Count)
{
yield return "mtbDaysPerStage count doesn't match Hediffs number of stages";
}
yield break;
}
public List<float> mtbDaysPerStage;
}
}

View file

@ -0,0 +1,97 @@
using LicentiaLabs;
using System.Collections.Generic;
using Verse;
using Verse.AI;
using UnityEngine;
using System;
using rjw;
using RimWorld;
namespace RJW_Genes
{
/// <summary>
/// Shamelessly stolen from LicentaLabs
/// [Jaals Fork] https://gitgud.io/Jaaldabaoth/licentia-labs/-/blob/master/Source/LicentiaLabs/LicentiaLabs/JobDriver_VomitCum.cs
/// </summary>
class JobDriver_ProcessingCumbucket : JobDriver_Vomit
{
public override bool CanBeginNowWhileLyingDown()
{
return true;
}
protected override IEnumerable<Toil> MakeNewToils()
{
if (ModsConfig.IsActive("rjw.sexperience"))
yield break;
ModLog.Debug("Starting Toils for Processing Cumbucket");
Toil toil = new Toil();
toil.initAction = delegate ()
{
this.ticksLeft = Rand.Range(150, 600);
int num = 0;
IntVec3 c;
for (; ; )
{
c = this.pawn.Position + GenAdj.AdjacentCellsAndInside[Rand.Range(0, 9)];
num++;
if (num > 12)
{
break;
}
if (c.InBounds(this.pawn.Map) && c.Standable(this.pawn.Map))
{
goto IL_77;
}
}
c = this.pawn.Position;
IL_77:
this.job.targetA = c;
this.pawn.pather.StopDead();
};
toil.tickAction = delegate ()
{
if (this.ticksLeft % 150 == 149)
{
if (!sourceName.NullOrEmpty())
{
if (ModsConfig.IsActive("LustLicentia.RJWLabs"))
FilthMaker.TryMakeFilth(this.job.targetA.Cell, base.Map, Licentia.ThingDefs.FilthCum, sourceName);
SpawnCum(this.pawn, this.job.targetA.Cell, base.Map);
}
else
{
if (ModsConfig.IsActive("LustLicentia.RJWLabs"))
FilthMaker.TryMakeFilth(this.job.targetA.Cell, base.Map, Licentia.ThingDefs.FilthCum);
SpawnCum(this.pawn, this.job.targetA.Cell, base.Map);
}
}
this.ticksLeft--;
if (this.ticksLeft <= 0)
{
base.ReadyForNextToil();
TaleRecorder.RecordTale(Licentia.TaleDefs.VomitedCum, new object[]
{
this.pawn
});
}
};
toil.defaultCompleteMode = ToilCompleteMode.Never;
toil.WithEffect(EffecterDefOf.Vomit, TargetIndex.A, new Color(100f, 100f, 100f, 0.5f));
toil.PlaySustainerOrSound(() => SoundDefOf.Vomit, 1f);
yield return toil;
yield break;
}
private void SpawnCum(Pawn pawn, IntVec3 cell, Map map)
{
ModLog.Warning($"This will be spawning cum for {pawn} at {cell}");
}
private int ticksLeft;
public string sourceName;
}
}

View file

@ -17,7 +17,7 @@ namespace RJW_Genes
/// <summary> /// <summary>
/// This is the amount of fluid required if the pawn has a bodysize of 1, to reach a severity in the hediff of 1. /// This is the amount of fluid required if the pawn has a bodysize of 1, to reach a severity in the hediff of 1.
/// The hediff can still be increased. /// The hediff can still be increased over 1.0.
/// </summary> /// </summary>
const float fluid_amount_required_for_hediff_severity_ = 100.0f; const float fluid_amount_required_for_hediff_severity_ = 100.0f;
@ -48,7 +48,6 @@ namespace RJW_Genes
{ {
float bodysize = pawn.BodySize; float bodysize = pawn.BodySize;
float result_severity_increase = cumamount / (fluid_amount_required_for_hediff_severity_ * bodysize); float result_severity_increase = cumamount / (fluid_amount_required_for_hediff_severity_ * bodysize);
ModLog.Message($"Pumping the living cumbucket {pawn} (Bodysize {bodysize}) with {cumamount} cum, resulting in severity {result_severity_increase}");
Hediff hediff = pawn.health.hediffSet.GetFirstHediffOfDef(HediffDefOf.rjw_genes_filled_living_cumbucket); Hediff hediff = pawn.health.hediffSet.GetFirstHediffOfDef(HediffDefOf.rjw_genes_filled_living_cumbucket);
@ -59,6 +58,7 @@ namespace RJW_Genes
} }
hediff.Severity += result_severity_increase; hediff.Severity += result_severity_increase;
ModLog.Debug($"Pumping the living cumbucket {pawn} (Bodysize {bodysize}) with {cumamount} cum, resulting in severity {hediff.Severity} (+{result_severity_increase})");
} }
} }
} }

View file

@ -82,6 +82,9 @@
<Compile Include="Genes\Breeding\Genes\Gene_FerventOvipositor.cs" /> <Compile Include="Genes\Breeding\Genes\Gene_FerventOvipositor.cs" />
<Compile Include="Genes\Breeding\Genes\Gene_InsectIncubator.cs" /> <Compile Include="Genes\Breeding\Genes\Gene_InsectIncubator.cs" />
<Compile Include="Genes\Breeding\Patches\Patch_BlockedMasturbation.cs" /> <Compile Include="Genes\Breeding\Patches\Patch_BlockedMasturbation.cs" />
<Compile Include="Genes\Cum\HediffComp_ProcessCumbucket.cs" />
<Compile Include="Genes\Cum\HediffsCompProperties_ProcessCumbucketMTB.cs" />
<Compile Include="Genes\Cum\JobDriver_ProcessingCumbucket.cs" />
<Compile Include="Genes\Cum\Patches\Patch_LikesCumflation.cs" /> <Compile Include="Genes\Cum\Patches\Patch_LikesCumflation.cs" />
<Compile Include="Genes\Cum\Patches\Patch_LivingCumbucket_StackHediff.cs" /> <Compile Include="Genes\Cum\Patches\Patch_LivingCumbucket_StackHediff.cs" />
<Compile Include="Genes\Damage\Gene_Elasticity.cs" /> <Compile Include="Genes\Damage\Gene_Elasticity.cs" />