Move voice code into separte method

Only use scav_* voices for assault type bots
rename vars to be more accurate
This commit is contained in:
Chomp 2021-08-12 21:40:41 +01:00
parent 2678c11924
commit 9b3278a2f9

View File

@ -48,7 +48,7 @@ namespace Generator
{ {
AddVisualAppearanceItems(bot, rawParsedBot); AddVisualAppearanceItems(bot, rawParsedBot);
AddName(bot, rawParsedBot.Info.Nickname); AddName(bot, rawParsedBot.Info.Nickname);
AddVoice(bot, rawParsedBot);
} }
} }
@ -59,6 +59,18 @@ namespace Generator
return rawBots; return rawBots;
} }
private void AddVoice(Bot bot, Datum rawParsedBot)
{
if (bot.botType == BotType.assault || bot.botType == BotType.marksman)
{
if (rawParsedBot.Info.Voice.StartsWith("scav", StringComparison.InvariantCultureIgnoreCase))
{
bot.appearance.voice.AddUnique(rawParsedBot.Info.Voice);
}
}
}
private void AddDifficulties(Bot bot, List<Datum> rawParsedBots) private void AddDifficulties(Bot bot, List<Datum> rawParsedBots)
{ {
var botType = bot.botType; var botType = bot.botType;
@ -103,22 +115,21 @@ namespace Generator
botToUpdate.health.BodyParts.RightLeg.max = firstBotOfDesiredType.Health.BodyParts.RightLeg.Health.Maximum; botToUpdate.health.BodyParts.RightLeg.max = firstBotOfDesiredType.Health.BodyParts.RightLeg.Health.Maximum;
} }
private void AddVisualAppearanceItems(Bot finalAssaultBot, Datum bot) private void AddVisualAppearanceItems(Bot botToUpdate, Datum rawBot)
{ {
finalAssaultBot.appearance.head.AddUnique(bot.Customization.Head); botToUpdate.appearance.head.AddUnique(rawBot.Customization.Head);
finalAssaultBot.appearance.body.AddUnique(bot.Customization.Body); botToUpdate.appearance.body.AddUnique(rawBot.Customization.Body);
finalAssaultBot.appearance.hands.AddUnique(bot.Customization.Hands); botToUpdate.appearance.hands.AddUnique(rawBot.Customization.Hands);
finalAssaultBot.appearance.feet.AddUnique(bot.Customization.Feet); botToUpdate.appearance.feet.AddUnique(rawBot.Customization.Feet);
finalAssaultBot.appearance.voice.AddUnique(bot.Info.Voice);
} }
private void AddName(Bot finalAssaultBot, string nickName) private void AddName(Bot botToUpdate, string nickName)
{ {
var name = nickName.Split(); var name = nickName.Split();
finalAssaultBot.firstName.AddUnique(name[0]); botToUpdate.firstName.AddUnique(name[0]);
if (name.Length > 1) if (name.Length > 1)
{ {
finalAssaultBot.lastName.AddUnique(name[1]); botToUpdate.lastName.AddUnique(name[1]);
} }
} }
} }