-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b5c0545
commit 7e2d2c4
Showing
72 changed files
with
652 additions
and
256 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<Defs> | ||
|
||
<!-- Mental breaks: extreme --> | ||
|
||
<MentalBreakDef> | ||
<defName>Possessed</defName> | ||
<mentalState>Possessed</mentalState> | ||
<baseCommonality>0.1</baseCommonality> | ||
<intensity>Extreme</intensity> | ||
</MentalBreakDef> | ||
<MentalStateDef ParentName="BaseMentalState"> | ||
<defName>Possessed</defName> | ||
<stateClass>FacialStuff.AI.MentalState_Possessed</stateClass> | ||
<workerClass>FacialStuff.AI.MentalStateWorker_Possessed</workerClass> | ||
<label>possessed</label> | ||
<category>Aggro</category> | ||
<moodRecoveryThought>Catharsis</moodRecoveryThought> | ||
<blockNormalThoughts>true</blockNormalThoughts> | ||
<nameColor>(0.9,0.2,0.5)</nameColor> | ||
<beginLetterLabel>possessed</beginLetterLabel> | ||
<beginLetter>{0} possessed!</beginLetter> | ||
<beginLetterDef>ThreatSmall</beginLetterDef> | ||
<minTicksBeforeRecovery>5000</minTicksBeforeRecovery> | ||
<recoveryMtbDays>0.3</recoveryMtbDays> | ||
<maxTicksBeforeRecovery>60000</maxTicksBeforeRecovery> | ||
<recoveryMessage>{0} is no longer possessed.</recoveryMessage> | ||
<baseInspectLine>Mental state: Possession</baseInspectLine> | ||
<stateEffecter>Berserk</stateEffecter> | ||
<tale>MentalStateBerserk</tale> | ||
<recoverFromSleep>true</recoverFromSleep> | ||
<unspawnedCanDo>true</unspawnedCanDo> | ||
</MentalStateDef> | ||
|
||
|
||
</Defs> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<Defs> | ||
|
||
<ThinkTreeDef> | ||
<defName>MentalStatesFS</defName> | ||
<insertTag>Humanlike_PostMentalState</insertTag> | ||
<insertPriority>1</insertPriority> | ||
<thinkRoot Class="ThinkNode_Priority"> | ||
<subNodes> | ||
<li Class="ThinkNode_ConditionalMentalState"> | ||
<state>Possessed</state> | ||
<subNodes> | ||
<li Class="ThinkNode_Priority"> | ||
<subNodes> | ||
<li Class="FacialStuff.AI.JobGiver_Possess"/> | ||
<li Class="JobGiver_WanderColony"> | ||
<maxDanger>Deadly</maxDanger> | ||
</li> | ||
</subNodes> | ||
</li> | ||
</subNodes> | ||
</li> | ||
</subNodes> | ||
</thinkRoot> | ||
</ThinkTreeDef> | ||
|
||
</Defs> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,200 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
|
||
namespace FacialStuff.AI | ||
{ | ||
using FacialStuff.newStuff; | ||
|
||
using RimWorld; | ||
|
||
using Verse; | ||
using Verse.AI; | ||
using Verse.Sound; | ||
|
||
public class JobDriver_Possess : JobDriver | ||
{ | ||
private Pawn Target | ||
{ | ||
get | ||
{ | ||
return (Pawn)(Thing)base.pawn.CurJob.GetTarget(TargetInd); | ||
} | ||
} | ||
|
||
public override bool TryMakePreToilReservations() | ||
{ | ||
return true; | ||
} | ||
private int ticksLeft; | ||
|
||
private TargetIndex TargetInd = TargetIndex.A; | ||
private TargetIndex VomitInd = TargetIndex.B; | ||
|
||
protected override IEnumerable<Toil> MakeNewToils() | ||
{ | ||
Toil newToils = this.HaveFunWithDemons().WithEffect(EffecterDefOf.Vomit, this.TargetInd) | ||
.PlaySustainerOrSound(() => SoundDef.Named("Vomit")); | ||
|
||
yield return Toils_Interpersonal.GotoInteractablePosition(this.TargetInd).FailOnDespawnedOrNull(this.TargetInd); | ||
|
||
yield return InsultingSpreeDelayToil(); | ||
yield return Toils_Interpersonal.WaitToBeAbleToInteract(this.pawn); | ||
|
||
Toil finalgoto = Toils_Interpersonal.GotoInteractablePosition(this.TargetInd); | ||
finalgoto.socialMode = RandomSocialMode.Off; | ||
yield return finalgoto; | ||
|
||
yield return newToils; | ||
|
||
|
||
yield return InteractToil(); | ||
} | ||
|
||
private Toil HaveFunWithDemons() | ||
{ | ||
Toil toil = new Toil(); | ||
this.pawn.GetCompFace(out CompFace compFace); | ||
|
||
toil.initAction = delegate | ||
{ | ||
// this.ticksLeft = Rand.Range(300, 900); | ||
this.ticksLeft = Rand.Range(450, 1200); | ||
int num2 = 0; | ||
IntVec3 c; | ||
while (true) | ||
{ | ||
c = this.pawn.Position + GenAdj.AdjacentCellsAndInside[Rand.Range(0, 9)]; | ||
num2++; | ||
if (num2 > 12) | ||
{ | ||
c = this.pawn.Position; | ||
break; | ||
} | ||
if (c.InBounds(this.pawn.Map) && c.Standable(this.pawn.Map)) break; | ||
} | ||
this.job.targetB = c; | ||
this.pawn.pather.StopDead(); | ||
|
||
DefDatabase<SoundDef>.GetNamed("Pawn_Cat_Angry").PlayOneShot(new TargetInfo(this.pawn.Position, this.pawn.Map)); // GenExplosion.DoExplosion( | ||
// this.pawn.Position, | ||
// this.pawn.Map, | ||
// 2, | ||
// DamageDefOf.Smoke, | ||
// null, | ||
// 0, | ||
// DefDatabase<SoundDef>.GetNamed("Explosion_Smoke")); | ||
// for (int i = 0; i < 2; i++) | ||
// { | ||
// var loc = this.pawn.Position.ToVector3Shifted(); | ||
// var map = this.pawn.Map; | ||
// MoteMaker.ThrowSmoke(loc, map, 1f); | ||
// MoteMaker.ThrowMicroSparks(loc, map); | ||
// MoteMaker.ThrowLightningGlow(loc, map, 1f); | ||
// } | ||
}; | ||
|
||
int accellerator = 25; | ||
toil.tickAction = delegate | ||
{ | ||
|
||
if (this.ticksLeft % 60 == 0) | ||
{ | ||
|
||
// MoteMaker.ThrowFireGlow(this.pawn.Position, this.pawn.Map, 0.1f); | ||
} | ||
// if (this.ticksLeft % 45 == 0) | ||
// { | ||
// MoteMaker.ThrowHeatGlow(this.pawn.Position, this.pawn.Map, 0.3f); | ||
// } | ||
if (this.ticksLeft % accellerator == 0) | ||
{ | ||
compFace?.HeadRotator.RotateRandomly(); | ||
// MoteMaker.ThrowSmoke(this.pawn.Position.ToVector3(), this.pawn.Map, 0.2f); | ||
if (accellerator > 20) | ||
{ | ||
accellerator--; | ||
} | ||
else if (accellerator < 37) | ||
{ | ||
accellerator++; | ||
} | ||
} | ||
|
||
if (this.ticksLeft % 150 == 149) | ||
{ | ||
DefDatabase<SoundDef>.GetNamed("Pawn_Cat_Angry") | ||
.PlayOneShot(new TargetInfo(this.pawn.Position, this.pawn.Map)); | ||
FilthMaker.MakeFilth( | ||
this.job.targetA.Cell, | ||
this.Map, | ||
ThingDefOf.FilthVomit, | ||
this.pawn.LabelIndefinite(), | ||
1); | ||
if (this.pawn.needs.food.CurLevelPercentage > 0.10000000149011612) | ||
{ | ||
this.pawn.needs.food.CurLevel -= | ||
(float)(this.pawn.needs.food.MaxLevel * 0.02); | ||
} | ||
} | ||
if (this.ticksLeft % 50 == 0) | ||
{ | ||
FilthMaker.MakeFilth( | ||
this.pawn.Position.RandomAdjacentCell8Way(), | ||
this.Map, | ||
ThingDefOf.FilthVomit, | ||
this.pawn.LabelIndefinite(), | ||
1); | ||
} | ||
this.ticksLeft--; | ||
if (this.ticksLeft <= 0) | ||
{ | ||
this.ReadyForNextToil(); | ||
TaleRecorder.RecordTale(TaleDefOf.Vomited, this.pawn); | ||
} | ||
}; | ||
|
||
toil.AddFinishAction(() => { compFace?.HeadRotator.SetUnPossessed(); }); | ||
|
||
toil.defaultCompleteMode = ToilCompleteMode.Never; | ||
return toil; | ||
} | ||
|
||
private Toil InsultingSpreeDelayToil() | ||
{ | ||
Action action = delegate | ||
{ | ||
MentalState_Possessed mentalState_InsultingSpree = base.pawn.MentalState as MentalState_Possessed; | ||
if (mentalState_InsultingSpree != null && Find.TickManager.TicksGame - mentalState_InsultingSpree.lastInsultTicks < 300)// 1200) | ||
return; | ||
base.pawn.jobs.curDriver.ReadyForNextToil(); | ||
}; | ||
Toil toil = new Toil(); | ||
toil.initAction = action; | ||
toil.tickAction = action; | ||
toil.socialMode = RandomSocialMode.Off; | ||
toil.defaultCompleteMode = ToilCompleteMode.Never; | ||
return toil; | ||
} | ||
|
||
private Toil InteractToil() | ||
{ | ||
return Toils_General.Do(delegate | ||
{ | ||
if (base.pawn.interactions.TryInteractWith(this.Target, InteractionDefOf.Insult)) | ||
{ | ||
MentalState_Possessed mentalState_InsultingSpree = base.pawn.MentalState as MentalState_Possessed; | ||
if (mentalState_InsultingSpree != null) | ||
{ | ||
mentalState_InsultingSpree.lastInsultTicks = Find.TickManager.TicksGame; | ||
if (mentalState_InsultingSpree.target == this.Target) | ||
{ | ||
mentalState_InsultingSpree.insultedTargetAtLeastOnce = true; | ||
} | ||
} | ||
} | ||
}); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// RimWorld.JobGiver_InsultingSpree | ||
|
||
using RimWorld; | ||
|
||
using Verse; | ||
using Verse.AI; | ||
|
||
namespace FacialStuff.AI | ||
{ | ||
public class JobGiver_Possess : ThinkNode_JobGiver | ||
{ | ||
protected override Job TryGiveJob(Pawn pawn) | ||
{ | ||
MentalState_Possessed mentalStatePossessed = pawn.MentalState as MentalState_Possessed; | ||
if (mentalStatePossessed != null && mentalStatePossessed.target != null && pawn.CanReach(mentalStatePossessed.target, PathEndMode.Touch, Danger.Deadly, false, TraverseMode.ByPawn)) | ||
{ | ||
return new Job(DefDatabase<JobDef>.GetNamed("Possess"), mentalStatePossessed.target); | ||
} | ||
return null; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// Verse.AI.MentalStateWorker_InsultingSpreeAll | ||
|
||
using System.Collections.Generic; | ||
|
||
using Verse; | ||
using Verse.AI; | ||
|
||
namespace FacialStuff.AI | ||
{ | ||
public class MentalStateWorker_Possessed : MentalStateWorker | ||
{ | ||
private static List<Pawn> candidates = new List<Pawn>(); | ||
|
||
public override bool StateCanOccur(Pawn pawn) | ||
{ | ||
if (!base.StateCanOccur(pawn)) | ||
{ | ||
return false; | ||
} | ||
|
||
InsultingSpreeMentalStateUtility.GetInsultCandidatesFor(pawn, candidates, true); | ||
bool result = candidates.Count >= 2; | ||
candidates.Clear(); | ||
return result; | ||
} | ||
} | ||
} |
Oops, something went wrong.