Skip to content

Commit

Permalink
changes & fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Killface1980 committed Apr 3, 2018
1 parent a65fa81 commit 9c02725
Show file tree
Hide file tree
Showing 37 changed files with 489 additions and 537 deletions.
9 changes: 5 additions & 4 deletions About/About.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<ModMetaData>
<name>Facial Stuff 0.18.5</name>
<name>Facial Stuff 0.18.5.2</name>
<author>Killface</author>
<url></url>
<targetVersion>0.18.0</targetVersion>
Expand All @@ -24,10 +24,10 @@

For modders:
- Walk cycle editor. Check out the develop mode in the mod options
- A tab for positioning the hands on weapons, also activated with the dev mode.
- A tab for positioning the hands on weapons, also activated with the dev mode; can export directly to xml.

+ hair textures with beards from the &apos;Spoonshortage&apos;s Rimworld Hairstyles 1.2&apos; and &apos;Nackblad Inc Rimhair 1.1&apos; mods are replaced by shaved versions
This mod contains no hair packs itself any more. Please subscribe to what you like.
This mod contains no hair packs itself any more. Please subscribe to the hair mods of your liking.

Patches the PawnRenderer via Harmony and returns &apos;false&apos; thus being incompatible to mods doing the same.
Look out for the FS "Alien Faces" addon if you're using erdelf's Humanoid Alien Framework.
Expand All @@ -40,6 +40,7 @@ Hands based on "Clutter Weapon Hands" by mrofa.
Body, gender and head changer code adapted from Change Dresser by Kiame Vivacity
Prepare Carefully saving / loading code adapted from Psychology by {WOBBLY} The Word-Mule
Inspiration for the new renderer and all of its benefits by {WOBBLY} The Word-Mule and ChJees
Special thanks to DoctorVanGogh and erdelf for help with transpilers, NotFood for the new Dresser patch and Brrainz for Harmony and help with transpilers
Special thanks to DoctorVanGogh and erdelf for help with transpilers, NotFood for the new Dresser patch
and Brrainz for Harmony and help with transpilers
</description>
</ModMetaData>
Binary file modified Assemblies/FacialStuff.dll
Binary file not shown.
106 changes: 53 additions & 53 deletions Source/RW_FacialStuff/AI/JobDriver_Possess.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using System.Collections.Generic;
using RimWorld;
using RimWorld;
using System.Collections.Generic;
using Verse;
using Verse.AI;
using Verse.Sound;
Expand All @@ -11,12 +11,12 @@ public class JobDriver_Possess : JobDriver
{
private readonly TargetIndex TargetInd = TargetIndex.A;

private int ticksLeft;
/*
private TargetIndex VomitInd = TargetIndex.B;
*/
private int ticksLeft;
/*
private TargetIndex VomitInd = TargetIndex.B;
*/

private Pawn Target => (Pawn) (Thing) this.pawn.CurJob.GetTarget(this.TargetInd);
private Pawn Target => (Pawn)(Thing)this.pawn.CurJob.GetTarget(this.TargetInd);

public override bool TryMakePreToilReservations()
{
Expand All @@ -33,7 +33,7 @@ protected override IEnumerable<Toil> MakeNewToils()
yield return this.InsultingSpreeDelayToil();
yield return Toils_Interpersonal.WaitToBeAbleToInteract(this.pawn);

Toil finalgoto = Toils_Interpersonal.GotoInteractablePosition(this.TargetInd);
Toil finalgoto = Toils_Interpersonal.GotoInteractablePosition(this.TargetInd);
finalgoto.socialMode = RandomSocialMode.Off;
yield return finalgoto;

Expand All @@ -50,8 +50,8 @@ private Toil HaveFunWithDemons()
toil.initAction = delegate
{
// this.ticksLeft = Rand.Range(300, 900);
this.ticksLeft = Rand.Range(450, 1200);
int num2 = 0;
this.ticksLeft = Rand.Range(450, 1200);
int num2 = 0;
IntVec3 c;
while (true)
{
Expand Down Expand Up @@ -93,10 +93,10 @@ private Toil HaveFunWithDemons()
};

int accellerator = 25;
toil.tickAction = delegate
{
if (this.ticksLeft % 60 == 0)
{
toil.tickAction = delegate
{
if (this.ticksLeft % 60 == 0)
{
// MoteMaker.ThrowFireGlow(this.pawn.Position, this.pawn.Map, 0.1f);
}

Expand All @@ -105,45 +105,45 @@ private Toil HaveFunWithDemons()
// MoteMaker.ThrowHeatGlow(this.pawn.Position, this.pawn.Map, 0.3f);
// }
if (this.ticksLeft % accellerator == 0)
{
compFace.HeadRotator.RotateRandomly();
{
compFace.HeadRotator.RotateRandomly();

// MoteMaker.ThrowSmoke(this.pawn.Position.ToVector3(), this.pawn.Map, 0.2f);
if (accellerator > 20)
{
accellerator--;
}
else if (accellerator < 37)
{
accellerator++;
}
}
{
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());
if (this.pawn.needs.food.CurLevelPercentage > 0.10000000149011612)
{
this.pawn.needs.food.CurLevel -= (float) (this.pawn.needs.food.MaxLevel * 0.02);
}
}
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());
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());
}
if (this.ticksLeft % 50 == 0)
{
FilthMaker.MakeFilth(this.pawn.Position.RandomAdjacentCell8Way(), this.Map,
ThingDefOf.FilthVomit, this.pawn.LabelIndefinite());
}

this.ticksLeft--;
if (this.ticksLeft <= 0)
{
this.ReadyForNextToil();
TaleRecorder.RecordTale(TaleDefOf.Vomited, this.pawn);
}
};
this.ticksLeft--;
if (this.ticksLeft <= 0)
{
this.ReadyForNextToil();
TaleRecorder.RecordTale(TaleDefOf.Vomited, this.pawn);
}
};

toil.AddFinishAction(compFace.HeadRotator.SetUnPossessed);

Expand All @@ -165,12 +165,12 @@ void Action()
}

Toil toil = new Toil
{
initAction = Action,
tickAction = Action,
socialMode = RandomSocialMode.Off,
defaultCompleteMode = ToilCompleteMode.Never
};
{
initAction = Action,
tickAction = Action,
socialMode = RandomSocialMode.Off,
defaultCompleteMode = ToilCompleteMode.Never
};
return toil;
}

Expand Down
2 changes: 1 addition & 1 deletion Source/RW_FacialStuff/AI/JobGiver_Possess.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ protected override Job TryGiveJob(Pawn pawn)
return null;
}
}
}
}
4 changes: 2 additions & 2 deletions Source/RW_FacialStuff/AI/MentalStateWorker_Possessed.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Verse.AI.MentalStateWorker_InsultingSpreeAll

using System.Collections.Generic;
using JetBrains.Annotations;
using System.Collections.Generic;
using Verse;
using Verse.AI;

Expand Down Expand Up @@ -29,4 +29,4 @@ public override bool StateCanOccur([NotNull] Pawn pawn)
return result;
}
}
}
}
4 changes: 2 additions & 2 deletions Source/RW_FacialStuff/AI/MentalState_Possessed.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System.Collections.Generic;
using RimWorld;
using System.Collections.Generic;
using System.Linq;
using RimWorld;
using UnityEngine;
using Verse;
using Verse.AI;
Expand Down
26 changes: 12 additions & 14 deletions Source/RW_FacialStuff/Animator/PawnHeadRotator.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using System.Collections.Generic;
using JetBrains.Annotations;
using JetBrains.Annotations;
using System.Collections.Generic;
using Verse;
using Verse.AI;

Expand All @@ -26,14 +26,14 @@ public class PawnHeadRotator

private bool _clockwise;
private Rot4 _currentRot = Rot4.Random;
private int _headRotation;
private int _headRotation;

private int _nextRotationEnd = -5000;

private bool _possessed;
private bool _possessed;
private RotationDirection _rotationMod;

private int _rotCount;
private int _rotCount;
private Thing _target;

#endregion Private Fields
Expand Down Expand Up @@ -69,7 +69,7 @@ public void RotateRandomly()
this._possessed = true;
if (this._rotCount < 1)
{
this._rotCount = Rand.Range(12, 28);
this._rotCount = Rand.Range(12, 28);
this._clockwise = !this._clockwise;
}

Expand All @@ -84,7 +84,7 @@ public Rot4 Rotation(Rot4 headFacing, bool renderBody)
return this._currentRot;
}

Rot4 rot = headFacing;
Rot4 rot = headFacing;
bool flag = false;
if (renderBody)
{
Expand Down Expand Up @@ -153,7 +153,7 @@ public void SetUnPossessed()
// Verse.AI.GenAI
private bool EnemyIsNear([NotNull] Pawn p, float radius)
{
bool enemy = false;
bool enemy = false;
this._target = null;

if (!p.Spawned)
Expand All @@ -172,7 +172,7 @@ private bool EnemyIsNear([NotNull] Pawn p, float radius)
continue;
}

if (!p.Position.InHorDistOf(((Thing) attackTarget).Position, radius))
if (!p.Position.InHorDistOf(((Thing)attackTarget).Position, radius))
{
continue;
}
Expand All @@ -187,7 +187,7 @@ private bool EnemyIsNear([NotNull] Pawn p, float radius)
return false;
}

Thing thing = (Thing) AttackTargetFinder.BestAttackTarget(
Thing thing = (Thing)AttackTargetFinder.BestAttackTarget(
p,
TargetScanFlags.NeedReachable |
TargetScanFlags.NeedThreat,
Expand Down Expand Up @@ -225,7 +225,7 @@ private void FaceHead()
// }
// }
float angle = (this._target.Position - this._pawn.Position).ToVector3().AngleFlat();
Rot4 rot = Pawn_RotationTracker.RotFromAngleBiased(angle);
Rot4 rot = Pawn_RotationTracker.RotFromAngleBiased(angle);
if (rot != this._pawn.Rotation.Opposite)
{
int rotty = this._pawn.Rotation.AsInt - rot.AsInt;
Expand Down Expand Up @@ -259,7 +259,6 @@ private void FaceHead()
// RimWorld.JobDriver_StandAndBeSociallyActive
private void FindClosestTarget()
{

// Watch out for enemies
Job job = this._pawn.CurJob;
if (job == null || !job.targetA.IsValid)
Expand Down Expand Up @@ -302,14 +301,13 @@ private void FindClosestTarget()
}

this._target = null;

}

private void SetNextRotation(int tickManagerTicksGame)
{
float blinkDuration = Rand.Range(120f, 240f);

this._nextRotationEnd = (int) (tickManagerTicksGame + blinkDuration);
this._nextRotationEnd = (int)(tickManagerTicksGame + blinkDuration);
}

private void TrackHead()
Expand Down
Loading

0 comments on commit 9c02725

Please sign in to comment.