Skip to content

Commit

Permalink
fix ...
Browse files Browse the repository at this point in the history
  • Loading branch information
Killface1980 committed Oct 9, 2017
1 parent 40a85e4 commit cdcdf0e
Show file tree
Hide file tree
Showing 69 changed files with 22 additions and 31 deletions.
2 changes: 1 addition & 1 deletion 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.17.3.4g</name>
<name>Facial Stuff 0.17.3.4h</name>
<author>Killface</author>
<url></url>
<targetVersion>0.17.1557</targetVersion>
Expand Down
Binary file modified Assemblies/FacialStuff.dll
Binary file not shown.
13 changes: 7 additions & 6 deletions Source/RW_FacialStuff/CompFace.cs
Original file line number Diff line number Diff line change
Expand Up @@ -428,12 +428,8 @@ public void CheckForAddedOrMissingParts(Pawn p)
return;
}

foreach (Hediff diff in hediffs)
foreach (Hediff diff in hediffs.Where(diff => diff?.def?.defName != null))
{
if (diff?.def?.defName == null)
{
continue;
}
this.CheckPart(body, diff);
}
}
Expand Down Expand Up @@ -879,7 +875,6 @@ private void CheckPart([NotNull] List<BodyPartRecord> body, [NotNull] Hediff hed
return;
}


BodyPartRecord leftEye = body.Find(x => x.def == BodyPartDefOf.LeftEye);
BodyPartRecord rightEye = body.Find(x => x.def == BodyPartDefOf.RightEye);
BodyPartRecord jaw = body.Find(x => x.def == BodyPartDefOf.Jaw);
Expand Down Expand Up @@ -1121,6 +1116,12 @@ private void ResetBoolsAndPaths()
{
SetPawnFace(new PawnFace(this.pawn, Faction.OfPlayer.def));
}

if (this.PawnFace.BrowDef == null)
{
this.PawnFace.BrowDef = PawnFaceMaker.RandomBrowDefFor(this.pawn, Faction.OfPlayer.def);
}

this.texPathEyeLeftPatch = null;
this.texPathEyeRightPatch = null;
this.texPathJawAddedPart = null;
Expand Down
5 changes: 0 additions & 5 deletions Source/RW_FacialStuff/Defs/BrowDef.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,10 @@ public class BrowDef : Def
{
public HairGender hairGender = HairGender.Any;



public List<string> hairTags = new List<string>();



public List<ThingDef> raceList = new List<ThingDef>();


public string texPath;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ public override void Init(GraphicRequest req)
{
Log.Message(
"Facial Stuff: No texture found at " + addedpartName + "_" + crowntype + "_side"
+ " - Graphic_Multi_AddedHeadParts");
+ " - Graphic_Multi_AddedHeadParts. This message is just a note, no error.");
array[3] = FaceTextures.BlankTexture;
}

Expand Down
31 changes: 13 additions & 18 deletions Source/RW_FacialStuff/PawnFaceMaker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -314,24 +314,23 @@ where beard.raceList.Contains(pawn.def)
public static BrowDef RandomBrowDefFor([NotNull] Pawn pawn, FactionDef factionType)
{
IEnumerable<BrowDef> source = from brow in DefDatabase<BrowDef>.AllDefs
where brow.raceList.Contains(pawn.def)
// where brow.raceList.Contains(pawn.def)
where brow.hairTags.SharesElementWith(factionType.hairTags)
select brow;

IEnumerable<BrowDef> browDefs = source as IList<BrowDef> ?? source.ToList();
if (!browDefs.Any())
if (!source.Any())
{
browDefs = from brow in DefDatabase<BrowDef>.AllDefs select brow;
source = from brow in DefDatabase<BrowDef>.AllDefs select brow;
}

BrowDef chosenBrows;

/*
switch (pawn.story.traits.DegreeOfTrait(TraitDef.Named("NaturalMood")))
{
case 2:
{
IEnumerable<BrowDef> filtered = browDefs.Where(x => x.label.Contains("Nice"));
chosenBrows = filtered.RandomElementByWeight(eye => BrowChoiceLikelihoodFor(eye, pawn));
chosenBrows = filtered.RandomElementByWeight(brow => BrowChoiceLikelihoodFor(brow, pawn));
return chosenBrows;
}
Expand Down Expand Up @@ -364,10 +363,9 @@ where brow.hairTags.SharesElementWith(factionType.hairTags)
return chosenBrows;
}
}
*/

chosenBrows = browDefs.RandomElementByWeight(brow => BrowChoiceLikelihoodFor(brow, pawn));

return chosenBrows;
return source.RandomElementByWeight(brow => BrowChoiceLikelihoodFor(brow, pawn));
}


