diff --git a/1.5/Assemblies/Rimworld-Animations.dll b/1.5/Assemblies/Rimworld-Animations.dll index d859982..fc2cf06 100644 Binary files a/1.5/Assemblies/Rimworld-Animations.dll and b/1.5/Assemblies/Rimworld-Animations.dll differ diff --git a/1.5/Defs/VoiceDefs/VoiceDef_Human.xml b/1.5/Defs/VoiceDefs/VoiceDef_Human.xml new file mode 100644 index 0000000..89c2f3e --- /dev/null +++ b/1.5/Defs/VoiceDefs/VoiceDef_Human.xml @@ -0,0 +1,21 @@ + + + + Voice_HumanFemale + Human + Female + + + + + + + Voice_HumanMale + Human + Male + + + + + + diff --git a/1.5/Defs/VoiceDefs/VoiceDef_Orassan.xml b/1.5/Defs/VoiceDefs/VoiceDef_Orassan.xml new file mode 100644 index 0000000..0026987 --- /dev/null +++ b/1.5/Defs/VoiceDefs/VoiceDef_Orassan.xml @@ -0,0 +1,16 @@ + + + + \ No newline at end of file diff --git a/1.5/Defs/VoiceDefs/VoiceTagDef.xml b/1.5/Defs/VoiceDefs/VoiceTagDef.xml new file mode 100644 index 0000000..04651dd --- /dev/null +++ b/1.5/Defs/VoiceDefs/VoiceTagDef.xml @@ -0,0 +1,6 @@ + + + + Moan + + \ No newline at end of file diff --git a/1.5/Source/Animations/GroupAnimations/GroupAnimationDef.cs b/1.5/Source/Animations/GroupAnimations/GroupAnimationDef.cs index b49f14d..fb9eb43 100644 --- a/1.5/Source/Animations/GroupAnimations/GroupAnimationDef.cs +++ b/1.5/Source/Animations/GroupAnimations/GroupAnimationDef.cs @@ -52,7 +52,7 @@ namespace Rimworld_Animations { if (context.AnimationPriority() > priority) { - //get highest priority context for fitting animation + //get highest priority context for fitting animation, and its reorder priority = context.AnimationPriority(); reorder = context.AnimationReorder(); diff --git a/1.5/Source/Comps/CompExtendedAnimator.cs b/1.5/Source/Comps/CompExtendedAnimator.cs index c9a83e7..d86bdbf 100644 --- a/1.5/Source/Comps/CompExtendedAnimator.cs +++ b/1.5/Source/Comps/CompExtendedAnimator.cs @@ -252,11 +252,11 @@ namespace Rimworld_Animations { //all voice options List voiceOptions = DefDatabase.AllDefsListForReading - .FindAll(voiceDef => voice.VoiceFitsPawn(pawn)); + .FindAll(voiceDef => voiceDef.VoiceFitsPawn(pawn)); //all voice options, with priority (for traitdef specific voices) List voiceOptionsWithPriority = - voiceOptions.FindAll(voiceDef => voice.takesPriority); + voiceOptions.FindAll(voiceDef => voiceDef.takesPriority); if (!voiceOptionsWithPriority.NullOrEmpty()) { diff --git a/1.5/Source/Voices/VoiceDef.cs b/1.5/Source/Voices/VoiceDef.cs new file mode 100644 index 0000000..9dd6c0d --- /dev/null +++ b/1.5/Source/Voices/VoiceDef.cs @@ -0,0 +1,39 @@ +using RimWorld; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Verse; + +namespace Rimworld_Animations +{ + public class VoiceDef : Def + { + + public ThingDef race; + public Gender gender = Gender.None; + public List traits = new List(); + public bool takesPriority = false; + public float randomChanceFactor = 1; + + public Dictionary sounds = new Dictionary(); + + public bool VoiceFitsPawn(Pawn pawn) + { + + //doesn't match race + if (pawn.def != race) return false; + + //doesn't match gender + if (gender != Gender.None && pawn.gender != gender) return false; + + //if traits list is not empty, and pawn doesn't have any of the designated traits, doesn't match + if (!traits.Empty() && !traits.Any(trait => pawn.story.traits.HasTrait(trait))) return false; + + return true; + + } + + } +} diff --git a/1.5/Source/Voices/VoiceDefOf.cs b/1.5/Source/Voices/VoiceDefOf.cs new file mode 100644 index 0000000..e489233 --- /dev/null +++ b/1.5/Source/Voices/VoiceDefOf.cs @@ -0,0 +1,22 @@ +using RimWorld; +using rjw; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Rimworld_Animations +{ + [DefOf] + public static class VoiceDefOf + { + static VoiceDefOf() + { + DefOfHelper.EnsureInitializedInCtor(typeof(VoiceDefOf)); + } + + public static VoiceDef Voice_HumanMale; + public static VoiceDef Voice_HumanFemale; + } +} diff --git a/1.5/Source/Voices/VoiceTagDef.cs b/1.5/Source/Voices/VoiceTagDef.cs new file mode 100644 index 0000000..3ebb678 --- /dev/null +++ b/1.5/Source/Voices/VoiceTagDef.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Verse; + +namespace Rimworld_Animations +{ + public class VoiceTagDef : Def + { + } +}