Restructuring, some sorting into folders

This commit is contained in:
Vegapnk 2023-01-22 09:06:28 +01:00
parent ac1fdc99be
commit 31e96bd5e3
36 changed files with 80 additions and 65 deletions

View file

@ -0,0 +1,22 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Verse;
using Verse.AI;
namespace RJW_Genes
{
public class ThinkNode_ConditionalCannotInteract : ThinkNode_Conditional
{
protected override bool Satisfied(Pawn pawn)
{
Pawn target = pawn.mindState.duty.focus.Pawn;
if (target == null)
{
return true;
}
return (target.jobs != null && target.jobs.curDriver.asleep) || !pawn.CanReach(target, PathEndMode.InteractionCell, Danger.Deadly);
}
}
}

View file

@ -0,0 +1,14 @@
using System;
using Verse;
using Verse.AI;
namespace RJW_Genes
{
public class ThinkNode_ConditionalCritcalLifeForce : ThinkNode_Conditional
{
protected override bool Satisfied(Pawn p)
{
return GeneUtility.HasCriticalLifeForce(p);
}
}
}

View file

@ -0,0 +1,14 @@
using System;
using Verse;
using Verse.AI;
namespace RJW_Genes
{
public class ThinkNode_ConditionalLowLifeForce : ThinkNode_Conditional
{
protected override bool Satisfied(Pawn p)
{
return GeneUtility.HasLowLifeForce(p);
}
}
}

View file

@ -0,0 +1,37 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Verse;
using Verse.AI;
using rjw;
namespace RJW_Genes
{
public class ThinkNode_NewFlirtTarget : ThinkNode
{
public override ThinkResult TryIssueJobPackage(Pawn pawn, JobIssueParams jobParams)
{
List<Pawn> validTargets = ValidTargets(pawn, pawn.Map).ToList();
Pawn new_target = validTargets.NullOrEmpty() ? null : validTargets.RandomElement();
if (new_target != null)
{
pawn.mindState.duty.focus = new_target;
}
return ThinkResult.NoJob;
}
private IEnumerable<Pawn> ValidTargets(Pawn pawn, Map map)
{
foreach (Pawn pawn2 in map.mapPawns.FreeAdultColonistsSpawned)
{
if (pawn != null && pawn2 != null && pawn != pawn2 && !pawn2.jobs.curDriver.asleep && SexAppraiser.would_fuck(pawn, pawn2) > 0.1f)
{
yield return pawn2;
}
}
//IEnumerator<Pawn> enumerator = null;
yield break;
}
}
}