mirror of
				https://github.com/vegapnk/RJW-Genes.git
				synced 2024-08-15 00:23:31 +00:00 
			
		
		
		
	Start on Jobdriver, WIP
This commit is contained in:
		
							parent
							
								
									05770a834e
								
							
						
					
					
						commit
						1e667e2730
					
				
					 7 changed files with 190 additions and 2 deletions
				
			
		
							
								
								
									
										29
									
								
								Source/Genes/Cum/HediffComp_ProcessCumbucket.cs
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										29
									
								
								Source/Genes/Cum/HediffComp_ProcessCumbucket.cs
									
										
									
									
									
										Normal 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);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -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;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										97
									
								
								Source/Genes/Cum/JobDriver_ProcessingCumbucket.cs
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										97
									
								
								Source/Genes/Cum/JobDriver_ProcessingCumbucket.cs
									
										
									
									
									
										Normal 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;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -17,7 +17,7 @@ namespace RJW_Genes
 | 
			
		|||
 | 
			
		||||
        /// <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. 
 | 
			
		||||
        /// The hediff can still be increased. 
 | 
			
		||||
        /// The hediff can still be increased over 1.0. 
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        const float fluid_amount_required_for_hediff_severity_ = 100.0f;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -48,7 +48,6 @@ namespace RJW_Genes
 | 
			
		|||
        {
 | 
			
		||||
            float bodysize = pawn.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);
 | 
			
		||||
| 
						 | 
				
			
			@ -59,6 +58,7 @@ namespace RJW_Genes
 | 
			
		|||
            }
 | 
			
		||||
 | 
			
		||||
            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})");
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -82,6 +82,9 @@
 | 
			
		|||
    <Compile Include="Genes\Breeding\Genes\Gene_FerventOvipositor.cs" />
 | 
			
		||||
    <Compile Include="Genes\Breeding\Genes\Gene_InsectIncubator.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_LivingCumbucket_StackHediff.cs" />
 | 
			
		||||
    <Compile Include="Genes\Damage\Gene_Elasticity.cs" />
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue