mirror of
https://gitgud.io/c0ffeeeeeeee/rimworld-animations.git
synced 2024-08-15 00:43:45 +00:00
voices
This commit is contained in:
parent
96986104d5
commit
0e9419b039
9 changed files with 120 additions and 3 deletions
Binary file not shown.
21
1.5/Defs/VoiceDefs/VoiceDef_Human.xml
Normal file
21
1.5/Defs/VoiceDefs/VoiceDef_Human.xml
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
|
<Defs>
|
||||||
|
<Rimworld_Animations.VoiceDef>
|
||||||
|
<defName>Voice_HumanFemale</defName>
|
||||||
|
<race>Human</race>
|
||||||
|
<gender>Female</gender>
|
||||||
|
<sounds>
|
||||||
|
<!-- <li><key>Moan</key><value>FemaleMoanSoundDefHere</value></li> -->
|
||||||
|
</sounds>
|
||||||
|
</Rimworld_Animations.VoiceDef>
|
||||||
|
|
||||||
|
<Rimworld_Animations.VoiceDef>
|
||||||
|
<defName>Voice_HumanMale</defName>
|
||||||
|
<race>Human</race>
|
||||||
|
<gender>Male</gender>
|
||||||
|
<sounds>
|
||||||
|
<!-- <li><key>Moan</key><value>MaleMoanSoundDefHere</value></li> -->
|
||||||
|
</sounds>
|
||||||
|
</Rimworld_Animations.VoiceDef>
|
||||||
|
|
||||||
|
</Defs>
|
16
1.5/Defs/VoiceDefs/VoiceDef_Orassan.xml
Normal file
16
1.5/Defs/VoiceDefs/VoiceDef_Orassan.xml
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
|
<Defs>
|
||||||
|
<!--
|
||||||
|
<Rimworld_Animations.VoiceDef>
|
||||||
|
<defName>Voice_Orassan</defName>
|
||||||
|
<race>Alien_Orassan</race>
|
||||||
|
<gender>Male</gender>
|
||||||
|
<traitDefs>
|
||||||
|
<li>Wimpy</li>
|
||||||
|
</traitDefs>
|
||||||
|
<sounds>
|
||||||
|
<li><key>Moan</key><value>CatMoans</value></li>
|
||||||
|
</sounds>
|
||||||
|
</Rimworld_Animations.VoiceDef>
|
||||||
|
-->
|
||||||
|
</Defs>
|
6
1.5/Defs/VoiceDefs/VoiceTagDef.xml
Normal file
6
1.5/Defs/VoiceDefs/VoiceTagDef.xml
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
|
<Defs>
|
||||||
|
<Rimworld_Animations.VoiceTagDef>
|
||||||
|
<defName>Moan</defName>
|
||||||
|
</Rimworld_Animations.VoiceTagDef>
|
||||||
|
</Defs>
|
|
@ -52,7 +52,7 @@ namespace Rimworld_Animations
|
||||||
{
|
{
|
||||||
if (context.AnimationPriority() > priority)
|
if (context.AnimationPriority() > priority)
|
||||||
{
|
{
|
||||||
//get highest priority context for fitting animation
|
//get highest priority context for fitting animation, and its reorder
|
||||||
priority = context.AnimationPriority();
|
priority = context.AnimationPriority();
|
||||||
reorder = context.AnimationReorder();
|
reorder = context.AnimationReorder();
|
||||||
|
|
||||||
|
|
|
@ -252,11 +252,11 @@ namespace Rimworld_Animations {
|
||||||
//all voice options
|
//all voice options
|
||||||
List<VoiceDef> voiceOptions =
|
List<VoiceDef> voiceOptions =
|
||||||
DefDatabase<VoiceDef>.AllDefsListForReading
|
DefDatabase<VoiceDef>.AllDefsListForReading
|
||||||
.FindAll(voiceDef => voice.VoiceFitsPawn(pawn));
|
.FindAll(voiceDef => voiceDef.VoiceFitsPawn(pawn));
|
||||||
|
|
||||||
//all voice options, with priority (for traitdef specific voices)
|
//all voice options, with priority (for traitdef specific voices)
|
||||||
List<VoiceDef> voiceOptionsWithPriority =
|
List<VoiceDef> voiceOptionsWithPriority =
|
||||||
voiceOptions.FindAll(voiceDef => voice.takesPriority);
|
voiceOptions.FindAll(voiceDef => voiceDef.takesPriority);
|
||||||
|
|
||||||
if (!voiceOptionsWithPriority.NullOrEmpty())
|
if (!voiceOptionsWithPriority.NullOrEmpty())
|
||||||
{
|
{
|
||||||
|
|
39
1.5/Source/Voices/VoiceDef.cs
Normal file
39
1.5/Source/Voices/VoiceDef.cs
Normal file
|
@ -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<TraitDef> traits = new List<TraitDef>();
|
||||||
|
public bool takesPriority = false;
|
||||||
|
public float randomChanceFactor = 1;
|
||||||
|
|
||||||
|
public Dictionary<VoiceTagDef, SoundDef> sounds = new Dictionary<VoiceTagDef, SoundDef>();
|
||||||
|
|
||||||
|
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;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
22
1.5/Source/Voices/VoiceDefOf.cs
Normal file
22
1.5/Source/Voices/VoiceDefOf.cs
Normal file
|
@ -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;
|
||||||
|
}
|
||||||
|
}
|
13
1.5/Source/Voices/VoiceTagDef.cs
Normal file
13
1.5/Source/Voices/VoiceTagDef.cs
Normal file
|
@ -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
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue