Skip to content

Commit

Permalink
alpha 1
Browse files Browse the repository at this point in the history
  • Loading branch information
Killface1980 committed Jan 1, 2018
1 parent a5e0ce9 commit bbad7c6
Show file tree
Hide file tree
Showing 51 changed files with 901 additions and 591 deletions.
21 changes: 12 additions & 9 deletions About/About.xml
Original file line number Diff line number Diff line change
@@ -1,32 +1,35 @@
<?xml version="1.0" encoding="utf-8"?>
<ModMetaData>
<name>Facial Stuff 0.18.0</name>
<name>Facial Stuff 0.18.5</name>
<author>Killface</author>
<url></url>
<targetVersion>0.18.0</targetVersion>
<description>This mod aims to provide more visual individuality for your colonists
- hands and feet, partially animated
- 30+ different beards for males, some of them combinable
- edited vanilla hair styles with 10 steps of hair loss
- new eyes and brows for both sexes
- animated eye &amp; mouth textures
- alternate eye and jaw textures for pawns with implants or removed parts
- 10 newly defined skin colors instead of the vanilla 6
- hair genetics according to real life (including the effects of eumelanin &amp; pheomelanin)
- adds the ability to change the head and body type for all Humans (needs activation in the mod options)
- fully compatible with Children &amp; Pregnancy, Werewolves and Prepare Carefully
- 30+ different beards, some of them combinable
- possibility to show hair under hats
- multiple visibility options for hats on map
- added vanilla hair styles with 10 steps of hair loss
- includes selected trending hair colors of 5501
- add hands to pawns that hold weapons (vanilia weapons only) thx mrofa
- possibility to show hair under hats
- multiple visibility options for head gear on map
- multiple visibility options for apparel layers in rooms/private rooms
- adds the ability to change the head and body type for all Humans (needs activation in the mod options)
- fully compatible with Children &amp; Pregnancy, Vampires, Werewolves and Prepare Carefully
- all features can be disabled in the mod options menu

- Walk cycle editor, disabled by default. Check out the MainButtons.xml for activation (intended for modders)

+ includes a modified version of &apos;Spoonshortage&apos;s Rimworld Hairstyles 1.2&apos; by spoonshortage
+ includes a modified version of &apos;Nackblad Inc Rimhair 1.1&apos; by nackblad

Patches the PawnRenderer via Harmony and returns &apos;false&apos; thus being incompatible to mods doing the same.

Initial Face Styling bench code adapted from "Clutter" by mrofa (available at the Ludeon forums)
Hands adapted from "Clutter Weapon Hands" by mrofa
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
Expand Down
Binary file modified Assemblies/FacialStuff.dll
Binary file not shown.
49 changes: 0 additions & 49 deletions Defs/ThingDefs/Worktable.xml

This file was deleted.

2 changes: 1 addition & 1 deletion Source/RW_FacialStuff/Animator/BodyAnimator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public bool IsMoving(out float movedPercent)

if (this.compAnim.AnimatorOpen)
{
movedPercent = MainTabWindowAnimator.AnimationPercent;
movedPercent = MainTabWindow_Animator.AnimationPercent;
return true;
}

Expand Down
79 changes: 46 additions & 33 deletions Source/RW_FacialStuff/Components/CompBodyAnimator.cs
Original file line number Diff line number Diff line change
@@ -1,49 +1,47 @@
namespace FacialStuff
{
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Reflection;

using FacialStuff.Animator;
using FacialStuff.DefOfs;
using FacialStuff.Defs;
using FacialStuff.Graphics;

using JetBrains.Annotations;

using RimWorld;
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Reflection;

using UnityEngine;

using Verse;

public class CompBodyAnimator : ThingComp
{

#region Public Fields

public static FieldInfo infoJitterer;
public bool AnimatorOpen;

public BodyAnimDef bodyAnim;

public BodyPartStats bodyStat;

public float JitterMax = 0.35f;

public int lastRoomCheck;

public PawnBodyGraphic PawnBodyGraphic;

public WalkCycleDef walkCycle = WalkCycleDefOf.Biped_Walk;
public WalkCycleDef WalkCycle = WalkCycleDefOf.Biped_Walk;

#endregion Public Fields

#region Private Fields

private static FieldInfo infoJitterer;
[NotNull]
private List<Material> cachedNakedMatsBodyBase = new List<Material>();

private int cachedNakedMatsBodyBaseHash = -1;
private List<Material> cachedSkinMatsBodyBase = new List<Material>();
private int cachedSkinMatsBodyBaseHash = -1;
private bool initialized;

private int lastRoomCheck;
private Room theRoom;

#endregion Private Fields
Expand Down Expand Up @@ -152,15 +150,15 @@ public static object GetHiddenValue(Type type, object instance, string fieldName
return info?.GetValue(instance);
}

public void ApplyBodyWobble(ref Vector3 rootLoc, ref Quaternion quat)
public void ApplyBodyWobble(ref Vector3 rootLoc, ref Vector3 footPos, ref Quaternion quat)
{
if (this.PawnBodyDrawers != null)
{
int i = 0;
int count = this.PawnBodyDrawers.Count;
while (i < count)
{
this.PawnBodyDrawers[i].ApplyBodyWobble(ref rootLoc, ref quat);
this.PawnBodyDrawers[i].ApplyBodyWobble(ref rootLoc, ref footPos, ref quat);
i++;
}
}
Expand All @@ -173,11 +171,11 @@ public void ClearCache()
this.cachedNakedMatsBodyBaseHash = -1;
}

public override string CompInspectStringExtra()
{
string extra = this.Pawn.DrawPos.ToString();
return extra;
}
// public override string CompInspectStringExtra()
// {
// string extra = this.Pawn.DrawPos.ToString();
// return extra;
// }

[SuppressMessage("ReSharper", "PossibleNullReferenceException")]
public void DrawBody(Vector3 rootLoc, Quaternion quat, RotDrawMode bodyDrawType, [CanBeNull] PawnWoundDrawer woundDrawer, bool renderBody, bool portrait)
Expand Down Expand Up @@ -260,6 +258,18 @@ public void InitializePawnDrawer()
thingComp.Initialize();
}
}
else
{
this.PawnBodyDrawers = new List<PawnBodyDrawer>();

PawnBodyDrawer thingComp = (PawnBodyDrawer)Activator.CreateInstance(typeof(HumanBipedDrawer));
thingComp.CompAnimator = this;
thingComp.Pawn = this.Pawn;
this.PawnBodyDrawers.Add(thingComp);
thingComp.Initialize();


}
}

public List<Material> NakedMatsBodyBaseAt(Rot4 facing, RotDrawMode bodyCondition = RotDrawMode.Fresh)
Expand Down Expand Up @@ -341,19 +351,22 @@ public override void PostSpawnSetup(bool respawningAfterLoad)
{
bodyType = this.Pawn.story.bodyType;
}

string defName = "BodyAnimDef_" + this.Pawn.def.defName + "_" + bodyType;

BodyAnimDef newDef = DefDatabase<BodyAnimDef>.GetNamedSilentFail(defName);

if (newDef != null)
List<string> names = new List<string>
{
"BodyAnimDef_" + this.Pawn.def.defName + "_" + bodyType,
"BodyAnimDef_" + ThingDefOf.Human.defName + "_" + bodyType
};
foreach (string name in names)
{
this.bodyAnim = newDef;
}
else
{
this.bodyAnim = new BodyAnimDef { defName = defName, label = defName };
BodyAnimDef newDef = DefDatabase<BodyAnimDef>.GetNamedSilentFail(name);
if (newDef != null)
{
this.bodyAnim = newDef;
return;
}
}

this.bodyAnim = new BodyAnimDef { defName = this.Pawn.def.defName, label = this.Pawn.def.defName };
}

public void TickDrawers(Rot4 bodyFacing, PawnGraphicSet graphics)
Expand Down
25 changes: 19 additions & 6 deletions Source/RW_FacialStuff/Components/CompFace.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using System.Collections.Generic;