Expand All @@ -376,7 +374,7 @@ public static EyeDef RandomEyeDefFor(Pawn pawn,
{
// Log.Message("Selecting eyes.");
IEnumerable<EyeDef> source = from eye in DefDatabase<EyeDef>.AllDefs
where eye.raceList.Contains(pawn.def)
// where eye.raceList.Contains(pawn.def)
where eye.hairTags.SharesElementWith(factionType.hairTags)
select eye;

Expand All @@ -386,12 +384,9 @@ where eye.hairTags.SharesElementWith(factionType.hairTags)
source = from eye in DefDatabase<EyeDef>.AllDefs select eye;
}

EyeDef chosenEyes;

chosenEyes = source.RandomElementByWeight(eye => EyeChoiceLikelihoodFor(eye, pawn));
return source.RandomElementByWeight(eye => EyeChoiceLikelihoodFor(eye, pawn));

// Log.Message("Chosen eyes: " + chosenEyes);
return chosenEyes;
}

#endregion Public Methods
Expand Down Expand Up @@ -479,8 +474,8 @@ private static float BrowChoiceLikelihoodFor(BrowDef brow, Pawn pawn)
case HairGender.Male: return 70f;
case HairGender.MaleUsually: return 30f;
case HairGender.Any: return 60f;
case HairGender.FemaleUsually: return 0f;
case HairGender.Female: return 0f;
case HairGender.FemaleUsually: return 5f;
case HairGender.Female: return 1f;
}
}

Expand All @@ -491,8 +486,8 @@ private static float BrowChoiceLikelihoodFor(BrowDef brow, Pawn pawn)
case HairGender.Female: return 70f;
case HairGender.FemaleUsually: return 30f;
case HairGender.Any: return 60f;
case HairGender.MaleUsually: return 0f;
case HairGender.Male: return 0f;
case HairGender.MaleUsually: return 5f;
case HairGender.Male: return 1f;
}
}

Expand Down
Binary file added Textures/MergedHair/SPSThor_back.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Textures/MergedHair/SPSThor_front.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Textures/MergedHair/SPSThor_side.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Textures/MergedHair/Scorpiontail_back.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Textures/MergedHair/Scorpiontail_front.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Textures/MergedHair/Scorpiontail_side.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Textures/MergedHair/Wavy_Bald02_back.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Textures/MergedHair/Wavy_Bald02_front.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Textures/MergedHair/Wavy_Bald02_side.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Textures/MergedHair/laijde_back.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Textures/MergedHair/laijde_front.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Textures/MergedHair/laijde_side.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Textures/MergedHair/nora_back.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Textures/MergedHair/nora_front.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Textures/MergedHair/nora_side.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Textures/MergedHair/ro_f03_back.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Textures/MergedHair/ro_f03_front.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Textures/MergedHair/ro_f03_side.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Textures/MergedHair/ro_f06_back.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Textures/MergedHair/ro_f06_front.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Textures/MergedHair/ro_f06_side.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Textures/MergedHair/ro_f07_back.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Textures/MergedHair/ro_f07_front.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Textures/MergedHair/ro_f07_side.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Textures/MergedHair/ro_f15_back.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Textures/MergedHair/ro_f15_front.png
Binary file added Textures/MergedHair/ro_f15_side.png
Binary file added Textures/MergedHair/ro_f28_back.png
Binary file added Textures/MergedHair/ro_f28_front.png
Binary file added Textures/MergedHair/ro_f28_side.png
Binary file added Textures/MergedHair/ro_m02_back.png
Binary file added Textures/MergedHair/ro_m02_front.png
Binary file added Textures/MergedHair/ro_m02_side.png
Binary file added Textures/MergedHair/ro_m03_back.png
Binary file added Textures/MergedHair/ro_m03_front.png
Binary file added Textures/MergedHair/ro_m03_side.png
Binary file added Textures/MergedHair/ro_m04_back.png
Binary file added Textures/MergedHair/ro_m04_front.png
Binary file added Textures/MergedHair/ro_m04_side.png
Binary file added Textures/MergedHair/ro_m08_back.png
Binary file added Textures/MergedHair/ro_m08_front.png
Binary file added Textures/MergedHair/ro_m08_side.png
Binary file added Textures/MergedHair/ro_m09_back.png
Binary file added Textures/MergedHair/ro_m09_front.png
Binary file added Textures/MergedHair/ro_m09_side.png
Binary file added Textures/MergedHair/ro_m12_back.png
Binary file added Textures/MergedHair/ro_m12_front.png
Binary file added Textures/MergedHair/ro_m12_side.png
Binary file added Textures/MergedHair/ro_m18_back.png
Binary file added Textures/MergedHair/ro_m18_front.png
Binary file added Textures/MergedHair/ro_m18_side.png
Binary file added Textures/MergedHair/ro_m19_back.png
Binary file added Textures/MergedHair/ro_m19_front.png
Binary file added Textures/MergedHair/ro_m19_side.png
Binary file added Textures/MergedHair/ro_m20_back.png
Binary file added Textures/MergedHair/ro_m20_front.png
Binary file added Textures/MergedHair/ro_m20_side.png
Binary file added Textures/MergedHair/ro_m22_back.png
Binary file added Textures/MergedHair/ro_m22_front.png
Binary file added Textures/MergedHair/ro_m22_side.png
Binary file added Textures/MergedHair/upchuck_back.png
Binary file added Textures/MergedHair/upchuck_front.png
Binary file added Textures/MergedHair/upchuck_side.png

0 comments on commit cdcdf0e

Please sign in to comment.