Fixed player scav not having correct HP values on limbs #642

This commit is contained in:
Chomp
2025-10-31 18:24:30 +00:00
parent f6d9d461a6
commit b92aedbc0c
@@ -70,6 +70,12 @@ public class BotGenerator(
bot = GenerateBot(sessionId, bot, botTemplate, botGenDetails);
// Pscavs in live have same limb hp as their pmc character
if (profile?.Health?.BodyParts is not null)
{
CopyLimbHpValuesToBot(bot, profile.Health.BodyParts);
}
// Sets the name after scav name shown in parentheses
bot.Info.MainProfileNickname = profile.Info.Nickname;
@@ -104,10 +110,19 @@ public class BotGenerator(
WishList = bot.WishList,
MoneyTransferLimitData = bot.MoneyTransferLimitData,
IsPmc = bot.IsPmc,
Prestige = new Dictionary<string, long>(),
Prestige = [],
};
}
protected void CopyLimbHpValuesToBot(BotBase bot, Dictionary<string, BodyPartHealth> bodyParts)
{
foreach (var (partName, partProperties) in bodyParts)
{
bot.Health.BodyParts[partName].Health.Maximum = partProperties.Health.Maximum;
bot.Health.BodyParts[partName].Health.Current = bot.Health.BodyParts[partName].Health.Maximum;
}
}
/// <summary>
/// Create 1 bot of the type/side/difficulty defined in botGenerationDetails
/// </summary>