using FacialStuff.Animator;
using FacialStuff.DefOfs;
using FacialStuff.Defs;
using FacialStuff.Graphics;
using FacialStuff.Utilities;
Expand Down Expand Up @@ -37,6 +38,7 @@ public class CompFace : ThingComp

private Vector2 eyeOffset = Vector2.zero;

[NotNull]
public List<PawnHeadDrawer> PawnDrawers { get; private set; }

private Faction factionInt;
Expand All @@ -48,7 +50,6 @@ public class CompFace : ThingComp
private Vector2 mouthOffset = Vector2.zero;

// must be null, always initialize with pawn
[CanBeNull]
private PawnFace pawnFace;

#endregion Private Fields
Expand All @@ -58,7 +59,6 @@ public class CompFace : ThingComp
// public bool IgnoreRenderer;
public GraphicVectorMeshSet EyeMeshSet => MeshPoolFS.HumanEyeSet[(int)this.FullHeadType];

[CanBeNull]
[NotNull]
public PawnEyeWiggler EyeWiggler { get; private set; }

Expand Down Expand Up @@ -323,6 +323,7 @@ public string BrowTexPath([NotNull] BrowDef browDef)
return "Brows/Brow_" + this.Pawn.gender + "_" + browDef.texPath;
}


// Can be called externally
public void DrawAlienBodyAddons(Quaternion quat, Vector3 vector, bool portrait, bool renderBody)
{
Expand Down Expand Up @@ -389,7 +390,7 @@ public void DrawBasicHead(out bool headDrawn, RotDrawMode bodyDrawType, bool por

public void DrawBeardAndTache(ref Vector3 locFacialY, bool portrait, Quaternion headQuat)
{
if (this.PawnDrawers != null)
if (!this.PawnDrawers.NullOrEmpty())
{
int i = 0;
int count = this.PawnDrawers.Count;
Expand All @@ -403,7 +404,7 @@ public void DrawBeardAndTache(ref Vector3 locFacialY, bool portrait, Quaternion

public void DrawBrows(ref Vector3 locFacialY, Quaternion headQuat, bool portrait)
{
if (this.PawnDrawers != null)
if (!this.PawnDrawers.NullOrEmpty())
{
int i = 0;
int count = this.PawnDrawers.Count;
Expand All @@ -417,7 +418,7 @@ public void DrawBrows(ref Vector3 locFacialY, Quaternion headQuat, bool portrait

public void DrawHairAndHeadGear(Vector3 rootLoc, RotDrawMode bodyDrawType, ref Vector3 currentLoc, Vector3 b, bool portrait, bool renderBody, Quaternion headQuat)
{
if (this.PawnDrawers != null)
if (!this.PawnDrawers.NullOrEmpty())
{
int i = 0;
int count = this.PawnDrawers.Count;
Expand Down Expand Up @@ -558,13 +559,25 @@ public void InitializePawnDrawer()
this.PawnDrawers = new List<PawnHeadDrawer>();
for (int i = 0; i < this.Props.drawers.Count; i++)
{
PawnHeadDrawer thingComp = (PawnHeadDrawer)Activator.CreateInstance(this.Props.drawers[i].GetType());
PawnHeadDrawer thingComp =
(PawnHeadDrawer)Activator.CreateInstance(this.Props.drawers[i].GetType());
thingComp.CompFace = this;
thingComp.Pawn = this.Pawn;
this.PawnDrawers.Add(thingComp);
thingComp.Initialize();
}
}
else
{
this.PawnDrawers = new List<PawnHeadDrawer>();
PawnHeadDrawer thingComp =
(PawnHeadDrawer)Activator.CreateInstance(typeof(HumanHeadDrawer));
thingComp.CompFace = this;
thingComp.Pawn = this.Pawn;
this.PawnDrawers.Add(thingComp);
thingComp.Initialize();

}
}

public bool IsAsleep;
Expand Down
Loading

0 comments on commit bbad7c6

Please sign in to comment.